Add Exim 4,97
[exim-website.git] / docbook / 4.97 / 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 04 Nov 2023
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.97</revnumber>
22 <date>04 Nov 2023</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2023
27            </year><holder>The Exim Maintainers</holder></copyright>
28 </bookinfo>
29 <chapter id="CHID1">
30 <title>Introduction</title>
31 <indexterm role="variable">
32   <primary><emphasis>$1</emphasis>, <emphasis>$2</emphasis>, etc.</primary>
33   <see><emphasis>numerical variables</emphasis></see>
34 </indexterm>
35 <indexterm role="concept">
36   <primary>address</primary>
37   <secondary>rewriting</secondary>
38   <see><emphasis>rewriting</emphasis></see>
39 </indexterm>
40 <indexterm role="concept">
41   <primary>Bounce Address Tag Validation</primary>
42   <see><emphasis>BATV</emphasis></see>
43 </indexterm>
44 <indexterm role="concept">
45   <primary>Client SMTP Authorization</primary>
46   <see><emphasis>CSA</emphasis></see>
47 </indexterm>
48 <indexterm role="concept">
49   <primary>CR character</primary>
50   <see><emphasis>carriage return</emphasis></see>
51 </indexterm>
52 <indexterm role="concept">
53   <primary>CRL</primary>
54   <see><emphasis>certificate revocation list</emphasis></see>
55 </indexterm>
56 <indexterm role="concept">
57   <primary>de-tainting</primary>
58   <seealso><emphasis>tainted data</emphasis></seealso>
59 </indexterm>
60 <indexterm role="concept">
61   <primary>delivery</primary>
62   <secondary>failure report</secondary>
63   <see><emphasis>bounce message</emphasis></see>
64 </indexterm>
65 <indexterm role="concept">
66   <primary>dialup</primary>
67   <see><emphasis>intermittently connected hosts</emphasis></see>
68 </indexterm>
69 <indexterm role="concept">
70   <primary>exiscan</primary>
71   <see><emphasis>content scanning</emphasis></see>
72 </indexterm>
73 <indexterm role="concept">
74   <primary>fallover</primary>
75   <see><emphasis>fallback</emphasis></see>
76 </indexterm>
77 <indexterm role="concept">
78   <primary>filter</primary>
79   <secondary>Sieve</secondary>
80   <see><emphasis>Sieve filter</emphasis></see>
81 </indexterm>
82 <indexterm role="concept">
83   <primary>headers</primary>
84   <see><emphasis>header lines</emphasis></see>
85 </indexterm>
86 <indexterm role="concept">
87   <primary>ident</primary>
88   <see><emphasis>RFC 1413</emphasis></see>
89 </indexterm>
90 <indexterm role="concept">
91   <primary>LF character</primary>
92   <see><emphasis>linefeed</emphasis></see>
93 </indexterm>
94 <indexterm role="concept">
95   <primary>maximum</primary>
96   <seealso><emphasis>limit</emphasis></seealso>
97 </indexterm>
98 <indexterm role="concept">
99   <primary>monitor</primary>
100   <see><emphasis>Exim monitor</emphasis></see>
101 </indexterm>
102 <indexterm role="concept">
103   <primary>no_<emphasis>xxx</emphasis></primary>
104   <see><emphasis>entry for xxx</emphasis></see>
105 </indexterm>
106 <indexterm role="concept">
107   <primary>NUL</primary>
108   <see><emphasis>binary zero</emphasis></see>
109 </indexterm>
110 <indexterm role="concept">
111   <primary>passwd file</primary>
112   <see><emphasis>/etc/passwd</emphasis></see>
113 </indexterm>
114 <indexterm role="concept">
115   <primary>process id</primary>
116   <see><emphasis>pid</emphasis></see>
117 </indexterm>
118 <indexterm role="concept">
119   <primary>RBL</primary>
120   <see><emphasis>DNS list</emphasis></see>
121 </indexterm>
122 <indexterm role="concept">
123   <primary>redirection</primary>
124   <see><emphasis>address redirection</emphasis></see>
125 </indexterm>
126 <indexterm role="concept">
127   <primary>return path</primary>
128   <see><emphasis>envelope sender</emphasis></see>
129 </indexterm>
130 <indexterm role="concept">
131   <primary>scanning</primary>
132   <see><emphasis>content scanning</emphasis></see>
133 </indexterm>
134 <indexterm role="concept">
135   <primary>SSL</primary>
136   <see><emphasis>TLS</emphasis></see>
137 </indexterm>
138 <indexterm role="concept">
139   <primary>string</primary>
140   <secondary>expansion</secondary>
141   <see><emphasis>expansion</emphasis></see>
142 </indexterm>
143 <indexterm role="concept">
144   <primary>top bit</primary>
145   <see><emphasis>8-bit characters</emphasis></see>
146 </indexterm>
147 <indexterm role="concept">
148   <primary>variables</primary>
149   <see><emphasis>expansion, variables</emphasis></see>
150 </indexterm>
151 <indexterm role="concept">
152   <primary>zero, binary</primary>
153   <see><emphasis>binary zero</emphasis></see>
154 </indexterm>
155 <para>
156 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
157 Unix-like operating systems. It was designed on the assumption that it would be
158 run on hosts that are permanently connected to the Internet. However, it can be
159 used on intermittently connected hosts with suitable configuration adjustments.
160 </para>
161 <para>
162 Configuration files currently exist for the following operating systems: AIX,
163 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
164 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
165 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
166 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and UnixWare.
167 Some of these operating systems are no longer current and cannot easily be
168 tested, so the configuration files may no longer work in practice.
169 </para>
170 <para>
171 There are also configuration files for compiling Exim in the Cygwin environment
172 that can be installed on systems running Windows. However, this document does
173 not contain any information about running Exim in the Cygwin environment.
174 </para>
175 <para>
176 The terms and conditions for the use and distribution of Exim are contained in
177 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
178 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
179 </para>
180 <para>
181 The use, supply, or promotion of Exim for the purpose of sending bulk,
182 unsolicited electronic mail is incompatible with the basic aims of Exim,
183 which revolve around the free provision of a service that enhances the quality
184 of personal communications. The author of Exim regards indiscriminate
185 mass-mailing as an antisocial, irresponsible abuse of the Internet.
186 </para>
187 <para>
188 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
189 experience of running and working on the Smail 3 code, I could never have
190 contemplated starting to write a new MTA. Many of the ideas and user interfaces
191 were originally taken from Smail 3, though the actual code of Exim is entirely
192 new, and has developed far beyond the initial concept.
193 </para>
194 <para>
195 Many people, both in Cambridge and around the world, have contributed to the
196 development and the testing of Exim, and to porting it to various operating
197 systems. I am grateful to them all. The distribution now contains a file called
198 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
199 contributors.
200 </para>
201 <section id="SECID1">
202 <title>Exim documentation</title>
203 <para revisionflag="changed">
204 <indexterm role="concept">
205 <primary>documentation</primary>
206 </indexterm>
207 This edition of the Exim specification applies to version 4.97 of Exim.
208 Substantive changes from the 4.96 edition are marked in some
209 renditions of this document; this paragraph is so marked if the rendition is
210 capable of showing a change indicator.
211 </para>
212 <para>
213 This document is very much a reference manual; it is not a tutorial. The reader
214 is expected to have some familiarity with the SMTP mail transfer protocol and
215 with general Unix system administration. Although there are some discussions
216 and examples in places, the information is mostly organized in a way that makes
217 it easy to look up, rather than in a natural order for sequential reading.
218 Furthermore, this manual aims to cover every aspect of Exim in detail, including
219 a number of rarely-used, special-purpose features that are unlikely to be of
220 very wide interest.
221 </para>
222 <para>
223 <indexterm role="concept">
224 <primary>books about Exim</primary>
225 </indexterm>
226 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
227 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
228 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
229 (<emphasis role="bold"><ulink url="https://www.uit.co.uk/exim-book/">https://www.uit.co.uk/exim-book/</ulink></emphasis>).
230 </para>
231 <para>
232 The book also contains a chapter that gives a general introduction to SMTP and
233 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
234 with the latest release of Exim. (Note that the earlier book about Exim,
235 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
236 </para>
237 <para>
238 <indexterm role="concept">
239 <primary>Debian</primary>
240 <secondary>information sources</secondary>
241 </indexterm>
242 If you are using a Debian distribution of Exim, you will find information about
243 Debian-specific features in the file
244 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
245 The command <command>man update-exim.conf</command> is another source of Debian-specific
246 information.
247 </para>
248 <para>
249 <indexterm role="concept">
250 <primary><filename>doc/NewStuff</filename></primary>
251 </indexterm>
252 <indexterm role="concept">
253 <primary><filename>doc/ChangeLog</filename></primary>
254 </indexterm>
255 <indexterm role="concept">
256 <primary>change log</primary>
257 </indexterm>
258 As Exim develops, there may be features in newer versions that have not
259 yet made it into this document, which is updated only when the most significant
260 digit of the fractional part of the version number changes. Specifications of
261 new features that are not yet in this manual are placed in the file
262 <filename>doc/NewStuff</filename> in the Exim distribution.
263 </para>
264 <para>
265 Some features may be classified as <quote>experimental</quote>. These may change
266 incompatibly while they are developing, or even be withdrawn. For this reason,
267 they are not documented in this manual. Information about experimental features
268 can be found in the file <filename>doc/experimental.txt</filename>.
269 </para>
270 <para>
271 All changes to Exim (whether new features, bug fixes, or other kinds of
272 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
273 </para>
274 <para>
275 <indexterm role="concept">
276 <primary><filename>doc/spec.txt</filename></primary>
277 </indexterm>
278 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
279 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
280 directory are:
281 </para>
282 <informaltable frame="none">
283 <tgroup cols="2" colsep="0" rowsep="0">
284 <colspec colwidth="100pt" align="left"/>
285 <colspec colwidth="254pt" align="left"/>
286 <tbody>
287 <row>
288 <entry><filename>OptionLists.txt</filename></entry>
289 <entry>list of all options in alphabetical order</entry>
290 </row>
291 <row>
292 <entry><filename>dbm.discuss.txt</filename></entry>
293 <entry>discussion about DBM libraries</entry>
294 </row>
295 <row>
296 <entry><filename>exim.8</filename></entry>
297 <entry>a man page of Exim&#x2019;s command line options</entry>
298 </row>
299 <row>
300 <entry><filename>experimental.txt</filename></entry>
301 <entry>documentation of experimental features</entry>
302 </row>
303 <row>
304 <entry><filename>filter.txt</filename></entry>
305 <entry>specification of the filter language</entry>
306 </row>
307 <row>
308 <entry><filename>Exim3.upgrade</filename></entry>
309 <entry>upgrade notes from release 2 to release 3</entry>
310 </row>
311 <row>
312 <entry><filename>Exim4.upgrade</filename></entry>
313 <entry>upgrade notes from release 3 to release 4</entry>
314 </row>
315 <row>
316 <entry><filename>openssl.txt</filename></entry>
317 <entry>installing a current OpenSSL release</entry>
318 </row>
319 </tbody>
320 </tgroup>
321 </informaltable>
322 <para>
323 The main specification and the specification of the filtering language are also
324 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
325 <xref linkend="SECTavail"/> below tells you how to get hold of these.
326 </para>
327 </section>
328 <section id="SECID2">
329 <title>FTP site and websites</title>
330 <para>
331 <indexterm role="concept">
332 <primary>website</primary>
333 </indexterm>
334 <indexterm role="concept">
335 <primary>FTP site</primary>
336 </indexterm>
337 The primary site for Exim source distributions is the <option>exim.org</option> FTP site,
338 available over HTTPS, HTTP and FTP.  These services, and the <option>exim.org</option>
339 website, are hosted at the University of Cambridge.
340 </para>
341 <para>
342 <indexterm role="concept">
343 <primary>wiki</primary>
344 </indexterm>
345 <indexterm role="concept">
346 <primary>FAQ</primary>
347 </indexterm>
348 As well as Exim distribution tar files, the Exim website contains a number of
349 differently formatted versions of the documentation. A recent addition to the
350 online information is the Exim wiki (<emphasis role="bold"><ulink url="https://wiki.exim.org">https://wiki.exim.org</ulink></emphasis>),
351 which contains what used to be a separate FAQ, as well as various other
352 examples, tips, and know-how that have been contributed by Exim users.
353 The wiki site should always redirect to the correct place, which is currently
354 provided by GitHub, and is open to editing by anyone with a GitHub account.
355 </para>
356 <para>
357 <indexterm role="concept">
358 <primary>Bugzilla</primary>
359 </indexterm>
360 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>. You can use
361 this to report bugs, and also to add items to the wish list. Please search
362 first to check that you are not duplicating a previous entry.
363 Please do not ask for configuration help in the bug-tracker.
364 </para>
365 </section>
366 <section id="SECID3">
367 <title>Mailing lists</title>
368 <para>
369 <indexterm role="concept">
370 <primary>mailing lists</primary>
371 <secondary>for Exim users</secondary>
372 </indexterm>
373 The following Exim mailing lists exist:
374 </para>
375 <informaltable frame="none">
376 <tgroup cols="2" colsep="0" rowsep="0">
377 <colspec colwidth="140pt" align="left"/>
378 <colspec colwidth="254pt" align="left"/>
379 <tbody>
380 <row>
381 <entry><emphasis>exim-announce@lists.exim.org</emphasis></entry>
382 <entry>Moderated, low volume announcements list</entry>
383 </row>
384 <row>
385 <entry><emphasis>exim-users@lists.exim.org</emphasis></entry>
386 <entry>General discussion list</entry>
387 </row>
388 <row>
389 <entry><emphasis>exim-users-de@lists.exim.org</emphasis></entry>
390 <entry>General discussion list in German language</entry>
391 </row>
392 <row>
393 <entry><emphasis>exim-dev@lists.exim.org</emphasis></entry>
394 <entry>Discussion of bugs, enhancements, etc.</entry>
395 </row>
396 <row>
397 <entry><emphasis>exim-cvs@lists.exim.org</emphasis></entry>
398 <entry>Automated commit messages from the VCS</entry>
399 </row>
400 </tbody>
401 </tgroup>
402 </informaltable>
403 <para>
404 You can subscribe to these lists, change your existing subscriptions, and view
405 or search the archives via the mailing lists link on the Exim home page.
406 <indexterm role="concept">
407 <primary>Debian</primary>
408 <secondary>mailing list for</secondary>
409 </indexterm>
410 If you are using a Debian distribution of Exim, you may wish to subscribe to
411 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
412 via this web page:
413 </para>
414 <literallayout>
415 <emphasis role="bold"><ulink url="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exim4-users">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
416 </literallayout>
417 <para>
418 Please ask Debian-specific questions on that list and not on the general Exim
419 lists.
420 </para>
421 </section>
422 <section id="SECID5">
423 <title>Bug reports</title>
424 <para>
425 <indexterm role="concept">
426 <primary>bug reports</primary>
427 </indexterm>
428 <indexterm role="concept">
429 <primary>reporting bugs</primary>
430 </indexterm>
431 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
432 via the Bugzilla (<emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>). However, if you are unsure
433 whether some behaviour is a bug or not, the best thing to do is to post a
434 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
435 </para>
436 </section>
437 <section id="SECTavail">
438 <title>Where to find the Exim distribution</title>
439 <para>
440 <indexterm role="concept">
441 <primary>FTP site</primary>
442 </indexterm>
443 <indexterm role="concept">
444 <primary>HTTPS download site</primary>
445 </indexterm>
446 <indexterm role="concept">
447 <primary>distribution</primary>
448 <secondary>FTP site</secondary>
449 </indexterm>
450 <indexterm role="concept">
451 <primary>distribution</primary>
452 <secondary>https site</secondary>
453 </indexterm>
454 The master distribution site for the Exim distribution is
455 </para>
456 <literallayout>
457 <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis>
458 </literallayout>
459 <para>
460 The service is available over HTTPS, HTTP and FTP.
461 We encourage people to migrate to HTTPS.
462 </para>
463 <para>
464 The content served at <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis> is identical to the
465 content served at <emphasis role="bold"><ulink url="https://ftp.exim.org/pub/exim">https://ftp.exim.org/pub/exim</ulink></emphasis> and
466 <emphasis role="bold"><ulink url="ftp://ftp.exim.org/pub/exim">ftp://ftp.exim.org/pub/exim</ulink></emphasis>.
467 </para>
468 <para>
469 If accessing via a hostname containing <emphasis>ftp</emphasis>, then the file references that
470 follow are relative to the <filename>exim</filename> directories at these sites.
471 If accessing via the hostname <emphasis>downloads</emphasis> then the subdirectories described
472 here are top-level directories.
473 </para>
474 <para>
475 There are now quite a number of independent mirror sites around
476 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
477 </para>
478 <para>
479 Within the top exim directory there are subdirectories called <filename>exim3</filename> (for
480 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
481 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
482 subdirectory, the current release can always be found in files called
483 </para>
484 <literallayout>
485 <filename>exim-n.nn.tar.xz</filename>
486 <filename>exim-n.nn.tar.gz</filename>
487 <filename>exim-n.nn.tar.bz2</filename>
488 </literallayout>
489 <para>
490 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The three
491 files contain identical data; the only difference is the type of compression.
492 The <filename>.xz</filename> file is usually the smallest, while the <filename>.gz</filename> file is the
493 most portable to old systems.
494 </para>
495 <para>
496 <indexterm role="concept">
497 <primary>distribution</primary>
498 <secondary>signing details</secondary>
499 </indexterm>
500 <indexterm role="concept">
501 <primary>distribution</primary>
502 <secondary>public key</secondary>
503 </indexterm>
504 <indexterm role="concept">
505 <primary>public key for signed distribution</primary>
506 </indexterm>
507 The distributions will be PGP signed by an individual key of the Release
508 Coordinator.  This key will have a uid containing an email address in the
509 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
510 other Exim maintainers.  We expect that the key will be in the "strong set" of
511 PGP keys.  There should be a trust path to that key from the Exim Maintainer&#x2019;s
512 PGP keys, a version of which can be found in the release directory in the file
513 <filename>Exim-Maintainers-Keyring.asc</filename>.  All keys used will be available in public keyserver pools,
514 such as <emphasis>pool.sks-keyservers.net</emphasis>.
515 </para>
516 <para>
517 At the time of the last update, releases were being made by Jeremy Harris and signed
518 with key <emphasis>0xBCE58C8CE41F32DF</emphasis>.  Other recent keys used for signing are those
519 of Heiko Schlittermann, <emphasis>0x26101B62F69376CE</emphasis>,
520 and of Phil Pennock, <emphasis>0x4D1E900E14C1CC04</emphasis>.
521 </para>
522 <para>
523 The signatures for the tar bundles are in:
524 </para>
525 <literallayout>
526 <filename>exim-n.nn.tar.xz.asc</filename>
527 <filename>exim-n.nn.tar.gz.asc</filename>
528 <filename>exim-n.nn.tar.bz2.asc</filename>
529 </literallayout>
530 <para>
531 For each released version, the log of changes is made available in a
532 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
533 find out what has changed without having to download the entire distribution.
534 </para>
535 <para>
536 <indexterm role="concept">
537 <primary>documentation</primary>
538 <secondary>available formats</secondary>
539 </indexterm>
540 The main distribution contains ASCII versions of this specification and other
541 documentation; other formats of the documents are available in separate files
542 inside the <filename>exim4</filename> directory of the FTP site:
543 </para>
544 <literallayout>
545 <filename>exim-html-n.nn.tar.gz</filename>
546 <filename>exim-pdf-n.nn.tar.gz</filename>
547 <filename>exim-postscript-n.nn.tar.gz</filename>
548 <filename>exim-texinfo-n.nn.tar.gz</filename>
549 </literallayout>
550 <para>
551 These tar files contain only the <filename>doc</filename> directory, not the complete
552 distribution, and are also available in <filename>.bz2</filename> and <filename>.xz</filename> forms.
553 </para>
554 </section>
555 <section id="SECID6">
556 <title>Limitations</title>
557 <itemizedlist>
558 <listitem>
559 <para>
560 <indexterm role="concept">
561 <primary>limitations of Exim</primary>
562 </indexterm>
563 <indexterm role="concept">
564 <primary>bang paths</primary>
565 <secondary>not handled by Exim</secondary>
566 </indexterm>
567 Exim is designed for use as an Internet MTA, and therefore handles addresses in
568 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
569 simple two-component bang paths can be converted by a straightforward rewriting
570 configuration. This restriction does not prevent Exim from being interfaced to
571 UUCP as a transport mechanism, provided that domain addresses are used.
572 </para>
573 </listitem>
574 <listitem>
575 <para>
576 <indexterm role="concept">
577 <primary>domainless addresses</primary>
578 </indexterm>
579 <indexterm role="concept">
580 <primary>address</primary>
581 <secondary>without domain</secondary>
582 </indexterm>
583 Exim insists that every address it handles has a domain attached. For incoming
584 local messages, domainless addresses are automatically qualified with a
585 configured domain value. Configuration options specify from which remote
586 systems unqualified addresses are acceptable. These are then qualified on
587 arrival.
588 </para>
589 </listitem>
590 <listitem>
591 <para>
592 <indexterm role="concept">
593 <primary>transport</primary>
594 <secondary>external</secondary>
595 </indexterm>
596 <indexterm role="concept">
597 <primary>external transports</primary>
598 </indexterm>
599 The only external transport mechanisms that are currently implemented are SMTP
600 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
601 transport is available, and there are facilities for writing messages to files
602 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
603 to send messages to other transport mechanisms such as UUCP, provided they can
604 handle domain-style addresses. Batched SMTP input is also catered for.
605 </para>
606 </listitem>
607 <listitem>
608 <para>
609 Exim is not designed for storing mail for dial-in hosts. When the volumes of
610 such mail are large, it is better to get the messages <quote>delivered</quote> into files
611 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
612 other means.
613 </para>
614 </listitem>
615 <listitem>
616 <para>
617 Although Exim does have basic facilities for scanning incoming messages, these
618 are not comprehensive enough to do full virus or spam scanning. Such operations
619 are best carried out using additional specialized software packages. If you
620 compile Exim with the content-scanning extension, straightforward interfaces to
621 a number of common scanners are provided.
622 </para>
623 </listitem>
624 </itemizedlist>
625 </section>
626 <section id="SECID7">
627 <title>Runtime configuration</title>
628 <para>
629 Exim&#x2019;s runtime configuration is held in a single text file that is divided
630 into a number of sections. The entries in this file consist of keywords and
631 values, in the style of Smail 3 configuration files. A default configuration
632 file which is suitable for simple online installations is provided in the
633 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
634 </para>
635 </section>
636 <section id="SECID8">
637 <title>Calling interface</title>
638 <para>
639 <indexterm role="concept">
640 <primary>Sendmail compatibility</primary>
641 <secondary>command line interface</secondary>
642 </indexterm>
643 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
644 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
645 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
646 about Sendmail in order to run Exim. For actions other than sending messages,
647 Sendmail-compatible options also exist, but those that produce output (for
648 example, <option>-bp</option>, which lists the messages in the queue) do so in Exim&#x2019;s own
649 format. There are also some additional options that are compatible with Smail
650 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
651 documents all Exim&#x2019;s command line options. This information is automatically
652 made into the man page that forms part of the Exim distribution.
653 </para>
654 <para>
655 Control of messages in the queue can be done via certain privileged command
656 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
657 which displays current information in an X window, and which contains a menu
658 interface to Exim&#x2019;s command line administration options.
659 </para>
660 </section>
661 <section id="SECID9">
662 <title>Terminology</title>
663 <para>
664 <indexterm role="concept">
665 <primary>terminology definitions</primary>
666 </indexterm>
667 <indexterm role="concept">
668 <primary>body of message</primary>
669 <secondary>definition of</secondary>
670 </indexterm>
671 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
672 It is the last part of a message and is separated from the <emphasis>header</emphasis> (see
673 below) by a blank line.
674 </para>
675 <para>
676 <indexterm role="concept">
677 <primary>bounce message</primary>
678 <secondary>definition of</secondary>
679 </indexterm>
680 When a message cannot be delivered, it is normally returned to the sender in a
681 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
682 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
683 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
684 failure error report</quote>. Such messages have an empty sender address in the
685 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
686 rise to further bounce messages.
687 </para>
688 <para>
689 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
690 value which is used in the absence of any setting in the configuration. It may
691 also qualify an action which is taken unless a configuration setting specifies
692 otherwise.
693 </para>
694 <para>
695 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
696 destination cannot immediately take place for some reason (a remote host may be
697 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
698 until a later time.
699 </para>
700 <para>
701 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
702 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
703 the part of an email address following the @ sign.
704 </para>
705 <para>
706 <indexterm role="concept">
707 <primary>envelope, definition of</primary>
708 </indexterm>
709 <indexterm role="concept">
710 <primary>sender</primary>
711 <secondary>definition of</secondary>
712 </indexterm>
713 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
714 body. The envelope contains a sender address (to which bounce messages should
715 be delivered), and any number of recipient addresses. References to the
716 sender or the recipients of a message usually mean the addresses in the
717 envelope. An MTA uses these addresses for delivery, and for returning bounce
718 messages, not the addresses that appear in the header lines.
719 </para>
720 <para>
721 <indexterm role="concept">
722 <primary>message</primary>
723 <secondary>header, definition of</secondary>
724 </indexterm>
725 <indexterm role="concept">
726 <primary>header section</primary>
727 <secondary>definition of</secondary>
728 </indexterm>
729 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
730 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
731 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
732 indenting the continuations. The header is separated from the body by a blank
733 line.
734 </para>
735 <para>
736 <indexterm role="concept">
737 <primary>local part</primary>
738 <secondary>definition of</secondary>
739 </indexterm>
740 <indexterm role="concept">
741 <primary>domain</primary>
742 <secondary>definition of</secondary>
743 </indexterm>
744 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to the
745 part of an email address that precedes the @ sign. The part that follows the
746 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
747 </para>
748 <para>
749 <indexterm role="concept">
750 <primary>local delivery</primary>
751 <secondary>definition of</secondary>
752 </indexterm>
753 <indexterm role="concept">
754 <primary>remote delivery, definition of</primary>
755 </indexterm>
756 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
757 delivery to a file or a pipe on the local host from delivery by SMTP over
758 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
759 host it is running on are <emphasis>remote</emphasis>.
760 </para>
761 <para>
762 <indexterm role="concept">
763 <primary>return path</primary>
764 <secondary>definition of</secondary>
765 </indexterm>
766 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
767 message&#x2019;s envelope.
768 </para>
769 <para>
770 <indexterm role="concept">
771 <primary>queue</primary>
772 <secondary>definition of</secondary>
773 </indexterm>
774 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery
775 because this term is in widespread use in the context of MTAs. However, in
776 Exim&#x2019;s case, the reality is more like a pool than a queue, because there is
777 normally no ordering of waiting messages.
778 </para>
779 <para>
780 <indexterm role="concept">
781 <primary>queue runner</primary>
782 <secondary>definition of</secondary>
783 </indexterm>
784 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
785 and attempts to deliver those messages whose retry times have come. This term
786 is used by other MTAs and also relates to the command <option>runq</option>, but in Exim
787 the waiting messages are normally processed in an unpredictable order.
788 </para>
789 <para>
790 <indexterm role="concept">
791 <primary>spool directory</primary>
792 <secondary>definition of</secondary>
793 </indexterm>
794 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
795 messages in its queue &ndash; that is, those that it is in the process of
796 delivering. This should not be confused with the directory in which local
797 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
798 the Exim documentation, <quote>spool</quote> is always used in the first sense.
799 </para>
800 </section>
801 </chapter>
802
803 <chapter id="CHID2">
804 <title>Incorporated code</title>
805 <para>
806 <indexterm role="concept">
807 <primary>incorporated code</primary>
808 </indexterm>
809 <indexterm role="concept">
810 <primary>regular expressions</primary>
811 <secondary>library</secondary>
812 </indexterm>
813 <indexterm role="concept">
814 <primary>PCRE2</primary>
815 </indexterm>
816 <indexterm role="concept">
817 <primary>OpenDMARC</primary>
818 </indexterm>
819 A number of pieces of external code are included in the Exim distribution.
820 </para>
821 <itemizedlist>
822 <listitem>
823 <para>
824 Regular expressions are supported in the main Exim program and in the
825 Exim monitor using the freely-distributable PCRE2 library, copyright
826 &copy; University of Cambridge. The source to PCRE2 is not longer shipped with
827 Exim, so you will need to use the version of PCRE2 shipped with your system,
828 or obtain and install the full version of the library from
829 <emphasis role="bold"><ulink url="https://github.com/PhilipHazel/pcre2/releases">https://github.com/PhilipHazel/pcre2/releases</ulink></emphasis>.
830 </para>
831 </listitem>
832 <listitem>
833 <para>
834 <indexterm role="concept">
835 <primary>cdb</primary>
836 <secondary>acknowledgment</secondary>
837 </indexterm>
838 Support for the cdb (Constant DataBase) lookup method is provided by code
839 contributed by Nigel Metheringham of (at the time he contributed it) Planet
840 Online Ltd. The implementation is completely contained within the code of Exim.
841 It does not link against an external cdb library. The code contains the
842 following statements:
843 </para>
844 <blockquote>
845 <para>
846 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
847 </para>
848 <para>
849 This program is free software; you can redistribute it and/or modify it under
850 the terms of the GNU General Public License as published by the Free Software
851 Foundation; either version 2 of the License, or (at your option) any later
852 version.
853 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
854 the spec and sample code for cdb can be obtained from
855 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>. This implementation borrows
856 some code from Dan Bernstein&#x2019;s implementation (which has no license
857 restrictions applied to it).
858 </para>
859 </blockquote>
860 </listitem>
861 <listitem>
862 <para>
863 <indexterm role="concept">
864 <primary>SPA authentication</primary>
865 </indexterm>
866 <indexterm role="concept">
867 <primary>Samba project</primary>
868 </indexterm>
869 <indexterm role="concept">
870 <primary>Microsoft Secure Password Authentication</primary>
871 </indexterm>
872 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
873 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
874 Tom Kistner. This includes code taken from the Samba project, which is released
875 under the Gnu GPL.
876 </para>
877 </listitem>
878 <listitem>
879 <para>
880 <indexterm role="concept">
881 <primary>Cyrus</primary>
882 </indexterm>
883 <indexterm role="concept">
884 <primary><emphasis>pwcheck</emphasis> daemon</primary>
885 </indexterm>
886 <indexterm role="concept">
887 <primary><emphasis>pwauthd</emphasis> daemon</primary>
888 </indexterm>
889 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
890 by code taken from the Cyrus-SASL library and adapted by Alexander S.
891 Sabourenkov. The permission notice appears below, in accordance with the
892 conditions expressed therein.
893 </para>
894 <blockquote>
895 <para>
896 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
897 </para>
898 <para>
899 Redistribution and use in source and binary forms, with or without
900 modification, are permitted provided that the following conditions
901 are met:
902 </para>
903 <orderedlist numeration="arabic">
904 <listitem>
905 <para>
906 Redistributions of source code must retain the above copyright
907 notice, this list of conditions and the following disclaimer.
908 </para>
909 </listitem>
910 <listitem>
911 <para>
912 Redistributions in binary form must reproduce the above copyright
913 notice, this list of conditions and the following disclaimer in
914 the documentation and/or other materials provided with the
915 distribution.
916 </para>
917 </listitem>
918 <listitem>
919 <para>
920 The name <quote>Carnegie Mellon University</quote> must not be used to
921 endorse or promote products derived from this software without
922 prior written permission. For permission or any other legal
923 details, please contact
924 </para>
925 <literallayout>
926               Office of Technology Transfer
927               Carnegie Mellon University
928               5000 Forbes Avenue
929               Pittsburgh, PA  15213-3890
930               (412) 268-4387, fax: (412) 268-7395
931               tech-transfer@andrew.cmu.edu
932 </literallayout>
933 </listitem>
934 <listitem>
935 <para>
936 Redistributions of any form whatsoever must retain the following
937 acknowledgment:
938 </para>
939 <para>
940 <quote>This product includes software developed by Computing Services
941 at Carnegie Mellon University (<emphasis role="bold"><ulink url="https://www.cmu.edu/computing/">https://www.cmu.edu/computing/</ulink></emphasis>.</quote>
942 </para>
943 <para>
944 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
945 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
946 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
947 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
948 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
949 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
950 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
951 </para>
952 </listitem>
953 </orderedlist>
954 </blockquote>
955 </listitem>
956 <listitem>
957 <para>
958 <indexterm role="concept">
959 <primary>Exim monitor</primary>
960 <secondary>acknowledgment</secondary>
961 </indexterm>
962 <indexterm role="concept">
963 <primary>X-windows</primary>
964 </indexterm>
965 <indexterm role="concept">
966 <primary>Athena</primary>
967 </indexterm>
968 The Exim Monitor program, which is an X-Window application, includes
969 modified versions of the Athena StripChart and TextPop widgets.
970 This code is copyright by DEC and MIT, and their permission notice appears
971 below, in accordance with the conditions expressed therein.
972 </para>
973 <blockquote>
974 <para>
975 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
976 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
977 </para>
978 <para>
979 All Rights Reserved
980 </para>
981 <para>
982 Permission to use, copy, modify, and distribute this software and its
983 documentation for any purpose and without fee is hereby granted,
984 provided that the above copyright notice appear in all copies and that
985 both that copyright notice and this permission notice appear in
986 supporting documentation, and that the names of Digital or MIT not be
987 used in advertising or publicity pertaining to distribution of the
988 software without specific, written prior permission.
989 </para>
990 <para>
991 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
992 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
993 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
994 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
995 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
996 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
997 SOFTWARE.
998 </para>
999 </blockquote>
1000 </listitem>
1001 <listitem>
1002 <para>
1003 <indexterm role="concept">
1004 <primary>opendmarc</primary>
1005 <secondary>acknowledgment</secondary>
1006 </indexterm>
1007 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
1008 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
1009 derived code are indicated in the respective source files. The full OpenDMARC
1010 license is provided in the LICENSE.opendmarc file contained in the distributed
1011 source code.
1012 </para>
1013 </listitem>
1014 <listitem>
1015 <para>
1016 Many people have contributed code fragments, some large, some small, that were
1017 not covered by any specific license requirements. It is assumed that the
1018 contributors are happy to see their code incorporated into Exim under the GPL.
1019 </para>
1020 </listitem>
1021 </itemizedlist>
1022 </chapter>
1023
1024 <chapter id="CHID11">
1025 <title>How Exim receives and delivers mail</title>
1026 <titleabbrev>Receiving and delivering mail</titleabbrev>
1027 <section id="SECID10">
1028 <title>Overall philosophy</title>
1029 <para>
1030 <indexterm role="concept">
1031 <primary>design philosophy</primary>
1032 </indexterm>
1033 Exim is designed to work efficiently on systems that are permanently connected
1034 to the Internet and are handling a general mix of mail. In such circumstances,
1035 most messages can be delivered immediately. Consequently, Exim does not
1036 maintain independent queues of messages for specific domains or hosts, though
1037 it does try to send several messages in a single SMTP connection after a host
1038 has been down, and it also maintains per-host retry information.
1039 </para>
1040 </section>
1041 <section id="SECID11">
1042 <title>Policy control</title>
1043 <para>
1044 <indexterm role="concept">
1045 <primary>policy control</primary>
1046 <secondary>overview</secondary>
1047 </indexterm>
1048 Policy controls are now an important feature of MTAs that are connected to the
1049 Internet. Perhaps their most important job is to stop MTAs from being abused as
1050 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1051 unsolicited junk and want to disguise its source. Exim provides flexible
1052 facilities for specifying policy controls on incoming mail:
1053 </para>
1054 <itemizedlist>
1055 <listitem>
1056 <para>
1057 <indexterm role="concept">
1058 <primary>access control lists (ACLs)</primary>
1059 <secondary>introduction</secondary>
1060 </indexterm>
1061 Exim 4 (unlike previous versions of Exim) implements policy controls on
1062 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1063 series of statements that may either grant or deny access. ACLs can be used at
1064 several places in the SMTP dialogue while receiving a message from a remote
1065 host. However, the most common places are after each RCPT command, and at the
1066 very end of the message. The sysadmin can specify conditions for accepting or
1067 rejecting individual recipients or the entire message, respectively, at these
1068 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1069 error code.
1070 </para>
1071 </listitem>
1072 <listitem>
1073 <para>
1074 An ACL is also available for locally generated, non-SMTP messages. In this
1075 case, the only available actions are to accept or deny the entire message.
1076 </para>
1077 </listitem>
1078 <listitem>
1079 <para>
1080 When Exim is compiled with the content-scanning extension, facilities are
1081 provided in the ACL mechanism for passing the message to external virus and/or
1082 spam scanning software. The result of such a scan is passed back to the ACL,
1083 which can then use it to decide what to do with the message.
1084 </para>
1085 </listitem>
1086 <listitem>
1087 <para>
1088 When a message has been received, either from a remote host or from the local
1089 host, but before the final acknowledgment has been sent, a locally supplied C
1090 function called <function>local_scan()</function> can be run to inspect the message and decide
1091 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1092 is accepted, the list of recipients can be modified by the function.
1093 </para>
1094 </listitem>
1095 <listitem>
1096 <para>
1097 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1098 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1099 Exim to be compiled with the content-scanning extension.
1100 </para>
1101 </listitem>
1102 <listitem>
1103 <para>
1104 After a message has been accepted, a further checking mechanism is available in
1105 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1106 runs at the start of every delivery process.
1107 </para>
1108 </listitem>
1109 </itemizedlist>
1110 </section>
1111 <section id="SECID12">
1112 <title>User filters</title>
1113 <para>
1114 <indexterm role="concept">
1115 <primary>filter</primary>
1116 <secondary>introduction</secondary>
1117 </indexterm>
1118 <indexterm role="concept">
1119 <primary>Sieve filter</primary>
1120 </indexterm>
1121 In a conventional Exim configuration, users are able to run private filters by
1122 setting up appropriate <filename>.forward</filename> files in their home directories. See
1123 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1124 configuration needed to support this, and the separate document entitled
1125 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1126 of filtering are available:
1127 </para>
1128 <itemizedlist>
1129 <listitem>
1130 <para>
1131 Sieve filters are written in the standard filtering language that is defined
1132 by RFC 3028.
1133 </para>
1134 </listitem>
1135 <listitem>
1136 <para>
1137 Exim filters are written in a syntax that is unique to Exim, but which is more
1138 powerful than Sieve, which it pre-dates.
1139 </para>
1140 </listitem>
1141 </itemizedlist>
1142 <para>
1143 User filters are run as part of the routing process, described below.
1144 </para>
1145 </section>
1146 <section id="SECTmessiden">
1147 <title>Message identification</title>
1148 <para>
1149 <indexterm role="concept">
1150 <primary>message ids</primary>
1151 <secondary>details of format</secondary>
1152 </indexterm>
1153 <indexterm role="concept">
1154 <primary>format</primary>
1155 <secondary>of message id</secondary>
1156 </indexterm>
1157 <indexterm role="concept">
1158 <primary>id of message</primary>
1159 </indexterm>
1160 <indexterm role="concept">
1161 <primary>base62</primary>
1162 </indexterm>
1163 <indexterm role="concept">
1164 <primary>base36</primary>
1165 </indexterm>
1166 <indexterm role="concept">
1167 <primary>Darwin</primary>
1168 </indexterm>
1169 <indexterm role="concept">
1170 <primary>Cygwin</primary>
1171 </indexterm>
1172 <indexterm role="concept">
1173 <primary>exim_msgdate</primary>
1174 </indexterm>
1175 Every message handled by Exim is given a <emphasis>message id</emphasis> which is 23
1176 characters long. It is divided into three parts, separated by hyphens, for
1177 example <literal>16VDhn-000000001bo-D342</literal>. Each part is a sequence of letters and digits,
1178 normally encoding numbers in base 62. However, in the Darwin operating
1179 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1180 (avoiding the use of lower case letters) is used instead, because the message
1181 id is used to construct filenames, and the names of files in those systems are
1182 not always case-sensitive.
1183 </para>
1184 <para>
1185 <indexterm role="concept">
1186 <primary>pid (process id)</primary>
1187 <secondary>re-use of</secondary>
1188 </indexterm>
1189 The detail of the contents of the message id have changed as Exim has evolved.
1190 Earlier versions relied on the operating system not re-using a process id (pid)
1191 within one second. On modern operating systems, this assumption can no longer
1192 be made, so the algorithm had to be changed. To retain backward compatibility,
1193 the format of the message id was retained, which is why the following rules are
1194 somewhat eccentric:
1195 </para>
1196 <itemizedlist>
1197 <listitem>
1198 <para>
1199 The first six characters of the message id are the time at which the message
1200 started to be received, to a granularity of one second. That is, this field
1201 contains the number of seconds since the start of the epoch (the normal Unix
1202 way of representing the date and time of day).
1203 </para>
1204 </listitem>
1205 <listitem>
1206 <para>
1207 After the first hyphen, the next
1208 </para>
1209 <para revisionflag="changed">
1210 eleven
1211 </para>
1212 <para>
1213 characters are the id of the process that received the message.
1214 </para>
1215 </listitem>
1216 <listitem>
1217 <para revisionflag="changed">
1218 There are two different possibilities for the final four characters:
1219 </para>
1220 <orderedlist numeration="arabic" revisionflag="changed">
1221 <listitem>
1222 <para revisionflag="changed">
1223 <indexterm role="option">
1224 <primary><option>localhost_number</option></primary>
1225 </indexterm>
1226 If <option>localhost_number</option> is not set, this value is the fractional part of the
1227 time of reception, normally in units of
1228 microseconds.
1229 but for systems
1230 that must use base 36 instead of base 62 (because of case-insensitive file
1231 systems), the units are
1232 2 us.
1233 </para>
1234 </listitem>
1235 <listitem>
1236 <para revisionflag="changed">
1237 If <option>localhost_number</option> is set, it is multiplied by
1238 500000 (250000) and added to
1239 the fractional part of the time, which in this case is in units of 2 us (4 us).
1240 </para>
1241 </listitem>
1242 </orderedlist>
1243 </listitem>
1244 </itemizedlist>
1245 <para>
1246 After a message has been received, Exim waits for the clock to tick at the
1247 appropriate resolution before proceeding, so that if another message is
1248 received by the same process, or by another process with the same (re-used)
1249 pid, it is guaranteed that the time will be different. In most cases, the clock
1250 will already have ticked while the message was being received.
1251 </para>
1252 <para>
1253 The exim_msgdate utility (see section <xref linkend="SECTexim_msgdate"/>) can be
1254 used to display the date, and optionally the process id, of an Exim
1255 Message ID.
1256 </para>
1257 </section>
1258 <section id="SECID13">
1259 <title>Receiving mail</title>
1260 <para>
1261 <indexterm role="concept">
1262 <primary>receiving mail</primary>
1263 </indexterm>
1264 <indexterm role="concept">
1265 <primary>message</primary>
1266 <secondary>reception</secondary>
1267 </indexterm>
1268 The only way Exim can receive mail from another host is using SMTP over
1269 TCP/IP, in which case the sender and recipient addresses are transferred using
1270 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1271 there are several possibilities:
1272 </para>
1273 <itemizedlist>
1274 <listitem>
1275 <para>
1276 If the process runs Exim with the <option>-bm</option> option, the message is read
1277 non-interactively (usually via a pipe), with the recipients taken from the
1278 command line, or from the body of the message if <option>-t</option> is also used.
1279 </para>
1280 </listitem>
1281 <listitem>
1282 <para>
1283 If the process runs Exim with the <option>-bS</option> option, the message is also read
1284 non-interactively, but in this case the recipients are listed at the start of
1285 the message in a series of SMTP RCPT commands, terminated by a DATA
1286 command. This is called <quote>batch SMTP</quote> format,
1287 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1288 envelope addresses in a non-interactive submission.
1289 </para>
1290 </listitem>
1291 <listitem>
1292 <para>
1293 If the process runs Exim with the <option>-bs</option> option, the message is read
1294 interactively, using the SMTP protocol. A two-way pipe is normally used for
1295 passing data between the local process and the Exim process.
1296 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1297 example, the ACLs for SMTP commands are used for this form of submission.
1298 </para>
1299 </listitem>
1300 <listitem>
1301 <para>
1302 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1303 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1304 does not treat the loopback address specially. It treats all such connections
1305 in the same way as connections from other hosts.
1306 </para>
1307 </listitem>
1308 </itemizedlist>
1309 <para>
1310 <indexterm role="concept">
1311 <primary>message sender, constructed by Exim</primary>
1312 </indexterm>
1313 <indexterm role="concept">
1314 <primary>sender</primary>
1315 <secondary>constructed by Exim</secondary>
1316 </indexterm>
1317 In the three cases that do not involve TCP/IP, the sender address is
1318 constructed from the login name of the user that called Exim and a default
1319 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1320 option). For local or batch SMTP, a sender address that is passed using the
1321 SMTP MAIL command is ignored. However, the system administrator may allow
1322 certain users (<quote>trusted users</quote>) to specify a different sender addresses
1323 unconditionally, or all users to specify certain forms of different sender
1324 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1325 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1326 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1327 users to change sender addresses.
1328 </para>
1329 <para>
1330 Messages received by either of the non-interactive mechanisms are subject to
1331 checking by the non-SMTP ACL if one is defined. Messages received using SMTP
1332 (either over TCP/IP or interacting with a local process) can be checked by a
1333 number of ACLs that operate at different times during the SMTP session. Either
1334 individual recipients or the entire message can be rejected if local policy
1335 requirements are not met. The <function>local_scan()</function> function (see chapter
1336 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1337 </para>
1338 <para>
1339 Exim can be configured not to start a delivery process when a message is
1340 received; this can be unconditional, or depend on the number of incoming SMTP
1341 connections or the system load. In these situations, new messages wait on the
1342 queue until a queue runner process picks them up. However, in standard
1343 configurations under normal conditions, delivery is started as soon as a
1344 message is received.
1345 </para>
1346 </section>
1347 <section id="SECID14">
1348 <title>Handling an incoming message</title>
1349 <para>
1350 <indexterm role="concept">
1351 <primary>spool directory</primary>
1352 <secondary>files that hold a message</secondary>
1353 </indexterm>
1354 <indexterm role="concept">
1355 <primary>file</primary>
1356 <secondary>how a message is held</secondary>
1357 </indexterm>
1358 When Exim accepts a message, it writes two files in its spool directory. The
1359 first contains the envelope information, the current status of the message, and
1360 the header lines, and the second contains the body of the message. The names of
1361 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1362 file containing the envelope and header, and <literal>-D</literal> for the data file.
1363 </para>
1364 <para>
1365 <indexterm role="concept">
1366 <primary>spool directory</primary>
1367 <secondary><filename>input</filename> sub-directory</secondary>
1368 </indexterm>
1369 By default, all these message files are held in a single directory called
1370 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1371 not perform very well if the number of files in a directory gets large; to
1372 improve performance in such cases, the <option>split_spool_directory</option> option can be
1373 used. This causes Exim to split up the input files into 62 sub-directories
1374 whose names are single letters or digits. When this is done, the queue is
1375 processed one sub-directory at a time instead of all at once, which can improve
1376 overall performance even when there are not enough files in each directory to
1377 affect file system performance.
1378 </para>
1379 <para>
1380 The envelope information consists of the address of the message&#x2019;s sender and
1381 the addresses of the recipients. This information is entirely separate from
1382 any addresses contained in the header lines. The status of the message includes
1383 a list of recipients who have already received the message. The format of the
1384 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1385 </para>
1386 <para>
1387 <indexterm role="concept">
1388 <primary>rewriting</primary>
1389 <secondary>addresses</secondary>
1390 </indexterm>
1391 Address rewriting that is specified in the rewrite section of the configuration
1392 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1393 both in the header lines and the envelope, at the time the message is accepted.
1394 If during the course of delivery additional addresses are generated (for
1395 example, via aliasing), these new addresses are rewritten as soon as they are
1396 generated. At the time a message is actually delivered (transported) further
1397 rewriting can take place; because this is a transport option, it can be
1398 different for different forms of delivery. It is also possible to specify the
1399 addition or removal of certain header lines at the time the message is
1400 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1401 <xref linkend="CHAPtransportgeneric"/>).
1402 </para>
1403 </section>
1404 <section id="SECID15">
1405 <title>Life of a message</title>
1406 <para>
1407 <indexterm role="concept">
1408 <primary>message</primary>
1409 <secondary>life of</secondary>
1410 </indexterm>
1411 <indexterm role="concept">
1412 <primary>message</primary>
1413 <secondary>frozen</secondary>
1414 </indexterm>
1415 A message remains in the spool directory until it is completely delivered to
1416 its recipients or to an error address, or until it is deleted by an
1417 administrator or by the user who originally created it. In cases when delivery
1418 cannot proceed &ndash; for example when a message can neither be delivered to its
1419 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1420 spool, and no more deliveries are attempted.
1421 </para>
1422 <para>
1423 <indexterm role="concept">
1424 <primary>frozen messages</primary>
1425 <secondary>thawing</secondary>
1426 </indexterm>
1427 <indexterm role="concept">
1428 <primary>message</primary>
1429 <secondary>thawing frozen</secondary>
1430 </indexterm>
1431 An administrator can <quote>thaw</quote> such messages when the problem has been
1432 corrected, and can also freeze individual messages by hand if necessary. In
1433 addition, an administrator can force a delivery error, causing a bounce message
1434 to be sent.
1435 </para>
1436 <para>
1437 <indexterm role="option">
1438 <primary><option>timeout_frozen_after</option></primary>
1439 </indexterm>
1440 <indexterm role="option">
1441 <primary><option>ignore_bounce_errors_after</option></primary>
1442 </indexterm>
1443 There are options called <option>ignore_bounce_errors_after</option> and
1444 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1445 The first applies only to frozen bounces, the second to all frozen messages.
1446 </para>
1447 <para>
1448 <indexterm role="concept">
1449 <primary>message</primary>
1450 <secondary>log file for</secondary>
1451 </indexterm>
1452 <indexterm role="concept">
1453 <primary>log</primary>
1454 <secondary>file for each message</secondary>
1455 </indexterm>
1456 While Exim is working on a message, it writes information about each delivery
1457 attempt to its main log file. This includes successful, unsuccessful, and
1458 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1459 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1460 These logs are solely for the benefit of the administrator and are normally
1461 deleted along with the spool files when processing of a message is complete.
1462 The use of individual message logs can be disabled by setting
1463 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1464 systems.
1465 </para>
1466 <para>
1467 <indexterm role="concept">
1468 <primary>journal file</primary>
1469 </indexterm>
1470 <indexterm role="concept">
1471 <primary>file</primary>
1472 <secondary>journal</secondary>
1473 </indexterm>
1474 All the information Exim itself needs to set up a delivery is kept in the first
1475 spool file, along with the header lines. When a successful delivery occurs, the
1476 address is immediately written at the end of a journal file, whose name is the
1477 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1478 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1479 is updated to indicate which these are, and the journal file is then deleted.
1480 Updating the spool file is done by writing a new file and renaming it, to
1481 minimize the possibility of data loss.
1482 </para>
1483 <para>
1484 Should the system or Exim crash after a successful delivery but before
1485 the spool file has been updated, the journal is left lying around. The next
1486 time Exim attempts to deliver the message, it reads the journal file and
1487 updates the spool file before proceeding. This minimizes the chances of double
1488 deliveries caused by crashes.
1489 </para>
1490 </section>
1491 <section id="SECTprocaddress">
1492 <title>Processing an address for delivery</title>
1493 <para>
1494 <indexterm role="concept">
1495 <primary>drivers</primary>
1496 <secondary>definition of</secondary>
1497 </indexterm>
1498 <indexterm role="concept">
1499 <primary>router</primary>
1500 <secondary>definition of</secondary>
1501 </indexterm>
1502 <indexterm role="concept">
1503 <primary>transport</primary>
1504 <secondary>definition of</secondary>
1505 </indexterm>
1506 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1507 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1508 number of them is provided in the source distribution, and compile-time options
1509 specify which ones are included in the binary. Runtime options specify which
1510 ones are actually used for delivering messages.
1511 </para>
1512 <para>
1513 <indexterm role="concept">
1514 <primary>drivers</primary>
1515 <secondary>instance definition</secondary>
1516 </indexterm>
1517 Each driver that is specified in the runtime configuration is an <emphasis>instance</emphasis>
1518 of that particular driver type. Multiple instances are allowed; for example,
1519 you can set up several different <command>smtp</command> transports, each with different
1520 option values that might specify different ports or different timeouts. Each
1521 instance has its own identifying name. In what follows we will normally use the
1522 instance name when discussing one particular instance (that is, one specific
1523 configuration of the driver), and the generic driver name when discussing
1524 the driver&#x2019;s features in general.
1525 </para>
1526 <para>
1527 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1528 its delivery should happen, by assigning it to a specific transport, or
1529 converting the address into one or more new addresses (for example, via an
1530 alias file). A router may also explicitly choose to fail an address, causing it
1531 to be bounced.
1532 </para>
1533 <para>
1534 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1535 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1536 transport, the destination is a file or a pipe on the local host, whereas for a
1537 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1538 to a specific transport as a result of successful routing. If a message has
1539 several recipients, it may be passed to a number of different transports.
1540 </para>
1541 <para>
1542 <indexterm role="concept">
1543 <primary>preconditions</primary>
1544 <secondary>definition of</secondary>
1545 </indexterm>
1546 An address is processed by passing it to each configured router instance in
1547 turn, subject to certain preconditions, until a router accepts the address or
1548 specifies that it should be bounced. We will describe this process in more
1549 detail shortly. First, as a simple example, we consider how each recipient
1550 address in a message is processed in a small configuration of three routers.
1551 </para>
1552 <para>
1553 To make this a more concrete example, it is described in terms of some actual
1554 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1555 routers in many different ways, and there may be any number of routers in a
1556 configuration.
1557 </para>
1558 <para>
1559 The first router that is specified in a configuration is often one that handles
1560 addresses in domains that are not recognized specifically by the local host.
1561 Typically these are addresses for arbitrary domains on the Internet. A precondition
1562 is set up which looks for the special domains known to the host (for example,
1563 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1564 match. Typically, this is a router that looks up domains in the DNS in order to
1565 find the hosts to which this address routes. If it succeeds, the address is
1566 assigned to a suitable SMTP transport; if it does not succeed, the router is
1567 configured to fail the address.
1568 </para>
1569 <para>
1570 The second router is reached only when the domain is recognized as one that
1571 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1572 aliasing and forwarding. When it generates one or more new addresses from the
1573 original, each of them is routed independently from the start. Otherwise, the
1574 router may cause an address to fail, or it may simply decline to handle the
1575 address, in which case the address is passed to the next router.
1576 </para>
1577 <para>
1578 The final router in many configurations is one that checks to see if the
1579 address belongs to a local mailbox. The precondition may involve a check to
1580 see if the local part is the name of a login account, or it may look up the
1581 local part in a file or a database. If its preconditions are not met, or if
1582 the router declines, we have reached the end of the routers. When this happens,
1583 the address is bounced.
1584 </para>
1585 </section>
1586 <section id="SECID16">
1587 <title>Processing an address for verification</title>
1588 <para>
1589 <indexterm role="concept">
1590 <primary>router</primary>
1591 <secondary>for verification</secondary>
1592 </indexterm>
1593 <indexterm role="concept">
1594 <primary>verifying address</primary>
1595 <secondary>overview</secondary>
1596 </indexterm>
1597 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1598 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1599 one of the checks to be performed in an ACL for incoming messages, on both
1600 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1601 <option>-bvs</option> command line options.
1602 </para>
1603 <para>
1604 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1605 does not affect the way the routers work, but it is a state that can be
1606 detected. By this means, a router can be skipped or made to behave differently
1607 when verifying. A common example is a configuration in which the first router
1608 sends all messages to a message-scanning program unless they have been
1609 previously scanned. Thus, the first router accepts all addresses without any
1610 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1611 would be set for such a router, causing it to be skipped in verify mode.
1612 </para>
1613 </section>
1614 <section id="SECTrunindrou">
1615 <title>Running an individual router</title>
1616 <para>
1617 <indexterm role="concept">
1618 <primary>router</primary>
1619 <secondary>running details</secondary>
1620 </indexterm>
1621 <indexterm role="concept">
1622 <primary>preconditions</primary>
1623 <secondary>checking</secondary>
1624 </indexterm>
1625 <indexterm role="concept">
1626 <primary>router</primary>
1627 <secondary>result of running</secondary>
1628 </indexterm>
1629 As explained in the example above, a number of preconditions are checked before
1630 running a router. If any are not met, the router is skipped, and the address is
1631 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1632 the router is run. What happens next depends on the outcome, which is one of
1633 the following:
1634 </para>
1635 <itemizedlist>
1636 <listitem>
1637 <para>
1638 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1639 transport or generates one or more <quote>child</quote> addresses. Processing the
1640 original address ceases
1641 <indexterm role="option">
1642 <primary><option>unseen</option></primary>
1643 </indexterm>
1644 unless the <option>unseen</option> option is set on the router. This option
1645 can be used to set up multiple deliveries with different routing (for example,
1646 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1647 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1648 end of routing.
1649 </para>
1650 <para>
1651 Any child addresses generated by the router are processed independently,
1652 starting with the first router by default. It is possible to change this by
1653 setting the <option>redirect_router</option> option to specify which router to start at for
1654 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1655 <option>redirect_router</option> may be anywhere in the router configuration.
1656 </para>
1657 </listitem>
1658 <listitem>
1659 <para>
1660 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1661 requests that the address be passed to another router. By default, the address
1662 is passed to the next router, but this can be changed by setting the
1663 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1664 must be below the current router (to avoid loops).
1665 </para>
1666 </listitem>
1667 <listitem>
1668 <para>
1669 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1670 recognize it at all. By default, the address is passed to the next router, but
1671 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1672 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1673 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1674 </para>
1675 </listitem>
1676 <listitem>
1677 <para>
1678 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1679 the generation of a bounce message. There is no further processing of the
1680 original address unless <option>unseen</option> is set on the router.
1681 </para>
1682 </listitem>
1683 <listitem>
1684 <para>
1685 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1686 database may be offline, or a DNS lookup may have timed out.) No further
1687 processing of the address happens in this delivery attempt. It is tried again
1688 next time the message is considered for delivery.
1689 </para>
1690 </listitem>
1691 <listitem>
1692 <para>
1693 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1694 its configuration). The action is as for defer.
1695 </para>
1696 </listitem>
1697 </itemizedlist>
1698 <para>
1699 If an address reaches the end of the routers without having been accepted by
1700 any of them, it is bounced as unrouteable. The default error message in this
1701 situation is <quote>unrouteable address</quote>, but you can set your own message by
1702 making use of the <option>cannot_route_message</option> option. This can be set for any
1703 router; the value from the last router that <quote>saw</quote> the address is used.
1704 </para>
1705 <para>
1706 Sometimes while routing you want to fail a delivery when some conditions are
1707 met but others are not, instead of passing the address on for further routing.
1708 You can do this by having a second router that explicitly fails the delivery
1709 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1710 facility for this purpose.
1711 </para>
1712 </section>
1713 <section id="SECID17">
1714 <title>Duplicate addresses</title>
1715 <para>
1716 <indexterm role="concept">
1717 <primary>case of local parts</primary>
1718 </indexterm>
1719 <indexterm role="concept">
1720 <primary>address duplicate, discarding</primary>
1721 </indexterm>
1722 <indexterm role="concept">
1723 <primary>duplicate addresses</primary>
1724 </indexterm>
1725 Once routing is complete, Exim scans the addresses that are assigned to local
1726 and remote transports and discards any duplicates that it finds. During this
1727 check, local parts are treated case-sensitively. This happens only when
1728 actually delivering a message; when testing routers with <option>-bt</option>, all the
1729 routed addresses are shown.
1730 </para>
1731 </section>
1732 <section id="SECTrouprecon">
1733 <title>Router preconditions</title>
1734 <para>
1735 <indexterm role="concept">
1736 <primary>router</primary>
1737 <secondary>preconditions, order of processing</secondary>
1738 </indexterm>
1739 <indexterm role="concept">
1740 <primary>preconditions</primary>
1741 <secondary>order of processing</secondary>
1742 </indexterm>
1743 The preconditions that are tested for each router are listed below, in the
1744 order in which they are tested. The individual configuration options are
1745 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1746 </para>
1747 <orderedlist numeration="arabic">
1748 <listitem>
1749 <para>
1750 <indexterm role="concept">
1751 <primary>affix</primary>
1752 <secondary>router precondition</secondary>
1753 </indexterm>
1754 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1755 the local parts handled by the router may or must have certain prefixes and/or
1756 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1757 skipped. These conditions are tested first. When an affix is present, it is
1758 removed from the local part before further processing, including the evaluation
1759 of any other conditions.
1760 </para>
1761 </listitem>
1762 <listitem>
1763 <para>
1764 Routers can be designated for use only when not verifying an address, that is,
1765 only when routing it for delivery (or testing its delivery routing). If the
1766 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1767 address.
1768 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1769 <option>verify_recipient</option>, which independently control the use of the router for
1770 sender and recipient verification. You can set these options directly if
1771 you want a router to be used for only one type of verification.
1772 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1773 </para>
1774 </listitem>
1775 <listitem>
1776 <para>
1777 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1778 run with the <option>-bt</option> option to test an address routing. This can be helpful
1779 when the first router sends all new messages to a scanner of some sort; it
1780 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1781 having to simulate the effect of the scanner.
1782 </para>
1783 </listitem>
1784 <listitem>
1785 <para>
1786 Routers can be designated for use only when verifying an address, as
1787 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1788 Again, cutthrough delivery counts as a verification.
1789 </para>
1790 </listitem>
1791 <listitem>
1792 <para>
1793 Individual routers can be explicitly skipped when running the routers to
1794 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1795 </para>
1796 </listitem>
1797 <listitem>
1798 <para>
1799 If the <option>domains</option> option is set, the domain of the address must be in the set
1800 of domains that it defines.
1801 <indexterm role="concept">
1802 <primary>tainted data</primary>
1803 <secondary>de-tainting</secondary>
1804 </indexterm>
1805 <indexterm role="concept">
1806 <primary>de-tainting</primary>
1807 <secondary>using router domains option</secondary>
1808 </indexterm>
1809 A match verifies the variable <varname>$domain</varname> (which carries tainted data)
1810 and assigns an untainted value to the <varname>$domain_data</varname> variable.
1811 Such an untainted value is often needed in the transport.
1812 For specifics of the matching operation and the resulting untainted value,
1813 refer to section <xref linkend="SECTdomainlist"/>.
1814 </para>
1815 <para>
1816 When an untainted value is wanted, use this option
1817 rather than the generic <option>condition</option> option.
1818 </para>
1819 </listitem>
1820 <listitem>
1821 <para>
1822 <indexterm role="variable">
1823 <primary><varname>$local_part_prefix</varname></primary>
1824 </indexterm>
1825 <indexterm role="variable">
1826 <primary><varname>$local_part_prefix_v</varname></primary>
1827 </indexterm>
1828 <indexterm role="variable">
1829 <primary><varname>$local_part</varname></primary>
1830 </indexterm>
1831 <indexterm role="variable">
1832 <primary><varname>$local_part_suffix</varname></primary>
1833 </indexterm>
1834 <indexterm role="variable">
1835 <primary><varname>$local_part_suffix_v</varname></primary>
1836 </indexterm>
1837 <indexterm role="concept">
1838 <primary>affix</primary>
1839 <secondary>router precondition</secondary>
1840 </indexterm>
1841 If the <option>local_parts</option> option is set, the local part of the address must be in
1842 the set of local parts that it defines.
1843 A match verifies the variable <varname>$local_part</varname> (which carries tainted data)
1844 and assigns an untainted value to the <varname>$local_part_data</varname> variable.
1845 Such an untainted value is often needed in the transport.
1846 For specifics of the matching operation and the resulting untainted value,
1847 refer to section <xref linkend="SECTlocparlis"/>.
1848 </para>
1849 <para>
1850 When an untainted value is wanted, use this option
1851 rather than the generic <option>condition</option> option.
1852 </para>
1853 <para>
1854 If <option>local_part_prefix</option> or
1855 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1856 part before this check. If you want to do precondition tests on local parts
1857 that include affixes, you can do so by using a <option>condition</option> option (see below)
1858 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>,
1859 <varname>$local_part_prefix_v</varname>, <varname>$local_part_suffix</varname>
1860 and <varname>$local_part_suffix_v</varname> as necessary.
1861 </para>
1862 </listitem>
1863 <listitem>
1864 <para>
1865 <indexterm role="variable">
1866 <primary><varname>$local_user_uid</varname></primary>
1867 </indexterm>
1868 <indexterm role="variable">
1869 <primary><varname>$local_user_gid</varname></primary>
1870 </indexterm>
1871 <indexterm role="variable">
1872 <primary><varname>$home</varname></primary>
1873 </indexterm>
1874 If the <option>check_local_user</option> option is set, the local part must be the name of
1875 an account on the local host. If this check succeeds, the uid and gid of the
1876 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1877 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1878 remaining preconditions.
1879 </para>
1880 </listitem>
1881 <listitem>
1882 <para>
1883 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1884 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1885 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1886 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1887 could lead to confusion.
1888 </para>
1889 </listitem>
1890 <listitem>
1891 <para>
1892 If the <option>senders</option> option is set, the envelope sender address must be in the
1893 set of addresses that it defines.
1894 </para>
1895 </listitem>
1896 <listitem>
1897 <para>
1898 If the <option>require_files</option> option is set, the existence or non-existence of
1899 specified files is tested.
1900 </para>
1901 </listitem>
1902 <listitem>
1903 <para>
1904 <indexterm role="concept">
1905 <primary>customizing</primary>
1906 <secondary>precondition</secondary>
1907 </indexterm>
1908 If the <option>condition</option> option is set, it is evaluated and tested. This option
1909 uses an expanded string to allow you to set up your own custom preconditions.
1910 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1911 </para>
1912 <para>
1913 Note that while using
1914 this option for address matching technically works,
1915 it does not set any de-tainted values.
1916 Such values are often needed, either for router-specific options or
1917 for transport options.
1918 Using the <option>domains</option> and <option>local_parts</option> options is usually the most
1919 convenient way to obtain them.
1920 </para>
1921 </listitem>
1922 </orderedlist>
1923 <para>
1924 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1925 it to check for the existence of a file in which to lookup up a domain, local
1926 part, or sender. However, as these options are all expanded, you can use the
1927 <option>exists</option> expansion condition to make such tests within each condition. The
1928 <option>require_files</option> option is intended for checking files that the router may be
1929 going to use internally, or which are needed by a specific transport (for
1930 example, <filename>.procmailrc</filename>).
1931 </para>
1932 </section>
1933 <section id="SECID18">
1934 <title>Delivery in detail</title>
1935 <para>
1936 <indexterm role="concept">
1937 <primary>delivery</primary>
1938 <secondary>in detail</secondary>
1939 </indexterm>
1940 When a message is to be delivered, the sequence of events is as follows:
1941 </para>
1942 <orderedlist numeration="arabic">
1943 <listitem>
1944 <para>
1945 If a system-wide filter file is specified, the message is passed to it. The
1946 filter may add recipients to the message, replace the recipients, discard the
1947 message, cause a new message to be generated, or cause the message delivery to
1948 fail. The format of the system filter file is the same as for Exim user filter
1949 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1950 filtering</emphasis>.
1951 <indexterm role="concept">
1952 <primary>Sieve filter</primary>
1953 <secondary>not available for system filter</secondary>
1954 </indexterm>
1955 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1956 </para>
1957 <para>
1958 Some additional features are available in system filters &ndash; see chapter
1959 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1960 filter only once per delivery attempt, however many recipients it has. However,
1961 if there are several delivery attempts because one or more addresses could not
1962 be immediately delivered, the system filter is run each time. The filter
1963 condition <option>first_delivery</option> can be used to detect the first run of the system
1964 filter.
1965 </para>
1966 </listitem>
1967 <listitem>
1968 <para>
1969 Each recipient address is offered to each configured router, in turn, subject to
1970 its preconditions, until one is able to handle it. If no router can handle the
1971 address, that is, if they all decline, the address is failed. Because routers
1972 can be targeted at particular domains, several locally handled domains can be
1973 processed entirely independently of each other.
1974 </para>
1975 </listitem>
1976 <listitem>
1977 <para>
1978 <indexterm role="concept">
1979 <primary>routing</primary>
1980 <secondary>loops in</secondary>
1981 </indexterm>
1982 <indexterm role="concept">
1983 <primary>loop</primary>
1984 <secondary>while routing</secondary>
1985 </indexterm>
1986 A router that accepts an address may assign it to a local or a remote
1987 transport. However, the transport is not run at this time. Instead, the address
1988 is placed on a list for the particular transport, which will be run later.
1989 Alternatively, the router may generate one or more new addresses (typically
1990 from alias, forward, or filter files). New addresses are fed back into this
1991 process from the top, but in order to avoid loops, a router ignores any address
1992 which has an identically-named ancestor that was processed by itself.
1993 </para>
1994 </listitem>
1995 <listitem>
1996 <para>
1997 When all the routing has been done, addresses that have been successfully
1998 handled are passed to their assigned transports. When local transports are
1999 doing real local deliveries, they handle only one address at a time, but if a
2000 local transport is being used as a pseudo-remote transport (for example, to
2001 collect batched SMTP messages for transmission by some other means) multiple
2002 addresses can be handled. Remote transports can always handle more than one
2003 address at a time, but can be configured not to do so, or to restrict multiple
2004 addresses to the same domain.
2005 </para>
2006 </listitem>
2007 <listitem>
2008 <para>
2009 Each local delivery to a file or a pipe runs in a separate process under a
2010 non-privileged uid, and these deliveries are run one at a time. Remote
2011 deliveries also run in separate processes, normally under a uid that is private
2012 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
2013 run in parallel. The maximum number of simultaneous remote deliveries for any
2014 one message is set by the <option>remote_max_parallel</option> option.
2015 The order in which deliveries are done is not defined, except that all local
2016 deliveries happen before any remote deliveries.
2017 </para>
2018 </listitem>
2019 <listitem>
2020 <para>
2021 <indexterm role="concept">
2022 <primary>queue runner</primary>
2023 </indexterm>
2024 When it encounters a local delivery during a queue run, Exim checks its retry
2025 database to see if there has been a previous temporary delivery failure for the
2026 address before running the local transport. If there was a previous failure,
2027 Exim does not attempt a new delivery until the retry time for the address is
2028 reached. However, this happens only for delivery attempts that are part of a
2029 queue run. Local deliveries are always attempted when delivery immediately
2030 follows message reception, even if retry times are set for them. This makes for
2031 better behaviour if one particular message is causing problems (for example,
2032 causing quota overflow, or provoking an error in a filter file).
2033 </para>
2034 </listitem>
2035 <listitem>
2036 <para>
2037 <indexterm role="concept">
2038 <primary>delivery</primary>
2039 <secondary>retry in remote transports</secondary>
2040 </indexterm>
2041 Remote transports do their own retry handling, since an address may be
2042 deliverable to one of a number of hosts, each of which may have a different
2043 retry time. If there have been previous temporary failures and no host has
2044 reached its retry time, no delivery is attempted, whether in a queue run or
2045 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
2046 </para>
2047 </listitem>
2048 <listitem>
2049 <para>
2050 If there were any permanent errors, a bounce message is returned to an
2051 appropriate address (the sender in the common case), with details of the error
2052 for each failing address. Exim can be configured to send copies of bounce
2053 messages to other addresses.
2054 </para>
2055 </listitem>
2056 <listitem>
2057 <para>
2058 <indexterm role="concept">
2059 <primary>delivery</primary>
2060 <secondary>deferral</secondary>
2061 </indexterm>
2062 If one or more addresses suffered a temporary failure, the message is left on
2063 the queue, to be tried again later. Delivery of these addresses is said to be
2064 <emphasis>deferred</emphasis>.
2065 </para>
2066 </listitem>
2067 <listitem>
2068 <para>
2069 When all the recipient addresses have either been delivered or bounced,
2070 handling of the message is complete. The spool files and message log are
2071 deleted, though the message log can optionally be preserved if required.
2072 </para>
2073 </listitem>
2074 </orderedlist>
2075 </section>
2076 <section id="SECID19">
2077 <title>Retry mechanism</title>
2078 <para>
2079 <indexterm role="concept">
2080 <primary>delivery</primary>
2081 <secondary>retry mechanism</secondary>
2082 </indexterm>
2083 <indexterm role="concept">
2084 <primary>retry</primary>
2085 <secondary>description of mechanism</secondary>
2086 </indexterm>
2087 <indexterm role="concept">
2088 <primary>queue runner</primary>
2089 </indexterm>
2090 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2091 attempt is the queue runner process. You must either run an Exim daemon that
2092 uses the <option>-q</option> option with a time interval to start queue runners at regular
2093 intervals or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2094 not arrange for queue runners to be run, messages that fail temporarily at the
2095 first attempt will remain in your queue forever. A queue runner process works
2096 its way through the queue, one message at a time, trying each delivery that has
2097 passed its retry time.
2098 You can run several queue runners at once.
2099 </para>
2100 <para>
2101 Exim uses a set of configured rules to determine when next to retry the failing
2102 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2103 should give up trying to deliver to the address, at which point it generates a
2104 bounce message. If no retry rules are set for a particular host, address, and
2105 error combination, no retries are attempted, and temporary errors are treated
2106 as permanent.
2107 </para>
2108 <section id="SECID20">
2109 <title>Temporary delivery failure</title>
2110 <para>
2111 <indexterm role="concept">
2112 <primary>delivery</primary>
2113 <secondary>temporary failure</secondary>
2114 </indexterm>
2115 There are many reasons why a message may not be immediately deliverable to a
2116 particular address. Failure to connect to a remote machine (because it, or the
2117 connection to it, is down) is one of the most common. Temporary failures may be
2118 detected during routing as well as during the transport stage of delivery.
2119 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2120 is on a file system where the user is over quota. Exim can be configured to
2121 impose its own quotas on local mailboxes; where system quotas are set they will
2122 also apply.
2123 </para>
2124 <para>
2125 If a host is unreachable for a period of time, a number of messages may be
2126 waiting for it by the time it recovers, and sending them in a single SMTP
2127 connection is clearly beneficial. Whenever a delivery to a remote host is
2128 deferred,
2129 <indexterm role="concept">
2130 <primary>hints database</primary>
2131 <secondary>deferred deliveries</secondary>
2132 </indexterm>
2133 Exim makes a note in its hints database, and whenever a successful
2134 SMTP delivery has happened, it looks to see if any other messages are waiting
2135 for the same host. If any are found, they are sent over the same SMTP
2136 connection, subject to a configuration limit as to the maximum number in any
2137 one connection.
2138 </para>
2139 </section>
2140 <section id="SECID21">
2141 <title>Permanent delivery failure</title>
2142 <para>
2143 <indexterm role="concept">
2144 <primary>delivery</primary>
2145 <secondary>permanent failure</secondary>
2146 </indexterm>
2147 <indexterm role="concept">
2148 <primary>bounce message</primary>
2149 <secondary>when generated</secondary>
2150 </indexterm>
2151 When a message cannot be delivered to some or all of its intended recipients, a
2152 bounce message is generated. Temporary delivery failures turn into permanent
2153 errors when their timeout expires. All the addresses that fail in a given
2154 delivery attempt are listed in a single message. If the original message has
2155 many recipients, it is possible for some addresses to fail in one delivery
2156 attempt and others to fail subsequently, giving rise to more than one bounce
2157 message. The wording of bounce messages can be customized by the administrator.
2158 See chapter <xref linkend="CHAPemsgcust"/> for details.
2159 </para>
2160 <para>
2161 <indexterm role="concept">
2162 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2163 </indexterm>
2164 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2165 failed addresses, for the benefit of programs that try to analyse such messages
2166 automatically.
2167 </para>
2168 <para>
2169 <indexterm role="concept">
2170 <primary>bounce message</primary>
2171 <secondary>recipient of</secondary>
2172 </indexterm>
2173 A bounce message is normally sent to the sender of the original message, as
2174 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2175 address given in the MAIL command. However, when an address is expanded via a
2176 forward or alias file, an alternative address can be specified for delivery
2177 failures of the generated addresses. For a mailing list expansion (see section
2178 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2179 of the list.
2180 </para>
2181 </section>
2182 <section id="SECID22">
2183 <title>Failures to deliver bounce messages</title>
2184 <para>
2185 <indexterm role="concept">
2186 <primary>bounce message</primary>
2187 <secondary>failure to deliver</secondary>
2188 </indexterm>
2189 If a bounce message (either locally generated or received from a remote host)
2190 itself suffers a permanent delivery failure, the message is left in the queue,
2191 but it is frozen, awaiting the attention of an administrator. There are options
2192 that can be used to make Exim discard such failed messages, or to keep them
2193 for only a short time (see <option>timeout_frozen_after</option> and
2194 <option>ignore_bounce_errors_after</option>).
2195 </para>
2196 </section>
2197 </section>
2198 </chapter>
2199
2200 <chapter id="CHID3">
2201 <title>Building and installing Exim</title>
2202 <para>
2203 <indexterm role="concept" id="IIDbuex" class="startofrange">
2204 <primary>building Exim</primary>
2205 </indexterm>
2206 </para>
2207 <section id="SECID23">
2208 <title>Unpacking</title>
2209 <para>
2210 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2211 creates a directory with the name of the current release (for example,
2212 <filename>exim-4.97</filename>) into which the following files are placed:
2213 </para>
2214 <informaltable frame="none">
2215 <tgroup cols="2" colsep="0" rowsep="0">
2216 <colspec colwidth="140pt" align="left"/>
2217 <colspec colwidth="254pt" align="left"/>
2218 <tbody>
2219 <row>
2220 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2221 <entry>contains some acknowledgments</entry>
2222 </row>
2223 <row>
2224 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2225 <entry>contains a reference to where changes are documented</entry>
2226 </row>
2227 <row>
2228 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2229 <entry>the GNU General Public Licence</entry>
2230 </row>
2231 <row>
2232 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2233 <entry>top-level make file</entry>
2234 </row>
2235 <row>
2236 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2237 <entry>conditions for the use of Exim</entry>
2238 </row>
2239 <row>
2240 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2241 <entry>list of files, directories and simple build instructions</entry>
2242 </row>
2243 </tbody>
2244 </tgroup>
2245 </informaltable>
2246 <para>
2247 Other files whose names begin with <filename>README</filename> may also be present. The
2248 following subdirectories are created:
2249 </para>
2250 <informaltable frame="none">
2251 <tgroup cols="2" colsep="0" rowsep="0">
2252 <colspec colwidth="140pt" align="left"/>
2253 <colspec colwidth="254pt" align="left"/>
2254 <tbody>
2255 <row>
2256 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2257 <entry>an empty directory for local configuration files</entry>
2258 </row>
2259 <row>
2260 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2261 <entry>OS-specific files</entry>
2262 </row>
2263 <row>
2264 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2265 <entry>documentation files</entry>
2266 </row>
2267 <row>
2268 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2269 <entry>source files for the Exim monitor</entry>
2270 </row>
2271 <row>
2272 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2273 <entry>scripts used in the build process</entry>
2274 </row>
2275 <row>
2276 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2277 <entry>remaining source files</entry>
2278 </row>
2279 <row>
2280 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2281 <entry>independent utilities</entry>
2282 </row>
2283 </tbody>
2284 </tgroup>
2285 </informaltable>
2286 <para>
2287 The main utility programs are contained in the <filename>src</filename> directory and are built
2288 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2289 that may be useful to some sites.
2290 </para>
2291 </section>
2292 <section id="SECID24">
2293 <title>Multiple machine architectures and operating systems</title>
2294 <para>
2295 <indexterm role="concept">
2296 <primary>building Exim</primary>
2297 <secondary>multiple OS/architectures</secondary>
2298 </indexterm>
2299 The building process for Exim is arranged to make it easy to build binaries for
2300 a number of different architectures and operating systems from the same set of
2301 source files. Compilation does not take place in the <filename>src</filename> directory.
2302 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2303 system.
2304 <indexterm role="concept">
2305 <primary>symbolic link</primary>
2306 <secondary>to build directory</secondary>
2307 </indexterm>
2308 Symbolic links to the sources are installed in this directory, which is where
2309 the actual building takes place. In most cases, Exim can discover the machine
2310 architecture and operating system for itself, but the defaults can be
2311 overridden if necessary.
2312 <indexterm role="concept">
2313 <primary>compiler</primary>
2314 <secondary>requirements</secondary>
2315 </indexterm>
2316 <indexterm role="concept">
2317 <primary>compiler</primary>
2318 <secondary>version</secondary>
2319 </indexterm>
2320 A C99-capable compiler will be required for the build.
2321 </para>
2322 </section>
2323 <section id="SECTpcre">
2324 <title>PCRE2 library</title>
2325 <para>
2326 <indexterm role="concept">
2327 <primary>PCRE2 library</primary>
2328 </indexterm>
2329 Exim no longer has an embedded regular-expression library as the vast majority of
2330 modern systems include PCRE2 as a system library, although you may need to
2331 install the PCRE2 package or the PCRE2 development package for your operating
2332 system. If your system has a normal PCRE2 installation the Exim build
2333 process will need no further configuration. If the library or the
2334 headers are in an unusual location you will need to either set the PCRE2_LIBS
2335 and INCLUDE directives appropriately,
2336 or set PCRE2_CONFIG=yes to use the installed <command>pcre-config</command> command.
2337 If your operating system has no
2338 PCRE2 support then you will need to obtain and build the current PCRE2
2339 from <emphasis role="bold"><ulink url="https://github.com/PhilipHazel/pcre2/releases">https://github.com/PhilipHazel/pcre2/releases</ulink></emphasis>.
2340 More information on PCRE2 is available at <emphasis role="bold"><ulink url="https://www.pcre.org/">https://www.pcre.org/</ulink></emphasis>.
2341 </para>
2342 </section>
2343 <section id="SECTdb">
2344 <title>DBM libraries</title>
2345 <para>
2346 <indexterm role="concept">
2347 <primary>DBM libraries</primary>
2348 <secondary>discussion of</secondary>
2349 </indexterm>
2350 <indexterm role="concept">
2351 <primary>hints database</primary>
2352 <secondary>DBM files used for</secondary>
2353 </indexterm>
2354 Even if you do not use any DBM files in your configuration, Exim still needs a
2355 DBM library in order to operate, because it uses indexed files for its hints
2356 databases. Unfortunately, there are a number of DBM libraries in existence, and
2357 different operating systems often have different ones installed.
2358 </para>
2359 <para>
2360 <indexterm role="concept">
2361 <primary>Solaris</primary>
2362 <secondary>DBM library for</secondary>
2363 </indexterm>
2364 <indexterm role="concept">
2365 <primary>IRIX, DBM library for</primary>
2366 </indexterm>
2367 <indexterm role="concept">
2368 <primary>BSD, DBM library for</primary>
2369 </indexterm>
2370 <indexterm role="concept">
2371 <primary>Linux, DBM library for</primary>
2372 </indexterm>
2373 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2374 Linux distribution, the DBM configuration should happen automatically, and you
2375 may be able to ignore this section. Otherwise, you may have to learn more than
2376 you would like about DBM libraries from what follows.
2377 </para>
2378 <para>
2379 <indexterm role="concept">
2380 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2381 </indexterm>
2382 Licensed versions of Unix normally contain a library of DBM functions operating
2383 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2384 versions of Unix seem to vary in what they contain as standard. In particular,
2385 some early versions of Linux have no default DBM library, and different
2386 distributors have chosen to bundle different libraries with their packaged
2387 versions. However, the more recent releases seem to have standardized on the
2388 Berkeley DB library.
2389 </para>
2390 <para>
2391 Different DBM libraries have different conventions for naming the files they
2392 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2393 possibilities:
2394 </para>
2395 <orderedlist numeration="arabic">
2396 <listitem>
2397 <para>
2398 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2399 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2400 </para>
2401 </listitem>
2402 <listitem>
2403 <para>
2404 <indexterm role="concept">
2405 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2406 </indexterm>
2407 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2408 compatibility interface it makes two different hard links to it with names
2409 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2410 filename is used unmodified.
2411 </para>
2412 </listitem>
2413 <listitem>
2414 <para>
2415 <indexterm role="concept">
2416 <primary>Berkeley DB library</primary>
2417 </indexterm>
2418 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2419 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2420 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2421 </para>
2422 </listitem>
2423 <listitem>
2424 <para>
2425 If the Berkeley package is used in its native mode, it operates on a single
2426 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2427 the traditional <emphasis>ndbm</emphasis> interface.
2428 </para>
2429 </listitem>
2430 <listitem>
2431 <para>
2432 To complicate things further, there are several very different versions of the
2433 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2434 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while,
2435 but the latest versions when Exim last revamped support were numbered 5.<emphasis>x</emphasis>.
2436 Maintenance of some of the earlier releases has ceased,
2437 and Exim no longer supports versions before 3.<emphasis>x</emphasis>.
2438 All versions of Berkeley DB could be obtained from
2439 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>, which is now a redirect to their new owner&#x2019;s
2440 page with far newer versions listed.
2441 It is probably wise to plan to move your storage configurations away from
2442 Berkeley DB format, as today there are smaller and simpler alternatives more
2443 suited to Exim&#x2019;s usage model.
2444 </para>
2445 </listitem>
2446 <listitem>
2447 <para>
2448 <indexterm role="concept">
2449 <primary><emphasis>tdb</emphasis> DBM library</primary>
2450 </indexterm>
2451 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2452 <emphasis role="bold"><ulink url="https://sourceforge.net/projects/tdb/files/">https://sourceforge.net/projects/tdb/files/</ulink></emphasis>. It has its own interface, and also
2453 operates on a single file.
2454 </para>
2455 </listitem>
2456 </orderedlist>
2457 <para>
2458 <indexterm role="concept">
2459 <primary>USE_DB</primary>
2460 </indexterm>
2461 <indexterm role="concept">
2462 <primary>DBM libraries</primary>
2463 <secondary>configuration for building</secondary>
2464 </indexterm>
2465 Exim and its utilities can be compiled to use any of these interfaces. In order
2466 to use any version of the Berkeley DB package in native mode, you must set
2467 USE_DB in an appropriate configuration file (typically
2468 <filename>Local/Makefile</filename>). For example:
2469 </para>
2470 <literallayout class="monospaced">
2471 USE_DB=yes
2472 </literallayout>
2473 <para>
2474 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2475 error is diagnosed if you set more than one of these.
2476 You can set USE_NDBM if needed to override an operating system default.
2477 </para>
2478 <para>
2479 At the lowest level, the build-time configuration sets none of these options,
2480 thereby assuming an interface of type (1). However, some operating system
2481 configuration files (for example, those for the BSD operating systems and
2482 Linux) assume type (4) by setting USE_DB as their default, and the
2483 configuration files for Cygwin set USE_GDBM. Anything you set in
2484 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2485 </para>
2486 <para>
2487 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2488 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2489 in one of these lines:
2490 </para>
2491 <literallayout class="monospaced">
2492 DBMLIB = -ldb
2493 DBMLIB = -ltdb
2494 DBMLIB = -lgdbm -lgdbm_compat
2495 </literallayout>
2496 <para>
2497 The last of those was for a Linux having GDBM provide emulated NDBM facilities.
2498 Settings like that will work if the DBM library is installed in the standard
2499 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2500 the default path. You may need to set INCLUDE to specify where the header
2501 file is, and to specify the path to the library more fully in DBMLIB, as in
2502 this example:
2503 </para>
2504 <literallayout class="monospaced">
2505 INCLUDE=-I/usr/local/include/db-4.1
2506 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2507 </literallayout>
2508 <para>
2509 There is further detailed discussion about the various DBM libraries in the
2510 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2511 </para>
2512 </section>
2513 <section id="SECID25">
2514 <title>Pre-building configuration</title>
2515 <para>
2516 <indexterm role="concept">
2517 <primary>building Exim</primary>
2518 <secondary>pre-building configuration</secondary>
2519 </indexterm>
2520 <indexterm role="concept">
2521 <primary>configuration for building Exim</primary>
2522 </indexterm>
2523 <indexterm role="concept">
2524 <primary><filename>Local/Makefile</filename></primary>
2525 </indexterm>
2526 <indexterm role="concept">
2527 <primary><filename>src/EDITME</filename></primary>
2528 </indexterm>
2529 Before building Exim, a local configuration file that specifies options
2530 independent of any operating system has to be created with the name
2531 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2532 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2533 therein. These descriptions are therefore not repeated here. If you are
2534 building Exim for the first time, the simplest thing to do is to copy
2535 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2536 </para>
2537 <para>
2538 There are three settings that you must supply, because Exim will not build
2539 without them. They are the location of the runtime configuration file
2540 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2541 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2542 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2543 a colon-separated list of filenames; Exim uses the first of them that exists.
2544 </para>
2545 <para>
2546 There are a few other parameters that can be specified either at build time or
2547 at runtime, to enable the same binary to be used on a number of different
2548 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2549 directory (if not within the spool directory) are fixed, it is recommended that
2550 you specify them in <filename>Local/Makefile</filename> instead of at runtime, so that errors
2551 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2552 be logged.
2553 </para>
2554 <para>
2555 <indexterm role="concept">
2556 <primary>content scanning</primary>
2557 <secondary>specifying at build time</secondary>
2558 </indexterm>
2559 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2560 access control lists are not compiled by default. If you want to include these
2561 facilities, you need to set
2562 </para>
2563 <literallayout class="monospaced">
2564 WITH_CONTENT_SCAN=yes
2565 </literallayout>
2566 <para>
2567 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2568 chapter <xref linkend="CHAPexiscan"/>.
2569 </para>
2570 <para>
2571 <indexterm role="concept">
2572 <primary><filename>Local/eximon.conf</filename></primary>
2573 </indexterm>
2574 <indexterm role="concept">
2575 <primary><filename>exim_monitor/EDITME</filename></primary>
2576 </indexterm>
2577 If you are going to build the Exim monitor, a similar configuration process is
2578 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2579 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2580 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2581 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2582 </para>
2583 <para>
2584 This is all the configuration that is needed in straightforward cases for known
2585 operating systems. However, the building process is set up so that it is easy
2586 to override options that are set by default or by operating-system-specific
2587 configuration files, for example, to change the C compiler, which
2588 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2589 do this.
2590 </para>
2591 </section>
2592 <section id="SECID26">
2593 <title>Support for iconv()</title>
2594 <para>
2595 <indexterm role="concept">
2596 <primary><function>iconv()</function> support</primary>
2597 </indexterm>
2598 <indexterm role="concept">
2599 <primary>RFC 2047</primary>
2600 </indexterm>
2601 The contents of header lines in messages may be encoded according to the rules
2602 described RFC 2047. This makes it possible to transmit characters that are not
2603 in the ASCII character set, and to label them as being in a particular
2604 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2605 mechanism, it decodes them, and translates them into a specified character set
2606 (default is set at build time). The translation is possible only if the operating system
2607 supports the <function>iconv()</function> function.
2608 </para>
2609 <para>
2610 However, some of the operating systems that supply <function>iconv()</function> do not support
2611 very many conversions. The GNU <option>libiconv</option> library (available from
2612 <emphasis role="bold"><ulink url="https://www.gnu.org/software/libiconv/">https://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2613 systems to remedy this deficiency, as well as on systems that do not supply
2614 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2615 </para>
2616 <literallayout class="monospaced">
2617 HAVE_ICONV=yes
2618 </literallayout>
2619 <para>
2620 to your <filename>Local/Makefile</filename> and rebuild Exim.
2621 </para>
2622 </section>
2623 <section id="SECTinctlsssl">
2624 <title>Including TLS/SSL encryption support</title>
2625 <para>
2626 <indexterm role="concept">
2627 <primary>TLS</primary>
2628 <secondary>including support for TLS</secondary>
2629 </indexterm>
2630 <indexterm role="concept">
2631 <primary>encryption</primary>
2632 <secondary>including support for</secondary>
2633 </indexterm>
2634 <indexterm role="concept">
2635 <primary>OpenSSL</primary>
2636 <secondary>building Exim with</secondary>
2637 </indexterm>
2638 <indexterm role="concept">
2639 <primary>GnuTLS</primary>
2640 <secondary>building Exim with</secondary>
2641 </indexterm>
2642 Exim is usually built to support encrypted SMTP connections, using the STARTTLS
2643 command as per RFC 2487. It can also support clients that expect to
2644 start a TLS session immediately on connection to a non-standard port (see the
2645 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2646 line option).
2647 </para>
2648 <para>
2649 If you want to build Exim with TLS support, you must first install either the
2650 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2651 implementing SSL.
2652 </para>
2653 <para>
2654 If you do not want TLS support you should set
2655 </para>
2656 <literallayout class="monospaced">
2657 DISABLE_TLS=yes
2658 </literallayout>
2659 <para>
2660 in <filename>Local/Makefile</filename>.
2661 </para>
2662 <para>
2663 If OpenSSL is installed, you should set
2664 </para>
2665 <literallayout class="monospaced">
2666 USE_OPENSL=yes
2667 TLS_LIBS=-lssl -lcrypto
2668 </literallayout>
2669 <para>
2670 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2671 OpenSSL library and include files. For example:
2672 </para>
2673 <literallayout class="monospaced">
2674 USE_OPENSSL=yes
2675 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2676 TLS_INCLUDE=-I/usr/local/openssl/include/
2677 </literallayout>
2678 <para>
2679 <indexterm role="concept">
2680 <primary>pkg-config</primary>
2681 <secondary>OpenSSL</secondary>
2682 </indexterm>
2683 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2684 </para>
2685 <literallayout class="monospaced">
2686 USE_OPENSSL=yes
2687 USE_OPENSSL_PC=openssl
2688 </literallayout>
2689 <para>
2690 <indexterm role="concept">
2691 <primary>USE_GNUTLS</primary>
2692 </indexterm>
2693 If GnuTLS is installed, you should set
2694 </para>
2695 <literallayout class="monospaced">
2696 USE_GNUTLS=yes
2697 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2698 </literallayout>
2699 <para>
2700 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2701 library and include files. For example:
2702 </para>
2703 <literallayout class="monospaced">
2704 USE_GNUTLS=yes
2705 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2706 TLS_INCLUDE=-I/usr/gnu/include
2707 </literallayout>
2708 <para>
2709 <indexterm role="concept">
2710 <primary>pkg-config</primary>
2711 <secondary>GnuTLS</secondary>
2712 </indexterm>
2713 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2714 </para>
2715 <literallayout class="monospaced">
2716 USE_GNUTLS=yes
2717 USE_GNUTLS_PC=gnutls
2718 </literallayout>
2719 <para>
2720 You do not need to set TLS_INCLUDE if the relevant directory is already
2721 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2722 given in chapter <xref linkend="CHAPTLS"/>.
2723 </para>
2724 </section>
2725 <section id="SECID27">
2726 <title>Use of tcpwrappers</title>
2727 <para>
2728 <indexterm role="concept">
2729 <primary>tcpwrappers, building Exim to support</primary>
2730 </indexterm>
2731 <indexterm role="concept">
2732 <primary>USE_TCP_WRAPPERS</primary>
2733 </indexterm>
2734 <indexterm role="concept">
2735 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2736 </indexterm>
2737 <indexterm role="concept">
2738 <primary>tcp_wrappers_daemon_name</primary>
2739 </indexterm>
2740 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2741 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2742 alternative to Exim&#x2019;s own checking facilities for installations that are
2743 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2744 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2745 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2746 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2747 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2748 you might have
2749 </para>
2750 <literallayout class="monospaced">
2751 USE_TCP_WRAPPERS=yes
2752 CFLAGS=-O -I/usr/local/include
2753 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2754 </literallayout>
2755 <para>
2756 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2757 files is <quote>exim</quote>. For example, the line
2758 </para>
2759 <literallayout class="monospaced">
2760 exim : LOCAL  192.168.1.  .friendly.domain.example
2761 </literallayout>
2762 <para>
2763 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2764 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2765 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2766 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2767 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2768 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2769 further details.
2770 </para>
2771 </section>
2772 <section id="SECID28">
2773 <title>Including support for IPv6</title>
2774 <para>
2775 <indexterm role="concept">
2776 <primary>IPv6</primary>
2777 <secondary>including support for</secondary>
2778 </indexterm>
2779 Exim contains code for use on systems that have IPv6 support. Setting
2780 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2781 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2782 where the IPv6 support is not fully integrated into the normal include and
2783 library files.
2784 </para>
2785 <para>
2786 Two different types of DNS record for handling IPv6 addresses have been
2787 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2788 currently seen as the mainstream. Another record type called A6 was proposed
2789 as better than AAAA because it had more flexibility. However, it was felt to be
2790 over-complex, and its status was reduced to <quote>experimental</quote>.
2791 Exim used to
2792 have a compile option for including A6 record support but this has now been
2793 withdrawn.
2794 </para>
2795 </section>
2796 <section id="SECTdynamicmodules">
2797 <title>Dynamically loaded lookup module support</title>
2798 <para>
2799 <indexterm role="concept">
2800 <primary>lookup modules</primary>
2801 </indexterm>
2802 <indexterm role="concept">
2803 <primary>dynamic modules</primary>
2804 </indexterm>
2805 <indexterm role="concept">
2806 <primary>.so building</primary>
2807 </indexterm>
2808 On some platforms, Exim supports not compiling all lookup types directly into
2809 the main binary, instead putting some into external modules which can be loaded
2810 on demand.
2811 This permits packagers to build Exim with support for lookups with extensive
2812 library dependencies without requiring all users to install all of those
2813 dependencies.
2814 Most, but not all, lookup types can be built this way.
2815 </para>
2816 <para>
2817 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2818 installed; Exim will only load modules from that directory, as a security
2819 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2820 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2821 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2822 see <filename>src/EDITME</filename> for details.
2823 </para>
2824 <para>
2825 Then, for each module to be loaded dynamically, define the relevant
2826 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2827 For example, this will build in lsearch but load sqlite and mysql support
2828 on demand:
2829 </para>
2830 <literallayout class="monospaced">
2831 LOOKUP_LSEARCH=yes
2832 LOOKUP_SQLITE=2
2833 LOOKUP_MYSQL=2
2834 </literallayout>
2835 </section>
2836 <section id="SECID29">
2837 <title>The building process</title>
2838 <para>
2839 <indexterm role="concept">
2840 <primary>build directory</primary>
2841 </indexterm>
2842 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2843 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2844 operating system types, and creates a build directory if one does not exist.
2845 For example, on a Sun system running Solaris 8, the directory
2846 <filename>build-SunOS5-5.8-sparc</filename> is created.
2847 <indexterm role="concept">
2848 <primary>symbolic link</primary>
2849 <secondary>to source files</secondary>
2850 </indexterm>
2851 Symbolic links to relevant source files are installed in the build directory.
2852 </para>
2853 <para>
2854 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2855 a make file inside the build directory, using the configuration files from the
2856 <filename>Local</filename> directory. The new make file is then passed to another instance of
2857 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2858 then compiling and linking the binaries for the Exim monitor (if configured), a
2859 number of utility programs, and finally Exim itself. The command <literal>make
2860 makefile</literal> can be used to force a rebuild of the make file in the build
2861 directory, should this ever be necessary.
2862 </para>
2863 <para>
2864 If you have problems building Exim, check for any comments there may be in the
2865 <filename>README</filename> file concerning your operating system, and also take a look at the
2866 FAQ, where some common problems are covered.
2867 </para>
2868 </section>
2869 <section id="SECID283">
2870 <title>Output from <quote>make</quote></title>
2871 <para>
2872 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2873 unreadable, because these lines can be very long. For this reason, the normal
2874 output is suppressed by default, and instead output similar to that which
2875 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2876 each module that is being compiled or linked. However, it is still possible to
2877 get the full output, by calling <emphasis>make</emphasis> like this:
2878 </para>
2879 <literallayout class="monospaced">
2880 FULLECHO='' make -e
2881 </literallayout>
2882 <para>
2883 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2884 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2885 given in addition to the short output.
2886 </para>
2887 </section>
2888 <section id="SECToverride">
2889 <title>Overriding build-time options for Exim</title>
2890 <para>
2891 <indexterm role="concept">
2892 <primary>build-time options, overriding</primary>
2893 </indexterm>
2894 The main make file that is created at the beginning of the building process
2895 consists of the concatenation of a number of files which set configuration
2896 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2897 more than once, the last setting overrides any previous ones. This provides a
2898 convenient way of overriding defaults. The files that are concatenated are, in
2899 order:
2900 </para>
2901 <literallayout>
2902 <filename>OS/Makefile-Default</filename>
2903 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2904 <filename>Local/Makefile</filename>
2905 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2906 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2907 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2908 <filename>OS/Makefile-Base</filename>
2909 </literallayout>
2910 <para>
2911 <indexterm role="concept">
2912 <primary><filename>Local/Makefile</filename></primary>
2913 </indexterm>
2914 <indexterm role="concept">
2915 <primary>building Exim</primary>
2916 <secondary>operating system type</secondary>
2917 </indexterm>
2918 <indexterm role="concept">
2919 <primary>building Exim</primary>
2920 <secondary>architecture type</secondary>
2921 </indexterm>
2922 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2923 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2924 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2925 and are often not needed.
2926 </para>
2927 <para>
2928 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2929 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2930 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2931 values are used, thereby providing a means of forcing particular settings.
2932 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2933 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2934 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2935 that Exim expects. You can run these scripts directly from the shell in order
2936 to find out what values are being used on your system.
2937 </para>
2938 <para>
2939 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2940 therein. Some (but not all) are mentioned below. If there is something that
2941 needs changing, review the contents of this file and the contents of the make
2942 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2943 default values are.
2944 </para>
2945 <para>
2946 <indexterm role="concept">
2947 <primary>building Exim</primary>
2948 <secondary>overriding default settings</secondary>
2949 </indexterm>
2950 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2951 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2952 need to change the original files. Instead, you should make the changes by
2953 putting the new values in an appropriate <filename>Local</filename> file. For example,
2954 <indexterm role="concept">
2955 <primary>Tru64-Unix build-time settings</primary>
2956 </indexterm>
2957 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2958 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2959 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2960 called with the option <option>-std1</option>, to make it recognize some of the features of
2961 Standard C that Exim uses. (Most other compilers recognize Standard C by
2962 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2963 containing the lines
2964 </para>
2965 <literallayout class="monospaced">
2966 CC=cc
2967 CFLAGS=-std1
2968 </literallayout>
2969 <para>
2970 If you are compiling for just one operating system, it may be easier to put
2971 these lines directly into <filename>Local/Makefile</filename>.
2972 </para>
2973 <para>
2974 Keeping all your local configuration settings separate from the distributed
2975 files makes it easy to transfer them to new versions of Exim simply by copying
2976 the contents of the <filename>Local</filename> directory.
2977 </para>
2978 <para>
2979 <indexterm role="concept">
2980 <primary>NIS lookup type</primary>
2981 <secondary>including support for</secondary>
2982 </indexterm>
2983 <indexterm role="concept">
2984 <primary>NIS+ lookup type</primary>
2985 <secondary>including support for</secondary>
2986 </indexterm>
2987 <indexterm role="concept">
2988 <primary>LDAP</primary>
2989 <secondary>including support for</secondary>
2990 </indexterm>
2991 <indexterm role="concept">
2992 <primary>lookup</primary>
2993 <secondary>inclusion in binary</secondary>
2994 </indexterm>
2995 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2996 lookup, but not all systems have these components installed, so the default is
2997 not to include the relevant code in the binary. All the different kinds of file
2998 and database lookup that Exim supports are implemented as separate code modules
2999 which are included only if the relevant compile-time options are set. In the
3000 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
3001 </para>
3002 <literallayout class="monospaced">
3003 LOOKUP_LDAP=yes
3004 LOOKUP_NIS=yes
3005 LOOKUP_NISPLUS=yes
3006 </literallayout>
3007 <para>
3008 and similar settings apply to the other lookup types. They are all listed in
3009 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
3010 libraries need to be installed before compiling Exim.
3011 <indexterm role="concept">
3012 <primary>cdb</primary>
3013 <secondary>including support for</secondary>
3014 </indexterm>
3015 However, there are some optional lookup types (such as cdb) for which
3016 the code is entirely contained within Exim, and no external include
3017 files or libraries are required. When a lookup type is not included in the
3018 binary, attempts to configure Exim to use it cause runtime configuration
3019 errors.
3020 </para>
3021 <para>
3022 <indexterm role="concept">
3023 <primary>pkg-config</primary>
3024 <secondary>lookups</secondary>
3025 </indexterm>
3026 <indexterm role="concept">
3027 <primary>pkg-config</primary>
3028 <secondary>authenticators</secondary>
3029 </indexterm>
3030 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
3031 about how to compile against a library; Exim has some initial support for
3032 being able to use pkg-config for lookups and authenticators.  For any given
3033 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
3034 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
3035 name of the package to be queried.  The results of querying via the
3036 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
3037 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
3038 syntax.  For instance:
3039 </para>
3040 <literallayout class="monospaced">
3041 LOOKUP_SQLITE=yes
3042 LOOKUP_SQLITE_PC=sqlite3
3043 AUTH_GSASL=yes
3044 AUTH_GSASL_PC=libgsasl
3045 AUTH_HEIMDAL_GSSAPI=yes
3046 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
3047 </literallayout>
3048 <para>
3049 <indexterm role="concept">
3050 <primary>Perl</primary>
3051 <secondary>including support for</secondary>
3052 </indexterm>
3053 Exim can be linked with an embedded Perl interpreter, allowing Perl
3054 subroutines to be called during string expansion. To enable this facility,
3055 </para>
3056 <literallayout class="monospaced">
3057 EXIM_PERL=perl.o
3058 </literallayout>
3059 <para>
3060 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
3061 chapter <xref linkend="CHAPperl"/>.
3062 </para>
3063 <para>
3064 <indexterm role="concept">
3065 <primary>X11 libraries, location of</primary>
3066 </indexterm>
3067 The location of the X11 libraries is something that varies a lot between
3068 operating systems, and there may be different versions of X11 to cope
3069 with. Exim itself makes no use of X11, but if you are compiling the Exim
3070 monitor, the X11 libraries must be available.
3071 The following three variables are set in <filename>OS/Makefile-Default</filename>:
3072 </para>
3073 <literallayout class="monospaced">
3074 X11=/usr/X11R6
3075 XINCLUDE=-I$(X11)/include
3076 XLFLAGS=-L$(X11)/lib
3077 </literallayout>
3078 <para>
3079 These are overridden in some of the operating-system configuration files. For
3080 example, in <filename>OS/Makefile-SunOS5</filename> there is
3081 </para>
3082 <literallayout class="monospaced">
3083 X11=/usr/openwin
3084 XINCLUDE=-I$(X11)/include
3085 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
3086 </literallayout>
3087 <para>
3088 If you need to override the default setting for your operating system, place a
3089 definition of all three of these variables into your
3090 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
3091 </para>
3092 <para>
3093 <indexterm role="concept">
3094 <primary>EXTRALIBS</primary>
3095 </indexterm>
3096 If you need to add any extra libraries to the link steps, these can be put in a
3097 variable called EXTRALIBS, which appears in all the link commands, but by
3098 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3099 command for linking the main Exim binary, and not for any associated utilities.
3100 </para>
3101 <para>
3102 <indexterm role="concept">
3103 <primary>DBM libraries</primary>
3104 <secondary>configuration for building</secondary>
3105 </indexterm>
3106 There is also DBMLIB, which appears in the link commands for binaries that
3107 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3108 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3109 binary, and which can be used, for example, to include additional X11
3110 libraries.
3111 </para>
3112 <para>
3113 <indexterm role="concept">
3114 <primary>configuration file</primary>
3115 <secondary>editing</secondary>
3116 </indexterm>
3117 The make file copes with rebuilding Exim correctly if any of the configuration
3118 files are edited. However, if an optional configuration file is deleted, it is
3119 necessary to touch the associated non-optional file (that is,
3120 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3121 </para>
3122 </section>
3123 <section id="SECID30">
3124 <title>OS-specific header files</title>
3125 <para>
3126 <indexterm role="concept">
3127 <primary><filename>os.h</filename></primary>
3128 </indexterm>
3129 <indexterm role="concept">
3130 <primary>building Exim</primary>
3131 <secondary>OS-specific C header files</secondary>
3132 </indexterm>
3133 The <filename>OS</filename> directory contains a number of files with names of the form
3134 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3135 normally need to be changed. There is a list of macro settings that are
3136 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3137 are porting Exim to a new operating system.
3138 </para>
3139 </section>
3140 <section id="SECID31">
3141 <title>Overriding build-time options for the monitor</title>
3142 <para>
3143 <indexterm role="concept">
3144 <primary>building Eximon</primary>
3145 </indexterm>
3146 A similar process is used for overriding things when building the Exim monitor,
3147 where the files that are involved are
3148 </para>
3149 <literallayout>
3150 <filename>OS/eximon.conf-Default</filename>
3151 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3152 <filename>Local/eximon.conf</filename>
3153 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3154 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3155 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3156 </literallayout>
3157 <para>
3158 <indexterm role="concept">
3159 <primary><filename>Local/eximon.conf</filename></primary>
3160 </indexterm>
3161 As with Exim itself, the final three files need not exist, and in this case the
3162 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3163 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3164 variables of the same name, preceded by EXIMON_. For example, setting
3165 EXIMON_LOG_DEPTH in the environment overrides the value of
3166 LOG_DEPTH at runtime.
3167 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3168 </para>
3169 </section>
3170 <section id="SECID32">
3171 <title>Installing Exim binaries and scripts</title>
3172 <para>
3173 <indexterm role="concept">
3174 <primary>installing Exim</primary>
3175 </indexterm>
3176 <indexterm role="concept">
3177 <primary>BIN_DIRECTORY</primary>
3178 </indexterm>
3179 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3180 arguments. The script copies binaries and utility scripts into the directory
3181 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3182 <indexterm role="concept">
3183 <primary>setuid</primary>
3184 <secondary>installing Exim with</secondary>
3185 </indexterm>
3186 The install script copies files only if they are newer than the files they are
3187 going to replace. The Exim binary is required to be owned by root and have the
3188 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3189 install</literal> as root so that it can set up the Exim binary in this way. However, in
3190 some special situations (for example, if a host is doing no local deliveries)
3191 it may be possible to run Exim without making the binary setuid root (see
3192 chapter <xref linkend="CHAPsecurity"/> for details).
3193 </para>
3194 <para>
3195 <indexterm role="concept">
3196 <primary>CONFIGURE_FILE</primary>
3197 </indexterm>
3198 Exim&#x2019;s runtime configuration file is named by the CONFIGURE_FILE setting
3199 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3200 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3201 by the installation script. If a runtime configuration file already exists, it
3202 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3203 alternative files, no default is installed.
3204 </para>
3205 <para>
3206 <indexterm role="concept">
3207 <primary>system aliases file</primary>
3208 </indexterm>
3209 <indexterm role="concept">
3210 <primary><filename>/etc/aliases</filename></primary>
3211 </indexterm>
3212 One change is made to the default configuration file when it is installed: the
3213 default configuration contains a router that references a system aliases file.
3214 The path to this file is set to the value specified by
3215 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3216 If the system aliases file does not exist, the installation script creates it,
3217 and outputs a comment to the user.
3218 </para>
3219 <para>
3220 The created file contains no aliases, but it does contain comments about the
3221 aliases a site should normally have. Mail aliases have traditionally been
3222 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3223 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3224 Exim&#x2019;s configuration if necessary.
3225 </para>
3226 <para>
3227 The default configuration uses the local host&#x2019;s name as the only local domain,
3228 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3229 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3230 directories are supported, but no NIS or NIS+ support is configured. Domains
3231 other than the name of the local host are routed using the DNS, with delivery
3232 over SMTP.
3233 </para>
3234 <para>
3235 It is possible to install Exim for special purposes (such as building a binary
3236 distribution) in a private part of the file system. You can do this by a
3237 command such as
3238 </para>
3239 <literallayout class="monospaced">
3240 make DESTDIR=/some/directory/ install
3241 </literallayout>
3242 <para>
3243 This has the effect of pre-pending the specified directory to all the file
3244 paths, except the name of the system aliases file that appears in the default
3245 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3246 For backwards compatibility, ROOT is used if DESTDIR is not set,
3247 but this usage is deprecated.
3248 </para>
3249 <para>
3250 <indexterm role="concept">
3251 <primary>installing Exim</primary>
3252 <secondary>what is not installed</secondary>
3253 </indexterm>
3254 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3255 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3256 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3257 directory are copied, except for the info files when you have set
3258 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3259 </para>
3260 <para>
3261 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3262 to their names. The Exim binary itself, however, is handled differently. It is
3263 installed under a name that includes the version number and the compile number,
3264 for example, <filename>exim-4.97-1</filename>. The script then arranges for a symbolic link
3265 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3266 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3267 from the directory (as seen by other processes).
3268 </para>
3269 <para>
3270 <indexterm role="concept">
3271 <primary>installing Exim</primary>
3272 <secondary>testing the script</secondary>
3273 </indexterm>
3274 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3275 real, you can pass the <option>-n</option> option to the installation script by this
3276 command:
3277 </para>
3278 <literallayout class="monospaced">
3279 make INSTALL_ARG=-n install
3280 </literallayout>
3281 <para>
3282 The contents of the variable INSTALL_ARG are passed to the installation
3283 script. You do not need to be root to run this test. Alternatively, you can run
3284 the installation script directly, but this must be from within the build
3285 directory. For example, from the top-level Exim directory you could use this
3286 command:
3287 </para>
3288 <literallayout class="monospaced">
3289 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3290 </literallayout>
3291 <para>
3292 <indexterm role="concept">
3293 <primary>installing Exim</primary>
3294 <secondary>install script options</secondary>
3295 </indexterm>
3296 There are two other options that can be supplied to the installation script.
3297 </para>
3298 <itemizedlist>
3299 <listitem>
3300 <para>
3301 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3302 to root, and the call to make it a setuid binary.
3303 </para>
3304 </listitem>
3305 <listitem>
3306 <para>
3307 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3308 installed binary.
3309 </para>
3310 </listitem>
3311 </itemizedlist>
3312 <para>
3313 INSTALL_ARG can be used to pass these options to the script. For example:
3314 </para>
3315 <literallayout class="monospaced">
3316 make INSTALL_ARG=-no_symlink install
3317 </literallayout>
3318 <para>
3319 The installation script can also be given arguments specifying which files are
3320 to be copied. For example, to install just the Exim binary, and nothing else,
3321 without creating the symbolic link, you could use:
3322 </para>
3323 <literallayout class="monospaced">
3324 make INSTALL_ARG='-no_symlink exim' install
3325 </literallayout>
3326 </section>
3327 <section id="SECTinsinfdoc">
3328 <title>Installing info documentation</title>
3329 <para>
3330 <indexterm role="concept">
3331 <primary>installing Exim</primary>
3332 <secondary><emphasis>info</emphasis> documentation</secondary>
3333 </indexterm>
3334 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3335 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3336 distribution. Instead it is available separately from the FTP site (see section
3337 <xref linkend="SECTavail"/>).
3338 </para>
3339 <para>
3340 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3341 source of the documentation is found in the source tree, running <literal>make
3342 install</literal> automatically builds the info files and installs them.
3343 </para>
3344 </section>
3345 <section id="SECID33">
3346 <title>Setting up the spool directory</title>
3347 <para>
3348 <indexterm role="concept">
3349 <primary>spool directory</primary>
3350 <secondary>creating</secondary>
3351 </indexterm>
3352 When it starts up, Exim tries to create its spool directory if it does not
3353 exist. The Exim uid and gid are used for the owner and group of the spool
3354 directory. Sub-directories are automatically created in the spool directory as
3355 necessary.
3356 </para>
3357 </section>
3358 <section id="SECID34">
3359 <title>Testing</title>
3360 <para>
3361 <indexterm role="concept">
3362 <primary>testing</primary>
3363 <secondary>installation</secondary>
3364 </indexterm>
3365 Having installed Exim, you can check that the runtime configuration file is
3366 syntactically valid by running the following command, which assumes that the
3367 Exim binary directory is within your PATH environment variable:
3368 </para>
3369 <literallayout class="monospaced">
3370 exim -bV
3371 </literallayout>
3372 <para>
3373 If there are any errors in the configuration file, Exim outputs error messages.
3374 Otherwise it outputs the version number and build date,
3375 the DBM library that is being used, and information about which drivers and
3376 other optional code modules are included in the binary.
3377 Some simple routing tests can be done by using the address testing option. For
3378 example,
3379 </para>
3380 <literallayout>
3381 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3382 </literallayout>
3383 <para>
3384 should verify that it recognizes a local mailbox, and
3385 </para>
3386 <literallayout>
3387 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3388 </literallayout>
3389 <para>
3390 a remote one. Then try getting it to deliver mail, both locally and remotely.
3391 This can be done by passing messages directly to Exim, without going through a
3392 user agent. For example:
3393 </para>
3394 <literallayout class="monospaced">
3395 exim -v postmaster@your.domain.example
3396 From: user@your.domain.example
3397 To: postmaster@your.domain.example
3398 Subject: Testing Exim
3399
3400 This is a test message.
3401 ^D
3402 </literallayout>
3403 <para>
3404 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3405 In this case you should see copies of three log lines, one for the message&#x2019;s
3406 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3407 </para>
3408 <para>
3409 <indexterm role="concept">
3410 <primary>delivery</primary>
3411 <secondary>problems with</secondary>
3412 </indexterm>
3413 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3414 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3415 of information is running Exim with debugging turned on, by specifying the
3416 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3417 with debugging turned on by a command of the form
3418 </para>
3419 <literallayout>
3420 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3421 </literallayout>
3422 <para>
3423 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3424 produces rather a lot of output, but you can cut this down to specific areas.
3425 For example, if you use <option>-d-all+route</option> only the debugging information
3426 relevant to routing is included. (See the <option>-d</option> option in chapter
3427 <xref linkend="CHAPcommandline"/> for more details.)
3428 </para>
3429 <para>
3430 <indexterm role="concept">
3431 <primary><quote>sticky</quote> bit</primary>
3432 </indexterm>
3433 <indexterm role="concept">
3434 <primary>lock files</primary>
3435 </indexterm>
3436 One specific problem that has shown up on some sites is the inability to do
3437 local deliveries into a shared mailbox directory, because it does not have the
3438 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3439 writing to a mailbox file, and if it cannot create the lock file, the delivery
3440 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3441 directory, or by setting a specific group for local deliveries and allowing
3442 that group to create files in the directory (see the comments above the
3443 <command>local_delivery</command> transport in the default configuration file). Another
3444 approach is to configure Exim not to use lock files, but just to rely on
3445 <function>fcntl()</function> locking instead. However, you should do this only if all user
3446 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3447 see chapter <xref linkend="CHAPappendfile"/>.
3448 </para>
3449 <para>
3450 One thing that cannot be tested on a system that is already running an MTA is
3451 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3452 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3453 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3454 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3455 incoming SMTP mail.
3456 </para>
3457 <para>
3458 Testing a new version on a system that is already running Exim can most easily
3459 be done by building a binary with a different CONFIGURE_FILE setting. From
3460 within the runtime configuration, all other file and directory names
3461 that Exim uses can be altered, in order to keep it entirely clear of the
3462 production version.
3463 </para>
3464 </section>
3465 <section id="SECID35">
3466 <title>Replacing another MTA with Exim</title>
3467 <para>
3468 <indexterm role="concept">
3469 <primary>replacing another MTA</primary>
3470 </indexterm>
3471 Building and installing Exim for the first time does not of itself put it in
3472 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3473 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3474 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3475 binary in order to get the user agents to pass messages to Exim. This is
3476 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3477 or <filename>/usr/lib/sendmail</filename>
3478 <indexterm role="concept">
3479 <primary>symbolic link</primary>
3480 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3481 </indexterm>
3482 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3483 privilege and executable status from the old MTA. It is then necessary to stop
3484 and restart the mailer daemon, if one is running.
3485 </para>
3486 <para>
3487 <indexterm role="concept">
3488 <primary>FreeBSD, MTA indirection</primary>
3489 </indexterm>
3490 <indexterm role="concept">
3491 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3492 </indexterm>
3493 Some operating systems have introduced alternative ways of switching MTAs. For
3494 example, if you are running FreeBSD, you need to edit the file
3495 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3496 described. A typical example of the contents of this file for running Exim is
3497 as follows:
3498 </para>
3499 <literallayout class="monospaced">
3500 sendmail            /usr/exim/bin/exim
3501 send-mail           /usr/exim/bin/exim
3502 mailq               /usr/exim/bin/exim -bp
3503 newaliases          /usr/bin/true
3504 </literallayout>
3505 <para>
3506 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3507 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3508 favourite user agent.
3509 </para>
3510 <para>
3511 You should consider what to tell your users about the change of MTA. Exim may
3512 have different capabilities to what was previously running, and there are
3513 various operational differences such as the text of messages produced by
3514 command line options and in bounce messages. If you allow your users to make
3515 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3516 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3517 </para>
3518 </section>
3519 <section id="SECTdaemonLaunch">
3520 <title>Running the daemon</title>
3521 <para>
3522 The most common command line for launching the Exim daemon looks like
3523 </para>
3524 <literallayout class="monospaced">
3525 exim -bd -q5m
3526 </literallayout>
3527 <para>
3528 This starts a daemon which
3529 </para>
3530 <itemizedlist>
3531 <listitem>
3532 <para>
3533 listens for incoming smtp connections, launching handler processes for
3534 each new one
3535 </para>
3536 </listitem>
3537 <listitem>
3538 <para>
3539 starts a queue-runner process every five minutes, to inspect queued messages
3540 and run delivery attempts on any that have arrived at their retry time
3541 </para>
3542 </listitem>
3543 </itemizedlist>
3544 <para>
3545 Should a queue run take longer than the time between queue-runner starts,
3546 they will run in parallel.
3547 Numbers of jobs of the various types are subject to policy controls
3548 defined in the configuration.
3549 </para>
3550 </section>
3551 <section id="SECID36">
3552 <title>Upgrading Exim</title>
3553 <para>
3554 <indexterm role="concept">
3555 <primary>upgrading Exim</primary>
3556 </indexterm>
3557 If you are already running Exim on your host, building and installing a new
3558 version automatically makes it available to MUAs, or any other programs that
3559 call the MTA directly. However, if you are running an Exim daemon, you do need
3560 <indexterm role="concept">
3561 <primary>restart</primary>
3562 <secondary>on HUP signal</secondary>
3563 </indexterm>
3564 <indexterm role="concept">
3565 <primary>signal</primary>
3566 <secondary>HUP, to restart</secondary>
3567 </indexterm>
3568 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3569 new binary. You do not need to stop processing mail in order to install a new
3570 version of Exim. The install script does not modify an existing runtime
3571 configuration file.
3572 </para>
3573 </section>
3574 <section id="SECID37">
3575 <title>Stopping the Exim daemon on Solaris</title>
3576 <para>
3577 <indexterm role="concept">
3578 <primary>Solaris</primary>
3579 <secondary>stopping Exim on</secondary>
3580 </indexterm>
3581 The standard command for stopping the mailer daemon on Solaris is
3582 </para>
3583 <literallayout class="monospaced">
3584 /etc/init.d/sendmail stop
3585 </literallayout>
3586 <para>
3587 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3588 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3589 for the text <quote>sendmail</quote>; this is not present because the actual program name
3590 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3591 solution is to replace the line that finds the process id with something like
3592 </para>
3593 <literallayout class="monospaced">
3594 pid=`cat /var/spool/exim/exim-daemon.pid`
3595 </literallayout>
3596 <para>
3597 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3598 </para>
3599 <para>
3600 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3601 still be received from local processes, and if automatic delivery is configured
3602 (the normal case), deliveries will still occur.
3603 </para>
3604 </section>
3605 </chapter>
3606
3607 <chapter id="CHAPcommandline">
3608 <title>The Exim command line</title>
3609 <para>
3610 <indexterm role="concept" id="IIDclo1" class="startofrange">
3611 <primary>command line</primary>
3612 <secondary>options</secondary>
3613 </indexterm>
3614 <indexterm role="concept" id="IIDclo2" class="startofrange">
3615 <primary>options</primary>
3616 <secondary>command line</secondary>
3617 </indexterm>
3618 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3619 each starting with a hyphen character, followed by a number of arguments. The
3620 options are compatible with the main options of Sendmail, and there are also
3621 some additional options, some of which are compatible with Smail 3. Certain
3622 combinations of options do not make sense, and provoke an error if used.
3623 The form of the arguments depends on which options are set.
3624 </para>
3625 <section id="SECID38">
3626 <title>Setting options by program name</title>
3627 <para>
3628 <indexterm role="concept">
3629 <primary><emphasis>mailq</emphasis></primary>
3630 </indexterm>
3631 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3632 were present before any other options.
3633 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3634 standard output.
3635 This feature is for compatibility with some systems that contain a command of
3636 that name in one of the standard libraries, symbolically linked to
3637 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3638 </para>
3639 <para>
3640 <indexterm role="concept">
3641 <primary><emphasis>rsmtp</emphasis></primary>
3642 </indexterm>
3643 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3644 were present before any other options, for compatibility with Smail. The
3645 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3646 format.
3647 </para>
3648 <para>
3649 <indexterm role="concept">
3650 <primary><emphasis>rmail</emphasis></primary>
3651 </indexterm>
3652 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3653 <option>-oee</option> options were present before any other options, for compatibility with
3654 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3655 </para>
3656 <para>
3657 <indexterm role="concept">
3658 <primary><emphasis>runq</emphasis></primary>
3659 </indexterm>
3660 <indexterm role="concept">
3661 <primary>queue runner</primary>
3662 </indexterm>
3663 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3664 were present before any other options, for compatibility with Smail. The <option>-q</option>
3665 option causes a single queue runner process to be started.
3666 </para>
3667 <para>
3668 <indexterm role="concept">
3669 <primary><emphasis>newaliases</emphasis></primary>
3670 </indexterm>
3671 <indexterm role="concept">
3672 <primary>alias file</primary>
3673 <secondary>building</secondary>
3674 </indexterm>
3675 <indexterm role="concept">
3676 <primary>Sendmail compatibility</primary>
3677 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3678 </indexterm>
3679 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3680 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3681 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3682 the concept of a single alias file, but can be configured to run a given
3683 command if called with the <option>-bi</option> option.
3684 </para>
3685 </section>
3686 <section id="SECTtrustedadmin">
3687 <title>Trusted and admin users</title>
3688 <para>
3689 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3690 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3691 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3692 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3693 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3694 </para>
3695 <itemizedlist>
3696 <listitem>
3697 <para>
3698 <indexterm role="concept">
3699 <primary>trusted users</primary>
3700 <secondary>definition of</secondary>
3701 </indexterm>
3702 <indexterm role="concept">
3703 <primary>user</primary>
3704 <secondary>trusted definition of</secondary>
3705 </indexterm>
3706 The trusted users are root, the Exim user, any user listed in the
3707 <option>trusted_users</option> configuration option, and any user whose current group or any
3708 supplementary group is one of those listed in the <option>trusted_groups</option>
3709 configuration option. Note that the Exim group is not automatically trusted.
3710 </para>
3711 <para>
3712 <indexterm role="concept">
3713 <primary><quote>From</quote> line</primary>
3714 </indexterm>
3715 <indexterm role="concept">
3716 <primary>envelope from</primary>
3717 </indexterm>
3718 <indexterm role="concept">
3719 <primary>envelope sender</primary>
3720 </indexterm>
3721 Trusted users are always permitted to use the <option>-f</option> option or a leading
3722 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3723 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3724 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3725 users to set envelope senders.
3726 </para>
3727 <para>
3728 <indexterm role="concept">
3729 <primary><emphasis>From:</emphasis> header line</primary>
3730 </indexterm>
3731 <indexterm role="concept">
3732 <primary>header lines</primary>
3733 <secondary>From:</secondary>
3734 </indexterm>
3735 <indexterm role="concept">
3736 <primary><emphasis>Sender:</emphasis> header line</primary>
3737 </indexterm>
3738 <indexterm role="concept">
3739 <primary>header lines</primary>
3740 <secondary>Sender:</secondary>
3741 </indexterm>
3742 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3743 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3744 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3745 </para>
3746 <para>
3747 Trusted users may also specify a host name, host address, interface address,
3748 protocol name, ident value, and authentication data when submitting a message
3749 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3750 have the characteristics of messages received from a remote host. Untrusted
3751 users may in some circumstances use <option>-f</option>, but can never set the other values
3752 that are available to trusted users.
3753 </para>
3754 </listitem>
3755 <listitem>
3756 <para>
3757 <indexterm role="concept">
3758 <primary>user</primary>
3759 <secondary>admin definition of</secondary>
3760 </indexterm>
3761 <indexterm role="concept">
3762 <primary>admin user</primary>
3763 <secondary>definition of</secondary>
3764 </indexterm>
3765 The admin users are root, the Exim user, and any user that is a member of the
3766 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3767 The current group does not have to be one of these groups.
3768 </para>
3769 <para>
3770 Admin users are permitted to list the queue, and to carry out certain
3771 operations on messages, for example, to force delivery failures. It is also
3772 necessary to be an admin user in order to see the full information provided by
3773 the Exim monitor, and full debugging output.
3774 </para>
3775 <para>
3776 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3777 Exim to attempt delivery of messages on its queue is restricted to admin users.
3778 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3779 option false (that is, specifying <option>no_prod_requires_admin</option>).
3780 </para>
3781 <para>
3782 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3783 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3784 false.
3785 </para>
3786 </listitem>
3787 </itemizedlist>
3788 <para>
3789 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3790 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3791 getting root. There is further discussion of this issue at the start of chapter
3792 <xref linkend="CHAPconf"/>.
3793 </para>
3794 </section>
3795 <section id="SECID39">
3796 <title>Command line options</title>
3797 <para>
3798 Exim&#x2019;s command line options are described in alphabetical order below. If none
3799 of the options that specifies a specific action (such as starting the daemon or
3800 a queue runner, or testing an address, or receiving a message in a specific
3801 format, or listing the queue) are present, and there is at least one argument
3802 on the command line, <option>-bm</option> (accept a local message on the standard input,
3803 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3804 outputs a brief message about itself and exits.
3805 </para>
3806 <!-- === Start of command line options === -->
3807 <variablelist>
3808 <varlistentry>
3809 <term><option>--</option>&nbsp;--</term>
3810 <listitem>
3811 <para>
3812 <indexterm role="option">
3813 <primary><option>--</option></primary>
3814 </indexterm>
3815 <indexterm role="concept">
3816 <primary>options</primary>
3817 <secondary>command line; terminating</secondary>
3818 </indexterm>
3819 This is a pseudo-option whose only purpose is to terminate the options and
3820 therefore to cause subsequent command line items to be treated as arguments
3821 rather than options, even if they begin with hyphens.
3822 </para>
3823 </listitem></varlistentry>
3824 <varlistentry>
3825 <term><option>--help</option></term>
3826 <listitem>
3827 <para>
3828 <indexterm role="option">
3829 <primary><option>--help</option></primary>
3830 </indexterm>
3831 This option causes Exim to output a few sentences stating what it is.
3832 The same output is generated if the Exim binary is called with no options and
3833 no arguments.
3834 </para>
3835 </listitem></varlistentry>
3836 <varlistentry>
3837 <term><option>--version</option></term>
3838 <listitem>
3839 <para>
3840 <indexterm role="option">
3841 <primary><option>--version</option></primary>
3842 </indexterm>
3843 This option is an alias for <option>-bV</option> and causes version information to be
3844 displayed.
3845 </para>
3846 </listitem></varlistentry>
3847 <varlistentry>
3848 <term><option>-Ac</option></term>
3849 <term><option>-Am</option></term>
3850 <listitem>
3851 <para>
3852 <indexterm role="option">
3853 <primary><option>-Ac</option></primary>
3854 </indexterm>
3855 <indexterm role="option">
3856 <primary><option>-Am</option></primary>
3857 </indexterm>
3858 These options are used by Sendmail for selecting configuration files and are
3859 ignored by Exim.
3860 </para>
3861 </listitem></varlistentry>
3862 <varlistentry>
3863 <term><option>-B</option>&nbsp;&lt;<emphasis>type</emphasis>&gt;</term>
3864 <listitem>
3865 <para>
3866 <indexterm role="option">
3867 <primary><option>-B</option></primary>
3868 </indexterm>
3869 <indexterm role="option">
3870 <primary><option>-B</option></primary>
3871 </indexterm>
3872 <indexterm role="concept">
3873 <primary>8-bit characters</primary>
3874 </indexterm>
3875 <indexterm role="concept">
3876 <primary>Sendmail compatibility</primary>
3877 <secondary>8-bit characters</secondary>
3878 </indexterm>
3879 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3880 clean; it ignores this option.
3881 </para>
3882 </listitem></varlistentry>
3883 <varlistentry>
3884 <term><option>-bd</option></term>
3885 <listitem>
3886 <para>
3887 <indexterm role="option">
3888 <primary><option>-bd</option></primary>
3889 </indexterm>
3890 <indexterm role="concept">
3891 <primary>daemon</primary>
3892 </indexterm>
3893 <indexterm role="concept">
3894 <primary>SMTP</primary>
3895 <secondary>listener</secondary>
3896 </indexterm>
3897 <indexterm role="concept">
3898 <primary>queue runner</primary>
3899 </indexterm>
3900 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3901 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3902 that the daemon should also initiate periodic queue runs.
3903 </para>
3904 <para>
3905 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3906 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3907 disconnect from the controlling terminal. When running this way, it can be
3908 stopped by pressing ctrl-C.
3909 </para>
3910 <para>
3911 By default, Exim listens for incoming connections to the standard SMTP port on
3912 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3913 ports, on multiple ports, and only on specific interfaces. Chapter
3914 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3915 </para>
3916 <para>
3917 When a listening daemon
3918 <indexterm role="concept">
3919 <primary>daemon</primary>
3920 <secondary>process id (pid)</secondary>
3921 </indexterm>
3922 <indexterm role="concept">
3923 <primary>pid (process id)</primary>
3924 <secondary>of daemon</secondary>
3925 </indexterm>
3926 is started without the use of <option>-oX</option> (that is, without overriding the normal
3927 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3928 in Exim&#x2019;s spool directory. This location can be overridden by setting
3929 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3930 running as root.
3931 </para>
3932 <para>
3933 When <option>-oX</option> is used on the command line to start a listening daemon, the
3934 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3935 used to specify a path on the command line if a pid file is required.
3936 </para>
3937 <para>
3938 The SIGHUP signal
3939 <indexterm role="concept">
3940 <primary>SIGHUP</primary>
3941 </indexterm>
3942 <indexterm role="concept">
3943 <primary>restart</primary>
3944 <secondary>on HUP signal</secondary>
3945 </indexterm>
3946 <indexterm role="concept">
3947 <primary>signal</primary>
3948 <secondary>HUP, to restart</secondary>
3949 </indexterm>
3950 <indexterm role="concept">
3951 <primary>daemon</primary>
3952 <secondary>restarting</secondary>
3953 </indexterm>
3954 <indexterm role="concept">
3955 <primary>signal</primary>
3956 <secondary>to reload configuration</secondary>
3957 </indexterm>
3958 <indexterm role="concept">
3959 <primary>daemon</primary>
3960 <secondary>reload configuration</secondary>
3961 </indexterm>
3962 <indexterm role="concept">
3963 <primary>reload</primary>
3964 <secondary>configuration</secondary>
3965 </indexterm>
3966 can be used to cause the daemon to re-execute itself. This should be done
3967 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3968 means of the <option>.include</option> facility, is changed, and also whenever a new version
3969 of Exim is installed. It is not necessary to do this when other files that are
3970 referenced from the configuration (for example, alias files) are changed,
3971 because these are reread each time they are used.
3972 </para>
3973 <para revisionflag="changed">
3974 Either a SIGTERM or a SIGINT signal should be used to cause the daemon
3975 to cleanly shut down.
3976 Subprocesses handling recceiving or delivering messages,
3977 or for scanning the queue,
3978 will not be affected by the termination of the daemon process.
3979 </para>
3980 </listitem></varlistentry>
3981 <varlistentry>
3982 <term><option>-bdf</option></term>
3983 <listitem>
3984 <para>
3985 <indexterm role="option">
3986 <primary><option>-bdf</option></primary>
3987 </indexterm>
3988 This option has the same effect as <option>-bd</option> except that it never disconnects
3989 from the controlling terminal, even when no debugging is specified.
3990 </para>
3991 </listitem></varlistentry>
3992 <varlistentry>
3993 <term><option>-be</option></term>
3994 <listitem>
3995 <para>
3996 <indexterm role="option">
3997 <primary><option>-be</option></primary>
3998 </indexterm>
3999 <indexterm role="concept">
4000 <primary>testing</primary>
4001 <secondary>string expansion</secondary>
4002 </indexterm>
4003 <indexterm role="concept">
4004 <primary>expansion</primary>
4005 <secondary>testing</secondary>
4006 </indexterm>
4007 Run Exim in expansion testing mode. Exim discards its root privilege, to
4008 prevent ordinary users from using this mode to read otherwise inaccessible
4009 files. If no arguments are given, Exim runs interactively, prompting for lines
4010 of data. Otherwise, it processes each argument in turn.
4011 </para>
4012 <para>
4013 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
4014 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
4015 used without command line arguments. If successful, it uses the <function>readline()</function>
4016 function, which provides extensive line-editing facilities, for reading the
4017 test data. A line history is supported.
4018 </para>
4019 <para>
4020 Long expansion expressions can be split over several lines by using backslash
4021 continuations. As in Exim&#x2019;s runtime configuration, white space at the start of
4022 continuation lines is ignored. Each argument or data line is passed through the
4023 string expansion mechanism, and the result is output. Variable values from the
4024 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
4025 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
4026 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
4027 </para>
4028 <para>
4029 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
4030 files or databases you are using, you must exit and restart Exim before trying
4031 the same lookup again. Otherwise, because each Exim process caches the results
4032 of lookups, you will just get the same result as before.
4033 </para>
4034 <para>
4035 Macro processing is done on lines before string-expansion: new macros can be
4036 defined and macros will be expanded.
4037 Because macros in the config file are often used for secrets, those are only
4038 available to admin users.
4039 </para>
4040 <para revisionflag="changed">
4041 The word <quote>set</quote> at the start of a line, followed by a single space,
4042 is recognised specially as defining a value for a variable.
4043 The syntax is otherwise the same as the ACL modifier <quote>set =</quote>.
4044 </para>
4045 </listitem></varlistentry>
4046 <varlistentry>
4047 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4048 <listitem>
4049 <para>
4050 <indexterm role="option">
4051 <primary><option>-bem</option></primary>
4052 </indexterm>
4053 <indexterm role="concept">
4054 <primary>testing</primary>
4055 <secondary>string expansion</secondary>
4056 </indexterm>
4057 <indexterm role="concept">
4058 <primary>expansion</primary>
4059 <secondary>testing</secondary>
4060 </indexterm>
4061 This option operates like <option>-be</option> except that it must be followed by the name
4062 of a file. For example:
4063 </para>
4064 <literallayout class="monospaced">
4065 exim -bem /tmp/testmessage
4066 </literallayout>
4067 <para>
4068 The file is read as a message (as if receiving a locally-submitted non-SMTP
4069 message) before any of the test expansions are done. Thus, message-specific
4070 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
4071 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
4072 recipients are read from the headers in the normal way, and are shown in the
4073 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
4074 line, because further arguments are taken as strings to expand (just like
4075 <option>-be</option>).
4076 </para>
4077 </listitem></varlistentry>
4078 <varlistentry>
4079 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4080 <listitem>
4081 <para>
4082 <indexterm role="option">
4083 <primary><option>-bF</option></primary>
4084 </indexterm>
4085 <indexterm role="concept">
4086 <primary>system filter</primary>
4087 <secondary>testing</secondary>
4088 </indexterm>
4089 <indexterm role="concept">
4090 <primary>testing</primary>
4091 <secondary>system filter</secondary>
4092 </indexterm>
4093 This option is the same as <option>-bf</option> except that it assumes that the filter being
4094 tested is a system filter. The additional commands that are available only in
4095 system filters are recognized.
4096 </para>
4097 </listitem></varlistentry>
4098 <varlistentry>
4099 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4100 <listitem>
4101 <para>
4102 <indexterm role="option">
4103 <primary><option>-bf</option></primary>
4104 </indexterm>
4105 <indexterm role="concept">
4106 <primary>filter</primary>
4107 <secondary>testing</secondary>
4108 </indexterm>
4109 <indexterm role="concept">
4110 <primary>testing</primary>
4111 <secondary>filter file</secondary>
4112 </indexterm>
4113 <indexterm role="concept">
4114 <primary>forward file</primary>
4115 <secondary>testing</secondary>
4116 </indexterm>
4117 <indexterm role="concept">
4118 <primary>testing</primary>
4119 <secondary>forward file</secondary>
4120 </indexterm>
4121 <indexterm role="concept">
4122 <primary>Sieve filter</primary>
4123 <secondary>testing</secondary>
4124 </indexterm>
4125 This option runs Exim in user filter testing mode; the file is the filter file
4126 to be tested, and a test message must be supplied on the standard input. If
4127 there are no message-dependent tests in the filter, an empty file can be
4128 supplied.
4129 </para>
4130 <para>
4131 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
4132 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
4133 filter and a user filter in the same run. For example:
4134 </para>
4135 <literallayout class="monospaced">
4136 exim -bF /system/filter -bf /user/filter &lt;/test/message
4137 </literallayout>
4138 <para>
4139 This is helpful when the system filter adds header lines or sets filter
4140 variables that are used by the user filter.
4141 </para>
4142 <para>
4143 If the test filter file does not begin with one of the special lines
4144 </para>
4145 <literallayout class="monospaced">
4146 # Exim filter
4147 # Sieve filter
4148 </literallayout>
4149 <para>
4150 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
4151 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
4152 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
4153 redirection lists.
4154 </para>
4155 <para>
4156 The result of an Exim command that uses <option>-bf</option>, provided no errors are
4157 detected, is a list of the actions that Exim would try to take if presented
4158 with the message for real. More details of filter testing are given in the
4159 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
4160 </para>
4161 <para>
4162 When testing a filter file,
4163 <indexterm role="concept">
4164 <primary><quote>From</quote> line</primary>
4165 </indexterm>
4166 <indexterm role="concept">
4167 <primary>envelope from</primary>
4168 </indexterm>
4169 <indexterm role="concept">
4170 <primary>envelope sender</primary>
4171 </indexterm>
4172 <indexterm role="option">
4173 <primary><option>-f</option></primary>
4174 <secondary>for filter testing</secondary>
4175 </indexterm>
4176 the envelope sender can be set by the <option>-f</option> option,
4177 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
4178 that would normally be taken from the envelope recipient address of the message
4179 can be set by means of additional command line options (see the next four
4180 options).
4181 </para>
4182 </listitem></varlistentry>
4183 <varlistentry>
4184 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
4185 <listitem>
4186 <para>
4187 <indexterm role="option">
4188 <primary><option>-bfd</option></primary>
4189 </indexterm>
4190 <indexterm role="variable">
4191 <primary><varname>$qualify_domain</varname></primary>
4192 </indexterm>
4193 This sets the domain of the recipient address when a filter file is being
4194 tested by means of the <option>-bf</option> option. The default is the value of
4195 <varname>$qualify_domain</varname>.
4196 </para>
4197 </listitem></varlistentry>
4198 <varlistentry>
4199 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4200 <listitem>
4201 <para>
4202 <indexterm role="option">
4203 <primary><option>-bfl</option></primary>
4204 </indexterm>
4205 This sets the local part of the recipient address when a filter file is being
4206 tested by means of the <option>-bf</option> option. The default is the username of the
4207 process that calls Exim. A local part should be specified with any prefix or
4208 suffix stripped, because that is how it appears to the filter when a message is
4209 actually being delivered.
4210 </para>
4211 </listitem></varlistentry>
4212 <varlistentry>
4213 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4214 <listitem>
4215 <para>
4216 <indexterm role="option">
4217 <primary><option>-bfp</option></primary>
4218 </indexterm>
4219 <indexterm role="concept">
4220 <primary>affix</primary>
4221 <secondary>filter testing</secondary>
4222 </indexterm>
4223 This sets the prefix of the local part of the recipient address when a filter
4224 file is being tested by means of the <option>-bf</option> option. The default is an empty
4225 prefix.
4226 </para>
4227 </listitem></varlistentry>
4228 <varlistentry>
4229 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4230 <listitem>
4231 <para>
4232 <indexterm role="option">
4233 <primary><option>-bfs</option></primary>
4234 </indexterm>
4235 <indexterm role="concept">
4236 <primary>affix</primary>
4237 <secondary>filter testing</secondary>
4238 </indexterm>
4239 This sets the suffix of the local part of the recipient address when a filter
4240 file is being tested by means of the <option>-bf</option> option. The default is an empty
4241 suffix.
4242 </para>
4243 </listitem></varlistentry>
4244 <varlistentry>
4245 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4246 <listitem>
4247 <para>
4248 <indexterm role="option">
4249 <primary><option>-bh</option></primary>
4250 </indexterm>
4251 <indexterm role="concept">
4252 <primary>testing</primary>
4253 <secondary>incoming SMTP</secondary>
4254 </indexterm>
4255 <indexterm role="concept">
4256 <primary>SMTP</primary>
4257 <secondary>testing incoming</secondary>
4258 </indexterm>
4259 <indexterm role="concept">
4260 <primary>testing</primary>
4261 <secondary>relay control</secondary>
4262 </indexterm>
4263 <indexterm role="concept">
4264 <primary>relaying</primary>
4265 <secondary>testing configuration</secondary>
4266 </indexterm>
4267 <indexterm role="concept">
4268 <primary>policy control</primary>
4269 <secondary>testing</secondary>
4270 </indexterm>
4271 <indexterm role="concept">
4272 <primary>debugging</primary>
4273 <secondary><option>-bh</option> option</secondary>
4274 </indexterm>
4275 This option runs a fake SMTP session as if from the given IP address, using the
4276 standard input and output. The IP address may include a port number at the end,
4277 after a full stop. For example:
4278 </para>
4279 <literallayout class="monospaced">
4280 exim -bh 10.9.8.7.1234
4281 exim -bh fe80::a00:20ff:fe86:a061.5678
4282 </literallayout>
4283 <para>
4284 When an IPv6 address is given, it is converted into canonical form. In the case
4285 of the second example above, the value of <varname>$sender_host_address</varname> after
4286 conversion to the canonical form is
4287 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4288 </para>
4289 <para>
4290 Comments as to what is going on are written to the standard error file. These
4291 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4292 This facility is provided for testing configuration options for incoming
4293 messages, to make sure they implement the required policy. For example, you can
4294 test your relay controls using <option>-bh</option>.
4295 </para>
4296 <para>
4297 <emphasis role="bold">Warning 1</emphasis>:
4298 <indexterm role="concept">
4299 <primary>RFC 1413</primary>
4300 </indexterm>
4301 You can test features of the configuration that rely on ident (RFC 1413)
4302 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4303 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4304 connection.
4305 </para>
4306 <para>
4307 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4308 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4309 occur, use <option>-bhc</option> instead.
4310 </para>
4311 <para>
4312 Messages supplied during the testing session are discarded, and nothing is
4313 written to any of the real log files. There may be pauses when DNS (and other)
4314 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4315 can be used to specify a specific IP interface and port if this is important,
4316 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4317 session were authenticated.
4318 </para>
4319 <para>
4320 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4321 output just states whether a given recipient address from a given host is
4322 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4323 </para>
4324 <para>
4325 Features such as authentication and encryption, where the client input is not
4326 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4327 specialized SMTP test program such as
4328 <emphasis role="bold"><ulink url="https://www.jetmore.org/john/code/swaks/">swaks</ulink></emphasis>.
4329 </para>
4330 </listitem></varlistentry>
4331 <varlistentry>
4332 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4333 <listitem>
4334 <para>
4335 <indexterm role="option">
4336 <primary><option>-bhc</option></primary>
4337 </indexterm>
4338 This option operates in the same way as <option>-bh</option>, except that address
4339 verification callouts are performed if required. This includes consulting and
4340 updating the callout cache database.
4341 </para>
4342 </listitem></varlistentry>
4343 <varlistentry>
4344 <term><option>-bi</option></term>
4345 <listitem>
4346 <para>
4347 <indexterm role="option">
4348 <primary><option>-bi</option></primary>
4349 </indexterm>
4350 <indexterm role="concept">
4351 <primary>alias file</primary>
4352 <secondary>building</secondary>
4353 </indexterm>
4354 <indexterm role="concept">
4355 <primary>building alias file</primary>
4356 </indexterm>
4357 <indexterm role="concept">
4358 <primary>Sendmail compatibility</primary>
4359 <secondary><option>-bi</option> option</secondary>
4360 </indexterm>
4361 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4362 Exim does not have the concept of a single alias file, and so it cannot mimic
4363 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4364 tend to appear in various scripts such as NIS make files, so the option must be
4365 recognized.
4366 </para>
4367 <para>
4368 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4369 configuration option is run, under the uid and gid of the caller of Exim. If
4370 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4371 The command set by <option>bi_command</option> may not contain arguments. The command can
4372 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4373 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4374 <option>-bi</option> is a no-op.
4375 </para>
4376 </listitem></varlistentry>
4377 <varlistentry>
4378 <term><option>-bI:help</option></term>
4379 <listitem>
4380 <para>
4381 <indexterm role="option">
4382 <primary><option>-bI:help</option></primary>
4383 </indexterm>
4384 <indexterm role="concept">
4385 <primary>querying exim information</primary>
4386 </indexterm>
4387 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4388 information.  The output of many of these will be intended for machine
4389 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4390 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4391 options shall cause Exim to exit after producing the requested output.
4392 </para>
4393 </listitem></varlistentry>
4394 <varlistentry>
4395 <term><option>-bI:dscp</option></term>
4396 <listitem>
4397 <para>
4398 <indexterm role="option">
4399 <primary><option>-bI:dscp</option></primary>
4400 </indexterm>
4401 <indexterm role="concept">
4402 <primary>DSCP</primary>
4403 <secondary>values</secondary>
4404 </indexterm>
4405 This option causes Exim to emit an alphabetically sorted list of all
4406 recognised DSCP names.
4407 </para>
4408 </listitem></varlistentry>
4409 <varlistentry>
4410 <term><option>-bI:sieve</option></term>
4411 <listitem>
4412 <para>
4413 <indexterm role="option">
4414 <primary><option>-bI:sieve</option></primary>
4415 </indexterm>
4416 <indexterm role="concept">
4417 <primary>Sieve filter</primary>
4418 <secondary>capabilities</secondary>
4419 </indexterm>
4420 This option causes Exim to emit an alphabetically sorted list of all supported
4421 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4422 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4423 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4424 compile-time build options, which this option will adapt to, this is the only
4425 way to guarantee a correct response.
4426 </para>
4427 </listitem></varlistentry>
4428 <varlistentry>
4429 <term><option>-bm</option></term>
4430 <listitem>
4431 <para>
4432 <indexterm role="option">
4433 <primary><option>-bm</option></primary>
4434 </indexterm>
4435 <indexterm role="concept">
4436 <primary>local message reception</primary>
4437 </indexterm>
4438 This option runs an Exim receiving process that accepts an incoming,
4439 locally-generated message on the standard input. The recipients are given as the
4440 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4441 argument can be a comma-separated list of RFC 2822 addresses. This is the
4442 default option for selecting the overall action of an Exim call; it is assumed
4443 if no other conflicting option is present.
4444 </para>
4445 <para>
4446 If any addresses in the message are unqualified (have no domain), they are
4447 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4448 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4449 suppressing this for special cases.
4450 </para>
4451 <para>
4452 Policy checks on the contents of local messages can be enforced by means of
4453 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4454 </para>
4455 <para>
4456 <indexterm role="concept">
4457 <primary>return code</primary>
4458 <secondary>for <option>-bm</option></secondary>
4459 </indexterm>
4460 The return code is zero if the message is successfully accepted. Otherwise, the
4461 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4462 </para>
4463 <para>
4464 The format
4465 <indexterm role="concept">
4466 <primary>message</primary>
4467 <secondary>format</secondary>
4468 </indexterm>
4469 <indexterm role="concept">
4470 <primary>format</primary>
4471 <secondary>message</secondary>
4472 </indexterm>
4473 <indexterm role="concept">
4474 <primary><quote>From</quote> line</primary>
4475 </indexterm>
4476 <indexterm role="concept">
4477 <primary>UUCP</primary>
4478 <secondary><quote>From</quote> line</secondary>
4479 </indexterm>
4480 <indexterm role="concept">
4481 <primary>Sendmail compatibility</primary>
4482 <secondary><quote>From</quote> line</secondary>
4483 </indexterm>
4484 of the message must be as defined in RFC 2822, except that, for
4485 compatibility with Sendmail and Smail, a line in one of the forms
4486 </para>
4487 <literallayout class="monospaced">
4488 From sender Fri Jan  5 12:55 GMT 1997
4489 From sender Fri, 5 Jan 97 12:55:01
4490 </literallayout>
4491 <para>
4492 (with the weekday optional, and possibly with additional text after the date)
4493 is permitted to appear at the start of the message. There appears to be no
4494 authoritative specification of the format of this line. Exim recognizes it by
4495 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4496 option, which can be changed if necessary.
4497 </para>
4498 <para>
4499 <indexterm role="option">
4500 <primary><option>-f</option></primary>
4501 <secondary>overriding <quote>From</quote> line</secondary>
4502 </indexterm>
4503 The specified sender is treated as if it were given as the argument to the
4504 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4505 preference to the address taken from the message. The caller of Exim must be a
4506 trusted user for the sender of a message to be set in this way.
4507 </para>
4508 </listitem></varlistentry>
4509 <varlistentry>
4510 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4511 <listitem>
4512 <para>
4513 <indexterm role="option">
4514 <primary><option>-bmalware</option></primary>
4515 </indexterm>
4516 <indexterm role="concept">
4517 <primary>testing</primary>
4518 <secondary>,</secondary>
4519 </indexterm>
4520 <indexterm role="concept">
4521 <primary>malware scan test</primary>
4522 </indexterm>
4523 This debugging option causes Exim to scan the given file or directory
4524 (depending on the used scanner interface),
4525 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4526 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4527 the expansion should have defaults which apply to this invocation.  ACLs are
4528 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4529 will never be populated and <option>-bmalware</option> will fail.
4530 </para>
4531 <para>
4532 Exim will have changed working directory before resolving the filename, so
4533 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4534 user when it tries to open the file, rather than as the invoking user.
4535 This option requires admin privileges.
4536 </para>
4537 <para>
4538 The <option>-bmalware</option> option will not be extended to be more generally useful,
4539 there are better tools for file-scanning.  This option exists to help
4540 administrators verify their Exim and AV scanner configuration.
4541 </para>
4542 </listitem></varlistentry>
4543 <varlistentry>
4544 <term><option>-bnq</option></term>
4545 <listitem>
4546 <para>
4547 <indexterm role="option">
4548 <primary><option>-bnq</option></primary>
4549 </indexterm>
4550 <indexterm role="concept">
4551 <primary>address qualification, suppressing</primary>
4552 </indexterm>
4553 By default, Exim automatically qualifies unqualified addresses (those
4554 without domains) that appear in messages that are submitted locally (that
4555 is, not over TCP/IP). This qualification applies both to addresses in
4556 envelopes, and addresses in header lines. Sender addresses are qualified using
4557 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4558 defaults to the value of <option>qualify_domain</option>).
4559 </para>
4560 <para>
4561 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4562 being used to re-submit messages that originally came from remote hosts after
4563 content scanning, you probably do not want to qualify unqualified addresses in
4564 header lines. (Such lines will be present only if you have not enabled a header
4565 syntax check in the appropriate ACL.)
4566 </para>
4567 <para>
4568 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4569 messages that originate on the local host. When this is used, unqualified
4570 addresses in the envelope provoke errors (causing message rejection) and
4571 unqualified addresses in header lines are left alone.
4572 </para>
4573 </listitem></varlistentry>
4574 <varlistentry>
4575 <term><option>-bP</option></term>
4576 <listitem>
4577 <para>
4578 <indexterm role="option">
4579 <primary><option>-bP</option></primary>
4580 </indexterm>
4581 <indexterm role="concept">
4582 <primary>configuration options</primary>
4583 <secondary>extracting</secondary>
4584 </indexterm>
4585 <indexterm role="concept">
4586 <primary>options</primary>
4587 <secondary>configuration &ndash; extracting</secondary>
4588 </indexterm>
4589 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4590 main configuration options to be written to the standard output. The values
4591 of one or more specific options can be requested by giving their names as
4592 arguments, for example:
4593 </para>
4594 <literallayout class="monospaced">
4595 exim -bP qualify_domain hold_domains
4596 </literallayout>
4597 <para>
4598 <indexterm role="concept">
4599 <primary>hiding configuration option values</primary>
4600 </indexterm>
4601 <indexterm role="concept">
4602 <primary>configuration options</primary>
4603 <secondary>hiding value of</secondary>
4604 </indexterm>
4605 <indexterm role="concept">
4606 <primary>options</primary>
4607 <secondary>hiding value of</secondary>
4608 </indexterm>
4609 However, any option setting that is preceded by the word <quote>hide</quote> in the
4610 configuration file is not shown in full, except to an admin user. For other
4611 users, the output is as in this example:
4612 </para>
4613 <literallayout class="monospaced">
4614 mysql_servers = &lt;value not displayable&gt;
4615 </literallayout>
4616 <para>
4617 If <option>config</option> is given as an argument, the config is
4618 output, as it was parsed, any include file resolved, any comment removed.
4619 </para>
4620 <para>
4621 If <option>config_file</option> is given as an argument, the name of the runtime
4622 configuration file is output. (<option>configure_file</option> works too, for
4623 backward compatibility.)
4624 If a list of configuration files was supplied, the value that is output here
4625 is the name of the file that was actually used.
4626 </para>
4627 <para>
4628 <indexterm role="concept">
4629 <primary>options</primary>
4630 <secondary>hiding name of</secondary>
4631 </indexterm>
4632 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4633 name will not be output.
4634 </para>
4635 <para>
4636 <indexterm role="concept">
4637 <primary>daemon</primary>
4638 <secondary>process id (pid)</secondary>
4639 </indexterm>
4640 <indexterm role="concept">
4641 <primary>pid (process id)</primary>
4642 <secondary>of daemon</secondary>
4643 </indexterm>
4644 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4645 directories where log files and daemon pid files are written are output,
4646 respectively. If these values are unset, log files are written in a
4647 sub-directory of the spool directory called <option>log</option>, and the pid file is
4648 written directly into the spool directory.
4649 </para>
4650 <para>
4651 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4652 </para>
4653 <literallayout class="monospaced">
4654 exim -bP +local_domains
4655 </literallayout>
4656 <para>
4657 it searches for a matching named list of any type (domain, host, address, or
4658 local part) and outputs what it finds.
4659 </para>
4660 <para>
4661 <indexterm role="concept">
4662 <primary>options</primary>
4663 <secondary>router &ndash; extracting</secondary>
4664 </indexterm>
4665 <indexterm role="concept">
4666 <primary>options</primary>
4667 <secondary>transport &ndash; extracting</secondary>
4668 </indexterm>
4669 <indexterm role="concept">
4670 <primary>options</primary>
4671 <secondary>authenticator &ndash; extracting</secondary>
4672 </indexterm>
4673 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4674 followed by the name of an appropriate driver instance, the option settings for
4675 that driver are output. For example:
4676 </para>
4677 <literallayout class="monospaced">
4678 exim -bP transport local_delivery
4679 </literallayout>
4680 <para>
4681 The generic driver options are output first, followed by the driver&#x2019;s private
4682 options. A list of the names of drivers of a particular type can be obtained by
4683 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4684 <option>authenticator_list</option>, and a complete list of all drivers with their option
4685 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4686 <option>authenticators</option>.
4687 </para>
4688 <para>
4689 <indexterm role="concept">
4690 <primary>environment</primary>
4691 </indexterm>
4692 If <option>environment</option> is given as an argument, the set of environment
4693 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4694 variables.
4695 </para>
4696 <para>
4697 <indexterm role="concept">
4698 <primary>options</primary>
4699 <secondary>macro &ndash; extracting</secondary>
4700 </indexterm>
4701 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4702 are available, similarly to the drivers.  Because macros are sometimes used
4703 for storing passwords, this option is restricted.
4704 The output format is one item per line.
4705 For the "-bP macro &lt;name&gt;" form, if no such macro is found
4706 the exit status will be nonzero.
4707 </para>
4708 </listitem></varlistentry>
4709 <varlistentry>
4710 <term><option>-bp</option></term>
4711 <listitem>
4712 <para>
4713 <indexterm role="option">
4714 <primary><option>-bp</option></primary>
4715 </indexterm>
4716 <indexterm role="concept">
4717 <primary>queue</primary>
4718 <secondary>listing messages in</secondary>
4719 </indexterm>
4720 <indexterm role="concept">
4721 <primary>listing</primary>
4722 <secondary>messages in the queue</secondary>
4723 </indexterm>
4724 This option requests a listing of the contents of the mail queue on the
4725 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4726 just those messages are listed. By default, this option can be used only by an
4727 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4728 to allow any user to see the queue.
4729 </para>
4730 <para>
4731 Each message in the queue is displayed as in the following example:
4732 </para>
4733 <literallayout class="monospaced">
4734 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4735           red.king@looking-glass.fict.example
4736           &lt;other addresses&gt;
4737 </literallayout>
4738 <para>
4739 <indexterm role="concept">
4740 <primary>message</primary>
4741 <secondary>size in queue listing</secondary>
4742 </indexterm>
4743 <indexterm role="concept">
4744 <primary>size</primary>
4745 <secondary>of message</secondary>
4746 </indexterm>
4747 The first line contains the length of time the message has been in the queue
4748 (in this case 25 minutes), the size of the message (2.9K), the unique local
4749 identifier for the message, and the message sender, as contained in the
4750 envelope. For bounce messages, the sender address is empty, and appears as
4751 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4752 the default sender address, the user&#x2019;s login name is shown in parentheses
4753 before the sender address.
4754 </para>
4755 <para>
4756 <indexterm role="concept">
4757 <primary>frozen messages</primary>
4758 <secondary>in queue listing</secondary>
4759 </indexterm>
4760 If the message is frozen (attempts to deliver it are suspended) then the text
4761 <quote>*** frozen ***</quote> is displayed at the end of this line.
4762 </para>
4763 <para>
4764 The recipients of the message (taken from the envelope, not the headers) are
4765 displayed on subsequent lines. Those addresses to which the message has already
4766 been delivered are marked with the letter D. If an original address gets
4767 expanded into several addresses via an alias or forward file, the original is
4768 displayed with a D only when deliveries for all of its child addresses are
4769 complete.
4770 </para>
4771 </listitem></varlistentry>
4772 <varlistentry>
4773 <term><option>-bpa</option></term>
4774 <listitem>
4775 <para>
4776 <indexterm role="option">
4777 <primary><option>-bpa</option></primary>
4778 </indexterm>
4779 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4780 that were generated from the original top level address(es) in each message by
4781 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4782 of just <quote>D</quote>.
4783 </para>
4784 </listitem></varlistentry>
4785 <varlistentry>
4786 <term><option>-bpc</option></term>
4787 <listitem>
4788 <para>
4789 <indexterm role="option">
4790 <primary><option>-bpc</option></primary>
4791 </indexterm>
4792 <indexterm role="concept">
4793 <primary>queue</primary>
4794 <secondary>count of messages on</secondary>
4795 </indexterm>
4796 This option counts the number of messages in the queue, and writes the total
4797 to the standard output. It is restricted to admin users, unless
4798 <option>queue_list_requires_admin</option> is set false.
4799 </para>
4800 </listitem></varlistentry>
4801 <varlistentry>
4802 <term><option>-bpi</option></term>
4803 <listitem>
4804 <para>
4805 <indexterm role="option">
4806 <primary><option>-bpi</option></primary>
4807 </indexterm>
4808 <indexterm role="concept">
4809 <primary>queue</primary>
4810 <secondary>list of message IDs</secondary>
4811 </indexterm>
4812 This option operates like <option>-bp</option>, but only outputs message ids
4813 (one per line).
4814 </para>
4815 </listitem></varlistentry>
4816 <varlistentry>
4817 <term><option>-bpr</option></term>
4818 <listitem>
4819 <para>
4820 <indexterm role="option">
4821 <primary><option>-bpr</option></primary>
4822 </indexterm>
4823 This option operates like <option>-bp</option>, but the output is not sorted into
4824 chronological order of message arrival. This can speed it up when there are
4825 lots of messages in the queue, and is particularly useful if the output is
4826 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4827 </para>
4828 </listitem></varlistentry>
4829 <varlistentry>
4830 <term><option>-bpra</option></term>
4831 <listitem>
4832 <para>
4833 <indexterm role="option">
4834 <primary><option>-bpra</option></primary>
4835 </indexterm>
4836 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4837 </para>
4838 </listitem></varlistentry>
4839 <varlistentry>
4840 <term><option>-bpri</option></term>
4841 <listitem>
4842 <para>
4843 <indexterm role="option">
4844 <primary><option>-bpri</option></primary>
4845 </indexterm>
4846 This option is a combination of <option>-bpr</option> and <option>-bpi</option>.
4847 </para>
4848 </listitem></varlistentry>
4849 <varlistentry>
4850 <term><option>-bpru</option></term>
4851 <listitem>
4852 <para>
4853 <indexterm role="option">
4854 <primary><option>-bpru</option></primary>
4855 </indexterm>
4856 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4857 </para>
4858 </listitem></varlistentry>
4859 <varlistentry>
4860 <term><option>-bpu</option></term>
4861 <listitem>
4862 <para>
4863 <indexterm role="option">
4864 <primary><option>-bpu</option></primary>
4865 </indexterm>
4866 This option operates like <option>-bp</option> but shows only undelivered top-level
4867 addresses for each message displayed. Addresses generated by aliasing or
4868 forwarding are not shown, unless the message was deferred after processing by a
4869 router with the <option>one_time</option> option set.
4870 </para>
4871 </listitem></varlistentry>
4872 <varlistentry>
4873 <term><option>-brt</option></term>
4874 <listitem>
4875 <para>
4876 <indexterm role="option">
4877 <primary><option>-brt</option></primary>
4878 </indexterm>
4879 <indexterm role="concept">
4880 <primary>testing</primary>
4881 <secondary>retry configuration</secondary>
4882 </indexterm>
4883 <indexterm role="concept">
4884 <primary>retry</primary>
4885 <secondary>configuration testing</secondary>
4886 </indexterm>
4887 This option is for testing retry rules, and it must be followed by up to three
4888 arguments. It causes Exim to look for a retry rule that matches the values
4889 and to write it to the standard output. For example:
4890 </para>
4891 <literallayout class="monospaced">
4892 exim -brt bach.comp.mus.example
4893 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4894 </literallayout>
4895 <para>
4896 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4897 argument, which is required, can be a complete address in the form
4898 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4899 contains a dot, it is interpreted as an optional second domain name; if no
4900 retry rule is found for the first argument, the second is tried. This ties in
4901 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4902 rule is found that matches the host, one that matches the mail domain is
4903 sought. Finally, an argument that is the name of a specific delivery error, as
4904 used in setting up retry rules, can be given. For example:
4905 </para>
4906 <literallayout class="monospaced">
4907 exim -brt haydn.comp.mus.example quota_3d
4908 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4909 </literallayout>
4910 </listitem></varlistentry>
4911 <varlistentry>
4912 <term><option>-brw</option></term>
4913 <listitem>
4914 <para>
4915 <indexterm role="option">
4916 <primary><option>-brw</option></primary>
4917 </indexterm>
4918 <indexterm role="concept">
4919 <primary>testing</primary>
4920 <secondary>rewriting</secondary>
4921 </indexterm>
4922 <indexterm role="concept">
4923 <primary>rewriting</primary>
4924 <secondary>testing</secondary>
4925 </indexterm>
4926 This option is for testing address rewriting rules, and it must be followed by
4927 a single argument, consisting of either a local part without a domain, or a
4928 complete address with a fully qualified domain. Exim outputs how this address
4929 would be rewritten for each possible place it might appear. See chapter
4930 <xref linkend="CHAPrewrite"/> for further details.
4931 </para>
4932 </listitem></varlistentry>
4933 <varlistentry>
4934 <term><option>-bS</option></term>
4935 <listitem>
4936 <para>
4937 <indexterm role="option">
4938 <primary><option>-bS</option></primary>
4939 </indexterm>
4940 <indexterm role="concept">
4941 <primary>SMTP</primary>
4942 <secondary>batched incoming</secondary>
4943 </indexterm>
4944 <indexterm role="concept">
4945 <primary>batched SMTP input</primary>
4946 </indexterm>
4947 This option is used for batched SMTP input, which is an alternative interface
4948 for non-interactive local message submission. A number of messages can be
4949 submitted in a single run. However, despite its name, this is not really SMTP
4950 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4951 input, but generates no responses. If the caller is trusted, or
4952 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4953 believed; otherwise the sender is always the caller of Exim.
4954 </para>
4955 <para>
4956 The message itself is read from the standard input, in SMTP format (leading
4957 dots doubled), terminated by a line containing just a single dot. An error is
4958 provoked if the terminating dot is missing. A further message may then follow.
4959 </para>
4960 <para>
4961 As for other local message submissions, the contents of incoming batch SMTP
4962 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4963 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4964 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4965 </para>
4966 <para>
4967 Some other SMTP commands are recognized in the input. HELO and EHLO act
4968 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4969 QUIT quits, ignoring the rest of the standard input.
4970 </para>
4971 <para>
4972 <indexterm role="concept">
4973 <primary>return code</primary>
4974 <secondary>for <option>-bS</option></secondary>
4975 </indexterm>
4976 If any error is encountered, reports are written to the standard output and
4977 error streams, and Exim gives up immediately. The return code is 0 if no error
4978 was detected; it is 1 if one or more messages were accepted before the error
4979 was detected; otherwise it is 2.
4980 </para>
4981 <para>
4982 More details of input using batched SMTP are given in section
4983 <xref linkend="SECTincomingbatchedSMTP"/>.
4984 </para>
4985 </listitem></varlistentry>
4986 <varlistentry>
4987 <term><option>-bs</option></term>
4988 <listitem>
4989 <para>
4990 <indexterm role="option">
4991 <primary><option>-bs</option></primary>
4992 </indexterm>
4993 <indexterm role="concept">
4994 <primary>SMTP</primary>
4995 <secondary>local input</secondary>
4996 </indexterm>
4997 <indexterm role="concept">
4998 <primary>local SMTP input</primary>
4999 </indexterm>
5000 This option causes Exim to accept one or more messages by reading SMTP commands
5001 on the standard input, and producing SMTP replies on the standard output. SMTP
5002 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
5003 Some user agents use this interface as a way of passing locally-generated
5004 messages to the MTA.
5005 </para>
5006 <para>
5007 In
5008 <indexterm role="concept">
5009 <primary>sender</primary>
5010 <secondary>source of</secondary>
5011 </indexterm>
5012 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
5013 set, the senders of messages are taken from the SMTP MAIL commands.
5014 Otherwise the content of these commands is ignored and the sender is set up as
5015 the calling user. Unqualified addresses are automatically qualified using
5016 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
5017 <option>-bnq</option> option is used.
5018 </para>
5019 <para>
5020 <indexterm role="concept">
5021 <primary>inetd</primary>
5022 </indexterm>
5023 The
5024 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
5025 using a listening daemon. Exim can distinguish the two cases by checking
5026 whether the standard input is a TCP/IP socket. When Exim is called from
5027 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
5028 above concerning senders and qualification do not apply. In this situation,
5029 Exim behaves in exactly the same way as it does when receiving a message via
5030 the listening daemon.
5031 </para>
5032 </listitem></varlistentry>
5033 <varlistentry>
5034 <term><option>-bt</option></term>
5035 <listitem>
5036 <para>
5037 <indexterm role="option">
5038 <primary><option>-bt</option></primary>
5039 </indexterm>
5040 <indexterm role="concept">
5041 <primary>testing</primary>
5042 <secondary>addresses</secondary>
5043 </indexterm>
5044 <indexterm role="concept">
5045 <primary>address</primary>
5046 <secondary>testing</secondary>
5047 </indexterm>
5048 This option runs Exim in address testing mode, in which each argument is taken
5049 as a recipient address to be tested for deliverability. The results are
5050 written to the standard output. If a test fails, and the caller is not an admin
5051 user, no details of the failure are output, because these might contain
5052 sensitive information such as usernames and passwords for database lookups.
5053 </para>
5054 <para>
5055 If no arguments are given, Exim runs in an interactive manner, prompting with a
5056 right angle bracket for addresses to be tested.
5057 </para>
5058 <para>
5059 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
5060 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
5061 security issues.
5062 </para>
5063 <para>
5064 Each address is handled as if it were the recipient address of a message
5065 (compare the <option>-bv</option> option). It is passed to the routers and the result is
5066 written to the standard output. However, any router that has
5067 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
5068 genuine routing tests if your first router passes everything to a scanner
5069 program.
5070 </para>
5071 <para>
5072 <indexterm role="concept">
5073 <primary>return code</primary>
5074 <secondary>for <option>-bt</option></secondary>
5075 </indexterm>
5076 The return code is 2 if any address failed outright; it is 1 if no address
5077 failed outright but at least one could not be resolved for some reason. Return
5078 code 0 is given only when all addresses succeed.
5079 </para>
5080 <para>
5081 <indexterm role="concept">
5082 <primary>duplicate addresses</primary>
5083 </indexterm>
5084 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
5085 addresses after routing is complete, so that only one delivery takes place.
5086 This does not happen when testing with <option>-bt</option>; the full results of routing are
5087 always shown.
5088 </para>
5089 <para>
5090 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
5091 routers in the configuration makes any tests on the sender address of a
5092 message,
5093 <indexterm role="option">
5094 <primary><option>-f</option></primary>
5095 <secondary>for address testing</secondary>
5096 </indexterm>
5097 you can use the <option>-f</option> option to set an appropriate sender when running
5098 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
5099 default qualifying domain. However, if you have set up (for example) routers
5100 whose behaviour depends on the contents of an incoming message, you cannot test
5101 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
5102 doing such tests.
5103 </para>
5104 </listitem></varlistentry>
5105 <varlistentry>
5106 <term><option>-bV</option></term>
5107 <listitem>
5108 <para>
5109 <indexterm role="option">
5110 <primary><option>-bV</option></primary>
5111 </indexterm>
5112 <indexterm role="concept">
5113 <primary>version number of Exim</primary>
5114 </indexterm>
5115 This option causes Exim to write the current version number, compilation
5116 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
5117 It also lists the DBM library that is being used, the optional modules (such as
5118 specific lookup types), the drivers that are included in the binary, and the
5119 name of the runtime configuration file that is in use.
5120 </para>
5121 <para>
5122 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
5123 configuration file. However, this is a static check only. It cannot check
5124 values that are to be expanded. For example, although a misspelt ACL verb is
5125 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
5126 alone to discover (for example) all the typos in the configuration; some
5127 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
5128 dynamic testing facilities.
5129 </para>
5130 </listitem></varlistentry>
5131 <varlistentry>
5132 <term><option>-bv</option></term>
5133 <listitem>
5134 <para>
5135 <indexterm role="option">
5136 <primary><option>-bv</option></primary>
5137 </indexterm>
5138 <indexterm role="concept">
5139 <primary>verifying address</primary>
5140 <secondary>using <option>-bv</option></secondary>
5141 </indexterm>
5142 <indexterm role="concept">
5143 <primary>address</primary>
5144 <secondary>verification</secondary>
5145 </indexterm>
5146 This option runs Exim in address verification mode, in which each argument is
5147 taken as a recipient address to be verified by the routers. (This does
5148 not involve any verification callouts). During normal operation, verification
5149 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
5150 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
5151 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
5152 </para>
5153 <para>
5154 If verification fails, and the caller is not an admin user, no details of the
5155 failure are output, because these might contain sensitive information such as
5156 usernames and passwords for database lookups.
5157 </para>
5158 <para>
5159 If no arguments are given, Exim runs in an interactive manner, prompting with a
5160 right angle bracket for addresses to be verified.
5161 </para>
5162 <para>
5163 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
5164 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
5165 security issues.
5166 </para>
5167 <para>
5168 Verification differs from address testing (the <option>-bt</option> option) in that routers
5169 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
5170 router that has <option>fail_verify</option> set, verification fails. The address is
5171 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
5172 address, <option>-bvs</option> should be used.
5173 </para>
5174 <para>
5175 If the <option>-v</option> option is not set, the output consists of a single line for each
5176 address, stating whether it was verified or not, and giving a reason in the
5177 latter case. Without <option>-v</option>, generating more than one address by redirection
5178 causes verification to end successfully, without considering the generated
5179 addresses. However, if just one address is generated, processing continues,
5180 and the generated address must verify successfully for the overall verification
5181 to succeed.
5182 </para>
5183 <para>
5184 When <option>-v</option> is set, more details are given of how the address has been handled,
5185 and in the case of address redirection, all the generated addresses are also
5186 considered. Verification may succeed for some and fail for others.
5187 </para>
5188 <para>
5189 The
5190 <indexterm role="concept">
5191 <primary>return code</primary>
5192 <secondary>for <option>-bv</option></secondary>
5193 </indexterm>
5194 return code is 2 if any address failed outright; it is 1 if no address
5195 failed outright but at least one could not be resolved for some reason. Return
5196 code 0 is given only when all addresses succeed.
5197 </para>
5198 <para>
5199 If any of the routers in the configuration makes any tests on the sender
5200 address of a message, you should use the <option>-f</option> option to set an appropriate
5201 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
5202 calling user at the default qualifying domain.
5203 </para>
5204 </listitem></varlistentry>
5205 <varlistentry>
5206 <term><option>-bvs</option></term>
5207 <listitem>
5208 <para>
5209 <indexterm role="option">
5210 <primary><option>-bvs</option></primary>
5211 </indexterm>
5212 This option acts like <option>-bv</option>, but verifies the address as a sender rather
5213 than a recipient address. This affects any rewriting and qualification that
5214 might happen.
5215 </para>
5216 </listitem></varlistentry>
5217 <varlistentry>
5218 <term><option>-bw</option></term>
5219 <listitem>
5220 <para>
5221 <indexterm role="option">
5222 <primary><option>-bw</option></primary>
5223 </indexterm>
5224 <indexterm role="concept">
5225 <primary>daemon</primary>
5226 </indexterm>
5227 <indexterm role="concept">
5228 <primary>inetd</primary>
5229 </indexterm>
5230 <indexterm role="concept">
5231 <primary>inetd</primary>
5232 <secondary>wait mode</secondary>
5233 </indexterm>
5234 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5235 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5236 and in the configuration file are ignored.  Queue-running may not be specified.
5237 </para>
5238 <para>
5239 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5240 listening for connections.  This permits the system to start up and have
5241 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5242 each port only when the first connection is received.
5243 </para>
5244 <para>
5245 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5246 which the daemon will exit, which should cause inetd to listen once more.
5247 </para>
5248 </listitem></varlistentry>
5249 <varlistentry>
5250 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5251 <listitem>
5252 <para>
5253 <indexterm role="option">
5254 <primary><option>-C</option></primary>
5255 </indexterm>
5256 <indexterm role="concept">
5257 <primary>configuration file</primary>
5258 <secondary>alternate</secondary>
5259 </indexterm>
5260 <indexterm role="concept">
5261 <primary>CONFIGURE_FILE</primary>
5262 </indexterm>
5263 <indexterm role="concept">
5264 <primary>alternate configuration file</primary>
5265 </indexterm>
5266 This option causes Exim to find the runtime configuration file from the given
5267 list instead of from the list specified by the CONFIGURE_FILE
5268 compile-time setting. Usually, the list will consist of just a single filename,
5269 but it can be a colon-separated list of names. In this case, the first
5270 file that exists is used. Failure to open an existing file stops Exim from
5271 proceeding any further along the list, and an error is generated.
5272 </para>
5273 <para>
5274 When this option is used by a caller other than root, and the list is different
5275 from the compiled-in list, Exim gives up its root privilege immediately, and
5276 runs with the real and effective uid and gid set to those of the caller.
5277 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5278 file contains a list of full pathnames, one per line, for configuration files
5279 which are trusted. Root privilege is retained for any configuration file so
5280 listed, as long as the caller is the Exim user (or the user specified in the
5281 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5282 not writeable by inappropriate users or groups.
5283 </para>
5284 <para>
5285 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5286 configuration using <option>-C</option> right through message reception and delivery,
5287 even if the caller is root. The reception works, but by that time, Exim is
5288 running as the Exim user, so when it re-executes to regain privilege for the
5289 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5290 test reception and delivery using two separate commands (one to put a message
5291 in the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5292 </para>
5293 <para>
5294 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5295 prefix string with which any file named in a <option>-C</option> command line option
5296 must start. In addition, the filename must not contain the sequence <literal>/../</literal>.
5297 However, if the value of the <option>-C</option> option is identical to the value of
5298 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5299 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5300 unset, any filename can be used with <option>-C</option>.
5301 </para>
5302 <para>
5303 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5304 to a directory to which only root has access. This prevents someone who has
5305 broken into the Exim account from running a privileged Exim with an arbitrary
5306 configuration file.
5307 </para>
5308 <para>
5309 The <option>-C</option> facility is useful for ensuring that configuration files are
5310 syntactically correct, but cannot be used for test deliveries, unless the
5311 caller is privileged, or unless it is an exotic configuration that does not
5312 require privilege. No check is made on the owner or group of the files
5313 specified by this option.
5314 </para>
5315 </listitem></varlistentry>
5316 <varlistentry>
5317 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5318 <listitem>
5319 <para>
5320 <indexterm role="option">
5321 <primary><option>-D</option></primary>
5322 </indexterm>
5323 <indexterm role="concept">
5324 <primary>macro</primary>
5325 <secondary>setting on command line</secondary>
5326 </indexterm>
5327 This option can be used to override macro definitions in the configuration file
5328 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5329 unprivileged caller, it causes Exim to give up its root privilege.
5330 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5331 completely disabled, and its use causes an immediate error exit.
5332 </para>
5333 <para>
5334 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5335 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5336 supplies macros from this list, and the values are acceptable, then Exim will
5337 not give up root privilege if the caller is root, the Exim run-time user, or
5338 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5339 to be removed in the future.  Acceptable values for the macros satisfy the
5340 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5341 </para>
5342 <para>
5343 The entire option (including equals sign if present) must all be within one
5344 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5345 string, in which case the equals sign is optional. These two commands are
5346 synonymous:
5347 </para>
5348 <literallayout class="monospaced">
5349 exim -DABC  ...
5350 exim -DABC= ...
5351 </literallayout>
5352 <para>
5353 To include spaces in a macro definition item, quotes must be used. If you use
5354 quotes, spaces are permitted around the macro name and the equals sign. For
5355 example:
5356 </para>
5357 <literallayout class="monospaced">
5358 exim '-D ABC = something' ...
5359 </literallayout>
5360 <para>
5361 <option>-D</option> may be repeated up to 10 times on a command line.
5362 Only macro names up to 22 letters long can be set.
5363 </para>
5364 </listitem></varlistentry>
5365 <varlistentry>
5366 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5367 <listitem>
5368 <para>
5369 <indexterm role="option">
5370 <primary><option>-d</option></primary>
5371 </indexterm>
5372 <indexterm role="concept">
5373 <primary>debugging</primary>
5374 <secondary>list of selectors</secondary>
5375 </indexterm>
5376 <indexterm role="concept">
5377 <primary>debugging</primary>
5378 <secondary><option>-d</option> option</secondary>
5379 </indexterm>
5380 This option causes debugging information to be written to the standard
5381 error stream. It is restricted to admin users because debugging output may show
5382 database queries that contain password information. Also, the details of users&#x2019;
5383 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5384 writes an error message to the standard error stream and exits with a non-zero
5385 return code.
5386 </para>
5387 <para>
5388 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5389 standard debugging data is output. This can be reduced, or increased to include
5390 some more rarely needed information, by directly following <option>-d</option> with a string
5391 made up of names preceded by plus or minus characters. These add or remove sets
5392 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5393 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5394 no spaces are allowed in the debug setting. The available debugging categories
5395 are:
5396 </para>
5397 <informaltable frame="none">
5398 <tgroup cols="2" colsep="0" rowsep="0">
5399 <colspec colwidth="20*" align="left"/>
5400 <colspec colwidth="80*" align="left"/>
5401 <tbody>
5402 <row>
5403 <entry>&nbsp;&nbsp;&nbsp;&nbsp;acl</entry>
5404 <entry>ACL interpretation</entry>
5405 </row>
5406 <row>
5407 <entry>&nbsp;&nbsp;&nbsp;&nbsp;auth</entry>
5408 <entry>authenticators</entry>
5409 </row>
5410 <row>
5411 <entry>&nbsp;&nbsp;&nbsp;&nbsp;deliver</entry>
5412 <entry>general delivery logic</entry>
5413 </row>
5414 <row>
5415 <entry>&nbsp;&nbsp;&nbsp;&nbsp;dns</entry>
5416 <entry>DNS lookups (see also resolver)</entry>
5417 </row>
5418 <row>
5419 <entry>&nbsp;&nbsp;&nbsp;&nbsp;dnsbl</entry>
5420 <entry>DNS black list (aka RBL) code</entry>
5421 </row>
5422 <row>
5423 <entry>&nbsp;&nbsp;&nbsp;&nbsp;exec</entry>
5424 <entry>arguments for <function>execv()</function> calls</entry>
5425 </row>
5426 <row>
5427 <entry>&nbsp;&nbsp;&nbsp;&nbsp;expand</entry>
5428 <entry>detailed debugging for string expansions</entry>
5429 </row>
5430 <row>
5431 <entry>&nbsp;&nbsp;&nbsp;&nbsp;filter</entry>
5432 <entry>filter handling</entry>
5433 </row>
5434 <row>
5435 <entry>&nbsp;&nbsp;&nbsp;&nbsp;hints_lookup</entry>
5436 <entry>hints data lookups</entry>
5437 </row>
5438 <row>
5439 <entry>&nbsp;&nbsp;&nbsp;&nbsp;host_lookup</entry>
5440 <entry>all types of name-to-IP address handling</entry>
5441 </row>
5442 <row>
5443 <entry>&nbsp;&nbsp;&nbsp;&nbsp;ident</entry>
5444 <entry>ident lookup</entry>
5445 </row>
5446 <row>
5447 <entry>&nbsp;&nbsp;&nbsp;&nbsp;interface</entry>
5448 <entry>lists of local interfaces</entry>
5449 </row>
5450 <row>
5451 <entry>&nbsp;&nbsp;&nbsp;&nbsp;lists</entry>
5452 <entry>matching things in lists</entry>
5453 </row>
5454 <row>
5455 <entry>&nbsp;&nbsp;&nbsp;&nbsp;load</entry>
5456 <entry>system load checks</entry>
5457 </row>
5458 <row>
5459 <entry>&nbsp;&nbsp;&nbsp;&nbsp;local_scan</entry>
5460 <entry>can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)</entry>
5461 </row>
5462 <row>
5463 <entry>&nbsp;&nbsp;&nbsp;&nbsp;lookup</entry>
5464 <entry>general lookup code and all lookups</entry>
5465 </row>
5466 <row>
5467 <entry>&nbsp;&nbsp;&nbsp;&nbsp;memory</entry>
5468 <entry>memory handling</entry>
5469 </row>
5470 <row>
5471 <entry>&nbsp;&nbsp;&nbsp;&nbsp;noutf8</entry>
5472 <entry>modifier: avoid UTF-8 line-drawing</entry>
5473 </row>
5474 <row>
5475 <entry>&nbsp;&nbsp;&nbsp;&nbsp;pid</entry>
5476 <entry>modifier: add pid to debug output lines</entry>
5477 </row>
5478 <row>
5479 <entry>&nbsp;&nbsp;&nbsp;&nbsp;process_info</entry>
5480 <entry>setting info for the process log</entry>
5481 </row>
5482 <row>
5483 <entry>&nbsp;&nbsp;&nbsp;&nbsp;queue_run</entry>
5484 <entry>queue runs</entry>
5485 </row>
5486 <row>
5487 <entry>&nbsp;&nbsp;&nbsp;&nbsp;receive</entry>
5488 <entry>general message reception logic</entry>
5489 </row>
5490 <row>
5491 <entry>&nbsp;&nbsp;&nbsp;&nbsp;resolver</entry>
5492 <entry>turn on the DNS resolver&#x2019;s debugging output</entry>
5493 </row>
5494 <row>
5495 <entry>&nbsp;&nbsp;&nbsp;&nbsp;retry</entry>
5496 <entry>retry handling</entry>
5497 </row>
5498 <row>
5499 <entry>&nbsp;&nbsp;&nbsp;&nbsp;rewrite</entry>
5500 <entry>address rewriting"</entry>
5501 </row>
5502 <row>
5503 <entry>&nbsp;&nbsp;&nbsp;&nbsp;route</entry>
5504 <entry>address routing</entry>
5505 </row>
5506 <row>
5507 <entry>&nbsp;&nbsp;&nbsp;&nbsp;timestamp</entry>
5508 <entry>modifier: add timestamp to debug output lines</entry>
5509 </row>
5510 <row>
5511 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tls</entry>
5512 <entry>TLS logic</entry>
5513 </row>
5514 <row>
5515 <entry>&nbsp;&nbsp;&nbsp;&nbsp;transport</entry>
5516 <entry>transports</entry>
5517 </row>
5518 <row>
5519 <entry>&nbsp;&nbsp;&nbsp;&nbsp;uid</entry>
5520 <entry>changes of uid/gid and looking up uid/gid</entry>
5521 </row>
5522 <row>
5523 <entry>&nbsp;&nbsp;&nbsp;&nbsp;verify</entry>
5524 <entry>address verification logic</entry>
5525 </row>
5526 <row>
5527 <entry>&nbsp;&nbsp;&nbsp;&nbsp;all</entry>
5528 <entry>almost all of the above (see below), and also <option>-v</option></entry>
5529 </row>
5530 </tbody>
5531 </tgroup>
5532 </informaltable>
5533 <para>
5534 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5535 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5536 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5537 is included, an awful lot of output that is very rarely of interest is
5538 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5539 turn everything off.
5540 </para>
5541 <para>
5542 <indexterm role="concept">
5543 <primary>resolver, debugging output</primary>
5544 </indexterm>
5545 <indexterm role="concept">
5546 <primary>DNS resolver, debugging output</primary>
5547 </indexterm>
5548 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5549 with DEBUG enabled. This is not the case in some operating systems. Also,
5550 unfortunately, debugging output from the DNS resolver is written to stdout
5551 rather than stderr.
5552 </para>
5553 <para>
5554 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5555 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5556 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5557 daemon, which then passes it on to any re-executed Exims. Exim also
5558 automatically adds the pid to debug lines when several remote deliveries are
5559 run in parallel.
5560 </para>
5561 <para>
5562 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5563 of all debug output lines. This can be useful when trying to track down delays
5564 in processing.
5565 </para>
5566 <para>
5567 <indexterm role="concept">
5568 <primary>debugging</primary>
5569 <secondary>UTF-8 in</secondary>
5570 </indexterm>
5571 <indexterm role="concept">
5572 <primary>UTF-8</primary>
5573 <secondary>in debug output</secondary>
5574 </indexterm>
5575 The <literal>noutf8</literal> selector disables the use of
5576 UTF-8 line-drawing characters to group related information.
5577 When disabled. ascii-art is used instead.
5578 Using the <literal>+all</literal> option does not set this modifier,
5579 </para>
5580 <para>
5581 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5582 any debugging is selected, or if <option>-v</option> is used.
5583 </para>
5584 </listitem></varlistentry>
5585 <varlistentry>
5586 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5587 <listitem>
5588 <para>
5589 <indexterm role="option">
5590 <primary><option>-dd</option></primary>
5591 </indexterm>
5592 This option behaves exactly like <option>-d</option> except when used on a command that
5593 starts a daemon process. In that case, debugging is turned off for the
5594 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5595 behaviour of the daemon without creating as much output as full debugging does.
5596 </para>
5597 </listitem></varlistentry>
5598 <varlistentry>
5599 <term><option>-dropcr</option></term>
5600 <listitem>
5601 <para>
5602 <indexterm role="option">
5603 <primary><option>-dropcr</option></primary>
5604 </indexterm>
5605 This is an obsolete option that is now a no-op. It used to affect the way Exim
5606 handled CR and LF characters in incoming messages. What happens now is
5607 described in section <xref linkend="SECTlineendings"/>.
5608 </para>
5609 </listitem></varlistentry>
5610 <varlistentry>
5611 <term><option>-E</option></term>
5612 <listitem>
5613 <para>
5614 <indexterm role="option">
5615 <primary><option>-E</option></primary>
5616 </indexterm>
5617 <indexterm role="concept">
5618 <primary>bounce message</primary>
5619 <secondary>generating</secondary>
5620 </indexterm>
5621 This option specifies that an incoming message is a locally-generated delivery
5622 failure report. It is used internally by Exim when handling delivery failures
5623 and is not intended for external use. Its only effect is to stop Exim
5624 generating certain messages to the postmaster, as otherwise message cascades
5625 could occur in some situations. As part of the same option, a message id may
5626 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5627 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5628 </para>
5629 </listitem></varlistentry>
5630 <varlistentry>
5631 <term><option>-e</option><emphasis>x</emphasis></term>
5632 <listitem>
5633 <para>
5634 <indexterm role="option">
5635 <primary><option>-e</option><emphasis>x</emphasis></primary>
5636 </indexterm>
5637 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5638 called by various programs without the leading <option>o</option> in the option. For
5639 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5640 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5641 </para>
5642 </listitem></varlistentry>
5643 <varlistentry>
5644 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5645 <listitem>
5646 <para>
5647 <indexterm role="option">
5648 <primary><option>-F</option></primary>
5649 </indexterm>
5650 <indexterm role="concept">
5651 <primary>sender</primary>
5652 <secondary>name</secondary>
5653 </indexterm>
5654 <indexterm role="concept">
5655 <primary>name</primary>
5656 <secondary>of sender</secondary>
5657 </indexterm>
5658 This option sets the sender&#x2019;s full name for use when a locally-generated
5659 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5660 entry from the password data is used. As users are generally permitted to alter
5661 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5662 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5663 </para>
5664 </listitem></varlistentry>
5665 <varlistentry>
5666 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5667 <listitem>
5668 <para>
5669 <indexterm role="option">
5670 <primary><option>-f</option></primary>
5671 </indexterm>
5672 <indexterm role="concept">
5673 <primary>sender</primary>
5674 <secondary>address</secondary>
5675 </indexterm>
5676 <indexterm role="concept">
5677 <primary>address</primary>
5678 <secondary>sender</secondary>
5679 </indexterm>
5680 <indexterm role="concept">
5681 <primary>trusted users</primary>
5682 </indexterm>
5683 <indexterm role="concept">
5684 <primary>envelope from</primary>
5685 </indexterm>
5686 <indexterm role="concept">
5687 <primary>envelope sender</primary>
5688 </indexterm>
5689 <indexterm role="concept">
5690 <primary>user</primary>
5691 <secondary>trusted</secondary>
5692 </indexterm>
5693 This option sets the address of the envelope sender of a locally-generated
5694 message (also known as the return path). The option can normally be used only
5695 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5696 users to use it.
5697 </para>
5698 <para>
5699 Processes running as root or the Exim user are always trusted. Other
5700 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5701 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5702 of a local message is set to the caller&#x2019;s login name at the default qualify
5703 domain.
5704 </para>
5705 <para>
5706 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5707 can be specified by any user, trusted or not, to create a message that can
5708 never provoke a bounce. An empty sender can be specified either as an empty
5709 string, or as a pair of angle brackets with nothing between them, as in these
5710 examples of shell commands:
5711 </para>
5712 <literallayout class="monospaced">
5713 exim -f '&lt;&gt;' user@domain
5714 exim -f "" user@domain
5715 </literallayout>
5716 <para>
5717 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5718 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5719 <option>-bv</option> options.
5720 </para>
5721 <para>
5722 Allowing untrusted users to change the sender address does not of itself make
5723 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5724 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5725 though this can be overridden by setting <option>no_local_from_check</option>.
5726 </para>
5727 <para>
5728 White
5729 <indexterm role="concept">
5730 <primary><quote>From</quote> line</primary>
5731 </indexterm>
5732 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5733 given as two arguments or one combined argument). The sender of a
5734 locally-generated message can also be set (when permitted) by an initial
5735 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5736 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5737 </para>
5738 </listitem></varlistentry>
5739 <varlistentry>
5740 <term><option>-G</option></term>
5741 <listitem>
5742 <para>
5743 <indexterm role="option">
5744 <primary><option>-G</option></primary>
5745 </indexterm>
5746 <indexterm role="concept">
5747 <primary>submission fixups, suppressing (command-line)</primary>
5748 </indexterm>
5749 This option is equivalent to an ACL applying:
5750 </para>
5751 <literallayout class="monospaced">
5752 control = suppress_local_fixups
5753 </literallayout>
5754 <para>
5755 for every message received.  Note that Sendmail will complain about such
5756 bad formatting, where Exim silently just does not fix it up.  This may change
5757 in future.
5758 </para>
5759 <para>
5760 As this affects audit information, the caller must be a trusted user to use
5761 this option.
5762 </para>
5763 </listitem></varlistentry>
5764 <varlistentry>
5765 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5766 <listitem>
5767 <para>
5768 <indexterm role="option">
5769 <primary><option>-h</option></primary>
5770 </indexterm>
5771 <indexterm role="concept">
5772 <primary>Sendmail compatibility</primary>
5773 <secondary><option>-h</option> option ignored</secondary>
5774 </indexterm>
5775 This option is accepted for compatibility with Sendmail, but has no effect. (In
5776 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5777 headers.)
5778 </para>
5779 </listitem></varlistentry>
5780 <varlistentry>
5781 <term><option>-i</option></term>
5782 <listitem>
5783 <para>
5784 <indexterm role="option">
5785 <primary><option>-i</option></primary>
5786 </indexterm>
5787 <indexterm role="concept">
5788 <primary>Solaris</primary>
5789 <secondary><emphasis>mail</emphasis> command</secondary>
5790 </indexterm>
5791 <indexterm role="concept">
5792 <primary>dot</primary>
5793 <secondary>in incoming non-SMTP message</secondary>
5794 </indexterm>
5795 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5796 line by itself should not terminate an incoming, non-SMTP message.
5797 Solaris 2.4 (SunOS 5.4) Sendmail has a similar <option>-i</option> processing option
5798 <emphasis role="bold"><ulink url="https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf">https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf</ulink></emphasis>,
5799 p. 1M-529), and therefore a <option>-oi</option> command line option, which both are used
5800 by its <emphasis>mailx</emphasis> command.
5801 </para>
5802 </listitem></varlistentry>
5803 <varlistentry>
5804 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5805 <listitem>
5806 <para>
5807 <indexterm role="option">
5808 <primary><option>-L</option></primary>
5809 </indexterm>
5810 <indexterm role="concept">
5811 <primary>syslog</primary>
5812 <secondary>process name; set with flag</secondary>
5813 </indexterm>
5814 This option is equivalent to setting <option>syslog_processname</option> in the config
5815 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5816 Its use is restricted to administrators.  The configuration file has to be
5817 read and parsed, to determine access rights, before this is set and takes
5818 effect, so early configuration file errors will not honour this flag.
5819 </para>
5820 <para>
5821 The tag should not be longer than 32 characters.
5822 </para>
5823 </listitem></varlistentry>
5824 <varlistentry>
5825 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5826 <listitem>
5827 <para>
5828 <indexterm role="option">
5829 <primary><option>-M</option></primary>
5830 </indexterm>
5831 <indexterm role="concept">
5832 <primary>forcing delivery</primary>
5833 </indexterm>
5834 <indexterm role="concept">
5835 <primary>delivery</primary>
5836 <secondary>forcing attempt</secondary>
5837 </indexterm>
5838 <indexterm role="concept">
5839 <primary>frozen messages</primary>
5840 <secondary>forcing delivery</secondary>
5841 </indexterm>
5842 This option requests Exim to run a delivery attempt on each message in turn. If
5843 any of the messages are frozen, they are automatically thawed before the
5844 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5845 and <option>hold_domains</option> are ignored.
5846 </para>
5847 <para>
5848 Retry
5849 <indexterm role="concept">
5850 <primary>hints database</primary>
5851 <secondary>overriding retry hints</secondary>
5852 </indexterm>
5853 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5854 the normal retry time has not yet been reached. This option requires the caller
5855 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5856 which can be set false to relax this restriction (and also the same requirement
5857 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5858 </para>
5859 <para>
5860 The deliveries happen synchronously, that is, the original Exim process does
5861 not terminate until all the delivery attempts have finished. No output is
5862 produced unless there is a serious error. If you want to see what is happening,
5863 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5864 </para>
5865 </listitem></varlistentry>
5866 <varlistentry>
5867 <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>
5868 <listitem>
5869 <para>
5870 <indexterm role="option">
5871 <primary><option>-Mar</option></primary>
5872 </indexterm>
5873 <indexterm role="concept">
5874 <primary>message</primary>
5875 <secondary>adding recipients</secondary>
5876 </indexterm>
5877 <indexterm role="concept">
5878 <primary>recipient</primary>
5879 <secondary>adding</secondary>
5880 </indexterm>
5881 This option requests Exim to add the addresses to the list of recipients of the
5882 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5883 id, and the remaining ones must be email addresses. However, if the message is
5884 active (in the middle of a delivery attempt), it is not altered. This option
5885 can be used only by an admin user.
5886 </para>
5887 </listitem></varlistentry>
5888 <varlistentry>
5889 <term><option>-MC</option>&nbsp;&lt;<emphasis>transport</emphasis>&gt;&nbsp;&lt;<emphasis>hostname</emphasis>&gt;&nbsp;&lt;<emphasis>host&nbsp;IP</emphasis>&gt;&nbsp;&lt;<emphasis>sequence&nbsp;number</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5890 <listitem>
5891 <para>
5892 <indexterm role="option">
5893 <primary><option>-MC</option></primary>
5894 </indexterm>
5895 <indexterm role="concept">
5896 <primary>SMTP</primary>
5897 <secondary>passed connection</secondary>
5898 </indexterm>
5899 <indexterm role="concept">
5900 <primary>SMTP</primary>
5901 <secondary>multiple deliveries</secondary>
5902 </indexterm>
5903 <indexterm role="concept">
5904 <primary>multiple SMTP deliveries</primary>
5905 </indexterm>
5906 This option is not intended for use by external callers. It is used internally
5907 by Exim to invoke another instance of itself to deliver a waiting message using
5908 an existing SMTP connection, which is passed as the standard input. Details are
5909 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5910 must be root or the Exim user in order to use it.
5911 </para>
5912 </listitem></varlistentry>
5913 <varlistentry>
5914 <term><option>-MCA</option></term>
5915 <listitem>
5916 <para>
5917 <indexterm role="option">
5918 <primary><option>-MCA</option></primary>
5919 </indexterm>
5920 This option is not intended for use by external callers. It is used internally
5921 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5922 connection to the remote host has been authenticated.
5923 </para>
5924 </listitem></varlistentry>
5925 <varlistentry>
5926 <term><option>-MCD</option></term>
5927 <listitem>
5928 <para>
5929 <indexterm role="option">
5930 <primary><option>-MCD</option></primary>
5931 </indexterm>
5932 This option is not intended for use by external callers. It is used internally
5933 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5934 remote host supports the ESMTP <filename>DSN</filename> extension.
5935 </para>
5936 </listitem></varlistentry>
5937 <varlistentry>
5938 <term><option>-MCd</option></term>
5939 <listitem>
5940 <para>
5941 <indexterm role="option">
5942 <primary><option>-MCd</option></primary>
5943 </indexterm>
5944 This option is not intended for use by external callers. It is used internally
5945 by Exim in conjunction with the <option>-d</option> option
5946 to pass on an information string on the purpose of the process.
5947 </para>
5948 </listitem></varlistentry>
5949 <varlistentry>
5950 <term><option>-MCG</option>&nbsp;&lt;<emphasis>queue&nbsp;name</emphasis>&gt;</term>
5951 <listitem>
5952 <para>
5953 <indexterm role="option">
5954 <primary><option>-MCG</option></primary>
5955 </indexterm>
5956 This option is not intended for use by external callers. It is used internally
5957 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5958 alternate queue is used, named by the following argument.
5959 </para>
5960 </listitem></varlistentry>
5961 <varlistentry>
5962 <term><option>-MCK</option></term>
5963 <listitem>
5964 <para>
5965 <indexterm role="option">
5966 <primary><option>-MCK</option></primary>
5967 </indexterm>
5968 This option is not intended for use by external callers. It is used internally
5969 by Exim in conjunction with the <option>-MC</option> option. It signifies that a
5970 remote host supports the ESMTP <filename>CHUNKING</filename> extension.
5971 </para>
5972 </listitem></varlistentry>
5973 <varlistentry>
5974 <term><option>-MCL</option></term>
5975 <listitem>
5976 <para>
5977 <indexterm role="option">
5978 <primary><option>-MCL</option></primary>
5979 </indexterm>
5980 This option is not intended for use by external callers. It is used internally
5981 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5982 which Exim is connected advertised limits on numbers of mails, recipients or
5983 recipient domains.
5984 The limits are given by the following three arguments.
5985 </para>
5986 </listitem></varlistentry>
5987 <varlistentry>
5988 <term><option>-MCP</option></term>
5989 <listitem>
5990 <para>
5991 <indexterm role="option">
5992 <primary><option>-MCP</option></primary>
5993 </indexterm>
5994 This option is not intended for use by external callers. It is used internally
5995 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5996 which Exim is connected supports pipelining.
5997 </para>
5998 </listitem></varlistentry>
5999 <varlistentry>
6000 <term><option>-MCp</option></term>
6001 <listitem>
6002 <para>
6003 <indexterm role="option">
6004 <primary><option>-MCp</option></primary>
6005 </indexterm>
6006 This option is not intended for use by external callers. It is used internally
6007 by Exim in conjunction with the <option>-MC</option> option. It signifies that the connection
6008 t a remote server is via a SOCKS proxy, using addresses and ports given by
6009 the following four arguments.
6010 </para>
6011 </listitem></varlistentry>
6012 <varlistentry>
6013 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
6014 <listitem>
6015 <para>
6016 <indexterm role="option">
6017 <primary><option>-MCQ</option></primary>
6018 </indexterm>
6019 This option is not intended for use by external callers. It is used internally
6020 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
6021 started by a queue runner. It passes on the process id of the queue runner,
6022 together with the file descriptor number of an open pipe. Closure of the pipe
6023 signals the final completion of the sequence of processes that are passing
6024 messages through the same SMTP connection.
6025 </para>
6026 </listitem></varlistentry>
6027 <varlistentry>
6028 <term><option>-MCq</option>&nbsp;&lt;<emphasis>recipient&nbsp;address</emphasis>&gt;&nbsp;&lt;<emphasis>size</emphasis>&gt;</term>
6029 <listitem>
6030 <para>
6031 <indexterm role="option">
6032 <primary><option>-MCq</option></primary>
6033 </indexterm>
6034 This option is not intended for use by external callers. It is used internally
6035 by Exim to implement quota checking for local users.
6036 </para>
6037 </listitem></varlistentry>
6038 <varlistentry>
6039 <term><option>-MCS</option></term>
6040 <listitem>
6041 <para>
6042 <indexterm role="option">
6043 <primary><option>-MCS</option></primary>
6044 </indexterm>
6045 This option is not intended for use by external callers. It is used internally
6046 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
6047 ESMTP SIZE option should be used on messages delivered down the existing
6048 connection.
6049 </para>
6050 </listitem></varlistentry>
6051 <varlistentry>
6052 <term><option>-MCT</option></term>
6053 <listitem>
6054 <para>
6055 <indexterm role="option">
6056 <primary><option>-MCT</option></primary>
6057 </indexterm>
6058 This option is not intended for use by external callers. It is used internally
6059 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
6060 host to which Exim is connected supports TLS encryption.
6061 </para>
6062 </listitem></varlistentry>
6063 <varlistentry>
6064 <term><option>-MCr</option>&nbsp;&lt;<emphasis>SNI</emphasis>&gt;</term>
6065 <term><option>-MCs</option>&nbsp;&lt;<emphasis>SNI</emphasis>&gt;</term>
6066 <listitem>
6067 <para>
6068 <indexterm role="option">
6069 <primary><option>-MCs</option></primary>
6070 </indexterm>
6071 <indexterm role="option">
6072 <primary><option>-MCr</option></primary>
6073 </indexterm>
6074 These options are not intended for use by external callers. It is used internally
6075 by Exim in conjunction with the <option>-MCt</option> option, and passes on the fact that
6076 a TLS Server Name Indication was sent as part of the channel establishment.
6077 The argument gives the SNI string.
6078 The "r" variant indicates a DANE-verified connection.
6079 </para>
6080 </listitem></varlistentry>
6081 <varlistentry>
6082 <term><option>-MCt</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;&nbsp;&lt;<emphasis>port</emphasis>&gt;&nbsp;&lt;<emphasis>cipher</emphasis>&gt;</term>
6083 <listitem>
6084 <para>
6085 <indexterm role="option">
6086 <primary><option>-MCt</option></primary>
6087 </indexterm>
6088 This option is not intended for use by external callers. It is used internally
6089 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
6090 connection is being proxied by a parent process for handling TLS encryption.
6091 The arguments give the local address and port being proxied, and the TLS cipher.
6092 </para>
6093 </listitem></varlistentry>
6094 <varlistentry>
6095 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6096 <listitem>
6097 <para>
6098 <indexterm role="option">
6099 <primary><option>-Mc</option></primary>
6100 </indexterm>
6101 <indexterm role="concept">
6102 <primary>hints database</primary>
6103 <secondary>not overridden by <option>-Mc</option></secondary>
6104 </indexterm>
6105 <indexterm role="concept">
6106 <primary>delivery</primary>
6107 <secondary>manually started &ndash; not forced</secondary>
6108 </indexterm>
6109 This option requests Exim to run a delivery attempt on each message, in turn,
6110 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
6111 that are found. This option is not very useful to external callers. It is
6112 provided mainly for internal use by Exim when it needs to re-invoke itself in
6113 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
6114 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
6115 respects retry times and other options such as <option>hold_domains</option> that are
6116 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
6117 If you want to run a specific delivery as if in a queue run, you should use
6118 <option>-q</option> with a message id argument. A distinction between queue run deliveries
6119 and other deliveries is made in one or two places.
6120 </para>
6121 </listitem></varlistentry>
6122 <varlistentry>
6123 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6124 <listitem>
6125 <para>
6126 <indexterm role="option">
6127 <primary><option>-Mes</option></primary>
6128 </indexterm>
6129 <indexterm role="concept">
6130 <primary>message</primary>
6131 <secondary>changing sender</secondary>
6132 </indexterm>
6133 <indexterm role="concept">
6134 <primary>sender</primary>
6135 <secondary>changing</secondary>
6136 </indexterm>
6137 This option requests Exim to change the sender address in the message to the
6138 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
6139 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
6140 be a message id, and the second one an email address. However, if the message
6141 is active (in the middle of a delivery attempt), its status is not altered.
6142 This option can be used only by an admin user.
6143 </para>
6144 </listitem></varlistentry>
6145 <varlistentry>
6146 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6147 <listitem>
6148 <para>
6149 <indexterm role="option">
6150 <primary><option>-Mf</option></primary>
6151 </indexterm>
6152 <indexterm role="concept">
6153 <primary>freezing messages</primary>
6154 </indexterm>
6155 <indexterm role="concept">
6156 <primary>message</primary>
6157 <secondary>manually freezing</secondary>
6158 </indexterm>
6159 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
6160 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
6161 either manually or as a result of the <option>auto_thaw</option> configuration option.
6162 However, if any of the messages are active (in the middle of a delivery
6163 attempt), their status is not altered. This option can be used only by an admin
6164 user.
6165 </para>
6166 </listitem></varlistentry>
6167 <varlistentry>
6168 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6169 <listitem>
6170 <para>
6171 <indexterm role="option">
6172 <primary><option>-Mg</option></primary>
6173 </indexterm>
6174 <indexterm role="concept">
6175 <primary>giving up on messages</primary>
6176 </indexterm>
6177 <indexterm role="concept">
6178 <primary>message</primary>
6179 <secondary>abandoning delivery attempts</secondary>
6180 </indexterm>
6181 <indexterm role="concept">
6182 <primary>delivery</primary>
6183 <secondary>abandoning further attempts</secondary>
6184 </indexterm>
6185 This option requests Exim to give up trying to deliver the listed messages,
6186 including any that are frozen. However, if any of the messages are active,
6187 their status is not altered. For non-bounce messages, a delivery error message
6188 is sent to the sender.
6189 Bounce messages are just discarded. This option can be used only by an admin
6190 user.
6191 </para>
6192 </listitem></varlistentry>
6193 <varlistentry>
6194 <term><option>-MG</option>&nbsp;&lt;<emphasis>queue&nbsp;name</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6195 <listitem>
6196 <para>
6197 <indexterm role="option">
6198 <primary><option>-MG</option></primary>
6199 </indexterm>
6200 <indexterm role="concept">
6201 <primary>queue</primary>
6202 <secondary>named</secondary>
6203 </indexterm>
6204 <indexterm role="concept">
6205 <primary>named queues</primary>
6206 <secondary>moving messages</secondary>
6207 </indexterm>
6208 <indexterm role="concept">
6209 <primary>queue</primary>
6210 <secondary>moving messages</secondary>
6211 </indexterm>
6212 This option requests that each listed message be moved from its current
6213 queue to the given named queue.
6214 The destination queue name argument is required, but can be an empty
6215 string to define the default queue.
6216 If the messages are not currently located in the default queue,
6217 a <option>-qG&lt;name&gt;</option> option will be required to define the source queue.
6218 </para>
6219 </listitem></varlistentry>
6220 <varlistentry>
6221 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6222 <listitem>
6223 <para>
6224 <indexterm role="option">
6225 <primary><option>-Mmad</option></primary>
6226 </indexterm>
6227 <indexterm role="concept">
6228 <primary>delivery</primary>
6229 <secondary>cancelling all</secondary>
6230 </indexterm>
6231 This option requests Exim to mark all the recipient addresses in the messages
6232 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
6233 message is active (in the middle of a delivery attempt), its status is not
6234 altered. This option can be used only by an admin user.
6235 </para>
6236 </listitem></varlistentry>
6237 <varlistentry>
6238 <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>
6239 <listitem>
6240 <para>
6241 <indexterm role="option">
6242 <primary><option>-Mmd</option></primary>
6243 </indexterm>
6244 <indexterm role="concept">
6245 <primary>delivery</primary>
6246 <secondary>cancelling by address</secondary>
6247 </indexterm>
6248 <indexterm role="concept">
6249 <primary>recipient</primary>
6250 <secondary>removing</secondary>
6251 </indexterm>
6252 <indexterm role="concept">
6253 <primary>removing recipients</primary>
6254 </indexterm>
6255 This option requests Exim to mark the given addresses as already delivered
6256 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
6257 the remaining ones must be email addresses. These are matched to recipient
6258 addresses in the message in a case-sensitive manner. If the message is active
6259 (in the middle of a delivery attempt), its status is not altered. This option
6260 can be used only by an admin user.
6261 </para>
6262 </listitem></varlistentry>
6263 <varlistentry>
6264 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6265 <listitem>
6266 <para>
6267 <indexterm role="option">
6268 <primary><option>-Mrm</option></primary>
6269 </indexterm>
6270 <indexterm role="concept">
6271 <primary>removing messages</primary>
6272 </indexterm>
6273 <indexterm role="concept">
6274 <primary>abandoning mail</primary>
6275 </indexterm>
6276 <indexterm role="concept">
6277 <primary>message</primary>
6278 <secondary>manually discarding</secondary>
6279 </indexterm>
6280 This option requests Exim to remove the given messages from the queue. No
6281 bounce messages are sent; each message is simply forgotten. However, if any of
6282 the messages are active, their status is not altered. This option can be used
6283 only by an admin user or by the user who originally caused the message to be
6284 placed in the queue.
6285 </para>
6286 </listitem></varlistentry>
6287 <varlistentry>
6288 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6289 <listitem>
6290 <para>
6291 <indexterm role="option">
6292 <primary><option>-Mset</option></primary>
6293 </indexterm>
6294 <indexterm role="concept">
6295 <primary>testing</primary>
6296 <secondary>string expansion</secondary>
6297 </indexterm>
6298 <indexterm role="concept">
6299 <primary>expansion</primary>
6300 <secondary>testing</secondary>
6301 </indexterm>
6302 This option is useful only in conjunction with <option>-be</option> (that is, when testing
6303 string expansions). Exim loads the given message from its spool before doing
6304 the test expansions, thus setting message-specific variables such as
6305 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
6306 available. This feature is provided to make it easier to test expansions that
6307 make use of these variables. However, this option can be used only by an admin
6308 user. See also <option>-bem</option>.
6309 </para>
6310 </listitem></varlistentry>
6311 <varlistentry>
6312 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6313 <listitem>
6314 <para>
6315 <indexterm role="option">
6316 <primary><option>-Mt</option></primary>
6317 </indexterm>
6318 <indexterm role="concept">
6319 <primary>thawing messages</primary>
6320 </indexterm>
6321 <indexterm role="concept">
6322 <primary>unfreezing messages</primary>
6323 </indexterm>
6324 <indexterm role="concept">
6325 <primary>frozen messages</primary>
6326 <secondary>thawing</secondary>
6327 </indexterm>
6328 <indexterm role="concept">
6329 <primary>message</primary>
6330 <secondary>thawing frozen</secondary>
6331 </indexterm>
6332 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
6333 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
6334 messages are active, their status is not altered. This option can be used only
6335 by an admin user.
6336 </para>
6337 </listitem></varlistentry>
6338 <varlistentry>
6339 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6340 <listitem>
6341 <para>
6342 <indexterm role="option">
6343 <primary><option>-Mvb</option></primary>
6344 </indexterm>
6345 <indexterm role="concept">
6346 <primary>listing</primary>
6347 <secondary>message body</secondary>
6348 </indexterm>
6349 <indexterm role="concept">
6350 <primary>message</primary>
6351 <secondary>listing body of</secondary>
6352 </indexterm>
6353 This option causes the contents of the message body (-D) spool file to be
6354 written to the standard output. This option can be used only by an admin user.
6355 </para>
6356 </listitem></varlistentry>
6357 <varlistentry>
6358 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6359 <listitem>
6360 <para>
6361 <indexterm role="option">
6362 <primary><option>-Mvc</option></primary>
6363 </indexterm>
6364 <indexterm role="concept">
6365 <primary>message</primary>
6366 <secondary>listing in RFC 2822 format</secondary>
6367 </indexterm>
6368 <indexterm role="concept">
6369 <primary>listing</primary>
6370 <secondary>message in RFC 2822 format</secondary>
6371 </indexterm>
6372 This option causes a copy of the complete message (header lines plus body) to
6373 be written to the standard output in RFC 2822 format. This option can be used
6374 only by an admin user.
6375 </para>
6376 </listitem></varlistentry>
6377 <varlistentry>
6378 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6379 <listitem>
6380 <para>
6381 <indexterm role="option">
6382 <primary><option>-Mvh</option></primary>
6383 </indexterm>
6384 <indexterm role="concept">
6385 <primary>listing</primary>
6386 <secondary>message headers</secondary>
6387 </indexterm>
6388 <indexterm role="concept">
6389 <primary>header lines</primary>
6390 <secondary>listing</secondary>
6391 </indexterm>
6392 <indexterm role="concept">
6393 <primary>message</primary>
6394 <secondary>listing header lines</secondary>
6395 </indexterm>
6396 This option causes the contents of the message headers (-H) spool file to be
6397 written to the standard output. This option can be used only by an admin user.
6398 </para>
6399 </listitem></varlistentry>
6400 <varlistentry>
6401 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6402 <listitem>
6403 <para>
6404 <indexterm role="option">
6405 <primary><option>-Mvl</option></primary>
6406 </indexterm>
6407 <indexterm role="concept">
6408 <primary>listing</primary>
6409 <secondary>message log</secondary>
6410 </indexterm>
6411 <indexterm role="concept">
6412 <primary>message</primary>
6413 <secondary>listing message log</secondary>
6414 </indexterm>
6415 This option causes the contents of the message log spool file to be written to
6416 the standard output. This option can be used only by an admin user.
6417 </para>
6418 </listitem></varlistentry>
6419 <varlistentry>
6420 <term><option>-m</option></term>
6421 <listitem>
6422 <para>
6423 <indexterm role="option">
6424 <primary><option>-m</option></primary>
6425 </indexterm>
6426 This is a synonym for <option>-om</option> that is accepted by Sendmail
6427 (<emphasis role="bold"><ulink url="https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf">https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf</ulink></emphasis>
6428 p. 1M-258), so Exim treats it that way too.
6429 </para>
6430 </listitem></varlistentry>
6431 <varlistentry>
6432 <term><option>-N</option></term>
6433 <listitem>
6434 <para>
6435 <indexterm role="option">
6436 <primary><option>-N</option></primary>
6437 </indexterm>
6438 <indexterm role="concept">
6439 <primary>debugging</primary>
6440 <secondary><option>-N</option> option</secondary>
6441 </indexterm>
6442 <indexterm role="concept">
6443 <primary>debugging</primary>
6444 <secondary>suppressing delivery</secondary>
6445 </indexterm>
6446 This is a debugging option that inhibits delivery of a message at the transport
6447 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
6448 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
6449 had successfully done so. However, it does not make any updates to the retry
6450 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
6451 than <quote>=&gt;</quote>.
6452 </para>
6453 <para>
6454 Because <option>-N</option> discards any message to which it applies, only root or the Exim
6455 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
6456 words, an ordinary user can use it only when supplying an incoming message to
6457 which it will apply. Although transportation never fails when <option>-N</option> is set, an
6458 address may be deferred because of a configuration problem on a transport, or a
6459 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
6460 the message, and applies to any subsequent delivery attempts that may happen
6461 for that message.
6462 </para>
6463 </listitem></varlistentry>
6464 <varlistentry>
6465 <term><option>-n</option></term>
6466 <listitem>
6467 <para>
6468 <indexterm role="option">
6469 <primary><option>-n</option></primary>
6470 </indexterm>
6471 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6472 For normal modes of operation, it is ignored by Exim.
6473 When combined with <option>-bP</option> it makes the output more terse (suppresses
6474 option names, environment values and config pretty printing).
6475 </para>
6476 </listitem></varlistentry>
6477 <varlistentry>
6478 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6479 <listitem>
6480 <para>
6481 <indexterm role="option">
6482 <primary><option>-O</option></primary>
6483 </indexterm>
6484 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6485 Exim.
6486 </para>
6487 </listitem></varlistentry>
6488 <varlistentry>
6489 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6490 <listitem>
6491 <para>
6492 <indexterm role="option">
6493 <primary><option>-oA</option></primary>
6494 </indexterm>
6495 <indexterm role="concept">
6496 <primary>Sendmail compatibility</primary>
6497 <secondary><option>-oA</option> option</secondary>
6498 </indexterm>
6499 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6500 alternative alias filename. Exim handles <option>-bi</option> differently; see the
6501 description above.
6502 </para>
6503 </listitem></varlistentry>
6504 <varlistentry>
6505 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6506 <listitem>
6507 <para>
6508 <indexterm role="option">
6509 <primary><option>-oB</option></primary>
6510 </indexterm>
6511 <indexterm role="concept">
6512 <primary>SMTP</primary>
6513 <secondary>passed connection</secondary>
6514 </indexterm>
6515 <indexterm role="concept">
6516 <primary>SMTP</primary>
6517 <secondary>multiple deliveries</secondary>
6518 </indexterm>
6519 <indexterm role="concept">
6520 <primary>multiple SMTP deliveries</primary>
6521 </indexterm>
6522 This is a debugging option which limits the maximum number of messages that can
6523 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6524 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6525 </para>
6526 </listitem></varlistentry>
6527 <varlistentry>
6528 <term><option>-odb</option></term>
6529 <listitem>
6530 <para>
6531 <indexterm role="option">
6532 <primary><option>-odb</option></primary>
6533 </indexterm>
6534 <indexterm role="concept">
6535 <primary>background delivery</primary>
6536 </indexterm>
6537 <indexterm role="concept">
6538 <primary>delivery</primary>
6539 <secondary>in the background</secondary>
6540 </indexterm>
6541 This option applies to all modes in which Exim accepts incoming messages,
6542 including the listening daemon. It requests <quote>background</quote> delivery of such
6543 messages, which means that the accepting process automatically starts a
6544 delivery process for each message received, but does not wait for the delivery
6545 processes to finish.
6546 </para>
6547 <para>
6548 When all the messages have been received, the reception process exits,
6549 leaving the delivery processes to finish in their own time. The standard output
6550 and error streams are closed at the start of each delivery process.
6551 This is the default action if none of the <option>-od</option> options are present.
6552 </para>
6553 <para>
6554 If one of the queueing options in the configuration file
6555 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6556 overrides it if <option>queue_only_override</option> is set true, which is the default
6557 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6558 </para>
6559 </listitem></varlistentry>
6560 <varlistentry>
6561 <term><option>-odf</option></term>
6562 <listitem>
6563 <para>
6564 <indexterm role="option">
6565 <primary><option>-odf</option></primary>
6566 </indexterm>
6567 <indexterm role="concept">
6568 <primary>foreground delivery</primary>
6569 </indexterm>
6570 <indexterm role="concept">
6571 <primary>delivery</primary>
6572 <secondary>in the foreground</secondary>
6573 </indexterm>
6574 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6575 accepted a locally-generated message. (For the daemon it is exactly the same as
6576 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6577 and Exim waits for it to complete before proceeding.
6578 </para>
6579 <para>
6580 The original Exim reception process does not finish until the delivery
6581 process for the final message has ended. The standard error stream is left open
6582 during deliveries.
6583 </para>
6584 <para>
6585 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6586 false and one of the queueing options in the configuration file is in effect.
6587 </para>
6588 <para>
6589 If there is a temporary delivery error during foreground delivery, the
6590 message is left in the queue for later delivery, and the original reception
6591 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6592 restricted configuration that never queues messages.
6593 </para>
6594 </listitem></varlistentry>
6595 <varlistentry>
6596 <term><option>-odi</option></term>
6597 <listitem>
6598 <para>
6599 <indexterm role="option">
6600 <primary><option>-odi</option></primary>
6601 </indexterm>
6602 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6603 Sendmail.
6604 </para>
6605 </listitem></varlistentry>
6606 <varlistentry>
6607 <term><option>-odq</option></term>
6608 <listitem>
6609 <para>
6610 <indexterm role="option">
6611 <primary><option>-odq</option></primary>
6612 </indexterm>
6613 <indexterm role="concept">
6614 <primary>non-immediate delivery</primary>
6615 </indexterm>
6616 <indexterm role="concept">
6617 <primary>delivery</primary>
6618 <secondary>suppressing immediate</secondary>
6619 </indexterm>
6620 <indexterm role="concept">
6621 <primary>queueing incoming messages</primary>
6622 </indexterm>
6623 This option applies to all modes in which Exim accepts incoming messages,
6624 including the listening daemon. It specifies that the accepting process should
6625 not automatically start a delivery process for each message received. Messages
6626 are placed in the queue, and remain there until a subsequent queue runner
6627 process encounters them. There are several configuration options (such as
6628 <option>queue_only</option>) that can be used to queue incoming messages under certain
6629 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6630 forces queueing.
6631 </para>
6632 </listitem></varlistentry>
6633 <varlistentry>
6634 <term><option>-odqs</option></term>
6635 <listitem>
6636 <para>
6637 <indexterm role="option">
6638 <primary><option>-odqs</option></primary>
6639 </indexterm>
6640 <indexterm role="concept">
6641 <primary>SMTP</primary>
6642 <secondary>delaying delivery</secondary>
6643 </indexterm>
6644 <indexterm role="concept">
6645 <primary>first pass routing</primary>
6646 </indexterm>
6647 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6648 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6649 <option>queue_only_override</option> is false and one of the queueing options in the
6650 configuration file is in effect.
6651 </para>
6652 <para>
6653 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6654 message, in the background by default, but in the foreground if <option>-odi</option> is
6655 also present. The recipient addresses are routed, and local deliveries are done
6656 in the normal way. However, if any SMTP deliveries are required, they are not
6657 done at this time, so the message remains in the queue until a subsequent queue
6658 runner process encounters it. Because routing was done, Exim knows which
6659 messages are waiting for which hosts, and so a number of messages for the same
6660 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6661 configuration option has the same effect for specific domains. See also the
6662 <option>-qq</option> option.
6663 </para>
6664 </listitem></varlistentry>
6665 <varlistentry>
6666 <term><option>-oee</option></term>
6667 <listitem>
6668 <para>
6669 <indexterm role="option">
6670 <primary><option>-oee</option></primary>
6671 </indexterm>
6672 <indexterm role="concept">
6673 <primary>error</primary>
6674 <secondary>reporting</secondary>
6675 </indexterm>
6676 If an error is detected while a non-SMTP message is being received (for
6677 example, a malformed address), the error is reported to the sender in a mail
6678 message.
6679 </para>
6680 <para>
6681 <indexterm role="concept">
6682 <primary>return code</primary>
6683 <secondary>for <option>-oee</option></secondary>
6684 </indexterm>
6685 Provided
6686 this error message is successfully sent, the Exim receiving process
6687 exits with a return code of zero. If not, the return code is 2 if the problem
6688 is that the original message has no recipients, or 1 for any other error.
6689 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6690 </para>
6691 </listitem></varlistentry>
6692 <varlistentry>
6693 <term><option>-oem</option></term>
6694 <listitem>
6695 <para>
6696 <indexterm role="option">
6697 <primary><option>-oem</option></primary>
6698 </indexterm>
6699 <indexterm role="concept">
6700 <primary>error</primary>
6701 <secondary>reporting</secondary>
6702 </indexterm>
6703 <indexterm role="concept">
6704 <primary>return code</primary>
6705 <secondary>for <option>-oem</option></secondary>
6706 </indexterm>
6707 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6708 return code, whether or not the error message was successfully sent.
6709 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6710 </para>
6711 </listitem></varlistentry>
6712 <varlistentry>
6713 <term><option>-oep</option></term>
6714 <listitem>
6715 <para>
6716 <indexterm role="option">
6717 <primary><option>-oep</option></primary>
6718 </indexterm>
6719 <indexterm role="concept">
6720 <primary>error</primary>
6721 <secondary>reporting</secondary>
6722 </indexterm>
6723 If an error is detected while a non-SMTP message is being received, the
6724 error is reported by writing a message to the standard error file (stderr).
6725 <indexterm role="concept">
6726 <primary>return code</primary>
6727 <secondary>for <option>-oep</option></secondary>
6728 </indexterm>
6729 The return code is 1 for all errors.
6730 </para>
6731 </listitem></varlistentry>
6732 <varlistentry>
6733 <term><option>-oeq</option></term>
6734 <listitem>
6735 <para>
6736 <indexterm role="option">
6737 <primary><option>-oeq</option></primary>
6738 </indexterm>
6739 <indexterm role="concept">
6740 <primary>error</primary>
6741 <secondary>reporting</secondary>
6742 </indexterm>
6743 This option is supported for compatibility with Sendmail, but has the same
6744 effect as <option>-oep</option>.
6745 </para>
6746 </listitem></varlistentry>
6747 <varlistentry>
6748 <term><option>-oew</option></term>
6749 <listitem>
6750 <para>
6751 <indexterm role="option">
6752 <primary><option>-oew</option></primary>
6753 </indexterm>
6754 <indexterm role="concept">
6755 <primary>error</primary>
6756 <secondary>reporting</secondary>
6757 </indexterm>
6758 This option is supported for compatibility with Sendmail, but has the same
6759 effect as <option>-oem</option>.
6760 </para>
6761 </listitem></varlistentry>
6762 <varlistentry>
6763 <term><option>-oi</option></term>
6764 <listitem>
6765 <para>
6766 <indexterm role="option">
6767 <primary><option>-oi</option></primary>
6768 </indexterm>
6769 <indexterm role="concept">
6770 <primary>dot</primary>
6771 <secondary>in incoming non-SMTP message</secondary>
6772 </indexterm>
6773 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6774 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6775 single dot does terminate, though Exim does no special processing for other
6776 lines that start with a dot. This option is set by default if Exim is called as
6777 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6778 </para>
6779 </listitem></varlistentry>
6780 <varlistentry>
6781 <term><option>-oitrue</option></term>
6782 <listitem>
6783 <para>
6784 <indexterm role="option">
6785 <primary><option>-oitrue</option></primary>
6786 </indexterm>
6787 This option is treated as synonymous with <option>-oi</option>.
6788 </para>
6789 </listitem></varlistentry>
6790 <varlistentry>
6791 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6792 <listitem>
6793 <para>
6794 <indexterm role="option">
6795 <primary><option>-oMa</option></primary>
6796 </indexterm>
6797 <indexterm role="concept">
6798 <primary>sender</primary>
6799 <secondary>host address, specifying for local message</secondary>
6800 </indexterm>
6801 A number of options starting with <option>-oM</option> can be used to set values associated
6802 with remote hosts on locally-submitted messages (that is, messages not received
6803 over TCP/IP). These options can be used by any caller in conjunction with the
6804 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6805 other circumstances, they are ignored unless the caller is trusted.
6806 </para>
6807 <para>
6808 The <option>-oMa</option> option sets the sender host address. This may include a port
6809 number at the end, after a full stop (period). For example:
6810 </para>
6811 <literallayout class="monospaced">
6812 exim -bs -oMa 10.9.8.7.1234
6813 </literallayout>
6814 <para>
6815 An alternative syntax is to enclose the IP address in square brackets,
6816 followed by a colon and the port number:
6817 </para>
6818 <literallayout class="monospaced">
6819 exim -bs -oMa [10.9.8.7]:1234
6820 </literallayout>
6821 <para>
6822 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6823 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6824 are present on the command line, the sender host IP address is taken from
6825 whichever one is last.
6826 </para>
6827 </listitem></varlistentry>
6828 <varlistentry>
6829 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6830 <listitem>
6831 <para>
6832 <indexterm role="option">
6833 <primary><option>-oMaa</option></primary>
6834 </indexterm>
6835 <indexterm role="concept">
6836 <primary>authentication</primary>
6837 <secondary>name, specifying for local message</secondary>
6838 </indexterm>
6839 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6840 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6841 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6842 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6843 authenticated SMTP session without actually using the SMTP AUTH command.
6844 </para>
6845 </listitem></varlistentry>
6846 <varlistentry>
6847 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6848 <listitem>
6849 <para>
6850 <indexterm role="option">
6851 <primary><option>-oMai</option></primary>
6852 </indexterm>
6853 <indexterm role="concept">
6854 <primary>authentication</primary>
6855 <secondary>id, specifying for local message</secondary>
6856 </indexterm>
6857 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6858 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6859 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6860 where there is no default) for messages from local sources. See chapter
6861 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6862 </para>
6863 </listitem></varlistentry>
6864 <varlistentry>
6865 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6866 <listitem>
6867 <para>
6868 <indexterm role="option">
6869 <primary><option>-oMas</option></primary>
6870 </indexterm>
6871 <indexterm role="concept">
6872 <primary>authentication</primary>
6873 <secondary>sender, specifying for local message</secondary>
6874 </indexterm>
6875 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6876 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6877 overrides the sender address that is created from the caller&#x2019;s login id for
6878 messages from local sources, except when <option>-bh</option> is used, when there is no
6879 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6880 specified on a MAIL command overrides this value. See chapter
6881 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6882 </para>
6883 </listitem></varlistentry>
6884 <varlistentry>
6885 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6886 <listitem>
6887 <para>
6888 <indexterm role="option">
6889 <primary><option>-oMi</option></primary>
6890 </indexterm>
6891 <indexterm role="concept">
6892 <primary>interface</primary>
6893 <secondary>address, specifying for local message</secondary>
6894 </indexterm>
6895 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6896 option sets the IP interface address value. A port number may be included,
6897 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6898 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6899 </para>
6900 </listitem></varlistentry>
6901 <varlistentry>
6902 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6903 <listitem>
6904 <para>
6905 <indexterm role="option">
6906 <primary><option>-oMm</option></primary>
6907 </indexterm>
6908 <indexterm role="concept">
6909 <primary>message reference</primary>
6910 <secondary>message reference, specifying for local message</secondary>
6911 </indexterm>
6912 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6913 option sets the message reference, e.g. message-id, and is logged during
6914 delivery. This is useful when some kind of audit trail is required to tie
6915 messages together. The format of the message reference is checked and will
6916 abort if the format is invalid. The option will only be accepted if exim is
6917 running in trusted mode, not as any regular user.
6918 </para>
6919 <para>
6920 The best example of a message reference is when Exim sends a bounce message.
6921 The message reference is the message-id of the original message for which Exim
6922 is sending the bounce.
6923 </para>
6924 </listitem></varlistentry>
6925 <varlistentry>
6926 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6927 <listitem>
6928 <para>
6929 <indexterm role="option">
6930 <primary><option>-oMr</option></primary>
6931 </indexterm>
6932 <indexterm role="concept">
6933 <primary>protocol, specifying for local message</primary>
6934 </indexterm>
6935 <indexterm role="variable">
6936 <primary><varname>$received_protocol</varname></primary>
6937 </indexterm>
6938 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6939 option sets the received protocol value that is stored in
6940 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6941 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6942 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6943 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6944 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6945 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6946 </para>
6947 </listitem></varlistentry>
6948 <varlistentry>
6949 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6950 <listitem>
6951 <para>
6952 <indexterm role="option">
6953 <primary><option>-oMs</option></primary>
6954 </indexterm>
6955 <indexterm role="concept">
6956 <primary>sender</primary>
6957 <secondary>host name, specifying for local message</secondary>
6958 </indexterm>
6959 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6960 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6961 present, Exim does not attempt to look up a host name from an IP address; it
6962 uses the name it is given.
6963 </para>
6964 </listitem></varlistentry>
6965 <varlistentry>
6966 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6967 <listitem>
6968 <para>
6969 <indexterm role="option">
6970 <primary><option>-oMt</option></primary>
6971 </indexterm>
6972 <indexterm role="concept">
6973 <primary>sender</primary>
6974 <secondary>ident string, specifying for local message</secondary>
6975 </indexterm>
6976 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6977 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6978 local callers is the login id of the calling process, except when <option>-bh</option> is
6979 used, when there is no default.
6980 </para>
6981 </listitem></varlistentry>
6982 <varlistentry>
6983 <term><option>-om</option></term>
6984 <listitem>
6985 <para>
6986 <indexterm role="option">
6987 <primary><option>-om</option></primary>
6988 </indexterm>
6989 <indexterm role="concept">
6990 <primary>Sendmail compatibility</primary>
6991 <secondary><option>-om</option> option ignored</secondary>
6992 </indexterm>
6993 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6994 message should receive a copy of the message if the sender appears in an alias
6995 expansion. Exim always does this, so the option does nothing.
6996 </para>
6997 </listitem></varlistentry>
6998 <varlistentry>
6999 <term><option>-oo</option></term>
7000 <listitem>
7001 <para>
7002 <indexterm role="option">
7003 <primary><option>-oo</option></primary>
7004 </indexterm>
7005 <indexterm role="concept">
7006 <primary>Sendmail compatibility</primary>
7007 <secondary><option>-oo</option> option ignored</secondary>
7008 </indexterm>
7009 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
7010 whatever that means.
7011 </para>
7012 </listitem></varlistentry>
7013 <varlistentry>
7014 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
7015 <listitem>
7016 <para>
7017 <indexterm role="option">
7018 <primary><option>-oP</option></primary>
7019 </indexterm>
7020 <indexterm role="concept">
7021 <primary>pid (process id)</primary>
7022 <secondary>of daemon</secondary>
7023 </indexterm>
7024 <indexterm role="concept">
7025 <primary>daemon</primary>
7026 <secondary>process id (pid)</secondary>
7027 </indexterm>
7028 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
7029 value. The option specifies the file to which the process id of the daemon is
7030 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
7031 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
7032 because in those cases, the normal pid file is not used.
7033 </para>
7034 </listitem></varlistentry>
7035 <varlistentry>
7036 <term><option>-oPX</option></term>
7037 <listitem>
7038 <para>
7039 <indexterm role="option">
7040 <primary><option>-oPX</option></primary>
7041 </indexterm>
7042 <indexterm role="concept">
7043 <primary>pid (process id)</primary>
7044 <secondary>of daemon</secondary>
7045 </indexterm>
7046 <indexterm role="concept">
7047 <primary>daemon</primary>
7048 <secondary>process id (pid)</secondary>
7049 </indexterm>
7050 This option is not intended for general use.
7051 The daemon uses it when terminating due to a SIGTEM, possibly in
7052 combination with <option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;.
7053 It causes the pid file to be removed.
7054 </para>
7055 </listitem></varlistentry>
7056 <varlistentry>
7057 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
7058 <listitem>
7059 <para>
7060 <indexterm role="option">
7061 <primary><option>-or</option></primary>
7062 </indexterm>
7063 <indexterm role="concept">
7064 <primary>timeout</primary>
7065 <secondary>for non-SMTP input</secondary>
7066 </indexterm>
7067 This option sets a timeout value for incoming non-SMTP messages. If it is not
7068 set, Exim will wait forever for the standard input. The value can also be set
7069 by the <option>receive_timeout</option> option. The format used for specifying times is
7070 described in section <xref linkend="SECTtimeformat"/>.
7071 </para>
7072 </listitem></varlistentry>
7073 <varlistentry>
7074 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
7075 <listitem>
7076 <para>
7077 <indexterm role="option">
7078 <primary><option>-os</option></primary>
7079 </indexterm>
7080 <indexterm role="concept">
7081 <primary>timeout</primary>
7082 <secondary>for SMTP input</secondary>
7083 </indexterm>
7084 <indexterm role="concept">
7085 <primary>SMTP</primary>
7086 <secondary>input timeout</secondary>
7087 </indexterm>
7088 This option sets a timeout value for incoming SMTP messages. The timeout
7089 applies to each SMTP command and block of data. The value can also be set by
7090 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
7091 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
7092 </para>
7093 </listitem></varlistentry>
7094 <varlistentry>
7095 <term><option>-ov</option></term>
7096 <listitem>
7097 <para>
7098 <indexterm role="option">
7099 <primary><option>-ov</option></primary>
7100 </indexterm>
7101 This option has exactly the same effect as <option>-v</option>.
7102 </para>
7103 </listitem></varlistentry>
7104 <varlistentry>
7105 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
7106 <listitem>
7107 <para>
7108 <indexterm role="option">
7109 <primary><option>-oX</option></primary>
7110 </indexterm>
7111 <indexterm role="concept">
7112 <primary>TCP/IP</primary>
7113 <secondary>setting listening ports</secondary>
7114 </indexterm>
7115 <indexterm role="concept">
7116 <primary>TCP/IP</primary>
7117 <secondary>setting listening interfaces</secondary>
7118 </indexterm>
7119 <indexterm role="concept">
7120 <primary>port</primary>
7121 <secondary>receiving TCP/IP</secondary>
7122 </indexterm>
7123 This option is relevant only when the <option>-bd</option> (start listening daemon) option
7124 is also given. It controls which ports and interfaces the daemon uses. Details
7125 of the syntax, and how it interacts with configuration file options, are given
7126 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
7127 file is written unless <option>-oP</option> is also present to specify a pid filename.
7128 </para>
7129 </listitem></varlistentry>
7130 <varlistentry>
7131 <term><option>-oY</option></term>
7132 <listitem>
7133 <para>
7134 <indexterm role="option">
7135 <primary><option>-oY</option></primary>
7136 </indexterm>
7137 <indexterm role="concept">
7138 <primary>daemon notifier socket</primary>
7139 </indexterm>
7140 This option controls the creation of an inter-process communications endpoint
7141 by the Exim daemon.
7142 It is only relevant when the <option>-bd</option> (start listening daemon) option is also
7143 given.
7144 Normally the daemon creates this socket, unless a <option>-oX</option> and <emphasis role="bold">no</emphasis> <option>-oP</option>
7145 option is also present.
7146 </para>
7147 <para revisionflag="changed">
7148 If this option is given then the socket will not be created.  This is required
7149 if the system is running multiple daemons, in which case it should
7150 be used on all.
7151 The features supported by the socket will not be available in such cases.
7152 </para>
7153 <para revisionflag="changed">
7154 The socket is currently used for
7155 </para>
7156 <itemizedlist revisionflag="changed">
7157 <listitem>
7158 <para revisionflag="changed">
7159 fast ramp-up of queue runner processes
7160 </para>
7161 </listitem>
7162 <listitem>
7163 <para revisionflag="changed">
7164 caching compiled regexes
7165 </para>
7166 </listitem>
7167 <listitem>
7168 <para revisionflag="changed">
7169 obtaining a current queue size
7170 </para>
7171 </listitem>
7172 </itemizedlist>
7173 </listitem></varlistentry>
7174 <varlistentry>
7175 <term><option>-pd</option></term>
7176 <listitem>
7177 <para>
7178 <indexterm role="option">
7179 <primary><option>-pd</option></primary>
7180 </indexterm>
7181 <indexterm role="concept">
7182 <primary>Perl</primary>
7183 <secondary>starting the interpreter</secondary>
7184 </indexterm>
7185 This option applies when an embedded Perl interpreter is linked with Exim (see
7186 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
7187 option, forcing the starting of the interpreter to be delayed until it is
7188 needed.
7189 </para>
7190 </listitem></varlistentry>
7191 <varlistentry>
7192 <term><option>-ps</option></term>
7193 <listitem>
7194 <para>
7195 <indexterm role="option">
7196 <primary><option>-ps</option></primary>
7197 </indexterm>
7198 <indexterm role="concept">
7199 <primary>Perl</primary>
7200 <secondary>starting the interpreter</secondary>
7201 </indexterm>
7202 This option applies when an embedded Perl interpreter is linked with Exim (see
7203 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
7204 option, forcing the starting of the interpreter to occur as soon as Exim is
7205 started.
7206 </para>
7207 </listitem></varlistentry>
7208 <varlistentry>
7209 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
7210 <listitem>
7211 <para>
7212 <indexterm role="option">
7213 <primary><option>-p</option></primary>
7214 </indexterm>
7215 For compatibility with Sendmail, this option is equivalent to
7216 </para>
7217 <literallayout>
7218 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
7219 </literallayout>
7220 <para>
7221 It sets the incoming protocol and host name (for trusted callers). The
7222 host name and its colon can be omitted when only the protocol is to be set.
7223 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
7224 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
7225 or <literal>s</literal> using this option (but that does not seem a real limitation).
7226 Repeated use of this option is not supported.
7227 </para>
7228 </listitem></varlistentry>
7229 <varlistentry>
7230 <term><option>-q</option></term>
7231 <listitem>
7232 <para>
7233 <indexterm role="option">
7234 <primary><option>-q</option></primary>
7235 </indexterm>
7236 <indexterm role="concept">
7237 <primary>queue runner</primary>
7238 <secondary>starting manually</secondary>
7239 </indexterm>
7240 This option is normally restricted to admin users. However, there is a
7241 configuration option called <option>prod_requires_admin</option> which can be set false to
7242 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
7243 and <option>-S</option> options).
7244 </para>
7245 <para>
7246 <indexterm role="concept">
7247 <primary>queue runner</primary>
7248 <secondary>description of operation</secondary>
7249 </indexterm>
7250 If other commandline options do not specify an action,
7251 the <option>-q</option> option starts one queue runner process. This scans the queue of
7252 waiting messages, and runs a delivery process for each one in turn. It waits
7253 for each delivery process to finish before starting the next one. A delivery
7254 process may not actually do any deliveries if the retry times for the addresses
7255 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
7256 </para>
7257 <para>
7258 If
7259 <indexterm role="concept">
7260 <primary>SMTP</primary>
7261 <secondary>passed connection</secondary>
7262 </indexterm>
7263 <indexterm role="concept">
7264 <primary>SMTP</primary>
7265 <secondary>multiple deliveries</secondary>
7266 </indexterm>
7267 <indexterm role="concept">
7268 <primary>multiple SMTP deliveries</primary>
7269 </indexterm>
7270 the delivery process spawns other processes to deliver other messages down
7271 passed SMTP connections, the queue runner waits for these to finish before
7272 proceeding.
7273 </para>
7274 <para>
7275 When all the queued messages have been considered, the original queue runner
7276 process terminates. In other words, a single pass is made over the waiting
7277 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
7278 this to be repeated periodically.
7279 </para>
7280 <para>
7281 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
7282 random, but it is likely to be different each time, which is all that matters.
7283 If one particular message screws up a remote MTA, other messages to the same
7284 MTA have a chance of getting through if they get tried first.
7285 </para>
7286 <para>
7287 It is possible to cause the messages to be processed in lexical message id
7288 order, which is essentially the order in which they arrived, by setting the
7289 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
7290 </para>
7291 </listitem></varlistentry>
7292 <varlistentry>
7293 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
7294 <listitem>
7295 <para>
7296 The <option>-q</option> option may be followed by one or more flag letters that change its
7297 behaviour. They are all optional, but if more than one is present, they must
7298 appear in the correct order. Each flag is described in a separate item below.
7299 </para>
7300 </listitem></varlistentry>
7301 <varlistentry>
7302 <term><option>-qq...</option></term>
7303 <listitem>
7304 <para>
7305 <indexterm role="option">
7306 <primary><option>-qq</option></primary>
7307 </indexterm>
7308 <indexterm role="concept">
7309 <primary>queue</primary>
7310 <secondary>double scanning</secondary>
7311 </indexterm>
7312 <indexterm role="concept">
7313 <primary>queue</primary>
7314 <secondary>routing</secondary>
7315 </indexterm>
7316 <indexterm role="concept">
7317 <primary>routing</primary>
7318 <secondary>whole queue before delivery</secondary>
7319 </indexterm>
7320 <indexterm role="concept">
7321 <primary>first pass routing</primary>
7322 </indexterm>
7323 <indexterm role="concept">
7324 <primary>queue runner</primary>
7325 <secondary>two phase</secondary>
7326 </indexterm>
7327 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
7328 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
7329 every domain. Addresses are routed, local deliveries happen, but no remote
7330 transports are run.
7331 </para>
7332 <para>
7333 Performance will be best if the <option>queue_run_in_order</option> option is false.
7334 If that is so and
7335 the <option>queue_fast_ramp</option> option is true
7336 and a daemon-notifier socket is available
7337 then in the first phase of the run,
7338 once a threshold number of messages are routed for a given host,
7339 a delivery process is forked in parallel with the rest of the scan.
7340 </para>
7341 <para>
7342 <indexterm role="concept">
7343 <primary>hints database</primary>
7344 <secondary>remembering routing</secondary>
7345 </indexterm>
7346 The hints database that remembers which messages are waiting for specific hosts
7347 is updated, as if delivery to those hosts had been deferred.
7348 </para>
7349 <para>
7350 After the first queue scan complete,
7351 a second, normal queue scan is done, with routing and delivery taking
7352 place as normal.
7353 Messages that are routed to the same host should mostly be
7354 delivered down a single SMTP
7355 <indexterm role="concept">
7356 <primary>SMTP</primary>
7357 <secondary>passed connection</secondary>
7358 </indexterm>
7359 <indexterm role="concept">
7360 <primary>SMTP</primary>
7361 <secondary>multiple deliveries</secondary>
7362 </indexterm>
7363 <indexterm role="concept">
7364 <primary>multiple SMTP deliveries</primary>
7365 </indexterm>
7366 connection because of the hints that were set up during the first queue scan.
7367 </para>
7368 <para revisionflag="changed">
7369 Two-phase queue runs should be used on systems which, even intermittently,
7370 have a large queue (such as mailing-list operators).
7371 They may also be useful for hosts that are connected to the Internet
7372 intermittently.
7373 </para>
7374 </listitem></varlistentry>
7375 <varlistentry>
7376 <term><option>-q[q]i...</option></term>
7377 <listitem>
7378 <para>
7379 <indexterm role="option">
7380 <primary><option>-qi</option></primary>
7381 </indexterm>
7382 <indexterm role="concept">
7383 <primary>queue</primary>
7384 <secondary>initial delivery</secondary>
7385 </indexterm>
7386 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
7387 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
7388 delivery</quote>.) This can be helpful if you are putting messages in the queue using
7389 <option>-odq</option> and want a queue runner just to process the new messages.
7390 </para>
7391 </listitem></varlistentry>
7392 <varlistentry>
7393 <term><option>-q[q][i]f...</option></term>
7394 <listitem>
7395 <para>
7396 <indexterm role="option">
7397 <primary><option>-qf</option></primary>
7398 </indexterm>
7399 <indexterm role="concept">
7400 <primary>queue</primary>
7401 <secondary>forcing delivery</secondary>
7402 </indexterm>
7403 <indexterm role="concept">
7404 <primary>delivery</primary>
7405 <secondary>forcing in queue run</secondary>
7406 </indexterm>
7407 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
7408 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
7409 their retry times are tried.
7410 </para>
7411 </listitem></varlistentry>
7412 <varlistentry>
7413 <term><option>-q[q][i]ff...</option></term>
7414 <listitem>
7415 <para>
7416 <indexterm role="option">
7417 <primary><option>-qff</option></primary>
7418 </indexterm>
7419 <indexterm role="concept">
7420 <primary>frozen messages</primary>
7421 <secondary>forcing delivery</secondary>
7422 </indexterm>
7423 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
7424 frozen or not.
7425 </para>
7426 </listitem></varlistentry>
7427 <varlistentry>
7428 <term><option>-q[q][i][f[f]]l</option></term>
7429 <listitem>
7430 <para>
7431 <indexterm role="option">
7432 <primary><option>-ql</option></primary>
7433 </indexterm>
7434 <indexterm role="concept">
7435 <primary>queue</primary>
7436 <secondary>local deliveries only</secondary>
7437 </indexterm>
7438 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
7439 be done. If a message requires any remote deliveries, it remains in the queue
7440 for later delivery.
7441 </para>
7442 </listitem></varlistentry>
7443 <varlistentry>
7444 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
7445 <listitem>
7446 <para>
7447 <indexterm role="option">
7448 <primary><option>-qG</option></primary>
7449 </indexterm>
7450 <indexterm role="concept">
7451 <primary>queue</primary>
7452 <secondary>named</secondary>
7453 </indexterm>
7454 <indexterm role="concept">
7455 <primary>named queues</primary>
7456 <secondary>deliver from</secondary>
7457 </indexterm>
7458 <indexterm role="concept">
7459 <primary>queue</primary>
7460 <secondary>delivering specific messages</secondary>
7461 </indexterm>
7462 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
7463 queue with the given name rather than the default queue.
7464 The name should not contain a <emphasis>/</emphasis> character.
7465 For a periodic queue run (see below)
7466 append to the name a slash and a time value.
7467 </para>
7468 <para>
7469 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
7470 will specify a queue to operate on.
7471 For example:
7472 </para>
7473 <literallayout class="monospaced">
7474 exim -bp -qGquarantine
7475 mailq -qGquarantine
7476 exim -qGoffpeak -Rf @special.domain.example
7477 </literallayout>
7478 </listitem></varlistentry>
7479 <varlistentry>
7480 <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>
7481 <listitem>
7482 <para>
7483 When scanning the queue, Exim can be made to skip over messages whose ids are
7484 lexically less than a given value by following the <option>-q</option> option with a
7485 starting message id. For example:
7486 </para>
7487 <literallayout class="monospaced">
7488 exim -q 0t5C6f-0000c8-00
7489 </literallayout>
7490 <para>
7491 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
7492 second message id is given, messages whose ids are lexically greater than it
7493 are also skipped. If the same id is given twice, for example,
7494 </para>
7495 <literallayout class="monospaced">
7496 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
7497 </literallayout>
7498 <para>
7499 just one delivery process is started, for that message. This differs from
7500 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
7501 that it counts as a delivery from a queue run. Note that the selection
7502 mechanism does not affect the order in which the messages are scanned. There
7503 are also other ways of selecting specific sets of messages for delivery in a
7504 queue run &ndash; see <option>-R</option> and <option>-S</option>.
7505 </para>
7506 </listitem></varlistentry>
7507 <varlistentry>
7508 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
7509 <listitem>
7510 <para>
7511 <indexterm role="concept">
7512 <primary>queue runner</primary>
7513 <secondary>starting periodically</secondary>
7514 </indexterm>
7515 <indexterm role="concept">
7516 <primary>periodic queue running</primary>
7517 </indexterm>
7518 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
7519 starting a queue runner process at intervals specified by the given time value
7520 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
7521 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
7522 single daemon process handles both functions. A common way of starting up a
7523 combined daemon at system boot time is to use a command such as
7524 </para>
7525 <literallayout class="monospaced">
7526 /usr/exim/bin/exim -bd -q30m
7527 </literallayout>
7528 <para>
7529 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
7530 process every 30 minutes.
7531 </para>
7532 <para revisionflag="changed">
7533 <indexterm role="concept">
7534 <primary>named queues</primary>
7535 <secondary>queue runners</secondary>
7536 </indexterm>
7537 It is possible to set up runners for multiple named queues within one daemon,
7538 For example:
7539 </para>
7540 <literallayout class="monospaced" revisionflag="changed">
7541 exim -qGhipri/2m -q10m -qqGmailinglist/1h
7542 </literallayout>
7543 <para>
7544 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
7545 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
7546 </para>
7547 </listitem></varlistentry>
7548 <varlistentry>
7549 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7550 <listitem>
7551 <para>
7552 <indexterm role="option">
7553 <primary><option>-qR</option></primary>
7554 </indexterm>
7555 This option is synonymous with <option>-R</option>. It is provided for Sendmail
7556 compatibility.
7557 </para>
7558 </listitem></varlistentry>
7559 <varlistentry>
7560 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7561 <listitem>
7562 <para>
7563 <indexterm role="option">
7564 <primary><option>-qS</option></primary>
7565 </indexterm>
7566 This option is synonymous with <option>-S</option>.
7567 </para>
7568 </listitem></varlistentry>
7569 <varlistentry>
7570 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7571 <listitem>
7572 <para>
7573 <indexterm role="option">
7574 <primary><option>-R</option></primary>
7575 </indexterm>
7576 <indexterm role="concept">
7577 <primary>queue runner</primary>
7578 <secondary>for specific recipients</secondary>
7579 </indexterm>
7580 <indexterm role="concept">
7581 <primary>delivery</primary>
7582 <secondary>to given domain</secondary>
7583 </indexterm>
7584 <indexterm role="concept">
7585 <primary>domain</primary>
7586 <secondary>delivery to</secondary>
7587 </indexterm>
7588 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7589 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7590 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7591 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7592 </para>
7593 <para>
7594 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7595 perform a single queue run, except that, when scanning the messages on the
7596 queue, Exim processes only those that have at least one undelivered recipient
7597 address containing the given string, which is checked in a case-independent
7598 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7599 regular expression; otherwise it is a literal string.
7600 </para>
7601 <para>
7602 If you want to do periodic queue runs for messages with specific recipients,
7603 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7604 </para>
7605 <literallayout class="monospaced">
7606 exim -q25m -R @special.domain.example
7607 </literallayout>
7608 <para>
7609 This example does a queue run for messages with recipients in the given domain
7610 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7611 applied to each queue run.
7612 </para>
7613 <para>
7614 Once a message is selected for delivery by this mechanism, all its addresses
7615 are processed. For the first selected message, Exim overrides any retry
7616 information and forces a delivery attempt for each undelivered address. This
7617 means that if delivery of any address in the first message is successful, any
7618 existing retry information is deleted, and so delivery attempts for that
7619 address in subsequently selected messages (which are processed without forcing)
7620 will run. However, if delivery of any address does not succeed, the retry
7621 information is updated, and in subsequently selected messages, the failing
7622 address will be skipped.
7623 </para>
7624 <para>
7625 <indexterm role="concept">
7626 <primary>frozen messages</primary>
7627 <secondary>forcing delivery</secondary>
7628 </indexterm>
7629 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7630 all selected messages, not just the first; frozen messages are included when
7631 <emphasis>ff</emphasis> is present.
7632 </para>
7633 <para>
7634 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7635 to a given domain after a host has been down for some time. When the SMTP
7636 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7637 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7638 an arbitrary command instead.
7639 </para>
7640 </listitem></varlistentry>
7641 <varlistentry>
7642 <term><option>-r</option></term>
7643 <listitem>
7644 <para>
7645 <indexterm role="option">
7646 <primary><option>-r</option></primary>
7647 </indexterm>
7648 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7649 </para>
7650 </listitem></varlistentry>
7651 <varlistentry>
7652 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7653 <listitem>
7654 <para>
7655 <indexterm role="option">
7656 <primary><option>-S</option></primary>
7657 </indexterm>
7658 <indexterm role="concept">
7659 <primary>delivery</primary>
7660 <secondary>from given sender</secondary>
7661 </indexterm>
7662 <indexterm role="concept">
7663 <primary>queue runner</primary>
7664 <secondary>for specific senders</secondary>
7665 </indexterm>
7666 This option acts like <option>-R</option> except that it checks the string against each
7667 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7668 conditions must be met for a message to be selected. If either of the options
7669 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7670 </para>
7671 </listitem></varlistentry>
7672 <varlistentry>
7673 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7674 <listitem>
7675 <para>
7676 <indexterm role="option">
7677 <primary><option>-Tqt</option></primary>
7678 </indexterm>
7679 This is an option that is exclusively for use by the Exim testing suite. It is not
7680 recognized when Exim is run normally. It allows for the setting up of explicit
7681 <quote>queue times</quote> so that various warning/retry features can be tested.
7682 </para>
7683 </listitem></varlistentry>
7684 <varlistentry>
7685 <term><option>-t</option></term>
7686 <listitem>
7687 <para>
7688 <indexterm role="option">
7689 <primary><option>-t</option></primary>
7690 </indexterm>
7691 <indexterm role="concept">
7692 <primary>recipient</primary>
7693 <secondary>extracting from header lines</secondary>
7694 </indexterm>
7695 <indexterm role="concept">
7696 <primary><emphasis>Bcc:</emphasis> header line</primary>
7697 </indexterm>
7698 <indexterm role="concept">
7699 <primary>header lines</primary>
7700 <secondary>Bcc:</secondary>
7701 </indexterm>
7702 <indexterm role="concept">
7703 <primary><emphasis>Cc:</emphasis> header line</primary>
7704 </indexterm>
7705 <indexterm role="concept">
7706 <primary>header lines</primary>
7707 <secondary>Cc:</secondary>
7708 </indexterm>
7709 <indexterm role="concept">
7710 <primary><emphasis>To:</emphasis> header line</primary>
7711 </indexterm>
7712 <indexterm role="concept">
7713 <primary>header lines</primary>
7714 <secondary>To:</secondary>
7715 </indexterm>
7716 When Exim is receiving a locally-generated, non-SMTP message on its standard
7717 input, the <option>-t</option> option causes the recipients of the message to be obtained
7718 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7719 from the command arguments. The addresses are extracted before any rewriting
7720 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7721 </para>
7722 <para>
7723 <indexterm role="concept">
7724 <primary>Sendmail compatibility</primary>
7725 <secondary><option>-t</option> option</secondary>
7726 </indexterm>
7727 If the command has any arguments, they specify addresses to which the message
7728 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7729 the recipients list obtained from the headers. This is compatible with Smail 3
7730 and in accordance with the documented behaviour of several versions of
7731 Sendmail, as described in man pages on a number of operating systems (e.g.
7732 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7733 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7734 Sendmail book documents it that way. Exim can be made to add argument addresses
7735 instead of subtracting them by setting the option
7736 <option>extract_addresses_remove_arguments</option> false.
7737 </para>
7738 <para>
7739 <indexterm role="concept">
7740 <primary><option>Resent-</option> header lines</primary>
7741 <secondary>with <option>-t</option></secondary>
7742 </indexterm>
7743 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7744 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7745 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7746 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7747 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7748 </para>
7749 <para>
7750 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7751 message is resent several times). The RFC also specifies that they should be
7752 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7753 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7754 nor indeed exactly what constitutes a <quote>set</quote>.
7755 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7756 are often added at the end of the header, and if a message is resent more than
7757 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7758 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7759 </para>
7760 </listitem></varlistentry>
7761 <varlistentry>
7762 <term><option>-ti</option></term>
7763 <listitem>
7764 <para>
7765 <indexterm role="option">
7766 <primary><option>-ti</option></primary>
7767 </indexterm>
7768 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7769 compatibility with Sendmail.
7770 </para>
7771 </listitem></varlistentry>
7772 <varlistentry>
7773 <term><option>-tls-on-connect</option></term>
7774 <listitem>
7775 <para>
7776 <indexterm role="option">
7777 <primary><option>-tls-on-connect</option></primary>
7778 </indexterm>
7779 <indexterm role="concept">
7780 <primary>TLS</primary>
7781 <secondary>use without STARTTLS</secondary>
7782 </indexterm>
7783 <indexterm role="concept">
7784 <primary>TLS</primary>
7785 <secondary>automatic start</secondary>
7786 </indexterm>
7787 This option is available when Exim is compiled with TLS support. It forces all
7788 incoming SMTP connections to behave as if the incoming port is listed in the
7789 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7790 <xref linkend="CHAPTLS"/> for further details.
7791 </para>
7792 </listitem></varlistentry>
7793 <varlistentry>
7794 <term><option>-U</option></term>
7795 <listitem>
7796 <para>
7797 <indexterm role="option">
7798 <primary><option>-U</option></primary>
7799 </indexterm>
7800 <indexterm role="concept">
7801 <primary>Sendmail compatibility</primary>
7802 <secondary><option>-U</option> option ignored</secondary>
7803 </indexterm>
7804 Sendmail uses this option for <quote>initial message submission</quote>, and its
7805 documentation states that in future releases, it may complain about
7806 syntactically invalid messages rather than fixing them when this flag is not
7807 set. Exim ignores this option.
7808 </para>
7809 </listitem></varlistentry>
7810 <varlistentry>
7811 <term><option>-v</option></term>
7812 <listitem>
7813 <para>
7814 <indexterm role="option">
7815 <primary><option>-v</option></primary>
7816 </indexterm>
7817 This option causes Exim to write information to the standard error stream,
7818 describing what it is doing. In particular, it shows the log lines for
7819 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7820 dialogue is shown. Some of the log lines shown may not actually be written to
7821 the log if the setting of <option>log_selector</option> discards them. Any relevant
7822 selectors are shown with each log line. If none are shown, the logging is
7823 unconditional.
7824 </para>
7825 </listitem></varlistentry>
7826 <varlistentry>
7827 <term><option>-x</option></term>
7828 <listitem>
7829 <para>
7830 <indexterm role="option">
7831 <primary><option>-x</option></primary>
7832 </indexterm>
7833 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7834 National Language Support extended characters in the body of the mail item</quote>).
7835 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7836 this option.
7837 </para>
7838 </listitem></varlistentry>
7839 <varlistentry>
7840 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7841 <listitem>
7842 <para>
7843 <indexterm role="option">
7844 <primary><option>-X</option></primary>
7845 </indexterm>
7846 This option is interpreted by Sendmail to cause debug information to be sent
7847 to the named file.  It is ignored by Exim.
7848 </para>
7849 </listitem></varlistentry>
7850 <varlistentry>
7851 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7852 <listitem>
7853 <para>
7854 <indexterm role="option">
7855 <primary><option>-z</option></primary>
7856 </indexterm>
7857 This option writes its argument to Exim&#x2019;s logfile.
7858 Use is restricted to administrators; the intent is for operational notes.
7859 Quotes should be used to maintain a multi-word item as a single argument,
7860 under most shells.
7861 </para>
7862 </listitem></varlistentry>
7863 </variablelist>
7864 <para>
7865 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7866 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7867 </para>
7868 <!-- === End of command line options === -->
7869 </section>
7870 </chapter>
7871
7872 <chapter id="CHAPconf">
7873 <title>The Exim runtime configuration file</title>
7874 <titleabbrev>The runtime configuration file</titleabbrev>
7875 <para>
7876 <indexterm role="concept">
7877 <primary>runtime configuration</primary>
7878 </indexterm>
7879 <indexterm role="concept">
7880 <primary>configuration file</primary>
7881 <secondary>general description</secondary>
7882 </indexterm>
7883 <indexterm role="concept">
7884 <primary>CONFIGURE_FILE</primary>
7885 </indexterm>
7886 <indexterm role="concept">
7887 <primary>configuration file</primary>
7888 <secondary>errors in</secondary>
7889 </indexterm>
7890 <indexterm role="concept">
7891 <primary>error</primary>
7892 <secondary>in configuration file</secondary>
7893 </indexterm>
7894 <indexterm role="concept">
7895 <primary>return code</primary>
7896 <secondary>for bad configuration</secondary>
7897 </indexterm>
7898 Exim uses a single runtime configuration file that is read whenever an Exim
7899 binary is executed. Note that in normal operation, this happens frequently,
7900 because Exim is designed to operate in a distributed manner, without central
7901 control.
7902 </para>
7903 <para>
7904 If a syntax error is detected while reading the configuration file, Exim
7905 writes a message on the standard error, and exits with a non-zero return code.
7906 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7907 errors can be detected at this time. The values of any expanded options are
7908 not checked until the expansion happens, even when the expansion does not
7909 actually alter the string.
7910 </para>
7911 <para>
7912 The name of the configuration file is compiled into the binary for security
7913 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7914 most configurations, this specifies a single file. However, it is permitted to
7915 give a colon-separated list of filenames, in which case Exim uses the first
7916 existing file in the list.
7917 </para>
7918 <para>
7919 <indexterm role="concept">
7920 <primary>EXIM_USER</primary>
7921 </indexterm>
7922 <indexterm role="concept">
7923 <primary>EXIM_GROUP</primary>
7924 </indexterm>
7925 <indexterm role="concept">
7926 <primary>CONFIGURE_OWNER</primary>
7927 </indexterm>
7928 <indexterm role="concept">
7929 <primary>CONFIGURE_GROUP</primary>
7930 </indexterm>
7931 <indexterm role="concept">
7932 <primary>configuration file</primary>
7933 <secondary>ownership</secondary>
7934 </indexterm>
7935 <indexterm role="concept">
7936 <primary>ownership</primary>
7937 <secondary>configuration file</secondary>
7938 </indexterm>
7939 The runtime configuration file must be owned by root or by the user that is
7940 specified at compile time by the CONFIGURE_OWNER option (if set). The
7941 configuration file must not be world-writeable, or group-writeable unless its
7942 group is the root group or the one specified at compile time by the
7943 CONFIGURE_GROUP option.
7944 </para>
7945 <para>
7946 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7947 to root, anybody who is able to edit the runtime configuration file has an
7948 easy way to run commands as root. If you specify a user or group in the
7949 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7950 who are members of that group will trivially be able to obtain root privileges.
7951 </para>
7952 <para>
7953 Up to Exim version 4.72, the runtime configuration file was also permitted to
7954 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7955 since it offered a simple privilege escalation for any attacker who managed to
7956 compromise the Exim user account.
7957 </para>
7958 <para>
7959 A default configuration file, which will work correctly in simple situations,
7960 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7961 defines just one filename, the installation process copies the default
7962 configuration to a new file of that name if it did not previously exist. If
7963 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7964 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7965 configuration.
7966 </para>
7967 <section id="SECID40">
7968 <title>Using a different configuration file</title>
7969 <para>
7970 <indexterm role="concept">
7971 <primary>configuration file</primary>
7972 <secondary>alternate</secondary>
7973 </indexterm>
7974 A one-off alternate configuration can be specified by the <option>-C</option> command line
7975 option, which may specify a single file or a list of files. However, when
7976 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7977 unless the argument for <option>-C</option> is identical to the built-in value from
7978 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7979 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7980 is useful mainly for checking the syntax of configuration files before
7981 installing them. No owner or group checks are done on a configuration file
7982 specified by <option>-C</option>, if root privilege has been dropped.
7983 </para>
7984 <para>
7985 Even the Exim user is not trusted to specify an arbitrary configuration file
7986 with the <option>-C</option> option to be used with root privileges, unless that file is
7987 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7988 testing a configuration using <option>-C</option> right through message reception and
7989 delivery, even if the caller is root. The reception works, but by that time,
7990 Exim is running as the Exim user, so when it re-execs to regain privilege for
7991 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7992 can test reception and delivery using two separate commands (one to put a
7993 message in the queue, using <option>-odq</option>, and another to do the delivery, using
7994 <option>-M</option>).
7995 </para>
7996 <para>
7997 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7998 prefix string with which any file named in a <option>-C</option> command line option must
7999 start. In addition, the filename must not contain the sequence <quote><literal>/../</literal></quote>.
8000 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any
8001 filename can be used with <option>-C</option>.
8002 </para>
8003 <para>
8004 One-off changes to a configuration can be specified by the <option>-D</option> command line
8005 option, which defines and overrides values for macros used inside the
8006 configuration file. However, like <option>-C</option>, the use of this option by a
8007 non-privileged user causes Exim to discard its root privilege.
8008 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
8009 completely disabled, and its use causes an immediate error exit.
8010 </para>
8011 <para>
8012 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
8013 to declare certain macro names trusted, such that root privilege will not
8014 necessarily be discarded.
8015 WHITELIST_D_MACROS defines a colon-separated list of macros which are
8016 considered safe and, if <option>-D</option> only supplies macros from this list, and the
8017 values are acceptable, then Exim will not give up root privilege if the caller
8018 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
8019 transition mechanism and is expected to be removed in the future.  Acceptable
8020 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
8021 </para>
8022 <para>
8023 Some sites may wish to use the same Exim binary on different machines that
8024 share a file system, but to use different configuration files on each machine.
8025 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
8026 looks for a file whose name is the configuration filename followed by a dot
8027 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
8028 file does not exist, the standard name is tried. This processing occurs for
8029 each filename in the list given by CONFIGURE_FILE or <option>-C</option>.
8030 </para>
8031 <para>
8032 In some esoteric situations different versions of Exim may be run under
8033 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
8034 help with this. See the comments in <filename>src/EDITME</filename> for details.
8035 </para>
8036 </section>
8037 <section id="SECTconffilfor">
8038 <title>Configuration file format</title>
8039 <para>
8040 <indexterm role="concept">
8041 <primary>configuration file</primary>
8042 <secondary>format of</secondary>
8043 </indexterm>
8044 <indexterm role="concept">
8045 <primary>format</primary>
8046 <secondary>configuration file</secondary>
8047 </indexterm>
8048 Exim&#x2019;s configuration file is divided into a number of different parts. General
8049 option settings must always appear at the start of the file. The other parts
8050 are all optional, and may appear in any order. Each part other than the first
8051 is introduced by the word <quote>begin</quote> followed by at least one literal
8052 space, and the name of the part. The optional parts are:
8053 </para>
8054 <itemizedlist>
8055 <listitem>
8056 <para>
8057 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
8058 <xref linkend="CHAPACL"/>).
8059 </para>
8060 </listitem>
8061 <listitem>
8062 <para>
8063 <indexterm role="concept">
8064 <primary>AUTH</primary>
8065 <secondary>configuration</secondary>
8066 </indexterm>
8067 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
8068 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
8069 </para>
8070 </listitem>
8071 <listitem>
8072 <para>
8073 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
8074 addresses and determine how the message is to be delivered (see chapters
8075 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
8076 </para>
8077 </listitem>
8078 <listitem>
8079 <para>
8080 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
8081 define mechanisms for copying messages to destinations (see chapters
8082 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
8083 </para>
8084 </listitem>
8085 <listitem>
8086 <para>
8087 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
8088 If there is no retry section, or if it is empty (that is, no retry rules are
8089 defined), Exim will not retry deliveries. In this situation, temporary errors
8090 are treated the same as permanent errors. Retry rules are discussed in chapter
8091 <xref linkend="CHAPretry"/>.
8092 </para>
8093 </listitem>
8094 <listitem>
8095 <para>
8096 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
8097 when new addresses are generated during delivery. Rewriting is discussed in
8098 chapter <xref linkend="CHAPrewrite"/>.
8099 </para>
8100 </listitem>
8101 <listitem>
8102 <para>
8103 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
8104 want to use this feature, you must set
8105 </para>
8106 <literallayout class="monospaced">
8107 LOCAL_SCAN_HAS_OPTIONS=yes
8108 </literallayout>
8109 <para>
8110 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
8111 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
8112 </para>
8113 </listitem>
8114 </itemizedlist>
8115 <para>
8116 <indexterm role="concept">
8117 <primary>configuration file</primary>
8118 <secondary>leading white space in</secondary>
8119 </indexterm>
8120 <indexterm role="concept">
8121 <primary>configuration file</primary>
8122 <secondary>trailing white space in</secondary>
8123 </indexterm>
8124 <indexterm role="concept">
8125 <primary>white space</primary>
8126 <secondary>in configuration file</secondary>
8127 </indexterm>
8128 Leading and trailing white space in configuration lines is always ignored.
8129 </para>
8130 <para>
8131 Blank lines in the file, and lines starting with a # character (ignoring
8132 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
8133 # character other than at the beginning of a line is not treated specially,
8134 and does not introduce a comment.
8135 </para>
8136 <para>
8137 Any non-comment line can be continued by ending it with a backslash. Note that
8138 the general rule for white space means that trailing white space after the
8139 backslash and leading white space at the start of continuation
8140 lines is ignored. Comment lines beginning with # (but not empty lines) may
8141 appear in the middle of a sequence of continuation lines.
8142 </para>
8143 <para>
8144 A convenient way to create a configuration file is to start from the
8145 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
8146 change settings as required.
8147 </para>
8148 <para>
8149 The ACLs, retry rules, and rewriting rules have their own syntax which is
8150 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
8151 respectively. The other parts of the configuration file have some syntactic
8152 items in common, and these are described below, from section <xref linkend="SECTcos"/>
8153 onwards. Before that, the inclusion, macro, and conditional facilities are
8154 described.
8155 </para>
8156 </section>
8157 <section id="SECID41">
8158 <title>File inclusions in the configuration file</title>
8159 <para>
8160 <indexterm role="concept">
8161 <primary>inclusions in configuration file</primary>
8162 </indexterm>
8163 <indexterm role="concept">
8164 <primary>configuration file</primary>
8165 <secondary>including other files</secondary>
8166 </indexterm>
8167 <indexterm role="concept">
8168 <primary><literal>.include</literal> in configuration file</primary>
8169 </indexterm>
8170 <indexterm role="concept">
8171 <primary><literal>.include_if_exists</literal> in configuration file</primary>
8172 </indexterm>
8173 You can include other files inside Exim&#x2019;s runtime configuration file by
8174 using this syntax:
8175 </para>
8176 <literallayout>
8177 <literal>.include</literal> &lt;<emphasis>filename</emphasis>&gt;
8178 <literal>.include_if_exists</literal> &lt;<emphasis>filename</emphasis>&gt;
8179 </literallayout>
8180 <para>
8181 on a line by itself. Double quotes round the filename are optional. If you use
8182 the first form, a configuration error occurs if the file does not exist; the
8183 second form does nothing for non-existent files.
8184 The first form allows a relative name. It is resolved relative to
8185 the directory of the including file. For the second form an absolute filename
8186 is required.
8187 </para>
8188 <para>
8189 Includes may be nested to any depth, but remember that Exim reads its
8190 configuration file often, so it is a good idea to keep them to a minimum.
8191 If you change the contents of an included file, you must HUP the daemon,
8192 because an included file is read only when the configuration itself is read.
8193 </para>
8194 <para>
8195 The processing of inclusions happens early, at a physical line level, so, like
8196 comment lines, an inclusion can be used in the middle of an option setting,
8197 for example:
8198 </para>
8199 <literallayout class="monospaced">
8200 hosts_lookup = a.b.c \
8201                .include /some/file
8202 </literallayout>
8203 <para>
8204 Include processing happens after macro processing (see below). Its effect is to
8205 process the lines of the included file as if they occurred inline where the
8206 inclusion appears.
8207 </para>
8208 </section>
8209 <section id="SECTmacrodefs">
8210 <title>Macros in the configuration file</title>
8211 <para>
8212 <indexterm role="concept">
8213 <primary>macro</primary>
8214 <secondary>description of</secondary>
8215 </indexterm>
8216 <indexterm role="concept">
8217 <primary>configuration file</primary>
8218 <secondary>macros</secondary>
8219 </indexterm>
8220 If a line in the main part of the configuration (that is, before the first
8221 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
8222 definition, and must be of the form
8223 </para>
8224 <literallayout>
8225 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
8226 </literallayout>
8227 <para>
8228 The name must consist of letters, digits, and underscores, and need not all be
8229 in upper case, though that is recommended. The rest of the line, including any
8230 continuations, is the replacement text, and has leading and trailing white
8231 space removed. Quotes are not removed. The replacement text can never end with
8232 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
8233 </para>
8234 <para>
8235 Macros may also be defined between router, transport, authenticator, or ACL
8236 definitions. They may not, however, be defined within an individual driver or
8237 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
8238 </para>
8239 </section>
8240 <section id="SECID42">
8241 <title>Macro substitution</title>
8242 <para>
8243 Once a macro is defined, all subsequent lines in the file (and any included
8244 files) are scanned for the macro name; if there are several macros, the line is
8245 scanned for each, in turn, in the order in which the macros are defined. The
8246 replacement text is not re-scanned for the current macro, though it is scanned
8247 for subsequently defined macros. For this reason, a macro name may not contain
8248 the name of a previously defined macro as a substring. You could, for example,
8249 define
8250 </para>
8251 <literallayout>
8252 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
8253 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
8254 </literallayout>
8255 <para>
8256 but putting the definitions in the opposite order would provoke a configuration
8257 error. Macro expansion is applied to individual physical lines from the file,
8258 before checking for line continuation or file inclusion (see above). If a line
8259 consists solely of a macro name, and the expansion of the macro is empty, the
8260 line is ignored. A macro at the start of a line may turn the line into a
8261 comment line or a <literal>.include</literal> line.
8262 </para>
8263 </section>
8264 <section id="SECID43">
8265 <title>Redefining macros</title>
8266 <para>
8267 Once defined, the value of a macro can be redefined later in the configuration
8268 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
8269 <emphasis>=</emphasis>. For example:
8270 </para>
8271 <literallayout class="monospaced">
8272 MAC =  initial value
8273 ...
8274 MAC == updated value
8275 </literallayout>
8276 <para>
8277 Redefinition does not alter the order in which the macros are applied to the
8278 subsequent lines of the configuration file. It is still the same order in which
8279 the macros were originally defined. All that changes is the macro&#x2019;s value.
8280 Redefinition makes it possible to accumulate values. For example:
8281 </para>
8282 <literallayout class="monospaced">
8283 MAC =  initial value
8284 ...
8285 MAC == MAC and something added
8286 </literallayout>
8287 <para>
8288 This can be helpful in situations where the configuration file is built
8289 from a number of other files.
8290 </para>
8291 </section>
8292 <section id="SECID44">
8293 <title>Overriding macro values</title>
8294 <para>
8295 The values set for macros in the configuration file can be overridden by the
8296 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
8297 used, unless called by root or the Exim user. A definition on the command line
8298 using the <option>-D</option> option causes all definitions and redefinitions within the
8299 file to be ignored.
8300 </para>
8301 </section>
8302 <section id="SECID45">
8303 <title>Example of macro usage</title>
8304 <para>
8305 As an example of macro usage, consider a configuration where aliases are looked
8306 up in a MySQL database. It helps to keep the file less cluttered if long
8307 strings such as SQL statements are defined separately as macros, for example:
8308 </para>
8309 <literallayout class="monospaced">
8310 ALIAS_QUERY = select mailbox from user where \
8311               login='${quote_mysql:$local_part}';
8312 </literallayout>
8313 <para>
8314 This can then be used in a <command>redirect</command> router setting like this:
8315 </para>
8316 <literallayout class="monospaced">
8317 data = ${lookup mysql{ALIAS_QUERY}}
8318 </literallayout>
8319 <para>
8320 In earlier versions of Exim macros were sometimes used for domain, host, or
8321 address lists. In Exim 4 these are handled better by named lists &ndash; see
8322 section <xref linkend="SECTnamedlists"/>.
8323 </para>
8324 </section>
8325 <section id="SECTbuiltinmacros">
8326 <title>Builtin macros</title>
8327 <para>
8328 Exim defines some macros depending on facilities available, which may
8329 differ due to build-time definitions and from one release to another.
8330 All of these macros start with an underscore.
8331 They can be used to conditionally include parts of a configuration
8332 (see below).
8333 </para>
8334 <para>
8335 The following classes of macros are defined:
8336 </para>
8337 <literallayout>
8338 <literal> _HAVE_*                    </literal>  build-time defines
8339 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
8340 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
8341 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
8342 <literal> _EXP_COND_*                </literal>  expansion conditions
8343 <literal> _EXP_ITEM_*                </literal>  expansion items
8344 <literal> _EXP_OP_*                  </literal>  expansion operators
8345 <literal> _EXP_VAR_*                 </literal>  expansion variables
8346 <literal> _LOG_*                     </literal>  log_selector values
8347 <literal> _OPT_MAIN_*                </literal>  main config options
8348 <literal> _OPT_ROUTERS_*             </literal>  generic router options
8349 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
8350 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
8351 <literal> _OPT_ROUTER_*_*            </literal>  private router options
8352 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
8353 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
8354 </literallayout>
8355 <para>
8356 Use an <quote>exim -bP macros</quote> command to get the list of macros.
8357 </para>
8358 </section>
8359 <section id="SECID46">
8360 <title>Conditional skips in the configuration file</title>
8361 <para>
8362 <indexterm role="concept">
8363 <primary>configuration file</primary>
8364 <secondary>conditional skips</secondary>
8365 </indexterm>
8366 <indexterm role="concept">
8367 <primary><literal>.ifdef</literal></primary>
8368 </indexterm>
8369 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
8370 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
8371 portions of the configuration file. The processing happens whenever the file is
8372 read (that is, when an Exim binary starts to run).
8373 </para>
8374 <para>
8375 The implementation is very simple. Instances of the first four directives must
8376 be followed by text that includes the names of one or macros. The condition
8377 that is tested is whether or not any macro substitution has taken place in the
8378 line. Thus:
8379 </para>
8380 <literallayout class="monospaced">
8381 .ifdef AAA
8382 message_size_limit = 50M
8383 .else
8384 message_size_limit = 100M
8385 .endif
8386 </literallayout>
8387 <para>
8388 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
8389 (or <literal>A</literal> or <literal>AA</literal>), and 100M
8390 otherwise. If there is more than one macro named on the line, the condition
8391 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
8392 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
8393 </para>
8394 <para>
8395 Although you can use a macro expansion to generate one of these directives,
8396 it is not very useful, because the condition <quote>there was a macro substitution
8397 in this line</quote> will always be true.
8398 </para>
8399 <para>
8400 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
8401 to clarify complicated nestings.
8402 </para>
8403 </section>
8404 <section id="SECTcos">
8405 <title>Common option syntax</title>
8406 <para>
8407 <indexterm role="concept">
8408 <primary>common option syntax</primary>
8409 </indexterm>
8410 <indexterm role="concept">
8411 <primary>syntax of common options</primary>
8412 </indexterm>
8413 <indexterm role="concept">
8414 <primary>configuration file</primary>
8415 <secondary>common option syntax</secondary>
8416 </indexterm>
8417 For the main set of options, driver options, and <function>local_scan()</function> options,
8418 each setting is on a line by itself, and starts with a name consisting of
8419 lower-case letters and underscores. Many options require a data value, and in
8420 these cases the name must be followed by an equals sign (with optional white
8421 space) and then the value. For example:
8422 </para>
8423 <literallayout class="monospaced">
8424 qualify_domain = mydomain.example.com
8425 </literallayout>
8426 <para>
8427 <indexterm role="concept">
8428 <primary>hiding configuration option values</primary>
8429 </indexterm>
8430 <indexterm role="concept">
8431 <primary>configuration options</primary>
8432 <secondary>hiding value of</secondary>
8433 </indexterm>
8434 <indexterm role="concept">
8435 <primary>options</primary>
8436 <secondary>hiding value of</secondary>
8437 </indexterm>
8438 Some option settings may contain sensitive data, for example, passwords for
8439 accessing databases. To stop non-admin users from using the <option>-bP</option> command
8440 line option to read these values, you can precede the option settings with the
8441 word <quote>hide</quote>. For example:
8442 </para>
8443 <literallayout class="monospaced">
8444 hide mysql_servers = localhost/users/admin/secret-password
8445 </literallayout>
8446 <para>
8447 For non-admin users, such options are displayed like this:
8448 </para>
8449 <literallayout class="monospaced">
8450 mysql_servers = &lt;value not displayable&gt;
8451 </literallayout>
8452 <para>
8453 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
8454 all instances of the same driver.
8455 </para>
8456 <para>
8457 The following sections describe the syntax used for the different data types
8458 that are found in option settings.
8459 </para>
8460 </section>
8461 <section id="SECID47">
8462 <title>Boolean options</title>
8463 <para>
8464 <indexterm role="concept">
8465 <primary>format</primary>
8466 <secondary>boolean</secondary>
8467 </indexterm>
8468 <indexterm role="concept">
8469 <primary>boolean configuration values</primary>
8470 </indexterm>
8471 <indexterm role="option">
8472 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
8473 </indexterm>
8474 <indexterm role="option">
8475 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
8476 </indexterm>
8477 Options whose type is given as boolean are on/off switches. There are two
8478 different ways of specifying such options: with and without a data value. If
8479 the option name is specified on its own without data, the switch is turned on;
8480 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
8481 boolean options may be followed by an equals sign and one of the words
8482 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
8483 the following two settings have exactly the same effect:
8484 </para>
8485 <literallayout class="monospaced">
8486 queue_only
8487 queue_only = true
8488 </literallayout>
8489 <para>
8490 The following two lines also have the same (opposite) effect:
8491 </para>
8492 <literallayout class="monospaced">
8493 no_queue_only
8494 queue_only = false
8495 </literallayout>
8496 <para>
8497 You can use whichever syntax you prefer.
8498 </para>
8499 </section>
8500 <section id="SECID48">
8501 <title>Integer values</title>
8502 <para>
8503 <indexterm role="concept">
8504 <primary>integer configuration values</primary>
8505 </indexterm>
8506 <indexterm role="concept">
8507 <primary>format</primary>
8508 <secondary>integer</secondary>
8509 </indexterm>
8510 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
8511 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
8512 number is assumed. Otherwise, it is treated as an octal number unless it starts
8513 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
8514 hexadecimal number.
8515 </para>
8516 <para>
8517 If an integer value is followed by the letter K, it is multiplied by 1024; if
8518 it is followed by the letter M, it is multiplied by 1024x1024;
8519 if by the letter G, 1024x1024x1024.
8520 When the values
8521 of integer option settings are output, values which are an exact multiple of
8522 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
8523 and M. The printing style is independent of the actual input format that was
8524 used.
8525 </para>
8526 </section>
8527 <section id="SECID49">
8528 <title>Octal integer values</title>
8529 <para>
8530 <indexterm role="concept">
8531 <primary>integer format</primary>
8532 </indexterm>
8533 <indexterm role="concept">
8534 <primary>format</primary>
8535 <secondary>octal integer</secondary>
8536 </indexterm>
8537 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
8538 interpreted as an octal number, whether or not it starts with the digit zero.
8539 Such options are always output in octal.
8540 </para>
8541 </section>
8542 <section id="SECID50">
8543 <title>Fixed point numbers</title>
8544 <para>
8545 <indexterm role="concept">
8546 <primary>fixed point configuration values</primary>
8547 </indexterm>
8548 <indexterm role="concept">
8549 <primary>format</primary>
8550 <secondary>fixed point</secondary>
8551 </indexterm>
8552 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
8553 integer, optionally followed by a decimal point and up to three further digits.
8554 </para>
8555 </section>
8556 <section id="SECTtimeformat">
8557 <title>Time intervals</title>
8558 <para>
8559 <indexterm role="concept">
8560 <primary>time interval</primary>
8561 <secondary>specifying in configuration</secondary>
8562 </indexterm>
8563 <indexterm role="concept">
8564 <primary>format</primary>
8565 <secondary>time interval</secondary>
8566 </indexterm>
8567 A time interval is specified as a sequence of numbers, each followed by one of
8568 the following letters, with no intervening white space:
8569 </para>
8570 <informaltable frame="none">
8571 <tgroup cols="2" colsep="0" rowsep="0">
8572 <colspec colwidth="30pt" align="left"/>
8573 <colspec colwidth="254pt" align="left"/>
8574 <tbody>
8575 <row>
8576 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
8577 <entry>seconds</entry>
8578 </row>
8579 <row>
8580 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8581 <entry>minutes</entry>
8582 </row>
8583 <row>
8584 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8585 <entry>hours</entry>
8586 </row>
8587 <row>
8588 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8589 <entry>days</entry>
8590 </row>
8591 <row>
8592 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8593 <entry>weeks</entry>
8594 </row>
8595 </tbody>
8596 </tgroup>
8597 </informaltable>
8598 <para>
8599 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8600 intervals are output in the same format. Exim does not restrict the values; it
8601 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8602 </para>
8603 </section>
8604 <section id="SECTstrings">
8605 <title>String values</title>
8606 <para>
8607 <indexterm role="concept">
8608 <primary>string</primary>
8609 <secondary>format of configuration values</secondary>
8610 </indexterm>
8611 <indexterm role="concept">
8612 <primary>format</primary>
8613 <secondary>string</secondary>
8614 </indexterm>
8615 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8616 or without double-quotes. If it does not start with a double-quote, the value
8617 consists of the remainder of the line plus any continuation lines, starting at
8618 the first character after any leading white space, with trailing white space
8619 removed, and with no interpretation of the characters in the string. Because
8620 Exim removes comment lines (those beginning with #) at an early stage, they can
8621 appear in the middle of a multi-line string. The following two settings are
8622 therefore equivalent:
8623 </para>
8624 <literallayout class="monospaced">
8625 trusted_users = uucp:mail
8626 trusted_users = uucp:\
8627                 # This comment line is ignored
8628                 mail
8629 </literallayout>
8630 <para>
8631 <indexterm role="concept">
8632 <primary>string</primary>
8633 <secondary>quoted</secondary>
8634 </indexterm>
8635 <indexterm role="concept">
8636 <primary>escape characters in quoted strings</primary>
8637 </indexterm>
8638 If a string does start with a double-quote, it must end with a closing
8639 double-quote, and any backslash characters other than those used for line
8640 continuation are interpreted as escape characters, as follows:
8641 </para>
8642 <informaltable frame="none">
8643 <tgroup cols="2" colsep="0" rowsep="0">
8644 <colspec colwidth="100pt" align="left"/>
8645 <colspec colwidth="254pt" align="left"/>
8646 <tbody>
8647 <row>
8648 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8649 <entry>single backslash</entry>
8650 </row>
8651 <row>
8652 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8653 <entry>newline</entry>
8654 </row>
8655 <row>
8656 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8657 <entry>carriage return</entry>
8658 </row>
8659 <row>
8660 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8661 <entry>tab</entry>
8662 </row>
8663 <row>
8664 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8665 <entry>up to 3 octal digits specify one character</entry>
8666 </row>
8667 <row>
8668 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8669 <entry>up to 2 hexadecimal digits specify one character</entry>
8670 </row>
8671 </tbody>
8672 </tgroup>
8673 </informaltable>
8674 <para>
8675 If a backslash is followed by some other character, including a double-quote
8676 character, that character replaces the pair.
8677 </para>
8678 <para>
8679 Quoting is necessary only if you want to make use of the backslash escapes to
8680 insert special characters, or if you need to specify a value with leading or
8681 trailing spaces. These cases are rare, so quoting is almost never needed in
8682 current versions of Exim. In versions of Exim before 3.14, quoting was required
8683 in order to continue lines, so you may come across older configuration files
8684 and examples that apparently quote unnecessarily.
8685 </para>
8686 </section>
8687 <section id="SECID51">
8688 <title>Expanded strings</title>
8689 <para>
8690 <indexterm role="concept">
8691 <primary>expansion</primary>
8692 <secondary>definition of</secondary>
8693 </indexterm>
8694 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8695 by which means various parts of the string may be changed according to the
8696 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8697 is as just described; in particular, the handling of backslashes in quoted
8698 strings is done as part of the input process, before expansion takes place.
8699 However, backslash is also an escape character for the expander, so any
8700 backslashes that are required for that reason must be doubled if they are
8701 within a quoted configuration string.
8702 </para>
8703 </section>
8704 <section id="SECID52">
8705 <title>User and group names</title>
8706 <para>
8707 <indexterm role="concept">
8708 <primary>user name</primary>
8709 <secondary>format of</secondary>
8710 </indexterm>
8711 <indexterm role="concept">
8712 <primary>format</primary>
8713 <secondary>user name</secondary>
8714 </indexterm>
8715 <indexterm role="concept">
8716 <primary>groups</primary>
8717 <secondary>name format</secondary>
8718 </indexterm>
8719 <indexterm role="concept">
8720 <primary>format</primary>
8721 <secondary>group name</secondary>
8722 </indexterm>
8723 User and group names are specified as strings, using the syntax described
8724 above, but the strings are interpreted specially. A user or group name must
8725 either consist entirely of digits, or be a name that can be looked up using the
8726 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8727 </para>
8728 </section>
8729 <section id="SECTlistconstruct">
8730 <title>List construction</title>
8731 <para>
8732 <indexterm role="concept">
8733 <primary>list</primary>
8734 <secondary>syntax of in configuration</secondary>
8735 </indexterm>
8736 <indexterm role="concept">
8737 <primary>format</primary>
8738 <secondary>list item in configuration</secondary>
8739 </indexterm>
8740 <indexterm role="concept">
8741 <primary>string</primary>
8742 <secondary>list, definition of</secondary>
8743 </indexterm>
8744 The data for some configuration options is a list of items, with colon as the
8745 default separator. Many of these options are shown with type <quote>string list</quote> in
8746 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8747 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8748 are all the same; however, those other than <quote>string list</quote> are subject to
8749 particular kinds of interpretation, as described in chapter
8750 <xref linkend="CHAPdomhosaddlists"/>.
8751 </para>
8752 <para>
8753 In all these cases, the entire list is treated as a single string as far as the
8754 input syntax is concerned. The <option>trusted_users</option> setting in section
8755 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8756 in a list, it must be entered as two colons. Leading and trailing white space
8757 on each item in a list is ignored. This makes it possible to include items that
8758 start with a colon, and in particular, certain forms of IPv6 address. For
8759 example, the list
8760 </para>
8761 <literallayout class="monospaced">
8762 local_interfaces = 127.0.0.1 : ::::1
8763 </literallayout>
8764 <para>
8765 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8766 </para>
8767 <para>
8768 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8769 list items, it is not ignored when parsing the list. The spaces around the first
8770 colon in the example above are necessary. If they were not there, the list would
8771 be interpreted as the two items 127.0.0.1:: and 1.
8772 </para>
8773 </section>
8774 <section id="SECTlistsepchange">
8775 <title>Changing list separators</title>
8776 <para>
8777 <indexterm role="concept">
8778 <primary>list separator</primary>
8779 <secondary>changing</secondary>
8780 </indexterm>
8781 <indexterm role="concept">
8782 <primary>IPv6</primary>
8783 <secondary>addresses in lists</secondary>
8784 </indexterm>
8785 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8786 introduced to allow the separator character to be changed. If a list begins
8787 with a left angle bracket, followed by any punctuation character, that
8788 character is used instead of colon as the list separator. For example, the list
8789 above can be rewritten to use a semicolon separator like this:
8790 </para>
8791 <literallayout class="monospaced">
8792 local_interfaces = &lt;; 127.0.0.1 ; ::1
8793 </literallayout>
8794 <para>
8795 This facility applies to all lists, with the exception of the list in
8796 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8797 confined to circumstances where they really are needed.
8798 </para>
8799 <para>
8800 <indexterm role="concept">
8801 <primary>list separator</primary>
8802 <secondary>newline as</secondary>
8803 </indexterm>
8804 <indexterm role="concept">
8805 <primary>newline</primary>
8806 <secondary>as list separator</secondary>
8807 </indexterm>
8808 It is also possible to use newline and other control characters (those with
8809 code values less than 32, plus DEL) as separators in lists. Such separators
8810 must be provided literally at the time the list is processed. For options that
8811 are string-expanded, you can write the separator using a normal escape
8812 sequence. This will be processed by the expander before the string is
8813 interpreted as a list. For example, if a newline-separated list of domains is
8814 generated by a lookup, you can process it directly by a line such as this:
8815 </para>
8816 <literallayout class="monospaced">
8817 domains = &lt;\n ${lookup mysql{.....}}
8818 </literallayout>
8819 <para>
8820 This avoids having to change the list separator in such data. You are unlikely
8821 to want to use a control character as a separator in an option that is not
8822 expanded, because the value is literal text. However, it can be done by giving
8823 the value in quotes. For example:
8824 </para>
8825 <literallayout class="monospaced">
8826 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8827 </literallayout>
8828 <para>
8829 Unlike printing character separators, which can be included in list items by
8830 doubling, it is not possible to include a control character as data when it is
8831 set as the separator. Two such characters in succession are interpreted as
8832 enclosing an empty list item.
8833 </para>
8834 </section>
8835 <section id="SECTempitelis">
8836 <title>Empty items in lists</title>
8837 <para>
8838 <indexterm role="concept">
8839 <primary>list</primary>
8840 <secondary>empty item in</secondary>
8841 </indexterm>
8842 An empty item at the end of a list is always ignored. In other words, trailing
8843 separator characters are ignored. Thus, the list in
8844 </para>
8845 <literallayout class="monospaced">
8846 senders = user@domain :
8847 </literallayout>
8848 <para>
8849 contains only a single item. If you want to include an empty string as one item
8850 in a list, it must not be the last item. For example, this list contains three
8851 items, the second of which is empty:
8852 </para>
8853 <literallayout class="monospaced">
8854 senders = user1@domain : : user2@domain
8855 </literallayout>
8856 <para>
8857 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8858 are interpreted as representing a single colon data character (and the list
8859 would then contain just one item). If you want to specify a list that contains
8860 just one, empty item, you can do it as in this example:
8861 </para>
8862 <literallayout class="monospaced">
8863 senders = :
8864 </literallayout>
8865 <para>
8866 In this case, the first item is empty, and the second is discarded because it
8867 is at the end of the list.
8868 </para>
8869 </section>
8870 <section id="SECTfordricon">
8871 <title>Format of driver configurations</title>
8872 <para>
8873 <indexterm role="concept">
8874 <primary>drivers</primary>
8875 <secondary>configuration format</secondary>
8876 </indexterm>
8877 There are separate parts in the configuration for defining routers, transports,
8878 and authenticators. In each part, you are defining a number of driver
8879 instances, each with its own set of options. Each driver instance is defined by
8880 a sequence of lines like this:
8881 </para>
8882 <literallayout>
8883 &lt;<emphasis>instance name</emphasis>&gt;:
8884   &lt;<emphasis>option</emphasis>&gt;
8885   ...
8886   &lt;<emphasis>option</emphasis>&gt;
8887 </literallayout>
8888 <para>
8889 In the following example, the instance name is <command>localuser</command>, and it is
8890 followed by three options settings:
8891 </para>
8892 <literallayout class="monospaced">
8893 localuser:
8894   driver = accept
8895   check_local_user
8896   transport = local_delivery
8897 </literallayout>
8898 <para>
8899 For each driver instance, you specify which Exim code module it uses &ndash; by the
8900 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8901 settings. For example, in the case of transports, if you want a transport to
8902 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8903 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8904 described in detail in its own separate chapter later in this manual.
8905 </para>
8906 <para>
8907 You can have several routers, transports, or authenticators that are based on
8908 the same underlying driver (each must have a different instance name).
8909 </para>
8910 <para>
8911 The order in which routers are defined is important, because addresses are
8912 passed to individual routers one by one, in order. The order in which
8913 transports are defined does not matter at all. The order in which
8914 authenticators are defined is used only when Exim, as a client, is searching
8915 them to find one that matches an authentication mechanism offered by the
8916 server.
8917 </para>
8918 <para>
8919 <indexterm role="concept">
8920 <primary>generic options</primary>
8921 </indexterm>
8922 <indexterm role="concept">
8923 <primary>options</primary>
8924 <secondary>generic &ndash; definition of</secondary>
8925 </indexterm>
8926 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8927 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8928 same type (that is, all routers, all transports or all authenticators). The
8929 <option>driver</option> option is a generic option that must appear in every definition.
8930 <indexterm role="concept">
8931 <primary>private options</primary>
8932 </indexterm>
8933 The private options are special for each driver, and none need appear, because
8934 they all have default values.
8935 </para>
8936 <para>
8937 The options may appear in any order, except that the <option>driver</option> option must
8938 precede any private options, since these depend on the particular driver. For
8939 this reason, it is recommended that <option>driver</option> always be the first option.
8940 </para>
8941 <para>
8942 Driver instance names, which are used for reference in log entries and
8943 elsewhere, can be any sequence of letters, digits, and underscores (starting
8944 with a letter) and must be unique among drivers of the same type. A router and
8945 a transport (for example) can each have the same name, but no two router
8946 instances can have the same name. The name of a driver instance should not be
8947 confused with the name of the underlying driver module. For example, the
8948 configuration lines:
8949 </para>
8950 <literallayout class="monospaced">
8951 remote_smtp:
8952   driver = smtp
8953 </literallayout>
8954 <para>
8955 create an instance of the <command>smtp</command> transport driver whose name is
8956 <command>remote_smtp</command>. The same driver code can be used more than once, with
8957 different instance names and different option settings each time. A second
8958 instance of the <command>smtp</command> transport, with different options, might be defined
8959 thus:
8960 </para>
8961 <literallayout class="monospaced">
8962 special_smtp:
8963   driver = smtp
8964   port = 1234
8965   command_timeout = 10s
8966 </literallayout>
8967 <para>
8968 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8969 these transport instances from routers, and these names would appear in log
8970 lines.
8971 </para>
8972 <para>
8973 Comment lines may be present in the middle of driver specifications. The full
8974 list of option settings for any particular driver instance, including all the
8975 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8976 option.
8977 </para>
8978 </section>
8979 </chapter>
8980
8981 <chapter id="CHAPdefconfil">
8982 <title>The default configuration file</title>
8983 <para>
8984 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8985 <primary>configuration file</primary>
8986 <secondary>default <quote>walk through</quote></secondary>
8987 </indexterm>
8988 <indexterm role="concept">
8989 <primary>default</primary>
8990 <secondary>configuration file <quote>walk through</quote></secondary>
8991 </indexterm>
8992 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8993 is sufficient for a host with simple mail requirements. As an introduction to
8994 the way Exim is configured, this chapter <quote>walks through</quote> the default
8995 configuration, giving brief explanations of the settings. Detailed descriptions
8996 of the options are given in subsequent chapters. The default configuration file
8997 itself contains extensive comments about ways you might want to modify the
8998 initial settings. However, note that there are many options that are not
8999 mentioned at all in the default configuration.
9000 </para>
9001 <section id="SECTdefconfmacros">
9002 <title>Macros</title>
9003 <para>
9004 All macros should be defined before any options.
9005 </para>
9006 <para>
9007 One macro is specified, but commented out, in the default configuration:
9008 </para>
9009 <literallayout class="monospaced">
9010 # ROUTER_SMARTHOST=MAIL.HOSTNAME.FOR.CENTRAL.SERVER.EXAMPLE
9011 </literallayout>
9012 <para>
9013 If all off-site mail is expected to be delivered to a "smarthost", then set the
9014 hostname here and uncomment the macro.  This will affect which router is used
9015 later on.  If this is left commented out, then Exim will perform direct-to-MX
9016 deliveries using a <command>dnslookup</command> router.
9017 </para>
9018 <para>
9019 In addition to macros defined here, Exim includes a number of built-in macros
9020 to enable configuration to be guarded by a binary built with support for a
9021 given feature.  See section <xref linkend="SECTbuiltinmacros"/> for more details.
9022 </para>
9023 </section>
9024 <section id="SECTdefconfmain">
9025 <title>Main configuration settings</title>
9026 <para>
9027 The main (global) configuration option settings section must always come first
9028 in the file, after the macros.
9029 The first thing you&#x2019;ll see in the file, after some initial comments, is the line
9030 </para>
9031 <literallayout class="monospaced">
9032 # primary_hostname =
9033 </literallayout>
9034 <para>
9035 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
9036 to know the official, fully qualified name of your host, and this is where you
9037 can specify it. However, in most cases you do not need to set this option. When
9038 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
9039 </para>
9040 <para>
9041 The first three non-comment configuration lines are as follows:
9042 </para>
9043 <literallayout class="monospaced">
9044 domainlist local_domains    = @
9045 domainlist relay_to_domains =
9046 hostlist   relay_from_hosts = 127.0.0.1
9047 </literallayout>
9048 <para>
9049 These are not, in fact, option settings. They are definitions of two named
9050 domain lists and one named host list. Exim allows you to give names to lists of
9051 domains, hosts, and email addresses, in order to make it easier to manage the
9052 configuration file (see section <xref linkend="SECTnamedlists"/>).
9053 </para>
9054 <para>
9055 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
9056 later in the configuration to identify domains that are to be delivered
9057 on the local host.
9058 </para>
9059 <para>
9060 <indexterm role="concept">
9061 <primary>@ in a domain list</primary>
9062 </indexterm>
9063 There is just one item in this list, the string <quote>@</quote>. This is a special form
9064 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
9065 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
9066 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
9067 the same configuration file can be used on different hosts.
9068 </para>
9069 <para>
9070 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
9071 list itself is empty. Later in the configuration we will come to the part that
9072 controls mail relaying through the local host; it allows relaying to any
9073 domains in this list. By default, therefore, no relaying on the basis of a mail
9074 domain is permitted.
9075 </para>
9076 <para>
9077 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
9078 used later in the configuration to permit relaying from any host or IP address
9079 that matches the list. The default contains just the IP address of the IPv4
9080 loopback interface, which means that processes on the local host are able to
9081 submit mail for relaying by sending it over TCP/IP to that interface. No other
9082 hosts are permitted to submit messages for relaying.
9083 </para>
9084 <para>
9085 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
9086 we aren&#x2019;t actually setting up any controls. We are just defining some domains
9087 and hosts that will be used in the controls that are specified later.
9088 </para>
9089 <para>
9090 The next two configuration lines are genuine option settings:
9091 </para>
9092 <literallayout class="monospaced">
9093 acl_smtp_rcpt = acl_check_rcpt
9094 acl_smtp_data = acl_check_data
9095 </literallayout>
9096 <para>
9097 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
9098 during an incoming SMTP session for every recipient of a message (every RCPT
9099 command), and after the contents of the message have been received,
9100 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
9101 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
9102 section of the configuration. The RCPT ACL controls which recipients are
9103 accepted for an incoming message &ndash; if a configuration does not provide an ACL
9104 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
9105 contents of a message to be checked.
9106 </para>
9107 <para>
9108 Two commented-out option settings are next:
9109 </para>
9110 <literallayout class="monospaced">
9111 # av_scanner = clamd:/tmp/clamd
9112 # spamd_address = 127.0.0.1 783
9113 </literallayout>
9114 <para>
9115 These are example settings that can be used when Exim is compiled with the
9116 content-scanning extension. The first specifies the interface to the virus
9117 scanner, and the second specifies the interface to SpamAssassin. Further
9118 details are given in chapter <xref linkend="CHAPexiscan"/>.
9119 </para>
9120 <para>
9121 Three more commented-out option settings follow:
9122 </para>
9123 <literallayout class="monospaced">
9124 # tls_advertise_hosts = *
9125 # tls_certificate = /etc/ssl/exim.crt
9126 # tls_privatekey = /etc/ssl/exim.pem
9127 </literallayout>
9128 <para>
9129 These are example settings that can be used when Exim is compiled with
9130 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
9131 first one specifies the list of clients that are allowed to use TLS when
9132 connecting to this server; in this case, the wildcard means all clients. The
9133 other options specify where Exim should find its TLS certificate and private
9134 key, which together prove the server&#x2019;s identity to any clients that connect.
9135 More details are given in chapter <xref linkend="CHAPTLS"/>.
9136 </para>
9137 <para>
9138 Another two commented-out option settings follow:
9139 </para>
9140 <literallayout class="monospaced">
9141 # daemon_smtp_ports = 25 : 465 : 587
9142 # tls_on_connect_ports = 465
9143 </literallayout>
9144 <para>
9145 <indexterm role="concept">
9146 <primary>port</primary>
9147 <secondary>465 and 587</secondary>
9148 </indexterm>
9149 <indexterm role="concept">
9150 <primary>port</primary>
9151 <secondary>for message submission</secondary>
9152 </indexterm>
9153 <indexterm role="concept">
9154 <primary>message</primary>
9155 <secondary>submission, ports for</secondary>
9156 </indexterm>
9157 <indexterm role="concept">
9158 <primary>submissions protocol</primary>
9159 </indexterm>
9160 <indexterm role="concept">
9161 <primary>smtps protocol</primary>
9162 </indexterm>
9163 <indexterm role="concept">
9164 <primary>ssmtp protocol</primary>
9165 </indexterm>
9166 <indexterm role="concept">
9167 <primary>SMTP</primary>
9168 <secondary>submissions protocol</secondary>
9169 </indexterm>
9170 <indexterm role="concept">
9171 <primary>SMTP</primary>
9172 <secondary>ssmtp protocol</secondary>
9173 </indexterm>
9174 <indexterm role="concept">
9175 <primary>SMTP</primary>
9176 <secondary>smtps protocol</secondary>
9177 </indexterm>
9178 These options provide better support for roaming users who wish to use this
9179 server for message submission. They are not much use unless you have turned on
9180 TLS (as described in the previous paragraph) and authentication (about which
9181 more in section <xref linkend="SECTdefconfauth"/>).
9182 Mail submission from mail clients (MUAs) should be separate from inbound mail
9183 to your domain (MX delivery) for various good reasons (eg, ability to impose
9184 much saner TLS protocol and ciphersuite requirements without unintended
9185 consequences).
9186 RFC 6409 (previously 4409) specifies use of port 587 for SMTP Submission,
9187 which uses STARTTLS, so this is the <quote>submission</quote> port.
9188 RFC 8314 specifies use of port 465 as the <quote>submissions</quote> protocol,
9189 which should be used in preference to 587.
9190 You should also consider deploying SRV records to help clients find
9191 these ports.
9192 Older names for <quote>submissions</quote> are <quote>smtps</quote> and <quote>ssmtp</quote>.
9193 </para>
9194 <para>
9195 Two more commented-out options settings follow:
9196 </para>
9197 <literallayout class="monospaced">
9198 # qualify_domain =
9199 # qualify_recipient =
9200 </literallayout>
9201 <para>
9202 The first of these specifies a domain that Exim uses when it constructs a
9203 complete email address from a local login name. This is often needed when Exim
9204 receives a message from a local process. If you do not set <option>qualify_domain</option>,
9205 the value of <option>primary_hostname</option> is used. If you set both of these options,
9206 you can have different qualification domains for sender and recipient
9207 addresses. If you set only the first one, its value is used in both cases.
9208 </para>
9209 <para>
9210 <indexterm role="concept">
9211 <primary>domain literal</primary>
9212 <secondary>recognizing format</secondary>
9213 </indexterm>
9214 The following line must be uncommented if you want Exim to recognize
9215 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
9216 (an IP address within square brackets) instead of a named domain.
9217 </para>
9218 <literallayout class="monospaced">
9219 # allow_domain_literals
9220 </literallayout>
9221 <para>
9222 The RFCs still require this form, but many people think that in the modern
9223 Internet it makes little sense to permit mail to be sent to specific hosts by
9224 quoting their IP addresses. This ancient format has been used by people who
9225 try to abuse hosts by using them for unwanted relaying. However, some
9226 people believe there are circumstances (for example, messages addressed to
9227 <emphasis>postmaster</emphasis>) where domain literals are still useful.
9228 </para>
9229 <para>
9230 The next configuration line is a kind of trigger guard:
9231 </para>
9232 <literallayout class="monospaced">
9233 never_users = root
9234 </literallayout>
9235 <para>
9236 It specifies that no delivery must ever be run as the root user. The normal
9237 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
9238 setting is a guard against slips in the configuration.
9239 The list of users specified by <option>never_users</option> is not, however, the complete
9240 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
9241 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
9242 contents of <option>never_users</option> are added to this list. By default
9243 FIXED_NEVER_USERS also specifies root.
9244 </para>
9245 <para>
9246 When a remote host connects to Exim in order to send mail, the only information
9247 Exim has about the host&#x2019;s identity is its IP address. The next configuration
9248 line,
9249 </para>
9250 <literallayout class="monospaced">
9251 host_lookup = *
9252 </literallayout>
9253 <para>
9254 specifies that Exim should do a reverse DNS lookup on all incoming connections,
9255 in order to get a host name. This improves the quality of the logging
9256 information, but if you feel it is too expensive, you can remove it entirely,
9257 or restrict the lookup to hosts on <quote>nearby</quote> networks.
9258 Note that it is not always possible to find a host name from an IP address,
9259 because not all DNS reverse zones are maintained, and sometimes DNS servers are
9260 unreachable.
9261 </para>
9262 <para>
9263 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
9264 1413 (hence their names):
9265 </para>
9266 <literallayout class="monospaced">
9267 rfc1413_hosts = *
9268 rfc1413_query_timeout = 0s
9269 </literallayout>
9270 <para>
9271 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
9272 Few hosts offer RFC1413 service these days; calls have to be
9273 terminated by a timeout and this needlessly delays the startup
9274 of an incoming SMTP connection.
9275 If you have hosts for which you trust RFC1413 and need this
9276 information, you can change this.
9277 </para>
9278 <para>
9279 This line enables an efficiency SMTP option.  It is negotiated by clients
9280 and not expected to cause problems but can be disabled if needed.
9281 </para>
9282 <literallayout class="monospaced">
9283 prdr_enable = true
9284 </literallayout>
9285 <para>
9286 When Exim receives messages over SMTP connections, it expects all addresses to
9287 be fully qualified with a domain, as required by the SMTP definition. However,
9288 if you are running a server to which simple clients submit messages, you may
9289 find that they send unqualified addresses. The two commented-out options:
9290 </para>
9291 <literallayout class="monospaced">
9292 # sender_unqualified_hosts =
9293 # recipient_unqualified_hosts =
9294 </literallayout>
9295 <para>
9296 show how you can specify hosts that are permitted to send unqualified sender
9297 and recipient addresses, respectively.
9298 </para>
9299 <para>
9300 The <option>log_selector</option> option is used to increase the detail of logging
9301 over the default:
9302 </para>
9303 <literallayout class="monospaced">
9304 log_selector = +smtp_protocol_error +smtp_syntax_error \
9305                +tls_certificate_verified
9306 </literallayout>
9307 <para>
9308 The <option>percent_hack_domains</option> option is also commented out:
9309 </para>
9310 <literallayout class="monospaced">
9311 # percent_hack_domains =
9312 </literallayout>
9313 <para>
9314 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
9315 This is an almost obsolete form of explicit email routing. If you do not know
9316 anything about it, you can safely ignore this topic.
9317 </para>
9318 <para>
9319 The next two settings in the main part of the default configuration are
9320 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
9321 message is frozen, Exim no longer continues to try to deliver it. Freezing
9322 occurs when a bounce message encounters a permanent failure because the sender
9323 address of the original message that caused the bounce is invalid, so the
9324 bounce cannot be delivered. This is probably the most common case, but there
9325 are also other conditions that cause freezing, and frozen messages are not
9326 always bounce messages.
9327 </para>
9328 <literallayout class="monospaced">
9329 ignore_bounce_errors_after = 2d
9330 timeout_frozen_after = 7d
9331 </literallayout>
9332 <para>
9333 The first of these options specifies that failing bounce messages are to be
9334 discarded after 2 days in the queue. The second specifies that any frozen
9335 message (whether a bounce message or not) is to be timed out (and discarded)
9336 after a week. In this configuration, the first setting ensures that no failing
9337 bounce message ever lasts a week.
9338 </para>
9339 <para>
9340 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
9341 large queues, you may consider using this option. It splits the spool
9342 directory into subdirectories to avoid file system degradation from
9343 many files in a single directory, resulting in better performance.
9344 Manual manipulation of queued messages becomes more complex (though fortunately
9345 not often needed).
9346 </para>
9347 <literallayout class="monospaced">
9348 # split_spool_directory = true
9349 </literallayout>
9350 <para>
9351 In an ideal world everybody follows the standards. For non-ASCII
9352 messages RFC 2047 is a standard, allowing a maximum line length of 76
9353 characters. Exim adheres that standard and won&#x2019;t process messages which
9354 violate this standard. (Even ${rfc2047:...} expansions will fail.)
9355 In particular, the Exim maintainers have had multiple reports of
9356 problems from Russian administrators of issues until they disable this
9357 check, because of some popular, yet buggy, mail composition software.
9358 </para>
9359 <literallayout class="monospaced">
9360 # check_rfc2047_length = false
9361 </literallayout>
9362 <para>
9363 If you need to be strictly RFC compliant you may wish to disable the
9364 8BITMIME advertisement. Use this, if you exchange mails with systems
9365 that are not 8-bit clean.
9366 </para>
9367 <literallayout class="monospaced">
9368 # accept_8bitmime = false
9369 </literallayout>
9370 <para>
9371 Libraries you use may depend on specific environment settings.  This
9372 imposes a security risk (e.g. PATH). There are two lists:
9373 <option>keep_environment</option> for the variables to import as they are, and
9374 <option>add_environment</option> for variables we want to set to a fixed value.
9375 Note that TZ is handled separately, by the <option>timezone</option> runtime
9376 option and by the TIMEZONE_DEFAULT buildtime option.
9377 </para>
9378 <literallayout class="monospaced">
9379 # keep_environment = ^LDAP
9380 # add_environment = PATH=/usr/bin::/bin
9381 </literallayout>
9382 </section>
9383 <section id="SECID54">
9384 <title>ACL configuration</title>
9385 <para>
9386 <indexterm role="concept">
9387 <primary>default</primary>
9388 <secondary>ACLs</secondary>
9389 </indexterm>
9390 <indexterm role="concept">
9391 <primary>access control lists (ACLs)</primary>
9392 <secondary>default configuration</secondary>
9393 </indexterm>
9394 In the default configuration, the ACL section follows the main configuration.
9395 It starts with the line
9396 </para>
9397 <literallayout class="monospaced">
9398 begin acl
9399 </literallayout>
9400 <para>
9401 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
9402 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
9403 and <option>acl_smtp_data</option> above.
9404 </para>
9405 <para>
9406 <indexterm role="concept">
9407 <primary>RCPT</primary>
9408 <secondary>ACL for</secondary>
9409 </indexterm>
9410 The first ACL is used for every RCPT command in an incoming SMTP message. Each
9411 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
9412 are considered in order, until the recipient address is either accepted or
9413 rejected. The RCPT command is then accepted or rejected, according to the
9414 result of the ACL processing.
9415 </para>
9416 <literallayout class="monospaced">
9417 acl_check_rcpt:
9418 </literallayout>
9419 <para>
9420 This line, consisting of a name terminated by a colon, marks the start of the
9421 ACL, and names it.
9422 </para>
9423 <literallayout class="monospaced">
9424 accept  hosts = :
9425 </literallayout>
9426 <para>
9427 This ACL statement accepts the recipient if the sending host matches the list.
9428 But what does that strange list mean? It doesn&#x2019;t actually contain any host
9429 names or IP addresses. The presence of the colon puts an empty item in the
9430 list; Exim matches this only if the incoming message did not come from a remote
9431 host, because in that case, the remote hostname is empty. The colon is
9432 important. Without it, the list itself is empty, and can never match anything.
9433 </para>
9434 <para>
9435 What this statement is doing is to accept unconditionally all recipients in
9436 messages that are submitted by SMTP from local processes using the standard
9437 input and output (that is, not using TCP/IP). A number of MUAs operate in this
9438 manner.
9439 </para>
9440 <literallayout class="monospaced">
9441 deny    domains       = +local_domains
9442         local_parts   = ^[.] : ^.*[@%!/|]
9443         message       = Restricted characters in address
9444
9445 deny    domains       = !+local_domains
9446         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
9447         message       = Restricted characters in address
9448 </literallayout>
9449 <para>
9450 These statements are concerned with local parts that contain any of the
9451 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
9452 Although these characters are entirely legal in local parts (in the case of
9453 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
9454 in Internet mail addresses.
9455 </para>
9456 <para>
9457 The first three have in the past been associated with explicitly routed
9458 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
9459 option). Addresses containing these characters are regularly tried by spammers
9460 in an attempt to bypass relaying restrictions, and also by open relay testing
9461 programs. Unless you really need them it is safest to reject these characters
9462 at this early stage. This configuration is heavy-handed in rejecting these
9463 characters for all messages it accepts from remote hosts. This is a deliberate
9464 policy of being as safe as possible.
9465 </para>
9466 <para>
9467 The first rule above is stricter, and is applied to messages that are addressed
9468 to one of the local domains handled by this host. This is implemented by the
9469 first condition, which restricts it to domains that are listed in the
9470 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9471 reference to a named list. In this configuration, there is just one domain in
9472 <emphasis>local_domains</emphasis>, but in general there may be many.
9473 </para>
9474 <para>
9475 The second condition on the first statement uses two regular expressions to
9476 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
9477 or <quote>|</quote>. If you have local accounts that include these characters, you will
9478 have to modify this rule.
9479 </para>
9480 <para>
9481 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
9482 allows them because they have been encountered in practice. (Consider the
9483 common convention of local parts constructed as
9484 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
9485 the author of Exim, who has no second initial.) However, a local part starting
9486 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
9487 filename (for example, for a mailing list). This is also true for local parts
9488 that contain slashes. A pipe symbol can also be troublesome if the local part
9489 is incorporated unthinkingly into a shell command line.
9490 </para>
9491 <para>
9492 The second rule above applies to all other domains, and is less strict. This
9493 allows your own users to send outgoing messages to sites that use slashes
9494 and vertical bars in their local parts. It blocks local parts that begin
9495 with a dot, slash, or vertical bar, but allows these characters within the
9496 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
9497 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
9498 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
9499 </para>
9500 <literallayout class="monospaced">
9501 accept  local_parts   = postmaster
9502         domains       = +local_domains
9503 </literallayout>
9504 <para>
9505 This statement, which has two conditions, accepts an incoming address if the
9506 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
9507 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9508 reference to a named list. In this configuration, there is just one domain in
9509 <emphasis>local_domains</emphasis>, but in general there may be many.
9510 </para>
9511 <para>
9512 The presence of this statement means that mail to postmaster is never blocked
9513 by any of the subsequent tests. This can be helpful while sorting out problems
9514 in cases where the subsequent tests are incorrectly denying access.
9515 </para>
9516 <literallayout class="monospaced">
9517 require verify        = sender
9518 </literallayout>
9519 <para>
9520 This statement requires the sender address to be verified before any subsequent
9521 ACL statement can be used. If verification fails, the incoming recipient
9522 address is refused. Verification consists of trying to route the address, to
9523 see if a bounce message could be delivered to it. In the case of remote
9524 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
9525 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
9526 discusses the details of address verification.
9527 </para>
9528 <literallayout class="monospaced">
9529 accept  hosts         = +relay_from_hosts
9530         control       = submission
9531 </literallayout>
9532 <para>
9533 This statement accepts the address if the message is coming from one of the
9534 hosts that are defined as being allowed to relay through this host. Recipient
9535 verification is omitted here, because in many cases the clients are dumb MUAs
9536 that do not cope well with SMTP error responses. For the same reason, the
9537 second line specifies <quote>submission mode</quote> for messages that are accepted. This
9538 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
9539 messages that are deficient in some way, for example, because they lack a
9540 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
9541 probably add recipient verification here, and disable submission mode.
9542 </para>
9543 <literallayout class="monospaced">
9544 accept  authenticated = *
9545         control       = submission
9546 </literallayout>
9547 <para>
9548 This statement accepts the address if the client host has authenticated itself.
9549 Submission mode is again specified, on the grounds that such messages are most
9550 likely to come from MUAs. The default configuration does not define any
9551 authenticators, though it does include some nearly complete commented-out
9552 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
9553 fact authenticate until you complete the authenticator definitions.
9554 </para>
9555 <literallayout class="monospaced">
9556 require message = relay not permitted
9557         domains = +local_domains : +relay_to_domains
9558 </literallayout>
9559 <para>
9560 This statement rejects the address if its domain is neither a local domain nor
9561 one of the domains for which this host is a relay.
9562 </para>
9563 <literallayout class="monospaced">
9564 require verify = recipient
9565 </literallayout>
9566 <para>
9567 This statement requires the recipient address to be verified; if verification
9568 fails, the address is rejected.
9569 </para>
9570 <literallayout class="monospaced">
9571 # deny    dnslists    = black.list.example
9572 #         message     = rejected because $sender_host_address \
9573 #                       is in a black list at $dnslist_domain\n\
9574 #                       $dnslist_text
9575 #
9576 # warn    dnslists    = black.list.example
9577 #         add_header  = X-Warning: $sender_host_address is in \
9578 #                       a black list at $dnslist_domain
9579 #         log_message = found in $dnslist_domain
9580 </literallayout>
9581 <para>
9582 These commented-out lines are examples of how you could configure Exim to check
9583 sending hosts against a DNS black list. The first statement rejects messages
9584 from blacklisted hosts, whereas the second just inserts a warning header
9585 line.
9586 </para>
9587 <literallayout class="monospaced">
9588 # require verify = csa
9589 </literallayout>
9590 <para>
9591 This commented-out line is an example of how you could turn on client SMTP
9592 authorization (CSA) checking. Such checks do DNS lookups for special SRV
9593 records.
9594 </para>
9595 <literallayout class="monospaced">
9596 accept
9597 </literallayout>
9598 <para>
9599 The final statement in the first ACL unconditionally accepts any recipient
9600 address that has successfully passed all the previous tests.
9601 </para>
9602 <literallayout class="monospaced">
9603 acl_check_data:
9604 </literallayout>
9605 <para>
9606 This line marks the start of the second ACL, and names it. Most of the contents
9607 of this ACL are commented out:
9608 </para>
9609 <literallayout class="monospaced">
9610 # deny    malware   = *
9611 #         message   = This message contains a virus \
9612 #                     ($malware_name).
9613 </literallayout>
9614 <para>
9615 These lines are examples of how to arrange for messages to be scanned for
9616 viruses when Exim has been compiled with the content-scanning extension, and a
9617 suitable virus scanner is installed. If the message is found to contain a
9618 virus, it is rejected with the given custom error message.
9619 </para>
9620 <literallayout class="monospaced">
9621 # warn    spam      = nobody
9622 #         message   = X-Spam_score: $spam_score\n\
9623 #                     X-Spam_score_int: $spam_score_int\n\
9624 #                     X-Spam_bar: $spam_bar\n\
9625 #                     X-Spam_report: $spam_report
9626 </literallayout>
9627 <para>
9628 These lines are an example of how to arrange for messages to be scanned by
9629 SpamAssassin when Exim has been compiled with the content-scanning extension,
9630 and SpamAssassin has been installed. The SpamAssassin check is run with
9631 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9632 series of extra header line. In this case, the message is not rejected,
9633 whatever the spam score.
9634 </para>
9635 <literallayout class="monospaced">
9636 accept
9637 </literallayout>
9638 <para>
9639 This final line in the DATA ACL accepts the message unconditionally.
9640 </para>
9641 </section>
9642 <section id="SECID55">
9643 <title>Router configuration</title>
9644 <para>
9645 <indexterm role="concept">
9646 <primary>default</primary>
9647 <secondary>routers</secondary>
9648 </indexterm>
9649 <indexterm role="concept">
9650 <primary>routers</primary>
9651 <secondary>default</secondary>
9652 </indexterm>
9653 The router configuration comes next in the default configuration, introduced
9654 by the line
9655 </para>
9656 <literallayout class="monospaced">
9657 begin routers
9658 </literallayout>
9659 <para>
9660 Routers are the modules in Exim that make decisions about where to send
9661 messages. An address is passed to each router, in turn, until it is either
9662 accepted, or failed. This means that the order in which you define the routers
9663 matters. Each router is fully described in its own chapter later in this
9664 manual. Here we give only brief overviews.
9665 </para>
9666 <literallayout class="monospaced">
9667 # domain_literal:
9668 #   driver = ipliteral
9669 #   domains = !+local_domains
9670 #   transport = remote_smtp
9671 </literallayout>
9672 <para>
9673 <indexterm role="concept">
9674 <primary>domain literal</primary>
9675 <secondary>default router</secondary>
9676 </indexterm>
9677 This router is commented out because the majority of sites do not want to
9678 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9679 you uncomment this router, you also need to uncomment the setting of
9680 <option>allow_domain_literals</option> in the main part of the configuration.
9681 </para>
9682 <para>
9683 Which router is used next depends upon whether or not the ROUTER_SMARTHOST
9684 macro has been defined, per
9685 </para>
9686 <literallayout class="monospaced">
9687 .ifdef ROUTER_SMARTHOST
9688 smarthost:
9689 #...
9690 .else
9691 dnslookup:
9692 #...
9693 .endif
9694 </literallayout>
9695 <para>
9696 If ROUTER_SMARTHOST has been defined, either at the top of the file or on the
9697 command-line, then we route all non-local mail to that smarthost; otherwise, we&#x2019;ll
9698 perform DNS lookups for direct-to-MX lookup.  Any mail which is to a local domain will
9699 skip these routers because of the <option>domains</option> option.
9700 </para>
9701 <literallayout class="monospaced">
9702 smarthost:
9703   driver = manualroute
9704   domains = ! +local_domains
9705   transport = smarthost_smtp
9706   route_data = ROUTER_SMARTHOST
9707   ignore_target_hosts = &lt;; 0.0.0.0 ; 127.0.0.0/8 ; ::1
9708   no_more
9709 </literallayout>
9710 <para>
9711 This router only handles mail which is not to any local domains; this is
9712 specified by the line
9713 </para>
9714 <literallayout class="monospaced">
9715 domains = ! +local_domains
9716 </literallayout>
9717 <para>
9718 The <option>domains</option> option lists the domains to which this router applies, but the
9719 exclamation mark is a negation sign, so the router is used only for domains
9720 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9721 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9722 indicates that it is referring to a named list. Addresses in other domains are
9723 passed on to the following routers.
9724 </para>
9725 <para>
9726 The name of the router driver is <command>manualroute</command> because we are manually
9727 specifying how mail should be routed onwards, instead of using DNS MX.
9728 While the name of this router instance is arbitrary, the <option>driver</option> option must
9729 be one of the driver modules that is in the Exim binary.
9730 </para>
9731 <para>
9732 With no pre-conditions other than <option>domains</option>, all mail for non-local domains
9733 will be handled by this router, and the <option>no_more</option> setting will ensure that no
9734 other routers will be used for messages matching the pre-conditions.  See
9735 <xref linkend="SECTrouprecon"/> for more on how the pre-conditions apply.  For messages which
9736 are handled by this router, we provide a hostname to deliver to in <option>route_data</option>
9737 and the macro supplies the value; the address is then queued for the
9738 <command>smarthost_smtp</command> transport.
9739 </para>
9740 <literallayout class="monospaced">
9741 dnslookup:
9742   driver = dnslookup
9743   domains = ! +local_domains
9744   transport = remote_smtp
9745   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9746   no_more
9747 </literallayout>
9748 <para>
9749 The <option>domains</option> option behaves as per smarthost, above.
9750 </para>
9751 <para>
9752 The name of the router driver is <command>dnslookup</command>,
9753 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9754 the name of this router instance is the same as the name of the driver. The
9755 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9756 one of the driver modules that is in the Exim binary.
9757 </para>
9758 <para>
9759 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9760 DNS in order to obtain a list of hosts to which the address is routed. If the
9761 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9762 specified by the <option>transport</option> option. If the router does not find the domain
9763 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9764 the address fails and is bounced.
9765 </para>
9766 <para>
9767 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9768 be entirely ignored. This option is present because a number of cases have been
9769 encountered where MX records in the DNS point to host names
9770 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9771 Completely ignoring these IP addresses causes Exim to fail to route the
9772 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9773 continue to try to deliver the message periodically until the address timed
9774 out.
9775 </para>
9776 <literallayout class="monospaced">
9777 system_aliases:
9778   driver = redirect
9779   allow_fail
9780   allow_defer
9781   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9782 # user = exim
9783   file_transport = address_file
9784   pipe_transport = address_pipe
9785 </literallayout>
9786 <para>
9787 Control reaches this and subsequent routers only for addresses in the local
9788 domains. This router checks to see whether the local part is defined as an
9789 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9790 data that it looks up from that file. If no data is found for the local part,
9791 the value of the <option>data</option> option is empty, causing the address to be passed to
9792 the next router.
9793 </para>
9794 <para>
9795 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9796 often used. That is why it is referenced by from the default configuration
9797 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9798 <filename>Local/Makefile</filename> before building Exim.
9799 </para>
9800 <literallayout class="monospaced">
9801 userforward:
9802   driver = redirect
9803   check_local_user
9804 # local_part_suffix = +* : -*
9805 # local_part_suffix_optional
9806   file = $home/.forward
9807 # allow_filter
9808   no_verify
9809   no_expn
9810   check_ancestor
9811   file_transport = address_file
9812   pipe_transport = address_pipe
9813   reply_transport = address_reply
9814 </literallayout>
9815 <para>
9816 This is the most complicated router in the default configuration. It is another
9817 redirection router, but this time it is looking for forwarding data set up by
9818 individual users. The <option>check_local_user</option> setting specifies a check that the
9819 local part of the address is the login name of a local user. If it is not, the
9820 router is skipped. The two commented options that follow <option>check_local_user</option>,
9821 namely:
9822 </para>
9823 <literallayout class="monospaced">
9824 # local_part_suffix = +* : -*
9825 # local_part_suffix_optional
9826 </literallayout>
9827 <para>
9828 <indexterm role="variable">
9829 <primary><varname>$local_part_suffix</varname></primary>
9830 </indexterm>
9831 show how you can specify the recognition of local part suffixes. If the first
9832 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9833 by any sequence of characters, is removed from the local part and placed in the
9834 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9835 presence of a suffix in the local part is optional. When a suffix is present,
9836 the check for a local login uses the local part with the suffix removed.
9837 </para>
9838 <para>
9839 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9840 home directory is consulted. If it does not exist, or is empty, the router
9841 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9842 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9843 </para>
9844 <para>
9845 <indexterm role="concept">
9846 <primary>Sieve filter</primary>
9847 <secondary>enabling in default router</secondary>
9848 </indexterm>
9849 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9850 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9851 is commented out by default), the contents of the file are interpreted as a set
9852 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9853 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9854 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9855 </para>
9856 <para>
9857 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9858 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9859 There are two reasons for doing this:
9860 </para>
9861 <orderedlist numeration="arabic">
9862 <listitem>
9863 <para>
9864 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9865 checking an address for validity; it makes sense not to waste resources doing
9866 unnecessary work.
9867 </para>
9868 </listitem>
9869 <listitem>
9870 <para>
9871 More importantly, when Exim is verifying addresses or handling an EXPN
9872 command during an SMTP session, it is running as the Exim user, not as root.
9873 The group is the Exim group, and no additional groups are set up.
9874 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9875 this time.
9876 </para>
9877 </listitem>
9878 </orderedlist>
9879 <para>
9880 The setting of <option>check_ancestor</option> prevents the router from generating a new
9881 address that is the same as any previous address that was redirected. (This
9882 works round a problem concerning a bad interaction between aliasing and
9883 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9884 </para>
9885 <para>
9886 The final three option settings specify the transports that are to be used when
9887 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9888 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9889 </para>
9890 <literallayout class="monospaced">
9891 a.nother@elsewhere.example, /home/spqr/archive
9892 </literallayout>
9893 <para>
9894 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9895 transport.
9896 </para>
9897 <literallayout class="monospaced">
9898 localuser:
9899   driver = accept
9900   check_local_user
9901 # local_part_suffix = +* : -*
9902 # local_part_suffix_optional
9903   transport = local_delivery
9904 </literallayout>
9905 <para>
9906 The final router sets up delivery into local mailboxes, provided that the local
9907 part is the name of a local login, by accepting the address and assigning it to
9908 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9909 routers, so the address is bounced. The commented suffix settings fulfil the
9910 same purpose as they do for the <command>userforward</command> router.
9911 </para>
9912 </section>
9913 <section id="SECID56">
9914 <title>Transport configuration</title>
9915 <para>
9916 <indexterm role="concept">
9917 <primary>default</primary>
9918 <secondary>transports</secondary>
9919 </indexterm>
9920 <indexterm role="concept">
9921 <primary>transports</primary>
9922 <secondary>default</secondary>
9923 </indexterm>
9924 Transports define mechanisms for actually delivering messages. They operate
9925 only when referenced from routers, so the order in which they are defined does
9926 not matter. The transports section of the configuration starts with
9927 </para>
9928 <literallayout class="monospaced">
9929 begin transports
9930 </literallayout>
9931 <para>
9932 Two remote transports and four local transports are defined.
9933 </para>
9934 <literallayout class="monospaced">
9935 remote_smtp:
9936   driver = smtp
9937   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9938 .ifdef _HAVE_PRDR
9939   hosts_try_prdr = *
9940 .endif
9941 </literallayout>
9942 <para>
9943 This transport is used for delivering messages over SMTP connections.
9944 The list of remote hosts comes from the router.
9945 The <option>message_size_limit</option> usage is a hack to avoid sending on messages
9946 with over-long lines.
9947 </para>
9948 <para>
9949 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.  It is
9950 negotiated between client and server and not expected to cause problems
9951 but can be disabled if needed.  The built-in macro _HAVE_PRDR guards the
9952 use of the <option>hosts_try_prdr</option> configuration option.
9953 </para>
9954 <para>
9955 The other remote transport is used when delivering to a specific smarthost
9956 with whom there must be some kind of existing relationship, instead of the
9957 usual federated system.
9958 </para>
9959 <literallayout class="monospaced">
9960 smarthost_smtp:
9961   driver = smtp
9962   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9963   multi_domain
9964   #
9965 .ifdef _HAVE_TLS
9966   # Comment out any of these which you have to, then file a Support
9967   # request with your smarthost provider to get things fixed:
9968   hosts_require_tls = *
9969   tls_verify_hosts = *
9970   # As long as tls_verify_hosts is enabled, this this will have no effect,
9971   # but if you have to comment it out then this will at least log whether
9972   # you succeed or not:
9973   tls_try_verify_hosts = *
9974   #
9975   # The SNI name should match the name which we'll expect to verify;
9976   # many mail systems don't use SNI and this doesn't matter, but if it does,
9977   # we need to send a name which the remote site will recognize.
9978   # This _should_ be the name which the smarthost operators specified as
9979   # the hostname for sending your mail to.
9980   tls_sni = ROUTER_SMARTHOST
9981   #
9982 .ifdef _HAVE_OPENSSL
9983   tls_require_ciphers = HIGH:!aNULL:@STRENGTH
9984 .endif
9985 .ifdef _HAVE_GNUTLS
9986   tls_require_ciphers = SECURE192:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1
9987 .endif
9988 .endif
9989 .ifdef _HAVE_PRDR
9990   hosts_try_prdr = *
9991 .endif
9992 </literallayout>
9993 <para>
9994 After the same <option>message_size_limit</option> hack, we then specify that this Transport
9995 can handle messages to multiple domains in one run.  The assumption here is
9996 that you&#x2019;re routing all non-local mail to the same place and that place is
9997 happy to take all messages from you as quickly as possible.
9998 All other options depend upon built-in macros; if Exim was built without TLS support
9999 then no other options are defined.
10000 If TLS is available, then we configure "stronger than default" TLS ciphersuites
10001 and versions using the <option>tls_require_ciphers</option> option, where the value to be
10002 used depends upon the library providing TLS.
10003 Beyond that, the options adopt the stance that you should have TLS support available
10004 from your smarthost on today&#x2019;s Internet, so we turn on requiring TLS for the
10005 mail to be delivered, and requiring that the certificate be valid, and match
10006 the expected hostname.  The <option>tls_sni</option> option can be used by service providers
10007 to select an appropriate certificate to present to you and here we re-use the
10008 ROUTER_SMARTHOST macro, because that is unaffected by CNAMEs present in DNS.
10009 You want to specify the hostname which you&#x2019;ll expect to validate for, and that
10010 should not be subject to insecure tampering via DNS results.
10011 </para>
10012 <para>
10013 For the <option>hosts_try_prdr</option> option see the previous transport.
10014 </para>
10015 <para>
10016 All other options are defaulted.
10017 </para>
10018 <literallayout class="monospaced">
10019 local_delivery:
10020   driver = appendfile
10021   file = /var/mail/$local_part_data
10022   delivery_date_add
10023   envelope_to_add
10024   return_path_add
10025 # group = mail
10026 # mode = 0660
10027 </literallayout>
10028 <para>
10029 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
10030 traditional BSD mailbox format.
10031 </para>
10032 <para>
10033 We prefer to avoid using <varname>$local_part</varname> directly to define the mailbox filename,
10034 as it is provided by a potential bad actor.
10035 Instead we use <varname>$local_part_data</varname>,
10036 the result of looking up <varname>$local_part</varname> in the user database
10037 (done by using <option>check_local_user</option> in the the router).
10038 </para>
10039 <para>
10040 By default <command>appendfile</command> runs under the uid and gid of the
10041 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
10042 directory. Some systems use the alternative approach of running mail deliveries
10043 under a particular group instead of using the sticky bit. The commented options
10044 show how this can be done.
10045 </para>
10046 <para>
10047 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
10048 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
10049 similarly-named options above.
10050 </para>
10051 <literallayout class="monospaced">
10052 address_pipe:
10053   driver = pipe
10054   return_output
10055 </literallayout>
10056 <para>
10057 This transport is used for handling deliveries to pipes that are generated by
10058 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
10059 option specifies that any output on stdout or stderr generated by the pipe is to
10060 be returned to the sender.
10061 </para>
10062 <literallayout class="monospaced">
10063 address_file:
10064   driver = appendfile
10065   delivery_date_add
10066   envelope_to_add
10067   return_path_add
10068 </literallayout>
10069 <para>
10070 This transport is used for handling deliveries to files that are generated by
10071 redirection. The name of the file is not specified in this instance of
10072 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
10073 </para>
10074 <literallayout class="monospaced">
10075 address_reply:
10076   driver = autoreply
10077 </literallayout>
10078 <para>
10079 This transport is used for handling automatic replies generated by users&#x2019;
10080 filter files.
10081 </para>
10082 </section>
10083 <section id="SECID57">
10084 <title>Default retry rule</title>
10085 <para>
10086 <indexterm role="concept">
10087 <primary>retry</primary>
10088 <secondary>default rule</secondary>
10089 </indexterm>
10090 <indexterm role="concept">
10091 <primary>default</primary>
10092 <secondary>retry rule</secondary>
10093 </indexterm>
10094 The retry section of the configuration file contains rules which affect the way
10095 Exim retries deliveries that cannot be completed at the first attempt. It is
10096 introduced by the line
10097 </para>
10098 <literallayout class="monospaced">
10099 begin retry
10100 </literallayout>
10101 <para>
10102 In the default configuration, there is just one rule, which applies to all
10103 errors:
10104 </para>
10105 <literallayout class="monospaced">
10106 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
10107 </literallayout>
10108 <para>
10109 This causes any temporarily failing address to be retried every 15 minutes for
10110 2 hours, then at intervals starting at one hour and increasing by a factor of
10111 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
10112 is not delivered after 4 days of temporary failure, it is bounced. The time is
10113 measured from first failure, not from the time the message was received.
10114 </para>
10115 <para>
10116 If the retry section is removed from the configuration, or is empty (that is,
10117 if no retry rules are defined), Exim will not retry deliveries. This turns
10118 temporary errors into permanent errors.
10119 </para>
10120 </section>
10121 <section id="SECID58">
10122 <title>Rewriting configuration</title>
10123 <para>
10124 The rewriting section of the configuration, introduced by
10125 </para>
10126 <literallayout class="monospaced">
10127 begin rewrite
10128 </literallayout>
10129 <para>
10130 contains rules for rewriting addresses in messages as they arrive. There are no
10131 rewriting rules in the default configuration file.
10132 </para>
10133 </section>
10134 <section id="SECTdefconfauth">
10135 <title>Authenticators configuration</title>
10136 <para>
10137 <indexterm role="concept">
10138 <primary>AUTH</primary>
10139 <secondary>configuration</secondary>
10140 </indexterm>
10141 The authenticators section of the configuration, introduced by
10142 </para>
10143 <literallayout class="monospaced">
10144 begin authenticators
10145 </literallayout>
10146 <para>
10147 defines mechanisms for the use of the SMTP AUTH command. The default
10148 configuration file contains two commented-out example authenticators
10149 which support plaintext username/password authentication using the
10150 standard PLAIN mechanism and the traditional but non-standard LOGIN
10151 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
10152 to support most MUA software.
10153 </para>
10154 <para>
10155 The example PLAIN authenticator looks like this:
10156 </para>
10157 <literallayout class="monospaced">
10158 #PLAIN:
10159 #  driver                  = plaintext
10160 #  server_set_id           = $auth2
10161 #  server_prompts          = :
10162 #  server_condition        = Authentication is not yet configured
10163 #  server_advertise_condition = ${if def:tls_in_cipher }
10164 </literallayout>
10165 <para>
10166 And the example LOGIN authenticator looks like this:
10167 </para>
10168 <literallayout class="monospaced">
10169 #LOGIN:
10170 #  driver                  = plaintext
10171 #  server_set_id           = $auth1
10172 #  server_prompts          = &lt;| Username: | Password:
10173 #  server_condition        = Authentication is not yet configured
10174 #  server_advertise_condition = ${if def:tls_in_cipher }
10175 </literallayout>
10176 <para>
10177 The <option>server_set_id</option> option makes Exim remember the authenticated username
10178 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
10179 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
10180 that it implements the details of the specific authentication mechanism,
10181 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
10182 when Exim offers authentication to clients; in the examples, this is only
10183 when TLS or SSL has been started, so to enable the authenticators you also
10184 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
10185 </para>
10186 <para>
10187 The <option>server_condition</option> setting defines how to verify that the username and
10188 password are correct. In the examples it just produces an error message.
10189 To make the authenticators work, you can use a string expansion
10190 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
10191 </para>
10192 <para>
10193 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
10194 usercode and password are in different positions.
10195 Chapter <xref linkend="CHAPplaintext"/> covers both.
10196 </para>
10197 <para>
10198 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
10199 </para>
10200 </section>
10201 </chapter>
10202
10203 <chapter id="CHAPregexp">
10204 <title>Regular expressions</title>
10205 <para>
10206 <indexterm role="concept">
10207 <primary>regular expressions</primary>
10208 <secondary>library</secondary>
10209 </indexterm>
10210 <indexterm role="concept">
10211 <primary>PCRE2</primary>
10212 </indexterm>
10213 Exim supports the use of regular expressions in many of its options. It
10214 uses the PCRE2 regular expression library; this provides regular expression
10215 matching that is compatible with Perl 5. The syntax and semantics of
10216 regular expressions is discussed in
10217 online Perl manpages, in
10218 many Perl reference books, and also in
10219 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
10220 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
10221 </para>
10222 <para>
10223 The documentation for the syntax and semantics of the regular expressions that
10224 are supported by PCRE2 is included in the PCRE2 distribution, and no further
10225 description is included here. The PCRE2 functions are called from Exim using
10226 the default option settings (that is, with no PCRE2 options set), except that
10227 the PCRE2_CASELESS option is set when the matching is required to be
10228 case-insensitive.
10229 </para>
10230 <para>
10231 In most cases, when a regular expression is required in an Exim configuration,
10232 it has to start with a circumflex, in order to distinguish it from plain text
10233 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
10234 second item in the colon-separated list is a regular expression.
10235 </para>
10236 <literallayout class="monospaced">
10237 domains = a.b.c : ^\\d{3} : *.y.z : ...
10238 </literallayout>
10239 <para>
10240 The doubling of the backslash is required because of string expansion that
10241 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
10242 of this issue, and a way of avoiding the need for doubling backslashes. The
10243 regular expression that is eventually used in this example contains just one
10244 backslash. The circumflex is included in the regular expression, and has the
10245 normal effect of <quote>anchoring</quote> it to the start of the string that is being
10246 matched.
10247 </para>
10248 <para>
10249 There are, however, two cases where a circumflex is not required for the
10250 recognition of a regular expression: these are the <option>match</option> condition in a
10251 string expansion, and the <option>matches</option> condition in an Exim filter file. In
10252 these cases, the relevant string is always treated as a regular expression; if
10253 it does not start with a circumflex, the expression is not anchored, and can
10254 match anywhere in the subject string.
10255 </para>
10256 <para>
10257 In all cases, if you want a regular expression to match at the end of a string,
10258 you must code the $ metacharacter to indicate this. For example:
10259 </para>
10260 <literallayout class="monospaced">
10261 domains = ^\\d{3}\\.example
10262 </literallayout>
10263 <para>
10264 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
10265 You need to use:
10266 </para>
10267 <literallayout class="monospaced">
10268 domains = ^\\d{3}\\.example\$
10269 </literallayout>
10270 <para>
10271 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
10272 $ is needed because string expansion also interprets dollar characters.
10273 </para>
10274 </chapter>
10275
10276 <chapter id="CHAPfdlookup">
10277 <title>File and database lookups</title>
10278 <para>
10279 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
10280 <primary>file</primary>
10281 <secondary>lookups</secondary>
10282 </indexterm>
10283 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
10284 <primary>database</primary>
10285 <secondary>lookups</secondary>
10286 </indexterm>
10287 <indexterm role="concept">
10288 <primary>lookup</primary>
10289 <secondary>description of</secondary>
10290 </indexterm>
10291 Exim can be configured to look up data in files or databases as it processes
10292 messages. Two different kinds of syntax are used:
10293 </para>
10294 <orderedlist numeration="arabic">
10295 <listitem>
10296 <para>
10297 A string that is to be expanded may contain explicit lookup requests. These
10298 cause parts of the string to be replaced by data that is obtained from the
10299 lookup. Lookups of this type are conditional expansion items. Different results
10300 can be defined for the cases of lookup success and failure. See chapter
10301 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
10302 The key for the lookup is <emphasis role="bold">specified</emphasis> as part of the string to be expanded.
10303 </para>
10304 </listitem>
10305 <listitem>
10306 <para>
10307 Lists of domains, hosts, and email addresses can contain lookup requests as a
10308 way of avoiding excessively long linear lists. In this case, the data that is
10309 returned by the lookup is often (but not always) discarded; whether the lookup
10310 succeeds or fails is what really counts. These kinds of list are described in
10311 chapter <xref linkend="CHAPdomhosaddlists"/>.
10312 Depending on the lookup type (see below)
10313 the key for the lookup may need to be <emphasis role="bold">specified</emphasis> as above
10314 or may be <emphasis role="bold">implicit</emphasis>,
10315 given by the context in which the list is being checked.
10316 </para>
10317 </listitem>
10318 </orderedlist>
10319 <para>
10320 String expansions, lists, and lookups interact with each other in such a way
10321 that there is no order in which to describe any one of them that does not
10322 involve references to the others. Each of these three chapters makes more sense
10323 if you have read the other two first. If you are reading this for the first
10324 time, be aware that some of it will make a lot more sense after you have read
10325 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
10326 </para>
10327 <section id="SECID60">
10328 <title>Examples of different lookup syntax</title>
10329 <para>
10330 It is easy to confuse the two different kinds of lookup, especially as the
10331 lists that may contain the second kind are always expanded before being
10332 processed as lists. Therefore, they may also contain lookups of the first kind.
10333 Be careful to distinguish between the following two examples:
10334 </para>
10335 <literallayout class="monospaced">
10336 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
10337 domains = lsearch;/some/file
10338 </literallayout>
10339 <itemizedlist>
10340 <listitem>
10341 <para>
10342 The first uses a string expansion, the result of which must be a domain list.
10343 The key for an expansion-style lookup must be given explicitly.
10344 No strings have been specified for a successful or a failing lookup; the
10345 defaults in this case are the looked-up data and an empty string, respectively.
10346 The expansion takes place before the string is processed as a list, and the
10347 file that is searched could contain lines like this:
10348 </para>
10349 <literallayout class="monospaced">
10350 192.168.3.4: domain1:domain2:...
10351 192.168.1.9: domain3:domain4:...
10352 </literallayout>
10353 <para>
10354 When the lookup succeeds, the result of the expansion is a list of domains (and
10355 possibly other types of item that are allowed in domain lists).
10356 <indexterm role="concept">
10357 <primary>tainted data</primary>
10358 <secondary>de-tainting</secondary>
10359 </indexterm>
10360 <indexterm role="concept">
10361 <primary>de-tainting</primary>
10362 <secondary>using a lookup expansion</secondary>
10363 </indexterm>
10364 The result of the expansion is not tainted.
10365 </para>
10366 </listitem>
10367 <listitem>
10368 <para>
10369 In the second example, the lookup is a single item in a domain list. It causes
10370 Exim to use a lookup to see if the domain that is being processed can be found
10371 in the file.
10372 The file could contains lines like this:
10373 </para>
10374 <literallayout class="monospaced">
10375 domain1:
10376 domain2:
10377 </literallayout>
10378 <para>
10379 Any data that follows the keys is not relevant when checking that the domain
10380 matches the list item.
10381 </para>
10382 <para>
10383 The key for a list-style lookup is implicit, from the lookup context, if
10384 the lookup is a single-key type (see below).
10385 For query-style lookup types the query must be given explicitly.
10386 </para>
10387 </listitem>
10388 </itemizedlist>
10389 <para>
10390 It is possible, though no doubt confusing, to use both kinds of lookup at once.
10391 Consider a file containing lines like this:
10392 </para>
10393 <literallayout class="monospaced">
10394 192.168.5.6: lsearch;/another/file
10395 </literallayout>
10396 <para>
10397 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
10398 first <option>domains</option> setting above generates the second setting, which therefore
10399 causes a second lookup to occur.
10400 </para>
10401 <para>
10402 The lookup type may optionally be followed by a comma
10403 and a comma-separated list of options.
10404 Each option is a <quote>name=value</quote> pair.
10405 Whether an option is meaningful depends on the lookup type.
10406 </para>
10407 <para>
10408 All lookups support the option <quote>cache=no_rd</quote>.
10409 If this is given then the cache that Exim manages for lookup results
10410 is not checked before doing the lookup.
10411 The result of the lookup is still written to the cache.
10412 </para>
10413 <para>
10414 The rest of this chapter describes the different lookup types that are
10415 available. Any of them can be used in any part of the configuration where a
10416 lookup is permitted.
10417 </para>
10418 </section>
10419 <section id="SECID61">
10420 <title>Lookup types</title>
10421 <para>
10422 <indexterm role="concept">
10423 <primary>lookup</primary>
10424 <secondary>types of</secondary>
10425 </indexterm>
10426 <indexterm role="concept">
10427 <primary>single-key lookup</primary>
10428 <secondary>definition of</secondary>
10429 </indexterm>
10430 Two different types of data lookup are implemented:
10431 </para>
10432 <itemizedlist>
10433 <listitem>
10434 <para>
10435 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
10436 and a single key to search for. The key must be a non-empty string for the
10437 lookup to succeed. The lookup type determines how the file is searched.
10438 <indexterm role="concept">
10439 <primary>tainted data</primary>
10440 <secondary>single-key lookups</secondary>
10441 </indexterm>
10442 The file string may not be tainted.
10443 </para>
10444 <para>
10445 <indexterm role="concept">
10446 <primary>tainted data</primary>
10447 <secondary>de-tainting</secondary>
10448 </indexterm>
10449 <indexterm role="concept">
10450 <primary>de-tainting</primary>
10451 <secondary>using a single-key lookup</secondary>
10452 </indexterm>
10453 All single-key lookups support the option <quote>ret=key</quote>.
10454 If this is given and the lookup
10455 (either underlying implementation or cached value)
10456 returns data, the result is replaced with a non-tainted
10457 version of the lookup key.
10458 </para>
10459 </listitem>
10460 <listitem>
10461 <para>
10462 <indexterm role="concept">
10463 <primary>query-style lookup</primary>
10464 <secondary>definition of</secondary>
10465 </indexterm>
10466 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
10467 key value is assumed by Exim for query-style lookups. You can use whichever
10468 Exim variables you need to construct the database query.
10469 </para>
10470 <para>
10471 For the string-expansion kind of lookups, the query is given in the first
10472 bracketed argument of the <varname>${lookup ...}</varname> expansion.
10473 For the list-argument kind of lookup the quury is given by the remainder of the
10474 list item after the first semicolon.
10475 </para>
10476 <para>
10477 <indexterm role="concept">
10478 <primary>tainted data</primary>
10479 <secondary>quoting for lookups</secondary>
10480 </indexterm>
10481 If tainted data is used in the query then it should be quuted by
10482 using the <emphasis role="bold">${quote_</emphasis>&lt;<emphasis>lookup-type</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis> expansion operator
10483 appropriate for the lookup.
10484 </para>
10485 </listitem>
10486 </itemizedlist>
10487 <para>
10488 The code for each lookup type is in a separate source file that is included in
10489 the binary of Exim only if the corresponding compile-time option is set. The
10490 default settings in <filename>src/EDITME</filename> are:
10491 </para>
10492 <literallayout class="monospaced">
10493 LOOKUP_DBM=yes
10494 LOOKUP_LSEARCH=yes
10495 </literallayout>
10496 <para>
10497 which means that only linear searching and DBM lookups are included by default.
10498 For some types of lookup (e.g. SQL databases), you need to install appropriate
10499 libraries and header files before building Exim.
10500 </para>
10501 </section>
10502 <section id="SECTsinglekeylookups">
10503 <title>Single-key lookup types</title>
10504 <para>
10505 <indexterm role="concept">
10506 <primary>lookup</primary>
10507 <secondary>single-key types</secondary>
10508 </indexterm>
10509 <indexterm role="concept">
10510 <primary>single-key lookup</primary>
10511 <secondary>list of types</secondary>
10512 </indexterm>
10513 The following single-key lookup types are implemented:
10514 </para>
10515 <section>
10516 <title>cdb</title>
10517 <para>
10518 <indexterm role="concept">
10519 <primary>cdb</primary>
10520 <secondary>description of</secondary>
10521 </indexterm>
10522 <indexterm role="concept">
10523 <primary>lookup</primary>
10524 <secondary>cdb</secondary>
10525 </indexterm>
10526 <indexterm role="concept">
10527 <primary>binary zero</primary>
10528 <secondary>in lookup key</secondary>
10529 </indexterm>
10530 The given file is searched as a Constant DataBase file, using the key
10531 string without a terminating binary zero. The cdb format is designed for
10532 indexed files that are read frequently and never updated, except by total
10533 re-creation. As such, it is particularly suitable for large files containing
10534 aliases or other indexed data referenced by an MTA. Information about cdb and
10535 tools for building the files can be found in several places:
10536 </para>
10537 <literallayout>
10538 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>
10539 <emphasis role="bold"><ulink url="https://www.corpit.ru/mjt/tinycdb.html">https://www.corpit.ru/mjt/tinycdb.html</ulink></emphasis>
10540 <emphasis role="bold"><ulink url="https://packages.debian.org/stable/utils/freecdb">https://packages.debian.org/stable/utils/freecdb</ulink></emphasis>
10541 <emphasis role="bold"><ulink url="https://github.com/philpennock/cdbtools">https://github.com/philpennock/cdbtools</ulink></emphasis> (in Go)
10542 </literallayout>
10543 <para>
10544 A cdb distribution is not needed in order to build Exim with cdb support,
10545 because the code for reading cdb files is included directly in Exim itself.
10546 However, no means of building or testing cdb files is provided with Exim, so
10547 you need to obtain a cdb distribution in order to do this.
10548 </para>
10549 </section>
10550 <section>
10551 <title>dbm</title>
10552 <para>
10553 <indexterm role="concept">
10554 <primary>DBM</primary>
10555 <secondary>lookup type</secondary>
10556 </indexterm>
10557 <indexterm role="concept">
10558 <primary>lookup</primary>
10559 <secondary>dbm</secondary>
10560 </indexterm>
10561 <indexterm role="concept">
10562 <primary>binary zero</primary>
10563 <secondary>in lookup key</secondary>
10564 </indexterm>
10565 Calls to DBM library functions are used to extract data from the given
10566 DBM file by looking up the record with the given key. A terminating binary
10567 zero is included in the key that is passed to the DBM library. See section
10568 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
10569 </para>
10570 <para>
10571 <indexterm role="concept">
10572 <primary>Berkeley DB library</primary>
10573 <secondary>file format</secondary>
10574 </indexterm>
10575 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
10576 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
10577 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
10578 the DB_UNKNOWN option. This enables it to handle any of the types of database
10579 that the library supports, and can be useful for accessing DBM files created by
10580 other applications. (For earlier DB versions, DB_HASH is always used.)
10581 </para>
10582 </section>
10583 <section>
10584 <title>dbmjz</title>
10585 <para>
10586 <indexterm role="concept">
10587 <primary>lookup</primary>
10588 <secondary>dbmjz</secondary>
10589 </indexterm>
10590 <indexterm role="concept">
10591 <primary>lookup</primary>
10592 <secondary>dbm &ndash; embedded NULs</secondary>
10593 </indexterm>
10594 <indexterm role="concept">
10595 <primary>sasldb2</primary>
10596 </indexterm>
10597 <indexterm role="concept">
10598 <primary>dbmjz lookup type</primary>
10599 </indexterm>
10600 This is the same as <command>dbm</command>, except that the lookup key is
10601 interpreted as an Exim list; the elements of the list are joined together with
10602 ASCII NUL characters to form the lookup key.  An example usage would be to
10603 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
10604 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
10605 <command>cram_md5</command> authenticator.
10606 </para>
10607 </section>
10608 <section>
10609 <title>dbmnz</title>
10610 <para>
10611 <indexterm role="concept">
10612 <primary>lookup</primary>
10613 <secondary>dbmnz</secondary>
10614 </indexterm>
10615 <indexterm role="concept">
10616 <primary>lookup</primary>
10617 <secondary>dbm &ndash; terminating zero</secondary>
10618 </indexterm>
10619 <indexterm role="concept">
10620 <primary>binary zero</primary>
10621 <secondary>in lookup key</secondary>
10622 </indexterm>
10623 <indexterm role="concept">
10624 <primary>Courier</primary>
10625 </indexterm>
10626 <indexterm role="concept">
10627 <primary><filename>/etc/userdbshadow.dat</filename></primary>
10628 </indexterm>
10629 <indexterm role="concept">
10630 <primary>dbmnz lookup type</primary>
10631 </indexterm>
10632 This is the same as <command>dbm</command>, except that a terminating binary zero
10633 is not included in the key that is passed to the DBM library. You may need this
10634 if you want to look up data in files that are created by or shared with some
10635 other application that does not use terminating zeros. For example, you need to
10636 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
10637 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
10638 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
10639 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
10640 </para>
10641 </section>
10642 <section>
10643 <title>dsearch</title>
10644 <para>
10645 <indexterm role="concept">
10646 <primary>lookup</primary>
10647 <secondary>dsearch</secondary>
10648 </indexterm>
10649 <indexterm role="concept">
10650 <primary>dsearch lookup type</primary>
10651 </indexterm>
10652 The given file must be an absolute directory path; this is searched for an entry
10653 whose name is the key by calling the <function>lstat()</function> function.
10654 The key may not contain any forward slash characters.
10655 If <function>lstat()</function> succeeds then so does the lookup.
10656 <indexterm role="concept">
10657 <primary>tainted data</primary>
10658 <secondary>dsearch result</secondary>
10659 </indexterm>
10660 The result is regarded as untainted.
10661 </para>
10662 <para>
10663 Options for the lookup can be given by appending them after the word "dsearch",
10664 separated by a comma.  Options, if present, are a comma-separated list having
10665 each element starting with a tag name and an equals.
10666 </para>
10667 <para>
10668 Two options are supported, for the return value and for filtering match
10669 candidates.
10670 The "ret" option requests an alternate result value of
10671 the entire path for the entry. Example:
10672 </para>
10673 <literallayout class="monospaced">
10674 ${lookup {passwd} dsearch,ret=full {/etc}}
10675 </literallayout>
10676 <para>
10677 The default result is just the requested entry.
10678 The "filter" option requests that only directory entries of a given type
10679 are matched. The match value is one of "file", "dir" or "subdir" (the latter
10680 not matching "." or ".."). Example:
10681 </para>
10682 <literallayout class="monospaced">
10683 ${lookup {passwd} dsearch,filter=file {/etc}}
10684 </literallayout>
10685 <para>
10686 The default matching is for any entry type, including directories
10687 and symlinks.
10688 </para>
10689 <para>
10690 An example of how this
10691 lookup can be used to support virtual domains is given in section
10692 <xref linkend="SECTvirtualdomains"/>.
10693 </para>
10694 </section>
10695 <section>
10696 <title>iplsearch</title>
10697 <para>
10698 <indexterm role="concept">
10699 <primary>lookup</primary>
10700 <secondary>iplsearch</secondary>
10701 </indexterm>
10702 <indexterm role="concept">
10703 <primary>iplsearch lookup type</primary>
10704 </indexterm>
10705 The given file is a text file containing keys and data. A key is
10706 terminated by a colon or white space or the end of the line. The keys in the
10707 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
10708 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
10709 being interpreted as a key terminator. For example:
10710 </para>
10711 <literallayout class="monospaced">
10712 1.2.3.4:           data for 1.2.3.4
10713 192.168.0.0/16:    data for 192.168.0.0/16
10714 "abcd::cdab":      data for abcd::cdab
10715 "abcd:abcd::/32"   data for abcd:abcd::/32
10716 </literallayout>
10717 <para>
10718 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
10719 file is searched linearly, using the CIDR masks where present, until a matching
10720 key is found. The first key that matches is used; there is no attempt to find a
10721 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
10722 <command>iplsearch</command> is the same as for <command>lsearch</command>.
10723 </para>
10724 <para>
10725 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
10726 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10727 lookup types support only literal keys.
10728 </para>
10729 <para>
10730 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
10731 the implicit key is the host&#x2019;s IP address rather than its name (see section
10732 <xref linkend="SECThoslispatsikey"/>).
10733 </para>
10734 <para>
10735 <emphasis role="bold">Warning 3</emphasis>: Do not use an IPv4-mapped IPv6 address for a key; use the
10736 IPv4, in dotted-quad form. (Exim converts IPv4-mapped IPv6 addresses to this
10737 notation before executing the lookup.)
10738 </para>
10739 <para>
10740 One option is supported, "ret=full", to request the return of the entire line
10741 rather than omitting the key portion.
10742 Note however that the key portion will have been de-quoted.
10743 </para>
10744 </section>
10745 <section>
10746 <title>json</title>
10747 <para>
10748 <indexterm role="concept">
10749 <primary>lookup</primary>
10750 <secondary>json</secondary>
10751 </indexterm>
10752 <indexterm role="concept">
10753 <primary>json</primary>
10754 <secondary>lookup type</secondary>
10755 </indexterm>
10756 <indexterm role="concept">
10757 <primary>JSON</primary>
10758 <secondary>expansions</secondary>
10759 </indexterm>
10760 The given file is a text file with a JSON structure.
10761 An element of the structure is extracted, defined by the search key.
10762 The key is a list of subelement selectors
10763 (colon-separated by default but changeable in the usual way)
10764 which are applied in turn to select smaller and smaller portions
10765 of the JSON structure.
10766 If a selector is numeric, it must apply to a JSON array; the (zero-based)
10767 nunbered array element is selected.
10768 Otherwise it must apply to a JSON object; the named element is selected.
10769 The final resulting element can be a simple JSON type or a JSON object
10770 or array; for the latter two a string-representation of the JSON
10771 is returned.
10772 For elements of type string, the returned value is de-quoted.
10773 </para>
10774 </section>
10775 <section>
10776 <title>lmdb</title>
10777 <para>
10778 <indexterm role="concept">
10779 <primary>LMDB</primary>
10780 </indexterm>
10781 <indexterm role="concept">
10782 <primary>lookup</primary>
10783 <secondary>lmdb</secondary>
10784 </indexterm>
10785 <indexterm role="concept">
10786 <primary>database</primary>
10787 <secondary>lmdb</secondary>
10788 </indexterm>
10789 The given file is an LMDB database.
10790 LMDB is a memory-mapped key-value store,
10791 with API modeled loosely on that of BerkeleyDB.
10792 See <emphasis role="bold"><ulink url="https://symas.com/products/lightning-memory-mapped-database/">https://symas.com/products/lightning-memory-mapped-database/</ulink></emphasis>
10793 for the feature set and operation modes.
10794 </para>
10795 <para>
10796 Exim provides read-only access via the LMDB C library.
10797 The library can be obtained from <emphasis role="bold"><ulink url="https://github.com/LMDB/lmdb">https://github.com/LMDB/lmdb</ulink></emphasis>
10798 or your operating system package repository.
10799 To enable LMDB support in Exim set LOOKUP_LMDB=yes in <filename>Local/Makefile</filename>.
10800 </para>
10801 <para>
10802 You will need to separately create the LMDB database file,
10803 possibly using the <quote>mdb_load</quote> utility.
10804 </para>
10805 </section>
10806 <section>
10807 <title>lsearch</title>
10808 <para>
10809 <indexterm role="concept">
10810 <primary>linear search</primary>
10811 </indexterm>
10812 <indexterm role="concept">
10813 <primary>lookup</primary>
10814 <secondary>lsearch</secondary>
10815 </indexterm>
10816 <indexterm role="concept">
10817 <primary>lsearch lookup type</primary>
10818 </indexterm>
10819 <indexterm role="concept">
10820 <primary>case sensitivity</primary>
10821 <secondary>in lsearch lookup</secondary>
10822 </indexterm>
10823 The given file is a text file that is searched linearly for a
10824 line beginning with the search key, terminated by a colon or white space or the
10825 end of the line. The search is case-insensitive; that is, upper and lower case
10826 letters are treated as the same. The first occurrence of the key that is found
10827 in the file is used.
10828 </para>
10829 <para>
10830 White space between the key and the colon is permitted. The remainder of the
10831 line, with leading and trailing white space removed, is the data. This can be
10832 continued onto subsequent lines by starting them with any amount of white
10833 space, but only a single space character is included in the data at such a
10834 junction. If the data begins with a colon, the key must be terminated by a
10835 colon, for example:
10836 </para>
10837 <literallayout class="monospaced">
10838 baduser:  :fail:
10839 </literallayout>
10840 <para>
10841 Empty lines and lines beginning with # are ignored, even if they occur in the
10842 middle of an item. This is the traditional textual format of alias files. Note
10843 that the keys in an <command>lsearch</command> file are literal strings. There is no
10844 wildcarding of any kind.
10845 </para>
10846 <para>
10847 <indexterm role="concept">
10848 <primary>lookup</primary>
10849 <secondary>lsearch &ndash; colons in keys</secondary>
10850 </indexterm>
10851 <indexterm role="concept">
10852 <primary>white space</primary>
10853 <secondary>in lsearch key</secondary>
10854 </indexterm>
10855 In most <command>lsearch</command> files, keys are not required to contain colons or #
10856 characters, or white space. However, if you need this feature, it is available.
10857 If a key begins with a doublequote character, it is terminated only by a
10858 matching quote (or end of line), and the normal escaping rules apply to its
10859 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
10860 quoted keys (exactly as for unquoted keys). There is no special handling of
10861 quotes for the data part of an <command>lsearch</command> line.
10862 </para>
10863 </section>
10864 <section>
10865 <title>nis</title>
10866 <para>
10867 <indexterm role="concept">
10868 <primary>NIS lookup type</primary>
10869 </indexterm>
10870 <indexterm role="concept">
10871 <primary>lookup</primary>
10872 <secondary>NIS</secondary>
10873 </indexterm>
10874 <indexterm role="concept">
10875 <primary>binary zero</primary>
10876 <secondary>in lookup key</secondary>
10877 </indexterm>
10878 The given file is the name of a NIS map, and a NIS lookup is done with
10879 the given key, without a terminating binary zero. There is a variant called
10880 <command>nis0</command> which does include the terminating binary zero in the key. This is
10881 reportedly needed for Sun-style alias files. Exim does not recognize NIS
10882 aliases; the full map names must be used.
10883 </para>
10884 </section>
10885 <section>
10886 <title>(n)wildlsearch</title>
10887 <para>
10888 <indexterm role="concept">
10889 <primary>wildlsearch lookup type</primary>
10890 </indexterm>
10891 <indexterm role="concept">
10892 <primary>lookup</primary>
10893 <secondary>wildlsearch</secondary>
10894 </indexterm>
10895 <indexterm role="concept">
10896 <primary>nwildlsearch lookup type</primary>
10897 </indexterm>
10898 <indexterm role="concept">
10899 <primary>lookup</primary>
10900 <secondary>nwildlsearch</secondary>
10901 </indexterm>
10902 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
10903 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
10904 the file may be wildcarded. The difference between these two lookup types is
10905 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
10906 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
10907 </para>
10908 <para>
10909 <indexterm role="concept">
10910 <primary>case sensitivity</primary>
10911 <secondary>in (n)wildlsearch lookup</secondary>
10912 </indexterm>
10913 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
10914 file that are regular expressions can be made case-sensitive by the use of
10915 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
10916 </para>
10917 <orderedlist numeration="arabic">
10918 <listitem>
10919 <para>
10920 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
10921 </para>
10922 <literallayout class="monospaced">
10923 *.a.b.c       data for anything.a.b.c
10924 *fish         data for anythingfish
10925 </literallayout>
10926 </listitem>
10927 <listitem>
10928 <para>
10929 The string may begin with a circumflex to indicate a regular expression. For
10930 example, for <command>wildlsearch</command>:
10931 </para>
10932 <literallayout class="monospaced">
10933 ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10934 </literallayout>
10935 <para>
10936 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10937 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10938 string-expanded, the equivalent entry is:
10939 </para>
10940 <literallayout class="monospaced">
10941 ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10942 </literallayout>
10943 <para>
10944 The case-insensitive flag is set at the start of compiling the regular
10945 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10946 For example, to make the entire pattern case-sensitive:
10947 </para>
10948 <literallayout class="monospaced">
10949 ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10950 </literallayout>
10951 <para>
10952 If the regular expression contains white space or colon characters, you must
10953 either quote it (see <command>lsearch</command> above), or represent these characters in other
10954 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10955 colon. This may be easier than quoting, because if you quote, you have to
10956 escape all the backslashes inside the quotes.
10957 </para>
10958 <para>
10959 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10960 match for later use, because the results of all lookups are cached. If a lookup
10961 is repeated, the result is taken from the cache, and no actual pattern matching
10962 takes place. The values of all the numeric variables are unset after a
10963 <command>(n)wildlsearch</command> match.
10964 </para>
10965 </listitem>
10966 <listitem>
10967 <para>
10968 Although I cannot see it being of much use, the general matching function that
10969 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10970 lookup name terminated by a semicolon, and followed by lookup data. For
10971 example:
10972 </para>
10973 <literallayout class="monospaced">
10974 cdb;/some/file  data for keys that match the file
10975 </literallayout>
10976 <para>
10977 The data that is obtained from the nested lookup is discarded.
10978 </para>
10979 </listitem>
10980 </orderedlist>
10981 <para>
10982 Keys that do not match any of these patterns are interpreted literally. The
10983 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10984 be followed by optional colons.
10985 </para>
10986 <para>
10987 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10988 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10989 lookup types support only literal keys.
10990 </para>
10991 </section>
10992 <section>
10993 <title>spf</title>
10994 <para>
10995 <indexterm role="concept">
10996 <primary>spf lookup type</primary>
10997 </indexterm>
10998 <indexterm role="concept">
10999 <primary>lookup</primary>
11000 <secondary>spf</secondary>
11001 </indexterm>
11002 If Exim is built with SPF support, manual lookups can be done
11003 (as opposed to the standard ACL condition method).
11004 For details see section <xref linkend="SECSPF"/>.
11005 </para>
11006 </section>
11007 </section>
11008 <section id="SECTquerystylelookups">
11009 <title>Query-style lookup types</title>
11010 <para>
11011 <indexterm role="concept">
11012 <primary>lookup</primary>
11013 <secondary>query-style types</secondary>
11014 </indexterm>
11015 <indexterm role="concept">
11016 <primary>query-style lookup</primary>
11017 <secondary>list of types</secondary>
11018 </indexterm>
11019 The supported query-style lookup types are listed below. Further details about
11020 many of them are given in later sections.
11021 </para>
11022 <section>
11023 <title>dnsdb</title>
11024 <para>
11025 <indexterm role="concept">
11026 <primary>DNS</primary>
11027 <secondary>as a lookup type</secondary>
11028 </indexterm>
11029 <indexterm role="concept">
11030 <primary>lookup</primary>
11031 <secondary>DNS</secondary>
11032 </indexterm>
11033 This does a DNS search for one or more records whose domain names
11034 are given in the supplied query. The resulting data is the contents of the
11035 records. See section <xref linkend="SECTdnsdb"/>.
11036 </para>
11037 </section>
11038 <section>
11039 <title>ibase</title>
11040 <para>
11041 <indexterm role="concept">
11042 <primary>InterBase lookup type</primary>
11043 </indexterm>
11044 <indexterm role="concept">
11045 <primary>lookup</primary>
11046 <secondary>InterBase</secondary>
11047 </indexterm>
11048 This does a lookup in an InterBase database.
11049 </para>
11050 </section>
11051 <section>
11052 <title>ldap</title>
11053 <para>
11054 <indexterm role="concept">
11055 <primary>LDAP</primary>
11056 <secondary>lookup type</secondary>
11057 </indexterm>
11058 <indexterm role="concept">
11059 <primary>lookup</primary>
11060 <secondary>LDAP</secondary>
11061 </indexterm>
11062 This does an LDAP lookup using a query in the form of a URL, and
11063 returns attributes from a single entry. There is a variant called <command>ldapm</command>
11064 that permits values from multiple entries to be returned. A third variant
11065 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
11066 any attribute values. See section <xref linkend="SECTldap"/>.
11067 </para>
11068 </section>
11069 <section>
11070 <title>mysql</title>
11071 <para>
11072 <indexterm role="concept">
11073 <primary>MySQL</primary>
11074 <secondary>lookup type</secondary>
11075 </indexterm>
11076 <indexterm role="concept">
11077 <primary>lookup</primary>
11078 <secondary>MySQL</secondary>
11079 </indexterm>
11080 The format of the query is an SQL statement that is passed to a
11081 MySQL database. See section <xref linkend="SECTsql"/>.
11082 </para>
11083 </section>
11084 <section>
11085 <title>nisplus</title>
11086 <para>
11087 <indexterm role="concept">
11088 <primary>NIS+ lookup type</primary>
11089 </indexterm>
11090 <indexterm role="concept">
11091 <primary>lookup</primary>
11092 <secondary>NIS+</secondary>
11093 </indexterm>
11094 This does a NIS+ lookup using a query that can specify the name of
11095 the field to be returned. See section <xref linkend="SECTnisplus"/>.
11096 </para>
11097 </section>
11098 <section>
11099 <title>oracle</title>
11100 <para>
11101 <indexterm role="concept">
11102 <primary>Oracle</primary>
11103 <secondary>lookup type</secondary>
11104 </indexterm>
11105 <indexterm role="concept">
11106 <primary>lookup</primary>
11107 <secondary>Oracle</secondary>
11108 </indexterm>
11109 The format of the query is an SQL statement that is passed to an
11110 Oracle database. See section <xref linkend="SECTsql"/>.
11111 </para>
11112 </section>
11113 <section>
11114 <title>passwd</title>
11115 <para>
11116 <indexterm role="concept">
11117 <primary>lookup</primary>
11118 <secondary>passwd</secondary>
11119 </indexterm>
11120 <indexterm role="concept">
11121 <primary>passwd lookup type</primary>
11122 </indexterm>
11123 <indexterm role="concept">
11124 <primary><filename>/etc/passwd</filename></primary>
11125 </indexterm>
11126 This is a query-style lookup with queries that are just user names. The
11127 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
11128 success, the result string is the same as you would get from an <command>lsearch</command>
11129 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
11130 password value. For example:
11131 </para>
11132 <literallayout class="monospaced">
11133 *:42:42:King Rat:/home/kr:/bin/bash
11134 </literallayout>
11135 </section>
11136 <section>
11137 <title>pgsql</title>
11138 <para>
11139 <indexterm role="concept">
11140 <primary>PostgreSQL lookup type</primary>
11141 </indexterm>
11142 <indexterm role="concept">
11143 <primary>lookup</primary>
11144 <secondary>PostgreSQL</secondary>
11145 </indexterm>
11146 The format of the query is an SQL statement that is passed to a
11147 PostgreSQL database. See section <xref linkend="SECTsql"/>.
11148 </para>
11149 </section>
11150 <section>
11151 <title>redis</title>
11152 <para>
11153 <indexterm role="concept">
11154 <primary>Redis lookup type</primary>
11155 </indexterm>
11156 <indexterm role="concept">
11157 <primary>lookup</primary>
11158 <secondary>Redis</secondary>
11159 </indexterm>
11160 The format of the query is either a simple get or simple set,
11161 passed to a Redis database. See section <xref linkend="SECTsql"/>.
11162 </para>
11163 </section>
11164 <section>
11165 <title>sqlite</title>
11166 <para>
11167 <indexterm role="concept">
11168 <primary>sqlite lookup type</primary>
11169 </indexterm>
11170 <indexterm role="concept">
11171 <primary>lookup</primary>
11172 <secondary>sqlite</secondary>
11173 </indexterm>
11174 The format of the query is
11175 an SQL statement that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
11176 </para>
11177 </section>
11178 <section>
11179 <title>testdb</title>
11180 <para>
11181 This is a lookup type that is used for testing Exim. It is
11182 not likely to be useful in normal operation.
11183 </para>
11184 </section>
11185 <section>
11186 <title>whoson</title>
11187 <para>
11188 <indexterm role="concept">
11189 <primary>whoson lookup type</primary>
11190 </indexterm>
11191 <indexterm role="concept">
11192 <primary>lookup</primary>
11193 <secondary>whoson</secondary>
11194 </indexterm>
11195 <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a protocol that
11196 allows a server to check whether a particular (dynamically allocated) IP
11197 address is currently allocated to a known (trusted) user and, optionally, to
11198 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
11199 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
11200 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
11201 <quote>POP before SMTP</quote> checking using ACL statements such as
11202 </para>
11203 <literallayout class="monospaced">
11204 require condition = \
11205   ${lookup whoson {$sender_host_address}{yes}{no}}
11206 </literallayout>
11207 <para>
11208 The query consists of a single IP address. The value returned is the name of
11209 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
11210 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
11211 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
11212 </para>
11213 </section>
11214 </section>
11215 <section id="SECID63">
11216 <title>Temporary errors in lookups</title>
11217 <para>
11218 <indexterm role="concept">
11219 <primary>lookup</primary>
11220 <secondary>temporary error in</secondary>
11221 </indexterm>
11222 Lookup functions can return temporary error codes if the lookup cannot be
11223 completed. For example, an SQL or LDAP database might be unavailable. For this
11224 reason, it is not advisable to use a lookup that might do this for critical
11225 options such as a list of local domains.
11226 </para>
11227 <para>
11228 When a lookup cannot be completed in a router or transport, delivery
11229 of the message (to the relevant address) is deferred, as for any other
11230 temporary error. In other circumstances Exim may assume the lookup has failed,
11231 or may give up altogether.
11232 </para>
11233 </section>
11234 <section id="SECTdefaultvaluelookups">
11235 <title>Default values in single-key lookups</title>
11236 <para>
11237 <indexterm role="concept">
11238 <primary>wildcard lookups</primary>
11239 </indexterm>
11240 <indexterm role="concept">
11241 <primary>lookup</primary>
11242 <secondary>default values</secondary>
11243 </indexterm>
11244 <indexterm role="concept">
11245 <primary>lookup</primary>
11246 <secondary>wildcard</secondary>
11247 </indexterm>
11248 <indexterm role="concept">
11249 <primary>lookup</primary>
11250 <secondary>* added to type</secondary>
11251 </indexterm>
11252 <indexterm role="concept">
11253 <primary>default</primary>
11254 <secondary>in single-key lookups</secondary>
11255 </indexterm>
11256 In this context, a <quote>default value</quote> is a value specified by the administrator
11257 that is to be used if a lookup fails.
11258 </para>
11259 <para>
11260 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
11261 lookups, the facilities of the query language must be used. An attempt to
11262 specify a default for a query-style lookup provokes an error.
11263 </para>
11264 <para>
11265 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
11266 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
11267 provide a default value. See also the section on partial matching below.
11268 </para>
11269 <para>
11270 <indexterm role="concept">
11271 <primary>*@ with single-key lookup</primary>
11272 </indexterm>
11273 <indexterm role="concept">
11274 <primary>lookup</primary>
11275 <secondary>*@ added to type</secondary>
11276 </indexterm>
11277 <indexterm role="concept">
11278 <primary>alias file</primary>
11279 <secondary>per-domain default</secondary>
11280 </indexterm>
11281 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
11282 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
11283 character, a second lookup is done with everything before the last @ replaced
11284 by *. This makes it possible to provide per-domain defaults in alias files
11285 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
11286 take place because there is no @ in the key), <quote>*</quote> is looked up.
11287 For example, a <command>redirect</command> router might contain:
11288 </para>
11289 <literallayout class="monospaced">
11290 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
11291 </literallayout>
11292 <para>
11293 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
11294 looks up these keys, in this order:
11295 </para>
11296 <literallayout class="monospaced">
11297 jane@eyre.example
11298 *@eyre.example
11299 *
11300 </literallayout>
11301 <para>
11302 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
11303 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
11304 complete scan is done for each key, and only if it is not found at all does
11305 Exim move on to try the next key.
11306 </para>
11307 </section>
11308 <section id="SECTpartiallookup">
11309 <title>Partial matching in single-key lookups</title>
11310 <para>
11311 <indexterm role="concept">
11312 <primary>partial matching</primary>
11313 </indexterm>
11314 <indexterm role="concept">
11315 <primary>wildcard lookups</primary>
11316 </indexterm>
11317 <indexterm role="concept">
11318 <primary>lookup</primary>
11319 <secondary>partial matching</secondary>
11320 </indexterm>
11321 <indexterm role="concept">
11322 <primary>lookup</primary>
11323 <secondary>wildcard</secondary>
11324 </indexterm>
11325 <indexterm role="concept">
11326 <primary>asterisk</primary>
11327 <secondary>in search type</secondary>
11328 </indexterm>
11329 The normal operation of a single-key lookup is to search the file for an exact
11330 match with the given key. However, in a number of situations where domains are
11331 being looked up, it is useful to be able to do partial matching. In this case,
11332 information in the file that has a key starting with <quote>*.</quote> is matched by any
11333 domain that ends with the components that follow the full stop. For example, if
11334 a key in a DBM file is
11335 </para>
11336 <literallayout class="monospaced">
11337 *.dates.fict.example
11338 </literallayout>
11339 <para>
11340 then when partial matching is enabled this is matched by (amongst others)
11341 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
11342 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
11343 file.
11344 </para>
11345 <para>
11346 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
11347 also not available for any lookup items in address lists (see section
11348 <xref linkend="SECTaddresslist"/>).
11349 </para>
11350 <para>
11351 Partial matching is implemented by doing a series of separate lookups using
11352 keys constructed by modifying the original subject key. This means that it can
11353 be used with any of the single-key lookup types, provided that
11354 partial matching keys
11355 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
11356 Keys in the file that do not begin with the prefix are matched only by
11357 unmodified subject keys when partial matching is in use.
11358 </para>
11359 <para>
11360 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
11361 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
11362 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
11363 is added at the start of the subject key, and it is looked up again. If that
11364 fails, further lookups are tried with dot-separated components removed from the
11365 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
11366 remains.
11367 </para>
11368 <para>
11369 A minimum number of two non-* components are required. This can be adjusted
11370 by including a number before the hyphen in the search type. For example,
11371 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
11372 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
11373 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
11374 up when the minimum number of non-* components is two:
11375 </para>
11376 <literallayout class="monospaced">
11377 2250.dates.fict.example
11378 *.2250.dates.fict.example
11379 *.dates.fict.example
11380 *.fict.example
11381 </literallayout>
11382 <para>
11383 As soon as one key in the sequence is successfully looked up, the lookup
11384 finishes.
11385 </para>
11386 <para>
11387 <indexterm role="concept">
11388 <primary>lookup</primary>
11389 <secondary>partial matching &ndash; changing prefix</secondary>
11390 </indexterm>
11391 <indexterm role="concept">
11392 <primary>prefix</primary>
11393 <secondary>for partial matching</secondary>
11394 </indexterm>
11395 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
11396 changed. The motivation for this feature is to allow Exim to operate with file
11397 formats that are used by other MTAs. A different prefix can be supplied in
11398 parentheses instead of the hyphen after <quote>partial</quote>. For example:
11399 </para>
11400 <literallayout class="monospaced">
11401 domains = partial(.)lsearch;/some/file
11402 </literallayout>
11403 <para>
11404 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
11405 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
11406 components is unchanged). The prefix may consist of any punctuation characters
11407 other than a closing parenthesis. It may be empty, for example:
11408 </para>
11409 <literallayout class="monospaced">
11410 domains = partial1()cdb;/some/file
11411 </literallayout>
11412 <para>
11413 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
11414 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
11415 </para>
11416 <para>
11417 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
11418 just one non-wild component has failed, and the original key is shortened right
11419 down to the null string) depends on the prefix:
11420 </para>
11421 <itemizedlist>
11422 <listitem>
11423 <para>
11424 If the prefix has zero length, the whole lookup fails.
11425 </para>
11426 </listitem>
11427 <listitem>
11428 <para>
11429 If the prefix has length 1, a lookup for just the prefix is done. For
11430 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
11431 </para>
11432 </listitem>
11433 <listitem>
11434 <para>
11435 Otherwise, if the prefix ends in a dot, the dot is removed, and the
11436 remainder is looked up. With the default prefix, therefore, the final lookup is
11437 for <quote>*</quote> on its own.
11438 </para>
11439 </listitem>
11440 <listitem>
11441 <para>
11442 Otherwise, the whole prefix is looked up.
11443 </para>
11444 </listitem>
11445 </itemizedlist>
11446 <para>
11447 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
11448 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
11449 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
11450 specified, adding <quote>*</quote> to the search type has no effect with the default
11451 prefix, because the <quote>*</quote> key is already included in the sequence of partial
11452 lookups. However, there might be a use for lookup types such as
11453 <quote>partial0(.)lsearch*</quote>.
11454 </para>
11455 <para>
11456 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
11457 in domain lists and the like. Partial matching works only in terms of
11458 dot-separated components; a key such as <literal>*fict.example</literal>
11459 in a database file is useless, because the asterisk in a partial matching
11460 subject key is always followed by a dot.
11461 </para>
11462 <para>
11463 When the lookup is done from a string-expansion,
11464 the variables <varname>$1</varname> and <varname>$2</varname> contain the wild and non-wild parts of the key
11465 during the expansion of the replacement text.
11466 They return to their previous values at the end of the lookup item.
11467 </para>
11468 </section>
11469 <section id="SECID64">
11470 <title>Lookup caching</title>
11471 <para>
11472 <indexterm role="concept">
11473 <primary>lookup</primary>
11474 <secondary>caching</secondary>
11475 </indexterm>
11476 <indexterm role="concept">
11477 <primary>caching</primary>
11478 <secondary>lookup data</secondary>
11479 </indexterm>
11480 Exim caches all lookup results in order to avoid needless repetition of
11481 lookups. However, because (apart from the daemon) Exim operates as a collection
11482 of independent, short-lived processes, this caching applies only within a
11483 single Exim process. There is no inter-process lookup caching facility.
11484 </para>
11485 <para>
11486 If an option <quote>cache=no_rd</quote> is used on the lookup then
11487 the cache is only written to, cached data is not used for the operation
11488 and a real lookup is done.
11489 </para>
11490 <para>
11491 For single-key lookups, Exim keeps the relevant files open in case there is
11492 another lookup that needs them. In some types of configuration this can lead to
11493 many files being kept open for messages with many recipients. To avoid hitting
11494 the operating system limit on the number of simultaneously open files, Exim
11495 closes the least recently used file when it needs to open more files than its
11496 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
11497 </para>
11498 <para>
11499 The single-key lookup files are closed and the lookup caches are flushed at
11500 strategic points during delivery &ndash; for example, after all routing is
11501 complete.
11502 </para>
11503 </section>
11504 <section id="SECID65">
11505 <title>Quoting lookup data</title>
11506 <para>
11507 <indexterm role="concept">
11508 <primary>lookup</primary>
11509 <secondary>quoting</secondary>
11510 </indexterm>
11511 <indexterm role="concept">
11512 <primary>quoting</primary>
11513 <secondary>in lookups</secondary>
11514 </indexterm>
11515 When data from an incoming message is included in a query-style lookup, there
11516 is the possibility of special characters in the data messing up the syntax of
11517 the query. For example, a NIS+ query that contains
11518 </para>
11519 <literallayout class="monospaced">
11520 [name=$local_part]
11521 </literallayout>
11522 <para>
11523 will be broken if the local part happens to contain a closing square bracket.
11524 For NIS+, data can be enclosed in double quotes like this:
11525 </para>
11526 <literallayout class="monospaced">
11527 [name="$local_part"]
11528 </literallayout>
11529 <para>
11530 but this still leaves the problem of a double quote in the data. The rule for
11531 NIS+ is that double quotes must be doubled. Other lookup types have different
11532 rules, and to cope with the differing requirements, an expansion operator
11533 of the following form is provided:
11534 </para>
11535 <literallayout class="monospaced">
11536 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
11537 </literallayout>
11538 <para>
11539 For example, the way to write the NIS+ query is
11540 </para>
11541 <literallayout class="monospaced">
11542 [name="${quote_nisplus:$local_part}"]
11543 </literallayout>
11544 <para>
11545 <indexterm role="concept">
11546 <primary>tainted data</primary>
11547 <secondary>in lookups</secondary>
11548 </indexterm>
11549 </para>
11550 <para revisionflag="changed">
11551 <emphasis role="bold">All</emphasis> tainted data used in a query-style lookup must be quoted
11552 using a mechanism appropriate for the lookup type.
11553 </para>
11554 <para>
11555 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
11556 operator can be used for all lookup types, but has no effect for single-key
11557 lookups, since no quoting is ever needed in their key strings.
11558 </para>
11559 </section>
11560 <section id="SECTdnsdb">
11561 <title>More about dnsdb</title>
11562 <para>
11563 <indexterm role="concept">
11564 <primary>dnsdb lookup</primary>
11565 </indexterm>
11566 <indexterm role="concept">
11567 <primary>lookup</primary>
11568 <secondary>dnsdb</secondary>
11569 </indexterm>
11570 <indexterm role="concept">
11571 <primary>DNS</primary>
11572 <secondary>as a lookup type</secondary>
11573 </indexterm>
11574 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
11575 of a record type and a domain name, separated by an equals sign. For example,
11576 an expansion string could contain:
11577 </para>
11578 <literallayout class="monospaced">
11579 ${lookup dnsdb{mx=a.b.example}{$value}fail}
11580 </literallayout>
11581 <para>
11582 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
11583 is used on its own as the result. If the lookup does not succeed, the
11584 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
11585 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
11586 </para>
11587 <para>
11588 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
11589 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
11590 If no type is given, TXT is assumed.
11591 </para>
11592 <para>
11593 For any record type, if multiple records are found, the data is returned as a
11594 concatenation, with newline as the default separator. The order, of course,
11595 depends on the DNS resolver. You can specify a different separator character
11596 between multiple records by putting a right angle-bracket followed immediately
11597 by the new separator at the start of the query. For example:
11598 </para>
11599 <literallayout class="monospaced">
11600 ${lookup dnsdb{&gt;: a=host1.example}}
11601 </literallayout>
11602 <para>
11603 It is permitted to specify a space as the separator character. Further
11604 white space is ignored.
11605 For lookup types that return multiple fields per record,
11606 an alternate field separator can be specified using a comma after the main
11607 separator character, followed immediately by the field separator.
11608 </para>
11609 <para>
11610 <indexterm role="concept">
11611 <primary>PTR record</primary>
11612 <secondary>in <command>dnsdb</command> lookup</secondary>
11613 </indexterm>
11614 When the type is PTR,
11615 the data can be an IP address, written as normal; inversion and the addition of
11616 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
11617 </para>
11618 <literallayout class="monospaced">
11619 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
11620 </literallayout>
11621 <para>
11622 If the data for a PTR record is not a syntactically valid IP address, it is not
11623 altered and nothing is added.
11624 </para>
11625 <para>
11626 <indexterm role="concept">
11627 <primary>MX record</primary>
11628 <secondary>in <command>dnsdb</command> lookup</secondary>
11629 </indexterm>
11630 <indexterm role="concept">
11631 <primary>SRV record</primary>
11632 <secondary>in <command>dnsdb</command> lookup</secondary>
11633 </indexterm>
11634 For an MX lookup, both the preference value and the host name are returned for
11635 each record, separated by a space. For an SRV lookup, the priority, weight,
11636 port, and host name are returned for each record, separated by spaces.
11637 The field separator can be modified as above.
11638 </para>
11639 <para>
11640 <indexterm role="concept">
11641 <primary>TXT record</primary>
11642 <secondary>in <command>dnsdb</command> lookup</secondary>
11643 </indexterm>
11644 <indexterm role="concept">
11645 <primary>SPF record</primary>
11646 <secondary>in <command>dnsdb</command> lookup</secondary>
11647 </indexterm>
11648 For TXT records with multiple items of data, only the first item is returned,
11649 unless a field separator is specified.
11650 To concatenate items without a separator, use a semicolon instead.
11651 For SPF records the
11652 default behaviour is to concatenate multiple items without using a separator.
11653 </para>
11654 <literallayout class="monospaced">
11655 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
11656 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
11657 ${lookup dnsdb{spf=example.org}}
11658 </literallayout>
11659 <para>
11660 It is permitted to specify a space as the separator character. Further
11661 white space is ignored.
11662 </para>
11663 <para>
11664 <indexterm role="concept">
11665 <primary>SOA record</primary>
11666 <secondary>in <command>dnsdb</command> lookup</secondary>
11667 </indexterm>
11668 For an SOA lookup, while no result is obtained the lookup is redone with
11669 successively more leading components dropped from the given domain.
11670 Only the primary-nameserver field is returned unless a field separator is
11671 specified.
11672 </para>
11673 <literallayout class="monospaced">
11674 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
11675 </literallayout>
11676 <section id="SECTdnsdb_mod">
11677 <title>Dnsdb lookup modifiers</title>
11678 <para>
11679 <indexterm role="concept">
11680 <primary>dnsdb modifiers</primary>
11681 </indexterm>
11682 <indexterm role="concept">
11683 <primary>modifiers</primary>
11684 <secondary>dnsdb</secondary>
11685 </indexterm>
11686 <indexterm role="concept">
11687 <primary>options</primary>
11688 <secondary>dnsdb</secondary>
11689 </indexterm>
11690 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
11691 each followed by a comma,
11692 that may appear before the record type.
11693 </para>
11694 <para>
11695 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
11696 temporary DNS error for any of them, the behaviour is controlled by
11697 a defer-option modifier.
11698 The possible keywords are
11699 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
11700 With <quote>strict</quote> behaviour, any temporary DNS error causes the
11701 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
11702 ignored, and the behaviour is as if the DNS lookup failed to find anything.
11703 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
11704 error causes the whole lookup to defer only if none of the other lookups
11705 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
11706 </para>
11707 <literallayout class="monospaced">
11708 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
11709 ${lookup dnsdb{a=one.host.com:two.host.com}}
11710 </literallayout>
11711 <para>
11712 Thus, in the default case, as long as at least one of the DNS lookups
11713 yields some data, the lookup succeeds.
11714 </para>
11715 <para>
11716 <indexterm role="concept">
11717 <primary>DNSSEC</primary>
11718 <secondary>dns lookup</secondary>
11719 </indexterm>
11720 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
11721 The possible keywords are
11722 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
11723 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
11724 with the lookup.
11725 With <quote>strict</quote> a response from the DNS resolver that
11726 is not labelled as authenticated data
11727 is treated as equivalent to a temporary DNS error.
11728 The default is <quote>lax</quote>.
11729 </para>
11730 <para>
11731 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
11732 </para>
11733 <para>
11734 <indexterm role="concept">
11735 <primary>timeout</primary>
11736 <secondary>dns lookup</secondary>
11737 </indexterm>
11738 <indexterm role="concept">
11739 <primary>DNS</primary>
11740 <secondary>timeout</secondary>
11741 </indexterm>
11742 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
11743 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
11744 (e.g. <quote>5s</quote>).
11745 The default value is set by the main configuration option <option>dns_retrans</option>.
11746 </para>
11747 <para>
11748 Retries for the dnsdb lookup can be controlled by a retry modifier.
11749 The form if <quote>retry_VAL</quote> where VAL is an integer.
11750 The default count is set by the main configuration option <option>dns_retry</option>.
11751 </para>
11752 <para>
11753 <indexterm role="concept">
11754 <primary>caching</primary>
11755 <secondary>of dns lookup</secondary>
11756 </indexterm>
11757 <indexterm role="concept">
11758 <primary>TTL</primary>
11759 <secondary>of dns lookup</secondary>
11760 </indexterm>
11761 <indexterm role="concept">
11762 <primary>DNS</primary>
11763 <secondary>TTL</secondary>
11764 </indexterm>
11765 Dnsdb lookup results are cached within a single process (and its children).
11766 The cache entry lifetime is limited to the smallest time-to-live (TTL)
11767 value of the set of returned DNS records.
11768 </para>
11769 </section>
11770 <section id="SECID66">
11771 <title>Pseudo dnsdb record types</title>
11772 <para>
11773 <indexterm role="concept">
11774 <primary>MX record</primary>
11775 <secondary>in <command>dnsdb</command> lookup</secondary>
11776 </indexterm>
11777 By default, both the preference value and the host name are returned for
11778 each MX record, separated by a space. If you want only host names, you can use
11779 the pseudo-type MXH:
11780 </para>
11781 <literallayout class="monospaced">
11782 ${lookup dnsdb{mxh=a.b.example}}
11783 </literallayout>
11784 <para>
11785 In this case, the preference values are omitted, and just the host names are
11786 returned.
11787 </para>
11788 <para>
11789 <indexterm role="concept">
11790 <primary>name server for enclosing domain</primary>
11791 </indexterm>
11792 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
11793 records on the given domain, but if none are found, it removes the first
11794 component of the domain name, and tries again. This process continues until NS
11795 records are found or there are no more components left (or there is a DNS
11796 error). In other words, it may return the name servers for a top-level domain,
11797 but it never returns the root name servers. If there are no NS records for the
11798 top-level domain, the lookup fails. Consider these examples:
11799 </para>
11800 <literallayout class="monospaced">
11801 ${lookup dnsdb{zns=xxx.quercite.com}}
11802 ${lookup dnsdb{zns=xxx.edu}}
11803 </literallayout>
11804 <para>
11805 Assuming that in each case there are no NS records for the full domain name,
11806 the first returns the name servers for <option>quercite.com</option>, and the second returns
11807 the name servers for <option>edu</option>.
11808 </para>
11809 <para>
11810 You should be careful about how you use this lookup because, unless the
11811 top-level domain does not exist, the lookup always returns some host names. The
11812 sort of use to which this might be put is for seeing if the name servers for a
11813 given domain are on a blacklist. You can probably assume that the name servers
11814 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
11815 such a list.
11816 </para>
11817 <para>
11818 <indexterm role="concept">
11819 <primary>CSA</primary>
11820 <secondary>in <command>dnsdb</command> lookup</secondary>
11821 </indexterm>
11822 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
11823 records according to the CSA rules, which are described in section
11824 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
11825 not sufficient because of the extra parent domain search behaviour of CSA. The
11826 result of a successful lookup such as:
11827 </para>
11828 <literallayout class="monospaced">
11829 ${lookup dnsdb {csa=$sender_helo_name}}
11830 </literallayout>
11831 <para>
11832 has two space-separated fields: an authorization code and a target host name.
11833 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
11834 authorization required but absent, or <quote>?</quote> for unknown.
11835 </para>
11836 <para>
11837 <indexterm role="concept">
11838 <primary>A+</primary>
11839 <secondary>in <command>dnsdb</command> lookup</secondary>
11840 </indexterm>
11841 The pseudo-type A+ performs an AAAA
11842 and then an A lookup.  All results are returned; defer processing
11843 (see below) is handled separately for each lookup.  Example:
11844 </para>
11845 <literallayout class="monospaced">
11846 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
11847 </literallayout>
11848 </section>
11849 <section id="SECID67">
11850 <title>Multiple dnsdb lookups</title>
11851 <para>
11852 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
11853 However, you can specify a list of domains or IP addresses in a single
11854 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
11855 the default separator, but with the ability to change this. For example:
11856 </para>
11857 <literallayout class="monospaced">
11858 ${lookup dnsdb{one.domain.com:two.domain.com}}
11859 ${lookup dnsdb{a=one.host.com:two.host.com}}
11860 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
11861 </literallayout>
11862 <para>
11863 In order to retain backwards compatibility, there is one special case: if
11864 the lookup type is PTR and no change of separator is specified, Exim looks
11865 to see if the rest of the string is precisely one IPv6 address. In this
11866 case, it does not treat it as a list.
11867 </para>
11868 <para>
11869 The data from each lookup is concatenated, with newline separators by default,
11870 in the same way that multiple DNS records for a single item are handled. A
11871 different separator can be specified, as described above.
11872 </para>
11873 </section>
11874 </section>
11875 <section id="SECTldap">
11876 <title>More about LDAP</title>
11877 <para>
11878 <indexterm role="concept">
11879 <primary>LDAP</primary>
11880 <secondary>lookup, more about</secondary>
11881 </indexterm>
11882 <indexterm role="concept">
11883 <primary>lookup</primary>
11884 <secondary>LDAP</secondary>
11885 </indexterm>
11886 <indexterm role="concept">
11887 <primary>Solaris</primary>
11888 <secondary>LDAP</secondary>
11889 </indexterm>
11890 The original LDAP implementation came from the University of Michigan; this has
11891 become <quote>Open LDAP</quote>, and there are now two different releases. Another
11892 implementation comes from Netscape, and Solaris 7 and subsequent releases
11893 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
11894 the lookup function level, their error handling is different. For this reason
11895 it is necessary to set a compile-time variable when building Exim with LDAP, to
11896 indicate which LDAP library is in use. One of the following should appear in
11897 your <filename>Local/Makefile</filename>:
11898 </para>
11899 <literallayout class="monospaced">
11900 LDAP_LIB_TYPE=UMICHIGAN
11901 LDAP_LIB_TYPE=OPENLDAP1
11902 LDAP_LIB_TYPE=OPENLDAP2
11903 LDAP_LIB_TYPE=NETSCAPE
11904 LDAP_LIB_TYPE=SOLARIS
11905 </literallayout>
11906 <para>
11907 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
11908 same interface as the University of Michigan version.
11909 </para>
11910 <para>
11911 There are three LDAP lookup types in Exim. These behave slightly differently in
11912 the way they handle the results of a query:
11913 </para>
11914 <itemizedlist>
11915 <listitem>
11916 <para>
11917 <command>ldap</command> requires the result to contain just one entry; if there are more, it
11918 gives an error.
11919 </para>
11920 </listitem>
11921 <listitem>
11922 <para>
11923 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
11924 Distinguished Name that is returned rather than any attribute values.
11925 </para>
11926 </listitem>
11927 <listitem>
11928 <para>
11929 <command>ldapm</command> permits the result to contain more than one entry; the attributes
11930 from all of them are returned.
11931 </para>
11932 </listitem>
11933 </itemizedlist>
11934 <para>
11935 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
11936 Exim behaves as if the entry did not exist, and the lookup fails. The format of
11937 the data returned by a successful lookup is described in the next section.
11938 First we explain how LDAP queries are coded.
11939 </para>
11940 <section id="SECTforldaque">
11941 <title>Format of LDAP queries</title>
11942 <para>
11943 <indexterm role="concept">
11944 <primary>LDAP</primary>
11945 <secondary>query format</secondary>
11946 </indexterm>
11947 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
11948 the configuration of a <command>redirect</command> router one might have this setting:
11949 </para>
11950 <literallayout class="monospaced">
11951 data = ${lookup ldap \
11952   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
11953   c=UK?mailbox?base?}}
11954 </literallayout>
11955 <para>
11956 <indexterm role="concept">
11957 <primary>LDAP</primary>
11958 <secondary>with TLS</secondary>
11959 </indexterm>
11960 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
11961 secure (encrypted) LDAP connections. The second of these ensures that an
11962 encrypted TLS connection is used.
11963 </para>
11964 <para>
11965 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
11966 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
11967 See the <option>ldap_start_tls</option> option.
11968 </para>
11969 <para>
11970 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
11971 controlled. Every part of the TLS configuration can be configured by settings in
11972 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
11973 your system, some of the initialization may have required setting options in
11974 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11975 certificates. This revealed a nuance where the current UID that exim was
11976 running as could affect which config files it read. With Exim 4.83, these
11977 methods become optional, only taking effect if not specifically set in
11978 <filename>exim.conf</filename>.
11979 </para>
11980 </section>
11981 <section id="SECID68">
11982 <title>LDAP quoting</title>
11983 <para>
11984 <indexterm role="concept">
11985 <primary>LDAP</primary>
11986 <secondary>quoting</secondary>
11987 </indexterm>
11988 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11989 and the second because the LDAP query is represented as a URL. Furthermore,
11990 within an LDAP query, two different kinds of quoting are required. For this
11991 reason, there are two different LDAP-specific quoting operators.
11992 </para>
11993 <para>
11994 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11995 filter specifications. Conceptually, it first does the following conversions on
11996 the string:
11997 </para>
11998 <literallayout class="monospaced">
11999 *   =&gt;   \2A
12000 (   =&gt;   \28
12001 )   =&gt;   \29
12002 \   =&gt;   \5C
12003 </literallayout>
12004 <para>
12005 in accordance with RFC 2254. The resulting string is then quoted according
12006 to the rules for URLs, that is, all non-alphanumeric characters except
12007 </para>
12008 <literallayout class="monospaced">
12009 ! $ ' - . _ ( ) * +
12010 </literallayout>
12011 <para>
12012 are converted to their hex values, preceded by a percent sign. For example:
12013 </para>
12014 <literallayout class="monospaced">
12015 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
12016 </literallayout>
12017 <para>
12018 yields
12019 </para>
12020 <literallayout class="monospaced">
12021 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
12022 </literallayout>
12023 <para>
12024 Removing the URL quoting, this is (with a leading and a trailing space):
12025 </para>
12026 <literallayout class="monospaced">
12027 a\28bc\29\2A, a&lt;yz&gt;;
12028 </literallayout>
12029 <para>
12030 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
12031 base DN specifications in queries. Conceptually, it first converts the string
12032 by inserting a backslash in front of any of the following characters:
12033 </para>
12034 <literallayout class="monospaced">
12035 , + " \ &lt; &gt; ;
12036 </literallayout>
12037 <para>
12038 It also inserts a backslash before any leading spaces or # characters, and
12039 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
12040 is then quoted according to the rules for URLs. For example:
12041 </para>
12042 <literallayout class="monospaced">
12043 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
12044 </literallayout>
12045 <para>
12046 yields
12047 </para>
12048 <literallayout class="monospaced">
12049 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
12050 </literallayout>
12051 <para>
12052 Removing the URL quoting, this is (with a trailing space):
12053 </para>
12054 <literallayout class="monospaced">
12055 \ a(bc)*\, a\&lt;yz\&gt;\;\
12056 </literallayout>
12057 <para>
12058 There are some further comments about quoting in the section on LDAP
12059 authentication below.
12060 </para>
12061 </section>
12062 <section id="SECID69">
12063 <title>LDAP connections</title>
12064 <para>
12065 <indexterm role="concept">
12066 <primary>LDAP</primary>
12067 <secondary>connections</secondary>
12068 </indexterm>
12069 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
12070 is in use, via a Unix domain socket. The example given above does not specify
12071 an LDAP server. A server that is reached by TCP/IP can be specified in a query
12072 by starting it with
12073 </para>
12074 <literallayout class="monospaced">
12075 ldap://&lt;hostname&gt;:&lt;port&gt;/...
12076 </literallayout>
12077 <para>
12078 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
12079 used. When no server is specified in a query, a list of default servers is
12080 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
12081 colon-separated list of servers which are tried in turn until one successfully
12082 handles a query, or there is a serious error. Successful handling either
12083 returns the requested data, or indicates that it does not exist. Serious errors
12084 are syntactical, or multiple values when only a single value is expected.
12085 Errors which cause the next server to be tried are connection failures, bind
12086 failures, and timeouts.
12087 </para>
12088 <para>
12089 For each server name in the list, a port number can be given. The standard way
12090 of specifying a host and port is to use a colon separator (RFC 1738). Because
12091 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
12092 doubled. For example
12093 </para>
12094 <literallayout class="monospaced">
12095 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
12096 </literallayout>
12097 <para>
12098 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
12099 to the LDAP library with no server name, and the library&#x2019;s default (normally
12100 the local host) is used.
12101 </para>
12102 <para>
12103 If you are using the OpenLDAP library, you can connect to an LDAP server using
12104 a Unix domain socket instead of a TCP/IP connection. This is specified by using
12105 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
12106 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
12107 not available.
12108 </para>
12109 <para>
12110 For this type of connection, instead of a host name for the server, a pathname
12111 for the socket is required, and the port number is not relevant. The pathname
12112 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
12113 the query. In the former case, you can have settings such as
12114 </para>
12115 <literallayout class="monospaced">
12116 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
12117 </literallayout>
12118 <para>
12119 When the pathname is given in the query, you have to escape the slashes as
12120 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
12121 </para>
12122 <literallayout class="monospaced">
12123 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
12124 </literallayout>
12125 <para>
12126 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
12127 a pathname, it uses the Unix domain socket code, even if the query actually
12128 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
12129 socket connection. This behaviour means that you can use a setting of
12130 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
12131 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
12132 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
12133 backup host.
12134 </para>
12135 <para>
12136 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
12137 specified, an error is diagnosed. However, if there are more items in
12138 <option>ldap_default_servers</option>, they are tried. In other words:
12139 </para>
12140 <itemizedlist>
12141 <listitem>
12142 <para>
12143 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
12144 interface.
12145 </para>
12146 </listitem>
12147 <listitem>
12148 <para>
12149 Using <literal>ldapi</literal> with a host name causes an error.
12150 </para>
12151 </listitem>
12152 </itemizedlist>
12153 <para>
12154 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
12155 <option>ldap_default_servers</option>, does whatever the library does by default.
12156 </para>
12157 </section>
12158 <section id="SECID70">
12159 <title>LDAP authentication and control information</title>
12160 <para>
12161 <indexterm role="concept">
12162 <primary>LDAP</primary>
12163 <secondary>authentication</secondary>
12164 </indexterm>
12165 The LDAP URL syntax provides no way of passing authentication and other control
12166 information to the server. To make this possible, the URL in an LDAP query may
12167 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
12168 spaces. If a value contains spaces it must be enclosed in double quotes, and
12169 when double quotes are used, backslash is interpreted in the usual way inside
12170 them. The following names are recognized:
12171 </para>
12172 <informaltable frame="none">
12173 <tgroup cols="2" colsep="0" rowsep="0">
12174 <colspec colwidth="20*" align="left"/>
12175 <colspec colwidth="80*" align="left"/>
12176 <tbody>
12177 <row>
12178 <entry>&nbsp;&nbsp;&nbsp;&nbsp;DEREFERENCE</entry>
12179 <entry>set the dereferencing parameter</entry>
12180 </row>
12181 <row>
12182 <entry>&nbsp;&nbsp;&nbsp;&nbsp;NETTIME</entry>
12183 <entry>set a timeout for a network operation</entry>
12184 </row>
12185 <row>
12186 <entry>&nbsp;&nbsp;&nbsp;&nbsp;USER</entry>
12187 <entry>set the DN, for authenticating the LDAP bind</entry>
12188 </row>
12189 <row>
12190 <entry>&nbsp;&nbsp;&nbsp;&nbsp;PASS</entry>
12191 <entry>set the password, likewise</entry>
12192 </row>
12193 <row>
12194 <entry>&nbsp;&nbsp;&nbsp;&nbsp;REFERRALS</entry>
12195 <entry>set the referrals parameter</entry>
12196 </row>
12197 <row>
12198 <entry>&nbsp;&nbsp;&nbsp;&nbsp;SERVERS</entry>
12199 <entry>set alternate server list for this query only</entry>
12200 </row>
12201 <row>
12202 <entry>&nbsp;&nbsp;&nbsp;&nbsp;SIZE</entry>
12203 <entry>set the limit for the number of entries returned</entry>
12204 </row>
12205 <row>
12206 <entry>&nbsp;&nbsp;&nbsp;&nbsp;TIME</entry>
12207 <entry>set the maximum waiting time for a query</entry>
12208 </row>
12209 </tbody>
12210 </tgroup>
12211 </informaltable>
12212 <para>
12213 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
12214 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
12215 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
12216 library from trying to follow referrals issued by the LDAP server.
12217 </para>
12218 <para>
12219 <indexterm role="concept">
12220 <primary>LDAP</primary>
12221 <secondary>timeout</secondary>
12222 </indexterm>
12223 <indexterm role="concept">
12224 <primary>timeout</primary>
12225 <secondary>LDAP lookup</secondary>
12226 </indexterm>
12227 The name CONNECT is an obsolete name for NETTIME, retained for
12228 backwards compatibility. This timeout (specified as a number of seconds) is
12229 enforced from the client end for operations that can be carried out over a
12230 network. Specifically, it applies to network connections and calls to the
12231 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
12232 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
12233 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
12234 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
12235 Netscape SDK; for OpenLDAP no action is taken.
12236 </para>
12237 <para>
12238 The TIME parameter (also a number of seconds) is passed to the server to
12239 set a server-side limit on the time taken to complete a search.
12240 </para>
12241 <para>
12242 The SERVERS parameter allows you to specify an alternate list of ldap servers
12243 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
12244 default list of ldap servers, and a single lookup can specify a single ldap
12245 server to use.  But when you need to do a lookup with a list of servers that is
12246 different than the default list (maybe different order, maybe a completely
12247 different set of servers), the SERVERS parameter allows you to specify this
12248 alternate list (colon-separated).
12249 </para>
12250 <para>
12251 Here is an example of an LDAP query in an Exim lookup that uses some of these
12252 values. This is a single line, folded to fit on the page:
12253 </para>
12254 <literallayout class="monospaced">
12255 ${lookup ldap
12256   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
12257   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
12258   {$value}fail}
12259 </literallayout>
12260 <para>
12261 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
12262 any of the auxiliary data. Exim configuration settings that include lookups
12263 which contain password information should be preceded by <quote>hide</quote> to prevent
12264 non-admin users from using the <option>-bP</option> option to see their values.
12265 </para>
12266 <para>
12267 The auxiliary data items may be given in any order. The default is no
12268 connection timeout (the system timeout is used), no user or password, no limit
12269 on the number of entries returned, and no time limit on queries.
12270 </para>
12271 <para>
12272 When a DN is quoted in the USER= setting for LDAP authentication, Exim
12273 removes any URL quoting that it may contain before passing it to the LDAP library.
12274 Apparently
12275 some libraries do this for themselves, but some do not. Removing the URL
12276 quoting has two advantages:
12277 </para>
12278 <itemizedlist>
12279 <listitem>
12280 <para>
12281 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
12282 DNs as with DNs inside actual queries.
12283 </para>
12284 </listitem>
12285 <listitem>
12286 <para>
12287 It permits spaces inside USER= DNs.
12288 </para>
12289 </listitem>
12290 </itemizedlist>
12291 <para>
12292 For example, a setting such as
12293 </para>
12294 <literallayout class="monospaced">
12295 USER=cn=${quote_ldap_dn:$1}
12296 </literallayout>
12297 <para>
12298 should work even if <varname>$1</varname> contains spaces.
12299 </para>
12300 <para>
12301 Expanded data for the PASS= value should be quoted using the <option>quote</option>
12302 expansion operator, rather than the LDAP quote operators. The only reason this
12303 field needs quoting is to ensure that it conforms to the Exim syntax, which
12304 does not allow unquoted spaces. For example:
12305 </para>
12306 <literallayout class="monospaced">
12307 PASS=${quote:$3}
12308 </literallayout>
12309 <para>
12310 The LDAP authentication mechanism can be used to check passwords as part of
12311 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
12312 <xref linkend="CHAPexpand"/>.
12313 </para>
12314 </section>
12315 <section id="SECID71">
12316 <title>Format of data returned by LDAP</title>
12317 <para>
12318 <indexterm role="concept">
12319 <primary>LDAP</primary>
12320 <secondary>returned data formats</secondary>
12321 </indexterm>
12322 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
12323 as a sequence of values, for example
12324 </para>
12325 <literallayout class="monospaced">
12326 cn=manager,o=University of Cambridge,c=UK
12327 </literallayout>
12328 <para>
12329 The <command>ldap</command> lookup type generates an error if more than one entry matches the
12330 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
12331 the result between the data from different entries. It is possible for multiple
12332 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
12333 you know that whatever values are returned all came from a single entry in the
12334 directory.
12335 </para>
12336 <para>
12337 In the common case where you specify a single attribute in your LDAP query, the
12338 result is not quoted, and does not contain the attribute name. If the attribute
12339 has multiple values, they are separated by commas. Any comma that is
12340 part of an attribute&#x2019;s value is doubled.
12341 </para>
12342 <para>
12343 If you specify multiple attributes, the result contains space-separated, quoted
12344 strings, each preceded by the attribute name and an equals sign. Within the
12345 quotes, the quote character, backslash, and newline are escaped with
12346 backslashes, and commas are used to separate multiple values for the attribute.
12347 Any commas in attribute values are doubled
12348 (permitting treatment of the values as a comma-separated list).
12349 Apart from the escaping, the string within quotes takes the same form as the
12350 output when a single attribute is requested. Specifying no attributes is the
12351 same as specifying all of an entry&#x2019;s attributes.
12352 </para>
12353 <para>
12354 Here are some examples of the output format. The first line of each pair is an
12355 LDAP query, and the second is the data that is returned. The attribute called
12356 <option>attr1</option> has two values, one of them with an embedded comma, whereas
12357 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
12358 (they have SUP <option>attr</option> in their schema definitions).
12359 </para>
12360 <literallayout class="monospaced">
12361 ldap:///o=base?attr1?sub?(uid=fred)
12362 value1.1,value1,,2
12363
12364 ldap:///o=base?attr2?sub?(uid=fred)
12365 value two
12366
12367 ldap:///o=base?attr?sub?(uid=fred)
12368 value1.1,value1,,2,value two
12369
12370 ldap:///o=base?attr1,attr2?sub?(uid=fred)
12371 attr1="value1.1,value1,,2" attr2="value two"
12372
12373 ldap:///o=base??sub?(uid=fred)
12374 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
12375 </literallayout>
12376 <para>
12377 You can
12378 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
12379 results of LDAP lookups.
12380 The <option>extract</option> operator in string expansions can be used to pick out
12381 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
12382 The <option>listextract</option> operator should be used to pick out individual values
12383 of attributes, even when only a single value is expected.
12384 The doubling of embedded commas allows you to use the returned data as a
12385 comma separated list (using the "&lt;," syntax for changing the input list separator).
12386 </para>
12387 </section>
12388 </section>
12389 <section id="SECTnisplus">
12390 <title>More about NIS+</title>
12391 <para>
12392 <indexterm role="concept">
12393 <primary>NIS+ lookup type</primary>
12394 </indexterm>
12395 <indexterm role="concept">
12396 <primary>lookup</primary>
12397 <secondary>NIS+</secondary>
12398 </indexterm>
12399 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
12400 and field name. If this is given, the result of a successful query is the
12401 contents of the named field; otherwise the result consists of a concatenation
12402 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
12403 values containing spaces are quoted. For example, the query
12404 </para>
12405 <literallayout class="monospaced">
12406 [name=mg1456],passwd.org_dir
12407 </literallayout>
12408 <para>
12409 might return the string
12410 </para>
12411 <literallayout class="monospaced">
12412 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
12413 home=/home/mg1456 shell=/bin/bash shadow=""
12414 </literallayout>
12415 <para>
12416 (split over two lines here to fit on the page), whereas
12417 </para>
12418 <literallayout class="monospaced">
12419 [name=mg1456],passwd.org_dir:gcos
12420 </literallayout>
12421 <para>
12422 would just return
12423 </para>
12424 <literallayout class="monospaced">
12425 Martin Guerre
12426 </literallayout>
12427 <para>
12428 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
12429 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
12430 operator is to double any quote characters within the text.
12431 </para>
12432 </section>
12433 <section id="SECTsql">
12434 <title>SQL lookups</title>
12435 <para>
12436 <indexterm role="concept">
12437 <primary>SQL lookup types</primary>
12438 </indexterm>
12439 <indexterm role="concept">
12440 <primary>MySQL</primary>
12441 <secondary>lookup type</secondary>
12442 </indexterm>
12443 <indexterm role="concept">
12444 <primary>PostgreSQL lookup type</primary>
12445 </indexterm>
12446 <indexterm role="concept">
12447 <primary>lookup</primary>
12448 <secondary>MySQL</secondary>
12449 </indexterm>
12450 <indexterm role="concept">
12451 <primary>lookup</primary>
12452 <secondary>PostgreSQL</secondary>
12453 </indexterm>
12454 <indexterm role="concept">
12455 <primary>Oracle</primary>
12456 <secondary>lookup type</secondary>
12457 </indexterm>
12458 <indexterm role="concept">
12459 <primary>lookup</primary>
12460 <secondary>Oracle</secondary>
12461 </indexterm>
12462 <indexterm role="concept">
12463 <primary>InterBase lookup type</primary>
12464 </indexterm>
12465 <indexterm role="concept">
12466 <primary>lookup</primary>
12467 <secondary>InterBase</secondary>
12468 </indexterm>
12469 <indexterm role="concept">
12470 <primary>Redis lookup type</primary>
12471 </indexterm>
12472 <indexterm role="concept">
12473 <primary>lookup</primary>
12474 <secondary>Redis</secondary>
12475 </indexterm>
12476 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
12477 and SQLite
12478 databases. Queries for these databases contain SQL statements, so an example
12479 might be
12480 </para>
12481 <literallayout class="monospaced">
12482 ${lookup mysql{select mailbox from users where id='userx'}\
12483   {$value}fail}
12484 </literallayout>
12485 <para>
12486 If the result of the query contains more than one field, the data for each
12487 field in the row is returned, preceded by its name, so the result of
12488 </para>
12489 <literallayout class="monospaced">
12490 ${lookup pgsql{select home,name from users where id='userx'}\
12491   {$value}}
12492 </literallayout>
12493 <para>
12494 might be
12495 </para>
12496 <literallayout class="monospaced">
12497 home=/home/userx name="Mister X"
12498 </literallayout>
12499 <para>
12500 Empty values and values containing spaces are double quoted, with embedded
12501 quotes escaped by a backslash. If the result of the query contains just one
12502 field, the value is passed back verbatim, without a field name, for example:
12503 </para>
12504 <literallayout class="monospaced">
12505 Mister X
12506 </literallayout>
12507 <para>
12508 If the result of the query yields more than one row, it is all concatenated,
12509 with a newline between the data for each row.
12510 </para>
12511 <section id="SECID72">
12512 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
12513 <para>
12514 <indexterm role="concept">
12515 <primary>MySQL</primary>
12516 <secondary>lookup type</secondary>
12517 </indexterm>
12518 <indexterm role="concept">
12519 <primary>PostgreSQL lookup type</primary>
12520 </indexterm>
12521 <indexterm role="concept">
12522 <primary>lookup</primary>
12523 <secondary>MySQL</secondary>
12524 </indexterm>
12525 <indexterm role="concept">
12526 <primary>lookup</primary>
12527 <secondary>PostgreSQL</secondary>
12528 </indexterm>
12529 <indexterm role="concept">
12530 <primary>Oracle</primary>
12531 <secondary>lookup type</secondary>
12532 </indexterm>
12533 <indexterm role="concept">
12534 <primary>lookup</primary>
12535 <secondary>Oracle</secondary>
12536 </indexterm>
12537 <indexterm role="concept">
12538 <primary>InterBase lookup type</primary>
12539 </indexterm>
12540 <indexterm role="concept">
12541 <primary>lookup</primary>
12542 <secondary>InterBase</secondary>
12543 </indexterm>
12544 <indexterm role="concept">
12545 <primary>Redis lookup type</primary>
12546 </indexterm>
12547 <indexterm role="concept">
12548 <primary>lookup</primary>
12549 <secondary>Redis</secondary>
12550 </indexterm>
12551 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
12552 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
12553 or <option>redis_servers</option>
12554 option (as appropriate) must be set to a colon-separated list of server
12555 information.
12556 <indexterm role="option">
12557 <primary><option>mysql_servers</option></primary>
12558 </indexterm>
12559 <indexterm role="option">
12560 <primary><option>pgsql_servers</option></primary>
12561 </indexterm>
12562 <indexterm role="option">
12563 <primary><option>oracle_servers</option></primary>
12564 </indexterm>
12565 <indexterm role="option">
12566 <primary><option>ibase_servers</option></primary>
12567 </indexterm>
12568 <indexterm role="option">
12569 <primary><option>redis_servers</option></primary>
12570 </indexterm>
12571 (For MySQL and PostgreSQL, the global option need not be set if all
12572 queries contain their own server information &ndash; see section
12573 <xref linkend="SECTspeserque"/>.)
12574 For all but Redis
12575 each item in the list is a slash-separated list of four
12576 items: host name, database name, user name, and password. In the case of
12577 Oracle, the host name field is used for the <quote>service name</quote>, and the database
12578 name field is not used and should be empty. For example:
12579 </para>
12580 <literallayout class="monospaced">
12581 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
12582 </literallayout>
12583 <para>
12584 Because password data is sensitive, you should always precede the setting with
12585 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
12586 option. Here is an example where two MySQL servers are listed:
12587 </para>
12588 <literallayout class="monospaced">
12589 hide mysql_servers = localhost/users/root/secret:\
12590                      otherhost/users/root/othersecret
12591 </literallayout>
12592 <para>
12593 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
12594 because this is a colon-separated list, the colon has to be doubled. For each
12595 query, these parameter groups are tried in order until a connection is made and
12596 a query is successfully processed. The result of a query may be that no data is
12597 found, but that is still a successful query. In other words, the list of
12598 servers provides a backup facility, not a list of different places to look.
12599 </para>
12600 <para>
12601 For Redis the global option need not be specified if all queries contain their
12602 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
12603 If specified, the option must be set to a colon-separated list of server
12604 information.
12605 Each item in the list is a slash-separated list of three items:
12606 host, database number, and password.
12607 </para>
12608 <orderedlist numeration="arabic">
12609 <listitem>
12610 <para>
12611 The host is required and may be either an IPv4 address and optional
12612 port number (separated by a colon, which needs doubling due to the
12613 higher-level list), or a Unix socket pathname enclosed in parentheses
12614 </para>
12615 </listitem>
12616 <listitem>
12617 <para>
12618 The database number is optional; if present that number is selected in the backend
12619 </para>
12620 </listitem>
12621 <listitem>
12622 <para>
12623 The password is optional; if present it is used to authenticate to the backend
12624 </para>
12625 </listitem>
12626 </orderedlist>
12627 <para>
12628 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
12629 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
12630 respectively, and the characters single-quote, double-quote, and backslash
12631 itself are escaped with backslashes.
12632 </para>
12633 <para>
12634 The <option>quote_redis</option> expansion operator
12635 escapes whitespace and backslash characters with a backslash.
12636 </para>
12637 </section>
12638 <section id="SECTspeserque">
12639 <title>Specifying the server in the query</title>
12640 <para>
12641 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
12642 it is possible to specify a list of servers with an individual query. This is
12643 done by appending a comma-separated option to the query type:
12644 </para>
12645 <literallayout>
12646 <literal>,servers=</literal><emphasis>server1:server2:server3:...</emphasis>
12647 </literallayout>
12648 <para>
12649 Each item in the list may take one of two forms:
12650 </para>
12651 <orderedlist numeration="arabic">
12652 <listitem>
12653 <para>
12654 If it contains no slashes it is assumed to be just a host name. The appropriate
12655 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
12656 of the same name, and the remaining parameters (database, user, password) are
12657 taken from there.
12658 </para>
12659 </listitem>
12660 <listitem>
12661 <para>
12662 If it contains any slashes, it is taken as a complete parameter set.
12663 </para>
12664 </listitem>
12665 </orderedlist>
12666 <para>
12667 The list of servers is used in exactly the same way as the global list.
12668 Once a connection to a server has happened and a query has been
12669 successfully executed, processing of the lookup ceases.
12670 </para>
12671 <para>
12672 This feature is intended for use in master/slave situations where updates
12673 are occurring and you want to update the master rather than a slave. If the
12674 master is in the list as a backup for reading, you might have a global setting
12675 like this:
12676 </para>
12677 <literallayout class="monospaced">
12678 mysql_servers = slave1/db/name/pw:\
12679                 slave2/db/name/pw:\
12680                 master/db/name/pw
12681 </literallayout>
12682 <para>
12683 In an updating lookup, you could then write:
12684 </para>
12685 <literallayout class="monospaced">
12686 ${lookup mysql,servers=master {UPDATE ...} }
12687 </literallayout>
12688 <para>
12689 That query would then be sent only to the master server. If, on the other hand,
12690 the master is not to be used for reading, and so is not present in the global
12691 option, you can still update it by a query of this form:
12692 </para>
12693 <literallayout class="monospaced">
12694 ${lookup pgsql,servers=master/db/name/pw {UPDATE ...} }
12695 </literallayout>
12696 <para>
12697 An older syntax places the servers specification before the query,
12698 semicolon separated:
12699 </para>
12700 <literallayout class="monospaced">
12701 ${lookup mysql{servers=master; UPDATE ...} }
12702 </literallayout>
12703 <para>
12704 The new version avoids potential issues with tainted
12705 arguments in the query, for explicit expansion.
12706 <emphasis role="bold">Note</emphasis>: server specifications in list-style lookups are still problematic.
12707 </para>
12708 </section>
12709 <section id="SECID73">
12710 <title>Special MySQL features</title>
12711 <para>
12712 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
12713 causes a connection to the server on the local host by means of a Unix domain
12714 socket. An alternate socket can be specified in parentheses.
12715 An option group name for MySQL option files can be specified in square brackets;
12716 the default value is <quote>exim</quote>.
12717 The full syntax of each item in <option>mysql_servers</option> is:
12718 </para>
12719 <literallayout>
12720 &lt;<emphasis>hostname</emphasis>&gt;::&lt;<emphasis>port</emphasis>&gt;(&lt;<emphasis>socket name</emphasis>&gt;)[&lt;<emphasis>option group</emphasis>&gt;]/&lt;<emphasis>database</emphasis>&gt;/&lt;<emphasis>user</emphasis>&gt;/&lt;<emphasis>password</emphasis>&gt;
12721 </literallayout>
12722 <para>
12723 Any of the four sub-parts of the first field can be omitted. For normal use on
12724 the local host it can be left blank or set to just <quote>localhost</quote>.
12725 </para>
12726 <para>
12727 No database need be supplied &ndash; but if it is absent here, it must be given in
12728 the queries.
12729 </para>
12730 <para>
12731 If a MySQL query is issued that does not request any data (an insert, update,
12732 or delete command), the result of the lookup is the number of rows affected.
12733 </para>
12734 <para>
12735 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
12736 anything (for example, setting a field to the value it already has), the result
12737 is zero because no rows are affected.
12738 </para>
12739 </section>
12740 <section id="SECID74">
12741 <title>Special PostgreSQL features</title>
12742 <para>
12743 PostgreSQL lookups can also use Unix domain socket connections to the database.
12744 This is usually faster and costs less CPU time than a TCP/IP connection.
12745 However it can be used only if the mail server runs on the same machine as the
12746 database server. A configuration line for PostgreSQL via Unix domain sockets
12747 looks like this:
12748 </para>
12749 <literallayout class="monospaced">
12750 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
12751 </literallayout>
12752 <para>
12753 In other words, instead of supplying a host name, a path to the socket is
12754 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
12755 visually confused with the delimiters for the other server parameters.
12756 </para>
12757 <para>
12758 If a PostgreSQL query is issued that does not request any data (an insert,
12759 update, or delete command), the result of the lookup is the number of rows
12760 affected.
12761 </para>
12762 </section>
12763 <section id="SECTsqlite">
12764 <title>More about SQLite</title>
12765 <para>
12766 <indexterm role="concept">
12767 <primary>lookup</primary>
12768 <secondary>SQLite</secondary>
12769 </indexterm>
12770 <indexterm role="concept">
12771 <primary>sqlite lookup type</primary>
12772 </indexterm>
12773 SQLite is different to the other SQL lookups because a filename is required in
12774 addition to the SQL query. An SQLite database is a single file, and there is no
12775 daemon as in the other SQL databases.
12776 </para>
12777 <para>
12778 <indexterm role="option">
12779 <primary><option>sqlite_dbfile</option></primary>
12780 </indexterm>
12781 There are two ways of
12782 specifying the file.
12783 The first is by using the <option>sqlite_dbfile</option> main option.
12784 The second, which allows separate files for each query,
12785 is to use an option appended, comma-separated, to the <quote>sqlite</quote>
12786 lookup type word.  The option is the word <quote>file</quote>, then an equals,
12787 then the filename.
12788 The filename in this case cannot contain whitespace or open-brace charachters.
12789 </para>
12790 <para>
12791 A deprecated method is available, prefixing the query with the filename
12792 separated by white space.
12793 This means that
12794 <indexterm role="concept">
12795 <primary>tainted data</primary>
12796 <secondary>sqlite file</secondary>
12797 </indexterm>
12798 the query cannot use any tainted values, as that taints
12799 the entire query including the filename - resulting in a refusal to open
12800 the file.
12801 </para>
12802 <para>
12803 In all the above cases the filename must be an absolute path.
12804 </para>
12805 <para>
12806 Here is a lookup expansion example:
12807 </para>
12808 <literallayout class="monospaced">
12809 sqlite_dbfile = /some/thing/sqlitedb
12810 ...
12811 ${lookup sqlite {select name from aliases where id='userx';}}
12812 </literallayout>
12813 <para>
12814 In a list, the syntax is similar. For example:
12815 </para>
12816 <literallayout class="monospaced">
12817 domainlist relay_to_domains = sqlite;\
12818    select * from relays where ip='$sender_host_address';
12819 </literallayout>
12820 <para>
12821 The only character affected by the <option>quote_sqlite</option> operator is a single
12822 quote, which it doubles.
12823 </para>
12824 <para>
12825 <indexterm role="concept">
12826 <primary>timeout</primary>
12827 <secondary>SQLite</secondary>
12828 </indexterm>
12829 <indexterm role="concept">
12830 <primary>sqlite</primary>
12831 <secondary>lookup timeout</secondary>
12832 </indexterm>
12833 The SQLite library handles multiple simultaneous accesses to the database
12834 internally. Multiple readers are permitted, but only one process can
12835 update at once. Attempts to access the database while it is being updated
12836 are rejected after a timeout period, during which the SQLite library
12837 waits for the lock to be released. In Exim, the default timeout is set
12838 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
12839 option.
12840 </para>
12841 </section>
12842 <section id="SECTredis">
12843 <title>More about Redis</title>
12844 <para>
12845 <indexterm role="concept">
12846 <primary>lookup</primary>
12847 <secondary>Redis</secondary>
12848 </indexterm>
12849 <indexterm role="concept">
12850 <primary>redis lookup type</primary>
12851 </indexterm>
12852 Redis is a non-SQL database. Commands are simple get and set.
12853 Examples:
12854 </para>
12855 <literallayout class="monospaced">
12856 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
12857 ${lookup redis{get keyname}}
12858 </literallayout>
12859 <para>
12860 As of release 4.91, "lightweight" support for Redis Cluster is available.
12861 Requires <option>redis_servers</option> list to contain all the servers in the cluster, all
12862 of which must be reachable from the running exim instance. If the cluster has
12863 master/slave replication, the list must contain all the master and slave
12864 servers.
12865 </para>
12866 <para>
12867 When the Redis Cluster returns a "MOVED" response to a query, Exim does not
12868 immediately follow the redirection but treats the response as a DEFER, moving on
12869 to the next server in the <option>redis_servers</option> list until the correct server is
12870 reached.
12871 </para>
12872 <para>
12873 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
12874 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
12875 </para>
12876 </section>
12877 </section>
12878 </chapter>
12879
12880 <chapter id="CHAPdomhosaddlists">
12881 <title>Domain, host, address, and local part lists</title>
12882 <titleabbrev>Domain, host, and address lists</titleabbrev>
12883 <para>
12884 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
12885 <primary>lists of domains; hosts; etc.</primary>
12886 </indexterm>
12887 A number of Exim configuration options contain lists of domains, hosts,
12888 email addresses, or local parts. For example, the <option>hold_domains</option> option
12889 contains a list of domains whose delivery is currently suspended. These lists
12890 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
12891 arguments to expansion conditions such as <option>match_domain</option>.
12892 </para>
12893 <para>
12894 Each item in one of these lists is a pattern to be matched against a domain,
12895 host, email address, or local part, respectively. In the sections below, the
12896 different types of pattern for each case are described, but first we cover some
12897 general facilities that apply to all four kinds of list.
12898 </para>
12899 <para>
12900 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
12901 support all the complexity available in
12902 domain, host, address and local part lists.
12903 </para>
12904 <section id="SECTlistresults">
12905 <title>Results of list checking</title>
12906 <para>
12907 The primary result of doing a list check is a truth value.
12908 In some contexts additional information is stored
12909 about the list element that matched:
12910 </para>
12911 <variablelist>
12912 <varlistentry>
12913 <term>hosts</term>
12914 <listitem>
12915 <para>
12916 A <option>hosts</option> ACL condition
12917 will store a result in the <varname>$host_data</varname> variable.
12918 </para>
12919 </listitem></varlistentry>
12920 <varlistentry>
12921 <term>local_parts</term>
12922 <listitem>
12923 <para>
12924 A <option>local_parts</option> router option or <option>local_parts</option> ACL condition
12925 will store a result in the <varname>$local_part_data</varname> variable.
12926 </para>
12927 </listitem></varlistentry>
12928 <varlistentry>
12929 <term>domains</term>
12930 <listitem>
12931 <para>
12932 A <option>domains</option> router option or <option>domains</option> ACL condition
12933 will store a result in the <varname>$domain_data</varname> variable.
12934 </para>
12935 </listitem></varlistentry>
12936 <varlistentry>
12937 <term>senders</term>
12938 <listitem>
12939 <para>
12940 A <option>senders</option> router option or <option>senders</option> ACL condition
12941 will store a result in the <varname>$sender_data</varname> variable.
12942 </para>
12943 </listitem></varlistentry>
12944 <varlistentry>
12945 <term>recipients</term>
12946 <listitem>
12947 <para>
12948 A <option>recipients</option> ACL condition
12949 will store a result in the <varname>$recipient_data</varname> variable.
12950 </para>
12951 </listitem></varlistentry>
12952 </variablelist>
12953 <para>
12954 The detail of the additional information depends on the
12955 type of match and is given below as the <emphasis role="bold">value</emphasis> information.
12956 </para>
12957 </section>
12958 <section id="SECTlistexpand">
12959 <title>Expansion of lists</title>
12960 <para>
12961 <indexterm role="concept">
12962 <primary>expansion</primary>
12963 <secondary>of lists</secondary>
12964 </indexterm>
12965 Each list is expanded as a single string before it is used.
12966 </para>
12967 <para>
12968 <emphasis>Exception: the router headers_remove option, where list-item
12969 splitting is done before string-expansion.</emphasis>
12970 </para>
12971 <para>
12972 The result of
12973 expansion must be a list, possibly containing empty items, which is split up
12974 into separate items for matching. By default, colon is the separator character,
12975 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
12976 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
12977 discusses the way to specify empty list items.
12978 </para>
12979 <para>
12980 If the string expansion is forced to fail, Exim behaves as if the item it is
12981 testing (domain, host, address, or local part) is not in the list. Other
12982 expansion failures cause temporary errors.
12983 </para>
12984 <para>
12985 If an item in a list is a regular expression, backslashes, dollars and possibly
12986 other special characters in the expression must be protected against
12987 misinterpretation by the string expander. The easiest way to do this is to use
12988 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
12989 expression should not be expanded. For example, in an ACL you might have:
12990 </para>
12991 <literallayout class="monospaced">
12992 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
12993                ${lookup{$domain}lsearch{/badsenders/bydomain}}
12994 </literallayout>
12995 <para>
12996 The first item is a regular expression that is protected from expansion by
12997 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
12998 senders based on the receiving domain.
12999 </para>
13000 <section id="SECID76">
13001 <title>Negated items in lists</title>
13002 <para>
13003 <indexterm role="concept">
13004 <primary>list</primary>
13005 <secondary>negation</secondary>
13006 </indexterm>
13007 <indexterm role="concept">
13008 <primary>negation</primary>
13009 <secondary>in lists</secondary>
13010 </indexterm>
13011 Items in a list may be positive or negative. Negative items are indicated by a
13012 leading exclamation mark, which may be followed by optional white space. A list
13013 defines a set of items (domains, etc). When Exim processes one of these lists,
13014 it is trying to find out whether a domain, host, address, or local part
13015 (respectively) is in the set that is defined by the list. It works like this:
13016 </para>
13017 <para>
13018 The list is scanned from left to right. If a positive item is matched, the
13019 subject that is being checked is in the set; if a negative item is matched, the
13020 subject is not in the set. If the end of the list is reached without the
13021 subject having matched any of the patterns, it is in the set if the last item
13022 was a negative one, but not if it was a positive one. For example, the list in
13023 </para>
13024 <literallayout class="monospaced">
13025 domainlist relay_to_domains = !a.b.c : *.b.c
13026 </literallayout>
13027 <para>
13028 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
13029 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
13030 list is positive. However, if the setting were
13031 </para>
13032 <literallayout class="monospaced">
13033 domainlist relay_to_domains = !a.b.c
13034 </literallayout>
13035 <para>
13036 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
13037 list is negative. In other words, a list that ends with a negative item behaves
13038 as if it had an extra item <literal>:*</literal> on the end.
13039 </para>
13040 <para>
13041 Another way of thinking about positive and negative items in lists is to read
13042 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
13043 item.
13044 </para>
13045 </section>
13046 <section id="SECTfilnamlis">
13047 <title>File names in lists</title>
13048 <para>
13049 <indexterm role="concept">
13050 <primary>list</primary>
13051 <secondary>filename in</secondary>
13052 </indexterm>
13053 If an item in a domain, host, address, or local part list is an absolute
13054 filename (beginning with a slash character), each line of the file is read and
13055 processed as if it were an independent item in the list, except that further
13056 filenames are not allowed,
13057 and no expansion of the data from the file takes place.
13058 Empty lines in the file are ignored, and the file may also contain comment
13059 lines:
13060 </para>
13061 <itemizedlist>
13062 <listitem>
13063 <para>
13064 For domain and host lists, if a # character appears anywhere in a line of the
13065 file, it and all following characters are ignored.
13066 </para>
13067 </listitem>
13068 <listitem>
13069 <para>
13070 Because local parts may legitimately contain # characters, a comment in an
13071 address list or local part list file is recognized only if # is preceded by
13072 white space or the start of the line. For example:
13073 </para>
13074 <literallayout class="monospaced">
13075 not#comment@x.y.z   # but this is a comment
13076 </literallayout>
13077 </listitem>
13078 </itemizedlist>
13079 <para>
13080 Putting a filename in a list has the same effect as inserting each line of the
13081 file as an item in the list (blank lines and comments excepted). However, there
13082 is one important difference: the file is read each time the list is processed,
13083 so if its contents vary over time, Exim&#x2019;s behaviour changes.
13084 </para>
13085 <para>
13086 If a filename is preceded by an exclamation mark, the sense of any match
13087 within the file is inverted. For example, if
13088 </para>
13089 <literallayout class="monospaced">
13090 hold_domains = !/etc/nohold-domains
13091 </literallayout>
13092 <para>
13093 and the file contains the lines
13094 </para>
13095 <literallayout class="monospaced">
13096 !a.b.c
13097 *.b.c
13098 </literallayout>
13099 <para>
13100 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
13101 any domain matching <literal>*.b.c</literal> is not.
13102 </para>
13103 </section>
13104 <section id="SECID77">
13105 <title>An lsearch file is not an out-of-line list</title>
13106 <para>
13107 As will be described in the sections that follow, lookups can be used in lists
13108 to provide indexed methods of checking list membership. There has been some
13109 confusion about the way <command>lsearch</command> lookups work in lists. Because
13110 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
13111 sometimes thought that it is allowed to contain wild cards and other kinds of
13112 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
13113 always fixed strings, just as for any other single-key lookup type.
13114 </para>
13115 <para>
13116 If you want to use a file to contain wild-card patterns that form part of a
13117 list, just give the filename on its own, without a search type, as described
13118 in the previous section. You could also use the <command>wildlsearch</command> or
13119 <command>nwildlsearch</command>, but there is no advantage in doing this.
13120 </para>
13121 </section>
13122 <section id="SECTnamedlists">
13123 <title>Named lists</title>
13124 <para>
13125 <indexterm role="concept">
13126 <primary>named lists</primary>
13127 </indexterm>
13128 <indexterm role="concept">
13129 <primary>list</primary>
13130 <secondary>named</secondary>
13131 </indexterm>
13132 A list of domains, hosts, email addresses, or local parts can be given a name
13133 which is then used to refer to the list elsewhere in the configuration. This is
13134 particularly convenient if the same list is required in several different
13135 places. It also allows lists to be given meaningful names, which can improve
13136 the readability of the configuration. For example, it is conventional to define
13137 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
13138 locally on a host, using a configuration line such as
13139 </para>
13140 <literallayout class="monospaced">
13141 domainlist local_domains = localhost:my.dom.example
13142 </literallayout>
13143 <para>
13144 Named lists are referenced by giving their name preceded by a plus sign, so,
13145 for example, a router that is intended to handle local domains would be
13146 configured with the line
13147 </para>
13148 <literallayout class="monospaced">
13149 domains = +local_domains
13150 </literallayout>
13151 <para>
13152 The first router in a configuration is often one that handles all domains
13153 except the local ones, using a configuration with a negated item like this:
13154 </para>
13155 <literallayout class="monospaced">
13156 dnslookup:
13157   driver = dnslookup
13158   domains = ! +local_domains
13159   transport = remote_smtp
13160   no_more
13161 </literallayout>
13162 <para>
13163 The four kinds of named list are created by configuration lines starting with
13164 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
13165 respectively. Then there follows the name that you are defining, followed by an
13166 equals sign and the list itself. For example:
13167 </para>
13168 <literallayout class="monospaced">
13169 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
13170 addresslist bad_senders = cdb;/etc/badsenders
13171 </literallayout>
13172 <para>
13173 A named list may refer to other named lists:
13174 </para>
13175 <literallayout class="monospaced">
13176 domainlist  dom1 = first.example : second.example
13177 domainlist  dom2 = +dom1 : third.example
13178 domainlist  dom3 = fourth.example : +dom2 : fifth.example
13179 </literallayout>
13180 <para>
13181 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
13182 effect may not be what you intended, because the negation does not propagate
13183 out to the higher level. For example, consider:
13184 </para>
13185 <literallayout class="monospaced">
13186 domainlist  dom1 = !a.b
13187 domainlist  dom2 = +dom1 : *.b
13188 </literallayout>
13189 <para>
13190 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
13191 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
13192 means it matches the second list as well. The effect is not the same as
13193 </para>
13194 <literallayout class="monospaced">
13195 domainlist  dom2 = !a.b : *.b
13196 </literallayout>
13197 <para>
13198 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
13199 referenced lists if you can.
13200 </para>
13201 <para>
13202 <indexterm role="concept">
13203 <primary>hiding named list values</primary>
13204 </indexterm>
13205 <indexterm role="concept">
13206 <primary>named lists</primary>
13207 <secondary>hiding value of</secondary>
13208 </indexterm>
13209 Some named list definitions may contain sensitive data, for example, passwords for
13210 accessing databases. To stop non-admin users from using the <option>-bP</option> command
13211 line option to read these values, you can precede the definition with the
13212 word <quote>hide</quote>. For example:
13213 </para>
13214 <literallayout class="monospaced">
13215 hide domainlist filter_for_domains = ldap;PASS=secret ldap::/// ...
13216 </literallayout>
13217 <para>
13218 Named lists may have a performance advantage. When Exim is routing an
13219 address or checking an incoming message, it caches the result of tests on named
13220 lists. So, if you have a setting such as
13221 </para>
13222 <literallayout class="monospaced">
13223 domains = +local_domains
13224 </literallayout>
13225 <para>
13226 on several of your routers
13227 or in several ACL statements,
13228 the actual test is done only for the first one. However, the caching works only
13229 if there are no expansions within the list itself or any sublists that it
13230 references. In other words, caching happens only for lists that are known to be
13231 the same each time they are referenced.
13232 </para>
13233 <para>
13234 By default, there may be up to 16 named lists of each type. This limit can be
13235 extended by changing a compile-time variable. The use of domain and host lists
13236 is recommended for concepts such as local domains, relay domains, and relay
13237 hosts. The default configuration is set up like this.
13238 </para>
13239 </section>
13240 <section id="SECID78">
13241 <title>Named lists compared with macros</title>
13242 <para>
13243 <indexterm role="concept">
13244 <primary>list</primary>
13245 <secondary>named compared with macro</secondary>
13246 </indexterm>
13247 <indexterm role="concept">
13248 <primary>macro</primary>
13249 <secondary>compared with named list</secondary>
13250 </indexterm>
13251 At first sight, named lists might seem to be no different from macros in the
13252 configuration file. However, macros are just textual substitutions. If you
13253 write
13254 </para>
13255 <literallayout class="monospaced">
13256 ALIST = host1 : host2
13257 auth_advertise_hosts = !ALIST
13258 </literallayout>
13259 <para>
13260 it probably won&#x2019;t do what you want, because that is exactly the same as
13261 </para>
13262 <literallayout class="monospaced">
13263 auth_advertise_hosts = !host1 : host2
13264 </literallayout>
13265 <para>
13266 Notice that the second host name is not negated. However, if you use a host
13267 list, and write
13268 </para>
13269 <literallayout class="monospaced">
13270 hostlist alist = host1 : host2
13271 auth_advertise_hosts = ! +alist
13272 </literallayout>
13273 <para>
13274 the negation applies to the whole list, and so that is equivalent to
13275 </para>
13276 <literallayout class="monospaced">
13277 auth_advertise_hosts = !host1 : !host2
13278 </literallayout>
13279 </section>
13280 <section id="SECID79">
13281 <title>Named list caching</title>
13282 <para>
13283 <indexterm role="concept">
13284 <primary>list</primary>
13285 <secondary>caching of named</secondary>
13286 </indexterm>
13287 <indexterm role="concept">
13288 <primary>caching</primary>
13289 <secondary>named lists</secondary>
13290 </indexterm>
13291 While processing a message, Exim caches the result of checking a named list if
13292 it is sure that the list is the same each time. In practice, this means that
13293 the cache operates only if the list contains no $ characters, which guarantees
13294 that it will not change when it is expanded. Sometimes, however, you may have
13295 an expanded list that you know will be the same each time within a given
13296 message. For example:
13297 </para>
13298 <literallayout class="monospaced">
13299 domainlist special_domains = \
13300            ${lookup{$sender_host_address}cdb{/some/file}}
13301 </literallayout>
13302 <para>
13303 This provides a list of domains that depends only on the sending host&#x2019;s IP
13304 address. If this domain list is referenced a number of times (for example,
13305 in several ACL lines, or in several routers) the result of the check is not
13306 cached by default, because Exim does not know that it is going to be the
13307 same list each time.
13308 </para>
13309 <para>
13310 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
13311 cache the result anyway. For example:
13312 </para>
13313 <literallayout class="monospaced">
13314 domainlist_cache special_domains = ${lookup{...
13315 </literallayout>
13316 <para>
13317 If you do this, you should be absolutely sure that caching is going to do
13318 the right thing in all cases. When in doubt, leave it out.
13319 </para>
13320 </section>
13321 </section>
13322 <section id="SECTdomainlist">
13323 <title>Domain lists</title>
13324 <para>
13325 <indexterm role="concept">
13326 <primary>domain list</primary>
13327 <secondary>patterns for</secondary>
13328 </indexterm>
13329 <indexterm role="concept">
13330 <primary>list</primary>
13331 <secondary>domain list</secondary>
13332 </indexterm>
13333 Domain lists contain patterns that are to be matched against a mail domain.
13334 The following types of item may appear in domain lists:
13335 </para>
13336 <itemizedlist>
13337 <listitem>
13338 <para>
13339 <indexterm role="concept">
13340 <primary>primary host name</primary>
13341 </indexterm>
13342 <indexterm role="concept">
13343 <primary>host name</primary>
13344 <secondary>matched in domain list</secondary>
13345 </indexterm>
13346 <indexterm role="option">
13347 <primary><option>primary_hostname</option></primary>
13348 </indexterm>
13349 <indexterm role="concept">
13350 <primary>domain list</primary>
13351 <secondary>matching primary host name</secondary>
13352 </indexterm>
13353 <indexterm role="concept">
13354 <primary>@ in a domain list</primary>
13355 </indexterm>
13356 If a pattern consists of a single @ character, it matches the local host name,
13357 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
13358 possible to use the same configuration file on several different hosts that
13359 differ only in their names.
13360 </para>
13361 <para>
13362 The value for a match will be the primary host name.
13363 </para>
13364 </listitem>
13365 <listitem>
13366 <para>
13367 <indexterm role="concept">
13368 <primary>@[] in a domain list</primary>
13369 </indexterm>
13370 <indexterm role="concept">
13371 <primary>domain list</primary>
13372 <secondary>matching local IP interfaces</secondary>
13373 </indexterm>
13374 <indexterm role="concept">
13375 <primary>domain literal</primary>
13376 </indexterm>
13377 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
13378 in square brackets (as in an email address that contains a domain literal), but
13379 only if that IP address is recognized as local for email routing purposes. The
13380 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
13381 control which of a host&#x2019;s several IP addresses are treated as local.
13382 In today&#x2019;s Internet, the use of domain literals is controversial;
13383 see the <option>allow_domain_literals</option> main option.
13384 </para>
13385 <para>
13386 The value for a match will be the string <literal>@[]</literal>.
13387 </para>
13388 </listitem>
13389 <listitem>
13390 <para>
13391 <indexterm role="concept">
13392 <primary>@mx_any</primary>
13393 </indexterm>
13394 <indexterm role="concept">
13395 <primary>@mx_primary</primary>
13396 </indexterm>
13397 <indexterm role="concept">
13398 <primary>@mx_secondary</primary>
13399 </indexterm>
13400 <indexterm role="concept">
13401 <primary>domain list</primary>
13402 <secondary>matching MX pointers to local host</secondary>
13403 </indexterm>
13404 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
13405 has an MX record pointing to the local host or to any host that is listed in
13406 <indexterm role="option">
13407 <primary><option>hosts_treat_as_local</option></primary>
13408 </indexterm>
13409 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
13410 are similar, except that the first matches only when a primary MX target is the
13411 local host, and the second only when no primary MX target is the local host,
13412 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
13413 preference value &ndash; there may of course be more than one of them.
13414 </para>
13415 <para>
13416 The MX lookup that takes place when matching a pattern of this type is
13417 performed with the resolver options for widening names turned off. Thus, for
13418 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
13419 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
13420 options of the <command>dnslookup</command> router for a discussion of domain widening.
13421 </para>
13422 <para>
13423 Sometimes you may want to ignore certain IP addresses when using one of these
13424 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
13425 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
13426 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
13427 on a router). For example:
13428 </para>
13429 <literallayout class="monospaced">
13430 domains = @mx_any/ignore=127.0.0.1
13431 </literallayout>
13432 <para>
13433 This example matches any domain that has an MX record pointing to one of
13434 the local host&#x2019;s IP addresses other than 127.0.0.1.
13435 </para>
13436 <para>
13437 The list of IP addresses is in fact processed by the same code that processes
13438 host lists, so it may contain CIDR-coded network specifications and it may also
13439 contain negative items.
13440 </para>
13441 <para>
13442 Because the list of IP addresses is a sublist within a domain list, you have to
13443 be careful about delimiters if there is more than one address. Like any other
13444 list, the default delimiter can be changed. Thus, you might have:
13445 </para>
13446 <literallayout class="monospaced">
13447 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
13448           an.other.domain : ...
13449 </literallayout>
13450 <para>
13451 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
13452 involved, it is easiest to change the delimiter for the main list as well:
13453 </para>
13454 <literallayout class="monospaced">
13455 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
13456           an.other.domain ? ...
13457 </literallayout>
13458 <para>
13459 The value for a match will be the list element string (starting <literal>@mx_</literal>).
13460 </para>
13461 </listitem>
13462 <listitem>
13463 <para>
13464 <indexterm role="concept">
13465 <primary>asterisk</primary>
13466 <secondary>in domain list</secondary>
13467 </indexterm>
13468 <indexterm role="concept">
13469 <primary>domain list</primary>
13470 <secondary>asterisk in</secondary>
13471 </indexterm>
13472 <indexterm role="concept">
13473 <primary>domain list</primary>
13474 <secondary>matching <quote>ends with</quote></secondary>
13475 </indexterm>
13476 If a pattern starts with an asterisk, the remaining characters of the pattern
13477 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
13478 domain lists differs from its use in partial matching lookups. In a domain
13479 list, the character following the asterisk need not be a dot, whereas partial
13480 matching works only in terms of dot-separated components. For example, a domain
13481 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
13482 <emphasis>cipher.key.ex</emphasis>.
13483 </para>
13484 <para>
13485 The value for a match will be the list element string (starting with the asterisk).
13486 Additionally, <varname>$0</varname> will be set to the matched string
13487 and <varname>$1</varname> to the variable portion which the asterisk matched.
13488 </para>
13489 </listitem>
13490 <listitem>
13491 <para>
13492 <indexterm role="concept">
13493 <primary>regular expressions</primary>
13494 <secondary>in domain list</secondary>
13495 </indexterm>
13496 <indexterm role="concept">
13497 <primary>domain list</primary>
13498 <secondary>matching regular expression</secondary>
13499 </indexterm>
13500 If a pattern starts with a circumflex character, it is treated as a regular
13501 expression, and matched against the domain using a regular expression matching
13502 function. The circumflex is treated as part of the regular expression.
13503 Email domains are case-independent, so this regular expression match is by
13504 default case-independent, but you can make it case-dependent by starting it
13505 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
13506 are given in chapter <xref linkend="CHAPregexp"/>.
13507 </para>
13508 <para>
13509 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
13510 must escape any backslash and dollar characters in the regular expression, or
13511 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
13512 it is not to be expanded (unless you really do want to build a regular
13513 expression by expansion, of course).
13514 </para>
13515 <para>
13516 The value for a match will be the list element string (starting with the circumflex).
13517 Additionally, <varname>$0</varname> will be set to the string matching the regular expression,
13518 and <varname>$1</varname> (onwards) to any submatches identified by parentheses.
13519 </para>
13520 </listitem>
13521 <listitem>
13522 <para>
13523 <indexterm role="concept">
13524 <primary>lookup</primary>
13525 <secondary>in domain list</secondary>
13526 </indexterm>
13527 <indexterm role="concept">
13528 <primary>domain list</primary>
13529 <secondary>matching by lookup</secondary>
13530 </indexterm>
13531 If a pattern starts with the name of a single-key lookup type followed by a
13532 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
13533 must be a filename in a suitable format for the lookup type. For example, for
13534 <quote>cdb;</quote> it must be an absolute path:
13535 </para>
13536 <literallayout class="monospaced">
13537 domains = cdb;/etc/mail/local_domains.cdb
13538 </literallayout>
13539 <para>
13540 The appropriate type of lookup is done on the file using the domain name as the
13541 key. In most cases, the value resulting from the lookup is not used; Exim is interested
13542 only in whether or not the key is present in the file. However, when a lookup
13543 is used for the <option>domains</option> option on a router
13544 or a <option>domains</option> condition in an ACL statement, the value is preserved in the
13545 <varname>$domain_data</varname> variable and can be referred to in other router options or
13546 other statements in the same ACL.
13547 <indexterm role="concept">
13548 <primary>tainted data</primary>
13549 <secondary>de-tainting</secondary>
13550 </indexterm>
13551 <indexterm role="concept">
13552 <primary>de-tainting</primary>
13553 <secondary>using ACL domains condition</secondary>
13554 </indexterm>
13555 The value will be untainted.
13556 </para>
13557 <para>
13558 <emphasis role="bold">Note</emphasis>: If the data result of the lookup (as opposed to the key)
13559 is empty, then this empty value is stored in <varname>$domain_data</varname>.
13560 The option to return the key for the lookup, as the value,
13561 may be what is wanted.
13562 </para>
13563 </listitem>
13564 <listitem>
13565 <para>
13566 Any of the single-key lookup type names may be preceded by
13567 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
13568 </para>
13569 <literallayout class="monospaced">
13570 domains = partial-dbm;/partial/domains
13571 </literallayout>
13572 <para>
13573 This causes partial matching logic to be invoked; a description of how this
13574 works is given in section <xref linkend="SECTpartiallookup"/>.
13575 </para>
13576 </listitem>
13577 <listitem>
13578 <para>
13579 <indexterm role="concept">
13580 <primary>asterisk</primary>
13581 <secondary>in lookup type</secondary>
13582 </indexterm>
13583 Any of the single-key lookup types may be followed by an asterisk. This causes
13584 a default lookup for a key consisting of a single asterisk to be done if the
13585 original lookup fails. This is not a useful feature when using a domain list to
13586 select particular domains (because any domain would match), but it might have
13587 value if the result of the lookup is being used via the <varname>$domain_data</varname>
13588 expansion variable.
13589 </para>
13590 </listitem>
13591 <listitem>
13592 <para>
13593 If the pattern starts with the name of a query-style lookup type followed by a
13594 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
13595 pattern must be an appropriate query for the lookup type, as described in
13596 chapter <xref linkend="CHAPfdlookup"/>. For example:
13597 </para>
13598 <literallayout class="monospaced">
13599 hold_domains = mysql;select domain from holdlist \
13600   where domain = '${quote_mysql:$domain}';
13601 </literallayout>
13602 <para>
13603 In most cases, the value resulting from the lookup is not used (so for an SQL query, for
13604 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
13605 whether or not the query succeeds. However, when a lookup is used for the
13606 <option>domains</option> option on a router, the value is preserved in the <varname>$domain_data</varname>
13607 variable and can be referred to in other options.
13608 <indexterm role="concept">
13609 <primary>tainted data</primary>
13610 <secondary>de-tainting</secondary>
13611 </indexterm>
13612 <indexterm role="concept">
13613 <primary>de-tainting</primary>
13614 <secondary>using router domains option</secondary>
13615 </indexterm>
13616 The value will be untainted.
13617 </para>
13618 </listitem>
13619 <listitem>
13620 <para>
13621 If the pattern starts with the name of a lookup type
13622 of either kind (single-key or query-style) it may be
13623 followed by a comma and options,
13624 The options are lookup-type specific and consist of a comma-separated list.
13625 Each item starts with a tag and and equals "=" sign.
13626 </para>
13627 </listitem>
13628 <listitem>
13629 <para>
13630 <indexterm role="concept">
13631 <primary>domain list</primary>
13632 <secondary>matching literal domain name</secondary>
13633 </indexterm>
13634 If none of the above cases apply, a caseless textual comparison is made
13635 between the pattern and the domain.
13636 </para>
13637 <para>
13638 The value for a match will be the list element string.
13639 <indexterm role="concept">
13640 <primary>tainted data</primary>
13641 <secondary>de-tainting</secondary>
13642 </indexterm>
13643 Note that this is commonly untainted
13644 (depending on the way the list was created).
13645 Specifically, explicit text in the configuration file in not tainted.
13646 This is a useful way of obtaining an untainted equivalent to
13647 the domain, for later operations.
13648 </para>
13649 <para>
13650 However if the list (including one-element lists)
13651 is created by expanding a variable containing tainted data,
13652 it is tainted and so will the match value be.
13653 </para>
13654 </listitem>
13655 </itemizedlist>
13656 <para>
13657 Here is an example that uses several different kinds of pattern:
13658 </para>
13659 <literallayout class="monospaced">
13660 domainlist funny_domains = \
13661   @ : \
13662   lib.unseen.edu : \
13663   *.foundation.fict.example : \
13664   \N^[1-2]\d{3}\.fict\.example$\N : \
13665   partial-dbm;/opt/data/penguin/book : \
13666   nis;domains.byname : \
13667   nisplus;[name=$domain,status=local],domains.org_dir
13668 </literallayout>
13669 <para>
13670 There are obvious processing trade-offs among the various matching modes. Using
13671 an asterisk is faster than a regular expression, and listing a few names
13672 explicitly probably is too. The use of a file or database lookup is expensive,
13673 but may be the only option if hundreds of names are required. Because the
13674 patterns are tested in order, it makes sense to put the most commonly matched
13675 patterns earlier.
13676 </para>
13677 </section>
13678 <section id="SECThostlist">
13679 <title>Host lists</title>
13680 <para>
13681 <indexterm role="concept">
13682 <primary>host list</primary>
13683 <secondary>patterns in</secondary>
13684 </indexterm>
13685 <indexterm role="concept">
13686 <primary>list</primary>
13687 <secondary>host list</secondary>
13688 </indexterm>
13689 Host lists are used to control what remote hosts are allowed to do. For
13690 example, some hosts may be allowed to use the local host as a relay, and some
13691 may be permitted to use the SMTP ETRN command. Hosts can be identified in
13692 two different ways, by name or by IP address. In a host list, some types of
13693 pattern are matched to a host name, and some are matched to an IP address.
13694 You need to be particularly careful with this when single-key lookups are
13695 involved, to ensure that the right value is being used as the key.
13696 </para>
13697 <section id="SECID80">
13698 <title>Special host list patterns</title>
13699 <para>
13700 <indexterm role="concept">
13701 <primary>empty item in hosts list</primary>
13702 </indexterm>
13703 <indexterm role="concept">
13704 <primary>host list</primary>
13705 <secondary>empty string in</secondary>
13706 </indexterm>
13707 If a host list item is the empty string, it matches only when no remote host is
13708 involved. This is the case when a message is being received from a local
13709 process using SMTP on the standard input, that is, when a TCP/IP connection is
13710 not used.
13711 </para>
13712 <para>
13713 <indexterm role="concept">
13714 <primary>asterisk</primary>
13715 <secondary>in host list</secondary>
13716 </indexterm>
13717 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
13718 the IP address nor the name is actually inspected.
13719 </para>
13720 </section>
13721 <section id="SECThoslispatip">
13722 <title>Host list patterns that match by IP address</title>
13723 <para>
13724 <indexterm role="concept">
13725 <primary>host list</primary>
13726 <secondary>matching IP addresses</secondary>
13727 </indexterm>
13728 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
13729 the incoming address actually appears in the IPv6 host as
13730 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
13731 list, it is converted into a traditional IPv4 address first. (Not all operating
13732 systems accept IPv4 calls on IPv6 sockets, as there have been some security
13733 concerns.)
13734 </para>
13735 <para>
13736 The following types of pattern in a host list check the remote host by
13737 inspecting its IP address:
13738 </para>
13739 <itemizedlist>
13740 <listitem>
13741 <para>
13742 If the pattern is a plain domain name (not a regular expression, not starting
13743 with *, not a lookup of any kind), Exim calls the operating system function
13744 to find the associated IP address(es). Exim uses the newer
13745 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
13746 This typically causes a forward DNS lookup of the name. The result is compared
13747 with the IP address of the subject host.
13748 </para>
13749 <para>
13750 If there is a temporary problem (such as a DNS timeout) with the host name
13751 lookup, a temporary error occurs. For example, if the list is being used in an
13752 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
13753 temporary SMTP error code. If no IP address can be found for the host name,
13754 what happens is described in section <xref linkend="SECTbehipnot"/> below.
13755 </para>
13756 </listitem>
13757 <listitem>
13758 <para>
13759 <indexterm role="concept">
13760 <primary>@ in a host list</primary>
13761 </indexterm>
13762 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
13763 domain name, as just described.
13764 </para>
13765 </listitem>
13766 <listitem>
13767 <para>
13768 If the pattern is an IP address, it is matched against the IP address of the
13769 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
13770 IPv6 addresses can be given in colon-separated format, but the colons have to
13771 be doubled so as not to be taken as item separators when the default list
13772 separator is used. IPv6 addresses are recognized even when Exim is compiled
13773 without IPv6 support. This means that if they appear in a host list on an
13774 IPv4-only host, Exim will not treat them as host names. They are just addresses
13775 that can never match a client host.
13776 </para>
13777 </listitem>
13778 <listitem>
13779 <para>
13780 <indexterm role="concept">
13781 <primary>@[] in a host list</primary>
13782 </indexterm>
13783 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
13784 the local host. For example, if the local host is an IPv4 host with one
13785 interface address 10.45.23.56, these two ACL statements have the same effect:
13786 </para>
13787 <literallayout class="monospaced">
13788 accept hosts = 127.0.0.1 : 10.45.23.56
13789 accept hosts = @[]
13790 </literallayout>
13791 </listitem>
13792 <listitem>
13793 <para>
13794 <indexterm role="concept">
13795 <primary>CIDR notation</primary>
13796 </indexterm>
13797 If the pattern is an IP address followed by a slash and a mask length, for
13798 example
13799 </para>
13800 <literallayout class="monospaced">
13801 10.11.42.0/24
13802 </literallayout>
13803 <para>
13804 , it is matched against the IP address of the subject
13805 host under the given mask. This allows an entire network of hosts to be
13806 included (or excluded) by a single item. The mask uses CIDR notation; it
13807 specifies the number of address bits that must match, starting from the most
13808 significant end of the address.
13809 </para>
13810 <para>
13811 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
13812 of a range of addresses. It is the number of bits in the network portion of the
13813 address. The above example specifies a 24-bit netmask, so it matches all 256
13814 addresses in the 10.11.42.0 network. An item such as
13815 </para>
13816 <literallayout class="monospaced">
13817 192.168.23.236/31
13818 </literallayout>
13819 <para>
13820 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
13821 32 for an IPv4 address is the same as no mask at all; just a single address
13822 matches.
13823 </para>
13824 <para>
13825 Here is another example which shows an IPv4 and an IPv6 network:
13826 </para>
13827 <literallayout class="monospaced">
13828 recipient_unqualified_hosts = 192.168.0.0/16: \
13829                               3ffe::ffff::836f::::/48
13830 </literallayout>
13831 <para>
13832 The doubling of list separator characters applies only when these items
13833 appear inline in a host list. It is not required when indirecting via a file.
13834 For example:
13835 </para>
13836 <literallayout class="monospaced">
13837 recipient_unqualified_hosts = /opt/exim/unqualnets
13838 </literallayout>
13839 <para>
13840 could make use of a file containing
13841 </para>
13842 <literallayout class="monospaced">
13843 172.16.0.0/12
13844 3ffe:ffff:836f::/48
13845 </literallayout>
13846 <para>
13847 to have exactly the same effect as the previous example. When listing IPv6
13848 addresses inline, it is usually more convenient to use the facility for
13849 changing separator characters. This list contains the same two networks:
13850 </para>
13851 <literallayout class="monospaced">
13852 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
13853                                  3ffe:ffff:836f::/48
13854 </literallayout>
13855 <para>
13856 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
13857 list.
13858 </para>
13859 </listitem>
13860 </itemizedlist>
13861 </section>
13862 <section id="SECThoslispatsikey">
13863 <title>Host list patterns for single-key lookups by host address</title>
13864 <para>
13865 <indexterm role="concept">
13866 <primary>host list</primary>
13867 <secondary>lookup of IP address</secondary>
13868 </indexterm>
13869 When a host is to be identified by a single-key lookup of its complete IP
13870 address, the pattern takes this form:
13871 </para>
13872 <literallayout>
13873 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
13874 </literallayout>
13875 <para>
13876 For example:
13877 </para>
13878 <literallayout class="monospaced">
13879 hosts_lookup = net-cdb;/hosts-by-ip.db
13880 </literallayout>
13881 <para>
13882 The text form of the IP address of the subject host is used as the lookup key.
13883 IPv6 addresses are converted to an unabbreviated form, using lower case
13884 letters, with dots as separators because colon is the key terminator in
13885 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
13886 quoting the keys, but this is a facility that was added later.] The data
13887 returned by the lookup is not used.
13888 </para>
13889 <para>
13890 <indexterm role="concept">
13891 <primary>IP address</primary>
13892 <secondary>masking</secondary>
13893 </indexterm>
13894 <indexterm role="concept">
13895 <primary>host list</primary>
13896 <secondary>masked IP address</secondary>
13897 </indexterm>
13898 Single-key lookups can also be performed using masked IP addresses, using
13899 patterns of this form:
13900 </para>
13901 <literallayout>
13902 <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>
13903 </literallayout>
13904 <para>
13905 For example:
13906 </para>
13907 <literallayout class="monospaced">
13908 net24-dbm;/networks.db
13909 </literallayout>
13910 <para>
13911 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
13912 length. A textual string is constructed from the masked value, followed by the
13913 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
13914 is 192.168.34.6, the key that is looked up for the above example is
13915 <quote>192.168.34.0/24</quote>.
13916 </para>
13917 <para>
13918 When an IPv6 address is converted to a string, dots are normally used instead
13919 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
13920 terminate <command>lsearch</command> keys). This was implemented some time before the ability
13921 to quote keys was made available in <command>lsearch</command> files. However, the more
13922 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
13923 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
13924 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
13925 converted using colons and not dots.
13926 In all cases except IPv4-mapped IPv6, full, unabbreviated IPv6
13927 addresses are always used.
13928 The latter are converted to IPv4 addresses, in dotted-quad form.
13929 </para>
13930 <para>
13931 Ideally, it would be nice to tidy up this anomalous situation by changing to
13932 colons in all cases, given that quoting is now available for <command>lsearch</command>.
13933 However, this would be an incompatible change that might break some existing
13934 configurations.
13935 </para>
13936 <para>
13937 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
13938 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
13939 the former case the key strings include the mask value, whereas in the latter
13940 case the IP address is used on its own.
13941 </para>
13942 </section>
13943 <section id="SECThoslispatnam">
13944 <title>Host list patterns that match by host name</title>
13945 <para>
13946 <indexterm role="concept">
13947 <primary>host</primary>
13948 <secondary>lookup failures</secondary>
13949 </indexterm>
13950 <indexterm role="concept">
13951 <primary>unknown host name</primary>
13952 </indexterm>
13953 <indexterm role="concept">
13954 <primary>host list</primary>
13955 <secondary>matching host name</secondary>
13956 </indexterm>
13957 There are several types of pattern that require Exim to know the name of the
13958 remote host. These are either wildcard patterns or lookups by name. (If a
13959 complete hostname is given without any wildcarding, it is used to find an IP
13960 address to match against, as described in section <xref linkend="SECThoslispatip"/>
13961 above.)
13962 </para>
13963 <para>
13964 If the remote host name is not already known when Exim encounters one of these
13965 patterns, it has to be found from the IP address.
13966 Although many sites on the Internet are conscientious about maintaining reverse
13967 DNS data for their hosts, there are also many that do not do this.
13968 Consequently, a name cannot always be found, and this may lead to unwanted
13969 effects. Take care when configuring host lists with wildcarded name patterns.
13970 Consider what will happen if a name cannot be found.
13971 </para>
13972 <para>
13973 Because of the problems of determining host names from IP addresses, matching
13974 against host names is not as common as matching against IP addresses.
13975 </para>
13976 <para>
13977 By default, in order to find a host name, Exim first does a reverse DNS lookup;
13978 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
13979 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
13980 are done can be changed by setting the <option>host_lookup_order</option> option. For
13981 security, once Exim has found one or more names, it looks up the IP addresses
13982 for these names and compares them with the IP address that it started with.
13983 Only those names whose IP addresses match are accepted. Any other names are
13984 discarded. If no names are left, Exim behaves as if the host name cannot be
13985 found. In the most common case there is only one name and one IP address.
13986 </para>
13987 <para>
13988 There are some options that control what happens if a host name cannot be
13989 found. These are described in section <xref linkend="SECTbehipnot"/> below.
13990 </para>
13991 <para>
13992 <indexterm role="concept">
13993 <primary>host</primary>
13994 <secondary>alias for</secondary>
13995 </indexterm>
13996 <indexterm role="concept">
13997 <primary>alias for host</primary>
13998 </indexterm>
13999 As a result of aliasing, hosts may have more than one name. When processing any
14000 of the following types of pattern, all the host&#x2019;s names are checked:
14001 </para>
14002 <itemizedlist>
14003 <listitem>
14004 <para>
14005 <indexterm role="concept">
14006 <primary>asterisk</primary>
14007 <secondary>in host list</secondary>
14008 </indexterm>
14009 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
14010 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
14011 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
14012 requirement. Other kinds of wildcarding require the use of a regular
14013 expression.
14014 </para>
14015 </listitem>
14016 <listitem>
14017 <para>
14018 <indexterm role="concept">
14019 <primary>regular expressions</primary>
14020 <secondary>in host list</secondary>
14021 </indexterm>
14022 <indexterm role="concept">
14023 <primary>host list</primary>
14024 <secondary>regular expression in</secondary>
14025 </indexterm>
14026 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
14027 matched against the host name. Host names are case-independent, so this regular
14028 expression match is by default case-independent, but you can make it
14029 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
14030 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
14031 example,
14032 </para>
14033 <literallayout class="monospaced">
14034 ^(a|b)\.c\.d$
14035 </literallayout>
14036 <para>
14037 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
14038 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
14039 that backslash and dollar characters are not misinterpreted as part of the
14040 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
14041 part of the string as non-expandable. For example:
14042 </para>
14043 <literallayout class="monospaced">
14044 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
14045 </literallayout>
14046 <para>
14047 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
14048 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
14049 example. Without it, a match at the start of the host name is all that is
14050 required.
14051 </para>
14052 </listitem>
14053 </itemizedlist>
14054 </section>
14055 <section id="SECTbehipnot">
14056 <title>Behaviour when an IP address or name cannot be found</title>
14057 <para>
14058 <indexterm role="concept">
14059 <primary>host</primary>
14060 <secondary>lookup failures, permanent</secondary>
14061 </indexterm>
14062 While processing a host list, Exim may need to look up an IP address from a
14063 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
14064 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
14065 behaviour when it fails to find the information it is seeking is the same.
14066 </para>
14067 <para>
14068 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
14069 apply to temporary DNS errors, whose handling is described in the next section.
14070 </para>
14071 <para>
14072 <indexterm role="concept">
14073 <primary><literal>+include_unknown</literal></primary>
14074 </indexterm>
14075 <indexterm role="concept">
14076 <primary><literal>+ignore_unknown</literal></primary>
14077 </indexterm>
14078 Exim parses a host list from left to right. If it encounters a permanent
14079 lookup failure in any item in the host list before it has found a match,
14080 Exim treats it as a failure and the default behavior is as if the host
14081 does not match the list. This may not always be what you want to happen.
14082 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
14083 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
14084 not recognized in an indirected file).
14085 </para>
14086 <itemizedlist>
14087 <listitem>
14088 <para>
14089 If any item that follows <literal>+include_unknown</literal> requires information that
14090 cannot found, Exim behaves as if the host does match the list. For example,
14091 </para>
14092 <literallayout class="monospaced">
14093 host_reject_connection = +include_unknown:*.enemy.ex
14094 </literallayout>
14095 <para>
14096 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
14097 any hosts whose name it cannot find.
14098 </para>
14099 </listitem>
14100 <listitem>
14101 <para>
14102 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
14103 be found, Exim ignores that item and proceeds to the rest of the list. For
14104 example:
14105 </para>
14106 <literallayout class="monospaced">
14107 accept hosts = +ignore_unknown : friend.example : \
14108                192.168.4.5
14109 </literallayout>
14110 <para>
14111 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
14112 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
14113 name can be found for 192.168.4.5, it is rejected.
14114 </para>
14115 </listitem>
14116 </itemizedlist>
14117 <para>
14118 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
14119 list. The effect of each one lasts until the next, or until the end of the
14120 list.
14121 </para>
14122 </section>
14123 <section id="SECTmixwilhos">
14124 <title>Mixing wildcarded host names and addresses in host lists</title>
14125 <para>
14126 <indexterm role="concept">
14127 <primary>host list</primary>
14128 <secondary>mixing names and addresses in</secondary>
14129 </indexterm>
14130 </para>
14131 <para>
14132 This section explains the host/ip processing logic with the same concepts
14133 as the previous section, but specifically addresses what happens when a
14134 wildcarded hostname is one of the items in the hostlist.
14135 </para>
14136 <itemizedlist>
14137 <listitem>
14138 <para>
14139 If you have name lookups or wildcarded host names and
14140 IP addresses in the same host list, you should normally put the IP
14141 addresses first. For example, in an ACL you could have:
14142 </para>
14143 <literallayout class="monospaced">
14144 accept hosts = 10.9.8.7 : *.friend.example
14145 </literallayout>
14146 <para>
14147 The reason you normally would order it this way lies in the
14148 left-to-right way that Exim processes lists.  It can test IP addresses
14149 without doing any DNS lookups, but when it reaches an item that requires
14150 a host name, it fails if it cannot find a host name to compare with the
14151 pattern. If the above list is given in the opposite order, the
14152 <option>accept</option> statement fails for a host whose name cannot be found, even
14153 if its IP address is 10.9.8.7.
14154 </para>
14155 </listitem>
14156 <listitem>
14157 <para>
14158 If you really do want to do the name check first, and still recognize the IP
14159 address, you can rewrite the ACL like this:
14160 </para>
14161 <literallayout class="monospaced">
14162 accept hosts = *.friend.example
14163 accept hosts = 10.9.8.7
14164 </literallayout>
14165 <para>
14166 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
14167 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
14168 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
14169 this section.
14170 </para>
14171 </listitem>
14172 </itemizedlist>
14173 </section>
14174 <section id="SECTtemdnserr">
14175 <title>Temporary DNS errors when looking up host information</title>
14176 <para>
14177 <indexterm role="concept">
14178 <primary>host</primary>
14179 <secondary>lookup failures, temporary</secondary>
14180 </indexterm>
14181 <indexterm role="concept">
14182 <primary><literal>+include_defer</literal></primary>
14183 </indexterm>
14184 <indexterm role="concept">
14185 <primary><literal>+ignore_defer</literal></primary>
14186 </indexterm>
14187 A temporary DNS lookup failure normally causes a defer action (except when
14188 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
14189 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
14190 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
14191 section. These options should be used with care, probably only in non-critical
14192 host lists such as whitelists.
14193 </para>
14194 </section>
14195 <section id="SECThoslispatnamsk">
14196 <title>Host list patterns for single-key lookups by host name</title>
14197 <para>
14198 <indexterm role="concept">
14199 <primary>unknown host name</primary>
14200 </indexterm>
14201 <indexterm role="concept">
14202 <primary>host list</primary>
14203 <secondary>matching host name</secondary>
14204 </indexterm>
14205 If a pattern is of the form
14206 </para>
14207 <literallayout>
14208 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
14209 </literallayout>
14210 <para>
14211 for example
14212 </para>
14213 <literallayout class="monospaced">
14214 dbm;/host/accept/list
14215 </literallayout>
14216 <para>
14217 a single-key lookup is performed, using the host name as its key. If the
14218 lookup succeeds, the host matches the item. The actual data that is looked up
14219 is not used.
14220 </para>
14221 <para>
14222 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
14223 keys in the file, not IP addresses. If you want to do lookups based on IP
14224 addresses, you must precede the search type with <quote>net-</quote> (see section
14225 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
14226 two items in the same list, one doing an address lookup and one doing a name
14227 lookup, both using the same file.
14228 </para>
14229 </section>
14230 <section id="SECID81">
14231 <title>Host list patterns for query-style lookups</title>
14232 <para>
14233 If a pattern is of the form
14234 </para>
14235 <literallayout>
14236 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
14237 </literallayout>
14238 <para>
14239 the query is obeyed, and if it succeeds, the host matches the item. The actual
14240 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
14241 <varname>$sender_host_name</varname> can be used in the query. For example:
14242 </para>
14243 <literallayout class="monospaced">
14244 hosts_lookup = pgsql;\
14245   select ip from hostlist where ip='$sender_host_address'
14246 </literallayout>
14247 <para>
14248 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
14249 can use the <option>sg</option> expansion item to change this if you need to. If you want to
14250 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
14251 operator.
14252 </para>
14253 <para>
14254 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
14255 looks up the host name if it has not already done so. (See section
14256 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
14257 </para>
14258 <para>
14259 Historical note: prior to release 4.30, Exim would always attempt to find a
14260 host name before running the query, unless the search type was preceded by
14261 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
14262 still recognized for query-style lookups, but its presence or absence has no
14263 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
14264 See section <xref linkend="SECThoslispatsikey"/>.)
14265 </para>
14266 </section>
14267 </section>
14268 <section id="SECTaddresslist">
14269 <title>Address lists</title>
14270 <para>
14271 <indexterm role="concept">
14272 <primary>list</primary>
14273 <secondary>address list</secondary>
14274 </indexterm>
14275 <indexterm role="concept">
14276 <primary>address list</primary>
14277 <secondary>empty item</secondary>
14278 </indexterm>
14279 <indexterm role="concept">
14280 <primary>address list</primary>
14281 <secondary>patterns</secondary>
14282 </indexterm>
14283 Address lists contain patterns that are matched against mail addresses. There
14284 is one special case to be considered: the sender address of a bounce message is
14285 always empty. You can test for this by providing an empty item in an address
14286 list. For example, you can set up a router to process bounce messages by
14287 using this option setting:
14288 </para>
14289 <literallayout class="monospaced">
14290 senders = :
14291 </literallayout>
14292 <para>
14293 The presence of the colon creates an empty item. If you do not provide any
14294 data, the list is empty and matches nothing. The empty sender can also be
14295 detected by a regular expression that matches an empty string,
14296 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
14297 </para>
14298 <para>
14299 Non-empty items in an address list can be straightforward email addresses. For
14300 example:
14301 </para>
14302 <literallayout class="monospaced">
14303 senders = jbc@askone.example : hs@anacreon.example
14304 </literallayout>
14305 <para>
14306 A certain amount of wildcarding is permitted. If a pattern contains an @
14307 character, but is not a regular expression and does not begin with a
14308 semicolon-terminated lookup type (described below), the local part of the
14309 subject address is compared with the local part of the pattern, which may start
14310 with an asterisk. If the local parts match, the domain is checked in exactly
14311 the same way as for a pattern in a domain list. For example, the domain can be
14312 wildcarded, refer to a named list, or be a lookup:
14313 </para>
14314 <literallayout class="monospaced">
14315 deny senders = *@*.spamming.site:\
14316                *@+hostile_domains:\
14317                bozo@partial-lsearch;/list/of/dodgy/sites:\
14318                *@dbm;/bad/domains.db
14319 </literallayout>
14320 <para>
14321 <indexterm role="concept">
14322 <primary>local part</primary>
14323 <secondary>starting with !</secondary>
14324 </indexterm>
14325 <indexterm role="concept">
14326 <primary>address list</primary>
14327 <secondary>local part starting with !</secondary>
14328 </indexterm>
14329 If a local part that begins with an exclamation mark is required, it has to be
14330 specified using a regular expression, because otherwise the exclamation mark is
14331 treated as a sign of negation, as is standard in lists.
14332 </para>
14333 <para>
14334 If a non-empty pattern that is not a regular expression or a lookup does not
14335 contain an @ character, it is matched against the domain part of the subject
14336 address. The only two formats that are recognized this way are a literal
14337 domain, or a domain pattern that starts with *. In both these cases, the effect
14338 is the same as if <literal>*@</literal> preceded the pattern. For example:
14339 </para>
14340 <literallayout class="monospaced">
14341 deny senders = enemy.domain : *.enemy.domain
14342 </literallayout>
14343 <para>
14344 The following kinds of more complicated address list pattern can match any
14345 address, including the empty address that is characteristic of bounce message
14346 senders:
14347 </para>
14348 <itemizedlist>
14349 <listitem>
14350 <para>
14351 <indexterm role="concept">
14352 <primary>regular expressions</primary>
14353 <secondary>in address list</secondary>
14354 </indexterm>
14355 <indexterm role="concept">
14356 <primary>address list</primary>
14357 <secondary>regular expression in</secondary>
14358 </indexterm>
14359 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
14360 done against the complete address, with the pattern as the regular expression.
14361 You must take care that backslash and dollar characters are not misinterpreted
14362 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
14363 to mark that part of the string as non-expandable. For example:
14364 </para>
14365 <literallayout class="monospaced">
14366 deny senders = \N^.*this.*@example\.com$\N : \
14367                \N^\d{8}.+@spamhaus.example$\N : ...
14368 </literallayout>
14369 <para>
14370 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
14371 start with <quote>^</quote> by the time they are being interpreted as address patterns.
14372 </para>
14373 </listitem>
14374 <listitem>
14375 <para>
14376 <indexterm role="concept">
14377 <primary>address list</primary>
14378 <secondary>lookup for complete address</secondary>
14379 </indexterm>
14380 Complete addresses can be looked up by using a pattern that starts with a
14381 lookup type terminated by a semicolon, followed by the data for the lookup. For
14382 example:
14383 </para>
14384 <literallayout class="monospaced">
14385 deny senders = cdb;/etc/blocked.senders : \
14386   mysql;select address from blocked where \
14387   address='${quote_mysql:$sender_address}'
14388 </literallayout>
14389 <para>
14390 Both query-style and single-key lookup types can be used. For a single-key
14391 lookup type, Exim uses the complete address as the key. However, empty keys are
14392 not supported for single-key lookups, so a match against the empty address
14393 always fails. This restriction does not apply to query-style lookups.
14394 </para>
14395 <para>
14396 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
14397 cannot be used, and is ignored if specified, with an entry being written to the
14398 panic log.
14399 <indexterm role="concept">
14400 <primary>*@ with single-key lookup</primary>
14401 </indexterm>
14402 However, you can configure lookup defaults, as described in section
14403 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
14404 default. For example, with this lookup:
14405 </para>
14406 <literallayout class="monospaced">
14407 accept senders = lsearch*@;/some/file
14408 </literallayout>
14409 <para>
14410 the file could contains lines like this:
14411 </para>
14412 <literallayout class="monospaced">
14413 user1@domain1.example
14414 *@domain2.example
14415 </literallayout>
14416 <para>
14417 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
14418 that are tried is:
14419 </para>
14420 <literallayout class="monospaced">
14421 nimrod@jaeger.example
14422 *@jaeger.example
14423 *
14424 </literallayout>
14425 <para>
14426 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
14427 would mean that every address matches, thus rendering the test useless.
14428 </para>
14429 <para>
14430 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
14431 </para>
14432 <literallayout class="monospaced">
14433 deny recipients = dbm*@;/some/file
14434 deny recipients = *@dbm;/some/file
14435 </literallayout>
14436 <para>
14437 The first does a whole address lookup, with defaulting, as just described,
14438 because it starts with a lookup type. The second matches the local part and
14439 domain independently, as described in a bullet point below.
14440 </para>
14441 </listitem>
14442 </itemizedlist>
14443 <para>
14444 The following kinds of address list pattern can match only non-empty addresses.
14445 If the subject address is empty, a match against any of these pattern types
14446 always fails.
14447 </para>
14448 <itemizedlist>
14449 <listitem>
14450 <para>
14451 <indexterm role="concept">
14452 <primary>@@ with single-key lookup</primary>
14453 </indexterm>
14454 <indexterm role="concept">
14455 <primary>address list</primary>
14456 <secondary>@@ lookup type</secondary>
14457 </indexterm>
14458 <indexterm role="concept">
14459 <primary>address list</primary>
14460 <secondary>split local part and domain</secondary>
14461 </indexterm>
14462 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
14463 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
14464 split into a local part and a domain. The domain is looked up in the file. If
14465 it is not found, there is no match. If it is found, the data that is looked up
14466 from the file is treated as a colon-separated list of local part patterns, each
14467 of which is matched against the subject local part in turn.
14468 </para>
14469 <para>
14470 <indexterm role="concept">
14471 <primary>asterisk</primary>
14472 <secondary>in address list</secondary>
14473 </indexterm>
14474 The lookup may be a partial one, and/or one involving a search for a default
14475 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
14476 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
14477 even be further lookups. They may also be independently negated. For example,
14478 with
14479 </para>
14480 <literallayout class="monospaced">
14481 deny senders = @@dbm;/etc/reject-by-domain
14482 </literallayout>
14483 <para>
14484 the data from which the DBM file is built could contain lines like
14485 </para>
14486 <literallayout class="monospaced">
14487 baddomain.com:  !postmaster : *
14488 </literallayout>
14489 <para>
14490 to reject all senders except <option>postmaster</option> from that domain.
14491 </para>
14492 <para>
14493 <indexterm role="concept">
14494 <primary>local part</primary>
14495 <secondary>starting with !</secondary>
14496 </indexterm>
14497 If a local part that actually begins with an exclamation mark is required, it
14498 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
14499 may be split over several lines by indenting the second and subsequent lines,
14500 but the separating colon must still be included at line breaks. White space
14501 surrounding the colons is ignored. For example:
14502 </para>
14503 <literallayout class="monospaced">
14504 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
14505   spammer3 : spammer4
14506 </literallayout>
14507 <para>
14508 As in all colon-separated lists in Exim, a colon can be included in an item by
14509 doubling.
14510 </para>
14511 <para>
14512 If the last item in the list starts with a right angle-bracket, the remainder
14513 of the item is taken as a new key to look up in order to obtain a continuation
14514 list of local parts. The new key can be any sequence of characters. Thus one
14515 might have entries like
14516 </para>
14517 <literallayout class="monospaced">
14518 aol.com: spammer1 : spammer 2 : &gt;*
14519 xyz.com: spammer3 : &gt;*
14520 *:       ^\d{8}$
14521 </literallayout>
14522 <para>
14523 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
14524 local parts for all domains, in addition to the specific local parts listed for
14525 each domain. Of course, using this feature costs another lookup each time a
14526 chain is followed, but the effort needed to maintain the data is reduced.
14527 </para>
14528 <para>
14529 <indexterm role="concept">
14530 <primary>loop</primary>
14531 <secondary>in lookups</secondary>
14532 </indexterm>
14533 It is possible to construct loops using this facility, and in order to catch
14534 them, the chains may be no more than fifty items long.
14535 </para>
14536 </listitem>
14537 <listitem>
14538 <para>
14539 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
14540 lookup, but in this case, the chaining facility is not available. The lookup
14541 can only return a single list of local parts.
14542 </para>
14543 </listitem>
14544 </itemizedlist>
14545 <para>
14546 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
14547 in these two examples:
14548 </para>
14549 <literallayout class="monospaced">
14550 senders = +my_list
14551 senders = *@+my_list
14552 </literallayout>
14553 <para>
14554 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
14555 example it is a named domain list.
14556 </para>
14557 <section id="SECTcasletadd">
14558 <title>Case of letters in address lists</title>
14559 <para>
14560 <indexterm role="concept">
14561 <primary>case of local parts</primary>
14562 </indexterm>
14563 <indexterm role="concept">
14564 <primary>address list</primary>
14565 <secondary>case forcing</secondary>
14566 </indexterm>
14567 <indexterm role="concept">
14568 <primary>case forcing in address lists</primary>
14569 </indexterm>
14570 Domains in email addresses are always handled caselessly, but for local parts
14571 case may be significant on some systems (see <option>caseful_local_part</option> for how
14572 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
14573 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
14574 blocking lists should be done in a case-independent manner. Since most address
14575 lists in Exim are used for this kind of control, Exim attempts to do this by
14576 default.
14577 </para>
14578 <para>
14579 The domain portion of an address is always lowercased before matching it to an
14580 address list. The local part is lowercased by default, and any string
14581 comparisons that take place are done caselessly. This means that the data in
14582 the address list itself, in files included as plain filenames, and in any file
14583 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
14584 keys in files that are looked up by a search type other than <command>lsearch</command> (which
14585 works caselessly) must be in lower case, because these lookups are not
14586 case-independent.
14587 </para>
14588 <para>
14589 <indexterm role="concept">
14590 <primary><literal>+caseful</literal></primary>
14591 </indexterm>
14592 To allow for the possibility of caseful address list matching, if an item in
14593 an address list is the string <quote>+caseful</quote>, the original case of the local
14594 part is restored for any comparisons that follow, and string comparisons are no
14595 longer case-independent. This does not affect the domain, which remains in
14596 lower case. However, although independent matches on the domain alone are still
14597 performed caselessly, regular expressions that match against an entire address
14598 become case-sensitive after <quote>+caseful</quote> has been seen.
14599 </para>
14600 </section>
14601 </section>
14602 <section id="SECTlocparlis">
14603 <title>Local part lists</title>
14604 <para>
14605 <indexterm role="concept">
14606 <primary>list</primary>
14607 <secondary>local part list</secondary>
14608 </indexterm>
14609 <indexterm role="concept">
14610 <primary>local part</primary>
14611 <secondary>list</secondary>
14612 </indexterm>
14613 These behave in the same way as domain and host lists, with the following
14614 changes:
14615 </para>
14616 <para>
14617 Case-sensitivity in local part lists is handled in the same way as for address
14618 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
14619 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
14620 set false, the subject is lowercased and the matching is initially
14621 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
14622 matching in the local part list, but not elsewhere in the router. If
14623 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
14624 option is case-sensitive from the start.
14625 </para>
14626 <para>
14627 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
14628 comments are handled in the same way as address lists &ndash; they are recognized
14629 only if the # is preceded by white space or the start of the line.
14630 Otherwise, local part lists are matched in the same way as domain lists, except
14631 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
14632 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
14633 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
14634 types.
14635 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
14636 </para>
14637 </section>
14638 </chapter>
14639
14640 <chapter id="CHAPexpand">
14641 <title>String expansions</title>
14642 <para>
14643 <indexterm role="concept" id="IIDstrexp" class="startofrange">
14644 <primary>expansion</primary>
14645 <secondary>of strings</secondary>
14646 </indexterm>
14647 Many strings in Exim&#x2019;s runtime configuration are expanded before use. Some of
14648 them are expanded every time they are used; others are expanded only once.
14649 </para>
14650 <para>
14651 When a string is being expanded it is copied verbatim from left to right except
14652 <indexterm role="concept">
14653 <primary>expansion</primary>
14654 <secondary>string concatenation</secondary>
14655 </indexterm>
14656 when a dollar or backslash character is encountered. A dollar specifies the
14657 start of a portion of the string that is interpreted and replaced as described
14658 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
14659 escape character, as described in the following section.
14660 </para>
14661 <para>
14662 Whether a string is expanded depends upon the context.  Usually this is solely
14663 dependent upon the option for which a value is sought; in this documentation,
14664 options for which string expansion is performed are marked with &dagger; after
14665 the data type.  ACL rules always expand strings.  A couple of expansion
14666 conditions do not expand some of the brace-delimited branches, for security
14667 reasons,
14668 <indexterm role="concept">
14669 <primary>tainted data</primary>
14670 <secondary>expansion</secondary>
14671 </indexterm>
14672 <indexterm role="concept">
14673 <primary>tainted data</primary>
14674 <secondary>definition</secondary>
14675 </indexterm>
14676 <indexterm role="concept">
14677 <primary>expansion</primary>
14678 <secondary>tainted data</secondary>
14679 </indexterm>
14680 and expansion of data deriving from the sender (<quote>tainted data</quote>)
14681 is not permitted (including acessing a file using a tainted name).
14682 </para>
14683 <para>
14684 Common ways of obtaining untainted equivalents of variables with
14685 tainted values
14686 <indexterm role="concept">
14687 <primary>tainted data</primary>
14688 <secondary>de-tainting</secondary>
14689 </indexterm>
14690 come down to using the tainted value as a lookup key in a trusted database.
14691 This database could be the filesystem structure,
14692 or the password file,
14693 or accessed via a DBMS.
14694 Specific methods are indexed under <quote>de-tainting</quote>.
14695 </para>
14696 <section id="SECTlittext">
14697 <title>Literal text in expanded strings</title>
14698 <para>
14699 <indexterm role="concept">
14700 <primary>expansion</primary>
14701 <secondary>including literal text</secondary>
14702 </indexterm>
14703 An uninterpreted dollar can be included in an expanded string by putting a
14704 backslash in front of it. A backslash can be used to prevent any special
14705 character being treated specially in an expansion, including backslash itself.
14706 If the string appears in quotes in the configuration file, two backslashes are
14707 required because the quotes themselves cause interpretation of backslashes when
14708 the string is read in (see section <xref linkend="SECTstrings"/>).
14709 </para>
14710 <para>
14711 <indexterm role="concept">
14712 <primary>expansion</primary>
14713 <secondary>non-expandable substrings</secondary>
14714 </indexterm>
14715 A portion of the string can specified as non-expandable by placing it between
14716 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
14717 expressions, which often contain backslashes and dollar signs. For example:
14718 </para>
14719 <literallayout class="monospaced">
14720 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
14721 </literallayout>
14722 <para>
14723 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
14724 without interpretation until it reaches the next <literal>\N</literal> or the end of the
14725 string.
14726 </para>
14727 </section>
14728 <section id="SECID82">
14729 <title>Character escape sequences in expanded strings</title>
14730 <para>
14731 <indexterm role="concept">
14732 <primary>expansion</primary>
14733 <secondary>escape sequences</secondary>
14734 </indexterm>
14735 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
14736 expanded string is recognized as an escape sequence for the character newline,
14737 carriage return, or tab, respectively. A backslash followed by up to three
14738 octal digits is recognized as an octal encoding for a single character, and a
14739 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
14740 encoding.
14741 </para>
14742 <para>
14743 These escape sequences are also recognized in quoted strings when they are read
14744 in. Their interpretation in expansions as well is useful for unquoted strings,
14745 and for other cases such as looked-up strings that are then expanded.
14746 </para>
14747 </section>
14748 <section id="SECID83">
14749 <title>Testing string expansions</title>
14750 <para>
14751 <indexterm role="concept">
14752 <primary>expansion</primary>
14753 <secondary>testing</secondary>
14754 </indexterm>
14755 <indexterm role="concept">
14756 <primary>testing</primary>
14757 <secondary>string expansion</secondary>
14758 </indexterm>
14759 <indexterm role="option">
14760 <primary><option>-be</option></primary>
14761 </indexterm>
14762 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
14763 takes the command arguments, or lines from the standard input if there are no
14764 arguments, runs them through the string expansion code, and writes the results
14765 to the standard output. Variables based on configuration values are set up, but
14766 since no message is being processed, variables such as <varname>$local_part</varname> have no
14767 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
14768 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
14769 and <option>nhash</option>.
14770 </para>
14771 <para revisionflag="changed">
14772 When reading lines from the standard input,
14773 macros can be defined and ACL variables can be set.
14774 For example:
14775 </para>
14776 <literallayout class="monospaced" revisionflag="changed">
14777 MY_MACRO = foo
14778 set acl_m_myvar = bar
14779 </literallayout>
14780 <para revisionflag="changed">
14781 Such macros and variables can then be used in later input lines.
14782 </para>
14783 <para>
14784 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
14785 instead runs under the uid and gid it was called with, to prevent users from
14786 using <option>-be</option> for reading files to which they do not have access.
14787 </para>
14788 <para>
14789 <indexterm role="option">
14790 <primary><option>-bem</option></primary>
14791 </indexterm>
14792 If you want to test expansions that include variables whose values are taken
14793 from a message, there are two other options that can be used. The <option>-bem</option>
14794 option is like <option>-be</option> except that it is followed by a filename. The file is
14795 read as a message before doing the test expansions. For example:
14796 </para>
14797 <literallayout class="monospaced">
14798 exim -bem /tmp/test.message '$h_subject:'
14799 </literallayout>
14800 <para>
14801 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
14802 Exim message identifier. For example:
14803 </para>
14804 <literallayout class="monospaced">
14805 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
14806 </literallayout>
14807 <para>
14808 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
14809 is therefore restricted to admin users.
14810 </para>
14811 </section>
14812 <section id="SECTforexpfai">
14813 <title>Forced expansion failure</title>
14814 <para>
14815 <indexterm role="concept">
14816 <primary>expansion</primary>
14817 <secondary>forced failure</secondary>
14818 </indexterm>
14819 A number of expansions that are described in the following section have
14820 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
14821 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
14822 used depends on some condition that is evaluated as part of the expansion. If,
14823 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
14824 the entire string expansion fails in a way that can be detected by the code
14825 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
14826 its consequences depend on the circumstances. In some cases it is no different
14827 from any other expansion failure, but in others a different action may be
14828 taken. Such variations are mentioned in the documentation of the option that is
14829 being expanded.
14830 </para>
14831 </section>
14832 <section id="SECTexpansionitems">
14833 <title>Expansion items</title>
14834 <para>
14835 The following items are recognized in expanded strings. White space may be used
14836 between sub-items that are keywords or substrings enclosed in braces inside an
14837 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
14838 white space is significant.
14839 </para>
14840 <variablelist>
14841 <varlistentry>
14842 <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>
14843 <listitem>
14844 <para>
14845 <indexterm role="concept">
14846 <primary>expansion</primary>
14847 <secondary>variables</secondary>
14848 </indexterm>
14849 Substitute the contents of the named variable, for example:
14850 </para>
14851 <literallayout class="monospaced">
14852 $local_part
14853 ${domain}
14854 </literallayout>
14855 <para>
14856 The second form can be used to separate the name from subsequent alphanumeric
14857 characters. This form (using braces) is available only for variables; it does
14858 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
14859 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
14860 given, the expansion fails.
14861 </para>
14862 </listitem></varlistentry>
14863 <varlistentry>
14864 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14865 <listitem>
14866 <para>
14867 <indexterm role="concept">
14868 <primary>expansion</primary>
14869 <secondary>operators</secondary>
14870 </indexterm>
14871 The string is first itself expanded, and then the operation specified by
14872 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
14873 </para>
14874 <literallayout class="monospaced">
14875 ${lc:$local_part}
14876 </literallayout>
14877 <para>
14878 The string starts with the first character after the colon, which may be
14879 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
14880 below. The operator notation is used for simple expansion items that have just
14881 one argument, because it reduces the number of braces and therefore makes the
14882 string easier to understand.
14883 </para>
14884 </listitem></varlistentry>
14885 <varlistentry>
14886 <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>
14887 <listitem>
14888 <para>
14889 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
14890 expansion item below.
14891 </para>
14892 </listitem></varlistentry>
14893 <varlistentry>
14894 <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>
14895 <listitem>
14896 <para>
14897 <indexterm role="concept">
14898 <primary>expansion</primary>
14899 <secondary>calling an acl</secondary>
14900 </indexterm>
14901 <indexterm role="concept">
14902 <primary><option>acl</option></primary>
14903 <secondary>call from expansion</secondary>
14904 </indexterm>
14905 The name and zero to nine argument strings are first expanded separately.  The expanded
14906 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
14907 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
14908 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
14909 and may use the variables; if another acl expansion is used the values
14910 are restored after it returns.  If the ACL sets
14911 a value using a "message =" modifier and returns accept or deny, the value becomes
14912 the result of the expansion.
14913 If no message is set and the ACL returns accept or deny
14914 the expansion result is an empty string.
14915 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
14916 </para>
14917 </listitem></varlistentry>
14918 <varlistentry>
14919 <term><emphasis role="bold">${authresults{</emphasis>&lt;<emphasis>authserv-id</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14920 <listitem>
14921 <para>
14922 <indexterm role="concept">
14923 <primary>authentication</primary>
14924 <secondary>results header</secondary>
14925 </indexterm>
14926 <indexterm role="concept">
14927 <primary><emphasis>Authentication-Results:</emphasis> header line</primary>
14928 </indexterm>
14929 <indexterm role="concept">
14930 <primary>header lines</primary>
14931 <secondary>Authentication-Results:</secondary>
14932 </indexterm>
14933 <indexterm role="concept">
14934 <primary>authentication</primary>
14935 <secondary>expansion item</secondary>
14936 </indexterm>
14937 This item returns a string suitable for insertion as an
14938 <emphasis>Authentication-Results:</emphasis>
14939 header line.
14940 The given &lt;<emphasis>authserv-id</emphasis>&gt; is included in the result; typically this
14941 will be a domain name identifying the system performing the authentications.
14942 Methods that might be present in the result include:
14943 </para>
14944 <literallayout class="monospaced">
14945 none
14946 iprev
14947 auth
14948 spf
14949 dkim
14950 </literallayout>
14951 <para>
14952 Example use (as an ACL modifier):
14953 </para>
14954 <literallayout class="monospaced">
14955       add_header = :at_start:${authresults {$primary_hostname}}
14956 </literallayout>
14957 <para>
14958 This is safe even if no authentication results are available
14959 </para>
14960 <para revisionflag="changed">
14961 and would generally be placed in the DATA ACL.
14962 </para>
14963 </listitem></varlistentry>
14964 <varlistentry>
14965 <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>
14966 <listitem>
14967 <para>
14968 <indexterm role="concept">
14969 <primary>expansion</primary>
14970 <secondary>extracting certificate fields</secondary>
14971 </indexterm>
14972 <indexterm role="concept">
14973 <primary><option>certextract</option></primary>
14974 <secondary>certificate fields</secondary>
14975 </indexterm>
14976 <indexterm role="concept">
14977 <primary>certificate</primary>
14978 <secondary>extracting fields</secondary>
14979 </indexterm>
14980 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
14981 The field name is expanded and used to retrieve the relevant field from
14982 the certificate.  Supported fields are:
14983 </para>
14984 <literallayout>
14985 <literal>version        </literal>
14986 <literal>serial_number  </literal>
14987 <literal>subject        </literal> RFC4514 DN
14988 <literal>issuer         </literal> RFC4514 DN
14989 <literal>notbefore      </literal> time
14990 <literal>notafter       </literal> time
14991 <literal>sig_algorithm  </literal>
14992 <literal>signature      </literal>
14993 <literal>subj_altname   </literal> tagged list
14994 <literal>ocsp_uri       </literal> list
14995 <literal>crl_uri        </literal> list
14996 </literallayout>
14997 <para>
14998 If the field is found,
14999 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
15000 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
15001 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
15002 is restored to any previous value it might have had.
15003 </para>
15004 <para>
15005 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
15006 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
15007 extracted is used.
15008 </para>
15009 <para>
15010 Some field names take optional modifiers, appended and separated by commas.
15011 </para>
15012 <para>
15013 The field selectors marked as "RFC4514" above
15014 output a Distinguished Name string which is
15015 not quite
15016 parseable by Exim as a comma-separated tagged list
15017 (the exceptions being elements containing commas).
15018 RDN elements of a single type may be selected by
15019 a modifier of the type label; if so the expansion
15020 result is a list (newline-separated by default).
15021 The separator may be changed by another modifier of
15022 a right angle-bracket followed immediately by the new separator.
15023 Recognised RDN type labels include "CN", "O", "OU" and "DC".
15024 </para>
15025 <para>
15026 The field selectors marked as "time" above
15027 take an optional modifier of "int"
15028 for which the result is the number of seconds since epoch.
15029 Otherwise the result is a human-readable string
15030 in the timezone selected by the main "timezone" option.
15031 </para>
15032 <para>
15033 The field selectors marked as "list" above return a list,
15034 newline-separated by default,
15035 (embedded separator characters in elements are doubled).
15036 The separator may be changed by a modifier of
15037 a right angle-bracket followed immediately by the new separator.
15038 </para>
15039 <para>
15040 The field selectors marked as "tagged" above
15041 prefix each list element with a type string and an equals sign.
15042 Elements of only one type may be selected by a modifier
15043 which is one of "dns", "uri" or "mail";
15044 if so the element tags are omitted.
15045 </para>
15046 <para>
15047 If not otherwise noted field values are presented in human-readable form.
15048 </para>
15049 </listitem></varlistentry>
15050 <varlistentry>
15051 <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>
15052 <listitem>
15053 <para>
15054 <indexterm role="concept">
15055 <primary><option>dlfunc</option></primary>
15056 </indexterm>
15057 This expansion dynamically loads and then calls a locally-written C function.
15058 This functionality is available only if Exim is compiled with
15059 </para>
15060 <literallayout class="monospaced">
15061 EXPAND_DLFUNC=yes
15062 </literallayout>
15063 <para>
15064 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
15065 object so that it doesn&#x2019;t reload the same object file in the same Exim process
15066 (but of course Exim does start new processes frequently).
15067 </para>
15068 <para>
15069 There may be from zero to eight arguments to the function.
15070 </para>
15071 <para>
15072 When compiling
15073 a local function that is to be called in this way,
15074 first <filename>DLFUNC_IMPL</filename> should be defined,
15075 and second <filename>local_scan.h</filename> should be included.
15076 The Exim variables and functions that are defined by that API
15077 are also available for dynamically loaded functions. The function itself
15078 must have the following type:
15079 </para>
15080 <literallayout class="monospaced">
15081 int dlfunction(uschar **yield, int argc, uschar *argv[])
15082 </literallayout>
15083 <para>
15084 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
15085 function should return one of the following values:
15086 </para>
15087 <para>
15088 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
15089 into the expanded string that is being built.
15090 </para>
15091 <para>
15092 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
15093 from <emphasis>yield</emphasis>, if it is set.
15094 </para>
15095 <para>
15096 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
15097 taken from <emphasis>yield</emphasis> if it is set.
15098 </para>
15099 <para>
15100 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
15101 </para>
15102 <para>
15103 When compiling a function that is to be used in this way with gcc,
15104 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
15105 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
15106 </para>
15107 </listitem></varlistentry>
15108 <varlistentry>
15109 <term><emphasis role="bold">${env{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15110 <listitem>
15111 <para>
15112 <indexterm role="concept">
15113 <primary>expansion</primary>
15114 <secondary>extracting value from environment</secondary>
15115 </indexterm>
15116 <indexterm role="concept">
15117 <primary>environment</primary>
15118 <secondary>values from</secondary>
15119 </indexterm>
15120 The key is first expanded separately, and leading and trailing white space
15121 removed.
15122 This is then searched for as a name in the environment.
15123 If a variable is found then its value is placed in <varname>$value</varname>
15124 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
15125 </para>
15126 <para>
15127 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
15128 appear, for example:
15129 </para>
15130 <literallayout class="monospaced">
15131 ${env{USER}{$value} fail }
15132 </literallayout>
15133 <para>
15134 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
15135 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
15136 </para>
15137 <para>
15138 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
15139 search failure.
15140 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
15141 search success.
15142 </para>
15143 <para>
15144 The environment is adjusted by the <option>keep_environment</option> and
15145 <option>add_environment</option> main section options.
15146 </para>
15147 </listitem></varlistentry>
15148 <varlistentry>
15149 <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>
15150 <listitem>
15151 <para>
15152 <indexterm role="concept">
15153 <primary>expansion</primary>
15154 <secondary>extracting substrings by key</secondary>
15155 </indexterm>
15156 <indexterm role="concept">
15157 <primary><option>extract</option></primary>
15158 <secondary>substrings by key</secondary>
15159 </indexterm>
15160 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
15161 white space is removed from the key (but not from any of the strings). The key
15162 must not be empty and must not consist entirely of digits.
15163 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
15164 </para>
15165 <literallayout>
15166 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
15167 </literallayout>
15168 <para>
15169 <indexterm role="variable">
15170 <primary><varname>$value</varname></primary>
15171 </indexterm>
15172 where the equals signs and spaces (but not both) are optional. If any of the
15173 values contain white space, they must be enclosed in double quotes, and any
15174 values that are enclosed in double quotes are subject to escape processing as
15175 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
15176 for the value that corresponds to the key. The search is case-insensitive. If
15177 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
15178 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
15179 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
15180 is restored to any previous value it might have had.
15181 </para>
15182 <para>
15183 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
15184 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
15185 extracted is used. Thus, for example, these two expansions are identical, and
15186 yield <quote>2001</quote>:
15187 </para>
15188 <literallayout class="monospaced">
15189 ${extract{gid}{uid=1984 gid=2001}}
15190 ${extract{gid}{uid=1984 gid=2001}{$value}}
15191 </literallayout>
15192 <para>
15193 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
15194 appear, for example:
15195 </para>
15196 <literallayout class="monospaced">
15197 ${extract{Z}{A=... B=...}{$value} fail }
15198 </literallayout>
15199 <para>
15200 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
15201 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
15202 </para>
15203 </listitem></varlistentry>
15204 <varlistentry>
15205 <term><emphasis role="bold">${extract json{</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>
15206 <term><emphasis role="bold">${extract jsons{</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>
15207 <listitem>
15208 <para>
15209 <indexterm role="concept">
15210 <primary>expansion</primary>
15211 <secondary>extracting from JSON object</secondary>
15212 </indexterm>
15213 <indexterm role="concept">
15214 <primary>JSON</primary>
15215 <secondary>expansions</secondary>
15216 </indexterm>
15217 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
15218 white space is removed from the key (but not from any of the strings). The key
15219 must not be empty and must not consist entirely of digits.
15220 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
15221 </para>
15222 <literallayout>
15223 { &lt;<emphasis>"key1"</emphasis>&gt; : &lt;<emphasis>value1</emphasis>&gt; ,  &lt;<emphasis>"key2"</emphasis>&gt; , &lt;<emphasis>value2</emphasis>&gt; ... }
15224 </literallayout>
15225 <para>
15226 <indexterm role="variable">
15227 <primary><varname>$value</varname></primary>
15228 </indexterm>
15229 The braces, commas and colons, and the quoting of the member name are required;
15230 the spaces are optional.
15231 Matching of the key against the member names is done case-sensitively.
15232 For the <quote>json</quote> variant,
15233 if a returned value is a JSON string, it retains its leading and
15234 trailing quotes.
15235 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
15236 leading and trailing quotes are removed from the returned value.
15237 </para>
15238 <para>
15239 The results of matching are handled as above.
15240 </para>
15241 </listitem></varlistentry>
15242 <varlistentry>
15243 <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>
15244 <listitem>
15245 <para>
15246 <indexterm role="concept">
15247 <primary>expansion</primary>
15248 <secondary>extracting substrings by number</secondary>
15249 </indexterm>
15250 <indexterm role="concept">
15251 <primary><option>extract</option></primary>
15252 <secondary>substrings by number</secondary>
15253 </indexterm>
15254 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15255 apart from leading and trailing white space, which is ignored.
15256 This is what distinguishes this form of <option>extract</option> from the previous kind. It
15257 behaves in the same way, except that, instead of extracting a named field, it
15258 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
15259 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
15260 &lt;<emphasis>string3</emphasis>&gt; as before.
15261 </para>
15262 <para>
15263 The fields in the string are separated by any one of the characters in the
15264 separator string. These may include space or tab characters.
15265 The first field is numbered one. If the number is negative, the fields are
15266 counted from the end of the string, with the rightmost one numbered -1. If the
15267 number given is zero, the entire string is returned. If the modulus of the
15268 number is greater than the number of fields in the string, the result is the
15269 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
15270 provided. For example:
15271 </para>
15272 <literallayout class="monospaced">
15273 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
15274 </literallayout>
15275 <para>
15276 yields <quote>42</quote>, and
15277 </para>
15278 <literallayout class="monospaced">
15279 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
15280 </literallayout>
15281 <para>
15282 yields <quote>99</quote>. Two successive separators mean that the field between them is
15283 empty (for example, the fifth field above).
15284 </para>
15285 </listitem></varlistentry>
15286 <varlistentry>
15287 <term><emphasis role="bold">${extract json {</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>
15288 <term><emphasis role="bold">${extract jsons{</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>
15289 <listitem>
15290 <para>
15291 <indexterm role="concept">
15292 <primary>expansion</primary>
15293 <secondary>extracting from JSON array</secondary>
15294 </indexterm>
15295 <indexterm role="concept">
15296 <primary>JSON</primary>
15297 <secondary>expansions</secondary>
15298 </indexterm>
15299 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15300 apart from leading and trailing white space, which is ignored.
15301 </para>
15302 <para>
15303 Field selection and result handling is as above;
15304 there is no choice of field separator.
15305 For the <quote>json</quote> variant,
15306 if a returned value is a JSON string, it retains its leading and
15307 trailing quotes.
15308 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
15309 leading and trailing quotes are removed from the returned value.
15310 </para>
15311 </listitem></varlistentry>
15312 <varlistentry>
15313 <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>
15314 <listitem>
15315 <para>
15316 <indexterm role="concept">
15317 <primary>list</primary>
15318 <secondary>selecting by condition</secondary>
15319 </indexterm>
15320 <indexterm role="concept">
15321 <primary>expansion</primary>
15322 <secondary>selecting from list by condition</secondary>
15323 </indexterm>
15324 <indexterm role="variable">
15325 <primary><varname>$item</varname></primary>
15326 </indexterm>
15327 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
15328 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15329 For each item
15330 in this list, its value is placed in <varname>$item</varname>, and then the condition is
15331 evaluated.
15332 </para>
15333 <para revisionflag="changed">
15334 Any modification of <varname>$value</varname> by this evaluation is discarded.
15335 </para>
15336 <para>
15337 If the condition is true, <varname>$item</varname> is added to the output as an
15338 item in a new list; if the condition is false, the item is discarded. The
15339 separator used for the output list is the same as the one used for the
15340 input, but a separator setting is not included in the output. For example:
15341 </para>
15342 <literallayout class="monospaced">
15343 ${filter{a:b:c}{!eq{$item}{b}}}
15344 </literallayout>
15345 <para>
15346 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
15347 to what it was before.
15348 See also the <option>map</option> and <option>reduce</option> expansion items.
15349 </para>
15350 </listitem></varlistentry>
15351 <varlistentry>
15352 <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>
15353 <listitem>
15354 <para>
15355 <indexterm role="concept">
15356 <primary>hash function</primary>
15357 <secondary>textual</secondary>
15358 </indexterm>
15359 <indexterm role="concept">
15360 <primary>expansion</primary>
15361 <secondary>textual hash</secondary>
15362 </indexterm>
15363 This is a textual hashing function, and was the first to be implemented in
15364 early versions of Exim. In current releases, there are other hashing functions
15365 (numeric, MD5, and SHA-1), which are described below.
15366 </para>
15367 <para>
15368 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
15369 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
15370 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
15371 use the simpler operator notation that avoids some of the braces:
15372 </para>
15373 <literallayout class="monospaced">
15374 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15375 </literallayout>
15376 <para>
15377 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
15378 or equal to the length of the string, the expansion item returns the string.
15379 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
15380 function to the string. The new string consists of characters taken from the
15381 first &lt;<emphasis>m</emphasis>&gt; characters of the string
15382 </para>
15383 <literallayout class="monospaced">
15384 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
15385 </literallayout>
15386 <para>
15387 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
15388 letters appear. For example:
15389 </para>
15390 <literallayout>
15391 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
15392 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
15393 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
15394 </literallayout>
15395 </listitem></varlistentry>
15396 <varlistentry>
15397 <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>
15398 <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>
15399 <term><emphasis role="bold">$lheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$lh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
15400 <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>
15401 <listitem>
15402 <para>
15403 <indexterm role="concept">
15404 <primary>expansion</primary>
15405 <secondary>header insertion</secondary>
15406 </indexterm>
15407 <indexterm role="variable">
15408 <primary><varname>$header_</varname></primary>
15409 </indexterm>
15410 <indexterm role="variable">
15411 <primary><varname>$bheader_</varname></primary>
15412 </indexterm>
15413 <indexterm role="variable">
15414 <primary><varname>$lheader_</varname></primary>
15415 </indexterm>
15416 <indexterm role="variable">
15417 <primary><varname>$rheader_</varname></primary>
15418 </indexterm>
15419 <indexterm role="concept">
15420 <primary>header lines</primary>
15421 <secondary>in expansion strings</secondary>
15422 </indexterm>
15423 <indexterm role="concept">
15424 <primary>header lines</primary>
15425 <secondary>character sets</secondary>
15426 </indexterm>
15427 <indexterm role="concept">
15428 <primary>header lines</primary>
15429 <secondary>decoding</secondary>
15430 </indexterm>
15431 Substitute the contents of the named message header line, for example
15432 </para>
15433 <literallayout class="monospaced">
15434 $header_reply-to:
15435 </literallayout>
15436 <para>
15437 The newline that terminates a header line is not included in the expansion, but
15438 internal newlines (caused by splitting the header line over several physical
15439 lines) may be present.
15440 </para>
15441 <para>
15442 The difference between the four pairs of expansions is in the way
15443 the data in the header line is interpreted.
15444 </para>
15445 <itemizedlist>
15446 <listitem>
15447 <para>
15448 <indexterm role="concept">
15449 <primary>white space</primary>
15450 <secondary>in header lines</secondary>
15451 </indexterm>
15452 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
15453 processing at all, and without the removal of leading and trailing white space.
15454 </para>
15455 </listitem>
15456 <listitem>
15457 <para>
15458 <indexterm role="concept">
15459 <primary>list</primary>
15460 <secondary>of header lines</secondary>
15461 </indexterm>
15462 <option>lheader</option> gives a colon-separated list, one element per header when there
15463 are multiple headers with a given name.
15464 Any embedded colon characters within an element are doubled, so normal Exim
15465 list-processing facilities can be used.
15466 The terminating newline of each element is removed; in other respects
15467 the content is <quote>raw</quote>.
15468 </para>
15469 </listitem>
15470 <listitem>
15471 <para>
15472 <indexterm role="concept">
15473 <primary>base64 encoding</primary>
15474 <secondary>in header lines</secondary>
15475 </indexterm>
15476 <option>bheader</option> removes leading and trailing white space, and then decodes base64
15477 or quoted-printable MIME <quote>words</quote> within the header text, but does no
15478 character set translation. If decoding of what looks superficially like a MIME
15479 <quote>word</quote> fails, the raw string is returned. If decoding
15480 <indexterm role="concept">
15481 <primary>binary zero</primary>
15482 <secondary>in header line</secondary>
15483 </indexterm>
15484 produces a binary zero character, it is replaced by a question mark &ndash; this is
15485 what Exim does for binary zeros that are actually received in header lines.
15486 </para>
15487 </listitem>
15488 <listitem>
15489 <para>
15490 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
15491 standard character set. This is an attempt to produce the same string as would
15492 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
15493 returned. Translation is attempted only on operating systems that support the
15494 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
15495 a system Makefile or in <filename>Local/Makefile</filename>.
15496 </para>
15497 </listitem>
15498 </itemizedlist>
15499 <para>
15500 In a filter file, the target character set for <option>header</option> can be specified by a
15501 command of the following form:
15502 </para>
15503 <literallayout class="monospaced">
15504 headers charset "UTF-8"
15505 </literallayout>
15506 <para>
15507 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
15508 subsequently obeyed filter commands. In the absence of this command, the target
15509 character set in a filter is taken from the setting of the <option>headers_charset</option>
15510 option in the runtime configuration. The value of this option defaults to the
15511 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
15512 ISO-8859-1.
15513 </para>
15514 <para>
15515 Header names follow the syntax of RFC 2822, which states that they may contain
15516 any printing characters except space and colon. Consequently, curly brackets
15517 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
15518 if they were variables. Attempting to do so causes a syntax error.
15519 </para>
15520 <para>
15521 Only header lines that are common to all copies of a message are visible to
15522 this mechanism. These are the original header lines that are received with the
15523 message, and any that are added by an ACL statement or by a system
15524 filter. Header lines that are added to a particular copy of a message by a
15525 router or transport are not accessible.
15526 </para>
15527 <para>
15528 For incoming SMTP messages, no header lines are visible in
15529 ACLs that are obeyed before the data phase completes,
15530 because the header structure is not set up until the message is received.
15531 They are visible in DKIM, PRDR and DATA ACLs.
15532 Header lines that are added in a RCPT ACL (for example)
15533 are saved until the message&#x2019;s incoming header lines are available, at which
15534 point they are added.
15535 When any of the above ACLs are
15536 running, however, header lines added by earlier ACLs are visible.
15537 </para>
15538 <para>
15539 Upper case and lower case letters are synonymous in header names. If the
15540 following character is white space, the terminating colon may be omitted, but
15541 this is not recommended, because you may then forget it when it is needed. When
15542 white space terminates the header name, this white space is included in the
15543 expanded string.  If the message does not contain the given header, the
15544 expansion item is replaced by an empty string. (See the <option>def</option> condition in
15545 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
15546 header.)
15547 </para>
15548 <para>
15549 If there is more than one header with the same name, they are all concatenated
15550 to form the substitution string, up to a maximum length of 64K. Unless
15551 <option>rheader</option> is being used, leading and trailing white space is removed from
15552 each header before concatenation, and a completely empty header is ignored. A
15553 newline character is then inserted between non-empty headers, but there is no
15554 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
15555 those headers that contain lists of addresses, a comma is also inserted at the
15556 junctions between headers. This does not happen for the <option>rheader</option> expansion.
15557 </para>
15558 <para>
15559 <indexterm role="concept">
15560 <primary>tainted data</primary>
15561 <secondary>message headers</secondary>
15562 </indexterm>
15563 When the headers are from an incoming message,
15564 the result of expanding any of these variables is tainted.
15565 </para>
15566 </listitem></varlistentry>
15567 <varlistentry>
15568 <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>
15569 <listitem>
15570 <para>
15571 <indexterm role="concept">
15572 <primary>expansion</primary>
15573 <secondary>hmac hashing</secondary>
15574 </indexterm>
15575 <indexterm role="concept">
15576 <primary><option>hmac</option></primary>
15577 </indexterm>
15578 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
15579 shared secret and some text into a message authentication code, as specified in
15580 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
15581 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
15582 cryptographic hash, allowing for authentication that is not possible with MD5
15583 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
15584 present. For example:
15585 </para>
15586 <literallayout class="monospaced">
15587 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
15588 </literallayout>
15589 <para>
15590 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
15591 produces:
15592 </para>
15593 <literallayout class="monospaced">
15594 dd97e3ba5d1a61b5006108f8c8252953
15595 </literallayout>
15596 <para>
15597 As an example of how this might be used, you might put in the main part of
15598 an Exim configuration:
15599 </para>
15600 <literallayout class="monospaced">
15601 SPAMSCAN_SECRET=cohgheeLei2thahw
15602 </literallayout>
15603 <para>
15604 In a router or a transport you could then have:
15605 </para>
15606 <literallayout class="monospaced">
15607 headers_add = \
15608   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
15609   ${hmac{md5}{SPAMSCAN_SECRET}\
15610   {${primary_hostname},${message_exim_id},$h_message-id:}}
15611 </literallayout>
15612 <para>
15613 Then given a message, you can check where it was scanned by looking at the
15614 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
15615 this header line is authentic by recomputing the authentication code from the
15616 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
15617 using Exim&#x2019;s <option>-be</option> option, or by other means, for example, by using the
15618 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
15619 </para>
15620 </listitem></varlistentry>
15621 <varlistentry>
15622 <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>
15623 <listitem>
15624 <para>
15625 <indexterm role="concept">
15626 <primary>expansion</primary>
15627 <secondary>conditional</secondary>
15628 </indexterm>
15629 <indexterm role="concept">
15630 <primary><option>if</option>, expansion item</primary>
15631 </indexterm>
15632 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
15633 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
15634 in section <xref linkend="SECTexpcond"/> below. For example:
15635 </para>
15636 <literallayout class="monospaced">
15637 ${if eq {$local_part}{postmaster} {yes}{no} }
15638 </literallayout>
15639 <para>
15640 The second string need not be present; if it is not and the condition is not
15641 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
15642 be present instead of the second string (without any curly brackets). In this
15643 case, the expansion is forced to fail if the condition is not true (see section
15644 <xref linkend="SECTforexpfai"/>).
15645 </para>
15646 <para>
15647 If both strings are omitted, the result is the string <literal>true</literal> if the condition
15648 is true, and the empty string if the condition is false. This makes it less
15649 cumbersome to write custom ACL and router conditions. For example, instead of
15650 </para>
15651 <literallayout class="monospaced">
15652 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
15653 </literallayout>
15654 <para>
15655 you can use
15656 </para>
15657 <literallayout class="monospaced">
15658 condition = ${if &gt;{$acl_m4}{3}}
15659 </literallayout>
15660 </listitem></varlistentry>
15661 <varlistentry>
15662 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15663 <listitem>
15664 <para>
15665 <indexterm role="concept">
15666 <primary>expansion</primary>
15667 <secondary>imap folder</secondary>
15668 </indexterm>
15669 <indexterm role="concept">
15670 <primary><option>imapfolder</option> expansion item</primary>
15671 </indexterm>
15672 This item converts a (possibly multilevel, or with non-ASCII characters)
15673 folder specification to a Maildir name for filesystem use.
15674 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
15675 </para>
15676 </listitem></varlistentry>
15677 <varlistentry>
15678 <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>
15679 <listitem>
15680 <para>
15681 <indexterm role="concept">
15682 <primary>expansion</primary>
15683 <secondary>string truncation</secondary>
15684 </indexterm>
15685 <indexterm role="concept">
15686 <primary><option>length</option> expansion item</primary>
15687 </indexterm>
15688 The <option>length</option> item is used to extract the initial portion of a string. Both
15689 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
15690 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
15691 change when expanded, you can use the simpler operator notation that avoids
15692 some of the braces:
15693 </para>
15694 <literallayout class="monospaced">
15695 ${length_&lt;n&gt;:&lt;string&gt;}
15696 </literallayout>
15697 <para>
15698 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; bytes or the whole
15699 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
15700 <option>strlen</option>, which gives the length of a string.
15701 All measurement is done in bytes and is not UTF-8 aware.
15702 </para>
15703 </listitem></varlistentry>
15704 <varlistentry>
15705 <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>
15706 <listitem>
15707 <para>
15708 <indexterm role="concept">
15709 <primary>expansion</primary>
15710 <secondary>extracting list elements by number</secondary>
15711 </indexterm>
15712 <indexterm role="concept">
15713 <primary><option>listextract</option></primary>
15714 <secondary>extract list elements by number</secondary>
15715 </indexterm>
15716 <indexterm role="concept">
15717 <primary>list</primary>
15718 <secondary>extracting elements by number</secondary>
15719 </indexterm>
15720 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15721 apart from an optional leading minus,
15722 and leading and trailing white space (which is ignored).
15723 </para>
15724 <para>
15725 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15726 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15727 </para>
15728 <para>
15729 The first field of the list is numbered one.
15730 If the number is negative, the fields are
15731 counted from the end of the list, with the rightmost one numbered -1.
15732 The numbered element of the list is extracted and placed in <varname>$value</varname>,
15733 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
15734 </para>
15735 <para>
15736 If the modulus of the
15737 number is zero or greater than the number of fields in the string,
15738 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
15739 </para>
15740 <para>
15741 For example:
15742 </para>
15743 <literallayout class="monospaced">
15744 ${listextract{2}{x:42:99}}
15745 </literallayout>
15746 <para>
15747 yields <quote>42</quote>, and
15748 </para>
15749 <literallayout class="monospaced">
15750 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
15751 </literallayout>
15752 <para>
15753 yields <quote>result: 42</quote>.
15754 </para>
15755 <para>
15756 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
15757 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
15758 extracted is used.
15759 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
15760 </para>
15761 </listitem></varlistentry>
15762 <varlistentry>
15763 <term><emphasis role="bold">${listquote{</emphasis>&lt;<emphasis>separator</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15764 <listitem>
15765 <para>
15766 <indexterm role="concept">
15767 <primary>quoting</primary>
15768 <secondary>for list</secondary>
15769 </indexterm>
15770 <indexterm role="concept">
15771 <primary>list</primary>
15772 <secondary>quoting</secondary>
15773 </indexterm>
15774 This item doubles any occurrence of the separator character
15775 in the given string.
15776 An empty string is replaced with a single space.
15777 This converts the string into a safe form for use as a list element,
15778 in a list using the given separator.
15779 </para>
15780 </listitem></varlistentry>
15781 <varlistentry>
15782 <term><emphasis role="bold">${lookup&nbsp;{</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>
15783 <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>
15784 <listitem>
15785 <para>
15786 <indexterm role="concept">
15787 <primary>expansion</primary>
15788 <secondary>lookup in</secondary>
15789 </indexterm>
15790 <indexterm role="concept">
15791 <primary>file</primary>
15792 <secondary>lookups</secondary>
15793 </indexterm>
15794 <indexterm role="concept">
15795 <primary>lookup</primary>
15796 <secondary>in expanded string</secondary>
15797 </indexterm>
15798 The two forms of lookup item specify data lookups in files and databases, as
15799 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
15800 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
15801 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
15802 </para>
15803 <para>
15804 If there is any white space in a lookup item which is part of a filter command,
15805 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
15806 other place where white space is significant, the lookup item must be enclosed
15807 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
15808 out by the system administrator.
15809 </para>
15810 <para>
15811 <indexterm role="variable">
15812 <primary><varname>$value</varname></primary>
15813 </indexterm>
15814 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
15815 During its expansion, the variable <varname>$value</varname> contains the data returned by the
15816 lookup. Afterwards it reverts to the value it had previously (at the outer
15817 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
15818 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
15819 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
15820 lookup, thus providing a mechanism for looking up a default value when the
15821 original lookup fails.
15822 </para>
15823 <para>
15824 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
15825 data for the outer lookup while the parameters of the second lookup are
15826 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
15827 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
15828 appear, and in this case, if the lookup fails, the entire expansion is forced
15829 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
15830 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
15831 successful lookup, and nothing in the case of failure.
15832 </para>
15833 <para>
15834 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
15835 search type in order to do partial matching, and * or *@ may follow a search
15836 type to request default lookups if the key does not match (see sections
15837 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
15838 </para>
15839 <para>
15840 <indexterm role="concept">
15841 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15842 <secondary>in lookup expansion</secondary>
15843 </indexterm>
15844 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
15845 and non-wild parts of the key during the expansion of the replacement text.
15846 They return to their previous values at the end of the lookup item.
15847 </para>
15848 <para>
15849 This example looks up the postmaster alias in the conventional alias file:
15850 </para>
15851 <literallayout class="monospaced">
15852 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
15853 </literallayout>
15854 <para>
15855 This example uses NIS+ to look up the full name of the user corresponding to
15856 the local part of an address, forcing the expansion to fail if it is not found:
15857 </para>
15858 <literallayout class="monospaced">
15859 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
15860   {$value}fail}
15861 </literallayout>
15862 </listitem></varlistentry>
15863 <varlistentry>
15864 <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>
15865 <listitem>
15866 <para>
15867 <indexterm role="concept">
15868 <primary>expansion</primary>
15869 <secondary>list creation</secondary>
15870 </indexterm>
15871 <indexterm role="variable">
15872 <primary><varname>$item</varname></primary>
15873 </indexterm>
15874 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15875 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15876 For each item
15877 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
15878 expanded and added to the output as an item in a new list. The separator used
15879 for the output list is the same as the one used for the input, but a separator
15880 setting is not included in the output. For example:
15881 </para>
15882 <literallayout class="monospaced">
15883 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
15884 </literallayout>
15885 <para>
15886 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
15887 value of <varname>$item</varname> is restored to what it was before. See also the <option>filter</option>
15888 and <option>reduce</option> expansion items.
15889 </para>
15890 </listitem></varlistentry>
15891 <varlistentry>
15892 <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>
15893 <listitem>
15894 <para>
15895 <indexterm role="concept">
15896 <primary>expansion</primary>
15897 <secondary>numeric hash</secondary>
15898 </indexterm>
15899 <indexterm role="concept">
15900 <primary>hash function</primary>
15901 <secondary>numeric</secondary>
15902 </indexterm>
15903 The three strings are expanded; the first two must yield numbers. Call them
15904 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15905 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15906 can use the simpler operator notation that avoids some of the braces:
15907 </para>
15908 <literallayout class="monospaced">
15909 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15910 </literallayout>
15911 <para>
15912 The second number is optional (in both notations). If there is only one number,
15913 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
15914 processed by a div/mod hash function that returns two numbers, separated by a
15915 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
15916 example,
15917 </para>
15918 <literallayout class="monospaced">
15919 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
15920 </literallayout>
15921 <para>
15922 returns the string <quote>6/33</quote>.
15923 </para>
15924 </listitem></varlistentry>
15925 <varlistentry>
15926 <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>
15927 <listitem>
15928 <para>
15929 <indexterm role="concept">
15930 <primary>Perl</primary>
15931 <secondary>use in expanded string</secondary>
15932 </indexterm>
15933 <indexterm role="concept">
15934 <primary>expansion</primary>
15935 <secondary>calling Perl from</secondary>
15936 </indexterm>
15937 This item is available only if Exim has been built to include an embedded Perl
15938 interpreter. The subroutine name and the arguments are first separately
15939 expanded, and then the Perl subroutine is called with those arguments. No
15940 additional arguments need be given; the maximum number permitted, including the
15941 name of the subroutine, is nine.
15942 </para>
15943 <para>
15944 The return value of the subroutine is inserted into the expanded string, unless
15945 the return value is <option>undef</option>. In that case, the entire expansion is
15946 forced to fail, in the same way as an explicit <quote>fail</quote> on a lookup item
15947 does (see section <xref linkend="SECTforexpfai"/>).  Whatever you return is evaluated
15948 in a scalar context, thus the return value is a scalar.  For example, if you
15949 return a Perl vector, the return value is the size of the vector,
15950 not its contents.
15951 </para>
15952 <para>
15953 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
15954 with the error message that was passed to <option>die</option>. More details of the embedded
15955 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
15956 </para>
15957 <para>
15958 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
15959 out the use of this expansion item in filter files.
15960 </para>
15961 </listitem></varlistentry>
15962 <varlistentry>
15963 <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>
15964 <listitem>
15965 <para>
15966 <indexterm role="concept">
15967 <primary><option>prvs</option> expansion item</primary>
15968 </indexterm>
15969 The first argument is a complete email address and the second is secret
15970 keystring. The third argument, specifying a key number, is optional. If absent,
15971 it defaults to 0. The result of the expansion is a prvs-signed email address,
15972 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
15973 as part of a bounce address tag validation (BATV) scheme. For more discussion
15974 and an example, see section <xref linkend="SECTverifyPRVS"/>.
15975 </para>
15976 </listitem></varlistentry>
15977 <varlistentry>
15978 <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>
15979 <listitem>
15980 <para>
15981 <indexterm role="concept">
15982 <primary><option>prvscheck</option> expansion item</primary>
15983 </indexterm>
15984 This expansion item is the complement of the <option>prvs</option> item. It is used for
15985 checking prvs-signed addresses. If the expansion of the first argument does not
15986 yield a syntactically valid prvs-signed address, the whole item expands to the
15987 empty string. When the first argument does expand to a syntactically valid
15988 prvs-signed address, the second argument is expanded, with the prvs-decoded
15989 version of the address and the key number extracted from the address in the
15990 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
15991 </para>
15992 <para>
15993 These two variables can be used in the expansion of the second argument to
15994 retrieve the secret. The validity of the prvs-signed address is then checked
15995 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
15996 which is empty for failure or <quote>1</quote> for success.
15997 </para>
15998 <para>
15999 The third argument is optional; if it is missing, it defaults to an empty
16000 string. This argument is now expanded. If the result is an empty string, the
16001 result of the expansion is the decoded version of the address. This is the case
16002 whether or not the signature was valid. Otherwise, the result of the expansion
16003 is the expansion of the third argument.
16004 </para>
16005 <para>
16006 All three variables can be used in the expansion of the third argument.
16007 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
16008 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
16009 </para>
16010 </listitem></varlistentry>
16011 <varlistentry>
16012 <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>
16013 <listitem>
16014 <para>
16015 <indexterm role="concept">
16016 <primary>expansion</primary>
16017 <secondary>inserting an entire file</secondary>
16018 </indexterm>
16019 <indexterm role="concept">
16020 <primary>file</primary>
16021 <secondary>inserting into expansion</secondary>
16022 </indexterm>
16023 <indexterm role="concept">
16024 <primary><option>readfile</option> expansion item</primary>
16025 </indexterm>
16026 The filename and end-of-line (eol) string are first expanded separately. The file is
16027 then read, and its contents replace the entire item. All newline characters in
16028 the file are replaced by the end-of-line string if it is present. Otherwise,
16029 newlines are left in the string.
16030 String expansion is not applied to the contents of the file. If you want this,
16031 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
16032 the string expansion fails.
16033 </para>
16034 <para>
16035 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
16036 locks out the use of this expansion item in filter files.
16037 </para>
16038 </listitem></varlistentry>
16039 <varlistentry>
16040 <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>options</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>
16041 <listitem>
16042 <para>
16043 <indexterm role="concept">
16044 <primary>expansion</primary>
16045 <secondary>inserting from a socket</secondary>
16046 </indexterm>
16047 <indexterm role="concept">
16048 <primary>socket, use of in expansion</primary>
16049 </indexterm>
16050 <indexterm role="concept">
16051 <primary><option>readsocket</option> expansion item</primary>
16052 </indexterm>
16053 This item inserts data from a Unix domain or TCP socket into the expanded
16054 string. The minimal way of using it uses just two arguments, as in these
16055 examples:
16056 </para>
16057 <literallayout class="monospaced">
16058 ${readsocket{/socket/name}{request string}}
16059 ${readsocket{inet:some.host:1234}{request string}}
16060 </literallayout>
16061 <para>
16062 For a Unix domain socket, the first substring must be the path to the socket.
16063 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
16064 a host name or IP address, followed by a colon and a port, which can be a
16065 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
16066 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
16067 example:
16068 </para>
16069 <literallayout class="monospaced">
16070 ${readsocket{inet:[::1]:1234}{request string}}
16071 </literallayout>
16072 <para>
16073 Only a single host name may be given, but if looking it up yields more than
16074 one IP address, they are each tried in turn until a connection is made. For
16075 both kinds of socket, Exim makes a connection, writes the request string
16076 (unless it is an empty string; no terminating NUL is ever sent)
16077 and reads from the socket until an end-of-file
16078 is read. A timeout of 5 seconds is applied. Additional, optional arguments
16079 extend what can be done. Firstly, you can vary the timeout. For example:
16080 </para>
16081 <literallayout class="monospaced">
16082 ${readsocket{/socket/name}{request string}{3s}}
16083 </literallayout>
16084 <para>
16085 The third argument is a list of options, of which the first element is the timeout
16086 and must be present if any options are given.
16087 Further elements are options of form <emphasis>name=value</emphasis>.
16088 Example:
16089 </para>
16090 <literallayout class="monospaced">
16091 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
16092 </literallayout>
16093 <para>
16094 The following option names are recognised:
16095 </para>
16096 <itemizedlist>
16097 <listitem>
16098 <para>
16099 <emphasis role="bold">cache</emphasis>
16100 Defines if the result data can be cached for use by a later identical
16101 request in the same process.
16102 Values are <quote>yes</quote> or <quote>no</quote> (the default).
16103 If not, all cached results for this connection specification
16104 will be invalidated.
16105 </para>
16106 </listitem>
16107 <listitem>
16108 <para>
16109 <emphasis role="bold">shutdown</emphasis>
16110 Defines whether or not a write-shutdown is done on the connection after
16111 sending the request. Values are <quote>yes</quote> (the default) or <quote>no</quote>
16112 (preferred, eg. by some webservers).
16113 </para>
16114 </listitem>
16115 <listitem>
16116 <para>
16117 <emphasis role="bold">sni</emphasis>
16118 Controls the use of Server Name Identification on the connection.
16119 Any nonempty value will be the SNI sent; TLS will be forced.
16120 </para>
16121 </listitem>
16122 <listitem>
16123 <para>
16124 <emphasis role="bold">tls</emphasis>
16125 Controls the use of TLS on the connection.
16126 Values are <quote>yes</quote> or <quote>no</quote> (the default).
16127 If it is enabled, a shutdown as described above is never done.
16128 </para>
16129 </listitem>
16130 </itemizedlist>
16131 <para>
16132 A fourth argument allows you to change any newlines that are in the data
16133 that is read, in the same way as for <option>readfile</option> (see above). This example
16134 turns them into spaces:
16135 </para>
16136 <literallayout class="monospaced">
16137 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
16138 </literallayout>
16139 <para>
16140 As with all expansions, the substrings are expanded before the processing
16141 happens. Errors in these sub-expansions cause the expansion to fail. In
16142 addition, the following errors can occur:
16143 </para>
16144 <itemizedlist>
16145 <listitem>
16146 <para>
16147 Failure to create a socket file descriptor;
16148 </para>
16149 </listitem>
16150 <listitem>
16151 <para>
16152 Failure to connect the socket;
16153 </para>
16154 </listitem>
16155 <listitem>
16156 <para>
16157 Failure to write the request string;
16158 </para>
16159 </listitem>
16160 <listitem>
16161 <para>
16162 Timeout on reading from the socket.
16163 </para>
16164 </listitem>
16165 </itemizedlist>
16166 <para>
16167 By default, any of these errors causes the expansion to fail. However, if
16168 you supply a fifth substring, it is expanded and used when any of the above
16169 errors occurs. For example:
16170 </para>
16171 <literallayout class="monospaced">
16172 ${readsocket{/socket/name}{request string}{3s}{\n}\
16173   {socket failure}}
16174 </literallayout>
16175 <para>
16176 You can test for the existence of a Unix domain socket by wrapping this
16177 expansion in <literal>${if exists</literal>, but there is a race condition between that test
16178 and the actual opening of the socket, so it is safer to use the fifth argument
16179 if you want to be absolutely sure of avoiding an expansion error for a
16180 non-existent Unix domain socket, or a failure to connect to an Internet socket.
16181 </para>
16182 <para>
16183 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
16184 locks out the use of this expansion item in filter files.
16185 </para>
16186 </listitem></varlistentry>
16187 <varlistentry>
16188 <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>
16189 <listitem>
16190 <para>
16191 <indexterm role="concept">
16192 <primary>expansion</primary>
16193 <secondary>reducing a list to a scalar</secondary>
16194 </indexterm>
16195 <indexterm role="concept">
16196 <primary>list</primary>
16197 <secondary>reducing to a scalar</secondary>
16198 </indexterm>
16199 <indexterm role="variable">
16200 <primary><varname>$value</varname></primary>
16201 </indexterm>
16202 <indexterm role="variable">
16203 <primary><varname>$item</varname></primary>
16204 </indexterm>
16205 This operation reduces a list to a single, scalar string. After expansion,
16206 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
16207 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
16208 Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
16209 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
16210 list is assigned to <varname>$item</varname>, in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
16211 them. The result of that expansion is assigned to <varname>$value</varname> before the next
16212 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
16213 added to the expansion output. The <option>reduce</option> expansion item can be used in a
16214 number of ways. For example, to add up a list of numbers:
16215 </para>
16216 <literallayout class="monospaced">
16217 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
16218 </literallayout>
16219 <para>
16220 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
16221 can be found:
16222 </para>
16223 <literallayout class="monospaced">
16224 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
16225 </literallayout>
16226 <para>
16227 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
16228 restored to what they were before. See also the <option>filter</option> and <option>map</option>
16229 expansion items.
16230 </para>
16231 </listitem></varlistentry>
16232 <varlistentry>
16233 <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>
16234 <listitem>
16235 <para>
16236 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
16237 expansion item in section <xref linkend="SECTexpansionitems"/> above.
16238 </para>
16239 </listitem></varlistentry>
16240 <varlistentry>
16241 <term><emphasis role="bold">${run&lt;<emphasis>options</emphasis>&gt; {</emphasis>&lt;<emphasis>command&nbsp;string</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>
16242 <listitem>
16243 <para>
16244 <indexterm role="concept">
16245 <primary>expansion</primary>
16246 <secondary>running a command</secondary>
16247 </indexterm>
16248 <indexterm role="concept">
16249 <primary><option>run</option> expansion item</primary>
16250 </indexterm>
16251 This item runs an external command, as a subprocess.
16252 One option is supported after the word <emphasis>run</emphasis>, comma-separated
16253 and without whitespace.
16254 </para>
16255 <para>
16256 If the option <emphasis>preexpand</emphasis> is not used,
16257 the command string before expansion is split into individual arguments by spaces
16258 and then each argument is separately expanded.
16259 Then the command is run
16260 in a separate process, but under the same uid and gid.  As in other command
16261 executions from Exim, a shell is not used by default. If the command requires
16262 a shell, you must explicitly code it.
16263 The command name may not be tainted, but the remaining arguments can be.
16264 </para>
16265 <para>
16266 <emphasis role="bold">Note</emphasis>: if tainted arguments are used, they are supplied by a
16267 potential attacker;
16268 a careful assessment for security vulnerabilities should be done.
16269 </para>
16270 <para>
16271 If the option <emphasis>preexpand</emphasis> is used,
16272 the command string is first expanded as a whole.
16273 The expansion result is split apart into individual arguments by spaces,
16274 and then the command is run as above.
16275 Since the arguments are split by spaces, when there is a variable expansion
16276 which has an empty result, it will cause the situation that the argument will
16277 simply be omitted when the program is actually executed by Exim. If the
16278 script/program requires a specific number of arguments and the expanded
16279 variable could possibly result in this empty expansion, the variable must be
16280 quoted. This is more difficult if the expanded variable itself could result
16281 in a string containing quotes, because it would interfere with the quotes
16282 around the command arguments. A possible guard against this is to wrap the
16283 variable in the <option>sg</option> operator to change any quote marks to some other
16284 character.
16285 Neither the command nor any argument may be tainted.
16286 </para>
16287 <para>
16288 The standard input for the command exists, but is empty. The standard output
16289 and standard error are set to the same file descriptor.
16290 <indexterm role="concept">
16291 <primary>return code</primary>
16292 <secondary>from <option>run</option> expansion</secondary>
16293 </indexterm>
16294 <indexterm role="variable">
16295 <primary><varname>$value</varname></primary>
16296 </indexterm>
16297 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
16298 and replaces the entire item; during this expansion, the standard output/error
16299 from the command is in the variable <varname>$value</varname>. If the command fails,
16300 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
16301 expansion, the standard output/error from the command is in the variable
16302 <varname>$value</varname>.
16303 </para>
16304 <para>
16305 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
16306 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
16307 command does not succeed. If both strings are omitted, the result is contents
16308 of the standard output/error on success, and nothing on failure.
16309 </para>
16310 <para>
16311 <indexterm role="variable">
16312 <primary><varname>$run_in_acl</varname></primary>
16313 </indexterm>
16314 The standard output/error of the command is put in the variable <varname>$value</varname>.
16315 In this ACL example, the output of a command is logged for the admin to
16316 troubleshoot:
16317 </para>
16318 <literallayout class="monospaced">
16319 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
16320       log_message  = Output of id: $value
16321 </literallayout>
16322 <para>
16323 If the command requires shell idioms, such as the &gt; redirect operator, the
16324 shell must be invoked directly, such as with:
16325 </para>
16326 <literallayout class="monospaced">
16327 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
16328 </literallayout>
16329 <para>
16330 Note that <varname>$value</varname> will not persist beyond the reception of a single message.
16331 </para>
16332 <para>
16333 <indexterm role="variable">
16334 <primary><varname>$runrc</varname></primary>
16335 </indexterm>
16336 The return code from the command is put in the variable <varname>$runrc</varname>, and this
16337 remains set afterwards, so in a filter file you can do things like this:
16338 </para>
16339 <literallayout class="monospaced">
16340 if "${run{x y z}{}}$runrc" is 1 then ...
16341   elif $runrc is 2 then ...
16342   ...
16343 endif
16344 </literallayout>
16345 <para>
16346 If execution of the command fails (for example, the command does not exist),
16347 the return code is 127 &ndash; the same code that shells use for non-existent
16348 commands.
16349 </para>
16350 <para>
16351 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
16352 option values are expanded, except for those preconditions whose order of
16353 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
16354 by the expansion of one option, and use it in another.
16355 </para>
16356 <para>
16357 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
16358 out the use of this expansion item in filter files.
16359 </para>
16360 </listitem></varlistentry>
16361 <varlistentry>
16362 <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>
16363 <listitem>
16364 <para>
16365 <indexterm role="concept">
16366 <primary>expansion</primary>
16367 <secondary>string substitution</secondary>
16368 </indexterm>
16369 <indexterm role="concept">
16370 <primary><option>sg</option> expansion item</primary>
16371 </indexterm>
16372 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
16373 option; hence its name. However, unlike the Perl equivalent, Exim does not
16374 modify the subject string; instead it returns the modified string for insertion
16375 into the overall expansion. The item takes three arguments: the subject string,
16376 a regular expression, and a substitution string. For example:
16377 </para>
16378 <literallayout class="monospaced">
16379 ${sg{abcdefabcdef}{abc}{xyz}}
16380 </literallayout>
16381 <para>
16382 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
16383 if any $, } or \ characters are required in the regular expression or in the
16384 substitution string, they have to be escaped. For example:
16385 </para>
16386 <literallayout class="monospaced">
16387 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
16388 </literallayout>
16389 <para>
16390 yields <quote>defabc</quote>, and
16391 </para>
16392 <literallayout class="monospaced">
16393 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
16394 </literallayout>
16395 <para>
16396 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
16397 the regular expression from string expansion.
16398 </para>
16399 <para>
16400 The regular expression is compiled in 8-bit mode, working against bytes
16401 rather than any Unicode-aware character handling.
16402 </para>
16403 </listitem></varlistentry>
16404 <varlistentry>
16405 <term><emphasis role="bold">${sort{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>comparator</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>extractor</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
16406 <listitem>
16407 <para>
16408 <indexterm role="concept">
16409 <primary>sorting</primary>
16410 <secondary>a list</secondary>
16411 </indexterm>
16412 <indexterm role="concept">
16413 <primary>list</primary>
16414 <secondary>sorting</secondary>
16415 </indexterm>
16416 <indexterm role="concept">
16417 <primary>expansion</primary>
16418 <secondary>list sorting</secondary>
16419 </indexterm>
16420 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
16421 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
16422 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
16423 of a two-argument expansion condition.
16424 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
16425 The comparison should return true when applied to two values
16426 if the first value should sort before the second value.
16427 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
16428 the element being placed in <varname>$item</varname>,
16429 to give values for comparison.
16430 </para>
16431 <para>
16432 The item result is a sorted list,
16433 with the original list separator,
16434 of the list elements (in full) of the original.
16435 </para>
16436 <para>
16437 Examples:
16438 </para>
16439 <literallayout class="monospaced">
16440 ${sort{3:2:1:4}{&lt;}{$item}}
16441 </literallayout>
16442 <para>
16443 sorts a list of numbers, and
16444 </para>
16445 <literallayout class="monospaced">
16446 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
16447 </literallayout>
16448 <para>
16449 will sort an MX lookup into priority order.
16450 </para>
16451 </listitem></varlistentry>
16452 <varlistentry>
16453 <term><emphasis role="bold">${srs_encode&nbsp;{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>return&nbsp;path</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>original&nbsp;domain</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
16454 <listitem>
16455 <para>
16456 SRS encoding.  See SECT <xref linkend="SECTSRS"/> for details.
16457 </para>
16458 </listitem></varlistentry>
16459 <varlistentry>
16460 <term><emphasis role="bold">${substr{</emphasis>&lt;<emphasis>start</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>len</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
16461 <listitem>
16462 <para>
16463 <indexterm role="concept">
16464 <primary><option>substr</option> expansion item</primary>
16465 </indexterm>
16466 <indexterm role="concept">
16467 <primary>substring extraction</primary>
16468 </indexterm>
16469 <indexterm role="concept">
16470 <primary>expansion</primary>
16471 <secondary>substring extraction</secondary>
16472 </indexterm>
16473 The three strings are expanded; the first two must yield numbers. Call them
16474 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
16475 if &lt;<emphasis>start</emphasis>&gt; and &lt;<emphasis>len</emphasis>&gt; do not change when they are expanded, you
16476 can use the simpler operator notation that avoids some of the braces:
16477 </para>
16478 <literallayout class="monospaced">
16479 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;subject&gt;}
16480 </literallayout>
16481 <para>
16482 The second number is optional (in both notations).
16483 If it is absent in the simpler format, the preceding underscore must also be
16484 omitted.
16485 </para>
16486 <para>
16487 The <option>substr</option> item can be used to extract more general substrings than
16488 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
16489 length required. For example
16490 </para>
16491 <literallayout class="monospaced">
16492 ${substr{3}{2}{$local_part}}
16493 </literallayout>
16494 <para>
16495 If the starting offset is greater than the string length the result is the
16496 null string; if the length plus starting offset is greater than the string
16497 length, the result is the right-hand part of the string, starting from the
16498 given offset. The first byte (character) in the string has offset zero.
16499 </para>
16500 <para>
16501 The <option>substr</option> expansion item can take negative offset values to count
16502 from the right-hand end of its operand. The last byte (character) is offset -1,
16503 the second-last is offset -2, and so on. Thus, for example,
16504 </para>
16505 <literallayout class="monospaced">
16506 ${substr{-5}{2}{1234567}}
16507 </literallayout>
16508 <para>
16509 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
16510 length of the string, the substring starts at the beginning of the string, and
16511 the length is reduced by the amount of overshoot. Thus, for example,
16512 </para>
16513 <literallayout class="monospaced">
16514 ${substr{-5}{2}{12}}
16515 </literallayout>
16516 <para>
16517 yields an empty string, but
16518 </para>
16519 <literallayout class="monospaced">
16520 ${substr{-3}{2}{12}}
16521 </literallayout>
16522 <para>
16523 yields <quote>1</quote>.
16524 </para>
16525 <para>
16526 When the second number is omitted from <option>substr</option>, the remainder of the string
16527 is taken if the offset is positive. If it is negative, all bytes (characters) in the
16528 string preceding the offset point are taken. For example, an offset of -1 and
16529 no length, as in these semantically identical examples:
16530 </para>
16531 <literallayout class="monospaced">
16532 ${substr_-1:abcde}
16533 ${substr{-1}{abcde}}
16534 </literallayout>
16535 <para>
16536 yields all but the last character of the string, that is, <quote>abcd</quote>.
16537 </para>
16538 <para>
16539 All measurement is done in bytes and is not UTF-8 aware.
16540 </para>
16541 </listitem></varlistentry>
16542 <varlistentry>
16543 <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>
16544 <listitem>
16545 <para>
16546 <indexterm role="concept">
16547 <primary>expansion</primary>
16548 <secondary>character translation</secondary>
16549 </indexterm>
16550 <indexterm role="concept">
16551 <primary><option>tr</option> expansion item</primary>
16552 </indexterm>
16553 This item does single-character (in bytes) translation on its subject string. The second
16554 argument is a list of characters to be translated in the subject string. Each
16555 matching character is replaced by the corresponding character from the
16556 replacement list. For example
16557 </para>
16558 <literallayout class="monospaced">
16559 ${tr{abcdea}{ac}{13}}
16560 </literallayout>
16561 <para>
16562 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
16563 last occurrence is used. If the third string is shorter than the second, its
16564 last character is replicated. However, if it is empty, no translation takes
16565 place.
16566 </para>
16567 <para>
16568 All character handling is done in bytes and is not UTF-8 aware.
16569 </para>
16570 </listitem></varlistentry>
16571 </variablelist>
16572 </section>
16573 <section id="SECTexpop">
16574 <title>Expansion operators</title>
16575 <para>
16576 <indexterm role="concept">
16577 <primary>expansion</primary>
16578 <secondary>operators</secondary>
16579 </indexterm>
16580 For expansion items that perform transformations on a single argument string,
16581 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
16582 The substring is first expanded before the operation is applied to it. The
16583 following operations can be performed:
16584 </para>
16585 <variablelist>
16586 <varlistentry>
16587 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16588 <listitem>
16589 <para>
16590 <indexterm role="concept">
16591 <primary>expansion</primary>
16592 <secondary>RFC 2822 address handling</secondary>
16593 </indexterm>
16594 <indexterm role="concept">
16595 <primary><option>address</option> expansion item</primary>
16596 </indexterm>
16597 The string is interpreted as an RFC 2822 address, as it might appear in a
16598 header line, and the effective address is extracted from it. If the string does
16599 not parse successfully, the result is empty.
16600 </para>
16601 <para>
16602 The parsing correctly handles SMTPUTF8 Unicode in the string.
16603 </para>
16604 </listitem></varlistentry>
16605 <varlistentry>
16606 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16607 <listitem>
16608 <para>
16609 <indexterm role="concept">
16610 <primary>expansion</primary>
16611 <secondary>RFC 2822 address handling</secondary>
16612 </indexterm>
16613 <indexterm role="concept">
16614 <primary><option>addresses</option> expansion item</primary>
16615 </indexterm>
16616 The string (after expansion) is interpreted as a list of addresses in RFC
16617 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
16618 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
16619 result of the expansion is a colon-separated list, with appropriate
16620 doubling of colons should any happen to be present in the email addresses.
16621 Syntactically invalid RFC2822 address items are omitted from the output.
16622 </para>
16623 <para>
16624 It is possible to specify a character other than colon for the output
16625 separator by starting the string with &gt; followed by the new separator
16626 character. For example:
16627 </para>
16628 <literallayout class="monospaced">
16629 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
16630 </literallayout>
16631 <para>
16632 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. The string is expanded
16633 first, so if the expanded string starts with &gt;, it may change the output
16634 separator unintentionally. This can be avoided by setting the output
16635 separator explicitly:
16636 </para>
16637 <literallayout class="monospaced">
16638 ${addresses:&gt;:$h_from:}
16639 </literallayout>
16640 <para>
16641 Compare the <option>address</option> (singular)
16642 expansion item, which extracts the working address from a single RFC2822
16643 address. See the <option>filter</option>, <option>map</option>, and <option>reduce</option> items for ways of
16644 processing lists.
16645 </para>
16646 <para>
16647 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
16648 a strict interpretation of header line formatting.  Exim parses the bare,
16649 unquoted portion of an email address and if it finds a comma, treats it as an
16650 email address separator. For the example header line:
16651 </para>
16652 <literallayout class="monospaced">
16653 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
16654 </literallayout>
16655 <para>
16656 The first example below demonstrates that Q-encoded email addresses are parsed
16657 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
16658 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
16659 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
16660 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
16661 The third example shows that the presence of a comma is skipped when it is
16662 quoted.  The fourth example shows SMTPUTF8 handling.
16663 </para>
16664 <literallayout class="monospaced">
16665 # exim -be '${addresses:From: \
16666 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
16667 user@example.com
16668 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
16669 Last:user@example.com
16670 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
16671 user@example.com
16672 # exim -be '${addresses:フィル &lt;フィリップ@example.jp&gt;}'
16673 フィリップ@example.jp
16674 </literallayout>
16675 </listitem></varlistentry>
16676 <varlistentry>
16677 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16678 <listitem>
16679 <para>
16680 <indexterm role="concept">
16681 <primary><option>base32</option> expansion item</primary>
16682 </indexterm>
16683 <indexterm role="concept">
16684 <primary>expansion</primary>
16685 <secondary>conversion to base 32</secondary>
16686 </indexterm>
16687 The string must consist entirely of decimal digits. The number is converted to
16688 base 32 and output as a (empty, for zero) string of characters.
16689 Only lowercase letters are used.
16690 </para>
16691 </listitem></varlistentry>
16692 <varlistentry>
16693 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16694 <listitem>
16695 <para>
16696 <indexterm role="concept">
16697 <primary><option>base32d</option> expansion item</primary>
16698 </indexterm>
16699 <indexterm role="concept">
16700 <primary>expansion</primary>
16701 <secondary>conversion to base 32</secondary>
16702 </indexterm>
16703 The string must consist entirely of base-32 digits.
16704 The number is converted to decimal and output as a string.
16705 </para>
16706 </listitem></varlistentry>
16707 <varlistentry>
16708 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16709 <listitem>
16710 <para>
16711 <indexterm role="concept">
16712 <primary><option>base62</option> expansion item</primary>
16713 </indexterm>
16714 <indexterm role="concept">
16715 <primary>expansion</primary>
16716 <secondary>conversion to base 62</secondary>
16717 </indexterm>
16718 The string must consist entirely of decimal digits. The number is converted to
16719 base 62 and output as a string of six characters, including leading zeros. In
16720 the few operating environments where Exim uses base 36 instead of base 62 for
16721 its message identifiers (because those systems do not have case-sensitive
16722 filenames), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just
16723 to be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
16724 </para>
16725 </listitem></varlistentry>
16726 <varlistentry>
16727 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16728 <listitem>
16729 <para>
16730 <indexterm role="concept">
16731 <primary><option>base62d</option> expansion item</primary>
16732 </indexterm>
16733 <indexterm role="concept">
16734 <primary>expansion</primary>
16735 <secondary>conversion to base 62</secondary>
16736 </indexterm>
16737 The string must consist entirely of base-62 digits, or, in operating
16738 environments where Exim uses base 36 instead of base 62 for its message
16739 identifiers, base-36 digits. The number is converted to decimal and output as a
16740 string.
16741 </para>
16742 </listitem></varlistentry>
16743 <varlistentry>
16744 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16745 <listitem>
16746 <para>
16747 <indexterm role="concept">
16748 <primary>expansion</primary>
16749 <secondary>base64 encoding</secondary>
16750 </indexterm>
16751 <indexterm role="concept">
16752 <primary>base64 encoding</primary>
16753 <secondary>in string expansion</secondary>
16754 </indexterm>
16755 <indexterm role="concept">
16756 <primary><option>base64</option> expansion item</primary>
16757 </indexterm>
16758 <indexterm role="concept">
16759 <primary>certificate</primary>
16760 <secondary>base64 of DER</secondary>
16761 </indexterm>
16762 This operator converts a string into one that is base64 encoded.
16763 </para>
16764 <para>
16765 If the string is a single variable of type certificate,
16766 returns the base64 encoding of the DER form of the certificate.
16767 </para>
16768 </listitem></varlistentry>
16769 <varlistentry>
16770 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16771 <listitem>
16772 <para>
16773 <indexterm role="concept">
16774 <primary>expansion</primary>
16775 <secondary>base64 decoding</secondary>
16776 </indexterm>
16777 <indexterm role="concept">
16778 <primary>base64 decoding</primary>
16779 <secondary>in string expansion</secondary>
16780 </indexterm>
16781 <indexterm role="concept">
16782 <primary><option>base64d</option> expansion item</primary>
16783 </indexterm>
16784 This operator converts a base64-encoded string into the un-coded form.
16785 </para>
16786 </listitem></varlistentry>
16787 <varlistentry>
16788 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16789 <listitem>
16790 <para>
16791 <indexterm role="concept">
16792 <primary>domain</primary>
16793 <secondary>extraction</secondary>
16794 </indexterm>
16795 <indexterm role="concept">
16796 <primary>expansion</primary>
16797 <secondary>domain extraction</secondary>
16798 </indexterm>
16799 The string is interpreted as an RFC 2822 address and the domain is extracted
16800 from it. If the string does not parse successfully, the result is empty.
16801 </para>
16802 </listitem></varlistentry>
16803 <varlistentry>
16804 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16805 <listitem>
16806 <para>
16807 <indexterm role="concept">
16808 <primary>expansion</primary>
16809 <secondary>escaping non-printing characters</secondary>
16810 </indexterm>
16811 <indexterm role="concept">
16812 <primary><option>escape</option> expansion item</primary>
16813 </indexterm>
16814 If the string contains any non-printing characters, they are converted to
16815 escape sequences starting with a backslash. Whether characters with the most
16816 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
16817 is controlled by the <option>print_topbitchars</option> option.
16818 </para>
16819 </listitem></varlistentry>
16820 <varlistentry>
16821 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16822 <listitem>
16823 <para>
16824 <indexterm role="concept">
16825 <primary>expansion</primary>
16826 <secondary>escaping 8-bit characters</secondary>
16827 </indexterm>
16828 <indexterm role="concept">
16829 <primary><option>escape8bit</option> expansion item</primary>
16830 </indexterm>
16831 If the string contains any characters with the most significant bit set,
16832 they are converted to escape sequences starting with a backslash.
16833 Backslashes and DEL characters are also converted.
16834 </para>
16835 </listitem></varlistentry>
16836 <varlistentry>
16837 <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>
16838 <listitem>
16839 <para>
16840 <indexterm role="concept">
16841 <primary>expansion</primary>
16842 <secondary>expression evaluation</secondary>
16843 </indexterm>
16844 <indexterm role="concept">
16845 <primary>expansion</primary>
16846 <secondary>arithmetic expression</secondary>
16847 </indexterm>
16848 <indexterm role="concept">
16849 <primary><option>eval</option> expansion item</primary>
16850 </indexterm>
16851 These items supports simple arithmetic and bitwise logical operations in
16852 expansion strings. The string (after expansion) must be a conventional
16853 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
16854 logical operators, and parentheses. All operations are carried out using
16855 integer arithmetic. The operator priorities are as follows (the same as in the
16856 C programming language):
16857 </para>
16858 <informaltable frame="none">
16859 <tgroup cols="2" colsep="0" rowsep="0">
16860 <colspec colwidth="70pt" align="left"/>
16861 <colspec colwidth="300pt" align="left"/>
16862 <tbody>
16863 <row>
16864 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
16865 <entry>not (~), negate (-)</entry>
16866 </row>
16867 <row>
16868 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16869 <entry>multiply (*), divide (/), remainder (%)</entry>
16870 </row>
16871 <row>
16872 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16873 <entry>plus (+), minus (-)</entry>
16874 </row>
16875 <row>
16876 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16877 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
16878 </row>
16879 <row>
16880 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16881 <entry>and (&amp;)</entry>
16882 </row>
16883 <row>
16884 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16885 <entry>xor (^)</entry>
16886 </row>
16887 <row>
16888 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
16889 <entry>or (|)</entry>
16890 </row>
16891 </tbody>
16892 </tgroup>
16893 </informaltable>
16894 <para>
16895 Binary operators with the same priority are evaluated from left to right. White
16896 space is permitted before or after operators.
16897 </para>
16898 <para>
16899 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
16900 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
16901 decimal, even if they start with a leading zero; hexadecimal numbers are not
16902 permitted. This can be useful when processing numbers extracted from dates or
16903 times, which often do have leading zeros.
16904 </para>
16905 <para>
16906 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
16907 or 1024*1024*1024,
16908 respectively. Negative numbers are supported. The result of the computation is
16909 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
16910 </para>
16911 <literallayout>
16912 <literal>${eval:1+1}            </literal>  yields 2
16913 <literal>${eval:1+2*3}          </literal>  yields 7
16914 <literal>${eval:(1+2)*3}        </literal>  yields 9
16915 <literal>${eval:2+42%5}         </literal>  yields 4
16916 <literal>${eval:0xc&amp;5}          </literal>  yields 4
16917 <literal>${eval:0xc|5}          </literal>  yields 13
16918 <literal>${eval:0xc^5}          </literal>  yields 9
16919 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
16920 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
16921 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
16922 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
16923 </literallayout>
16924 <para>
16925 As a more realistic example, in an ACL you might have
16926 </para>
16927 <literallayout class="monospaced">
16928 deny   condition =                    \
16929          ${if and {                   \
16930            {&gt;{$rcpt_count}{10}}       \
16931            {                          \
16932            &lt;                          \
16933              {$recipients_count}      \
16934              {${eval:$rcpt_count/2}}  \
16935            }                          \
16936          }{yes}{no}}
16937        message = Too many bad recipients
16938 </literallayout>
16939 <para>
16940 The condition is true if there have been more than 10 RCPT commands and
16941 fewer than half of them have resulted in a valid recipient.
16942 </para>
16943 </listitem></varlistentry>
16944 <varlistentry>
16945 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16946 <listitem>
16947 <para>
16948 <indexterm role="concept">
16949 <primary>expansion</primary>
16950 <secondary>re-expansion of substring</secondary>
16951 </indexterm>
16952 The <option>expand</option> operator causes a string to be expanded for a second time. For
16953 example,
16954 </para>
16955 <literallayout class="monospaced">
16956 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
16957 </literallayout>
16958 <para>
16959 first looks up a string in a file while expanding the operand for <option>expand</option>,
16960 and then re-expands what it has found.
16961 </para>
16962 </listitem></varlistentry>
16963 <varlistentry>
16964 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16965 <listitem>
16966 <para>
16967 <indexterm role="concept">
16968 <primary>Unicode</primary>
16969 </indexterm>
16970 <indexterm role="concept">
16971 <primary>UTF-8</primary>
16972 <secondary>conversion from</secondary>
16973 </indexterm>
16974 <indexterm role="concept">
16975 <primary>expansion</primary>
16976 <secondary>UTF-8 conversion</secondary>
16977 </indexterm>
16978 <indexterm role="concept">
16979 <primary><option>from_utf8</option> expansion item</primary>
16980 </indexterm>
16981 The world is slowly moving towards Unicode, although there are no standards for
16982 email yet. However, other applications (including some databases) are starting
16983 to store data in Unicode, using UTF-8 encoding. This operator converts from a
16984 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
16985 converted to underscores. The input must be a valid UTF-8 string. If it is not,
16986 the result is an undefined sequence of bytes.
16987 </para>
16988 <para>
16989 Unicode code points with values less than 256 are compatible with ASCII and
16990 ISO-8859-1 (also known as Latin-1).
16991 For example, character 169 is the copyright symbol in both cases, though the
16992 way it is encoded is different. In UTF-8, more than one byte is needed for
16993 characters with code values greater than 127, whereas ISO-8859-1 is a
16994 single-byte encoding (but thereby limited to 256 characters). This makes
16995 translation from UTF-8 to ISO-8859-1 straightforward.
16996 </para>
16997 </listitem></varlistentry>
16998 <varlistentry>
16999 <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>
17000 <listitem>
17001 <para>
17002 <indexterm role="concept">
17003 <primary>hash function</primary>
17004 <secondary>textual</secondary>
17005 </indexterm>
17006 <indexterm role="concept">
17007 <primary>expansion</primary>
17008 <secondary>textual hash</secondary>
17009 </indexterm>
17010 The <option>hash</option> operator is a simpler interface to the hashing function that can
17011 be used when the two parameters are fixed numbers (as opposed to strings that
17012 change when expanded). The effect is the same as
17013 </para>
17014 <literallayout class="monospaced">
17015 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
17016 </literallayout>
17017 <para>
17018 See the description of the general <option>hash</option> item above for details. The
17019 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
17020 </para>
17021 </listitem></varlistentry>
17022 <varlistentry revisionflag="changed">
17023 <term><emphasis role="bold">${headerwrap_</emphasis>&lt;<emphasis>cols</emphasis>&gt;<emphasis role="bold">_</emphasis>&lt;<emphasis>limit</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17024 <listitem>
17025 <para revisionflag="changed">
17026 <indexterm role="concept">
17027 <primary>header</primary>
17028 <secondary>wrapping operator</secondary>
17029 </indexterm>
17030 <indexterm role="concept">
17031 <primary>expansion</primary>
17032 <secondary>header wrapping</secondary>
17033 </indexterm>
17034 This operator line-wraps its argument in a way useful for headers.
17035 The <emphasis>cols</emphasis> value gives the column number to wrap after,
17036 the <emphasis>limit</emphasis> gives a limit number of result characters to truncate at.
17037 Either just the <emphasis>limit</emphasis> and the preceding underbar, or both, can be omitted;
17038 the defaults are 80 and 998.
17039 Wrapping will be inserted at a space if possible before the
17040 column number is reached.
17041 Whitespace at a chosen wrap point is removed.
17042 A line-wrap consists of a newline followed by a tab,
17043 and the tab is counted as 8 columns.
17044 </para>
17045 </listitem></varlistentry>
17046 <varlistentry>
17047 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17048 <listitem>
17049 <para>
17050 <indexterm role="concept">
17051 <primary>base64 encoding</primary>
17052 <secondary>conversion from hex</secondary>
17053 </indexterm>
17054 <indexterm role="concept">
17055 <primary>expansion</primary>
17056 <secondary>hex to base64</secondary>
17057 </indexterm>
17058 <indexterm role="concept">
17059 <primary><option>hex2b64</option> expansion item</primary>
17060 </indexterm>
17061 This operator converts a hex string into one that is base64 encoded. This can
17062 be useful for processing the output of the various hashing functions.
17063 </para>
17064 </listitem></varlistentry>
17065 <varlistentry>
17066 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17067 <listitem>
17068 <para>
17069 <indexterm role="concept">
17070 <primary>quoting</primary>
17071 <secondary>hex-encoded unprintable characters</secondary>
17072 </indexterm>
17073 <indexterm role="concept">
17074 <primary><option>hexquote</option> expansion item</primary>
17075 </indexterm>
17076 This operator converts non-printable characters in a string into a hex
17077 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
17078 as is, and other byte values are converted to <literal>\xNN</literal>, for example, a
17079 byte value 127 is converted to <literal>\x7f</literal>.
17080 </para>
17081 </listitem></varlistentry>
17082 <varlistentry>
17083 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17084 <listitem>
17085 <para>
17086 <indexterm role="concept">
17087 <primary><option>ipv6denorm</option> expansion item</primary>
17088 </indexterm>
17089 <indexterm role="concept">
17090 <primary>IP address</primary>
17091 <secondary>normalisation</secondary>
17092 </indexterm>
17093 This expands an IPv6 address to a full eight-element colon-separated set
17094 of hex digits including leading zeroes.
17095 A trailing ipv4-style dotted-decimal set is converted to hex.
17096 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
17097 </para>
17098 </listitem></varlistentry>
17099 <varlistentry>
17100 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17101 <listitem>
17102 <para>
17103 <indexterm role="concept">
17104 <primary><option>ipv6norm</option> expansion item</primary>
17105 </indexterm>
17106 <indexterm role="concept">
17107 <primary>IP address</primary>
17108 <secondary>normalisation</secondary>
17109 </indexterm>
17110 <indexterm role="concept">
17111 <primary>IP address</primary>
17112 <secondary>canonical form</secondary>
17113 </indexterm>
17114 This converts an IPv6 address to canonical form.
17115 Leading zeroes of groups are omitted, and the longest
17116 set of zero-valued groups is replaced with a double colon.
17117 A trailing ipv4-style dotted-decimal set is converted to hex.
17118 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
17119 </para>
17120 </listitem></varlistentry>
17121 <varlistentry>
17122 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17123 <listitem>
17124 <para>
17125 <indexterm role="concept">
17126 <primary>case forcing in strings</primary>
17127 </indexterm>
17128 <indexterm role="concept">
17129 <primary>string</primary>
17130 <secondary>case forcing</secondary>
17131 </indexterm>
17132 <indexterm role="concept">
17133 <primary>lower casing</primary>
17134 </indexterm>
17135 <indexterm role="concept">
17136 <primary>expansion</primary>
17137 <secondary>case forcing</secondary>
17138 </indexterm>
17139 <indexterm role="concept">
17140 <primary><option>lc</option> expansion item</primary>
17141 </indexterm>
17142 This forces the letters in the string into lower-case, for example:
17143 </para>
17144 <literallayout class="monospaced">
17145 ${lc:$local_part}
17146 </literallayout>
17147 <para>
17148 Case is defined per the system C locale.
17149 </para>
17150 </listitem></varlistentry>
17151 <varlistentry>
17152 <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>
17153 <listitem>
17154 <para>
17155 <indexterm role="concept">
17156 <primary>expansion</primary>
17157 <secondary>string truncation</secondary>
17158 </indexterm>
17159 <indexterm role="concept">
17160 <primary><option>length</option> expansion item</primary>
17161 </indexterm>
17162 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
17163 can be used when the parameter is a fixed number (as opposed to a string that
17164 changes when expanded). The effect is the same as
17165 </para>
17166 <literallayout class="monospaced">
17167 ${length{&lt;number&gt;}{&lt;string&gt;}}
17168 </literallayout>
17169 <para>
17170 See the description of the general <option>length</option> item above for details. Note that
17171 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
17172 when <option>length</option> is used as an operator.
17173 All measurement is done in bytes and is not UTF-8 aware.
17174 </para>
17175 </listitem></varlistentry>
17176 <varlistentry>
17177 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17178 <listitem>
17179 <para>
17180 <indexterm role="concept">
17181 <primary>expansion</primary>
17182 <secondary>list item count</secondary>
17183 </indexterm>
17184 <indexterm role="concept">
17185 <primary>list</primary>
17186 <secondary>item count</secondary>
17187 </indexterm>
17188 <indexterm role="concept">
17189 <primary>list</primary>
17190 <secondary>count of items</secondary>
17191 </indexterm>
17192 <indexterm role="concept">
17193 <primary><option>listcount</option> expansion item</primary>
17194 </indexterm>
17195 The string is interpreted as a list and the number of items is returned.
17196 </para>
17197 </listitem></varlistentry>
17198 <varlistentry>
17199 <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>
17200 <listitem>
17201 <para>
17202 <indexterm role="concept">
17203 <primary>expansion</primary>
17204 <secondary>named list</secondary>
17205 </indexterm>
17206 <indexterm role="concept">
17207 <primary><option>listnamed</option> expansion item</primary>
17208 </indexterm>
17209 The name is interpreted as a named list and the content of the list is returned,
17210 expanding any referenced lists, re-quoting as needed for colon-separation.
17211 If the optional type is given it must be one of "a", "d", "h" or "l"
17212 and selects address-, domain-, host- or localpart- lists to search among respectively.
17213 Otherwise all types are searched in an undefined order and the first
17214 matching list is returned.
17215 <emphasis role="bold">Note</emphasis>: Neither string-expansion of lists referenced by named-list syntax elements,
17216 nor expansion of lookup elements, is done by the <option>listnamed</option> operator.
17217 </para>
17218 </listitem></varlistentry>
17219 <varlistentry>
17220 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17221 <listitem>
17222 <para>
17223 <indexterm role="concept">
17224 <primary>expansion</primary>
17225 <secondary>local part extraction</secondary>
17226 </indexterm>
17227 <indexterm role="concept">
17228 <primary><option>local_part</option> expansion item</primary>
17229 </indexterm>
17230 The string is interpreted as an RFC 2822 address and the local part is
17231 extracted from it. If the string does not parse successfully, the result is
17232 empty.
17233 The parsing correctly handles SMTPUTF8 Unicode in the string.
17234 </para>
17235 </listitem></varlistentry>
17236 <varlistentry>
17237 <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>
17238 <term><emphasis role="bold">${mask_n:</emphasis>&lt;<emphasis>IP&nbsp;address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>bit&nbsp;count</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17239 <listitem>
17240 <para>
17241 <indexterm role="concept">
17242 <primary>masked IP address</primary>
17243 </indexterm>
17244 <indexterm role="concept">
17245 <primary>IP address</primary>
17246 <secondary>masking</secondary>
17247 </indexterm>
17248 <indexterm role="concept">
17249 <primary>CIDR notation</primary>
17250 </indexterm>
17251 <indexterm role="concept">
17252 <primary>expansion</primary>
17253 <secondary>IP address masking</secondary>
17254 </indexterm>
17255 <indexterm role="concept">
17256 <primary><option>mask</option> expansion item</primary>
17257 </indexterm>
17258 If the form of the string to be operated on is not an IP address followed by a
17259 slash and an integer (that is, a network address in CIDR notation), the
17260 expansion fails. Otherwise, this operator converts the IP address to binary,
17261 masks off the least significant bits according to the bit count, and converts
17262 the result back to text, with mask appended. For example,
17263 </para>
17264 <literallayout class="monospaced">
17265 ${mask:10.111.131.206/28}
17266 </literallayout>
17267 <para>
17268 returns the string <quote>10.111.131.192/28</quote>.
17269 </para>
17270 <para>
17271 Since this operation is expected to
17272 be mostly used for looking up masked addresses in files, the
17273 normal
17274 result for an IPv6
17275 address uses dots to separate components instead of colons, because colon
17276 terminates a key string in lsearch files. So, for example,
17277 </para>
17278 <literallayout class="monospaced">
17279 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
17280 </literallayout>
17281 <para>
17282 returns the string
17283 </para>
17284 <literallayout class="monospaced">
17285 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
17286 </literallayout>
17287 <para>
17288 If the optional form <emphasis role="bold">mask_n</emphasis> is used, IPv6 address result are instead
17289 returned in normailsed form, using colons and with zero-compression.
17290 Letters in IPv6 addresses are always output in lower case.
17291 </para>
17292 </listitem></varlistentry>
17293 <varlistentry>
17294 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17295 <listitem>
17296 <para>
17297 <indexterm role="concept">
17298 <primary>MD5 hash</primary>
17299 </indexterm>
17300 <indexterm role="concept">
17301 <primary>expansion</primary>
17302 <secondary>MD5 hash</secondary>
17303 </indexterm>
17304 <indexterm role="concept">
17305 <primary>certificate</primary>
17306 <secondary>fingerprint</secondary>
17307 </indexterm>
17308 <indexterm role="concept">
17309 <primary><option>md5</option> expansion item</primary>
17310 </indexterm>
17311 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
17312 as a 32-digit hexadecimal number, in which any letters are in lower case.
17313 </para>
17314 <para>
17315 If the string is a single variable of type certificate,
17316 returns the MD5 hash fingerprint of the certificate.
17317 </para>
17318 </listitem></varlistentry>
17319 <varlistentry>
17320 <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>
17321 <listitem>
17322 <para>
17323 <indexterm role="concept">
17324 <primary>expansion</primary>
17325 <secondary>numeric hash</secondary>
17326 </indexterm>
17327 <indexterm role="concept">
17328 <primary>hash function</primary>
17329 <secondary>numeric</secondary>
17330 </indexterm>
17331 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
17332 that can be used when the two parameters are fixed numbers (as opposed to
17333 strings that change when expanded). The effect is the same as
17334 </para>
17335 <literallayout class="monospaced">
17336 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
17337 </literallayout>
17338 <para>
17339 See the description of the general <option>nhash</option> item above for details.
17340 </para>
17341 </listitem></varlistentry>
17342 <varlistentry>
17343 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17344 <listitem>
17345 <para>
17346 <indexterm role="concept">
17347 <primary>quoting</primary>
17348 <secondary>in string expansions</secondary>
17349 </indexterm>
17350 <indexterm role="concept">
17351 <primary>expansion</primary>
17352 <secondary>quoting</secondary>
17353 </indexterm>
17354 <indexterm role="concept">
17355 <primary><option>quote</option> expansion item</primary>
17356 </indexterm>
17357 The <option>quote</option> operator puts its argument into double quotes if it
17358 is an empty string or
17359 contains anything other than letters, digits, underscores, dots, and hyphens.
17360 Any occurrences of double quotes and backslashes are escaped with a backslash.
17361 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
17362 respectively For example,
17363 </para>
17364 <literallayout class="monospaced">
17365 ${quote:ab"*"cd}
17366 </literallayout>
17367 <para>
17368 becomes
17369 </para>
17370 <literallayout class="monospaced">
17371 "ab\"*\"cd"
17372 </literallayout>
17373 <para>
17374 The place where this is useful is when the argument is a substitution from a
17375 variable or a message header.
17376 </para>
17377 </listitem></varlistentry>
17378 <varlistentry>
17379 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17380 <listitem>
17381 <para>
17382 <indexterm role="concept">
17383 <primary><option>quote_local_part</option> expansion item</primary>
17384 </indexterm>
17385 This operator is like <option>quote</option>, except that it quotes the string only if
17386 required to do so by the rules of RFC 2822 for quoting local parts. For
17387 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
17388 If you are creating a new email address from the contents of <varname>$local_part</varname>
17389 (or any other unknown data), you should always use this operator.
17390 </para>
17391 <para>
17392 This quoting determination is not SMTPUTF8-aware, thus quoting non-ASCII data
17393 will likely use the quoting form.
17394 Thus <emphasis>${quote_local_part:フィル}</emphasis> will always become <emphasis>"フィル"</emphasis>.
17395 </para>
17396 </listitem></varlistentry>
17397 <varlistentry>
17398 <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>
17399 <listitem>
17400 <para>
17401 <indexterm role="concept">
17402 <primary>quoting</primary>
17403 <secondary>lookup-specific</secondary>
17404 </indexterm>
17405 This operator applies lookup-specific quoting rules to the string. Each
17406 query-style lookup type has its own quoting rules which are described with
17407 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
17408 </para>
17409 <literallayout class="monospaced">
17410 ${quote_ldap:two * two}
17411 </literallayout>
17412 <para>
17413 returns
17414 </para>
17415 <literallayout class="monospaced">
17416 two%20%5C2A%20two
17417 </literallayout>
17418 <para>
17419 For single-key lookup types, no quoting is ever necessary and this operator
17420 yields an unchanged string.
17421 </para>
17422 </listitem></varlistentry>
17423 <varlistentry>
17424 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17425 <listitem>
17426 <para>
17427 <indexterm role="concept">
17428 <primary>random number</primary>
17429 </indexterm>
17430 This operator returns a somewhat random number which is less than the
17431 supplied number and is at least 0.  The quality of this randomness depends
17432 on how Exim was built; the values are not suitable for keying material.
17433 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
17434 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
17435 for versions of GnuTLS with that function.
17436 Otherwise, the implementation may be arc4random(), random() seeded by
17437 srandomdev() or srandom(), or a custom implementation even weaker than
17438 random().
17439 </para>
17440 </listitem></varlistentry>
17441 <varlistentry>
17442 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17443 <listitem>
17444 <para>
17445 <indexterm role="concept">
17446 <primary>expansion</primary>
17447 <secondary>IP address</secondary>
17448 </indexterm>
17449 This operator reverses an IP address; for IPv4 addresses, the result is in
17450 dotted-quad decimal form, while for IPv6 addresses the result is in
17451 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
17452 for DNS.  For example,
17453 </para>
17454 <literallayout class="monospaced">
17455 ${reverse_ip:192.0.2.4}
17456 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
17457 </literallayout>
17458 <para>
17459 returns
17460 </para>
17461 <literallayout class="monospaced">
17462 4.2.0.192
17463 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
17464 </literallayout>
17465 </listitem></varlistentry>
17466 <varlistentry>
17467 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17468 <listitem>
17469 <para>
17470 <indexterm role="concept">
17471 <primary>expansion</primary>
17472 <secondary>RFC 2047</secondary>
17473 </indexterm>
17474 <indexterm role="concept">
17475 <primary>RFC 2047</primary>
17476 <secondary>expansion operator</secondary>
17477 </indexterm>
17478 <indexterm role="concept">
17479 <primary><option>rfc2047</option> expansion item</primary>
17480 </indexterm>
17481 This operator encodes text according to the rules of RFC 2047. This is an
17482 encoding that is used in header lines to encode non-ASCII characters. It is
17483 assumed that the input string is in the encoding specified by the
17484 <option>headers_charset</option> option, which gets its default at build time. If the string
17485 contains only characters in the range 33&ndash;126, and no instances of the
17486 characters
17487 </para>
17488 <literallayout class="monospaced">
17489 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
17490 </literallayout>
17491 <para>
17492 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
17493 string, using as many <quote>encoded words</quote> as necessary to encode all the
17494 characters.
17495 </para>
17496 </listitem></varlistentry>
17497 <varlistentry>
17498 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17499 <listitem>
17500 <para>
17501 <indexterm role="concept">
17502 <primary>expansion</primary>
17503 <secondary>RFC 2047</secondary>
17504 </indexterm>
17505 <indexterm role="concept">
17506 <primary>RFC 2047</primary>
17507 <secondary>decoding</secondary>
17508 </indexterm>
17509 <indexterm role="concept">
17510 <primary><option>rfc2047d</option> expansion item</primary>
17511 </indexterm>
17512 This operator decodes strings that are encoded as per RFC 2047. Binary zero
17513 bytes are replaced by question marks. Characters are converted into the
17514 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
17515 not recognized unless <option>check_rfc2047_length</option> is set false.
17516 </para>
17517 <para>
17518 <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
17519 access a header line, RFC 2047 decoding is done automatically. You do not need
17520 to use this operator as well.
17521 </para>
17522 </listitem></varlistentry>
17523 <varlistentry>
17524 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17525 <listitem>
17526 <para>
17527 <indexterm role="concept">
17528 <primary>quoting</primary>
17529 <secondary>in regular expressions</secondary>
17530 </indexterm>
17531 <indexterm role="concept">
17532 <primary>regular expressions</primary>
17533 <secondary>quoting</secondary>
17534 </indexterm>
17535 <indexterm role="concept">
17536 <primary><option>rxquote</option> expansion item</primary>
17537 </indexterm>
17538 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
17539 characters in its argument. This is useful when substituting the values of
17540 variables or headers inside regular expressions.
17541 </para>
17542 </listitem></varlistentry>
17543 <varlistentry>
17544 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17545 <listitem>
17546 <para>
17547 <indexterm role="concept">
17548 <primary>SHA-1 hash</primary>
17549 </indexterm>
17550 <indexterm role="concept">
17551 <primary>expansion</primary>
17552 <secondary>SHA-1 hashing</secondary>
17553 </indexterm>
17554 <indexterm role="concept">
17555 <primary>certificate</primary>
17556 <secondary>fingerprint</secondary>
17557 </indexterm>
17558 <indexterm role="concept">
17559 <primary><option>sha1</option> expansion item</primary>
17560 </indexterm>
17561 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
17562 it as a 40-digit hexadecimal number, in which any letters are in upper case.
17563 </para>
17564 <para>
17565 If the string is a single variable of type certificate,
17566 returns the SHA-1 hash fingerprint of the certificate.
17567 </para>
17568 </listitem></varlistentry>
17569 <varlistentry>
17570 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17571 <term><emphasis role="bold">${sha2:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17572 <term><emphasis role="bold">${sha2_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17573 <listitem>
17574 <para>
17575 <indexterm role="concept">
17576 <primary>SHA-256 hash</primary>
17577 </indexterm>
17578 <indexterm role="concept">
17579 <primary>SHA-2 hash</primary>
17580 </indexterm>
17581 <indexterm role="concept">
17582 <primary>certificate</primary>
17583 <secondary>fingerprint</secondary>
17584 </indexterm>
17585 <indexterm role="concept">
17586 <primary>expansion</primary>
17587 <secondary>SHA-256 hashing</secondary>
17588 </indexterm>
17589 <indexterm role="concept">
17590 <primary><option>sha256</option> expansion item</primary>
17591 </indexterm>
17592 <indexterm role="concept">
17593 <primary><option>sha2</option> expansion item</primary>
17594 </indexterm>
17595 The <option>sha256</option> operator computes the SHA-256 hash value of the string
17596 and returns
17597 it as a 64-digit hexadecimal number, in which any letters are in upper case.
17598 </para>
17599 <para>
17600 If the string is a single variable of type certificate,
17601 returns the SHA-256 hash fingerprint of the certificate.
17602 </para>
17603 <para>
17604 The operator can also be spelled <option>sha2</option> and does the same as <option>sha256</option>
17605 (except for certificates, which are not supported).
17606 Finally, if an underbar
17607 and a number is appended it specifies the output length, selecting a
17608 member of the SHA-2 family of hash functions.
17609 Values of 256, 384 and 512 are accepted, with 256 being the default.
17610 </para>
17611 </listitem></varlistentry>
17612 <varlistentry>
17613 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17614 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17615 <listitem>
17616 <para>
17617 <indexterm role="concept">
17618 <primary>SHA3 hash</primary>
17619 </indexterm>
17620 <indexterm role="concept">
17621 <primary>expansion</primary>
17622 <secondary>SHA3 hashing</secondary>
17623 </indexterm>
17624 <indexterm role="concept">
17625 <primary><option>sha3</option> expansion item</primary>
17626 </indexterm>
17627 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
17628 and returns
17629 it as a 64-digit hexadecimal number, in which any letters are in upper case.
17630 </para>
17631 <para>
17632 If a number is appended, separated by an underbar, it specifies
17633 the output length.  Values of 224, 256, 384 and 512 are accepted;
17634 with 256 being the default.
17635 </para>
17636 <para>
17637 The <option>sha3</option> expansion item is only supported if Exim has been
17638 compiled with GnuTLS 3.5.0 or later,
17639 or OpenSSL 1.1.1 or later.
17640 The macro "_CRYPTO_HASH_SHA3" will be defined if it is supported.
17641 </para>
17642 </listitem></varlistentry>
17643 <varlistentry>
17644 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17645 <listitem>
17646 <para>
17647 <indexterm role="concept">
17648 <primary>expansion</primary>
17649 <secondary>statting a file</secondary>
17650 </indexterm>
17651 <indexterm role="concept">
17652 <primary>file</primary>
17653 <secondary>extracting characteristics</secondary>
17654 </indexterm>
17655 <indexterm role="concept">
17656 <primary><option>stat</option> expansion item</primary>
17657 </indexterm>
17658 The string, after expansion, must be a file path. A call to the <function>stat()</function>
17659 function is made for this path. If <function>stat()</function> fails, an error occurs and the
17660 expansion fails. If it succeeds, the data from the stat replaces the item, as a
17661 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
17662 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
17663 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
17664 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
17665 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
17666 can extract individual fields using the <option>extract</option> expansion item.
17667 </para>
17668 <para>
17669 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
17670 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
17671 systems for files larger than 2GB.
17672 </para>
17673 </listitem></varlistentry>
17674 <varlistentry>
17675 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17676 <listitem>
17677 <para>
17678 <indexterm role="concept">
17679 <primary><option>str2b64</option> expansion item</primary>
17680 </indexterm>
17681 Now deprecated, a synonym for the <option>base64</option> expansion operator.
17682 </para>
17683 </listitem></varlistentry>
17684 <varlistentry>
17685 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17686 <listitem>
17687 <para>
17688 <indexterm role="concept">
17689 <primary>expansion</primary>
17690 <secondary>string length</secondary>
17691 </indexterm>
17692 <indexterm role="concept">
17693 <primary>string</primary>
17694 <secondary>length in expansion</secondary>
17695 </indexterm>
17696 <indexterm role="concept">
17697 <primary><option>strlen</option> expansion item</primary>
17698 </indexterm>
17699 The item is replaced by the length of the expanded string, expressed as a
17700 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
17701 All measurement is done in bytes and is not UTF-8 aware.
17702 </para>
17703 </listitem></varlistentry>
17704 <varlistentry>
17705 <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>
17706 <listitem>
17707 <para>
17708 <indexterm role="concept">
17709 <primary><option>substr</option> expansion item</primary>
17710 </indexterm>
17711 <indexterm role="concept">
17712 <primary>substring extraction</primary>
17713 </indexterm>
17714 <indexterm role="concept">
17715 <primary>expansion</primary>
17716 <secondary>substring expansion</secondary>
17717 </indexterm>
17718 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
17719 can be used when the two parameters are fixed numbers (as opposed to strings
17720 that change when expanded). The effect is the same as
17721 </para>
17722 <literallayout class="monospaced">
17723 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
17724 </literallayout>
17725 <para>
17726 See the description of the general <option>substr</option> item above for details. The
17727 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
17728 All measurement is done in bytes and is not UTF-8 aware.
17729 </para>
17730 </listitem></varlistentry>
17731 <varlistentry>
17732 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17733 <listitem>
17734 <para>
17735 <indexterm role="concept">
17736 <primary><option>time_eval</option> expansion item</primary>
17737 </indexterm>
17738 <indexterm role="concept">
17739 <primary>time interval</primary>
17740 <secondary>decoding</secondary>
17741 </indexterm>
17742 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
17743 seconds.
17744 </para>
17745 </listitem></varlistentry>
17746 <varlistentry>
17747 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17748 <listitem>
17749 <para>
17750 <indexterm role="concept">
17751 <primary><option>time_interval</option> expansion item</primary>
17752 </indexterm>
17753 <indexterm role="concept">
17754 <primary>time interval</primary>
17755 <secondary>formatting</secondary>
17756 </indexterm>
17757 The argument (after sub-expansion) must be a sequence of decimal digits that
17758 represents an interval of time as a number of seconds. It is converted into a
17759 number of larger units and output in Exim&#x2019;s normal time format, for example,
17760 <literal>1w3d4h2m6s</literal>.
17761 </para>
17762 </listitem></varlistentry>
17763 <varlistentry>
17764 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17765 <listitem>
17766 <para>
17767 <indexterm role="concept">
17768 <primary>case forcing in strings</primary>
17769 </indexterm>
17770 <indexterm role="concept">
17771 <primary>string</primary>
17772 <secondary>case forcing</secondary>
17773 </indexterm>
17774 <indexterm role="concept">
17775 <primary>upper casing</primary>
17776 </indexterm>
17777 <indexterm role="concept">
17778 <primary>expansion</primary>
17779 <secondary>case forcing</secondary>
17780 </indexterm>
17781 <indexterm role="concept">
17782 <primary><option>uc</option> expansion item</primary>
17783 </indexterm>
17784 This forces the letters in the string into upper-case.
17785 Case is defined per the system C locale.
17786 </para>
17787 </listitem></varlistentry>
17788 <varlistentry>
17789 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17790 <listitem>
17791 <para>
17792 <indexterm role="concept">
17793 <primary>correction of invalid utf-8 sequences in strings</primary>
17794 </indexterm>
17795 <indexterm role="concept">
17796 <primary>utf-8</primary>
17797 <secondary>utf-8 sequences</secondary>
17798 </indexterm>
17799 <indexterm role="concept">
17800 <primary>incorrect utf-8</primary>
17801 </indexterm>
17802 <indexterm role="concept">
17803 <primary>expansion</primary>
17804 <secondary>utf-8 forcing</secondary>
17805 </indexterm>
17806 <indexterm role="concept">
17807 <primary><option>utf8clean</option> expansion item</primary>
17808 </indexterm>
17809 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
17810 In versions of Exim before 4.92, this did not correctly do so for a truncated
17811 final codepoint&#x2019;s encoding, and the character would be silently dropped.
17812 If you must handle detection of this scenario across both sets of Exim behavior,
17813 the complexity will depend upon the task.
17814 For instance, to detect if the first character is multibyte and a 1-byte
17815 extraction can be successfully used as a path component (as is common for
17816 dividing up delivery folders), you might use:
17817 </para>
17818 <literallayout class="monospaced">
17819 condition = ${if inlist{${utf8clean:${length_1:$local_part}}}{:?}{yes}{no}}
17820 </literallayout>
17821 <para>
17822 (which will false-positive if the first character of the local part is a
17823 literal question mark).
17824 </para>
17825 </listitem></varlistentry>
17826 <varlistentry>
17827 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17828 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17829 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17830 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17831 <listitem>
17832 <para>
17833 <indexterm role="concept">
17834 <primary>expansion</primary>
17835 <secondary>UTF-8</secondary>
17836 </indexterm>
17837 <indexterm role="concept">
17838 <primary>UTF-8</primary>
17839 <secondary>expansion</secondary>
17840 </indexterm>
17841 <indexterm role="concept">
17842 <primary>EAI</primary>
17843 </indexterm>
17844 <indexterm role="concept">
17845 <primary>internationalisation</primary>
17846 </indexterm>
17847 <indexterm role="concept">
17848 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
17849 </indexterm>
17850 <indexterm role="concept">
17851 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
17852 </indexterm>
17853 <indexterm role="concept">
17854 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
17855 </indexterm>
17856 <indexterm role="concept">
17857 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
17858 </indexterm>
17859 These convert EAI mail name components between UTF-8 and a-label forms.
17860 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
17861 </para>
17862 </listitem></varlistentry>
17863 </variablelist>
17864 </section>
17865 <section id="SECTexpcond">
17866 <title>Expansion conditions</title>
17867 <para>
17868 <indexterm role="concept" id="IIDexpcond" class="startofrange">
17869 <primary>expansion</primary>
17870 <secondary>conditions</secondary>
17871 </indexterm>
17872 The following conditions are available for testing by the <option>${if</option> construct
17873 while expanding strings:
17874 </para>
17875 <variablelist>
17876 <varlistentry>
17877 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
17878 <listitem>
17879 <para>
17880 <indexterm role="concept">
17881 <primary>expansion</primary>
17882 <secondary>negating a condition</secondary>
17883 </indexterm>
17884 <indexterm role="concept">
17885 <primary>negation</primary>
17886 <secondary>in expansion condition</secondary>
17887 </indexterm>
17888 Preceding any condition with an exclamation mark negates the result of the
17889 condition.
17890 </para>
17891 </listitem></varlistentry>
17892 <varlistentry>
17893 <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>
17894 <listitem>
17895 <para>
17896 <indexterm role="concept">
17897 <primary>numeric comparison</primary>
17898 </indexterm>
17899 <indexterm role="concept">
17900 <primary>expansion</primary>
17901 <secondary>numeric comparison</secondary>
17902 </indexterm>
17903 There are a number of symbolic operators for doing numeric comparisons. They
17904 are:
17905 </para>
17906 <informaltable frame="none">
17907 <tgroup cols="2" colsep="0" rowsep="0">
17908 <colspec colwidth="10*" align="left"/>
17909 <colspec colwidth="90*" align="left"/>
17910 <tbody>
17911 <row>
17912 <entry>&nbsp;&nbsp;&nbsp;&nbsp;=   </entry>
17913 <entry>equal</entry>
17914 </row>
17915 <row>
17916 <entry>&nbsp;&nbsp;&nbsp;&nbsp;==  </entry>
17917 <entry>equal</entry>
17918 </row>
17919 <row>
17920 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&gt;   </entry>
17921 <entry>greater</entry>
17922 </row>
17923 <row>
17924 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&gt;=  </entry>
17925 <entry>greater or equal</entry>
17926 </row>
17927 <row>
17928 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&lt;   </entry>
17929 <entry>less</entry>
17930 </row>
17931 <row>
17932 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&lt;=  </entry>
17933 <entry>less or equal</entry>
17934 </row>
17935 </tbody>
17936 </tgroup>
17937 </informaltable>
17938 <para>
17939 For example:
17940 </para>
17941 <literallayout class="monospaced">
17942 ${if &gt;{$message_size}{10M} ...
17943 </literallayout>
17944 <para>
17945 Note that the general negation operator provides for inequality testing. The
17946 two strings must take the form of optionally signed decimal integers,
17947 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
17948 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
17949 As a special case, the numerical value of an empty string is taken as
17950 zero.
17951 </para>
17952 <para>
17953 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
17954 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
17955 10M, not if 10M is larger than <varname>$message_size</varname>.
17956 </para>
17957 </listitem></varlistentry>
17958 <varlistentry>
17959 <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>
17960 <listitem>
17961 <para>
17962 <indexterm role="concept">
17963 <primary>expansion</primary>
17964 <secondary>calling an acl</secondary>
17965 </indexterm>
17966 <indexterm role="concept">
17967 <primary><option>acl</option></primary>
17968 <secondary>expansion condition</secondary>
17969 </indexterm>
17970 The name and zero to nine argument strings are first expanded separately.  The expanded
17971 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
17972 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
17973 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
17974 and may use the variables; if another acl expansion is used the values
17975 are restored after it returns.  If the ACL sets
17976 a value using a "message =" modifier the variable $value becomes
17977 the result of the expansion, otherwise it is empty.
17978 If the ACL returns accept the condition is true; if deny, false.
17979 If the ACL returns defer the result is a forced-fail.
17980 </para>
17981 </listitem></varlistentry>
17982 <varlistentry>
17983 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17984 <listitem>
17985 <para>
17986 <indexterm role="concept">
17987 <primary>expansion</primary>
17988 <secondary>boolean parsing</secondary>
17989 </indexterm>
17990 <indexterm role="concept">
17991 <primary><option>bool</option> expansion condition</primary>
17992 </indexterm>
17993 This condition turns a string holding a true or false representation into
17994 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
17995 (case-insensitively); also integer numbers map to true if non-zero,
17996 false if zero.
17997 An empty string is treated as false.
17998 Leading and trailing whitespace is ignored;
17999 thus a string consisting only of whitespace is false.
18000 All other string values will result in expansion failure.
18001 </para>
18002 <para>
18003 When combined with ACL variables, this expansion condition will let you
18004 make decisions in one place and act on those decisions in another place.
18005 For example:
18006 </para>
18007 <literallayout class="monospaced">
18008 ${if bool{$acl_m_privileged_sender} ...
18009 </literallayout>
18010 </listitem></varlistentry>
18011 <varlistentry>
18012 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18013 <listitem>
18014 <para>
18015 <indexterm role="concept">
18016 <primary>expansion</primary>
18017 <secondary>boolean parsing</secondary>
18018 </indexterm>
18019 <indexterm role="concept">
18020 <primary><option>bool_lax</option> expansion condition</primary>
18021 </indexterm>
18022 Like <option>bool</option>, this condition turns a string into a boolean state.  But
18023 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
18024 loose definition that the Router <option>condition</option> option uses.  The empty string
18025 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
18026 true.  Leading and trailing whitespace is ignored.
18027 </para>
18028 <para>
18029 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
18030 </para>
18031 </listitem></varlistentry>
18032 <varlistentry>
18033 <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>
18034 <listitem>
18035 <para>
18036 <indexterm role="concept">
18037 <primary>expansion</primary>
18038 <secondary>encrypted comparison</secondary>
18039 </indexterm>
18040 <indexterm role="concept">
18041 <primary>encrypted strings, comparing</primary>
18042 </indexterm>
18043 <indexterm role="concept">
18044 <primary><option>crypteq</option> expansion condition</primary>
18045 </indexterm>
18046 This condition is included in the Exim binary if it is built to support any
18047 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
18048 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
18049 included in the binary.
18050 </para>
18051 <para>
18052 The <option>crypteq</option> condition has two arguments. The first is encrypted and
18053 compared against the second, which is already encrypted. The second string may
18054 be in the LDAP form for storing encrypted strings, which starts with the
18055 encryption type in curly brackets, followed by the data. If the second string
18056 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
18057 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
18058 Typically this will be a field from a password file. An example of an encrypted
18059 string in LDAP form is:
18060 </para>
18061 <literallayout class="monospaced">
18062 {md5}CY9rzUYh03PK3k6DJie09g==
18063 </literallayout>
18064 <para>
18065 If such a string appears directly in an expansion, the curly brackets have to
18066 be quoted, because they are part of the expansion syntax. For example:
18067 </para>
18068 <literallayout class="monospaced">
18069 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
18070 </literallayout>
18071 <para>
18072 The following encryption types (whose names are matched case-independently) are
18073 supported:
18074 </para>
18075 <itemizedlist>
18076 <listitem>
18077 <para>
18078 <indexterm role="concept">
18079 <primary>MD5 hash</primary>
18080 </indexterm>
18081 <indexterm role="concept">
18082 <primary>base64 encoding</primary>
18083 <secondary>in encrypted password</secondary>
18084 </indexterm>
18085 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
18086 printable characters to compare with the remainder of the second string. If the
18087 length of the comparison string is 24, Exim assumes that it is base64 encoded
18088 (as in the above example). If the length is 32, Exim assumes that it is a
18089 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
18090 comparison fails.
18091 </para>
18092 </listitem>
18093 <listitem>
18094 <para>
18095 <indexterm role="concept">
18096 <primary>SHA-1 hash</primary>
18097 </indexterm>
18098 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
18099 printable characters to compare with the remainder of the second string. If the
18100 length of the comparison string is 28, Exim assumes that it is base64 encoded.
18101 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
18102 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
18103 </para>
18104 </listitem>
18105 <listitem>
18106 <para>
18107 <indexterm role="concept">
18108 <primary><function>crypt()</function></primary>
18109 </indexterm>
18110 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
18111 only the first eight characters of the password. However, in modern operating
18112 systems this is no longer true, and in many cases the entire password is used,
18113 whatever its length.
18114 </para>
18115 </listitem>
18116 <listitem>
18117 <para>
18118 <indexterm role="concept">
18119 <primary><function>crypt16()</function></primary>
18120 </indexterm>
18121 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
18122 use up to 16 characters of the password in some operating systems. Again, in
18123 modern operating systems, more characters may be used.
18124 </para>
18125 </listitem>
18126 </itemizedlist>
18127 <para>
18128 Exim has its own version of <function>crypt16()</function>, which is just a double call to
18129 <function>crypt()</function>. For operating systems that have their own version, setting
18130 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
18131 operating system version instead of its own. This option is set by default in
18132 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
18133 support <function>crypt16()</function>.
18134 </para>
18135 <para>
18136 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
18137 it was not using the same algorithm as some operating systems&#x2019; versions. It
18138 turns out that as well as <function>crypt16()</function> there is a function called
18139 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
18140 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
18141 </para>
18142 <para>
18143 However, since there is now a move away from the traditional <function>crypt()</function>
18144 functions towards using SHA1 and other algorithms, tidying up this area of
18145 Exim is seen as very low priority.
18146 </para>
18147 <para>
18148 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
18149 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
18150 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
18151 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
18152 function by specifying it explicitly in curly brackets.
18153 </para>
18154 </listitem></varlistentry>
18155 <varlistentry>
18156 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
18157 <listitem>
18158 <para>
18159 <indexterm role="concept">
18160 <primary>expansion</primary>
18161 <secondary>checking for empty variable</secondary>
18162 </indexterm>
18163 <indexterm role="concept">
18164 <primary><option>def</option> expansion condition</primary>
18165 </indexterm>
18166 The <option>def</option> condition must be followed by the name of one of the expansion
18167 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
18168 variable does not contain the empty string. For example:
18169 </para>
18170 <literallayout class="monospaced">
18171 ${if def:sender_ident {from $sender_ident}}
18172 </literallayout>
18173 <para>
18174 Note that the variable name is given without a leading <option>$</option> character. If the
18175 variable does not exist, the expansion fails.
18176 </para>
18177 </listitem></varlistentry>
18178 <varlistentry>
18179 <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>
18180 <listitem>
18181 <para>
18182 <indexterm role="concept">
18183 <primary>expansion</primary>
18184 <secondary>checking header line existence</secondary>
18185 </indexterm>
18186 This condition is true if a message is being processed and the named header
18187 exists in the message. For example,
18188 </para>
18189 <literallayout class="monospaced">
18190 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
18191 </literallayout>
18192 <para>
18193 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
18194 the header name must be terminated by a colon if white space does not follow.
18195 </para>
18196 </listitem></varlistentry>
18197 <varlistentry>
18198 <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>
18199 <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>
18200 <listitem>
18201 <para>
18202 <indexterm role="concept">
18203 <primary>string</primary>
18204 <secondary>comparison</secondary>
18205 </indexterm>
18206 <indexterm role="concept">
18207 <primary>expansion</primary>
18208 <secondary>string comparison</secondary>
18209 </indexterm>
18210 <indexterm role="concept">
18211 <primary><option>eq</option> expansion condition</primary>
18212 </indexterm>
18213 <indexterm role="concept">
18214 <primary><option>eqi</option> expansion condition</primary>
18215 </indexterm>
18216 The two substrings are first expanded. The condition is true if the two
18217 resulting strings are identical. For <option>eq</option> the comparison includes the case of
18218 letters, whereas for <option>eqi</option> the comparison is case-independent, where
18219 case is defined per the system C locale.
18220 </para>
18221 </listitem></varlistentry>
18222 <varlistentry>
18223 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18224 <listitem>
18225 <para>
18226 <indexterm role="concept">
18227 <primary>expansion</primary>
18228 <secondary>file existence test</secondary>
18229 </indexterm>
18230 <indexterm role="concept">
18231 <primary>file</primary>
18232 <secondary>existence test</secondary>
18233 </indexterm>
18234 <indexterm role="concept">
18235 <primary><option>exists</option>, expansion condition</primary>
18236 </indexterm>
18237 The substring is first expanded and then interpreted as an absolute path. The
18238 condition is true if the named file (or directory) exists. The existence test
18239 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
18240 users&#x2019; filter files may be locked out by the system administrator.
18241 </para>
18242 <para>
18243 <emphasis role="bold">Note:</emphasis> Testing a path using this condition is not a sufficient way of
18244 de-tainting it.
18245 Consider using a dsearch lookup.
18246 </para>
18247 </listitem></varlistentry>
18248 <varlistentry>
18249 <term><emphasis role="bold">first_delivery</emphasis></term>
18250 <listitem>
18251 <para>
18252 <indexterm role="concept">
18253 <primary>delivery</primary>
18254 <secondary>first</secondary>
18255 </indexterm>
18256 <indexterm role="concept">
18257 <primary>first delivery</primary>
18258 </indexterm>
18259 <indexterm role="concept">
18260 <primary>expansion</primary>
18261 <secondary>first delivery test</secondary>
18262 </indexterm>
18263 <indexterm role="concept">
18264 <primary><option>first_delivery</option> expansion condition</primary>
18265 </indexterm>
18266 <indexterm role="concept">
18267 <primary>retry</primary>
18268 <secondary>condition</secondary>
18269 </indexterm>
18270 This condition, which has no data, is true during a message&#x2019;s first delivery
18271 attempt. It is false during any subsequent delivery attempts.
18272 </para>
18273 </listitem></varlistentry>
18274 <varlistentry>
18275 <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>
18276 <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>
18277 <listitem>
18278 <para>
18279 <indexterm role="concept">
18280 <primary>list</primary>
18281 <secondary>iterative conditions</secondary>
18282 </indexterm>
18283 <indexterm role="concept">
18284 <primary>expansion</primary>
18285 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
18286 </indexterm>
18287 <indexterm role="concept">
18288 <primary>expansion</primary>
18289 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
18290 </indexterm>
18291 <indexterm role="variable">
18292 <primary><varname>$item</varname></primary>
18293 </indexterm>
18294 These conditions iterate over a list. The first argument is expanded to form
18295 the list. By default, the list separator is a colon, but it can be changed by
18296 the normal method (<xref linkend="SECTlistsepchange"/>).
18297 The second argument is interpreted as a condition that is to
18298 be applied to each item in the list in turn. During the interpretation of the
18299 condition, the current list item is placed in a variable called <varname>$item</varname>.
18300 </para>
18301 <itemizedlist>
18302 <listitem>
18303 <para>
18304 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
18305 the result of the whole condition is true. If the condition is false for all
18306 items in the list, the overall condition is false.
18307 </para>
18308 </listitem>
18309 <listitem>
18310 <para>
18311 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
18312 and the result of the whole condition is false. If the condition is true for
18313 all items in the list, the overall condition is true.
18314 </para>
18315 </listitem>
18316 </itemizedlist>
18317 <para>
18318 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
18319 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
18320 that the condition must be false for at least one item.
18321 </para>
18322 <para>
18323 Example:
18324 </para>
18325 <literallayout class="monospaced">
18326 ${if forany{$recipients_list}{match{$item}{^user3@}}{yes}{no}}
18327 </literallayout>
18328 <para>
18329 The value of <varname>$item</varname> is saved and restored while <option>forany</option> or <option>forall</option> is
18330 being processed, to enable these expansion items to be nested.
18331 </para>
18332 <para>
18333 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
18334 </para>
18335 </listitem></varlistentry>
18336 <varlistentry>
18337 <term><emphasis role="bold">forall_json{</emphasis>&lt;<emphasis>a JSON array</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18338 <term><emphasis role="bold">forany_json{</emphasis>&lt;<emphasis>a JSON array</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18339 <term><emphasis role="bold">forall_jsons{</emphasis>&lt;<emphasis>a JSON array</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18340 <term><emphasis role="bold">forany_jsons{</emphasis>&lt;<emphasis>a JSON array</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>a condition</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18341 <listitem>
18342 <para>
18343 <indexterm role="concept">
18344 <primary>JSON</primary>
18345 <secondary>iterative conditions</secondary>
18346 </indexterm>
18347 <indexterm role="concept">
18348 <primary>JSON</primary>
18349 <secondary>expansions</secondary>
18350 </indexterm>
18351 <indexterm role="concept">
18352 <primary>expansion</primary>
18353 <secondary><emphasis role="bold">forall_json</emphasis> condition</secondary>
18354 </indexterm>
18355 <indexterm role="concept">
18356 <primary>expansion</primary>
18357 <secondary><emphasis role="bold">forany_json</emphasis> condition</secondary>
18358 </indexterm>
18359 <indexterm role="concept">
18360 <primary>expansion</primary>
18361 <secondary><emphasis role="bold">forall_jsons</emphasis> condition</secondary>
18362 </indexterm>
18363 <indexterm role="concept">
18364 <primary>expansion</primary>
18365 <secondary><emphasis role="bold">forany_jsons</emphasis> condition</secondary>
18366 </indexterm>
18367 As for the above, except that the first argument must, after expansion,
18368 be a JSON array.
18369 The array separator is not changeable.
18370 For the <quote>jsons</quote> variants the elements are expected to be JSON strings
18371 and have their quotes removed before the evaluation of the condition.
18372 </para>
18373 </listitem></varlistentry>
18374 <varlistentry>
18375 <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>
18376 <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>
18377 <listitem>
18378 <para>
18379 <indexterm role="concept">
18380 <primary>string</primary>
18381 <secondary>comparison</secondary>
18382 </indexterm>
18383 <indexterm role="concept">
18384 <primary>expansion</primary>
18385 <secondary>string comparison</secondary>
18386 </indexterm>
18387 <indexterm role="concept">
18388 <primary><option>ge</option> expansion condition</primary>
18389 </indexterm>
18390 <indexterm role="concept">
18391 <primary><option>gei</option> expansion condition</primary>
18392 </indexterm>
18393 The two substrings are first expanded. The condition is true if the first
18394 string is lexically greater than or equal to the second string. For <option>ge</option> the
18395 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
18396 case-independent.
18397 Case and collation order are defined per the system C locale.
18398 </para>
18399 </listitem></varlistentry>
18400 <varlistentry>
18401 <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>
18402 <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>
18403 <listitem>
18404 <para>
18405 <indexterm role="concept">
18406 <primary>string</primary>
18407 <secondary>comparison</secondary>
18408 </indexterm>
18409 <indexterm role="concept">
18410 <primary>expansion</primary>
18411 <secondary>string comparison</secondary>
18412 </indexterm>
18413 <indexterm role="concept">
18414 <primary><option>gt</option> expansion condition</primary>
18415 </indexterm>
18416 <indexterm role="concept">
18417 <primary><option>gti</option> expansion condition</primary>
18418 </indexterm>
18419 The two substrings are first expanded. The condition is true if the first
18420 string is lexically greater than the second string. For <option>gt</option> the comparison
18421 includes the case of letters, whereas for <option>gti</option> the comparison is
18422 case-independent.
18423 Case and collation order are defined per the system C locale.
18424 </para>
18425 </listitem></varlistentry>
18426 <varlistentry>
18427 <term><emphasis role="bold">inbound_srs&nbsp;{</emphasis>&lt;<emphasis>local&nbsp;part</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18428 <listitem>
18429 <para>
18430 SRS decode.  See SECT <xref linkend="SECTSRS"/> for details.
18431 </para>
18432 </listitem></varlistentry>
18433 <varlistentry>
18434 <term><emphasis role="bold">inlist&nbsp;{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>list</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18435 <term><emphasis role="bold">inlisti&nbsp;{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>list</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18436 <listitem>
18437 <para>
18438 <indexterm role="concept">
18439 <primary>string</primary>
18440 <secondary>comparison</secondary>
18441 </indexterm>
18442 <indexterm role="concept">
18443 <primary>list</primary>
18444 <secondary>iterative conditions</secondary>
18445 </indexterm>
18446 Both strings are expanded; the second string is treated as a list of simple
18447 strings; if the first string is a member of the second, then the condition
18448 is true.
18449 For the case-independent <option>inlisti</option> condition, case is defined per the system C locale.
18450 </para>
18451 <para>
18452 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
18453 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
18454 </para>
18455 <literallayout class="monospaced">
18456 ${if inlist{needle}{foo:needle:bar}}
18457   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
18458 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
18459   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
18460 </literallayout>
18461 <para>
18462 The variable <varname>$value</varname> will be set for a successful match and can be
18463 used in the success clause of an <option>if</option> expansion item using the condition.
18464 <indexterm role="concept">
18465 <primary>tainted data</primary>
18466 <secondary>de-tainting</secondary>
18467 </indexterm>
18468 <indexterm role="concept">
18469 <primary>de-tainting</primary>
18470 <secondary>using an inlist expansion condition</secondary>
18471 </indexterm>
18472 It will have the same taint status as the list; expansions such as
18473 </para>
18474 <literallayout class="monospaced">
18475 ${if inlist {$h_mycode:} {0 : 1 : 42} {$value}}
18476 </literallayout>
18477 <para>
18478 can be used for de-tainting.
18479 Any previous <varname>$value</varname> is restored after the if.
18480 </para>
18481 </listitem></varlistentry>
18482 <varlistentry>
18483 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18484 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18485 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18486 <listitem>
18487 <para>
18488 <indexterm role="concept">
18489 <primary>IP address</primary>
18490 <secondary>testing string format</secondary>
18491 </indexterm>
18492 <indexterm role="concept">
18493 <primary>string</primary>
18494 <secondary>testing for IP address</secondary>
18495 </indexterm>
18496 <indexterm role="concept">
18497 <primary><option>isip</option> expansion condition</primary>
18498 </indexterm>
18499 <indexterm role="concept">
18500 <primary><option>isip4</option> expansion condition</primary>
18501 </indexterm>
18502 <indexterm role="concept">
18503 <primary><option>isip6</option> expansion condition</primary>
18504 </indexterm>
18505 The substring is first expanded, and then tested to see if it has the form of
18506 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
18507 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
18508 </para>
18509 <para>
18510 For an IPv4 address, the test is for four dot-separated components, each of
18511 which consists of from one to three digits. For an IPv6 address, up to eight
18512 colon-separated components are permitted, each containing from one to four
18513 hexadecimal digits. There may be fewer than eight components if an empty
18514 component (adjacent colons) is present. Only one empty component is permitted.
18515 </para>
18516 <para>
18517 <emphasis role="bold">Note</emphasis>: The checks used to be just on the form of the address; actual numerical
18518 values were not considered. Thus, for example, 999.999.999.999 passed the IPv4
18519 check.
18520 This is no longer the case.
18521 </para>
18522 <para>
18523 The main use of these tests is to distinguish between IP addresses and
18524 host names, or between IPv4 and IPv6 addresses. For example, you could use
18525 </para>
18526 <literallayout class="monospaced">
18527 ${if isip4{$sender_host_address}...
18528 </literallayout>
18529 <para>
18530 to test which IP version an incoming SMTP connection is using.
18531 </para>
18532 </listitem></varlistentry>
18533 <varlistentry>
18534 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18535 <listitem>
18536 <para>
18537 <indexterm role="concept">
18538 <primary>LDAP</primary>
18539 <secondary>use for authentication</secondary>
18540 </indexterm>
18541 <indexterm role="concept">
18542 <primary>expansion</primary>
18543 <secondary>LDAP authentication test</secondary>
18544 </indexterm>
18545 <indexterm role="concept">
18546 <primary><option>ldapauth</option> expansion condition</primary>
18547 </indexterm>
18548 This condition supports user authentication using LDAP. See section
18549 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
18550 queries. For this use, the query must contain a user name and password. The
18551 query itself is not used, and can be empty. The condition is true if the
18552 password is not empty, and the user name and password are accepted by the LDAP
18553 server. An empty password is rejected without calling LDAP because LDAP binds
18554 with an empty password are considered anonymous regardless of the username, and
18555 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
18556 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
18557 this can be used.
18558 </para>
18559 </listitem></varlistentry>
18560 <varlistentry>
18561 <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>
18562 <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>
18563 <listitem>
18564 <para>
18565 <indexterm role="concept">
18566 <primary>string</primary>
18567 <secondary>comparison</secondary>
18568 </indexterm>
18569 <indexterm role="concept">
18570 <primary>expansion</primary>
18571 <secondary>string comparison</secondary>
18572 </indexterm>
18573 <indexterm role="concept">
18574 <primary><option>le</option> expansion condition</primary>
18575 </indexterm>
18576 <indexterm role="concept">
18577 <primary><option>lei</option> expansion condition</primary>
18578 </indexterm>
18579 The two substrings are first expanded. The condition is true if the first
18580 string is lexically less than or equal to the second string. For <option>le</option> the
18581 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
18582 case-independent.
18583 Case and collation order are defined per the system C locale.
18584 </para>
18585 </listitem></varlistentry>
18586 <varlistentry>
18587 <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>
18588 <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>
18589 <listitem>
18590 <para>
18591 <indexterm role="concept">
18592 <primary>string</primary>
18593 <secondary>comparison</secondary>
18594 </indexterm>
18595 <indexterm role="concept">
18596 <primary>expansion</primary>
18597 <secondary>string comparison</secondary>
18598 </indexterm>
18599 <indexterm role="concept">
18600 <primary><option>lt</option> expansion condition</primary>
18601 </indexterm>
18602 <indexterm role="concept">
18603 <primary><option>lti</option> expansion condition</primary>
18604 </indexterm>
18605 The two substrings are first expanded. The condition is true if the first
18606 string is lexically less than the second string. For <option>lt</option> the comparison
18607 includes the case of letters, whereas for <option>lti</option> the comparison is
18608 case-independent.
18609 Case and collation order are defined per the system C locale.
18610 </para>
18611 </listitem></varlistentry>
18612 <varlistentry>
18613 <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>
18614 <listitem>
18615 <para>
18616 <indexterm role="concept">
18617 <primary>expansion</primary>
18618 <secondary>regular expression comparison</secondary>
18619 </indexterm>
18620 <indexterm role="concept">
18621 <primary>regular expressions</primary>
18622 <secondary>match in expanded string</secondary>
18623 </indexterm>
18624 <indexterm role="concept">
18625 <primary><option>match</option> expansion condition</primary>
18626 </indexterm>
18627 The two substrings are first expanded. The second is then treated as a regular
18628 expression and applied to the first. Because of the pre-expansion, if the
18629 regular expression contains dollar, or backslash characters, they must be
18630 escaped. Care must also be taken if the regular expression contains braces
18631 (curly brackets). A closing brace must be escaped so that it is not taken as a
18632 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
18633 <literal>\N</literal> feature to disable expansion of the regular expression.
18634 For example,
18635 </para>
18636 <literallayout class="monospaced">
18637 ${if match {$local_part}{\N^\d{3}\N} ...
18638 </literallayout>
18639 <para>
18640 If the whole expansion string is in double quotes, further escaping of
18641 backslashes is also required.
18642 </para>
18643 <para>
18644 The condition is true if the regular expression match succeeds.
18645 The regular expression is not required to begin with a circumflex
18646 metacharacter, but if there is no circumflex, the expression is not anchored,
18647 and it may match anywhere in the subject, not just at the start. If you want
18648 the pattern to match at the end of the subject, you must include the <literal>$</literal>
18649 metacharacter at an appropriate point.
18650 All character handling is done in bytes and is not UTF-8 aware,
18651 but we might change this in a future Exim release.
18652 </para>
18653 <para>
18654 <indexterm role="concept">
18655 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
18656 <secondary>in <option>if</option> expansion</secondary>
18657 </indexterm>
18658 At the start of an <option>if</option> expansion the values of the numeric variable
18659 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
18660 succeeds causes them to be reset to the substrings of that condition and they
18661 will have these values during the expansion of the success string. At the end
18662 of the <option>if</option> expansion, the previous values are restored. After testing a
18663 combination of conditions using <option>or</option>, the subsequent values of the numeric
18664 variables are those of the condition that succeeded.
18665 </para>
18666 </listitem></varlistentry>
18667 <varlistentry>
18668 <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>
18669 <listitem>
18670 <para>
18671 <indexterm role="concept">
18672 <primary><option>match_address</option> expansion condition</primary>
18673 </indexterm>
18674 See <emphasis role="bold">match_local_part</emphasis>.
18675 </para>
18676 </listitem></varlistentry>
18677 <varlistentry>
18678 <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>
18679 <listitem>
18680 <para>
18681 <indexterm role="concept">
18682 <primary><option>match_domain</option> expansion condition</primary>
18683 </indexterm>
18684 See <emphasis role="bold">match_local_part</emphasis>.
18685 </para>
18686 </listitem></varlistentry>
18687 <varlistentry>
18688 <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>
18689 <listitem>
18690 <para>
18691 <indexterm role="concept">
18692 <primary><option>match_ip</option> expansion condition</primary>
18693 </indexterm>
18694 This condition matches an IP address to a list of IP address patterns. It must
18695 be followed by two argument strings. The first (after expansion) must be an IP
18696 address or an empty string. The second (not expanded) is a restricted host
18697 list that can match only an IP address, not a host name. For example:
18698 </para>
18699 <literallayout class="monospaced">
18700 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
18701 </literallayout>
18702 <para>
18703 The specific types of host list item that are permitted in the list are:
18704 </para>
18705 <itemizedlist>
18706 <listitem>
18707 <para>
18708 An IP address, optionally with a CIDR mask.
18709 </para>
18710 </listitem>
18711 <listitem>
18712 <para>
18713 A single asterisk, which matches any IP address.
18714 </para>
18715 </listitem>
18716 <listitem>
18717 <para>
18718 An empty item, which matches only if the IP address is empty. This could be
18719 useful for testing for a locally submitted message or one from specific hosts
18720 in a single test such as
18721 </para>
18722 <literallayout class="monospaced">
18723   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
18724 </literallayout>
18725 <para>
18726 where the first item in the list is the empty string.
18727 </para>
18728 </listitem>
18729 <listitem>
18730 <para>
18731 The item @[] matches any of the local host&#x2019;s interface addresses.
18732 </para>
18733 </listitem>
18734 <listitem>
18735 <para>
18736 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
18737 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
18738 address into a host name. The most common type of linear search for
18739 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
18740 masks. For example:
18741 </para>
18742 <literallayout class="monospaced">
18743   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
18744 </literallayout>
18745 <para>
18746 It is of course possible to use other kinds of lookup, and in such a case, you
18747 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
18748 address mask, for example:
18749 </para>
18750 <literallayout class="monospaced">
18751   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
18752 </literallayout>
18753 <para>
18754 However, unless you are combining a <option>match_ip</option> condition with others, it is
18755 just as easy to use the fact that a lookup is itself a condition, and write:
18756 </para>
18757 <literallayout class="monospaced">
18758   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
18759 </literallayout>
18760 </listitem>
18761 </itemizedlist>
18762 <para>
18763 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18764 Exim was built with the EXPAND_LISTMATCH_RHS option.
18765 </para>
18766 <para>
18767 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
18768 </para>
18769 <para>
18770 The variable <varname>$value</varname> will be set for a successful match and can be
18771 used in the success clause of an <option>if</option> expansion item using the condition.
18772 Any previous <varname>$value</varname> is restored after the if.
18773 </para>
18774 </listitem></varlistentry>
18775 <varlistentry>
18776 <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>
18777 <listitem>
18778 <para>
18779 <indexterm role="concept">
18780 <primary>domain list</primary>
18781 <secondary>in expansion condition</secondary>
18782 </indexterm>
18783 <indexterm role="concept">
18784 <primary>address list</primary>
18785 <secondary>in expansion condition</secondary>
18786 </indexterm>
18787 <indexterm role="concept">
18788 <primary>local part</primary>
18789 <secondary>list, in expansion condition</secondary>
18790 </indexterm>
18791 <indexterm role="concept">
18792 <primary><option>match_local_part</option> expansion condition</primary>
18793 </indexterm>
18794 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
18795 possible to test domain, address, and local part lists within expansions. Each
18796 condition requires two arguments: an item and a list to match. A trivial
18797 example is:
18798 </para>
18799 <literallayout class="monospaced">
18800 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
18801 </literallayout>
18802 <para>
18803 In each case, the second argument may contain any of the allowable items for a
18804 list of the appropriate type. Also, because the second argument
18805 is a standard form of list, it is possible to refer to a named list.
18806 Thus, you can use conditions like this:
18807 </para>
18808 <literallayout class="monospaced">
18809 ${if match_domain{$domain}{+local_domains}{...
18810 </literallayout>
18811 <para>
18812 <indexterm role="concept">
18813 <primary><literal>+caseful</literal></primary>
18814 </indexterm>
18815 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
18816 item can be used, as in all address lists, to cause subsequent items to
18817 have their local parts matched casefully. Domains are always matched
18818 caselessly.
18819 </para>
18820 <para>
18821 The variable <varname>$value</varname> will be set for a successful match and can be
18822 used in the success clause of an <option>if</option> expansion item using the condition.
18823 <indexterm role="concept">
18824 <primary>tainted data</primary>
18825 <secondary>de-tainting</secondary>
18826 </indexterm>
18827 <indexterm role="concept">
18828 <primary>de-tainting</primary>
18829 <secondary>using a match_local_part expansion condition</secondary>
18830 </indexterm>
18831 It will have the same taint status as the list; expansions such as
18832 </para>
18833 <literallayout class="monospaced">
18834 ${if match_local_part {$local_part} {alice : bill : charlotte : dave} {$value}}
18835 </literallayout>
18836 <para>
18837 can be used for de-tainting.
18838 Any previous <varname>$value</varname> is restored after the if.
18839 </para>
18840 <para>
18841 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18842 Exim was built with the EXPAND_LISTMATCH_RHS option.
18843 </para>
18844 <para>
18845 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
18846 hosts have two identities: a name and an IP address, and it is not clear
18847 how to specify cleanly how such a test would work. However, IP addresses can be
18848 matched using <option>match_ip</option>.
18849 </para>
18850 </listitem></varlistentry>
18851 <varlistentry>
18852 <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>
18853 <listitem>
18854 <para>
18855 <indexterm role="concept">
18856 <primary>PAM authentication</primary>
18857 </indexterm>
18858 <indexterm role="concept">
18859 <primary>AUTH</primary>
18860 <secondary>with PAM</secondary>
18861 </indexterm>
18862 <indexterm role="concept">
18863 <primary>Solaris</primary>
18864 <secondary>PAM support</secondary>
18865 </indexterm>
18866 <indexterm role="concept">
18867 <primary>expansion</primary>
18868 <secondary>PAM authentication test</secondary>
18869 </indexterm>
18870 <indexterm role="concept">
18871 <primary><option>pam</option> expansion condition</primary>
18872 </indexterm>
18873 <emphasis>Pluggable Authentication Modules</emphasis>
18874 (<emphasis role="bold"><ulink url="https://mirrors.edge.kernel.org/pub/linux/libs/pam/">https://mirrors.edge.kernel.org/pub/linux/libs/pam/</ulink></emphasis>) are a facility that is
18875 available in Solaris
18876 and in some GNU/Linux distributions.
18877 The Exim support, which is intended for use in conjunction with
18878 the SMTP AUTH command, is available only if Exim is compiled with
18879 </para>
18880 <literallayout class="monospaced">
18881 SUPPORT_PAM=yes
18882 </literallayout>
18883 <para>
18884 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
18885 in some releases of GNU/Linux <option>-ldl</option> is also needed.
18886 </para>
18887 <para>
18888 The argument string is first expanded, and the result must be a
18889 colon-separated list of strings. Leading and trailing white space is ignored.
18890 The PAM module is initialized with the service name <quote>exim</quote> and the user name
18891 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
18892 The remaining items in the data string are passed over in response to requests
18893 from the authentication function. In the simple case there will only be one
18894 request, for a password, so the data consists of just two strings.
18895 </para>
18896 <para>
18897 There can be problems if any of the strings are permitted to contain colon
18898 characters. In the usual way, these have to be doubled to avoid being taken as
18899 separators.
18900 The <option>listquote</option> expansion item can be used for this.
18901 For example, the configuration
18902 of a LOGIN authenticator might contain this setting:
18903 </para>
18904 <literallayout class="monospaced">
18905 server_condition = ${if pam{$auth1:${listquote{:}{$auth2}}}}
18906 </literallayout>
18907 <para>
18908 In some operating systems, PAM authentication can be done only from a process
18909 running as root. Since Exim is running as the Exim user when receiving
18910 messages, this means that PAM cannot be used directly in those systems.
18911 </para>
18912 </listitem></varlistentry>
18913 <varlistentry>
18914 <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>
18915 <listitem>
18916 <para>
18917 <indexterm role="concept">
18918 <primary><emphasis>pwcheck</emphasis> daemon</primary>
18919 </indexterm>
18920 <indexterm role="concept">
18921 <primary>Cyrus</primary>
18922 </indexterm>
18923 <indexterm role="concept">
18924 <primary>expansion</primary>
18925 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
18926 </indexterm>
18927 <indexterm role="concept">
18928 <primary><option>pwcheck</option> expansion condition</primary>
18929 </indexterm>
18930 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
18931 This is one way of making it possible for passwords to be checked by a process
18932 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
18933 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
18934 </para>
18935 <para>
18936 The pwcheck support is not included in Exim by default. You need to specify
18937 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
18938 building Exim. For example:
18939 </para>
18940 <literallayout class="monospaced">
18941 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
18942 </literallayout>
18943 <para>
18944 You do not need to install the full Cyrus software suite in order to use
18945 the pwcheck daemon. You can compile and install just the daemon alone
18946 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
18947 access to the <filename>/var/pwcheck</filename> directory.
18948 </para>
18949 <para>
18950 The <option>pwcheck</option> condition takes one argument, which must be the user name and
18951 password, separated by a colon. For example, in a LOGIN authenticator
18952 configuration, you might have this:
18953 </para>
18954 <literallayout class="monospaced">
18955 server_condition = ${if pwcheck{$auth1:$auth2}}
18956 </literallayout>
18957 <para>
18958 Again, for a PLAIN authenticator configuration, this would be:
18959 </para>
18960 <literallayout class="monospaced">
18961 server_condition = ${if pwcheck{$auth2:$auth3}}
18962 </literallayout>
18963 </listitem></varlistentry>
18964 <varlistentry>
18965 <term><emphasis role="bold">queue_running</emphasis></term>
18966 <listitem>
18967 <para>
18968 <indexterm role="concept">
18969 <primary>queue runner</primary>
18970 <secondary>detecting when delivering from</secondary>
18971 </indexterm>
18972 <indexterm role="concept">
18973 <primary>expansion</primary>
18974 <secondary>queue runner test</secondary>
18975 </indexterm>
18976 <indexterm role="concept">
18977 <primary><option>queue_running</option> expansion condition</primary>
18978 </indexterm>
18979 This condition, which has no data, is true during delivery attempts that are
18980 initiated by queue runner processes, and false otherwise.
18981 </para>
18982 </listitem></varlistentry>
18983 <varlistentry>
18984 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18985 <listitem>
18986 <para>
18987 <indexterm role="concept">
18988 <primary>Radius</primary>
18989 </indexterm>
18990 <indexterm role="concept">
18991 <primary>expansion</primary>
18992 <secondary>Radius authentication</secondary>
18993 </indexterm>
18994 <indexterm role="concept">
18995 <primary><option>radius</option> expansion condition</primary>
18996 </indexterm>
18997 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
18998 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
18999 the Radius client configuration file in order to build Exim with Radius
19000 support.
19001 </para>
19002 <para>
19003 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
19004 library, using the original API. If you are using release 0.4.0 or later of
19005 this library, you need to set
19006 </para>
19007 <literallayout class="monospaced">
19008 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
19009 </literallayout>
19010 <para>
19011 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
19012 <option>libradius</option> library that comes with FreeBSD. To do this, set
19013 </para>
19014 <literallayout class="monospaced">
19015 RADIUS_LIB_TYPE=RADLIB
19016 </literallayout>
19017 <para>
19018 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
19019 You may also have to supply a suitable setting in EXTRALIBS so that the
19020 Radius library can be found when Exim is linked.
19021 </para>
19022 <para>
19023 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
19024 Radius client library, which calls the Radius server. The condition is true if
19025 the authentication is successful. For example:
19026 </para>
19027 <literallayout class="monospaced">
19028 server_condition = ${if radius{&lt;arguments&gt;}}
19029 </literallayout>
19030 </listitem></varlistentry>
19031 <varlistentry>
19032 <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>
19033 <listitem>
19034 <para>
19035 <indexterm role="concept">
19036 <primary><emphasis>saslauthd</emphasis> daemon</primary>
19037 </indexterm>
19038 <indexterm role="concept">
19039 <primary>Cyrus</primary>
19040 </indexterm>
19041 <indexterm role="concept">
19042 <primary>expansion</primary>
19043 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
19044 </indexterm>
19045 <indexterm role="concept">
19046 <primary><option>saslauthd</option> expansion condition</primary>
19047 </indexterm>
19048 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
19049 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
19050 Using this daemon is one way of making it possible for passwords to be checked
19051 by a process that is not running as root.
19052 </para>
19053 <para>
19054 The saslauthd support is not included in Exim by default. You need to specify
19055 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
19056 building Exim. For example:
19057 </para>
19058 <literallayout class="monospaced">
19059 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
19060 </literallayout>
19061 <para>
19062 You do not need to install the full Cyrus software suite in order to use
19063 the saslauthd daemon. You can compile and install just the daemon alone
19064 from the Cyrus SASL library.
19065 </para>
19066 <para>
19067 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
19068 two are mandatory. For example:
19069 </para>
19070 <literallayout class="monospaced">
19071 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
19072 </literallayout>
19073 <para>
19074 The service and the realm are optional (which is why the arguments are enclosed
19075 in their own set of braces). For details of the meaning of the service and
19076 realm, and how to run the daemon, consult the Cyrus documentation.
19077 </para>
19078 </listitem></varlistentry>
19079 </variablelist>
19080 </section>
19081 <section id="SECID84">
19082 <title>Combining expansion conditions</title>
19083 <para>
19084 <indexterm role="concept">
19085 <primary>expansion</primary>
19086 <secondary>combining conditions</secondary>
19087 </indexterm>
19088 Several conditions can be tested at once by combining them using the <option>and</option>
19089 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
19090 conditions on their own, and precede their lists of sub-conditions. Each
19091 sub-condition must be enclosed in braces within the overall braces that contain
19092 the list. No repetition of <option>if</option> is used.
19093 </para>
19094 <variablelist>
19095 <varlistentry>
19096 <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>
19097 <listitem>
19098 <para>
19099 <indexterm role="concept">
19100 <primary><quote>or</quote> expansion condition</primary>
19101 </indexterm>
19102 <indexterm role="concept">
19103 <primary>expansion</primary>
19104 <secondary><quote>or</quote> of conditions</secondary>
19105 </indexterm>
19106 The sub-conditions are evaluated from left to right. The condition is true if
19107 any one of the sub-conditions is true.
19108 For example,
19109 </para>
19110 <literallayout class="monospaced">
19111 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
19112 </literallayout>
19113 <para>
19114 When a true sub-condition is found, the following ones are parsed but not
19115 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
19116 numeric variables afterwards are taken from the first one that succeeds.
19117 </para>
19118 </listitem></varlistentry>
19119 <varlistentry>
19120 <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>
19121 <listitem>
19122 <para>
19123 <indexterm role="concept">
19124 <primary><quote>and</quote> expansion condition</primary>
19125 </indexterm>
19126 <indexterm role="concept">
19127 <primary>expansion</primary>
19128 <secondary><quote>and</quote> of conditions</secondary>
19129 </indexterm>
19130 The sub-conditions are evaluated from left to right. The condition is true if
19131 all of the sub-conditions are true. If there are several <quote>match</quote>
19132 sub-conditions, the values of the numeric variables afterwards are taken from
19133 the last one. When a false sub-condition is found, the following ones are
19134 parsed but not evaluated.
19135 </para>
19136 </listitem></varlistentry>
19137 </variablelist>
19138 <para>
19139 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
19140 </para>
19141 </section>
19142 <section id="SECTexpvar">
19143 <title>Expansion variables</title>
19144 <para>
19145 <indexterm role="concept">
19146 <primary>expansion</primary>
19147 <secondary>variables, list of</secondary>
19148 </indexterm>
19149 This section contains an alphabetical list of all the expansion variables. Some
19150 of them are available only when Exim is compiled with specific options such as
19151 support for TLS or the content scanning extension.
19152 <indexterm role="concept">
19153 <primary>tainted data</primary>
19154 </indexterm>
19155 Variables marked as <emphasis>tainted</emphasis> are likely to carry data supplied by
19156 a potential attacker.
19157 Variables without such marking may also, depending on how their
19158 values are created.
19159 Such variables should not be further expanded,
19160 used as filenames
19161 or used as command-line arguments for external commands.
19162 </para>
19163 <variablelist>
19164 <varlistentry>
19165 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
19166 <listitem>
19167 <para>
19168 <indexterm role="concept">
19169 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
19170 </indexterm>
19171 When a <option>match</option> expansion condition succeeds, these variables contain the
19172 captured substrings identified by the regular expression during subsequent
19173 processing of the success string of the containing <option>if</option> expansion item.
19174 In the expansion condition case
19175 they do not retain their values afterwards; in fact, their previous
19176 values are restored at the end of processing an <option>if</option> item. The numerical
19177 variables may also be set externally by some other matching process which
19178 precedes the expansion of the string. For example, the commands available in
19179 Exim filter files include an <option>if</option> command with its own regular expression
19180 matching condition.
19181 If the subject string was tainted then any captured substring will also be.
19182 </para>
19183 </listitem></varlistentry>
19184 <varlistentry>
19185 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
19186 <listitem>
19187 <para>
19188 Within an acl condition, expansion condition or expansion item
19189 any arguments are copied to these variables,
19190 any unused variables being made empty.
19191 </para>
19192 </listitem></varlistentry>
19193 <varlistentry>
19194 <term><varname>$acl_c...</varname></term>
19195 <listitem>
19196 <para>
19197 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
19198 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
19199 long, but the sixth character must be either a digit or an underscore. For
19200 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
19201 variables persist throughout the lifetime of an SMTP connection. They can be
19202 used to pass information between ACLs and between different invocations of the
19203 same ACL. When a message is received, the values of these variables are saved
19204 with the message, and can be accessed by filters, routers, and transports
19205 during subsequent delivery.
19206 </para>
19207 </listitem></varlistentry>
19208 <varlistentry>
19209 <term><varname>$acl_m...</varname></term>
19210 <listitem>
19211 <para>
19212 These variables are like the <varname>$acl_c...</varname> variables, except that their values
19213 are reset after a message has been received. Thus, if several messages are
19214 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
19215 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
19216 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
19217 message is received, the values of these variables are saved with the message,
19218 and can be accessed by filters, routers, and transports during subsequent
19219 delivery.
19220 </para>
19221 </listitem></varlistentry>
19222 <varlistentry>
19223 <term><varname>$acl_narg</varname></term>
19224 <listitem>
19225 <para>
19226 Within an acl condition, expansion condition or expansion item
19227 this variable has the number of arguments.
19228 </para>
19229 </listitem></varlistentry>
19230 <varlistentry>
19231 <term><varname>$acl_verify_message</varname></term>
19232 <listitem>
19233 <para>
19234 <indexterm role="variable">
19235 <primary><varname>$acl_verify_message</varname></primary>
19236 </indexterm>
19237 After an address verification has failed, this variable contains the failure
19238 message. It retains its value for use in subsequent modifiers of the verb.
19239 The message can be preserved by coding like this:
19240 </para>
19241 <literallayout class="monospaced">
19242 warn !verify = sender
19243      set acl_m0 = $acl_verify_message
19244 </literallayout>
19245 <para>
19246 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
19247 <option>log_message</option> modifiers, to include information about the verification
19248 failure.
19249 <emphasis role="bold">Note</emphasis>: The variable is cleared at the end of processing the ACL verb.
19250 </para>
19251 </listitem></varlistentry>
19252 <varlistentry>
19253 <term><varname>$address_data</varname></term>
19254 <listitem>
19255 <para>
19256 <indexterm role="variable">
19257 <primary><varname>$address_data</varname></primary>
19258 </indexterm>
19259 This variable is set by means of the <option>address_data</option> option in routers. The
19260 value then remains with the address while it is processed by subsequent routers
19261 and eventually a transport. If the transport is handling multiple addresses,
19262 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
19263 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
19264 user filter files.
19265 </para>
19266 <para>
19267 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
19268 a recipient address, the final value is still in the variable for subsequent
19269 conditions and modifiers of the ACL statement. If routing the address caused it
19270 to be redirected to just one address, the child address is also routed as part
19271 of the verification, and in this case the final value of <varname>$address_data</varname> is
19272 from the child&#x2019;s routing.
19273 </para>
19274 <para>
19275 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19276 sender address, the final value is also preserved, but this time in
19277 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
19278 address.
19279 </para>
19280 <para>
19281 In both cases (recipient and sender verification), the value does not persist
19282 after the end of the current ACL statement. If you want to preserve
19283 these values for longer, you can save them in ACL variables.
19284 </para>
19285 </listitem></varlistentry>
19286 <varlistentry>
19287 <term><varname>$address_file</varname></term>
19288 <listitem>
19289 <para>
19290 <indexterm role="variable">
19291 <primary><varname>$address_file</varname></primary>
19292 </indexterm>
19293 When, as a result of aliasing, forwarding, or filtering, a message is directed
19294 to a specific file, this variable holds the name of the file when the transport
19295 is running. At other times, the variable is empty. For example, using the
19296 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
19297 </para>
19298 <literallayout class="monospaced">
19299 /home/r2d2/savemail
19300 </literallayout>
19301 <para>
19302 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
19303 contains the text string <literal>/home/r2d2/savemail</literal>.
19304 <indexterm role="concept">
19305 <primary>Sieve filter</primary>
19306 <secondary>value of <varname>$address_file</varname></secondary>
19307 </indexterm>
19308 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
19309 then up to the transport configuration to generate an appropriate absolute path
19310 to the relevant file.
19311 </para>
19312 </listitem></varlistentry>
19313 <varlistentry>
19314 <term><varname>$address_pipe</varname></term>
19315 <listitem>
19316 <para>
19317 <indexterm role="variable">
19318 <primary><varname>$address_pipe</varname></primary>
19319 </indexterm>
19320 When, as a result of aliasing or forwarding, a message is directed to a pipe,
19321 this variable holds the pipe command when the transport is running.
19322 </para>
19323 </listitem></varlistentry>
19324 <varlistentry>
19325 <term><varname>$auth1</varname> &ndash; <varname>$auth4</varname></term>
19326 <listitem>
19327 <para>
19328 <indexterm role="variable">
19329 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
19330 </indexterm>
19331 These variables are used in SMTP authenticators (see chapters
19332 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
19333 </para>
19334 </listitem></varlistentry>
19335 <varlistentry>
19336 <term><varname>$authenticated_id</varname></term>
19337 <listitem>
19338 <para>
19339 <indexterm role="concept">
19340 <primary>authentication</primary>
19341 <secondary>id</secondary>
19342 </indexterm>
19343 <indexterm role="variable">
19344 <primary><varname>$authenticated_id</varname></primary>
19345 </indexterm>
19346 When a server successfully authenticates a client it may be configured to
19347 preserve some of the authentication information in the variable
19348 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
19349 user/password authenticator configuration might preserve the user name for use
19350 in the routers. Note that this is not the same information that is saved in
19351 <varname>$sender_host_authenticated</varname>.
19352 </para>
19353 <para>
19354 When a message is submitted locally (that is, not over a TCP connection)
19355 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
19356 process. However, a trusted user can override this by means of the <option>-oMai</option>
19357 command line option.
19358 This second case also sets up information used by the
19359 <varname>$authresults</varname> expansion item.
19360 </para>
19361 </listitem></varlistentry>
19362 <varlistentry>
19363 <term><varname>$authenticated_fail_id</varname></term>
19364 <listitem>
19365 <para>
19366 <indexterm role="concept">
19367 <primary>authentication</primary>
19368 <secondary>fail</secondary>
19369 </indexterm>
19370 <indexterm role="variable">
19371 <primary><varname>$authenticated_fail_id</varname></primary>
19372 </indexterm>
19373 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
19374 will contain the failed authentication id. If more than one authentication
19375 id is attempted, it will contain only the last one. The variable is
19376 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
19377 A message to a local recipient could still be accepted without requiring
19378 authentication, which means this variable could also be visible in all of
19379 the ACL&#x2019;s as well.
19380 </para>
19381 </listitem></varlistentry>
19382 <varlistentry>
19383 <term><varname>$authenticated_sender</varname></term>
19384 <listitem>
19385 <para>
19386 <indexterm role="variable">
19387 <primary><varname>$authenticated_sender</varname></primary>
19388 </indexterm>
19389 </para>
19390 <informaltable frame="none">
19391 <tgroup cols="1" colsep="0" rowsep="0">
19392 <colspec colwidth="10pt" align="left"/>
19393 <tbody>
19394 <row>
19395 <entry><emphasis>Tainted</emphasis></entry>
19396 </row>
19397 </tbody>
19398 </tgroup>
19399 </informaltable>
19400 <para>
19401 <indexterm role="concept">
19402 <primary>sender</primary>
19403 <secondary>authenticated</secondary>
19404 </indexterm>
19405 <indexterm role="concept">
19406 <primary>authentication</primary>
19407 <secondary>sender</secondary>
19408 </indexterm>
19409 <indexterm role="concept">
19410 <primary>AUTH</primary>
19411 <secondary>on MAIL command</secondary>
19412 </indexterm>
19413 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
19414 SMTP MAIL command if it believes the sender is sufficiently trusted, as
19415 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
19416 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
19417 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
19418 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
19419 </para>
19420 <para>
19421 <indexterm role="variable">
19422 <primary><varname>$qualify_domain</varname></primary>
19423 </indexterm>
19424 When a message is submitted locally (that is, not over a TCP connection), the
19425 value of <varname>$authenticated_sender</varname> is an address constructed from the login
19426 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
19427 can override this by means of the <option>-oMas</option> command line option.
19428 </para>
19429 </listitem></varlistentry>
19430 <varlistentry>
19431 <term><varname>$authentication_failed</varname></term>
19432 <listitem>
19433 <para>
19434 <indexterm role="concept">
19435 <primary>authentication</primary>
19436 <secondary>failure</secondary>
19437 </indexterm>
19438 <indexterm role="variable">
19439 <primary><varname>$authentication_failed</varname></primary>
19440 </indexterm>
19441 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
19442 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
19443 possible to distinguish between <quote>did not try to authenticate</quote>
19444 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
19445 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
19446 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>).
19447 Failure includes cancellation of a authentication attempt,
19448 and any negative response to an AUTH command,
19449 (including, for example, an attempt to use an undefined mechanism).
19450 </para>
19451 </listitem></varlistentry>
19452 <varlistentry>
19453 <term><varname>$av_failed</varname></term>
19454 <listitem>
19455 <para>
19456 <indexterm role="concept">
19457 <primary>content scanning</primary>
19458 <secondary>AV scanner failure</secondary>
19459 </indexterm>
19460 This variable is available when Exim is compiled with the content-scanning
19461 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
19462 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
19463 the ACL malware condition.
19464 </para>
19465 </listitem></varlistentry>
19466 <varlistentry>
19467 <term><varname>$body_linecount</varname></term>
19468 <listitem>
19469 <para>
19470 <indexterm role="concept">
19471 <primary>message body</primary>
19472 <secondary>line count</secondary>
19473 </indexterm>
19474 <indexterm role="concept">
19475 <primary>body of message</primary>
19476 <secondary>line count</secondary>
19477 </indexterm>
19478 <indexterm role="variable">
19479 <primary><varname>$body_linecount</varname></primary>
19480 </indexterm>
19481 When a message is being received or delivered, this variable contains the
19482 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
19483 </para>
19484 </listitem></varlistentry>
19485 <varlistentry>
19486 <term><varname>$body_zerocount</varname></term>
19487 <listitem>
19488 <para>
19489 <indexterm role="concept">
19490 <primary>message body</primary>
19491 <secondary>binary zero count</secondary>
19492 </indexterm>
19493 <indexterm role="concept">
19494 <primary>body of message</primary>
19495 <secondary>binary zero count</secondary>
19496 </indexterm>
19497 <indexterm role="concept">
19498 <primary>binary zero</primary>
19499 <secondary>in message body</secondary>
19500 </indexterm>
19501 <indexterm role="variable">
19502 <primary><varname>$body_zerocount</varname></primary>
19503 </indexterm>
19504 When a message is being received or delivered, this variable contains the
19505 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
19506 </para>
19507 </listitem></varlistentry>
19508 <varlistentry>
19509 <term><varname>$bounce_recipient</varname></term>
19510 <listitem>
19511 <para>
19512 <indexterm role="variable">
19513 <primary><varname>$bounce_recipient</varname></primary>
19514 </indexterm>
19515 This is set to the recipient address of a bounce message while Exim is creating
19516 it. It is useful if a customized bounce message text file is in use (see
19517 chapter <xref linkend="CHAPemsgcust"/>).
19518 </para>
19519 </listitem></varlistentry>
19520 <varlistentry>
19521 <term><varname>$bounce_return_size_limit</varname></term>
19522 <listitem>
19523 <para>
19524 <indexterm role="variable">
19525 <primary><varname>$bounce_return_size_limit</varname></primary>
19526 </indexterm>
19527 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
19528 up to a multiple of 1000. It is useful when a customized error message text
19529 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
19530 </para>
19531 </listitem></varlistentry>
19532 <varlistentry>
19533 <term><varname>$caller_gid</varname></term>
19534 <listitem>
19535 <para>
19536 <indexterm role="concept">
19537 <primary>gid (group id)</primary>
19538 <secondary>caller</secondary>
19539 </indexterm>
19540 <indexterm role="variable">
19541 <primary><varname>$caller_gid</varname></primary>
19542 </indexterm>
19543 The real group id under which the process that called Exim was running. This is
19544 not the same as the group id of the originator of a message (see
19545 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
19546 incarnation normally contains the Exim gid.
19547 </para>
19548 </listitem></varlistentry>
19549 <varlistentry>
19550 <term><varname>$caller_uid</varname></term>
19551 <listitem>
19552 <para>
19553 <indexterm role="concept">
19554 <primary>uid (user id)</primary>
19555 <secondary>caller</secondary>
19556 </indexterm>
19557 <indexterm role="variable">
19558 <primary><varname>$caller_uid</varname></primary>
19559 </indexterm>
19560 The real user id under which the process that called Exim was running. This is
19561 not the same as the user id of the originator of a message (see
19562 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
19563 incarnation normally contains the Exim uid.
19564 </para>
19565 </listitem></varlistentry>
19566 <varlistentry>
19567 <term><varname>$callout_address</varname></term>
19568 <listitem>
19569 <para>
19570 <indexterm role="variable">
19571 <primary><varname>$callout_address</varname></primary>
19572 </indexterm>
19573 After a callout for verification, spamd or malware daemon service, the
19574 address that was connected to.
19575 </para>
19576 </listitem></varlistentry>
19577 <varlistentry>
19578 <term><varname>$compile_number</varname></term>
19579 <listitem>
19580 <para>
19581 <indexterm role="variable">
19582 <primary><varname>$compile_number</varname></primary>
19583 </indexterm>
19584 The building process for Exim keeps a count of the number
19585 of times it has been compiled. This serves to distinguish different
19586 compilations of the same version of Exim.
19587 </para>
19588 </listitem></varlistentry>
19589 <varlistentry>
19590 <term><varname>$config_dir</varname></term>
19591 <listitem>
19592 <para>
19593 <indexterm role="variable">
19594 <primary><varname>$config_dir</varname></primary>
19595 </indexterm>
19596 The directory name of the main configuration file. That is, the content of
19597 <varname>$config_file</varname> with the last component stripped. The value does not
19598 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
19599 <varname>$config_dir</varname> is ".".
19600 </para>
19601 </listitem></varlistentry>
19602 <varlistentry>
19603 <term><varname>$config_file</varname></term>
19604 <listitem>
19605 <para>
19606 <indexterm role="variable">
19607 <primary><varname>$config_file</varname></primary>
19608 </indexterm>
19609 The name of the main configuration file Exim is using.
19610 </para>
19611 </listitem></varlistentry>
19612 <varlistentry>
19613 <term><varname>$dkim_verify_status</varname></term>
19614 <listitem>
19615 <para>
19616 Results of DKIM verification.
19617 For details see section <xref linkend="SECDKIMVFY"/>.
19618 </para>
19619 </listitem></varlistentry>
19620 <varlistentry>
19621 <term><varname>$dkim_cur_signer</varname></term>
19622 <term><varname>$dkim_verify_reason</varname></term>
19623 <term><varname>$dkim_domain</varname></term>
19624 <term><varname>$dkim_identity</varname></term>
19625 <term><varname>$dkim_selector</varname></term>
19626 <term><varname>$dkim_algo</varname></term>
19627 <term><varname>$dkim_canon_body</varname></term>
19628 <term><varname>$dkim_canon_headers</varname></term>
19629 <term><varname>$dkim_copiedheaders</varname></term>
19630 <term><varname>$dkim_bodylength</varname></term>
19631 <term><varname>$dkim_created</varname></term>
19632 <term><varname>$dkim_expires</varname></term>
19633 <term><varname>$dkim_headernames</varname></term>
19634 <term><varname>$dkim_key_testing</varname></term>
19635 <term><varname>$dkim_key_nosubdomains</varname></term>
19636 <term><varname>$dkim_key_srvtype</varname></term>
19637 <term><varname>$dkim_key_granularity</varname></term>
19638 <term><varname>$dkim_key_notes</varname></term>
19639 <term><varname>$dkim_key_length</varname></term>
19640 <listitem>
19641 <para>
19642 These variables are only available within the DKIM ACL.
19643 For details see section <xref linkend="SECDKIMVFY"/>.
19644 </para>
19645 </listitem></varlistentry>
19646 <varlistentry>
19647 <term><varname>$dkim_signers</varname></term>
19648 <listitem>
19649 <para>
19650 <indexterm role="variable">
19651 <primary><varname>$dkim_signers</varname></primary>
19652 </indexterm>
19653 When a message has been received this variable contains
19654 a colon-separated list of signer domains and identities for the message.
19655 For details see section <xref linkend="SECDKIMVFY"/>.
19656 </para>
19657 </listitem></varlistentry>
19658 <varlistentry>
19659 <term><varname>$dmarc_domain_policy</varname></term>
19660 <term><varname>$dmarc_status</varname></term>
19661 <term><varname>$dmarc_status_text</varname></term>
19662 <term><varname>$dmarc_used_domains</varname></term>
19663 <listitem>
19664 <para>
19665 Results of DMARC verification.
19666 For details see section <xref linkend="SECDMARC"/>.
19667 </para>
19668 </listitem></varlistentry>
19669 <varlistentry>
19670 <term><varname>$dnslist_domain</varname></term>
19671 <term><varname>$dnslist_matched</varname></term>
19672 <term><varname>$dnslist_text</varname></term>
19673 <term><varname>$dnslist_value</varname></term>
19674 <listitem>
19675 <para>
19676 <indexterm role="variable">
19677 <primary><varname>$dnslist_domain</varname></primary>
19678 </indexterm>
19679 <indexterm role="variable">
19680 <primary><varname>$dnslist_matched</varname></primary>
19681 </indexterm>
19682 <indexterm role="variable">
19683 <primary><varname>$dnslist_text</varname></primary>
19684 </indexterm>
19685 <indexterm role="variable">
19686 <primary><varname>$dnslist_value</varname></primary>
19687 </indexterm>
19688 <indexterm role="concept">
19689 <primary>black list (DNS)</primary>
19690 </indexterm>
19691 When a DNS (black) list lookup succeeds, these variables are set to contain
19692 the following data from the lookup: the list&#x2019;s domain name, the key that was
19693 looked up, the contents of any associated TXT record, and the value from the
19694 main A record. See section <xref linkend="SECID204"/> for more details.
19695 </para>
19696 </listitem></varlistentry>
19697 <varlistentry>
19698 <term><varname>$domain</varname></term>
19699 <listitem>
19700 <para>
19701 <indexterm role="variable">
19702 <primary><varname>$domain</varname></primary>
19703 </indexterm>
19704 </para>
19705 <informaltable frame="none">
19706 <tgroup cols="1" colsep="0" rowsep="0">
19707 <colspec colwidth="10pt" align="left"/>
19708 <tbody>
19709 <row>
19710 <entry><emphasis>Tainted</emphasis></entry>
19711 </row>
19712 </tbody>
19713 </tgroup>
19714 </informaltable>
19715 <para>
19716 When an address is being routed, or delivered on its own, this variable
19717 contains the domain. Uppercase letters in the domain are converted into lower
19718 case for <varname>$domain</varname>.
19719 </para>
19720 <para>
19721 Global address rewriting happens when a message is received, so the value of
19722 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
19723 is set during user filtering, but not during system filtering, because a
19724 message may have many recipients and the system filter is called just once.
19725 </para>
19726 <para>
19727 When more than one address is being delivered at once (for example, several
19728 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
19729 have the same domain. Transports can be restricted to handling only one domain
19730 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
19731 the default for local transports. For further details of the environment in
19732 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
19733 </para>
19734 <para>
19735 <indexterm role="option">
19736 <primary><option>delay_warning_condition</option></primary>
19737 </indexterm>
19738 At the end of a delivery, if all deferred addresses have the same domain, it is
19739 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
19740 </para>
19741 <para>
19742 The <varname>$domain</varname> variable is also used in some other circumstances:
19743 </para>
19744 <itemizedlist>
19745 <listitem>
19746 <para>
19747 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
19748 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
19749 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
19750 normally set during the running of the MAIL ACL. However, if the sender address
19751 is verified with a callout during the MAIL ACL, the sender domain is placed in
19752 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
19753 the <command>smtp</command> transport.
19754 </para>
19755 </listitem>
19756 <listitem>
19757 <para>
19758 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
19759 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
19760 it can be used in the expansion of the replacement address, for example, to
19761 rewrite domains by file lookup.
19762 </para>
19763 </listitem>
19764 <listitem>
19765 <para>
19766 With one important exception, whenever a domain list is being scanned,
19767 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
19768 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
19769 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
19770 that, in a RCPT ACL, the sender domain list can be dependent on the
19771 recipient domain (which is what is in <varname>$domain</varname> at this time).
19772 </para>
19773 </listitem>
19774 <listitem>
19775 <para>
19776 <indexterm role="concept">
19777 <primary>ETRN</primary>
19778 <secondary>value of <varname>$domain</varname></secondary>
19779 </indexterm>
19780 <indexterm role="option">
19781 <primary><option>smtp_etrn_command</option></primary>
19782 </indexterm>
19783 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
19784 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
19785 </para>
19786 </listitem>
19787 </itemizedlist>
19788 <para>
19789 <indexterm role="concept">
19790 <primary>tainted data</primary>
19791 </indexterm>
19792 If the origin of the data is an incoming message,
19793 the result of expanding this variable is tainted and may not
19794 be further expanded or used as a filename.
19795 When an untainted version is needed, one should be obtained from
19796 looking up the value in a local (therefore trusted) database.
19797 Often <varname>$domain_data</varname> is usable in this role.
19798 </para>
19799 </listitem></varlistentry>
19800 <varlistentry>
19801 <term><varname>$domain_data</varname></term>
19802 <listitem>
19803 <para>
19804 <indexterm role="variable">
19805 <primary><varname>$domain_data</varname></primary>
19806 </indexterm>
19807 When the <option>domains</option> condition on a router
19808 or an ACL
19809 matches a domain
19810 against a list, the match value is copied to <varname>$domain_data</varname>.
19811 This is an enhancement over previous versions of Exim, when it only
19812 applied to the data read by a lookup.
19813 For details on match values see section <xref linkend="SECTlistresults"/> et. al.
19814 </para>
19815 <para>
19816 If the router routes the
19817 address to a transport, the value is available in that transport. If the
19818 transport is handling multiple addresses, the value from the first address is
19819 used.
19820 </para>
19821 <para>
19822 <varname>$domain_data</varname> set in an ACL is available during
19823 the rest of the ACL statement.
19824 </para>
19825 </listitem></varlistentry>
19826 <varlistentry>
19827 <term><varname>$exim_gid</varname></term>
19828 <listitem>
19829 <para>
19830 <indexterm role="variable">
19831 <primary><varname>$exim_gid</varname></primary>
19832 </indexterm>
19833 This variable contains the numerical value of the Exim group id.
19834 </para>
19835 </listitem></varlistentry>
19836 <varlistentry>
19837 <term><varname>$exim_path</varname></term>
19838 <listitem>
19839 <para>
19840 <indexterm role="variable">
19841 <primary><varname>$exim_path</varname></primary>
19842 </indexterm>
19843 This variable contains the path to the Exim binary.
19844 </para>
19845 </listitem></varlistentry>
19846 <varlistentry>
19847 <term><varname>$exim_uid</varname></term>
19848 <listitem>
19849 <para>
19850 <indexterm role="variable">
19851 <primary><varname>$exim_uid</varname></primary>
19852 </indexterm>
19853 This variable contains the numerical value of the Exim user id.
19854 </para>
19855 </listitem></varlistentry>
19856 <varlistentry>
19857 <term><varname>$exim_version</varname></term>
19858 <listitem>
19859 <para>
19860 <indexterm role="variable">
19861 <primary><varname>$exim_version</varname></primary>
19862 </indexterm>
19863 This variable contains the version string of the Exim build.
19864 The first character is a major version number, currently 4.
19865 Then after a dot, the next group of digits is a minor version number.
19866 There may be other characters following the minor version.
19867 This value may be overridden by the <option>exim_version</option> main config option.
19868 </para>
19869 </listitem></varlistentry>
19870 <varlistentry>
19871 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
19872 <listitem>
19873 <informaltable frame="none">
19874 <tgroup cols="1" colsep="0" rowsep="0">
19875 <colspec colwidth="10pt" align="left"/>
19876 <tbody>
19877 <row>
19878 <entry><emphasis>Tainted</emphasis></entry>
19879 </row>
19880 </tbody>
19881 </tgroup>
19882 </informaltable>
19883 <para>
19884 This is not strictly an expansion variable. It is expansion syntax for
19885 inserting the message header line with the given name. Note that the name must
19886 be terminated by colon or white space, because it may contain a wide variety of
19887 characters. Note also that braces must <emphasis>not</emphasis> be used.
19888 See the full description in section <xref linkend="SECTexpansionitems"/> above.
19889 </para>
19890 </listitem></varlistentry>
19891 <varlistentry>
19892 <term><varname>$headers_added</varname></term>
19893 <listitem>
19894 <para>
19895 <indexterm role="variable">
19896 <primary><varname>$headers_added</varname></primary>
19897 </indexterm>
19898 Within an ACL this variable contains the headers added so far by
19899 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
19900 The headers are a newline-separated list.
19901 </para>
19902 </listitem></varlistentry>
19903 <varlistentry>
19904 <term><varname>$home</varname></term>
19905 <listitem>
19906 <para>
19907 <indexterm role="variable">
19908 <primary><varname>$home</varname></primary>
19909 </indexterm>
19910 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
19911 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
19912 means it is set during the running of users&#x2019; filter files. A router may also
19913 explicitly set a home directory for use by a transport; this can be overridden
19914 by a setting on the transport itself.
19915 </para>
19916 <para>
19917 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
19918 of the environment variable HOME, which is subject to the
19919 <option>keep_environment</option> and <option>add_environment</option> main config options.
19920 </para>
19921 </listitem></varlistentry>
19922 <varlistentry>
19923 <term><varname>$host</varname></term>
19924 <listitem>
19925 <para>
19926 <indexterm role="variable">
19927 <primary><varname>$host</varname></primary>
19928 </indexterm>
19929 If a router assigns an address to a transport (any transport), and passes a
19930 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
19931 to run is the name of the first host on the list. Note that this applies both
19932 to local and remote transports.
19933 </para>
19934 <para>
19935 <indexterm role="concept">
19936 <primary>transport</primary>
19937 <secondary>filter</secondary>
19938 </indexterm>
19939 <indexterm role="concept">
19940 <primary>filter</primary>
19941 <secondary>transport filter</secondary>
19942 </indexterm>
19943 For the <command>smtp</command> transport, if there is more than one host, the value of
19944 <varname>$host</varname> changes as the transport works its way through the list. In
19945 particular, when the <command>smtp</command> transport is expanding its options for encryption
19946 using TLS, or for specifying a transport filter (see chapter
19947 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
19948 is connected.
19949 </para>
19950 <para>
19951 When used in the client part of an authenticator configuration (see chapter
19952 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
19953 client is connected.
19954 </para>
19955 </listitem></varlistentry>
19956 <varlistentry>
19957 <term><varname>$host_address</varname></term>
19958 <listitem>
19959 <para>
19960 <indexterm role="variable">
19961 <primary><varname>$host_address</varname></primary>
19962 </indexterm>
19963 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
19964 for a remote connection. It is also set to the IP address that is being checked
19965 when the <option>ignore_target_hosts</option> option is being processed.
19966 </para>
19967 </listitem></varlistentry>
19968 <varlistentry>
19969 <term><varname>$host_data</varname></term>
19970 <listitem>
19971 <para>
19972 <indexterm role="variable">
19973 <primary><varname>$host_data</varname></primary>
19974 </indexterm>
19975 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
19976 result of the lookup is made available in the <varname>$host_data</varname> variable. This
19977 allows you, for example, to do things like this:
19978 </para>
19979 <literallayout class="monospaced">
19980 deny  hosts = net-lsearch;/some/file
19981       message = $host_data
19982 </literallayout>
19983 </listitem></varlistentry>
19984 <varlistentry>
19985 <term><varname>$host_lookup_deferred</varname></term>
19986 <listitem>
19987 <para>
19988 <indexterm role="concept">
19989 <primary>host name</primary>
19990 <secondary>lookup, failure of</secondary>
19991 </indexterm>
19992 <indexterm role="variable">
19993 <primary><varname>$host_lookup_deferred</varname></primary>
19994 </indexterm>
19995 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
19996 message comes from a remote host and there is an attempt to look up the host&#x2019;s
19997 name from its IP address, and the attempt is not successful, one of these
19998 variables is set to <quote>1</quote>.
19999 </para>
20000 <itemizedlist>
20001 <listitem>
20002 <para>
20003 If the lookup receives a definite negative response (for example, a DNS lookup
20004 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
20005 </para>
20006 </listitem>
20007 <listitem>
20008 <para>
20009 If there is any kind of problem during the lookup, such that Exim cannot
20010 tell whether or not the host name is defined (for example, a timeout for a DNS
20011 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
20012 </para>
20013 </listitem>
20014 </itemizedlist>
20015 <para>
20016 Looking up a host&#x2019;s name from its IP address consists of more than just a
20017 single reverse lookup. Exim checks that a forward lookup of at least one of the
20018 names it receives from a reverse lookup yields the original IP address. If this
20019 is not the case, Exim does not accept the looked up name(s), and
20020 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
20021 IP address (for example, the existence of a PTR record in the DNS) is not
20022 sufficient on its own for the success of a host name lookup. If the reverse
20023 lookup succeeds, but there is a lookup problem such as a timeout when checking
20024 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
20025 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
20026 </para>
20027 <para>
20028 <indexterm role="concept">
20029 <primary>authentication</primary>
20030 <secondary>expansion item</secondary>
20031 </indexterm>
20032 Performing these checks sets up information used by the
20033 <option>authresults</option> expansion item.
20034 </para>
20035 </listitem></varlistentry>
20036 <varlistentry>
20037 <term><varname>$host_lookup_failed</varname></term>
20038 <listitem>
20039 <para>
20040 <indexterm role="variable">
20041 <primary><varname>$host_lookup_failed</varname></primary>
20042 </indexterm>
20043 See <varname>$host_lookup_deferred</varname>.
20044 </para>
20045 </listitem></varlistentry>
20046 <varlistentry>
20047 <term><varname>$host_port</varname></term>
20048 <listitem>
20049 <para>
20050 <indexterm role="variable">
20051 <primary><varname>$host_port</varname></primary>
20052 </indexterm>
20053 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
20054 for an outbound connection.
20055 </para>
20056 </listitem></varlistentry>
20057 <varlistentry>
20058 <term><varname>$initial_cwd</varname></term>
20059 <listitem>
20060 <para>
20061 <indexterm role="variable">
20062 <primary><varname>$initial_cwd</varname></primary>
20063 </indexterm>
20064 This variable contains the full path name of the initial working
20065 directory of the current Exim process. This may differ from the current
20066 working directory, as Exim changes this to "/" during early startup, and
20067 to <varname>$spool_directory</varname> later.
20068 </para>
20069 </listitem></varlistentry>
20070 <varlistentry>
20071 <term><varname>$inode</varname></term>
20072 <listitem>
20073 <para>
20074 <indexterm role="variable">
20075 <primary><varname>$inode</varname></primary>
20076 </indexterm>
20077 The only time this variable is set is while expanding the <option>directory_file</option>
20078 option in the <command>appendfile</command> transport. The variable contains the inode number
20079 of the temporary file which is about to be renamed. It can be used to construct
20080 a unique name for the file.
20081 </para>
20082 </listitem></varlistentry>
20083 <varlistentry>
20084 <term><varname>$interface_address</varname></term>
20085 <term><varname>$interface_port</varname></term>
20086 <listitem>
20087 <para>
20088 <indexterm role="variable">
20089 <primary><varname>$interface_address</varname></primary>
20090 </indexterm>
20091 <indexterm role="variable">
20092 <primary><varname>$interface_port</varname></primary>
20093 </indexterm>
20094 These are obsolete names for <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
20095 </para>
20096 </listitem></varlistentry>
20097 <varlistentry>
20098 <term><varname>$item</varname></term>
20099 <listitem>
20100 <para>
20101 <indexterm role="variable">
20102 <primary><varname>$item</varname></primary>
20103 </indexterm>
20104 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
20105 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
20106 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
20107 empty.
20108 </para>
20109 </listitem></varlistentry>
20110 <varlistentry>
20111 <term><varname>$ldap_dn</varname></term>
20112 <listitem>
20113 <para>
20114 <indexterm role="variable">
20115 <primary><varname>$ldap_dn</varname></primary>
20116 </indexterm>
20117 This variable, which is available only when Exim is compiled with LDAP support,
20118 contains the DN from the last entry in the most recently successful LDAP
20119 lookup.
20120 </para>
20121 </listitem></varlistentry>
20122 <varlistentry>
20123 <term><varname>$load_average</varname></term>
20124 <listitem>
20125 <para>
20126 <indexterm role="variable">
20127 <primary><varname>$load_average</varname></primary>
20128 </indexterm>
20129 This variable contains the system load average, multiplied by 1000 so that it
20130 is an integer. For example, if the load average is 0.21, the value of the
20131 variable is 210. The value is recomputed every time the variable is referenced.
20132 </para>
20133 </listitem></varlistentry>
20134 <varlistentry>
20135 <term><varname>$local_part</varname></term>
20136 <listitem>
20137 <para>
20138 <indexterm role="variable">
20139 <primary><varname>$local_part</varname></primary>
20140 </indexterm>
20141 </para>
20142 <informaltable frame="none">
20143 <tgroup cols="1" colsep="0" rowsep="0">
20144 <colspec colwidth="10pt" align="left"/>
20145 <tbody>
20146 <row>
20147 <entry><emphasis>Tainted</emphasis></entry>
20148 </row>
20149 </tbody>
20150 </tgroup>
20151 </informaltable>
20152 <para>
20153 When an address is being routed, or delivered on its own, this
20154 variable contains the local part. When a number of addresses are being
20155 delivered together (for example, multiple RCPT commands in an SMTP
20156 session), <varname>$local_part</varname> is not set.
20157 </para>
20158 <para>
20159 Global address rewriting happens when a message is received, so the value of
20160 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
20161 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
20162 because a message may have many recipients and the system filter is called just
20163 once.
20164 </para>
20165 <para>
20166 <indexterm role="concept">
20167 <primary>tainted data</primary>
20168 </indexterm>
20169 If the origin of the data is an incoming message,
20170 the result of expanding this variable is tainted and
20171 may not be further expanded or used as a filename.
20172 </para>
20173 <para>
20174 <emphasis role="bold">Warning</emphasis>: the content of this variable is usually provided by a potential
20175 attacker.
20176 Consider carefully the implications of using it unvalidated as a name
20177 for file access.
20178 This presents issues for users&#x2019; <filename>.forward</filename> and filter files.
20179 For traditional full user accounts, use <option>check_local_users</option> and the
20180 <varname>$local_part_data</varname> variable rather than this one.
20181 For virtual users, store a suitable pathname component in the database
20182 which is used for account name validation, and use that retrieved value
20183 rather than this variable.
20184 Often <varname>$local_part_data</varname> is usable in this role.
20185 If needed, use a router <option>address_data</option> or <option>set</option> option for
20186 the retrieved data.
20187 </para>
20188 <para>
20189 When a message is being delivered to a file, pipe, or autoreply transport as a
20190 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
20191 the parent address, not to the filename or command (see <varname>$address_file</varname> and
20192 <varname>$address_pipe</varname>).
20193 </para>
20194 <para>
20195 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
20196 local part of the recipient address.
20197 </para>
20198 <para>
20199 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
20200 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
20201 it can be used in the expansion of the replacement address, for example.
20202 </para>
20203 <para>
20204 In all cases, all quoting is removed from the local part. For example, for both
20205 the addresses
20206 </para>
20207 <literallayout class="monospaced">
20208 "abc:xyz"@test.example
20209 abc\:xyz@test.example
20210 </literallayout>
20211 <para>
20212 the value of <varname>$local_part</varname> is
20213 </para>
20214 <literallayout class="monospaced">
20215 abc:xyz
20216 </literallayout>
20217 <para>
20218 If you use <varname>$local_part</varname> to create another address, you should always wrap it
20219 inside a quoting operator. For example, in a <command>redirect</command> router you could
20220 have:
20221 </para>
20222 <literallayout class="monospaced">
20223 data = ${quote_local_part:$local_part}@new.domain.example
20224 </literallayout>
20225 <para>
20226 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
20227 to process local parts in a case-dependent manner in a router, you can set the
20228 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
20229 </para>
20230 </listitem></varlistentry>
20231 <varlistentry>
20232 <term><varname>$local_part_data</varname></term>
20233 <listitem>
20234 <para>
20235 <indexterm role="variable">
20236 <primary><varname>$local_part_data</varname></primary>
20237 </indexterm>
20238 When the <option>local_parts</option> condition on a router or ACL
20239 matches a local part list
20240 the match value is copied to <varname>$local_part_data</varname>.
20241 This is an enhancement over previous versions of Exim, when it only
20242 applied to the data read by a lookup.
20243 For details on match values see section <xref linkend="SECTlistresults"/> et. al.
20244 </para>
20245 <para>
20246 The <option>check_local_user</option> router option also sets this variable.
20247 </para>
20248 <para>
20249 <indexterm role="variable">
20250 <primary><varname>$local_part_prefix</varname></primary>
20251 <secondary><varname>$local_part_prefix_v</varname></secondary>
20252 </indexterm>
20253 <indexterm role="concept">
20254 <primary>affix</primary>
20255 <secondary>variables</secondary>
20256 </indexterm>
20257 If a local part prefix or suffix has been recognized, it is not included in the
20258 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
20259 any prefix or suffix are in <varname>$local_part_prefix</varname> and
20260 <varname>$local_part_suffix</varname>, respectively.
20261 <indexterm role="concept">
20262 <primary>tainted data</primary>
20263 </indexterm>
20264 If the specification did not include a wildcard then
20265 the affix variable value is not tainted.
20266 </para>
20267 <para>
20268 If the affix specification included a wildcard then the portion of
20269 the affix matched by the wildcard is in
20270 <varname>$local_part_prefix_v</varname> or <varname>$local_part_suffix_v</varname> as appropriate,
20271 and both the whole and varying values are tainted.
20272 </para>
20273 </listitem></varlistentry>
20274 <varlistentry>
20275 <term><varname>$local_scan_data</varname></term>
20276 <listitem>
20277 <para>
20278 <indexterm role="variable">
20279 <primary><varname>$local_scan_data</varname></primary>
20280 </indexterm>
20281 This variable contains the text returned by the <function>local_scan()</function> function when
20282 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
20283 </para>
20284 </listitem></varlistentry>
20285 <varlistentry>
20286 <term><varname>$local_user_gid</varname></term>
20287 <listitem>
20288 <para>
20289 <indexterm role="variable">
20290 <primary><varname>$local_user_gid</varname></primary>
20291 </indexterm>
20292 See <varname>$local_user_uid</varname>.
20293 </para>
20294 </listitem></varlistentry>
20295 <varlistentry>
20296 <term><varname>$local_user_uid</varname></term>
20297 <listitem>
20298 <para>
20299 <indexterm role="variable">
20300 <primary><varname>$local_user_uid</varname></primary>
20301 </indexterm>
20302 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
20303 <option>check_local_user</option> router precondition succeeds. This means that their values
20304 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
20305 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
20306 router-specific expansions. At all other times, the values in these variables
20307 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
20308 </para>
20309 </listitem></varlistentry>
20310 <varlistentry>
20311 <term><varname>$localhost_number</varname></term>
20312 <listitem>
20313 <para>
20314 <indexterm role="variable">
20315 <primary><varname>$localhost_number</varname></primary>
20316 </indexterm>
20317 This contains the expanded value of the
20318 <option>localhost_number</option> option. The expansion happens after the main options have
20319 been read.
20320 </para>
20321 </listitem></varlistentry>
20322 <varlistentry>
20323 <term><varname>$log_inodes</varname></term>
20324 <listitem>
20325 <para>
20326 <indexterm role="variable">
20327 <primary><varname>$log_inodes</varname></primary>
20328 </indexterm>
20329 The number of free inodes in the disk partition where Exim&#x2019;s
20330 log files are being written. The value is recalculated whenever the variable is
20331 referenced. If the relevant file system does not have the concept of inodes,
20332 the value of is -1. See also the <option>check_log_inodes</option> option.
20333 </para>
20334 </listitem></varlistentry>
20335 <varlistentry>
20336 <term><varname>$log_space</varname></term>
20337 <listitem>
20338 <para>
20339 <indexterm role="variable">
20340 <primary><varname>$log_space</varname></primary>
20341 </indexterm>
20342 The amount of free space (as a number of kilobytes) in the disk
20343 partition where Exim&#x2019;s log files are being written. The value is recalculated
20344 whenever the variable is referenced. If the operating system does not have the
20345 ability to find the amount of free space (only true for experimental systems),
20346 the space value is -1. See also the <option>check_log_space</option> option.
20347 </para>
20348 </listitem></varlistentry>
20349 <varlistentry>
20350 <term><varname>$lookup_dnssec_authenticated</varname></term>
20351 <listitem>
20352 <para>
20353 <indexterm role="variable">
20354 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
20355 </indexterm>
20356 This variable is set after a DNS lookup done by
20357 a dnsdb lookup expansion, dnslookup router or smtp transport.
20358 <indexterm role="concept">
20359 <primary>DNS</primary>
20360 <secondary>DNSSEC</secondary>
20361 </indexterm>
20362 It will be empty if <command>DNSSEC</command> was not requested,
20363 <quote>no</quote> if the result was not labelled as authenticated data
20364 and <quote>yes</quote> if it was.
20365 Results that are labelled as authoritative answer that match
20366 the <option>dns_trust_aa</option> configuration variable count also
20367 as authenticated data.
20368 </para>
20369 </listitem></varlistentry>
20370 <varlistentry>
20371 <term><varname>$mailstore_basename</varname></term>
20372 <listitem>
20373 <para>
20374 <indexterm role="variable">
20375 <primary><varname>$mailstore_basename</varname></primary>
20376 </indexterm>
20377 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
20378 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
20379 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
20380 contains the basename of the files that are being written, that is, the name
20381 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
20382 variable is empty.
20383 </para>
20384 </listitem></varlistentry>
20385 <varlistentry>
20386 <term><varname>$malware_name</varname></term>
20387 <listitem>
20388 <para>
20389 <indexterm role="variable">
20390 <primary><varname>$malware_name</varname></primary>
20391 </indexterm>
20392 This variable is available when Exim is compiled with the
20393 content-scanning extension. It is set to the name of the virus that was found
20394 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
20395 </para>
20396 </listitem></varlistentry>
20397 <varlistentry>
20398 <term><varname>$max_received_linelength</varname></term>
20399 <listitem>
20400 <para>
20401 <indexterm role="variable">
20402 <primary><varname>$max_received_linelength</varname></primary>
20403 </indexterm>
20404 <indexterm role="concept">
20405 <primary>maximum</primary>
20406 <secondary>line length</secondary>
20407 </indexterm>
20408 <indexterm role="concept">
20409 <primary>line length</primary>
20410 <secondary>maximum</secondary>
20411 </indexterm>
20412 This variable contains the number of bytes in the longest line that was
20413 received as part of the message, not counting the line termination
20414 character(s).
20415 It is not valid if the <option>spool_wireformat</option> option is used.
20416 </para>
20417 </listitem></varlistentry>
20418 <varlistentry>
20419 <term><varname>$message_age</varname></term>
20420 <listitem>
20421 <para>
20422 <indexterm role="concept">
20423 <primary>message</primary>
20424 <secondary>age of</secondary>
20425 </indexterm>
20426 <indexterm role="variable">
20427 <primary><varname>$message_age</varname></primary>
20428 </indexterm>
20429 This variable is set at the start of a delivery attempt to contain the number
20430 of seconds since the message was received. It does not change during a single
20431 delivery attempt.
20432 </para>
20433 </listitem></varlistentry>
20434 <varlistentry>
20435 <term><varname>$message_body</varname></term>
20436 <listitem>
20437 <para>
20438 <indexterm role="variable">
20439 <primary><varname>$message_body</varname></primary>
20440 </indexterm>
20441 </para>
20442 <informaltable frame="none">
20443 <tgroup cols="1" colsep="0" rowsep="0">
20444 <colspec colwidth="10pt" align="left"/>
20445 <tbody>
20446 <row>
20447 <entry><emphasis>Tainted</emphasis></entry>
20448 </row>
20449 </tbody>
20450 </tgroup>
20451 </informaltable>
20452 <para>
20453 <indexterm role="concept">
20454 <primary>body of message</primary>
20455 <secondary>expansion variable</secondary>
20456 </indexterm>
20457 <indexterm role="concept">
20458 <primary>message body</primary>
20459 <secondary>in expansion</secondary>
20460 </indexterm>
20461 <indexterm role="concept">
20462 <primary>binary zero</primary>
20463 <secondary>in message body</secondary>
20464 </indexterm>
20465 <indexterm role="option">
20466 <primary><option>message_body_visible</option></primary>
20467 </indexterm>
20468 This variable contains the initial portion of a message&#x2019;s body while it is
20469 being delivered, and is intended mainly for use in filter files. The maximum
20470 number of characters of the body that are put into the variable is set by the
20471 <option>message_body_visible</option> configuration option; the default is 500.
20472 </para>
20473 <para>
20474 <indexterm role="option">
20475 <primary><option>message_body_newlines</option></primary>
20476 </indexterm>
20477 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
20478 easier to search for phrases that might be split over a line break. However,
20479 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
20480 zeros are always converted into spaces.
20481 </para>
20482 </listitem></varlistentry>
20483 <varlistentry>
20484 <term><varname>$message_body_end</varname></term>
20485 <listitem>
20486 <para>
20487 <indexterm role="variable">
20488 <primary><varname>$message_body_end</varname></primary>
20489 </indexterm>
20490 </para>
20491 <informaltable frame="none">
20492 <tgroup cols="1" colsep="0" rowsep="0">
20493 <colspec colwidth="10pt" align="left"/>
20494 <tbody>
20495 <row>
20496 <entry><emphasis>Tainted</emphasis></entry>
20497 </row>
20498 </tbody>
20499 </tgroup>
20500 </informaltable>
20501 <para>
20502 <indexterm role="concept">
20503 <primary>body of message</primary>
20504 <secondary>expansion variable</secondary>
20505 </indexterm>
20506 <indexterm role="concept">
20507 <primary>message body</primary>
20508 <secondary>in expansion</secondary>
20509 </indexterm>
20510 This variable contains the final portion of a message&#x2019;s
20511 body while it is being delivered. The format and maximum size are as for
20512 <varname>$message_body</varname>.
20513 </para>
20514 </listitem></varlistentry>
20515 <varlistentry>
20516 <term><varname>$message_body_size</varname></term>
20517 <listitem>
20518 <para>
20519 <indexterm role="concept">
20520 <primary>body of message</primary>
20521 <secondary>size</secondary>
20522 </indexterm>
20523 <indexterm role="concept">
20524 <primary>message body</primary>
20525 <secondary>size</secondary>
20526 </indexterm>
20527 <indexterm role="variable">
20528 <primary><varname>$message_body_size</varname></primary>
20529 </indexterm>
20530 When a message is being delivered, this variable contains the size of the body
20531 in bytes. The count starts from the character after the blank line that
20532 separates the body from the header. Newlines are included in the count. See
20533 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
20534 </para>
20535 <para>
20536 If the spool file is wireformat
20537 (see the <option>spool_wireformat</option> main option)
20538 the CRLF line-terminators are included in the count.
20539 </para>
20540 </listitem></varlistentry>
20541 <varlistentry>
20542 <term><varname>$message_exim_id</varname></term>
20543 <listitem>
20544 <para>
20545 <indexterm role="variable">
20546 <primary><varname>$message_exim_id</varname></primary>
20547 </indexterm>
20548 When a message is being received or delivered, this variable contains the
20549 unique message id that is generated and used by Exim to identify the message.
20550 An id is not created for a message until after its header has been successfully
20551 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
20552 line; it is the local id that Exim assigns to the message, for example:
20553 <literal>1BXTIK-0001yO-VA</literal>.
20554 </para>
20555 </listitem></varlistentry>
20556 <varlistentry>
20557 <term><varname>$message_headers</varname></term>
20558 <listitem>
20559 <para>
20560 <indexterm role="variable">
20561 <primary><varname>$message_headers</varname></primary>
20562 </indexterm>
20563 </para>
20564 <informaltable frame="none">
20565 <tgroup cols="1" colsep="0" rowsep="0">
20566 <colspec colwidth="10pt" align="left"/>
20567 <tbody>
20568 <row>
20569 <entry><emphasis>Tainted</emphasis></entry>
20570 </row>
20571 </tbody>
20572 </tgroup>
20573 </informaltable>
20574 <para>
20575 This variable contains a concatenation of all the header lines when a message
20576 is being processed, except for lines added by routers or transports. The header
20577 lines are separated by newline characters. Their contents are decoded in the
20578 same way as a header line that is inserted by <option>bheader</option>.
20579 </para>
20580 </listitem></varlistentry>
20581 <varlistentry>
20582 <term><varname>$message_headers_raw</varname></term>
20583 <listitem>
20584 <para>
20585 <indexterm role="variable">
20586 <primary><varname>$message_headers_raw</varname></primary>
20587 </indexterm>
20588 </para>
20589 <informaltable frame="none">
20590 <tgroup cols="1" colsep="0" rowsep="0">
20591 <colspec colwidth="10pt" align="left"/>
20592 <tbody>
20593 <row>
20594 <entry><emphasis>Tainted</emphasis></entry>
20595 </row>
20596 </tbody>
20597 </tgroup>
20598 </informaltable>
20599 <para>
20600 This variable is like <varname>$message_headers</varname> except that no processing of the
20601 contents of header lines is done.
20602 </para>
20603 </listitem></varlistentry>
20604 <varlistentry>
20605 <term><varname>$message_id</varname></term>
20606 <listitem>
20607 <para>
20608 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
20609 </para>
20610 </listitem></varlistentry>
20611 <varlistentry>
20612 <term><varname>$message_linecount</varname></term>
20613 <listitem>
20614 <para>
20615 <indexterm role="variable">
20616 <primary><varname>$message_linecount</varname></primary>
20617 </indexterm>
20618 This variable contains the total number of lines in the header and body of the
20619 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
20620 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
20621 number of lines received. Before delivery happens (that is, before filters,
20622 routers, and transports run) the count is increased to include the
20623 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
20624 lines that are added by ACLs. The blank line that separates the message header
20625 from the body is not counted.
20626 </para>
20627 <para>
20628 As with the special case of <varname>$message_size</varname>, during the expansion of the
20629 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
20630 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
20631 file that has been written (minus one for the blank line between the
20632 header and the body).
20633 </para>
20634 <para>
20635 Here is an example of the use of this variable in a DATA ACL:
20636 </para>
20637 <literallayout class="monospaced">
20638 deny condition = \
20639       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
20640      message   = Too many lines in message header
20641 </literallayout>
20642 <para>
20643 In the MAIL and RCPT ACLs, the value is zero because at that stage the
20644 message has not yet been received.
20645 </para>
20646 <para>
20647 This variable is not valid if the <option>spool_wireformat</option> option is used.
20648 </para>
20649 </listitem></varlistentry>
20650 <varlistentry>
20651 <term><varname>$message_size</varname></term>
20652 <listitem>
20653 <para>
20654 <indexterm role="concept">
20655 <primary>size</primary>
20656 <secondary>of message</secondary>
20657 </indexterm>
20658 <indexterm role="concept">
20659 <primary>message</primary>
20660 <secondary>size</secondary>
20661 </indexterm>
20662 <indexterm role="variable">
20663 <primary><varname>$message_size</varname></primary>
20664 </indexterm>
20665 When a message is being processed, this variable contains its size in bytes. In
20666 most cases, the size includes those headers that were received with the
20667 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
20668 deliveries as they are written. However, there is one special case: during the
20669 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
20670 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
20671 precise size of the file that has been written. See also
20672 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
20673 </para>
20674 <para>
20675 <indexterm role="concept">
20676 <primary>RCPT</primary>
20677 <secondary>value of <varname>$message_size</varname></secondary>
20678 </indexterm>
20679 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
20680 contains the size supplied on the MAIL command, or -1 if no size was given. The
20681 value may not, of course, be truthful.
20682 </para>
20683 </listitem></varlistentry>
20684 <varlistentry>
20685 <term><varname>$mime_anomaly_level</varname></term>
20686 <term><varname>$mime_anomaly_text</varname></term>
20687 <term><varname>$mime_boundary</varname></term>
20688 <term><varname>$mime_charset</varname></term>
20689 <term><varname>$mime_content_description</varname></term>
20690 <term><varname>$mime_content_disposition</varname></term>
20691 <term><varname>$mime_content_id</varname></term>
20692 <term><varname>$mime_content_size</varname></term>
20693 <term><varname>$mime_content_transfer_encoding</varname></term>
20694 <term><varname>$mime_content_type</varname></term>
20695 <term><varname>$mime_decoded_filename</varname></term>
20696 <term><varname>$mime_filename</varname></term>
20697 <term><varname>$mime_is_coverletter</varname></term>
20698 <term><varname>$mime_is_multipart</varname></term>
20699 <term><varname>$mime_is_rfc822</varname></term>
20700 <term><varname>$mime_part_count</varname></term>
20701 <listitem>
20702 <para>
20703 A number of variables whose names start with <varname>$mime</varname> are
20704 available when Exim is compiled with the content-scanning extension. For
20705 details, see section <xref linkend="SECTscanmimepart"/>.
20706 </para>
20707 </listitem></varlistentry>
20708 <varlistentry>
20709 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
20710 <listitem>
20711 <para>
20712 These variables are counters that can be incremented by means
20713 of the <option>add</option> command in filter files.
20714 </para>
20715 </listitem></varlistentry>
20716 <varlistentry>
20717 <term><varname>$original_domain</varname></term>
20718 <listitem>
20719 <para>
20720 <indexterm role="variable">
20721 <primary><varname>$original_domain</varname></primary>
20722 </indexterm>
20723 </para>
20724 <informaltable frame="none">
20725 <tgroup cols="1" colsep="0" rowsep="0">
20726 <colspec colwidth="10pt" align="left"/>
20727 <tbody>
20728 <row>
20729 <entry><emphasis>Tainted</emphasis></entry>
20730 </row>
20731 </tbody>
20732 </tgroup>
20733 </informaltable>
20734 <para>
20735 <indexterm role="variable">
20736 <primary><varname>$domain</varname></primary>
20737 </indexterm>
20738 When a top-level address is being processed for delivery, this contains the
20739 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
20740 generated by an alias, forward, or filter file) is being processed, this
20741 variable contains the domain of the original address (lower cased). This
20742 differs from <varname>$parent_domain</varname> only when there is more than one level of
20743 aliasing or forwarding. When more than one address is being delivered in a
20744 single transport run, <varname>$original_domain</varname> is not set.
20745 </para>
20746 <para>
20747 If a new address is created by means of a <option>deliver</option> command in a system
20748 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
20749 part <emphasis>system-filter</emphasis> and the default qualify domain.
20750 </para>
20751 </listitem></varlistentry>
20752 <varlistentry>
20753 <term><varname>$original_local_part</varname></term>
20754 <listitem>
20755 <para>
20756 <indexterm role="variable">
20757 <primary><varname>$original_local_part</varname></primary>
20758 </indexterm>
20759 </para>
20760 <informaltable frame="none">
20761 <tgroup cols="1" colsep="0" rowsep="0">
20762 <colspec colwidth="10pt" align="left"/>
20763 <tbody>
20764 <row>
20765 <entry><emphasis>Tainted</emphasis></entry>
20766 </row>
20767 </tbody>
20768 </tgroup>
20769 </informaltable>
20770 <para>
20771 <indexterm role="variable">
20772 <primary><varname>$local_part</varname></primary>
20773 </indexterm>
20774 When a top-level address is being processed for delivery, this contains the
20775 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
20776 local part, because <varname>$original_local_part</varname> always contains the full local
20777 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
20778 filter file) is being processed, this variable contains the full local part of
20779 the original address.
20780 </para>
20781 <para>
20782 If the router that did the redirection processed the local part
20783 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
20784 This variable differs from <varname>$parent_local_part</varname> only when there is more than
20785 one level of aliasing or forwarding. When more than one address is being
20786 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
20787 </para>
20788 <para>
20789 If a new address is created by means of a <option>deliver</option> command in a system
20790 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
20791 part <emphasis>system-filter</emphasis> and the default qualify domain.
20792 </para>
20793 </listitem></varlistentry>
20794 <varlistentry>
20795 <term><varname>$originator_gid</varname></term>
20796 <listitem>
20797 <para>
20798 <indexterm role="concept">
20799 <primary>gid (group id)</primary>
20800 <secondary>of originating user</secondary>
20801 </indexterm>
20802 <indexterm role="concept">
20803 <primary>sender</primary>
20804 <secondary>gid</secondary>
20805 </indexterm>
20806 <indexterm role="variable">
20807 <primary><varname>$caller_gid</varname></primary>
20808 </indexterm>
20809 <indexterm role="variable">
20810 <primary><varname>$originator_gid</varname></primary>
20811 </indexterm>
20812 This variable contains the value of <varname>$caller_gid</varname> that was set when the
20813 message was received. For messages received via the command line, this is the
20814 gid of the sending user. For messages received by SMTP over TCP/IP, this is
20815 normally the gid of the Exim user.
20816 </para>
20817 </listitem></varlistentry>
20818 <varlistentry>
20819 <term><varname>$originator_uid</varname></term>
20820 <listitem>
20821 <para>
20822 <indexterm role="concept">
20823 <primary>uid (user id)</primary>
20824 <secondary>of originating user</secondary>
20825 </indexterm>
20826 <indexterm role="concept">
20827 <primary>sender</primary>
20828 <secondary>uid</secondary>
20829 </indexterm>
20830 <indexterm role="variable">
20831 <primary><varname>$caller_uid</varname></primary>
20832 </indexterm>
20833 <indexterm role="variable">
20834 <primary><varname>$originator_uid</varname></primary>
20835 </indexterm>
20836 The value of <varname>$caller_uid</varname> that was set when the message was received. For
20837 messages received via the command line, this is the uid of the sending user.
20838 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
20839 user.
20840 </para>
20841 </listitem></varlistentry>
20842 <varlistentry>
20843 <term><varname>$parent_domain</varname></term>
20844 <listitem>
20845 <para>
20846 <indexterm role="variable">
20847 <primary><varname>$parent_domain</varname></primary>
20848 </indexterm>
20849 </para>
20850 <informaltable frame="none">
20851 <tgroup cols="1" colsep="0" rowsep="0">
20852 <colspec colwidth="10pt" align="left"/>
20853 <tbody>
20854 <row>
20855 <entry><emphasis>Tainted</emphasis></entry>
20856 </row>
20857 </tbody>
20858 </tgroup>
20859 </informaltable>
20860 <para>
20861 This variable is similar to <varname>$original_domain</varname> (see
20862 above), except that it refers to the immediately preceding parent address.
20863 </para>
20864 </listitem></varlistentry>
20865 <varlistentry>
20866 <term><varname>$parent_local_part</varname></term>
20867 <listitem>
20868 <para>
20869 <indexterm role="variable">
20870 <primary><varname>$parent_local_part</varname></primary>
20871 </indexterm>
20872 </para>
20873 <informaltable frame="none">
20874 <tgroup cols="1" colsep="0" rowsep="0">
20875 <colspec colwidth="10pt" align="left"/>
20876 <tbody>
20877 <row>
20878 <entry><emphasis>Tainted</emphasis></entry>
20879 </row>
20880 </tbody>
20881 </tgroup>
20882 </informaltable>
20883 <para>
20884 This variable is similar to <varname>$original_local_part</varname>
20885 (see above), except that it refers to the immediately preceding parent address.
20886 </para>
20887 </listitem></varlistentry>
20888 <varlistentry>
20889 <term><varname>$pid</varname></term>
20890 <listitem>
20891 <para>
20892 <indexterm role="concept">
20893 <primary>pid (process id)</primary>
20894 <secondary>of current process</secondary>
20895 </indexterm>
20896 <indexterm role="variable">
20897 <primary><varname>$pid</varname></primary>
20898 </indexterm>
20899 This variable contains the current process id.
20900 </para>
20901 </listitem></varlistentry>
20902 <varlistentry>
20903 <term><varname>$pipe_addresses</varname></term>
20904 <listitem>
20905 <para>
20906 <indexterm role="concept">
20907 <primary>filter</primary>
20908 <secondary>transport filter</secondary>
20909 </indexterm>
20910 <indexterm role="concept">
20911 <primary>transport</primary>
20912 <secondary>filter</secondary>
20913 </indexterm>
20914 <indexterm role="variable">
20915 <primary><varname>$pipe_addresses</varname></primary>
20916 </indexterm>
20917 This is not an expansion variable, but is mentioned here because the string
20918 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
20919 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
20920 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
20921 It cannot be used in general expansion strings, and provokes an <quote>unknown
20922 variable</quote> error if encountered.
20923 <emphasis role="bold">Note</emphasis>: This value permits data supplied by a potential attacker to
20924 be used in the command for a <command>pipe</command> transport.
20925 Such configurations should be carefully assessed for security vulnerbilities.
20926 </para>
20927 </listitem></varlistentry>
20928 <varlistentry>
20929 <term><varname>$primary_hostname</varname></term>
20930 <listitem>
20931 <para>
20932 <indexterm role="variable">
20933 <primary><varname>$primary_hostname</varname></primary>
20934 </indexterm>
20935 This variable contains the value set by <option>primary_hostname</option> in the
20936 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
20937 a single-component name, Exim calls <function>gethostbyname()</function> (or
20938 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
20939 qualified host name. See also <varname>$smtp_active_hostname</varname>.
20940 </para>
20941 </listitem></varlistentry>
20942 <varlistentry>
20943 <term><varname>$proxy_external_address</varname></term>
20944 <term><varname>$proxy_external_port</varname></term>
20945 <term><varname>$proxy_local_address</varname></term>
20946 <term><varname>$proxy_local_port</varname></term>
20947 <term><varname>$proxy_session</varname></term>
20948 <listitem>
20949 <para>
20950 These variables are only available when built with Proxy Protocol
20951 or SOCKS5 support.
20952 For details see chapter <xref linkend="SECTproxyInbound"/>.
20953 </para>
20954 </listitem></varlistentry>
20955 <varlistentry>
20956 <term><varname>$prdr_requested</varname></term>
20957 <listitem>
20958 <para>
20959 <indexterm role="concept">
20960 <primary>PRDR</primary>
20961 <secondary>variable for</secondary>
20962 </indexterm>
20963 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
20964 current message, otherwise <quote>no</quote>.
20965 </para>
20966 </listitem></varlistentry>
20967 <varlistentry>
20968 <term><varname>$prvscheck_address</varname></term>
20969 <term><varname>$prvscheck_keynum</varname></term>
20970 <term><varname>$prvscheck_result</varname></term>
20971 <listitem>
20972 <para>
20973 These variables are used in conjunction with the <option>prvscheck</option> expansion item,
20974 which is described in sections <xref linkend="SECTexpansionitems"/> and
20975 <xref linkend="SECTverifyPRVS"/>.
20976 </para>
20977 </listitem></varlistentry>
20978 <varlistentry>
20979 <term><varname>$qualify_domain</varname></term>
20980 <listitem>
20981 <para>
20982 <indexterm role="variable">
20983 <primary><varname>$qualify_domain</varname></primary>
20984 </indexterm>
20985 The value set for the <option>qualify_domain</option> option in the configuration file.
20986 </para>
20987 </listitem></varlistentry>
20988 <varlistentry>
20989 <term><varname>$qualify_recipient</varname></term>
20990 <listitem>
20991 <para>
20992 <indexterm role="variable">
20993 <primary><varname>$qualify_recipient</varname></primary>
20994 </indexterm>
20995 The value set for the <option>qualify_recipient</option> option in the configuration file,
20996 or if not set, the value of <varname>$qualify_domain</varname>.
20997 </para>
20998 </listitem></varlistentry>
20999 <varlistentry>
21000 <term><varname>$queue_name</varname></term>
21001 <listitem>
21002 <para>
21003 <indexterm role="variable">
21004 <primary><varname>$queue_name</varname></primary>
21005 </indexterm>
21006 <indexterm role="concept">
21007 <primary>named queues</primary>
21008 <secondary>variable</secondary>
21009 </indexterm>
21010 <indexterm role="concept">
21011 <primary>queues</primary>
21012 <secondary>named</secondary>
21013 </indexterm>
21014 The name of the spool queue in use; empty for the default queue.
21015 </para>
21016 </listitem></varlistentry>
21017 <varlistentry>
21018 <term><varname>$queue_size</varname></term>
21019 <listitem>
21020 <para>
21021 <indexterm role="variable">
21022 <primary><varname>$queue_size</varname></primary>
21023 </indexterm>
21024 <indexterm role="concept">
21025 <primary>queue</primary>
21026 <secondary>size of</secondary>
21027 </indexterm>
21028 <indexterm role="concept">
21029 <primary>spool</primary>
21030 <secondary>number of messages</secondary>
21031 </indexterm>
21032 This variable contains the number of messages queued.
21033 It is evaluated on demand, but no more often than once every minute.
21034 If there is no daemon notifier socket open, the value will be
21035 an empty string.
21036 </para>
21037 </listitem></varlistentry>
21038 <varlistentry>
21039 <term><varname>$r_...</varname></term>
21040 <listitem>
21041 <para>
21042 <indexterm role="variable">
21043 <primary><varname>$r_...</varname></primary>
21044 </indexterm>
21045 <indexterm role="concept">
21046 <primary>router</primary>
21047 <secondary>variables</secondary>
21048 </indexterm>
21049 Values can be placed in these variables by the <option>set</option> option of a router.
21050 They can be given any name that starts with <varname>$r_</varname>.
21051 The values persist for the address being handled through subsequent routers
21052 and the eventual transport.
21053 </para>
21054 </listitem></varlistentry>
21055 <varlistentry>
21056 <term><varname>$rcpt_count</varname></term>
21057 <listitem>
21058 <para>
21059 <indexterm role="variable">
21060 <primary><varname>$rcpt_count</varname></primary>
21061 </indexterm>
21062 When a message is being received by SMTP, this variable contains the number of
21063 RCPT commands received for the current message. If this variable is used in a
21064 RCPT ACL, its value includes the current command.
21065 </para>
21066 </listitem></varlistentry>
21067 <varlistentry>
21068 <term><varname>$rcpt_defer_count</varname></term>
21069 <listitem>
21070 <para>
21071 <indexterm role="variable">
21072 <primary><varname>$rcpt_defer_count</varname></primary>
21073 </indexterm>
21074 <indexterm role="concept">
21075 <primary>4<emphasis>xx</emphasis> responses</primary>
21076 <secondary>count of</secondary>
21077 </indexterm>
21078 When a message is being received by SMTP, this variable contains the number of
21079 RCPT commands in the current message that have previously been rejected with a
21080 temporary (4<emphasis>xx</emphasis>) response.
21081 </para>
21082 </listitem></varlistentry>
21083 <varlistentry>
21084 <term><varname>$rcpt_fail_count</varname></term>
21085 <listitem>
21086 <para>
21087 <indexterm role="variable">
21088 <primary><varname>$rcpt_fail_count</varname></primary>
21089 </indexterm>
21090 When a message is being received by SMTP, this variable contains the number of
21091 RCPT commands in the current message that have previously been rejected with a
21092 permanent (5<emphasis>xx</emphasis>) response.
21093 </para>
21094 </listitem></varlistentry>
21095 <varlistentry>
21096 <term><varname>$received_count</varname></term>
21097 <listitem>
21098 <para>
21099 <indexterm role="variable">
21100 <primary><varname>$received_count</varname></primary>
21101 </indexterm>
21102 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
21103 including the one added by Exim (so its value is always greater than zero). It
21104 is available in the DATA ACL, the non-SMTP ACL, and while routing and
21105 delivering.
21106 </para>
21107 </listitem></varlistentry>
21108 <varlistentry>
21109 <term><varname>$received_for</varname></term>
21110 <listitem>
21111 <para>
21112 <indexterm role="variable">
21113 <primary><varname>$received_for</varname></primary>
21114 </indexterm>
21115 </para>
21116 <informaltable frame="none">
21117 <tgroup cols="1" colsep="0" rowsep="0">
21118 <colspec colwidth="10pt" align="left"/>
21119 <tbody>
21120 <row>
21121 <entry><emphasis>Tainted</emphasis></entry>
21122 </row>
21123 </tbody>
21124 </tgroup>
21125 </informaltable>
21126 <para>
21127 If there is only a single recipient address in an incoming message, this
21128 variable contains that address when the <emphasis>Received:</emphasis> header line is being
21129 built. The value is copied after recipient rewriting has happened, but before
21130 the <function>local_scan()</function> function is run.
21131 </para>
21132 </listitem></varlistentry>
21133 <varlistentry>
21134 <term><varname>$received_ip_address</varname></term>
21135 <term><varname>$received_port</varname></term>
21136 <listitem>
21137 <para>
21138 <indexterm role="variable">
21139 <primary><varname>$received_ip_address</varname></primary>
21140 </indexterm>
21141 <indexterm role="variable">
21142 <primary><varname>$received_port</varname></primary>
21143 </indexterm>
21144 As soon as an Exim server starts processing an incoming TCP/IP connection, these
21145 variables are set to the address and port on the local IP interface.
21146 (The remote IP address and port are in
21147 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
21148 the port value is -1 unless it has been set using the <option>-oMi</option> command line
21149 option.
21150 </para>
21151 <para>
21152 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
21153 could be used, for example, to make the filename for a TLS certificate depend
21154 on which interface and/or port is being used for the incoming connection. The
21155 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
21156 messages that are received, thus making these variables available at delivery
21157 time.
21158 For outbound connections see <varname>$sending_ip_address</varname>.
21159 </para>
21160 </listitem></varlistentry>
21161 <varlistentry>
21162 <term><varname>$received_protocol</varname></term>
21163 <listitem>
21164 <para>
21165 <indexterm role="variable">
21166 <primary><varname>$received_protocol</varname></primary>
21167 </indexterm>
21168 When a message is being processed, this variable contains the name of the
21169 protocol by which it was received. Most of the names used by Exim are defined
21170 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
21171 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
21172 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
21173 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
21174 connection and the client was successfully authenticated.
21175 </para>
21176 <para>
21177 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
21178 automatically set up on connection without the use of STARTTLS (see
21179 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
21180 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
21181 where the client initially uses EHLO, sets up an encrypted connection using
21182 STARTTLS, and then uses HELO afterwards.
21183 </para>
21184 <para>
21185 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
21186 messages that are injected locally by trusted callers. This is commonly used to
21187 identify messages that are being re-injected after some kind of scanning.
21188 </para>
21189 </listitem></varlistentry>
21190 <varlistentry>
21191 <term><varname>$received_time</varname></term>
21192 <listitem>
21193 <para>
21194 <indexterm role="variable">
21195 <primary><varname>$received_time</varname></primary>
21196 </indexterm>
21197 This variable contains the date and time when the current message was received,
21198 as a number of seconds since the start of the Unix epoch.
21199 </para>
21200 </listitem></varlistentry>
21201 <varlistentry>
21202 <term><varname>$recipient_data</varname></term>
21203 <listitem>
21204 <para>
21205 <indexterm role="variable">
21206 <primary><varname>$recipient_data</varname></primary>
21207 </indexterm>
21208 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
21209 condition. It contains the data from the lookup, and the value remains set
21210 until the next <option>recipients</option> test. Thus, you can do things like this:
21211 </para>
21212 <literallayout>
21213 <literal>require recipients  = cdb*@;/some/file</literal>
21214 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
21215 </literallayout>
21216 <para>
21217 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
21218 method in the address list, using the semicolon syntax as in the example above.
21219 The variable is not set for a lookup that is used as part of the string
21220 expansion that all such lists undergo before being interpreted.
21221 </para>
21222 </listitem></varlistentry>
21223 <varlistentry>
21224 <term><varname>$recipient_verify_failure</varname></term>
21225 <listitem>
21226 <para>
21227 <indexterm role="variable">
21228 <primary><varname>$recipient_verify_failure</varname></primary>
21229 </indexterm>
21230 In an ACL, when a recipient verification fails, this variable contains
21231 information about the failure. It is set to one of the following words:
21232 </para>
21233 <itemizedlist>
21234 <listitem>
21235 <para>
21236 <quote>qualify</quote>: The address was unqualified (no domain), and the message
21237 was neither local nor came from an exempted host.
21238 </para>
21239 </listitem>
21240 <listitem>
21241 <para>
21242 <quote>route</quote>: Routing failed.
21243 </para>
21244 </listitem>
21245 <listitem>
21246 <para>
21247 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
21248 or before the MAIL command (that is, on initial connection, HELO, or
21249 MAIL).
21250 </para>
21251 </listitem>
21252 <listitem>
21253 <para>
21254 <quote>recipient</quote>: The RCPT command in a callout was rejected.
21255 </para>
21256 </listitem>
21257 <listitem>
21258 <para>
21259 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
21260 </para>
21261 </listitem>
21262 </itemizedlist>
21263 <para>
21264 The main use of this variable is expected to be to distinguish between
21265 rejections of MAIL and rejections of RCPT.
21266 </para>
21267 </listitem></varlistentry>
21268 <varlistentry>
21269 <term><varname>$recipients</varname></term>
21270 <listitem>
21271 <para>
21272 <indexterm role="variable">
21273 <primary><varname>$recipients</varname></primary>
21274 </indexterm>
21275 </para>
21276 <informaltable frame="none">
21277 <tgroup cols="1" colsep="0" rowsep="0">
21278 <colspec colwidth="10pt" align="left"/>
21279 <tbody>
21280 <row>
21281 <entry><emphasis>Tainted</emphasis></entry>
21282 </row>
21283 </tbody>
21284 </tgroup>
21285 </informaltable>
21286 </listitem></varlistentry>
21287 <varlistentry revisionflag="changed">
21288 <term><varname>$recipients_list</varname></term>
21289 <listitem>
21290 <para revisionflag="changed">
21291 <indexterm role="variable">
21292 <primary><varname>$recipients_list</varname></primary>
21293 </indexterm>
21294 </para>
21295 <informaltable frame="none" revisionflag="changed">
21296 <tgroup cols="1" colsep="0" rowsep="0">
21297 <colspec colwidth="10pt" align="left"/>
21298 <tbody>
21299 <row>
21300 <entry><emphasis>Tainted</emphasis></entry>
21301 </row>
21302 </tbody>
21303 </tgroup>
21304 </informaltable>
21305 <para revisionflag="changed">
21306 These variables both contain the envelope recipients for a message.
21307 </para>
21308 <para revisionflag="changed">
21309 The first uses a comma and a space separate the addresses in the replacement text.
21310 <emphasis role="bold">Note</emphasis>: an address can legitimately contain a comma;
21311 this variable is not intended for further processing.
21312 </para>
21313 <para revisionflag="changed">
21314 The second is a proper Exim list; colon-separated.
21315 </para>
21316 <para>
21317 However, the variables
21318 are not generally available, to prevent exposure of Bcc recipients in
21319 unprivileged users&#x2019; filter files. You can use either of them  only in these
21320 cases:
21321 </para>
21322 <orderedlist numeration="arabic">
21323 <listitem>
21324 <para>
21325 In a system filter file.
21326 </para>
21327 </listitem>
21328 <listitem>
21329 <para>
21330 In the ACLs associated with the DATA command and with non-SMTP messages, that
21331 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
21332 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
21333 <option>acl_not_smtp_mime</option>.
21334 </para>
21335 </listitem>
21336 <listitem>
21337 <para>
21338 From within a <function>local_scan()</function> function.
21339 </para>
21340 </listitem>
21341 </orderedlist>
21342 </listitem></varlistentry>
21343 <varlistentry>
21344 <term><varname>$recipients_count</varname></term>
21345 <listitem>
21346 <para>
21347 <indexterm role="variable">
21348 <primary><varname>$recipients_count</varname></primary>
21349 </indexterm>
21350 When a message is being processed, this variable contains the number of
21351 envelope recipients that came with the message. Duplicates are not excluded
21352 from the count. While a message is being received over SMTP, the number
21353 increases for each accepted recipient. It can be referenced in an ACL.
21354 </para>
21355 </listitem></varlistentry>
21356 <varlistentry>
21357 <term><varname>$regex_match_string</varname></term>
21358 <listitem>
21359 <para>
21360 <indexterm role="variable">
21361 <primary><varname>$regex_match_string</varname></primary>
21362 </indexterm>
21363 This variable is set to contain the matching regular expression after a
21364 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
21365 </para>
21366 </listitem></varlistentry>
21367 <varlistentry>
21368 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
21369 <listitem>
21370 <para>
21371 <indexterm role="concept">
21372 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
21373 </indexterm>
21374 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
21375 these variables contain the
21376 captured substrings identified by the regular expression.
21377 If the subject string was tainted then so will any captured substring.
21378 </para>
21379 </listitem></varlistentry>
21380 <varlistentry>
21381 <term><varname>$reply_address</varname></term>
21382 <listitem>
21383 <para>
21384 <indexterm role="variable">
21385 <primary><varname>$reply_address</varname></primary>
21386 </indexterm>
21387 </para>
21388 <informaltable frame="none">
21389 <tgroup cols="1" colsep="0" rowsep="0">
21390 <colspec colwidth="10pt" align="left"/>
21391 <tbody>
21392 <row>
21393 <entry><emphasis>Tainted</emphasis></entry>
21394 </row>
21395 </tbody>
21396 </tgroup>
21397 </informaltable>
21398 <para>
21399 When a message is being processed, this variable contains the contents of the
21400 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
21401 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
21402 white space, the value is not processed in any way. In particular, no RFC 2047
21403 decoding or character code translation takes place.
21404 </para>
21405 </listitem></varlistentry>
21406 <varlistentry>
21407 <term><varname>$return_path</varname></term>
21408 <listitem>
21409 <para>
21410 <indexterm role="variable">
21411 <primary><varname>$return_path</varname></primary>
21412 </indexterm>
21413 When a message is being delivered, this variable contains the return path &ndash;
21414 the sender field that will be sent as part of the envelope. It is not enclosed
21415 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
21416 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
21417 mailing list has been expanded by a router which specifies a different address
21418 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
21419 address, whereas <varname>$sender_address</varname> always contains the original sender address
21420 that was received with the message. In other words, <varname>$sender_address</varname> contains
21421 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
21422 envelope sender.
21423 </para>
21424 </listitem></varlistentry>
21425 <varlistentry>
21426 <term><varname>$return_size_limit</varname></term>
21427 <listitem>
21428 <para>
21429 <indexterm role="variable">
21430 <primary><varname>$return_size_limit</varname></primary>
21431 </indexterm>
21432 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
21433 </para>
21434 </listitem></varlistentry>
21435 <varlistentry>
21436 <term><varname>$router_name</varname></term>
21437 <listitem>
21438 <para>
21439 <indexterm role="concept">
21440 <primary>router</primary>
21441 <secondary>name</secondary>
21442 </indexterm>
21443 <indexterm role="concept">
21444 <primary>name</primary>
21445 <secondary>of router</secondary>
21446 </indexterm>
21447 <indexterm role="variable">
21448 <primary><varname>$router_name</varname></primary>
21449 </indexterm>
21450 During the running of a router, or a transport called,
21451 this variable contains the router name.
21452 </para>
21453 </listitem></varlistentry>
21454 <varlistentry>
21455 <term><varname>$runrc</varname></term>
21456 <listitem>
21457 <para>
21458 <indexterm role="concept">
21459 <primary>return code</primary>
21460 <secondary>from <option>run</option> expansion</secondary>
21461 </indexterm>
21462 <indexterm role="variable">
21463 <primary><varname>$runrc</varname></primary>
21464 </indexterm>
21465 This variable contains the return code from a command that is run by the
21466 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
21467 assume the order in which option values are expanded, except for those
21468 preconditions whose order of testing is documented. Therefore, you cannot
21469 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
21470 another.
21471 </para>
21472 </listitem></varlistentry>
21473 <varlistentry>
21474 <term><varname>$self_hostname</varname></term>
21475 <listitem>
21476 <para>
21477 <indexterm role="option">
21478 <primary><option>self</option></primary>
21479 <secondary>value of host name</secondary>
21480 </indexterm>
21481 <indexterm role="variable">
21482 <primary><varname>$self_hostname</varname></primary>
21483 </indexterm>
21484 When an address is routed to a supposedly remote host that turns out to be the
21485 local host, what happens is controlled by the <option>self</option> generic router option.
21486 One of its values causes the address to be passed to another router. When this
21487 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
21488 original router encountered. In other circumstances its contents are null.
21489 </para>
21490 </listitem></varlistentry>
21491 <varlistentry>
21492 <term><varname>$sender_address</varname></term>
21493 <listitem>
21494 <para>
21495 <indexterm role="variable">
21496 <primary><varname>$sender_address</varname></primary>
21497 </indexterm>
21498 </para>
21499 <informaltable frame="none">
21500 <tgroup cols="1" colsep="0" rowsep="0">
21501 <colspec colwidth="10pt" align="left"/>
21502 <tbody>
21503 <row>
21504 <entry><emphasis>Tainted</emphasis></entry>
21505 </row>
21506 </tbody>
21507 </tgroup>
21508 </informaltable>
21509 <para>
21510 When a message is being processed, this variable contains the sender&#x2019;s address
21511 that was received in the message&#x2019;s envelope. The case of letters in the address
21512 is retained, in both the local part and the domain. For bounce messages, the
21513 value of this variable is the empty string. See also <varname>$return_path</varname>.
21514 </para>
21515 </listitem></varlistentry>
21516 <varlistentry>
21517 <term><varname>$sender_address_data</varname></term>
21518 <listitem>
21519 <para>
21520 <indexterm role="variable">
21521 <primary><varname>$address_data</varname></primary>
21522 </indexterm>
21523 <indexterm role="variable">
21524 <primary><varname>$sender_address_data</varname></primary>
21525 </indexterm>
21526 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
21527 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
21528 distinguish it from data from a recipient address. The value does not persist
21529 after the end of the current ACL statement. If you want to preserve it for
21530 longer, you can save it in an ACL variable.
21531 </para>
21532 </listitem></varlistentry>
21533 <varlistentry>
21534 <term><varname>$sender_address_domain</varname></term>
21535 <listitem>
21536 <para>
21537 <indexterm role="variable">
21538 <primary><varname>$sender_address_domain</varname></primary>
21539 </indexterm>
21540 </para>
21541 <informaltable frame="none">
21542 <tgroup cols="1" colsep="0" rowsep="0">
21543 <colspec colwidth="10pt" align="left"/>
21544 <tbody>
21545 <row>
21546 <entry><emphasis>Tainted</emphasis></entry>
21547 </row>
21548 </tbody>
21549 </tgroup>
21550 </informaltable>
21551 <para>
21552 The domain portion of <varname>$sender_address</varname>.
21553 </para>
21554 </listitem></varlistentry>
21555 <varlistentry>
21556 <term><varname>$sender_address_local_part</varname></term>
21557 <listitem>
21558 <para>
21559 <indexterm role="variable">
21560 <primary><varname>$sender_address_local_part</varname></primary>
21561 </indexterm>
21562 </para>
21563 <informaltable frame="none">
21564 <tgroup cols="1" colsep="0" rowsep="0">
21565 <colspec colwidth="10pt" align="left"/>
21566 <tbody>
21567 <row>
21568 <entry><emphasis>Tainted</emphasis></entry>
21569 </row>
21570 </tbody>
21571 </tgroup>
21572 </informaltable>
21573 <para>
21574 The local part portion of <varname>$sender_address</varname>.
21575 </para>
21576 </listitem></varlistentry>
21577 <varlistentry>
21578 <term><varname>$sender_data</varname></term>
21579 <listitem>
21580 <para>
21581 <indexterm role="variable">
21582 <primary><varname>$sender_data</varname></primary>
21583 </indexterm>
21584 This variable is set after a lookup success in an ACL <option>senders</option> condition or
21585 in a router <option>senders</option> option. It contains the data from the lookup, and the
21586 value remains set until the next <option>senders</option> test. Thus, you can do things like
21587 this:
21588 </para>
21589 <literallayout>
21590 <literal>require senders      = cdb*@;/some/file</literal>
21591 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
21592 </literallayout>
21593 <para>
21594 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
21595 method in the address list, using the semicolon syntax as in the example above.
21596 The variable is not set for a lookup that is used as part of the string
21597 expansion that all such lists undergo before being interpreted.
21598 </para>
21599 </listitem></varlistentry>
21600 <varlistentry>
21601 <term><varname>$sender_fullhost</varname></term>
21602 <listitem>
21603 <para>
21604 <indexterm role="variable">
21605 <primary><varname>$sender_fullhost</varname></primary>
21606 </indexterm>
21607 When a message is received from a remote host, this variable contains the host
21608 name and IP address in a single string. It ends with the IP address in square
21609 brackets, followed by a colon and a port number if the logging of ports is
21610 enabled. The format of the rest of the string depends on whether the host
21611 issued a HELO or EHLO SMTP command, and whether the host name was verified by
21612 looking up its IP address. (Looking up the IP address can be forced by the
21613 <option>host_lookup</option> option, independent of verification.) A plain host name at the
21614 start of the string is a verified host name; if this is not present,
21615 verification either failed or was not requested. A host name in parentheses is
21616 the argument of a HELO or EHLO command. This is omitted if it is identical to
21617 the verified host name or to the host&#x2019;s IP address in square brackets.
21618 </para>
21619 </listitem></varlistentry>
21620 <varlistentry>
21621 <term><varname>$sender_helo_dnssec</varname></term>
21622 <listitem>
21623 <para>
21624 <indexterm role="variable">
21625 <primary><varname>$sender_helo_dnssec</varname></primary>
21626 </indexterm>
21627 This boolean variable is true if a successful HELO verification was
21628 <indexterm role="concept">
21629 <primary>DNS</primary>
21630 <secondary>DNSSEC</secondary>
21631 </indexterm>
21632 done using DNS information the resolver library stated was authenticated data.
21633 </para>
21634 </listitem></varlistentry>
21635 <varlistentry>
21636 <term><varname>$sender_helo_name</varname></term>
21637 <listitem>
21638 <para>
21639 <indexterm role="variable">
21640 <primary><varname>$sender_helo_name</varname></primary>
21641 </indexterm>
21642 </para>
21643 <informaltable frame="none">
21644 <tgroup cols="1" colsep="0" rowsep="0">
21645 <colspec colwidth="10pt" align="left"/>
21646 <tbody>
21647 <row>
21648 <entry><emphasis>Tainted</emphasis></entry>
21649 </row>
21650 </tbody>
21651 </tgroup>
21652 </informaltable>
21653 <para>
21654 When a message is received from a remote host that has issued a HELO or EHLO
21655 command, the argument of that command is placed in this variable. It is also
21656 set if HELO or EHLO is used when a message is received using SMTP locally via
21657 the <option>-bs</option> or <option>-bS</option> options.
21658 </para>
21659 </listitem></varlistentry>
21660 <varlistentry>
21661 <term><varname>$sender_host_address</varname></term>
21662 <listitem>
21663 <para>
21664 <indexterm role="variable">
21665 <primary><varname>$sender_host_address</varname></primary>
21666 </indexterm>
21667 When a message is received from a remote host using SMTP,
21668 this variable contains that
21669 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
21670 </para>
21671 </listitem></varlistentry>
21672 <varlistentry>
21673 <term><varname>$sender_host_authenticated</varname></term>
21674 <listitem>
21675 <para>
21676 <indexterm role="variable">
21677 <primary><varname>$sender_host_authenticated</varname></primary>
21678 </indexterm>
21679 This variable contains the name (not the public name) of the authenticator
21680 driver that successfully authenticated the client from which the message was
21681 received. It is empty if there was no successful authentication. See also
21682 <varname>$authenticated_id</varname>.
21683 </para>
21684 </listitem></varlistentry>
21685 <varlistentry>
21686 <term><varname>$sender_host_dnssec</varname></term>
21687 <listitem>
21688 <para>
21689 <indexterm role="variable">
21690 <primary><varname>$sender_host_dnssec</varname></primary>
21691 </indexterm>
21692 If an attempt to populate <varname>$sender_host_name</varname> has been made
21693 (by reference, <option>hosts_lookup</option> or
21694 otherwise) then this boolean will have been set true if, and only if, the
21695 resolver library states that both
21696 the reverse and forward DNS were authenticated data.  At all
21697 other times, this variable is false.
21698 </para>
21699 <para>
21700 <indexterm role="concept">
21701 <primary>DNS</primary>
21702 <secondary>DNSSEC</secondary>
21703 </indexterm>
21704 It is likely that you will need to coerce DNSSEC support on in the resolver
21705 library, by setting:
21706 </para>
21707 <literallayout class="monospaced">
21708 dns_dnssec_ok = 1
21709 </literallayout>
21710 <para>
21711 In addition, on Linux with glibc 2.31 or newer the resolver library will
21712 default to stripping out a successful validation status.
21713 This will break a previously working Exim installation.
21714 Provided that you do trust the resolver (ie, is on localhost) you can tell
21715 glibc to pass through any successful validation with a new option in
21716 <filename>/etc/resolv.conf</filename>:
21717 </para>
21718 <literallayout class="monospaced">
21719 options trust-ad
21720 </literallayout>
21721 <para>
21722 Exim does not perform DNSSEC validation itself, instead leaving that to a
21723 validating resolver (e.g. unbound, or bind with suitable configuration).
21724 </para>
21725 <para>
21726 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
21727 mechanism in the list, then this variable will be false.
21728 </para>
21729 <para>
21730 This requires that your system resolver library support EDNS0 (and that
21731 DNSSEC flags exist in the system headers).  If the resolver silently drops
21732 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
21733 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
21734 </para>
21735 </listitem></varlistentry>
21736 <varlistentry>
21737 <term><varname>$sender_host_name</varname></term>
21738 <listitem>
21739 <para>
21740 <indexterm role="variable">
21741 <primary><varname>$sender_host_name</varname></primary>
21742 </indexterm>
21743 </para>
21744 <informaltable frame="none">
21745 <tgroup cols="1" colsep="0" rowsep="0">
21746 <colspec colwidth="10pt" align="left"/>
21747 <tbody>
21748 <row>
21749 <entry><emphasis>Tainted</emphasis></entry>
21750 </row>
21751 </tbody>
21752 </tgroup>
21753 </informaltable>
21754 <para>
21755 When a message is received from a remote host, this variable contains the
21756 host&#x2019;s name as obtained by looking up its IP address. For messages received by
21757 other means, this variable is empty.
21758 </para>
21759 <para>
21760 <indexterm role="variable">
21761 <primary><varname>$host_lookup_failed</varname></primary>
21762 </indexterm>
21763 If the host name has not previously been looked up, a reference to
21764 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
21765 A looked up name is accepted only if it leads back to the original IP address
21766 via a forward lookup. If either the reverse or the forward lookup fails to find
21767 any data, or if the forward lookup does not yield the original IP address,
21768 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
21769 </para>
21770 <para>
21771 <indexterm role="variable">
21772 <primary><varname>$host_lookup_deferred</varname></primary>
21773 </indexterm>
21774 However, if either of the lookups cannot be completed (for example, there is a
21775 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
21776 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
21777 </para>
21778 <para>
21779 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
21780 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
21781 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
21782 is set to <quote>1</quote>.
21783 </para>
21784 <para>
21785 Exim does not automatically look up every calling host&#x2019;s name. If you want
21786 maximum efficiency, you should arrange your configuration so that it avoids
21787 these lookups altogether. The lookup happens only if one or more of the
21788 following are true:
21789 </para>
21790 <itemizedlist>
21791 <listitem>
21792 <para>
21793 A string containing <varname>$sender_host_name</varname> is expanded.
21794 </para>
21795 </listitem>
21796 <listitem>
21797 <para>
21798 The calling host matches the list in <option>host_lookup</option>. In the default
21799 configuration, this option is set to *, so it must be changed if lookups are
21800 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
21801 </para>
21802 </listitem>
21803 <listitem>
21804 <para>
21805 Exim needs the host name in order to test an item in a host list. The items
21806 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
21807 <xref linkend="SECThoslispatnamsk"/>.
21808 </para>
21809 </listitem>
21810 <listitem>
21811 <para>
21812 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
21813 In this case, the host name is required to compare with the name quoted in any
21814 EHLO or HELO commands that the client issues.
21815 </para>
21816 </listitem>
21817 <listitem>
21818 <para>
21819 The remote host issues a EHLO or HELO command that quotes one of the
21820 domains in <option>helo_lookup_domains</option>. The default value of this option is
21821 </para>
21822 <literallayout class="monospaced">
21823   helo_lookup_domains = @ : @[]
21824 </literallayout>
21825 <para>
21826 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
21827 IP address in an EHLO or HELO command.
21828 </para>
21829 </listitem>
21830 </itemizedlist>
21831 </listitem></varlistentry>
21832 <varlistentry>
21833 <term><varname>$sender_host_port</varname></term>
21834 <listitem>
21835 <para>
21836 <indexterm role="variable">
21837 <primary><varname>$sender_host_port</varname></primary>
21838 </indexterm>
21839 When a message is received from a remote host, this variable contains the port
21840 number that was used on the remote host.
21841 </para>
21842 </listitem></varlistentry>
21843 <varlistentry>
21844 <term><varname>$sender_ident</varname></term>
21845 <listitem>
21846 <para>
21847 <indexterm role="variable">
21848 <primary><varname>$sender_ident</varname></primary>
21849 </indexterm>
21850 When a message is received from a remote host, this variable contains the
21851 identification received in response to an RFC 1413 request. When a message has
21852 been received locally, this variable contains the login name of the user that
21853 called Exim.
21854 </para>
21855 </listitem></varlistentry>
21856 <varlistentry>
21857 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
21858 <listitem>
21859 <para>
21860 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
21861 <option>ratelimit</option> ACL condition. Details are given in section
21862 <xref linkend="SECTratelimiting"/>.
21863 </para>
21864 </listitem></varlistentry>
21865 <varlistentry>
21866 <term><varname>$sender_rcvhost</varname></term>
21867 <listitem>
21868 <para>
21869 <indexterm role="concept">
21870 <primary>DNS</primary>
21871 <secondary>reverse lookup</secondary>
21872 </indexterm>
21873 <indexterm role="concept">
21874 <primary>reverse DNS lookup</primary>
21875 </indexterm>
21876 <indexterm role="variable">
21877 <primary><varname>$sender_rcvhost</varname></primary>
21878 </indexterm>
21879 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
21880 either the verified host name (as obtained from a reverse DNS lookup) or, if
21881 there is no verified host name, the IP address in square brackets. After that
21882 there may be text in parentheses. When the first item is a verified host name,
21883 the first thing in the parentheses is the IP address in square brackets,
21884 followed by a colon and a port number if port logging is enabled. When the
21885 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
21886 the parentheses.
21887 </para>
21888 <para>
21889 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
21890 was used and its argument was not identical to the real host name or IP
21891 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
21892 all three items are present in the parentheses, a newline and tab are inserted
21893 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
21894 </para>
21895 </listitem></varlistentry>
21896 <varlistentry>
21897 <term><varname>$sender_verify_failure</varname></term>
21898 <listitem>
21899 <para>
21900 <indexterm role="variable">
21901 <primary><varname>$sender_verify_failure</varname></primary>
21902 </indexterm>
21903 In an ACL, when a sender verification fails, this variable contains information
21904 about the failure. The details are the same as for
21905 <varname>$recipient_verify_failure</varname>.
21906 </para>
21907 </listitem></varlistentry>
21908 <varlistentry>
21909 <term><varname>$sending_ip_address</varname></term>
21910 <listitem>
21911 <para>
21912 <indexterm role="variable">
21913 <primary><varname>$sending_ip_address</varname></primary>
21914 </indexterm>
21915 This variable is set whenever an outgoing SMTP connection to another host has
21916 been set up. It contains the IP address of the local interface that is being
21917 used. This is useful if a host that has more than one IP address wants to take
21918 on different personalities depending on which one is being used. For incoming
21919 connections, see <varname>$received_ip_address</varname>.
21920 </para>
21921 </listitem></varlistentry>
21922 <varlistentry>
21923 <term><varname>$sending_port</varname></term>
21924 <listitem>
21925 <para>
21926 <indexterm role="variable">
21927 <primary><varname>$sending_port</varname></primary>
21928 </indexterm>
21929 This variable is set whenever an outgoing SMTP connection to another host has
21930 been set up. It contains the local port that is being used. For incoming
21931 connections, see <varname>$received_port</varname>.
21932 </para>
21933 </listitem></varlistentry>
21934 <varlistentry>
21935 <term><varname>$smtp_active_hostname</varname></term>
21936 <listitem>
21937 <para>
21938 <indexterm role="variable">
21939 <primary><varname>$smtp_active_hostname</varname></primary>
21940 </indexterm>
21941 During an incoming SMTP session, this variable contains the value of the active
21942 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
21943 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
21944 value can be consulted during routing and delivery.
21945 </para>
21946 </listitem></varlistentry>
21947 <varlistentry>
21948 <term><varname>$smtp_command</varname></term>
21949 <listitem>
21950 <para>
21951 <indexterm role="variable">
21952 <primary><varname>$smtp_command</varname></primary>
21953 </indexterm>
21954 </para>
21955 <informaltable frame="none">
21956 <tgroup cols="1" colsep="0" rowsep="0">
21957 <colspec colwidth="10pt" align="left"/>
21958 <tbody>
21959 <row>
21960 <entry><emphasis>Tainted</emphasis></entry>
21961 </row>
21962 </tbody>
21963 </tgroup>
21964 </informaltable>
21965 <para>
21966 During the processing of an incoming SMTP command, this variable contains the
21967 entire command. This makes it possible to distinguish between HELO and EHLO in
21968 the HELO ACL, and also to distinguish between commands such as these:
21969 </para>
21970 <literallayout class="monospaced">
21971 MAIL FROM:&lt;&gt;
21972 MAIL FROM: &lt;&gt;
21973 </literallayout>
21974 <para>
21975 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
21976 command, the address in <varname>$smtp_command</varname> is the original address before any
21977 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
21978 the address after SMTP-time rewriting.
21979 </para>
21980 </listitem></varlistentry>
21981 <varlistentry>
21982 <term><varname>$smtp_command_argument</varname></term>
21983 <listitem>
21984 <para>
21985 <indexterm role="variable">
21986 <primary><varname>$smtp_command_argument</varname></primary>
21987 </indexterm>
21988 </para>
21989 <informaltable frame="none">
21990 <tgroup cols="1" colsep="0" rowsep="0">
21991 <colspec colwidth="10pt" align="left"/>
21992 <tbody>
21993 <row>
21994 <entry><emphasis>Tainted</emphasis></entry>
21995 </row>
21996 </tbody>
21997 </tgroup>
21998 </informaltable>
21999 <para>
22000 <indexterm role="concept">
22001 <primary>SMTP</primary>
22002 <secondary>command, argument for</secondary>
22003 </indexterm>
22004 While an ACL is running to check an SMTP command, this variable contains the
22005 argument, that is, the text that follows the command name, with leading white
22006 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
22007 somewhat redundant, but is retained for backwards compatibility.
22008 </para>
22009 </listitem></varlistentry>
22010 <varlistentry>
22011 <term><varname>$smtp_command_history</varname></term>
22012 <listitem>
22013 <para>
22014 <indexterm role="concept">
22015 <primary>SMTP</primary>
22016 <secondary>command history</secondary>
22017 </indexterm>
22018 <indexterm role="variable">
22019 <primary><varname>$smtp_command_history</varname></primary>
22020 </indexterm>
22021 A comma-separated list (with no whitespace) of the most-recent SMTP commands
22022 received, in time-order left to right.  Only a limited number of commands
22023 are remembered.
22024 </para>
22025 </listitem></varlistentry>
22026 <varlistentry>
22027 <term><varname>$smtp_count_at_connection_start</varname></term>
22028 <listitem>
22029 <para>
22030 <indexterm role="variable">
22031 <primary><varname>$smtp_count_at_connection_start</varname></primary>
22032 </indexterm>
22033 This variable is set greater than zero only in processes spawned by the Exim
22034 daemon for handling incoming SMTP connections. The name is deliberately long,
22035 in order to emphasize what the contents are. When the daemon accepts a new
22036 connection, it increments this variable. A copy of the variable is passed to
22037 the child process that handles the connection, but its value is fixed, and
22038 never changes. It is only an approximation of how many incoming connections
22039 there actually are, because many other connections may come and go while a
22040 single connection is being processed. When a child process terminates, the
22041 daemon decrements its copy of the variable.
22042 </para>
22043 </listitem></varlistentry>
22044 <varlistentry>
22045 <term><varname>$smtp_notquit_reason</varname></term>
22046 <listitem>
22047 <para>
22048 <indexterm role="variable">
22049 <primary><varname>$smtp_notquit_reason</varname></primary>
22050 </indexterm>
22051 When the not-QUIT ACL is running, this variable is set to a string
22052 that indicates the reason for the termination of the SMTP connection.
22053 </para>
22054 </listitem></varlistentry>
22055 <varlistentry>
22056 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
22057 <listitem>
22058 <para>
22059 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
22060 that were current at the end of the system filter file. This allows a system
22061 filter file to set values that can be tested in users&#x2019; filter files. For
22062 example, a system filter could set a value indicating how likely it is that a
22063 message is junk mail.
22064 </para>
22065 </listitem></varlistentry>
22066 <varlistentry>
22067 <term><varname>$spam_score</varname></term>
22068 <term><varname>$spam_score_int</varname></term>
22069 <term><varname>$spam_bar</varname></term>
22070 <term><varname>$spam_report</varname></term>
22071 <term><varname>$spam_action</varname></term>
22072 <listitem>
22073 <para>
22074 A number of variables whose names start with <varname>$spam</varname> are available when Exim
22075 is compiled with the content-scanning extension. For details, see section
22076 <xref linkend="SECTscanspamass"/>.
22077 </para>
22078 </listitem></varlistentry>
22079 <varlistentry>
22080 <term><varname>$spf_header_comment</varname></term>
22081 <term><varname>$spf_received</varname></term>
22082 <term><varname>$spf_result</varname></term>
22083 <term><varname>$spf_result_guessed</varname></term>
22084 <term><varname>$spf_smtp_comment</varname></term>
22085 <listitem>
22086 <para>
22087 These variables are only available if Exim is built with SPF support.
22088 For details see section <xref linkend="SECSPF"/>.
22089 </para>
22090 </listitem></varlistentry>
22091 <varlistentry>
22092 <term><varname>$spool_directory</varname></term>
22093 <listitem>
22094 <para>
22095 <indexterm role="variable">
22096 <primary><varname>$spool_directory</varname></primary>
22097 </indexterm>
22098 The name of Exim&#x2019;s spool directory.
22099 </para>
22100 </listitem></varlistentry>
22101 <varlistentry>
22102 <term><varname>$spool_inodes</varname></term>
22103 <listitem>
22104 <para>
22105 <indexterm role="variable">
22106 <primary><varname>$spool_inodes</varname></primary>
22107 </indexterm>
22108 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
22109 being written. The value is recalculated whenever the variable is referenced.
22110 If the relevant file system does not have the concept of inodes, the value of
22111 is -1. See also the <option>check_spool_inodes</option> option.
22112 </para>
22113 </listitem></varlistentry>
22114 <varlistentry>
22115 <term><varname>$spool_space</varname></term>
22116 <listitem>
22117 <para>
22118 <indexterm role="variable">
22119 <primary><varname>$spool_space</varname></primary>
22120 </indexterm>
22121 The amount of free space (as a number of kilobytes) in the disk partition where
22122 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
22123 variable is referenced. If the operating system does not have the ability to
22124 find the amount of free space (only true for experimental systems), the space
22125 value is -1. For example, to check in an ACL that there is at least 50
22126 megabytes free on the spool, you could write:
22127 </para>
22128 <literallayout class="monospaced">
22129 condition = ${if &gt; {$spool_space}{50000}}
22130 </literallayout>
22131 <para>
22132 See also the <option>check_spool_space</option> option.
22133 </para>
22134 </listitem></varlistentry>
22135 <varlistentry>
22136 <term><varname>$thisaddress</varname></term>
22137 <listitem>
22138 <para>
22139 <indexterm role="variable">
22140 <primary><varname>$thisaddress</varname></primary>
22141 </indexterm>
22142 This variable is set only during the processing of the <option>foranyaddress</option>
22143 command in a filter file. Its use is explained in the description of that
22144 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
22145 interfaces to mail filtering</emphasis>.
22146 </para>
22147 </listitem></varlistentry>
22148 <varlistentry>
22149 <term><varname>$tls_in_bits</varname></term>
22150 <listitem>
22151 <para>
22152 <indexterm role="variable">
22153 <primary><varname>$tls_in_bits</varname></primary>
22154 </indexterm>
22155 Contains an approximation of the TLS cipher&#x2019;s bit-strength
22156 on the inbound connection; the meaning of
22157 this depends upon the TLS implementation used.
22158 If TLS has not been negotiated, the value will be 0.
22159 The value of this is automatically fed into the Cyrus SASL authenticator
22160 when acting as a server, to specify the "external SSF" (a SASL term).
22161 </para>
22162 <para>
22163 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
22164 except when used in the context of an outbound SMTP delivery, when it refers to
22165 the outbound.
22166 </para>
22167 </listitem></varlistentry>
22168 <varlistentry>
22169 <term><varname>$tls_out_bits</varname></term>
22170 <listitem>
22171 <para>
22172 <indexterm role="variable">
22173 <primary><varname>$tls_out_bits</varname></primary>
22174 </indexterm>
22175 Contains an approximation of the TLS cipher&#x2019;s bit-strength
22176 on an outbound SMTP connection; the meaning of
22177 this depends upon the TLS implementation used.
22178 If TLS has not been negotiated, the value will be 0.
22179 </para>
22180 </listitem></varlistentry>
22181 <varlistentry>
22182 <term><varname>$tls_in_ourcert</varname></term>
22183 <listitem>
22184 <para>
22185 <indexterm role="variable">
22186 <primary><varname>$tls_in_ourcert</varname></primary>
22187 </indexterm>
22188 <indexterm role="concept">
22189 <primary>certificate</primary>
22190 <secondary>variables</secondary>
22191 </indexterm>
22192 This variable refers to the certificate presented to the peer of an
22193 inbound connection when the message was received.
22194 It is only useful as the argument of a
22195 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
22196 or a <option>def</option> condition.
22197 </para>
22198 <para>
22199 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
22200 when a list of more than one
22201 file is used for <option>tls_certificate</option>, this variable is not reliable.
22202 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
22203 </para>
22204 </listitem></varlistentry>
22205 <varlistentry>
22206 <term><varname>$tls_in_peercert</varname></term>
22207 <listitem>
22208 <para>
22209 <indexterm role="variable">
22210 <primary><varname>$tls_in_peercert</varname></primary>
22211 </indexterm>
22212 This variable refers to the certificate presented by the peer of an
22213 inbound connection when the message was received.
22214 It is only useful as the argument of a
22215 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
22216 or a <option>def</option> condition.
22217 If certificate verification fails it may refer to a failing chain element
22218 which is not the leaf.
22219 </para>
22220 </listitem></varlistentry>
22221 <varlistentry>
22222 <term><varname>$tls_out_ourcert</varname></term>
22223 <listitem>
22224 <para>
22225 <indexterm role="variable">
22226 <primary><varname>$tls_out_ourcert</varname></primary>
22227 </indexterm>
22228 This variable refers to the certificate presented to the peer of an
22229 outbound connection.  It is only useful as the argument of a
22230 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
22231 or a <option>def</option> condition.
22232 </para>
22233 </listitem></varlistentry>
22234 <varlistentry>
22235 <term><varname>$tls_out_peercert</varname></term>
22236 <listitem>
22237 <para>
22238 <indexterm role="variable">
22239 <primary><varname>$tls_out_peercert</varname></primary>
22240 </indexterm>
22241 This variable refers to the certificate presented by the peer of an
22242 outbound connection.  It is only useful as the argument of a
22243 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
22244 or a <option>def</option> condition.
22245 If certificate verification fails it may refer to a failing chain element
22246 which is not the leaf.
22247 </para>
22248 </listitem></varlistentry>
22249 <varlistentry>
22250 <term><varname>$tls_in_certificate_verified</varname></term>
22251 <listitem>
22252 <para>
22253 <indexterm role="variable">
22254 <primary><varname>$tls_in_certificate_verified</varname></primary>
22255 </indexterm>
22256 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
22257 message was received, and <quote>0</quote> otherwise.
22258 </para>
22259 <para>
22260 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
22261 except when used in the context of an outbound SMTP delivery, when it refers to
22262 the outbound.
22263 </para>
22264 </listitem></varlistentry>
22265 <varlistentry>
22266 <term><varname>$tls_out_certificate_verified</varname></term>
22267 <listitem>
22268 <para>
22269 <indexterm role="variable">
22270 <primary><varname>$tls_out_certificate_verified</varname></primary>
22271 </indexterm>
22272 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
22273 outbound SMTP connection was made,
22274 and <quote>0</quote> otherwise.
22275 </para>
22276 </listitem></varlistentry>
22277 <varlistentry>
22278 <term><varname>$tls_in_cipher</varname></term>
22279 <listitem>
22280 <para>
22281 <indexterm role="variable">
22282 <primary><varname>$tls_in_cipher</varname></primary>
22283 </indexterm>
22284 <indexterm role="variable">
22285 <primary><varname>$tls_cipher</varname></primary>
22286 </indexterm>
22287 When a message is received from a remote host over an encrypted SMTP
22288 connection, this variable is set to the cipher suite that was negotiated, for
22289 example DES-CBC3-SHA. In other circumstances, in particular, for message
22290 received over unencrypted connections, the variable is empty. Testing
22291 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
22292 non-encrypted connections during ACL processing.
22293 </para>
22294 <para>
22295 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
22296 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
22297 becomes the same as <varname>$tls_out_cipher</varname>.
22298 </para>
22299 </listitem></varlistentry>
22300 <varlistentry>
22301 <term><varname>$tls_in_cipher_std</varname></term>
22302 <listitem>
22303 <para>
22304 <indexterm role="variable">
22305 <primary><varname>$tls_in_cipher_std</varname></primary>
22306 </indexterm>
22307 As above, but returning the RFC standard name for the cipher suite.
22308 </para>
22309 </listitem></varlistentry>
22310 <varlistentry>
22311 <term><varname>$tls_out_cipher</varname></term>
22312 <listitem>
22313 <para>
22314 <indexterm role="variable">
22315 <primary><varname>$tls_out_cipher</varname></primary>
22316 </indexterm>
22317 This variable is
22318 cleared before any outgoing SMTP connection is made,
22319 and then set to the outgoing cipher suite if one is negotiated. See chapter
22320 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
22321 details of the <command>smtp</command> transport.
22322 </para>
22323 </listitem></varlistentry>
22324 <varlistentry>
22325 <term><varname>$tls_out_cipher_std</varname></term>
22326 <listitem>
22327 <para>
22328 <indexterm role="variable">
22329 <primary><varname>$tls_out_cipher_std</varname></primary>
22330 </indexterm>
22331 As above, but returning the RFC standard name for the cipher suite.
22332 </para>
22333 </listitem></varlistentry>
22334 <varlistentry>
22335 <term><varname>$tls_out_dane</varname></term>
22336 <listitem>
22337 <para>
22338 <indexterm role="variable">
22339 <primary><varname>$tls_out_dane</varname></primary>
22340 </indexterm>
22341 DANE active status.  See section <xref linkend="SECDANE"/>.
22342 </para>
22343 </listitem></varlistentry>
22344 <varlistentry>
22345 <term><varname>$tls_in_ocsp</varname></term>
22346 <listitem>
22347 <para>
22348 <indexterm role="variable">
22349 <primary><varname>$tls_in_ocsp</varname></primary>
22350 </indexterm>
22351 When a message is received from a remote client connection
22352 the result of any OCSP request from the client is encoded in this variable:
22353 </para>
22354 <literallayout class="monospaced">
22355 0 OCSP proof was not requested (default value)
22356 1 No response to request
22357 2 Response not verified
22358 3 Verification failed
22359 4 Verification succeeded
22360 </literallayout>
22361 </listitem></varlistentry>
22362 <varlistentry>
22363 <term><varname>$tls_out_ocsp</varname></term>
22364 <listitem>
22365 <para>
22366 <indexterm role="variable">
22367 <primary><varname>$tls_out_ocsp</varname></primary>
22368 </indexterm>
22369 When a message is sent to a remote host connection
22370 the result of any OCSP request made is encoded in this variable.
22371 See <varname>$tls_in_ocsp</varname> for values.
22372 </para>
22373 </listitem></varlistentry>
22374 <varlistentry>
22375 <term><varname>$tls_in_peerdn</varname></term>
22376 <listitem>
22377 <para>
22378 <indexterm role="variable">
22379 <primary><varname>$tls_in_peerdn</varname></primary>
22380 </indexterm>
22381 <indexterm role="variable">
22382 <primary><varname>$tls_peerdn</varname></primary>
22383 </indexterm>
22384 <indexterm role="concept">
22385 <primary>certificate</primary>
22386 <secondary>extracting fields</secondary>
22387 </indexterm>
22388 When a message is received from a remote host over an encrypted SMTP
22389 connection, and Exim is configured to request a certificate from the client,
22390 the value of the Distinguished Name of the certificate is made available in the
22391 <varname>$tls_in_peerdn</varname> during subsequent processing.
22392 If certificate verification fails it may refer to a failing chain element
22393 which is not the leaf.
22394 </para>
22395 <para>
22396 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
22397 except when used in the context of an outbound SMTP delivery, when it refers to
22398 the outbound.
22399 </para>
22400 </listitem></varlistentry>
22401 <varlistentry>
22402 <term><varname>$tls_out_peerdn</varname></term>
22403 <listitem>
22404 <para>
22405 <indexterm role="variable">
22406 <primary><varname>$tls_out_peerdn</varname></primary>
22407 </indexterm>
22408 When a message is being delivered to a remote host over an encrypted SMTP
22409 connection, and Exim is configured to request a certificate from the server,
22410 the value of the Distinguished Name of the certificate is made available in the
22411 <varname>$tls_out_peerdn</varname> during subsequent processing.
22412 If certificate verification fails it may refer to a failing chain element
22413 which is not the leaf.
22414 </para>
22415 </listitem></varlistentry>
22416 <varlistentry>
22417 <term><varname>$tls_in_resumption</varname></term>
22418 <term><varname>$tls_out_resumption</varname></term>
22419 <listitem>
22420 <para>
22421 <indexterm role="variable">
22422 <primary><varname>$tls_in_resumption</varname></primary>
22423 </indexterm>
22424 <indexterm role="variable">
22425 <primary><varname>$tls_out_resumption</varname></primary>
22426 </indexterm>
22427 <indexterm role="concept">
22428 <primary>TLS</primary>
22429 <secondary>resumption</secondary>
22430 </indexterm>
22431 Observability for TLS session resumption.  See <xref linkend="SECTresumption"/> for details.
22432 </para>
22433 </listitem></varlistentry>
22434 <varlistentry>
22435 <term><varname>$tls_in_sni</varname></term>
22436 <listitem>
22437 <para>
22438 <indexterm role="variable">
22439 <primary><varname>$tls_in_sni</varname></primary>
22440 </indexterm>
22441 </para>
22442 <informaltable frame="none">
22443 <tgroup cols="1" colsep="0" rowsep="0">
22444 <colspec colwidth="10pt" align="left"/>
22445 <tbody>
22446 <row>
22447 <entry><emphasis>Tainted</emphasis></entry>
22448 </row>
22449 </tbody>
22450 </tgroup>
22451 </informaltable>
22452 <para>
22453 <indexterm role="variable">
22454 <primary><varname>$tls_sni</varname></primary>
22455 </indexterm>
22456 <indexterm role="concept">
22457 <primary>TLS</primary>
22458 <secondary>Server Name Indication</secondary>
22459 </indexterm>
22460 <indexterm role="concept">
22461 <primary>TLS</primary>
22462 <secondary>SNI</secondary>
22463 </indexterm>
22464 <indexterm role="concept">
22465 <primary>SNI</primary>
22466 <secondary>observability on server</secondary>
22467 </indexterm>
22468 When a TLS session is being established, if the client sends the Server
22469 Name Indication extension, the value will be placed in this variable.
22470 If the variable appears in <option>tls_certificate</option> then this option and
22471 some others, described in <xref linkend="SECTtlssni"/>,
22472 will be re-expanded early in the TLS session, to permit
22473 a different certificate to be presented (and optionally a different key to be
22474 used) to the client, based upon the value of the SNI extension.
22475 </para>
22476 <para>
22477 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
22478 except when used in the context of an outbound SMTP delivery, when it refers to
22479 the outbound.
22480 </para>
22481 </listitem></varlistentry>
22482 <varlistentry>
22483 <term><varname>$tls_out_sni</varname></term>
22484 <listitem>
22485 <para>
22486 <indexterm role="variable">
22487 <primary><varname>$tls_out_sni</varname></primary>
22488 </indexterm>
22489 <indexterm role="concept">
22490 <primary>TLS</primary>
22491 <secondary>Server Name Indication</secondary>
22492 </indexterm>
22493 <indexterm role="concept">
22494 <primary>TLS</primary>
22495 <secondary>SNI</secondary>
22496 </indexterm>
22497 <indexterm role="concept">
22498 <primary>SNI</primary>
22499 <secondary>observability in client</secondary>
22500 </indexterm>
22501 During outbound
22502 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
22503 the transport.
22504 </para>
22505 </listitem></varlistentry>
22506 <varlistentry>
22507 <term><varname>$tls_out_tlsa_usage</varname></term>
22508 <listitem>
22509 <para>
22510 <indexterm role="variable">
22511 <primary><varname>$tls_out_tlsa_usage</varname></primary>
22512 </indexterm>
22513 Bitfield of TLSA record types found.  See section <xref linkend="SECDANE"/>.
22514 </para>
22515 </listitem></varlistentry>
22516 <varlistentry>
22517 <term><varname>$tls_in_ver</varname></term>
22518 <listitem>
22519 <para>
22520 <indexterm role="variable">
22521 <primary><varname>$tls_in_ver</varname></primary>
22522 </indexterm>
22523 When a message is received from a remote host over an encrypted SMTP connection
22524 this variable is set to the protocol version, eg <emphasis>TLS1.2</emphasis>.
22525 </para>
22526 </listitem></varlistentry>
22527 <varlistentry>
22528 <term><varname>$tls_out_ver</varname></term>
22529 <listitem>
22530 <para>
22531 <indexterm role="variable">
22532 <primary><varname>$tls_out_ver</varname></primary>
22533 </indexterm>
22534 When a message is being delivered to a remote host over an encrypted SMTP connection
22535 this variable is set to the protocol version.
22536 </para>
22537 </listitem></varlistentry>
22538 <varlistentry>
22539 <term><varname>$tod_bsdinbox</varname></term>
22540 <listitem>
22541 <para>
22542 <indexterm role="variable">
22543 <primary><varname>$tod_bsdinbox</varname></primary>
22544 </indexterm>
22545 The time of day and the date, in the format required for BSD-style mailbox
22546 files, for example: Thu Oct 17 17:14:09 1995.
22547 </para>
22548 </listitem></varlistentry>
22549 <varlistentry>
22550 <term><varname>$tod_epoch</varname></term>
22551 <listitem>
22552 <para>
22553 <indexterm role="variable">
22554 <primary><varname>$tod_epoch</varname></primary>
22555 </indexterm>
22556 The time and date as a number of seconds since the start of the Unix epoch.
22557 </para>
22558 </listitem></varlistentry>
22559 <varlistentry>
22560 <term><varname>$tod_epoch_l</varname></term>
22561 <listitem>
22562 <para>
22563 <indexterm role="variable">
22564 <primary><varname>$tod_epoch_l</varname></primary>
22565 </indexterm>
22566 The time and date as a number of microseconds since the start of the Unix epoch.
22567 </para>
22568 </listitem></varlistentry>
22569 <varlistentry>
22570 <term><varname>$tod_full</varname></term>
22571 <listitem>
22572 <para>
22573 <indexterm role="variable">
22574 <primary><varname>$tod_full</varname></primary>
22575 </indexterm>
22576 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
22577 +0100. The timezone is always given as a numerical offset from UTC, with
22578 positive values used for timezones that are ahead (east) of UTC, and negative
22579 values for those that are behind (west).
22580 </para>
22581 </listitem></varlistentry>
22582 <varlistentry>
22583 <term><varname>$tod_log</varname></term>
22584 <listitem>
22585 <para>
22586 <indexterm role="variable">
22587 <primary><varname>$tod_log</varname></primary>
22588 </indexterm>
22589 The time and date in the format used for writing Exim&#x2019;s log files, for example:
22590 1995-10-12 15:32:29, but without a timezone.
22591 </para>
22592 </listitem></varlistentry>
22593 <varlistentry>
22594 <term><varname>$tod_logfile</varname></term>
22595 <listitem>
22596 <para>
22597 <indexterm role="variable">
22598 <primary><varname>$tod_logfile</varname></primary>
22599 </indexterm>
22600 This variable contains the date in the format yyyymmdd. This is the format that
22601 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
22602 flag.
22603 </para>
22604 </listitem></varlistentry>
22605 <varlistentry>
22606 <term><varname>$tod_zone</varname></term>
22607 <listitem>
22608 <para>
22609 <indexterm role="variable">
22610 <primary><varname>$tod_zone</varname></primary>
22611 </indexterm>
22612 This variable contains the numerical value of the local timezone, for example:
22613 -0500.
22614 </para>
22615 </listitem></varlistentry>
22616 <varlistentry>
22617 <term><varname>$tod_zulu</varname></term>
22618 <listitem>
22619 <para>
22620 <indexterm role="variable">
22621 <primary><varname>$tod_zulu</varname></primary>
22622 </indexterm>
22623 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
22624 by ISO 8601, for example: 20030221154023Z.
22625 </para>
22626 </listitem></varlistentry>
22627 <varlistentry>
22628 <term><varname>$transport_name</varname></term>
22629 <listitem>
22630 <para>
22631 <indexterm role="concept">
22632 <primary>transport</primary>
22633 <secondary>name</secondary>
22634 </indexterm>
22635 <indexterm role="concept">
22636 <primary>name</primary>
22637 <secondary>of transport</secondary>
22638 </indexterm>
22639 <indexterm role="variable">
22640 <primary><varname>$transport_name</varname></primary>
22641 </indexterm>
22642 During the running of a transport, this variable contains its name.
22643 </para>
22644 </listitem></varlistentry>
22645 <varlistentry>
22646 <term><varname>$value</varname></term>
22647 <listitem>
22648 <para>
22649 <indexterm role="variable">
22650 <primary><varname>$value</varname></primary>
22651 </indexterm>
22652 This variable contains the result of an expansion lookup, extraction operation,
22653 or external command, as described above. It is also used during a
22654 <emphasis role="bold">reduce</emphasis> expansion.
22655 </para>
22656 </listitem></varlistentry>
22657 <varlistentry>
22658 <term><varname>$verify_mode</varname></term>
22659 <listitem>
22660 <para>
22661 <indexterm role="variable">
22662 <primary><varname>$verify_mode</varname></primary>
22663 </indexterm>
22664 While a router or transport is being run in verify mode or for cutthrough delivery,
22665 contains "S" for sender-verification or "R" for recipient-verification.
22666 Otherwise, empty.
22667 </para>
22668 </listitem></varlistentry>
22669 <varlistentry>
22670 <term><varname>$version_number</varname></term>
22671 <listitem>
22672 <para>
22673 <indexterm role="variable">
22674 <primary><varname>$version_number</varname></primary>
22675 </indexterm>
22676 The version number of Exim. Same as <varname>$exim_version</varname>, may be overridden
22677 by the <option>exim_version</option> main config option.
22678 </para>
22679 </listitem></varlistentry>
22680 <varlistentry>
22681 <term><varname>$warn_message_delay</varname></term>
22682 <listitem>
22683 <para>
22684 <indexterm role="variable">
22685 <primary><varname>$warn_message_delay</varname></primary>
22686 </indexterm>
22687 This variable is set only during the creation of a message warning about a
22688 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
22689 </para>
22690 </listitem></varlistentry>
22691 <varlistentry>
22692 <term><varname>$warn_message_recipients</varname></term>
22693 <listitem>
22694 <para>
22695 <indexterm role="variable">
22696 <primary><varname>$warn_message_recipients</varname></primary>
22697 </indexterm>
22698 This variable is set only during the creation of a message warning about a
22699 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
22700 </para>
22701 </listitem></varlistentry>
22702 </variablelist>
22703 <para>
22704 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
22705 </para>
22706 </section>
22707 </chapter>
22708
22709 <chapter id="CHAPperl">
22710 <title>Embedded Perl</title>
22711 <para>
22712 <indexterm role="concept" id="IIDperl" class="startofrange">
22713 <primary>Perl</primary>
22714 <secondary>calling from Exim</secondary>
22715 </indexterm>
22716 Exim can be built to include an embedded Perl interpreter. When this is done,
22717 Perl subroutines can be called as part of the string expansion process. To make
22718 use of the Perl support, you need version 5.004 or later of Perl installed on
22719 your system. To include the embedded interpreter in the Exim binary, include
22720 the line
22721 </para>
22722 <literallayout class="monospaced">
22723 EXIM_PERL = perl.o
22724 </literallayout>
22725 <para>
22726 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
22727 </para>
22728 <section id="SECID85">
22729 <title>Setting up so Perl can be used</title>
22730 <para>
22731 <indexterm role="option">
22732 <primary><option>perl_startup</option></primary>
22733 </indexterm>
22734 Access to Perl subroutines is via a global configuration option called
22735 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
22736 no <option>perl_startup</option> option in the Exim configuration file then no Perl
22737 interpreter is started and there is almost no overhead for Exim (since none of
22738 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
22739 option then the associated value is taken to be Perl code which is executed in
22740 a newly created Perl interpreter.
22741 </para>
22742 <para>
22743 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
22744 need backslashes before any characters to escape special meanings. The option
22745 should usually be something like
22746 </para>
22747 <literallayout class="monospaced">
22748 perl_startup = do '/etc/exim.pl'
22749 </literallayout>
22750 <para>
22751 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
22752 use from Exim. Exim can be configured either to start up a Perl interpreter as
22753 soon as it is entered, or to wait until the first time it is needed. Starting
22754 the interpreter at the beginning ensures that it is done while Exim still has
22755 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
22756 fact used in a particular run. Also, note that this does not mean that Exim is
22757 necessarily running as root when Perl is called at a later time. By default,
22758 the interpreter is started only when it is needed, but this can be changed in
22759 two ways:
22760 </para>
22761 <itemizedlist>
22762 <listitem>
22763 <para>
22764 <indexterm role="option">
22765 <primary><option>perl_at_start</option></primary>
22766 </indexterm>
22767 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
22768 a startup when Exim is entered.
22769 </para>
22770 </listitem>
22771 <listitem>
22772 <para>
22773 The command line option <option>-ps</option> also requests a startup when Exim is entered,
22774 overriding the setting of <option>perl_at_start</option>.
22775 </para>
22776 </listitem>
22777 </itemizedlist>
22778 <para>
22779 There is also a command line option <option>-pd</option> (for delay) which suppresses the
22780 initial startup, even if <option>perl_at_start</option> is set.
22781 </para>
22782 <itemizedlist>
22783 <listitem>
22784 <para>
22785 <indexterm role="option">
22786 <primary><option>perl_taintmode</option></primary>
22787 </indexterm>
22788 <indexterm role="concept">
22789 <primary>Perl</primary>
22790 <secondary>taintmode</secondary>
22791 </indexterm>
22792 To provide more security executing Perl code via the embedded Perl
22793 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
22794 taint mode of the Perl interpreter. You are encouraged to set this
22795 option to a true value. To avoid breaking existing installations, it
22796 defaults to false.
22797 </para>
22798 <para>
22799 <emphasis role="bold">Note</emphasis>: This is entirely separate from Exim&#x2019;s tainted-data tracking.
22800 </para>
22801 </listitem>
22802 </itemizedlist>
22803 </section>
22804 <section id="SECID86">
22805 <title>Calling Perl subroutines</title>
22806 <para>
22807 When the configuration file includes a <option>perl_startup</option> option you can make use
22808 of the string expansion item to call the Perl subroutines that are defined
22809 by the <option>perl_startup</option> code. The operator is used in any of the following
22810 forms:
22811 </para>
22812 <literallayout class="monospaced">
22813 ${perl{foo}}
22814 ${perl{foo}{argument}}
22815 ${perl{foo}{argument1}{argument2} ... }
22816 </literallayout>
22817 <para>
22818 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
22819 arguments may be passed. Passing more than this results in an expansion failure
22820 with an error message of the form
22821 </para>
22822 <literallayout class="monospaced">
22823 Too many arguments passed to Perl subroutine "foo" (max is 8)
22824 </literallayout>
22825 <para>
22826 The return value of the Perl subroutine is evaluated in a scalar context before
22827 it is passed back to Exim to be inserted into the expanded string. If the
22828 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
22829 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
22830 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
22831 that was passed to <option>die</option>.
22832 </para>
22833 </section>
22834 <section id="SECID87">
22835 <title>Calling Exim functions from Perl</title>
22836 <para>
22837 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
22838 is available to call back into Exim&#x2019;s string expansion function. For example,
22839 the Perl code
22840 </para>
22841 <literallayout class="monospaced">
22842 my $lp = Exim::expand_string('$local_part');
22843 </literallayout>
22844 <para>
22845 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
22846 Note those are single quotes and not double quotes to protect against
22847 <varname>$local_part</varname> being interpolated as a Perl variable.
22848 </para>
22849 <para>
22850 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
22851 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
22852 expansion string, the Perl call from the original expansion string fails with
22853 an appropriate error message, in the same way as if <option>die</option> were used.
22854 </para>
22855 <para>
22856 <indexterm role="concept">
22857 <primary>debugging</primary>
22858 <secondary>from embedded Perl</secondary>
22859 </indexterm>
22860 <indexterm role="concept">
22861 <primary>log</primary>
22862 <secondary>writing from embedded Perl</secondary>
22863 </indexterm>
22864 Two other Exim functions are available for use from within Perl code.
22865 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
22866 debugging is enabled. If you want a newline at the end, you must supply it.
22867 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
22868 timestamp. In this case, you should not supply a terminating newline.
22869 </para>
22870 </section>
22871 <section id="SECID88">
22872 <title>Use of standard output and error by Perl</title>
22873 <para>
22874 <indexterm role="concept">
22875 <primary>Perl</primary>
22876 <secondary>standard output and error</secondary>
22877 </indexterm>
22878 You should not write to the standard error or output streams from within your
22879 Perl code, as it is not defined how these are set up. In versions of Exim
22880 before 4.50, it is possible for the standard output or error to refer to the
22881 SMTP connection during message reception via the daemon. Writing to this stream
22882 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
22883 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
22884 avoided, but the output is lost.
22885 </para>
22886 <para>
22887 <indexterm role="concept">
22888 <primary>Perl</primary>
22889 <secondary>use of <option>warn</option></secondary>
22890 </indexterm>
22891 The Perl <option>warn</option> statement writes to the standard error stream by default.
22892 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
22893 you have no control. When Exim starts up the Perl interpreter, it arranges for
22894 output from the <option>warn</option> statement to be written to the Exim main log. You can
22895 change this by including appropriate Perl magic somewhere in your Perl code.
22896 For example, to discard <option>warn</option> output completely, you need this:
22897 </para>
22898 <literallayout class="monospaced">
22899 $SIG{__WARN__} = sub { };
22900 </literallayout>
22901 <para>
22902 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
22903 example, the code for the subroutine is empty, so it does nothing, but you can
22904 include any Perl code that you like. The text of the <option>warn</option> message is passed
22905 as the first subroutine argument.
22906 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
22907 </para>
22908 </section>
22909 </chapter>
22910
22911 <chapter id="CHAPinterfaces">
22912 <title>Starting the daemon and the use of network interfaces</title>
22913 <titleabbrev>Starting the daemon</titleabbrev>
22914 <para>
22915 <indexterm role="concept">
22916 <primary>daemon</primary>
22917 <secondary>starting</secondary>
22918 </indexterm>
22919 <indexterm role="concept">
22920 <primary>interface</primary>
22921 <secondary>listening</secondary>
22922 </indexterm>
22923 <indexterm role="concept">
22924 <primary>network interface</primary>
22925 </indexterm>
22926 <indexterm role="concept">
22927 <primary>interface</primary>
22928 <secondary>network</secondary>
22929 </indexterm>
22930 <indexterm role="concept">
22931 <primary>IP address</primary>
22932 <secondary>for listening</secondary>
22933 </indexterm>
22934 <indexterm role="concept">
22935 <primary>daemon</primary>
22936 <secondary>listening IP addresses</secondary>
22937 </indexterm>
22938 <indexterm role="concept">
22939 <primary>TCP/IP</primary>
22940 <secondary>setting listening interfaces</secondary>
22941 </indexterm>
22942 <indexterm role="concept">
22943 <primary>TCP/IP</primary>
22944 <secondary>setting listening ports</secondary>
22945 </indexterm>
22946 A host that is connected to a TCP/IP network may have one or more physical
22947 hardware network interfaces. Each of these interfaces may be configured as one
22948 or more <quote>logical</quote> interfaces, which are the entities that a program actually
22949 works with. Each of these logical interfaces is associated with an IP address.
22950 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
22951 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
22952 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
22953 </para>
22954 <orderedlist numeration="arabic">
22955 <listitem>
22956 <para>
22957 When a listening daemon is started, Exim needs to know which interfaces
22958 and ports to listen on.
22959 </para>
22960 </listitem>
22961 <listitem>
22962 <para>
22963 When Exim is routing an address, it needs to know which IP addresses
22964 are associated with local interfaces. This is required for the correct
22965 processing of MX lists by removing the local host and others with the
22966 same or higher priority values. Also, Exim needs to detect cases
22967 when an address is routed to an IP address that in fact belongs to the
22968 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
22969 option of the smtp transport is set (as appropriate), this is treated
22970 as an error situation.
22971 </para>
22972 </listitem>
22973 <listitem>
22974 <para>
22975 When Exim connects to a remote host, it may need to know which interface to use
22976 for the outgoing connection.
22977 </para>
22978 </listitem>
22979 </orderedlist>
22980 <para>
22981 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
22982 of cases. If your host has only one interface, and you want all its IP
22983 addresses to be treated in the same way, and you are using only the
22984 standard SMTP port, you should not need to take any special action. The
22985 rest of this chapter does not apply to you.
22986 </para>
22987 <para>
22988 In a more complicated situation you may want to listen only on certain
22989 interfaces, or on different ports, and for this reason there are a number of
22990 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
22991 chapter describes how they operate.
22992 </para>
22993 <para>
22994 When a message is received over TCP/IP, the interface and port that were
22995 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
22996 </para>
22997 <section id="SECID89">
22998 <title>Starting a listening daemon</title>
22999 <para>
23000 When a listening daemon is started (by means of the <option>-bd</option> command line
23001 option), the interfaces and ports on which it listens are controlled by the
23002 following options:
23003 </para>
23004 <itemizedlist>
23005 <listitem>
23006 <para>
23007 <option>daemon_smtp_ports</option> contains a list of default ports
23008 or service names.
23009 (For backward compatibility, this option can also be specified in the singular.)
23010 </para>
23011 </listitem>
23012 <listitem>
23013 <para>
23014 <option>local_interfaces</option> contains list of interface IP addresses on which to
23015 listen. Each item may optionally also specify a port.
23016 </para>
23017 </listitem>
23018 </itemizedlist>
23019 <para>
23020 The default list separator in both cases is a colon, but this can be changed as
23021 described in section <xref linkend="SECTlistsepchange"/>. When IPv6 addresses are involved,
23022 it is usually best to change the separator to avoid having to double all the
23023 colons. For example:
23024 </para>
23025 <literallayout class="monospaced">
23026 local_interfaces = &lt;; 127.0.0.1 ; \
23027                       192.168.23.65 ; \
23028                       ::1 ; \
23029                       3ffe:ffff:836f::fe86:a061
23030 </literallayout>
23031 <para>
23032 There are two different formats for specifying a port along with an IP address
23033 in <option>local_interfaces</option>:
23034 </para>
23035 <orderedlist numeration="arabic">
23036 <listitem>
23037 <para>
23038 The port is added onto the address with a dot separator. For example, to listen
23039 on port 1234 on two different IP addresses:
23040 </para>
23041 <literallayout class="monospaced">
23042 local_interfaces = &lt;; 192.168.23.65.1234 ; \
23043                       3ffe:ffff:836f::fe86:a061.1234
23044 </literallayout>
23045 </listitem>
23046 <listitem>
23047 <para>
23048 The IP address is enclosed in square brackets, and the port is added
23049 with a colon separator, for example:
23050 </para>
23051 <literallayout class="monospaced">
23052 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
23053                       [3ffe:ffff:836f::fe86:a061]:1234
23054 </literallayout>
23055 </listitem>
23056 </orderedlist>
23057 <para>
23058 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
23059 default setting contains just one port:
23060 </para>
23061 <literallayout class="monospaced">
23062 daemon_smtp_ports = smtp
23063 </literallayout>
23064 <para>
23065 If more than one port is listed, each interface that does not have its own port
23066 specified listens on all of them. Ports that are listed in
23067 <option>daemon_smtp_ports</option> can be identified either by name (defined in
23068 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
23069 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
23070 </para>
23071 </section>
23072 <section id="SECID90">
23073 <title>Special IP listening addresses</title>
23074 <para>
23075 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
23076 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
23077 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
23078 instead of setting up separate listening sockets for each interface. The
23079 default value of <option>local_interfaces</option> is
23080 </para>
23081 <literallayout class="monospaced">
23082 local_interfaces = 0.0.0.0
23083 </literallayout>
23084 <para>
23085 when Exim is built without IPv6 support; otherwise it is:
23086 </para>
23087 <literallayout class="monospaced">
23088 local_interfaces = &lt;; ::0 ; 0.0.0.0
23089 </literallayout>
23090 <para>
23091 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
23092 </para>
23093 </section>
23094 <section id="SECID91">
23095 <title>Overriding local_interfaces and daemon_smtp_ports</title>
23096 <para>
23097 The <option>-oX</option> command line option can be used to override the values of
23098 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
23099 instance. Another way of doing this would be to use macros and the <option>-D</option>
23100 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
23101 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
23102 exim.
23103 </para>
23104 <para>
23105 The value of <option>-oX</option> is a list of items. The default colon separator can be
23106 changed in the usual way (<xref linkend="SECTlistsepchange"/>) if required.
23107 If there are any items that do not
23108 contain dots or colons (that is, are not IP addresses), the value of
23109 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
23110 items that do contain dots or colons, the value of <option>local_interfaces</option> is
23111 replaced by those items. Thus, for example,
23112 </para>
23113 <literallayout class="monospaced">
23114 -oX 1225
23115 </literallayout>
23116 <para>
23117 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
23118 whereas
23119 </para>
23120 <literallayout class="monospaced">
23121 -oX 192.168.34.5.1125
23122 </literallayout>
23123 <para>
23124 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
23125 (However, since <option>local_interfaces</option> now contains no items without ports, the
23126 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
23127 </para>
23128 </section>
23129 <section id="SECTsupobssmt">
23130 <title>Support for the submissions (aka SSMTP or SMTPS) protocol</title>
23131 <para>
23132 <indexterm role="concept">
23133 <primary>submissions protocol</primary>
23134 </indexterm>
23135 <indexterm role="concept">
23136 <primary>ssmtp protocol</primary>
23137 </indexterm>
23138 <indexterm role="concept">
23139 <primary>smtps protocol</primary>
23140 </indexterm>
23141 <indexterm role="concept">
23142 <primary>SMTP</primary>
23143 <secondary>ssmtp protocol</secondary>
23144 </indexterm>
23145 <indexterm role="concept">
23146 <primary>SMTP</primary>
23147 <secondary>smtps protocol</secondary>
23148 </indexterm>
23149 Exim supports the use of TLS-on-connect, used by mail clients in the
23150 <quote>submissions</quote> protocol, historically also known as SMTPS or SSMTP.
23151 For some years, IETF Standards Track documents only blessed the
23152 STARTTLS-based Submission service (port 587) while common practice was to support
23153 the same feature set on port 465, but using TLS-on-connect.
23154 If your installation needs to provide service to mail clients
23155 (Mail User Agents, MUAs) then you should provide service on both the 587 and
23156 the 465 TCP ports.
23157 </para>
23158 <para>
23159 If the <option>tls_on_connect_ports</option> option is set to a list of port numbers or
23160 service names, connections to those ports must first establish TLS, before
23161 proceeding to the application layer use of the SMTP protocol.
23162 </para>
23163 <para>
23164 The common use of this option is expected to be
23165 </para>
23166 <literallayout class="monospaced">
23167 tls_on_connect_ports = 465
23168 </literallayout>
23169 <para>
23170 per RFC 8314.
23171 There is also a command line option <option>-tls-on-connect</option>, which forces all ports
23172 to behave in this way when a daemon is started.
23173 </para>
23174 <para>
23175 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
23176 daemon to listen on those ports. You must still specify them in
23177 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
23178 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
23179 connections via the daemon.)
23180 </para>
23181 </section>
23182 <section id="SECID92">
23183 <title>IPv6 address scopes</title>
23184 <para>
23185 <indexterm role="concept">
23186 <primary>IPv6</primary>
23187 <secondary>address scopes</secondary>
23188 </indexterm>
23189 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
23190 can, in principle, have the same link-local IPv6 address on different
23191 interfaces. Thus, additional information is needed, over and above the IP
23192 address, to distinguish individual interfaces. A convention of using a
23193 percent sign followed by something (often the interface name) has been
23194 adopted in some cases, leading to addresses like this:
23195 </para>
23196 <literallayout class="monospaced">
23197 fe80::202:b3ff:fe03:45c1%eth0
23198 </literallayout>
23199 <para>
23200 To accommodate this usage, a percent sign followed by an arbitrary string is
23201 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
23202 to convert a textual IPv6 address for actual use. This function recognizes the
23203 percent convention in operating systems that support it, and it processes the
23204 address appropriately. Unfortunately, some older libraries have problems with
23205 <function>getaddrinfo()</function>. If
23206 </para>
23207 <literallayout class="monospaced">
23208 IPV6_USE_INET_PTON=yes
23209 </literallayout>
23210 <para>
23211 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
23212 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
23213 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
23214 function.) Of course, this means that the additional functionality of
23215 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
23216 </para>
23217 </section>
23218 <section id="SECID93">
23219 <title>Disabling IPv6</title>
23220 <para>
23221 <indexterm role="concept">
23222 <primary>IPv6</primary>
23223 <secondary>disabling</secondary>
23224 </indexterm>
23225 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
23226 run on a host whose kernel does not support IPv6. The binary will fall back to
23227 using IPv4, but it may waste resources looking up AAAA records, and trying to
23228 connect to IPv6 addresses, causing delays to mail delivery. If you set the
23229 <indexterm role="option">
23230 <primary><option>disable_ipv6</option></primary>
23231 </indexterm>
23232 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
23233 activities take place. AAAA records are never looked up, and any IPv6 addresses
23234 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
23235 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23236 to handle IPv6 literal addresses.
23237 </para>
23238 <para>
23239 On the other hand, when IPv6 is in use, there may be times when you want to
23240 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
23241 option to globally suppress the lookup of AAAA records for specified domains,
23242 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
23243 IPv6 addresses in an individual router.
23244 </para>
23245 </section>
23246 <section id="SECID94">
23247 <title>Examples of starting a listening daemon</title>
23248 <para>
23249 The default case in an IPv6 environment is
23250 </para>
23251 <literallayout class="monospaced">
23252 daemon_smtp_ports = smtp
23253 local_interfaces = &lt;; ::0 ; 0.0.0.0
23254 </literallayout>
23255 <para>
23256 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
23257 Either one or two sockets may be used, depending on the characteristics of
23258 the TCP/IP stack. (This is complicated and messy; for more information,
23259 read the comments in the <filename>daemon.c</filename> source file.)
23260 </para>
23261 <para>
23262 To specify listening on ports 25 and 26 on all interfaces:
23263 </para>
23264 <literallayout class="monospaced">
23265 daemon_smtp_ports = 25 : 26
23266 </literallayout>
23267 <para>
23268 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
23269 </para>
23270 <literallayout class="monospaced">
23271 local_interfaces = &lt;; ::0.25     ; ::0.26 \
23272                       0.0.0.0.25 ; 0.0.0.0.26
23273 </literallayout>
23274 <para>
23275 To listen on the default port on all IPv4 interfaces, and on port 26 on the
23276 IPv4 loopback address only:
23277 </para>
23278 <literallayout class="monospaced">
23279 local_interfaces = 0.0.0.0 : 127.0.0.1.26
23280 </literallayout>
23281 <para>
23282 To specify listening on the default port on specific interfaces only:
23283 </para>
23284 <literallayout class="monospaced">
23285 local_interfaces = 10.0.0.67 : 192.168.34.67
23286 </literallayout>
23287 <para>
23288 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
23289 </para>
23290 </section>
23291 <section id="SECTreclocipadd">
23292 <title>Recognizing the local host</title>
23293 <para>
23294 The <option>local_interfaces</option> option is also used when Exim needs to determine
23295 whether or not an IP address refers to the local host. That is, the IP
23296 addresses of all the interfaces on which a daemon is listening are always
23297 treated as local.
23298 </para>
23299 <para>
23300 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
23301 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
23302 available interfaces from the operating system, and extracts the relevant
23303 (that is, IPv4 or IPv6) addresses to use for checking.
23304 </para>
23305 <para>
23306 Some systems set up large numbers of virtual interfaces in order to provide
23307 many virtual web servers. In this situation, you may want to listen for
23308 email on only a few of the available interfaces, but nevertheless treat all
23309 interfaces as local when routing. You can do this by setting
23310 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
23311 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
23312 used for listening. Consider this example:
23313 </para>
23314 <literallayout class="monospaced">
23315 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
23316                       192.168.53.235 ; \
23317                       3ffe:2101:12:1:a00:20ff:fe86:a061
23318
23319 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
23320 </literallayout>
23321 <para>
23322 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
23323 address, but all available interface addresses are treated as local when
23324 Exim is routing.
23325 </para>
23326 <para>
23327 In some environments the local host name may be in an MX list, but with an IP
23328 address that is not assigned to any local interface. In other cases it may be
23329 desirable to treat other host names as if they referred to the local host. Both
23330 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
23331 This contains host names rather than IP addresses. When a host is referenced
23332 during routing, either via an MX record or directly, it is treated as the local
23333 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
23334 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
23335 </para>
23336 </section>
23337 <section id="SECID95">
23338 <title>Delivering to a remote host</title>
23339 <para>
23340 Delivery to a remote host is handled by the smtp transport. By default, it
23341 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
23342 there is more than one) when connecting to a remote host. However, the
23343 <option>interface</option> option can be set to specify which interface is used. See the
23344 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
23345 details.
23346 </para>
23347 </section>
23348 </chapter>
23349
23350 <chapter id="CHAPmainconfig">
23351 <title>Main configuration</title>
23352 <para>
23353 <indexterm role="concept" id="IIDconfima" class="startofrange">
23354 <primary>configuration file</primary>
23355 <secondary>main section</secondary>
23356 </indexterm>
23357 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
23358 <primary>main configuration</primary>
23359 </indexterm>
23360 The first part of the runtime configuration file contains three types of item:
23361 </para>
23362 <itemizedlist>
23363 <listitem>
23364 <para>
23365 Macro definitions: These lines start with an upper case letter. See section
23366 <xref linkend="SECTmacrodefs"/> for details of macro processing.
23367 </para>
23368 </listitem>
23369 <listitem>
23370 <para>
23371 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
23372 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
23373 section <xref linkend="SECTnamedlists"/>.
23374 </para>
23375 </listitem>
23376 <listitem>
23377 <para>
23378 Main configuration settings: Each setting occupies one line of the file
23379 (with possible continuations). If any setting is preceded by the word
23380 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
23381 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
23382 settings.
23383 </para>
23384 </listitem>
23385 </itemizedlist>
23386 <para>
23387 This chapter specifies all the main configuration options, along with their
23388 types and default values. For ease of finding a particular option, they appear
23389 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
23390 are now so many options, they are first listed briefly in functional groups, as
23391 an aid to finding the name of the option you are looking for. Some options are
23392 listed in more than one group.
23393 </para>
23394 <section id="SECID96">
23395 <title>Miscellaneous</title>
23396 <informaltable frame="none">
23397 <tgroup cols="2" colsep="0" rowsep="0">
23398 <colspec colwidth="196pt" align="left"/>
23399 <colspec colwidth="254pt" align="left"/>
23400 <tbody>
23401 <row>
23402 <entry><option>add_environment</option></entry>
23403 <entry>environment variables</entry>
23404 </row>
23405 <row>
23406 <entry><option>bi_command</option></entry>
23407 <entry>to run for <option>-bi</option> command line option</entry>
23408 </row>
23409 <row>
23410 <entry><option>debug_store</option></entry>
23411 <entry>do extra internal checks</entry>
23412 </row>
23413 <row>
23414 <entry><option>disable_ipv6</option></entry>
23415 <entry>do no IPv6 processing</entry>
23416 </row>
23417 <row>
23418 <entry><option>keep_environment</option></entry>
23419 <entry>environment variables</entry>
23420 </row>
23421 <row>
23422 <entry><option>keep_malformed</option></entry>
23423 <entry>for broken files &ndash; should not happen</entry>
23424 </row>
23425 <row>
23426 <entry><option>localhost_number</option></entry>
23427 <entry>for unique message ids in clusters</entry>
23428 </row>
23429 <row>
23430 <entry><option>message_body_newlines</option></entry>
23431 <entry>retain newlines in <varname>$message_body</varname></entry>
23432 </row>
23433 <row>
23434 <entry><option>message_body_visible</option></entry>
23435 <entry>how much to show in <varname>$message_body</varname></entry>
23436 </row>
23437 <row>
23438 <entry><option>mua_wrapper</option></entry>
23439 <entry>run in <quote>MUA wrapper</quote> mode</entry>
23440 </row>
23441 <row>
23442 <entry><option>print_topbitchars</option></entry>
23443 <entry>top-bit characters are printing</entry>
23444 </row>
23445 <row>
23446 <entry><option>spool_wireformat</option></entry>
23447 <entry>use wire-format spool data files when possible</entry>
23448 </row>
23449 <row>
23450 <entry><option>timezone</option></entry>
23451 <entry>force time zone</entry>
23452 </row>
23453 </tbody>
23454 </tgroup>
23455 </informaltable>
23456 </section>
23457 <section id="SECID97">
23458 <title>Exim parameters</title>
23459 <informaltable frame="none">
23460 <tgroup cols="2" colsep="0" rowsep="0">
23461 <colspec colwidth="196pt" align="left"/>
23462 <colspec colwidth="254pt" align="left"/>
23463 <tbody>
23464 <row>
23465 <entry><option>exim_group</option></entry>
23466 <entry>override compiled-in value</entry>
23467 </row>
23468 <row>
23469 <entry><option>exim_path</option></entry>
23470 <entry>override compiled-in value</entry>
23471 </row>
23472 <row>
23473 <entry><option>exim_user</option></entry>
23474 <entry>override compiled-in value</entry>
23475 </row>
23476 <row>
23477 <entry><option>primary_hostname</option></entry>
23478 <entry>default from <function>uname()</function></entry>
23479 </row>
23480 <row>
23481 <entry><option>split_spool_directory</option></entry>
23482 <entry>use multiple directories</entry>
23483 </row>
23484 <row>
23485 <entry><option>spool_directory</option></entry>
23486 <entry>override compiled-in value</entry>
23487 </row>
23488 </tbody>
23489 </tgroup>
23490 </informaltable>
23491 </section>
23492 <section id="SECID98">
23493 <title>Privilege controls</title>
23494 <informaltable frame="none">
23495 <tgroup cols="2" colsep="0" rowsep="0">
23496 <colspec colwidth="196pt" align="left"/>
23497 <colspec colwidth="254pt" align="left"/>
23498 <tbody>
23499 <row>
23500 <entry><option>admin_groups</option></entry>
23501 <entry>groups that are Exim admin users</entry>
23502 </row>
23503 <row>
23504 <entry><option>commandline_checks_require_admin</option></entry>
23505 <entry>require admin for various checks</entry>
23506 </row>
23507 <row>
23508 <entry><option>deliver_drop_privilege</option></entry>
23509 <entry>drop root for delivery processes</entry>
23510 </row>
23511 <row>
23512 <entry><option>local_from_check</option></entry>
23513 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
23514 </row>
23515 <row>
23516 <entry><option>local_from_prefix</option></entry>
23517 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
23518 </row>
23519 <row>
23520 <entry><option>local_from_suffix</option></entry>
23521 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
23522 </row>
23523 <row>
23524 <entry><option>local_sender_retain</option></entry>
23525 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
23526 </row>
23527 <row>
23528 <entry><option>never_users</option></entry>
23529 <entry>do not run deliveries as these</entry>
23530 </row>
23531 <row>
23532 <entry><option>prod_requires_admin</option></entry>
23533 <entry>forced delivery requires admin user</entry>
23534 </row>
23535 <row>
23536 <entry><option>queue_list_requires_admin</option></entry>
23537 <entry>queue listing requires admin user</entry>
23538 </row>
23539 <row>
23540 <entry><option>trusted_groups</option></entry>
23541 <entry>groups that are trusted</entry>
23542 </row>
23543 <row>
23544 <entry><option>trusted_users</option></entry>
23545 <entry>users that are trusted</entry>
23546 </row>
23547 </tbody>
23548 </tgroup>
23549 </informaltable>
23550 </section>
23551 <section id="SECID99">
23552 <title>Logging</title>
23553 <informaltable frame="none">
23554 <tgroup cols="2" colsep="0" rowsep="0">
23555 <colspec colwidth="196pt" align="left"/>
23556 <colspec colwidth="254pt" align="left"/>
23557 <tbody>
23558 <row>
23559 <entry><option>event_action</option></entry>
23560 <entry>custom logging</entry>
23561 </row>
23562 <row>
23563 <entry><option>hosts_connection_nolog</option></entry>
23564 <entry>exemption from connect logging</entry>
23565 </row>
23566 <row>
23567 <entry><option>log_file_path</option></entry>
23568 <entry>override compiled-in value</entry>
23569 </row>
23570 <row>
23571 <entry><option>log_selector</option></entry>
23572 <entry>set/unset optional logging</entry>
23573 </row>
23574 <row>
23575 <entry><option>log_timezone</option></entry>
23576 <entry>add timezone to log lines</entry>
23577 </row>
23578 <row>
23579 <entry><option>message_logs</option></entry>
23580 <entry>create per-message logs</entry>
23581 </row>
23582 <row>
23583 <entry><option>preserve_message_logs</option></entry>
23584 <entry>after message completion</entry>
23585 </row>
23586 <row>
23587 <entry><option>panic_coredump</option></entry>
23588 <entry>request coredump on fatal errors</entry>
23589 </row>
23590 <row>
23591 <entry><option>process_log_path</option></entry>
23592 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
23593 </row>
23594 <row>
23595 <entry><option>slow_lookup_log</option></entry>
23596 <entry>control logging of slow DNS lookups</entry>
23597 </row>
23598 <row>
23599 <entry><option>syslog_duplication</option></entry>
23600 <entry>controls duplicate log lines on syslog</entry>
23601 </row>
23602 <row>
23603 <entry><option>syslog_facility</option></entry>
23604 <entry>set syslog <quote>facility</quote> field</entry>
23605 </row>
23606 <row>
23607 <entry><option>syslog_pid</option></entry>
23608 <entry>pid in syslog lines</entry>
23609 </row>
23610 <row>
23611 <entry><option>syslog_processname</option></entry>
23612 <entry>set syslog <quote>ident</quote> field</entry>
23613 </row>
23614 <row>
23615 <entry><option>syslog_timestamp</option></entry>
23616 <entry>timestamp syslog lines</entry>
23617 </row>
23618 <row>
23619 <entry><option>write_rejectlog</option></entry>
23620 <entry>control use of message log</entry>
23621 </row>
23622 </tbody>
23623 </tgroup>
23624 </informaltable>
23625 </section>
23626 <section id="SECID100">
23627 <title>Frozen messages</title>
23628 <informaltable frame="none">
23629 <tgroup cols="2" colsep="0" rowsep="0">
23630 <colspec colwidth="196pt" align="left"/>
23631 <colspec colwidth="254pt" align="left"/>
23632 <tbody>
23633 <row>
23634 <entry><option>auto_thaw</option></entry>
23635 <entry>sets time for retrying frozen messages</entry>
23636 </row>
23637 <row>
23638 <entry><option>freeze_tell</option></entry>
23639 <entry>send message when freezing</entry>
23640 </row>
23641 <row>
23642 <entry><option>move_frozen_messages</option></entry>
23643 <entry>to another directory</entry>
23644 </row>
23645 <row>
23646 <entry><option>timeout_frozen_after</option></entry>
23647 <entry>keep frozen messages only so long</entry>
23648 </row>
23649 </tbody>
23650 </tgroup>
23651 </informaltable>
23652 </section>
23653 <section id="SECID101">
23654 <title>Data lookups</title>
23655 <informaltable frame="none">
23656 <tgroup cols="2" colsep="0" rowsep="0">
23657 <colspec colwidth="196pt" align="left"/>
23658 <colspec colwidth="254pt" align="left"/>
23659 <tbody>
23660 <row>
23661 <entry><option>ibase_servers</option></entry>
23662 <entry>InterBase servers</entry>
23663 </row>
23664 <row>
23665 <entry><option>ldap_ca_cert_dir</option></entry>
23666 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
23667 </row>
23668 <row>
23669 <entry><option>ldap_ca_cert_file</option></entry>
23670 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
23671 </row>
23672 <row>
23673 <entry><option>ldap_cert_file</option></entry>
23674 <entry>client cert file for LDAP</entry>
23675 </row>
23676 <row>
23677 <entry><option>ldap_cert_key</option></entry>
23678 <entry>client key file for LDAP</entry>
23679 </row>
23680 <row>
23681 <entry><option>ldap_cipher_suite</option></entry>
23682 <entry>TLS negotiation preference control</entry>
23683 </row>
23684 <row>
23685 <entry><option>ldap_default_servers</option></entry>
23686 <entry>used if no server in query</entry>
23687 </row>
23688 <row>
23689 <entry><option>ldap_require_cert</option></entry>
23690 <entry>action to take without LDAP server cert</entry>
23691 </row>
23692 <row>
23693 <entry><option>ldap_start_tls</option></entry>
23694 <entry>require TLS within LDAP</entry>
23695 </row>
23696 <row>
23697 <entry><option>ldap_version</option></entry>
23698 <entry>set protocol version</entry>
23699 </row>
23700 <row>
23701 <entry><option>lookup_open_max</option></entry>
23702 <entry>lookup files held open</entry>
23703 </row>
23704 <row>
23705 <entry><option>mysql_servers</option></entry>
23706 <entry>default MySQL servers</entry>
23707 </row>
23708 <row>
23709 <entry><option>oracle_servers</option></entry>
23710 <entry>Oracle servers</entry>
23711 </row>
23712 <row>
23713 <entry><option>pgsql_servers</option></entry>
23714 <entry>default PostgreSQL servers</entry>
23715 </row>
23716 <row>
23717 <entry><option>sqlite_lock_timeout</option></entry>
23718 <entry>as it says</entry>
23719 </row>
23720 </tbody>
23721 </tgroup>
23722 </informaltable>
23723 </section>
23724 <section id="SECID102">
23725 <title>Message ids</title>
23726 <informaltable frame="none">
23727 <tgroup cols="2" colsep="0" rowsep="0">
23728 <colspec colwidth="196pt" align="left"/>
23729 <colspec colwidth="254pt" align="left"/>
23730 <tbody>
23731 <row>
23732 <entry><option>message_id_header_domain</option></entry>
23733 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
23734 </row>
23735 <row>
23736 <entry><option>message_id_header_text</option></entry>
23737 <entry>ditto</entry>
23738 </row>
23739 </tbody>
23740 </tgroup>
23741 </informaltable>
23742 </section>
23743 <section id="SECID103">
23744 <title>Embedded Perl Startup</title>
23745 <informaltable frame="none">
23746 <tgroup cols="2" colsep="0" rowsep="0">
23747 <colspec colwidth="196pt" align="left"/>
23748 <colspec colwidth="254pt" align="left"/>
23749 <tbody>
23750 <row>
23751 <entry><option>perl_at_start</option></entry>
23752 <entry>always start the interpreter</entry>
23753 </row>
23754 <row>
23755 <entry><option>perl_startup</option></entry>
23756 <entry>code to obey when starting Perl</entry>
23757 </row>
23758 <row>
23759 <entry><option>perl_taintmode</option></entry>
23760 <entry>enable taint mode in Perl</entry>
23761 </row>
23762 </tbody>
23763 </tgroup>
23764 </informaltable>
23765 </section>
23766 <section id="SECID104">
23767 <title>Daemon</title>
23768 <informaltable frame="none">
23769 <tgroup cols="2" colsep="0" rowsep="0">
23770 <colspec colwidth="196pt" align="left"/>
23771 <colspec colwidth="254pt" align="left"/>
23772 <tbody>
23773 <row>
23774 <entry><option>daemon_smtp_ports</option></entry>
23775 <entry>default ports</entry>
23776 </row>
23777 <row>
23778 <entry><option>daemon_startup_retries</option></entry>
23779 <entry>number of times to retry</entry>
23780 </row>
23781 <row>
23782 <entry><option>daemon_startup_sleep</option></entry>
23783 <entry>time to sleep between tries</entry>
23784 </row>
23785 <row>
23786 <entry><option>extra_local_interfaces</option></entry>
23787 <entry>not necessarily listened on</entry>
23788 </row>
23789 <row>
23790 <entry><option>local_interfaces</option></entry>
23791 <entry>on which to listen, with optional ports</entry>
23792 </row>
23793 <row>
23794 <entry><option>notifier_socket</option></entry>
23795 <entry>override compiled-in value</entry>
23796 </row>
23797 <row>
23798 <entry><option>pid_file_path</option></entry>
23799 <entry>override compiled-in value</entry>
23800 </row>
23801 <row>
23802 <entry><option>queue_run_max</option></entry>
23803 <entry>maximum simultaneous queue runners</entry>
23804 </row>
23805 <row>
23806 <entry><option>smtp_backlog_monitor</option></entry>
23807 <entry>level to log listen backlog</entry>
23808 </row>
23809 </tbody>
23810 </tgroup>
23811 </informaltable>
23812 </section>
23813 <section id="SECID105">
23814 <title>Resource control</title>
23815 <informaltable frame="none">
23816 <tgroup cols="2" colsep="0" rowsep="0">
23817 <colspec colwidth="196pt" align="left"/>
23818 <colspec colwidth="254pt" align="left"/>
23819 <tbody>
23820 <row>
23821 <entry><option>check_log_inodes</option></entry>
23822 <entry>before accepting a message</entry>
23823 </row>
23824 <row>
23825 <entry><option>check_log_space</option></entry>
23826 <entry>before accepting a message</entry>
23827 </row>
23828 <row>
23829 <entry><option>check_spool_inodes</option></entry>
23830 <entry>before accepting a message</entry>
23831 </row>
23832 <row>
23833 <entry><option>check_spool_space</option></entry>
23834 <entry>before accepting a message</entry>
23835 </row>
23836 <row>
23837 <entry><option>deliver_queue_load_max</option></entry>
23838 <entry>no queue deliveries if load high</entry>
23839 </row>
23840 <row>
23841 <entry><option>queue_only_load</option></entry>
23842 <entry>queue incoming if load high</entry>
23843 </row>
23844 <row>
23845 <entry><option>queue_only_load_latch</option></entry>
23846 <entry>don&#x2019;t re-evaluate load for each message</entry>
23847 </row>
23848 <row>
23849 <entry><option>queue_run_max</option></entry>
23850 <entry>maximum simultaneous queue runners</entry>
23851 </row>
23852 <row>
23853 <entry><option>remote_max_parallel</option></entry>
23854 <entry>parallel SMTP delivery per message</entry>
23855 </row>
23856 <row>
23857 <entry><option>smtp_accept_max</option></entry>
23858 <entry>simultaneous incoming connections</entry>
23859 </row>
23860 <row>
23861 <entry><option>smtp_accept_max_nonmail</option></entry>
23862 <entry>non-mail commands</entry>
23863 </row>
23864 <row>
23865 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
23866 <entry>hosts to which the limit applies</entry>
23867 </row>
23868 <row>
23869 <entry><option>smtp_accept_max_per_connection</option></entry>
23870 <entry>messages per connection</entry>
23871 </row>
23872 <row>
23873 <entry><option>smtp_accept_max_per_host</option></entry>
23874 <entry>connections from one host</entry>
23875 </row>
23876 <row>
23877 <entry><option>smtp_accept_queue</option></entry>
23878 <entry>queue mail if more connections</entry>
23879 </row>
23880 <row>
23881 <entry><option>smtp_accept_queue_per_connection</option></entry>
23882 <entry>queue if more messages per connection</entry>
23883 </row>
23884 <row>
23885 <entry><option>smtp_accept_reserve</option></entry>
23886 <entry>only reserve hosts if more connections</entry>
23887 </row>
23888 <row>
23889 <entry><option>smtp_check_spool_space</option></entry>
23890 <entry>from SIZE on MAIL command</entry>
23891 </row>
23892 <row>
23893 <entry><option>smtp_connect_backlog</option></entry>
23894 <entry>passed to TCP/IP stack</entry>
23895 </row>
23896 <row>
23897 <entry><option>smtp_load_reserve</option></entry>
23898 <entry>SMTP from reserved hosts if load high</entry>
23899 </row>
23900 <row>
23901 <entry><option>smtp_reserve_hosts</option></entry>
23902 <entry>these are the reserve hosts</entry>
23903 </row>
23904 </tbody>
23905 </tgroup>
23906 </informaltable>
23907 </section>
23908 <section id="SECID106">
23909 <title>Policy controls</title>
23910 <informaltable frame="none">
23911 <tgroup cols="2" colsep="0" rowsep="0">
23912 <colspec colwidth="196pt" align="left"/>
23913 <colspec colwidth="254pt" align="left"/>
23914 <tbody>
23915 <row>
23916 <entry><option>acl_not_smtp</option></entry>
23917 <entry>ACL for non-SMTP messages</entry>
23918 </row>
23919 <row>
23920 <entry><option>acl_not_smtp_mime</option></entry>
23921 <entry>ACL for non-SMTP MIME parts</entry>
23922 </row>
23923 <row>
23924 <entry><option>acl_not_smtp_start</option></entry>
23925 <entry>ACL for start of non-SMTP message</entry>
23926 </row>
23927 <row>
23928 <entry><option>acl_smtp_auth</option></entry>
23929 <entry>ACL for AUTH</entry>
23930 </row>
23931 <row>
23932 <entry><option>acl_smtp_connect</option></entry>
23933 <entry>ACL for connection</entry>
23934 </row>
23935 <row>
23936 <entry><option>acl_smtp_data</option></entry>
23937 <entry>ACL for DATA</entry>
23938 </row>
23939 <row>
23940 <entry><option>acl_smtp_data_prdr</option></entry>
23941 <entry>ACL for DATA, per-recipient</entry>
23942 </row>
23943 <row>
23944 <entry><option>acl_smtp_dkim</option></entry>
23945 <entry>ACL for DKIM verification</entry>
23946 </row>
23947 <row>
23948 <entry><option>acl_smtp_etrn</option></entry>
23949 <entry>ACL for ETRN</entry>
23950 </row>
23951 <row>
23952 <entry><option>acl_smtp_expn</option></entry>
23953 <entry>ACL for EXPN</entry>
23954 </row>
23955 <row>
23956 <entry><option>acl_smtp_helo</option></entry>
23957 <entry>ACL for EHLO or HELO</entry>
23958 </row>
23959 <row>
23960 <entry><option>acl_smtp_mail</option></entry>
23961 <entry>ACL for MAIL</entry>
23962 </row>
23963 <row>
23964 <entry><option>acl_smtp_mailauth</option></entry>
23965 <entry>ACL for AUTH on MAIL command</entry>
23966 </row>
23967 <row>
23968 <entry><option>acl_smtp_mime</option></entry>
23969 <entry>ACL for MIME parts</entry>
23970 </row>
23971 <row>
23972 <entry><option>acl_smtp_notquit</option></entry>
23973 <entry>ACL for non-QUIT terminations</entry>
23974 </row>
23975 <row>
23976 <entry><option>acl_smtp_predata</option></entry>
23977 <entry>ACL for start of data</entry>
23978 </row>
23979 <row>
23980 <entry><option>acl_smtp_quit</option></entry>
23981 <entry>ACL for QUIT</entry>
23982 </row>
23983 <row>
23984 <entry><option>acl_smtp_rcpt</option></entry>
23985 <entry>ACL for RCPT</entry>
23986 </row>
23987 <row>
23988 <entry><option>acl_smtp_starttls</option></entry>
23989 <entry>ACL for STARTTLS</entry>
23990 </row>
23991 <row>
23992 <entry><option>acl_smtp_vrfy</option></entry>
23993 <entry>ACL for VRFY</entry>
23994 </row>
23995 <row>
23996 <entry><option>av_scanner</option></entry>
23997 <entry>specify virus scanner</entry>
23998 </row>
23999 <row>
24000 <entry><option>check_rfc2047_length</option></entry>
24001 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
24002 </row>
24003 <row>
24004 <entry><option>dns_cname_loops</option></entry>
24005 <entry>follow CNAMEs returned by resolver</entry>
24006 </row>
24007 <row>
24008 <entry><option>dns_csa_search_limit</option></entry>
24009 <entry>control CSA parent search depth</entry>
24010 </row>
24011 <row>
24012 <entry><option>dns_csa_use_reverse</option></entry>
24013 <entry>en/disable CSA IP reverse search</entry>
24014 </row>
24015 <row>
24016 <entry><option>header_maxsize</option></entry>
24017 <entry>total size of message header</entry>
24018 </row>
24019 <row>
24020 <entry><option>header_line_maxsize</option></entry>
24021 <entry>individual header line limit</entry>
24022 </row>
24023 <row>
24024 <entry><option>helo_accept_junk_hosts</option></entry>
24025 <entry>allow syntactic junk from these hosts</entry>
24026 </row>
24027 <row>
24028 <entry><option>helo_allow_chars</option></entry>
24029 <entry>allow illegal chars in HELO names</entry>
24030 </row>
24031 <row>
24032 <entry><option>helo_lookup_domains</option></entry>
24033 <entry>lookup hostname for these HELO names</entry>
24034 </row>
24035 <row>
24036 <entry><option>helo_try_verify_hosts</option></entry>
24037 <entry>HELO soft-checked for these hosts</entry>
24038 </row>
24039 <row>
24040 <entry><option>helo_verify_hosts</option></entry>
24041 <entry>HELO hard-checked for these hosts</entry>
24042 </row>
24043 <row>
24044 <entry><option>host_lookup</option></entry>
24045 <entry>host name looked up for these hosts</entry>
24046 </row>
24047 <row>
24048 <entry><option>host_lookup_order</option></entry>
24049 <entry>order of DNS and local name lookups</entry>
24050 </row>
24051 <row>
24052 <entry><option>hosts_proxy</option></entry>
24053 <entry>use proxy protocol for these hosts</entry>
24054 </row>
24055 <row>
24056 <entry><option>host_reject_connection</option></entry>
24057 <entry>reject connection from these hosts</entry>
24058 </row>
24059 <row>
24060 <entry><option>hosts_treat_as_local</option></entry>
24061 <entry>useful in some cluster configurations</entry>
24062 </row>
24063 <row>
24064 <entry><option>local_scan_timeout</option></entry>
24065 <entry>timeout for <function>local_scan()</function></entry>
24066 </row>
24067 <row>
24068 <entry><option>message_size_limit</option></entry>
24069 <entry>for all messages</entry>
24070 </row>
24071 <row>
24072 <entry><option>percent_hack_domains</option></entry>
24073 <entry>recognize %-hack for these domains</entry>
24074 </row>
24075 <row>
24076 <entry><option>proxy_protocol_timeout</option></entry>
24077 <entry>timeout for proxy protocol negotiation</entry>
24078 </row>
24079 <row>
24080 <entry><option>spamd_address</option></entry>
24081 <entry>set interface to SpamAssassin</entry>
24082 </row>
24083 <row>
24084 <entry><option>strict_acl_vars</option></entry>
24085 <entry>object to unset ACL variables</entry>
24086 </row>
24087 <row>
24088 <entry><option>spf_smtp_comment_template</option></entry>
24089 <entry>template for <varname>$spf_smtp_comment</varname></entry>
24090 </row>
24091 </tbody>
24092 </tgroup>
24093 </informaltable>
24094 </section>
24095 <section id="SECID107">
24096 <title>Callout cache</title>
24097 <informaltable frame="none">
24098 <tgroup cols="2" colsep="0" rowsep="0">
24099 <colspec colwidth="196pt" align="left"/>
24100 <colspec colwidth="254pt" align="left"/>
24101 <tbody>
24102 <row>
24103 <entry><option>callout_domain_negative_expire</option></entry>
24104 <entry>timeout for negative domain cache item</entry>
24105 </row>
24106 <row>
24107 <entry><option>callout_domain_positive_expire</option></entry>
24108 <entry>timeout for positive domain cache item</entry>
24109 </row>
24110 <row>
24111 <entry><option>callout_negative_expire</option></entry>
24112 <entry>timeout for negative address cache item</entry>
24113 </row>
24114 <row>
24115 <entry><option>callout_positive_expire</option></entry>
24116 <entry>timeout for positive address cache item</entry>
24117 </row>
24118 <row>
24119 <entry><option>callout_random_local_part</option></entry>
24120 <entry>string to use for <quote>random</quote> testing</entry>
24121 </row>
24122 </tbody>
24123 </tgroup>
24124 </informaltable>
24125 </section>
24126 <section id="SECID108">
24127 <title>TLS</title>
24128 <informaltable frame="none">
24129 <tgroup cols="2" colsep="0" rowsep="0">
24130 <colspec colwidth="196pt" align="left"/>
24131 <colspec colwidth="254pt" align="left"/>
24132 <tbody>
24133 <row>
24134 <entry><option>gnutls_compat_mode</option></entry>
24135 <entry>use GnuTLS compatibility mode</entry>
24136 </row>
24137 <row>
24138 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
24139 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
24140 </row>
24141 <row>
24142 <entry><option>hosts_require_alpn</option></entry>
24143 <entry>mandatory ALPN</entry>
24144 </row>
24145 <row>
24146 <entry><option>hosts_require_helo</option></entry>
24147 <entry>mandatory HELO/EHLO</entry>
24148 </row>
24149 <row>
24150 <entry><option>openssl_options</option></entry>
24151 <entry>adjust OpenSSL compatibility options</entry>
24152 </row>
24153 <row>
24154 <entry><option>tls_advertise_hosts</option></entry>
24155 <entry>advertise TLS to these hosts</entry>
24156 </row>
24157 <row>
24158 <entry><option>tls_alpn</option></entry>
24159 <entry>acceptable protocol names</entry>
24160 </row>
24161 <row>
24162 <entry><option>tls_certificate</option></entry>
24163 <entry>location of server certificate</entry>
24164 </row>
24165 <row>
24166 <entry><option>tls_crl</option></entry>
24167 <entry>certificate revocation list</entry>
24168 </row>
24169 <row>
24170 <entry><option>tls_dh_max_bits</option></entry>
24171 <entry>clamp D-H bit count suggestion</entry>
24172 </row>
24173 <row>
24174 <entry><option>tls_dhparam</option></entry>
24175 <entry>DH parameters for server</entry>
24176 </row>
24177 <row>
24178 <entry><option>tls_eccurve</option></entry>
24179 <entry>EC curve selection for server</entry>
24180 </row>
24181 <row>
24182 <entry><option>tls_ocsp_file</option></entry>
24183 <entry>location of server certificate status proof</entry>
24184 </row>
24185 <row>
24186 <entry><option>tls_on_connect_ports</option></entry>
24187 <entry>specify SSMTP (SMTPS) ports</entry>
24188 </row>
24189 <row>
24190 <entry><option>tls_privatekey</option></entry>
24191 <entry>location of server private key</entry>
24192 </row>
24193 <row>
24194 <entry><option>tls_remember_esmtp</option></entry>
24195 <entry>don&#x2019;t reset after starting TLS</entry>
24196 </row>
24197 <row>
24198 <entry><option>tls_require_ciphers</option></entry>
24199 <entry>specify acceptable ciphers</entry>
24200 </row>
24201 <row>
24202 <entry><option>tls_try_verify_hosts</option></entry>
24203 <entry>try to verify client certificate</entry>
24204 </row>
24205 <row>
24206 <entry><option>tls_verify_certificates</option></entry>
24207 <entry>expected client certificates</entry>
24208 </row>
24209 <row>
24210 <entry><option>tls_verify_hosts</option></entry>
24211 <entry>insist on client certificate verify</entry>
24212 </row>
24213 </tbody>
24214 </tgroup>
24215 </informaltable>
24216 </section>
24217 <section id="SECID109">
24218 <title>Local user handling</title>
24219 <informaltable frame="none">
24220 <tgroup cols="2" colsep="0" rowsep="0">
24221 <colspec colwidth="196pt" align="left"/>
24222 <colspec colwidth="254pt" align="left"/>
24223 <tbody>
24224 <row>
24225 <entry><option>finduser_retries</option></entry>
24226 <entry>useful in NIS environments</entry>
24227 </row>
24228 <row>
24229 <entry><option>gecos_name</option></entry>
24230 <entry>used when creating <emphasis>Sender:</emphasis></entry>
24231 </row>
24232 <row>
24233 <entry><option>gecos_pattern</option></entry>
24234 <entry>ditto</entry>
24235 </row>
24236 <row>
24237 <entry><option>max_username_length</option></entry>
24238 <entry>for systems that truncate</entry>
24239 </row>
24240 <row>
24241 <entry><option>unknown_login</option></entry>
24242 <entry>used when no login name found</entry>
24243 </row>
24244 <row>
24245 <entry><option>unknown_username</option></entry>
24246 <entry>ditto</entry>
24247 </row>
24248 <row>
24249 <entry><option>uucp_from_pattern</option></entry>
24250 <entry>for recognizing <quote>From </quote> lines</entry>
24251 </row>
24252 <row>
24253 <entry><option>uucp_from_sender</option></entry>
24254 <entry>ditto</entry>
24255 </row>
24256 </tbody>
24257 </tgroup>
24258 </informaltable>
24259 </section>
24260 <section id="SECID110">
24261 <title>All incoming messages (SMTP and non-SMTP)</title>
24262 <informaltable frame="none">
24263 <tgroup cols="2" colsep="0" rowsep="0">
24264 <colspec colwidth="196pt" align="left"/>
24265 <colspec colwidth="254pt" align="left"/>
24266 <tbody>
24267 <row>
24268 <entry><option>header_maxsize</option></entry>
24269 <entry>total size of message header</entry>
24270 </row>
24271 <row>
24272 <entry><option>header_line_maxsize</option></entry>
24273 <entry>individual header line limit</entry>
24274 </row>
24275 <row>
24276 <entry><option>message_size_limit</option></entry>
24277 <entry>applies to all messages</entry>
24278 </row>
24279 <row>
24280 <entry><option>percent_hack_domains</option></entry>
24281 <entry>recognize %-hack for these domains</entry>
24282 </row>
24283 <row>
24284 <entry><option>received_header_text</option></entry>
24285 <entry>expanded to make <emphasis>Received:</emphasis></entry>
24286 </row>
24287 <row>
24288 <entry><option>received_headers_max</option></entry>
24289 <entry>for mail loop detection</entry>
24290 </row>
24291 <row>
24292 <entry><option>recipients_max</option></entry>
24293 <entry>limit per message</entry>
24294 </row>
24295 <row>
24296 <entry><option>recipients_max_reject</option></entry>
24297 <entry>permanently reject excess recipients</entry>
24298 </row>
24299 </tbody>
24300 </tgroup>
24301 </informaltable>
24302 </section>
24303 <section id="SECID111">
24304 <title>Non-SMTP incoming messages</title>
24305 <informaltable frame="none">
24306 <tgroup cols="2" colsep="0" rowsep="0">
24307 <colspec colwidth="196pt" align="left"/>
24308 <colspec colwidth="254pt" align="left"/>
24309 <tbody>
24310 <row>
24311 <entry><option>receive_timeout</option></entry>
24312 <entry>for non-SMTP messages</entry>
24313 </row>
24314 </tbody>
24315 </tgroup>
24316 </informaltable>
24317 </section>
24318 <section id="SECID112">
24319 <title>Incoming SMTP messages</title>
24320 <para>
24321 See also the <emphasis>Policy controls</emphasis> section above.
24322 </para>
24323 <informaltable frame="none">
24324 <tgroup cols="2" colsep="0" rowsep="0">
24325 <colspec colwidth="196pt" align="left"/>
24326 <colspec colwidth="254pt" align="left"/>
24327 <tbody>
24328 <row>
24329 <entry><option>dkim_verify_hashes</option></entry>
24330 <entry>DKIM hash methods accepted for signatures</entry>
24331 </row>
24332 <row>
24333 <entry><option>dkim_verify_keytypes</option></entry>
24334 <entry>DKIM key types accepted for signatures</entry>
24335 </row>
24336 <row>
24337 <entry><option>dkim_verify_min_keysizes</option></entry>
24338 <entry>DKIM key sizes accepted for signatures</entry>
24339 </row>
24340 <row>
24341 <entry><option>dkim_verify_signers</option></entry>
24342 <entry>DKIM domains for which DKIM ACL is run</entry>
24343 </row>
24344 <row>
24345 <entry><option>dmarc_forensic_sender</option></entry>
24346 <entry>DMARC sender for report messages</entry>
24347 </row>
24348 <row>
24349 <entry><option>dmarc_history_file</option></entry>
24350 <entry>DMARC results log</entry>
24351 </row>
24352 <row>
24353 <entry><option>dmarc_tld_file</option></entry>
24354 <entry>DMARC toplevel domains file</entry>
24355 </row>
24356 <row>
24357 <entry><option>host_lookup</option></entry>
24358 <entry>host name looked up for these hosts</entry>
24359 </row>
24360 <row>
24361 <entry><option>host_lookup_order</option></entry>
24362 <entry>order of DNS and local name lookups</entry>
24363 </row>
24364 <row>
24365 <entry><option>recipient_unqualified_hosts</option></entry>
24366 <entry>may send unqualified recipients</entry>
24367 </row>
24368 <row>
24369 <entry><option>rfc1413_hosts</option></entry>
24370 <entry>make ident calls to these hosts</entry>
24371 </row>
24372 <row>
24373 <entry><option>rfc1413_query_timeout</option></entry>
24374 <entry>zero disables ident calls</entry>
24375 </row>
24376 <row>
24377 <entry><option>sender_unqualified_hosts</option></entry>
24378 <entry>may send unqualified senders</entry>
24379 </row>
24380 <row>
24381 <entry><option>smtp_accept_keepalive</option></entry>
24382 <entry>some TCP/IP magic</entry>
24383 </row>
24384 <row>
24385 <entry><option>smtp_accept_max</option></entry>
24386 <entry>simultaneous incoming connections</entry>
24387 </row>
24388 <row>
24389 <entry><option>smtp_accept_max_nonmail</option></entry>
24390 <entry>non-mail commands</entry>
24391 </row>
24392 <row>
24393 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
24394 <entry>hosts to which the limit applies</entry>
24395 </row>
24396 <row>
24397 <entry><option>smtp_accept_max_per_connection</option></entry>
24398 <entry>messages per connection</entry>
24399 </row>
24400 <row>
24401 <entry><option>smtp_accept_max_per_host</option></entry>
24402 <entry>connections from one host</entry>
24403 </row>
24404 <row>
24405 <entry><option>smtp_accept_queue</option></entry>
24406 <entry>queue mail if more connections</entry>
24407 </row>
24408 <row>
24409 <entry><option>smtp_accept_queue_per_connection</option></entry>
24410 <entry>queue if more messages per connection</entry>
24411 </row>
24412 <row>
24413 <entry><option>smtp_accept_reserve</option></entry>
24414 <entry>only reserve hosts if more connections</entry>
24415 </row>
24416 <row>
24417 <entry><option>smtp_active_hostname</option></entry>
24418 <entry>host name to use in messages</entry>
24419 </row>
24420 <row>
24421 <entry><option>smtp_banner</option></entry>
24422 <entry>text for welcome banner</entry>
24423 </row>
24424 <row>
24425 <entry><option>smtp_check_spool_space</option></entry>
24426 <entry>from SIZE on MAIL command</entry>
24427 </row>
24428 <row>
24429 <entry><option>smtp_connect_backlog</option></entry>
24430 <entry>passed to TCP/IP stack</entry>
24431 </row>
24432 <row>
24433 <entry><option>smtp_enforce_sync</option></entry>
24434 <entry>of SMTP command/responses</entry>
24435 </row>
24436 <row>
24437 <entry><option>smtp_etrn_command</option></entry>
24438 <entry>what to run for ETRN</entry>
24439 </row>
24440 <row>
24441 <entry><option>smtp_etrn_serialize</option></entry>
24442 <entry>only one at once</entry>
24443 </row>
24444 <row>
24445 <entry><option>smtp_load_reserve</option></entry>
24446 <entry>only reserve hosts if this load</entry>
24447 </row>
24448 <row>
24449 <entry><option>smtp_max_unknown_commands</option></entry>
24450 <entry>before dropping connection</entry>
24451 </row>
24452 <row>
24453 <entry><option>smtp_ratelimit_hosts</option></entry>
24454 <entry>apply ratelimiting to these hosts</entry>
24455 </row>
24456 <row>
24457 <entry><option>smtp_ratelimit_mail</option></entry>
24458 <entry>ratelimit for MAIL commands</entry>
24459 </row>
24460 <row>
24461 <entry><option>smtp_ratelimit_rcpt</option></entry>
24462 <entry>ratelimit for RCPT commands</entry>
24463 </row>
24464 <row>
24465 <entry><option>smtp_receive_timeout</option></entry>
24466 <entry>per command or data line</entry>
24467 </row>
24468 <row>
24469 <entry><option>smtp_reserve_hosts</option></entry>
24470 <entry>these are the reserve hosts</entry>
24471 </row>
24472 <row>
24473 <entry><option>smtp_return_error_details</option></entry>
24474 <entry>give detail on rejections</entry>
24475 </row>
24476 </tbody>
24477 </tgroup>
24478 </informaltable>
24479 </section>
24480 <section id="SECID113">
24481 <title>SMTP extensions</title>
24482 <informaltable frame="none">
24483 <tgroup cols="2" colsep="0" rowsep="0">
24484 <colspec colwidth="196pt" align="left"/>
24485 <colspec colwidth="254pt" align="left"/>
24486 <tbody>
24487 <row>
24488 <entry><option>accept_8bitmime</option></entry>
24489 <entry>advertise 8BITMIME</entry>
24490 </row>
24491 <row>
24492 <entry><option>auth_advertise_hosts</option></entry>
24493 <entry>advertise AUTH to these hosts</entry>
24494 </row>
24495 <row>
24496 <entry><option>chunking_advertise_hosts</option></entry>
24497 <entry>advertise CHUNKING to these hosts</entry>
24498 </row>
24499 <row>
24500 <entry><option>dsn_advertise_hosts</option></entry>
24501 <entry>advertise DSN extensions to these hosts</entry>
24502 </row>
24503 <row>
24504 <entry><option>ignore_fromline_hosts</option></entry>
24505 <entry>allow <quote>From </quote> from these hosts</entry>
24506 </row>
24507 <row>
24508 <entry><option>ignore_fromline_local</option></entry>
24509 <entry>allow <quote>From </quote> from local SMTP</entry>
24510 </row>
24511 <row>
24512 <entry><option>pipelining_advertise_hosts</option></entry>
24513 <entry>advertise pipelining to these hosts</entry>
24514 </row>
24515 <row>
24516 <entry><option>pipelining_connect_advertise_hosts</option></entry>
24517 <entry>advertise pipelining to these hosts</entry>
24518 </row>
24519 <row>
24520 <entry><option>prdr_enable</option></entry>
24521 <entry>advertise PRDR to all hosts</entry>
24522 </row>
24523 <row>
24524 <entry><option>smtputf8_advertise_hosts</option></entry>
24525 <entry>advertise SMTPUTF8 to these hosts</entry>
24526 </row>
24527 <row>
24528 <entry><option>tls_advertise_hosts</option></entry>
24529 <entry>advertise TLS to these hosts</entry>
24530 </row>
24531 </tbody>
24532 </tgroup>
24533 </informaltable>
24534 </section>
24535 <section id="SECID114">
24536 <title>Processing messages</title>
24537 <informaltable frame="none">
24538 <tgroup cols="2" colsep="0" rowsep="0">
24539 <colspec colwidth="196pt" align="left"/>
24540 <colspec colwidth="254pt" align="left"/>
24541 <tbody>
24542 <row>
24543 <entry><option>allow_domain_literals</option></entry>
24544 <entry>recognize domain literal syntax</entry>
24545 </row>
24546 <row>
24547 <entry><option>allow_mx_to_ip</option></entry>
24548 <entry>allow MX to point to IP address</entry>
24549 </row>
24550 <row>
24551 <entry><option>allow_utf8_domains</option></entry>
24552 <entry>in addresses</entry>
24553 </row>
24554 <row>
24555 <entry><option>check_rfc2047_length</option></entry>
24556 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
24557 </row>
24558 <row>
24559 <entry><option>delivery_date_remove</option></entry>
24560 <entry>from incoming messages</entry>
24561 </row>
24562 <row>
24563 <entry><option>envelope_to_remove</option></entry>
24564 <entry>from incoming messages</entry>
24565 </row>
24566 <row>
24567 <entry><option>extract_addresses_remove_arguments</option></entry>
24568 <entry>affects <option>-t</option> processing</entry>
24569 </row>
24570 <row>
24571 <entry><option>headers_charset</option></entry>
24572 <entry>default for translations</entry>
24573 </row>
24574 <row>
24575 <entry><option>qualify_domain</option></entry>
24576 <entry>default for senders</entry>
24577 </row>
24578 <row>
24579 <entry><option>qualify_recipient</option></entry>
24580 <entry>default for recipients</entry>
24581 </row>
24582 <row>
24583 <entry><option>return_path_remove</option></entry>
24584 <entry>from incoming messages</entry>
24585 </row>
24586 <row>
24587 <entry><option>strip_excess_angle_brackets</option></entry>
24588 <entry>in addresses</entry>
24589 </row>
24590 <row>
24591 <entry><option>strip_trailing_dot</option></entry>
24592 <entry>at end of addresses</entry>
24593 </row>
24594 <row>
24595 <entry><option>untrusted_set_sender</option></entry>
24596 <entry>untrusted can set envelope sender</entry>
24597 </row>
24598 </tbody>
24599 </tgroup>
24600 </informaltable>
24601 </section>
24602 <section id="SECID115">
24603 <title>System filter</title>
24604 <informaltable frame="none">
24605 <tgroup cols="2" colsep="0" rowsep="0">
24606 <colspec colwidth="196pt" align="left"/>
24607 <colspec colwidth="254pt" align="left"/>
24608 <tbody>
24609 <row>
24610 <entry><option>system_filter</option></entry>
24611 <entry>locate system filter</entry>
24612 </row>
24613 <row>
24614 <entry><option>system_filter_directory_transport</option></entry>
24615 <entry>transport for delivery to a directory</entry>
24616 </row>
24617 <row>
24618 <entry><option>system_filter_file_transport</option></entry>
24619 <entry>transport for delivery to a file</entry>
24620 </row>
24621 <row>
24622 <entry><option>system_filter_group</option></entry>
24623 <entry>group for filter running</entry>
24624 </row>
24625 <row>
24626 <entry><option>system_filter_pipe_transport</option></entry>
24627 <entry>transport for delivery to a pipe</entry>
24628 </row>
24629 <row>
24630 <entry><option>system_filter_reply_transport</option></entry>
24631 <entry>transport for autoreply delivery</entry>
24632 </row>
24633 <row>
24634 <entry><option>system_filter_user</option></entry>
24635 <entry>user for filter running</entry>
24636 </row>
24637 </tbody>
24638 </tgroup>
24639 </informaltable>
24640 </section>
24641 <section id="SECID116">
24642 <title>Routing and delivery</title>
24643 <informaltable frame="none">
24644 <tgroup cols="2" colsep="0" rowsep="0">
24645 <colspec colwidth="196pt" align="left"/>
24646 <colspec colwidth="254pt" align="left"/>
24647 <tbody>
24648 <row>
24649 <entry><option>disable_ipv6</option></entry>
24650 <entry>do no IPv6 processing</entry>
24651 </row>
24652 <row>
24653 <entry><option>dns_again_means_nonexist</option></entry>
24654 <entry>for broken domains</entry>
24655 </row>
24656 <row>
24657 <entry><option>dns_check_names_pattern</option></entry>
24658 <entry>pre-DNS syntax check</entry>
24659 </row>
24660 <row>
24661 <entry><option>dns_dnssec_ok</option></entry>
24662 <entry>parameter for resolver</entry>
24663 </row>
24664 <row>
24665 <entry><option>dns_ipv4_lookup</option></entry>
24666 <entry>only v4 lookup for these domains</entry>
24667 </row>
24668 <row>
24669 <entry><option>dns_retrans</option></entry>
24670 <entry>parameter for resolver</entry>
24671 </row>
24672 <row>
24673 <entry><option>dns_retry</option></entry>
24674 <entry>parameter for resolver</entry>
24675 </row>
24676 <row>
24677 <entry><option>dns_trust_aa</option></entry>
24678 <entry>DNS zones trusted as authentic</entry>
24679 </row>
24680 <row>
24681 <entry><option>dns_use_edns0</option></entry>
24682 <entry>parameter for resolver</entry>
24683 </row>
24684 <row>
24685 <entry><option>hold_domains</option></entry>
24686 <entry>hold delivery for these domains</entry>
24687 </row>
24688 <row>
24689 <entry><option>local_interfaces</option></entry>
24690 <entry>for routing checks</entry>
24691 </row>
24692 <row>
24693 <entry><option>queue_domains</option></entry>
24694 <entry>no immediate delivery for these</entry>
24695 </row>
24696 <row>
24697 <entry><option>queue_fast_ramp</option></entry>
24698 <entry>parallel delivery with 2-phase queue run</entry>
24699 </row>
24700 <row>
24701 <entry><option>queue_only</option></entry>
24702 <entry>no immediate delivery at all</entry>
24703 </row>
24704 <row>
24705 <entry><option>queue_only_file</option></entry>
24706 <entry>no immediate delivery if file exists</entry>
24707 </row>
24708 <row>
24709 <entry><option>queue_only_load</option></entry>
24710 <entry>no immediate delivery if load is high</entry>
24711 </row>
24712 <row>
24713 <entry><option>queue_only_load_latch</option></entry>
24714 <entry>don&#x2019;t re-evaluate load for each message</entry>
24715 </row>
24716 <row>
24717 <entry><option>queue_only_override</option></entry>
24718 <entry>allow command line to override</entry>
24719 </row>
24720 <row>
24721 <entry><option>queue_run_in_order</option></entry>
24722 <entry>order of arrival</entry>
24723 </row>
24724 <row>
24725 <entry><option>queue_run_max</option></entry>
24726 <entry>of simultaneous queue runners</entry>
24727 </row>
24728 <row>
24729 <entry><option>queue_smtp_domains</option></entry>
24730 <entry>no immediate SMTP delivery for these</entry>
24731 </row>
24732 <row>
24733 <entry><option>remote_max_parallel</option></entry>
24734 <entry>parallel SMTP delivery per message</entry>
24735 </row>
24736 <row>
24737 <entry><option>remote_sort_domains</option></entry>
24738 <entry>order of remote deliveries</entry>
24739 </row>
24740 <row>
24741 <entry><option>retry_data_expire</option></entry>
24742 <entry>timeout for retry data</entry>
24743 </row>
24744 <row>
24745 <entry><option>retry_interval_max</option></entry>
24746 <entry>safety net for retry rules</entry>
24747 </row>
24748 </tbody>
24749 </tgroup>
24750 </informaltable>
24751 </section>
24752 <section id="SECID117">
24753 <title>Bounce and warning messages</title>
24754 <informaltable frame="none">
24755 <tgroup cols="2" colsep="0" rowsep="0">
24756 <colspec colwidth="196pt" align="left"/>
24757 <colspec colwidth="254pt" align="left"/>
24758 <tbody>
24759 <row>
24760 <entry><option>bounce_message_file</option></entry>
24761 <entry>content of bounce</entry>
24762 </row>
24763 <row>
24764 <entry><option>bounce_message_text</option></entry>
24765 <entry>content of bounce</entry>
24766 </row>
24767 <row>
24768 <entry><option>bounce_return_body</option></entry>
24769 <entry>include body if returning message</entry>
24770 </row>
24771 <row>
24772 <entry><option>bounce_return_linesize_limit</option></entry>
24773 <entry>limit on returned message line length</entry>
24774 </row>
24775 <row>
24776 <entry><option>bounce_return_message</option></entry>
24777 <entry>include original message in bounce</entry>
24778 </row>
24779 <row>
24780 <entry><option>bounce_return_size_limit</option></entry>
24781 <entry>limit on returned message</entry>
24782 </row>
24783 <row>
24784 <entry><option>bounce_sender_authentication</option></entry>
24785 <entry>send authenticated sender with bounce</entry>
24786 </row>
24787 <row>
24788 <entry><option>dsn_from</option></entry>
24789 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
24790 </row>
24791 <row>
24792 <entry><option>errors_copy</option></entry>
24793 <entry>copy bounce messages</entry>
24794 </row>
24795 <row>
24796 <entry><option>errors_reply_to</option></entry>
24797 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
24798 </row>
24799 <row>
24800 <entry><option>delay_warning</option></entry>
24801 <entry>time schedule</entry>
24802 </row>
24803 <row>
24804 <entry><option>delay_warning_condition</option></entry>
24805 <entry>condition for warning messages</entry>
24806 </row>
24807 <row>
24808 <entry><option>ignore_bounce_errors_after</option></entry>
24809 <entry>discard undeliverable bounces</entry>
24810 </row>
24811 <row>
24812 <entry><option>smtp_return_error_details</option></entry>
24813 <entry>give detail on rejections</entry>
24814 </row>
24815 <row>
24816 <entry><option>warn_message_file</option></entry>
24817 <entry>content of warning message</entry>
24818 </row>
24819 </tbody>
24820 </tgroup>
24821 </informaltable>
24822 </section>
24823 <section id="SECTalomo">
24824 <title>Alphabetical list of main options</title>
24825 <para>
24826 Those options that undergo string expansion before use are marked with
24827 &dagger;.
24828 </para>
24829 <para>
24830 <indexterm role="option">
24831 <primary><option>accept_8bitmime</option></primary>
24832 </indexterm>
24833 </para>
24834 <informaltable frame="all">
24835 <tgroup cols="4" colsep="0" rowsep="0">
24836 <colspec colwidth="8*" align="left"/>
24837 <colspec colwidth="6*" align="center"/>
24838 <colspec colwidth="6*" align="center"/>
24839 <colspec colwidth="6*" align="right"/>
24840 <tbody>
24841 <row>
24842 <entry><option>accept_8bitmime</option></entry>
24843 <entry>Use: <emphasis>main</emphasis></entry>
24844 <entry>Type: <emphasis>boolean</emphasis></entry>
24845 <entry>Default: <emphasis>true</emphasis></entry>
24846 </row>
24847 </tbody>
24848 </tgroup>
24849 </informaltable>
24850 <para>
24851 <indexterm role="concept">
24852 <primary>8BITMIME</primary>
24853 </indexterm>
24854 <indexterm role="concept">
24855 <primary>8-bit characters</primary>
24856 </indexterm>
24857 <indexterm role="concept">
24858 <primary>log</primary>
24859 <secondary>selectors</secondary>
24860 </indexterm>
24861 <indexterm role="concept">
24862 <primary>log</primary>
24863 <secondary>8BITMIME</secondary>
24864 </indexterm>
24865 <indexterm role="concept">
24866 <primary>ESMTP extensions</primary>
24867 <secondary>8BITMIME</secondary>
24868 </indexterm>
24869 This option causes Exim to send 8BITMIME in its response to an SMTP
24870 EHLO command, and to accept the BODY= parameter on MAIL commands.
24871 However, though Exim is 8-bit clean, it is not a protocol converter, and it
24872 takes no steps to do anything special with messages received by this route.
24873 </para>
24874 <para>
24875 Historically Exim kept this option off by default, but the maintainers
24876 feel that in today&#x2019;s Internet, this causes more problems than it solves.
24877 It now defaults to true.
24878 A more detailed analysis of the issues is provided by Dan Bernstein:
24879 </para>
24880 <literallayout>
24881 <emphasis role="bold"><ulink url="https://cr.yp.to/smtp/8bitmime.html">https://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
24882 </literallayout>
24883 <para>
24884 To log received 8BITMIME status use
24885 </para>
24886 <literallayout class="monospaced">
24887 log_selector = +8bitmime
24888 </literallayout>
24889 <para>
24890 <indexterm role="option">
24891 <primary><option>acl_not_smtp</option></primary>
24892 </indexterm>
24893 </para>
24894 <informaltable frame="all">
24895 <tgroup cols="4" colsep="0" rowsep="0">
24896 <colspec colwidth="8*" align="left"/>
24897 <colspec colwidth="6*" align="center"/>
24898 <colspec colwidth="6*" align="center"/>
24899 <colspec colwidth="6*" align="right"/>
24900 <tbody>
24901 <row>
24902 <entry><option>acl_not_smtp</option></entry>
24903 <entry>Use: <emphasis>main</emphasis></entry>
24904 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24905 <entry>Default: <emphasis>unset</emphasis></entry>
24906 </row>
24907 </tbody>
24908 </tgroup>
24909 </informaltable>
24910 <para>
24911 <indexterm role="concept">
24912 <primary>access control lists (ACLs)</primary>
24913 <secondary>for non-SMTP messages</secondary>
24914 </indexterm>
24915 <indexterm role="concept">
24916 <primary>non-SMTP messages</primary>
24917 <secondary>ACLs for</secondary>
24918 </indexterm>
24919 This option defines the ACL that is run when a non-SMTP message has been
24920 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
24921 further details.
24922 </para>
24923 <para>
24924 <indexterm role="option">
24925 <primary><option>acl_not_smtp_mime</option></primary>
24926 </indexterm>
24927 </para>
24928 <informaltable frame="all">
24929 <tgroup cols="4" colsep="0" rowsep="0">
24930 <colspec colwidth="8*" align="left"/>
24931 <colspec colwidth="6*" align="center"/>
24932 <colspec colwidth="6*" align="center"/>
24933 <colspec colwidth="6*" align="right"/>
24934 <tbody>
24935 <row>
24936 <entry><option>acl_not_smtp_mime</option></entry>
24937 <entry>Use: <emphasis>main</emphasis></entry>
24938 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24939 <entry>Default: <emphasis>unset</emphasis></entry>
24940 </row>
24941 </tbody>
24942 </tgroup>
24943 </informaltable>
24944 <para>
24945 This option defines the ACL that is run for individual MIME parts of non-SMTP
24946 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
24947 SMTP messages.
24948 </para>
24949 <para>
24950 <indexterm role="option">
24951 <primary><option>acl_not_smtp_start</option></primary>
24952 </indexterm>
24953 </para>
24954 <informaltable frame="all">
24955 <tgroup cols="4" colsep="0" rowsep="0">
24956 <colspec colwidth="8*" align="left"/>
24957 <colspec colwidth="6*" align="center"/>
24958 <colspec colwidth="6*" align="center"/>
24959 <colspec colwidth="6*" align="right"/>
24960 <tbody>
24961 <row>
24962 <entry><option>acl_not_smtp_start</option></entry>
24963 <entry>Use: <emphasis>main</emphasis></entry>
24964 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24965 <entry>Default: <emphasis>unset</emphasis></entry>
24966 </row>
24967 </tbody>
24968 </tgroup>
24969 </informaltable>
24970 <para>
24971 <indexterm role="concept">
24972 <primary>access control lists (ACLs)</primary>
24973 <secondary>at start of non-SMTP message</secondary>
24974 </indexterm>
24975 <indexterm role="concept">
24976 <primary>non-SMTP messages</primary>
24977 <secondary>ACLs for</secondary>
24978 </indexterm>
24979 This option defines the ACL that is run before Exim starts reading a
24980 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
24981 </para>
24982 <para>
24983 <indexterm role="option">
24984 <primary><option>acl_smtp_auth</option></primary>
24985 </indexterm>
24986 </para>
24987 <informaltable frame="all">
24988 <tgroup cols="4" colsep="0" rowsep="0">
24989 <colspec colwidth="8*" align="left"/>
24990 <colspec colwidth="6*" align="center"/>
24991 <colspec colwidth="6*" align="center"/>
24992 <colspec colwidth="6*" align="right"/>
24993 <tbody>
24994 <row>
24995 <entry><option>acl_smtp_auth</option></entry>
24996 <entry>Use: <emphasis>main</emphasis></entry>
24997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24998 <entry>Default: <emphasis>unset</emphasis></entry>
24999 </row>
25000 </tbody>
25001 </tgroup>
25002 </informaltable>
25003 <para>
25004 <indexterm role="concept">
25005 <primary>access control lists (ACLs)</primary>
25006 <secondary>setting up for SMTP commands</secondary>
25007 </indexterm>
25008 <indexterm role="concept">
25009 <primary>AUTH</primary>
25010 <secondary>ACL for</secondary>
25011 </indexterm>
25012 This option defines the ACL that is run when an SMTP AUTH command is
25013 received. See chapter <xref linkend="CHAPACL"/> for further details.
25014 </para>
25015 <para>
25016 <indexterm role="option">
25017 <primary><option>acl_smtp_connect</option></primary>
25018 </indexterm>
25019 </para>
25020 <informaltable frame="all">
25021 <tgroup cols="4" colsep="0" rowsep="0">
25022 <colspec colwidth="8*" align="left"/>
25023 <colspec colwidth="6*" align="center"/>
25024 <colspec colwidth="6*" align="center"/>
25025 <colspec colwidth="6*" align="right"/>
25026 <tbody>
25027 <row>
25028 <entry><option>acl_smtp_connect</option></entry>
25029 <entry>Use: <emphasis>main</emphasis></entry>
25030 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25031 <entry>Default: <emphasis>unset</emphasis></entry>
25032 </row>
25033 </tbody>
25034 </tgroup>
25035 </informaltable>
25036 <para>
25037 <indexterm role="concept">
25038 <primary>access control lists (ACLs)</primary>
25039 <secondary>on SMTP connection</secondary>
25040 </indexterm>
25041 This option defines the ACL that is run when an SMTP connection is received.
25042 See chapter <xref linkend="CHAPACL"/> for further details.
25043 </para>
25044 <para>
25045 <indexterm role="option">
25046 <primary><option>acl_smtp_data</option></primary>
25047 </indexterm>
25048 </para>
25049 <informaltable frame="all">
25050 <tgroup cols="4" colsep="0" rowsep="0">
25051 <colspec colwidth="8*" align="left"/>
25052 <colspec colwidth="6*" align="center"/>
25053 <colspec colwidth="6*" align="center"/>
25054 <colspec colwidth="6*" align="right"/>
25055 <tbody>
25056 <row>
25057 <entry><option>acl_smtp_data</option></entry>
25058 <entry>Use: <emphasis>main</emphasis></entry>
25059 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25060 <entry>Default: <emphasis>unset</emphasis></entry>
25061 </row>
25062 </tbody>
25063 </tgroup>
25064 </informaltable>
25065 <para>
25066 <indexterm role="concept">
25067 <primary>DATA</primary>
25068 <secondary>ACL for</secondary>
25069 </indexterm>
25070 This option defines the ACL that is run after an SMTP DATA command has been
25071 processed and the message itself has been received, but before the final
25072 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
25073 </para>
25074 <para>
25075 <indexterm role="option">
25076 <primary><option>acl_smtp_data_prdr</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>acl_smtp_data_prdr</option></entry>
25088 <entry>Use: <emphasis>main</emphasis></entry>
25089 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25090 <entry>Default: <emphasis>accept</emphasis></entry>
25091 </row>
25092 </tbody>
25093 </tgroup>
25094 </informaltable>
25095 <para>
25096 <indexterm role="concept">
25097 <primary>PRDR</primary>
25098 <secondary>ACL for</secondary>
25099 </indexterm>
25100 <indexterm role="concept">
25101 <primary>DATA</primary>
25102 <secondary>PRDR ACL for</secondary>
25103 </indexterm>
25104 <indexterm role="concept">
25105 <primary>access control lists (ACLs)</primary>
25106 <secondary>PRDR-related</secondary>
25107 </indexterm>
25108 <indexterm role="concept">
25109 <primary>access control lists (ACLs)</primary>
25110 <secondary>per-user data processing</secondary>
25111 </indexterm>
25112 This option defines the ACL that,
25113 if the PRDR feature has been negotiated,
25114 is run for each recipient after an SMTP DATA command has been
25115 processed and the message itself has been received, but before the
25116 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
25117 </para>
25118 <para>
25119 <indexterm role="option">
25120 <primary><option>acl_smtp_dkim</option></primary>
25121 </indexterm>
25122 </para>
25123 <informaltable frame="all">
25124 <tgroup cols="4" colsep="0" rowsep="0">
25125 <colspec colwidth="8*" align="left"/>
25126 <colspec colwidth="6*" align="center"/>
25127 <colspec colwidth="6*" align="center"/>
25128 <colspec colwidth="6*" align="right"/>
25129 <tbody>
25130 <row>
25131 <entry><option>acl_smtp_dkim</option></entry>
25132 <entry>Use: <emphasis>main</emphasis></entry>
25133 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25134 <entry>Default: <emphasis>unset</emphasis></entry>
25135 </row>
25136 </tbody>
25137 </tgroup>
25138 </informaltable>
25139 <para>
25140 <indexterm role="concept">
25141 <primary>DKIM</primary>
25142 <secondary>ACL for</secondary>
25143 </indexterm>
25144 This option defines the ACL that is run for each DKIM signature
25145 (by default, or as specified in the dkim_verify_signers option)
25146 of a received message.
25147 See section <xref linkend="SECDKIMVFY"/> for further details.
25148 </para>
25149 <para>
25150 <indexterm role="option">
25151 <primary><option>acl_smtp_etrn</option></primary>
25152 </indexterm>
25153 </para>
25154 <informaltable frame="all">
25155 <tgroup cols="4" colsep="0" rowsep="0">
25156 <colspec colwidth="8*" align="left"/>
25157 <colspec colwidth="6*" align="center"/>
25158 <colspec colwidth="6*" align="center"/>
25159 <colspec colwidth="6*" align="right"/>
25160 <tbody>
25161 <row>
25162 <entry><option>acl_smtp_etrn</option></entry>
25163 <entry>Use: <emphasis>main</emphasis></entry>
25164 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25165 <entry>Default: <emphasis>unset</emphasis></entry>
25166 </row>
25167 </tbody>
25168 </tgroup>
25169 </informaltable>
25170 <para>
25171 <indexterm role="concept">
25172 <primary>ETRN</primary>
25173 <secondary>ACL for</secondary>
25174 </indexterm>
25175 This option defines the ACL that is run when an SMTP ETRN command is
25176 received. See chapter <xref linkend="CHAPACL"/> for further details.
25177 </para>
25178 <para>
25179 <indexterm role="option">
25180 <primary><option>acl_smtp_expn</option></primary>
25181 </indexterm>
25182 </para>
25183 <informaltable frame="all">
25184 <tgroup cols="4" colsep="0" rowsep="0">
25185 <colspec colwidth="8*" align="left"/>
25186 <colspec colwidth="6*" align="center"/>
25187 <colspec colwidth="6*" align="center"/>
25188 <colspec colwidth="6*" align="right"/>
25189 <tbody>
25190 <row>
25191 <entry><option>acl_smtp_expn</option></entry>
25192 <entry>Use: <emphasis>main</emphasis></entry>
25193 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25194 <entry>Default: <emphasis>unset</emphasis></entry>
25195 </row>
25196 </tbody>
25197 </tgroup>
25198 </informaltable>
25199 <para>
25200 <indexterm role="concept">
25201 <primary>EXPN</primary>
25202 <secondary>ACL for</secondary>
25203 </indexterm>
25204 This option defines the ACL that is run when an SMTP EXPN command is
25205 received. See chapter <xref linkend="CHAPACL"/> for further details.
25206 </para>
25207 <para>
25208 <indexterm role="option">
25209 <primary><option>acl_smtp_helo</option></primary>
25210 </indexterm>
25211 </para>
25212 <informaltable frame="all">
25213 <tgroup cols="4" colsep="0" rowsep="0">
25214 <colspec colwidth="8*" align="left"/>
25215 <colspec colwidth="6*" align="center"/>
25216 <colspec colwidth="6*" align="center"/>
25217 <colspec colwidth="6*" align="right"/>
25218 <tbody>
25219 <row>
25220 <entry><option>acl_smtp_helo</option></entry>
25221 <entry>Use: <emphasis>main</emphasis></entry>
25222 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25223 <entry>Default: <emphasis>unset</emphasis></entry>
25224 </row>
25225 </tbody>
25226 </tgroup>
25227 </informaltable>
25228 <para>
25229 <indexterm role="concept">
25230 <primary>EHLO</primary>
25231 <secondary>ACL for</secondary>
25232 </indexterm>
25233 <indexterm role="concept">
25234 <primary>HELO</primary>
25235 <secondary>ACL for</secondary>
25236 </indexterm>
25237 This option defines the ACL that is run when an SMTP EHLO or HELO
25238 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
25239 </para>
25240 <para>
25241 <indexterm role="option">
25242 <primary><option>acl_smtp_mail</option></primary>
25243 </indexterm>
25244 </para>
25245 <informaltable frame="all">
25246 <tgroup cols="4" colsep="0" rowsep="0">
25247 <colspec colwidth="8*" align="left"/>
25248 <colspec colwidth="6*" align="center"/>
25249 <colspec colwidth="6*" align="center"/>
25250 <colspec colwidth="6*" align="right"/>
25251 <tbody>
25252 <row>
25253 <entry><option>acl_smtp_mail</option></entry>
25254 <entry>Use: <emphasis>main</emphasis></entry>
25255 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25256 <entry>Default: <emphasis>unset</emphasis></entry>
25257 </row>
25258 </tbody>
25259 </tgroup>
25260 </informaltable>
25261 <para>
25262 <indexterm role="concept">
25263 <primary>MAIL</primary>
25264 <secondary>ACL for</secondary>
25265 </indexterm>
25266 This option defines the ACL that is run when an SMTP MAIL command is
25267 received. See chapter <xref linkend="CHAPACL"/> for further details.
25268 </para>
25269 <para>
25270 <indexterm role="option">
25271 <primary><option>acl_smtp_mailauth</option></primary>
25272 </indexterm>
25273 </para>
25274 <informaltable frame="all">
25275 <tgroup cols="4" colsep="0" rowsep="0">
25276 <colspec colwidth="8*" align="left"/>
25277 <colspec colwidth="6*" align="center"/>
25278 <colspec colwidth="6*" align="center"/>
25279 <colspec colwidth="6*" align="right"/>
25280 <tbody>
25281 <row>
25282 <entry><option>acl_smtp_mailauth</option></entry>
25283 <entry>Use: <emphasis>main</emphasis></entry>
25284 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25285 <entry>Default: <emphasis>unset</emphasis></entry>
25286 </row>
25287 </tbody>
25288 </tgroup>
25289 </informaltable>
25290 <para>
25291 <indexterm role="concept">
25292 <primary>AUTH</primary>
25293 <secondary>on MAIL command</secondary>
25294 </indexterm>
25295 This option defines the ACL that is run when there is an AUTH parameter on
25296 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
25297 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
25298 </para>
25299 <para>
25300 <indexterm role="option">
25301 <primary><option>acl_smtp_mime</option></primary>
25302 </indexterm>
25303 </para>
25304 <informaltable frame="all">
25305 <tgroup cols="4" colsep="0" rowsep="0">
25306 <colspec colwidth="8*" align="left"/>
25307 <colspec colwidth="6*" align="center"/>
25308 <colspec colwidth="6*" align="center"/>
25309 <colspec colwidth="6*" align="right"/>
25310 <tbody>
25311 <row>
25312 <entry><option>acl_smtp_mime</option></entry>
25313 <entry>Use: <emphasis>main</emphasis></entry>
25314 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25315 <entry>Default: <emphasis>unset</emphasis></entry>
25316 </row>
25317 </tbody>
25318 </tgroup>
25319 </informaltable>
25320 <para>
25321 <indexterm role="concept">
25322 <primary>MIME content scanning</primary>
25323 <secondary>ACL for</secondary>
25324 </indexterm>
25325 This option is available when Exim is built with the content-scanning
25326 extension. It defines the ACL that is run for each MIME part in a message. See
25327 section <xref linkend="SECTscanmimepart"/> for details.
25328 </para>
25329 <para>
25330 <indexterm role="option">
25331 <primary><option>acl_smtp_notquit</option></primary>
25332 </indexterm>
25333 </para>
25334 <informaltable frame="all">
25335 <tgroup cols="4" colsep="0" rowsep="0">
25336 <colspec colwidth="8*" align="left"/>
25337 <colspec colwidth="6*" align="center"/>
25338 <colspec colwidth="6*" align="center"/>
25339 <colspec colwidth="6*" align="right"/>
25340 <tbody>
25341 <row>
25342 <entry><option>acl_smtp_notquit</option></entry>
25343 <entry>Use: <emphasis>main</emphasis></entry>
25344 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25345 <entry>Default: <emphasis>unset</emphasis></entry>
25346 </row>
25347 </tbody>
25348 </tgroup>
25349 </informaltable>
25350 <para>
25351 <indexterm role="concept">
25352 <primary>not-QUIT, ACL for</primary>
25353 </indexterm>
25354 This option defines the ACL that is run when an SMTP session
25355 ends without a QUIT command being received.
25356 See chapter <xref linkend="CHAPACL"/> for further details.
25357 </para>
25358 <para>
25359 <indexterm role="option">
25360 <primary><option>acl_smtp_predata</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>acl_smtp_predata</option></entry>
25372 <entry>Use: <emphasis>main</emphasis></entry>
25373 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25374 <entry>Default: <emphasis>unset</emphasis></entry>
25375 </row>
25376 </tbody>
25377 </tgroup>
25378 </informaltable>
25379 <para>
25380 This option defines the ACL that is run when an SMTP DATA command is
25381 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
25382 further details.
25383 </para>
25384 <para>
25385 <indexterm role="option">
25386 <primary><option>acl_smtp_quit</option></primary>
25387 </indexterm>
25388 </para>
25389 <informaltable frame="all">
25390 <tgroup cols="4" colsep="0" rowsep="0">
25391 <colspec colwidth="8*" align="left"/>
25392 <colspec colwidth="6*" align="center"/>
25393 <colspec colwidth="6*" align="center"/>
25394 <colspec colwidth="6*" align="right"/>
25395 <tbody>
25396 <row>
25397 <entry><option>acl_smtp_quit</option></entry>
25398 <entry>Use: <emphasis>main</emphasis></entry>
25399 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25400 <entry>Default: <emphasis>unset</emphasis></entry>
25401 </row>
25402 </tbody>
25403 </tgroup>
25404 </informaltable>
25405 <para>
25406 <indexterm role="concept">
25407 <primary>QUIT, ACL for</primary>
25408 </indexterm>
25409 This option defines the ACL that is run when an SMTP QUIT command is
25410 received. See chapter <xref linkend="CHAPACL"/> for further details.
25411 </para>
25412 <para>
25413 <indexterm role="option">
25414 <primary><option>acl_smtp_rcpt</option></primary>
25415 </indexterm>
25416 </para>
25417 <informaltable frame="all">
25418 <tgroup cols="4" colsep="0" rowsep="0">
25419 <colspec colwidth="8*" align="left"/>
25420 <colspec colwidth="6*" align="center"/>
25421 <colspec colwidth="6*" align="center"/>
25422 <colspec colwidth="6*" align="right"/>
25423 <tbody>
25424 <row>
25425 <entry><option>acl_smtp_rcpt</option></entry>
25426 <entry>Use: <emphasis>main</emphasis></entry>
25427 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25428 <entry>Default: <emphasis>unset</emphasis></entry>
25429 </row>
25430 </tbody>
25431 </tgroup>
25432 </informaltable>
25433 <para>
25434 <indexterm role="concept">
25435 <primary>RCPT</primary>
25436 <secondary>ACL for</secondary>
25437 </indexterm>
25438 This option defines the ACL that is run when an SMTP RCPT command is
25439 received. See chapter <xref linkend="CHAPACL"/> for further details.
25440 </para>
25441 <para>
25442 <indexterm role="option">
25443 <primary><option>acl_smtp_starttls</option></primary>
25444 </indexterm>
25445 </para>
25446 <informaltable frame="all">
25447 <tgroup cols="4" colsep="0" rowsep="0">
25448 <colspec colwidth="8*" align="left"/>
25449 <colspec colwidth="6*" align="center"/>
25450 <colspec colwidth="6*" align="center"/>
25451 <colspec colwidth="6*" align="right"/>
25452 <tbody>
25453 <row>
25454 <entry><option>acl_smtp_starttls</option></entry>
25455 <entry>Use: <emphasis>main</emphasis></entry>
25456 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25457 <entry>Default: <emphasis>unset</emphasis></entry>
25458 </row>
25459 </tbody>
25460 </tgroup>
25461 </informaltable>
25462 <para>
25463 <indexterm role="concept">
25464 <primary>STARTTLS, ACL for</primary>
25465 </indexterm>
25466 This option defines the ACL that is run when an SMTP STARTTLS command is
25467 received. See chapter <xref linkend="CHAPACL"/> for further details.
25468 </para>
25469 <para>
25470 <indexterm role="option">
25471 <primary><option>acl_smtp_vrfy</option></primary>
25472 </indexterm>
25473 </para>
25474 <informaltable frame="all">
25475 <tgroup cols="4" colsep="0" rowsep="0">
25476 <colspec colwidth="8*" align="left"/>
25477 <colspec colwidth="6*" align="center"/>
25478 <colspec colwidth="6*" align="center"/>
25479 <colspec colwidth="6*" align="right"/>
25480 <tbody>
25481 <row>
25482 <entry><option>acl_smtp_vrfy</option></entry>
25483 <entry>Use: <emphasis>main</emphasis></entry>
25484 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25485 <entry>Default: <emphasis>unset</emphasis></entry>
25486 </row>
25487 </tbody>
25488 </tgroup>
25489 </informaltable>
25490 <para>
25491 <indexterm role="concept">
25492 <primary>VRFY</primary>
25493 <secondary>ACL for</secondary>
25494 </indexterm>
25495 This option defines the ACL that is run when an SMTP VRFY command is
25496 received. See chapter <xref linkend="CHAPACL"/> for further details.
25497 </para>
25498 <para>
25499 <indexterm role="option">
25500 <primary><option>add_environment</option></primary>
25501 </indexterm>
25502 </para>
25503 <informaltable frame="all">
25504 <tgroup cols="4" colsep="0" rowsep="0">
25505 <colspec colwidth="8*" align="left"/>
25506 <colspec colwidth="6*" align="center"/>
25507 <colspec colwidth="6*" align="center"/>
25508 <colspec colwidth="6*" align="right"/>
25509 <tbody>
25510 <row>
25511 <entry><option>add_environment</option></entry>
25512 <entry>Use: <emphasis>main</emphasis></entry>
25513 <entry>Type: <emphasis>string list</emphasis></entry>
25514 <entry>Default: <emphasis>empty</emphasis></entry>
25515 </row>
25516 </tbody>
25517 </tgroup>
25518 </informaltable>
25519 <para>
25520 <indexterm role="concept">
25521 <primary>environment</primary>
25522 <secondary>set values</secondary>
25523 </indexterm>
25524 This option adds individual environment variables that the
25525 currently linked libraries and programs in child processes may use.
25526 Each list element should be of the form <quote>name=value</quote>.
25527 </para>
25528 <para>
25529 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
25530 </para>
25531 <para>
25532 <indexterm role="option">
25533 <primary><option>admin_groups</option></primary>
25534 </indexterm>
25535 </para>
25536 <informaltable frame="all">
25537 <tgroup cols="4" colsep="0" rowsep="0">
25538 <colspec colwidth="8*" align="left"/>
25539 <colspec colwidth="6*" align="center"/>
25540 <colspec colwidth="6*" align="center"/>
25541 <colspec colwidth="6*" align="right"/>
25542 <tbody>
25543 <row>
25544 <entry><option>admin_groups</option></entry>
25545 <entry>Use: <emphasis>main</emphasis></entry>
25546 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25547 <entry>Default: <emphasis>unset</emphasis></entry>
25548 </row>
25549 </tbody>
25550 </tgroup>
25551 </informaltable>
25552 <para>
25553 <indexterm role="concept">
25554 <primary>admin user</primary>
25555 </indexterm>
25556 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
25557 current group or any of the supplementary groups of an Exim caller is in this
25558 colon-separated list, the caller has admin privileges. If all your system
25559 programmers are in a specific group, for example, you can give them all Exim
25560 admin privileges by putting that group in <option>admin_groups</option>. However, this does
25561 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
25562 To permit this, you have to add individuals to the Exim group.
25563 </para>
25564 <para>
25565 <indexterm role="option">
25566 <primary><option>allow_domain_literals</option></primary>
25567 </indexterm>
25568 </para>
25569 <informaltable frame="all">
25570 <tgroup cols="4" colsep="0" rowsep="0">
25571 <colspec colwidth="8*" align="left"/>
25572 <colspec colwidth="6*" align="center"/>
25573 <colspec colwidth="6*" align="center"/>
25574 <colspec colwidth="6*" align="right"/>
25575 <tbody>
25576 <row>
25577 <entry><option>allow_domain_literals</option></entry>
25578 <entry>Use: <emphasis>main</emphasis></entry>
25579 <entry>Type: <emphasis>boolean</emphasis></entry>
25580 <entry>Default: <emphasis>false</emphasis></entry>
25581 </row>
25582 </tbody>
25583 </tgroup>
25584 </informaltable>
25585 <para>
25586 <indexterm role="concept">
25587 <primary>domain literal</primary>
25588 </indexterm>
25589 If this option is set, the RFC 2822 domain literal format is permitted in
25590 email addresses. The option is not set by default, because the domain literal
25591 format is not normally required these days, and few people know about it. It
25592 has, however, been exploited by mail abusers.
25593 </para>
25594 <para>
25595 Unfortunately, it seems that some DNS black list maintainers are using this
25596 format to report black listing to postmasters. If you want to accept messages
25597 addressed to your hosts by IP address, you need to set
25598 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
25599 domains (defined in the named domain list <option>local_domains</option> in the default
25600 configuration). This <quote>magic string</quote> matches the domain literal form of all
25601 the local host&#x2019;s IP addresses.
25602 </para>
25603 <para>
25604 <indexterm role="option">
25605 <primary><option>allow_mx_to_ip</option></primary>
25606 </indexterm>
25607 </para>
25608 <informaltable frame="all">
25609 <tgroup cols="4" colsep="0" rowsep="0">
25610 <colspec colwidth="8*" align="left"/>
25611 <colspec colwidth="6*" align="center"/>
25612 <colspec colwidth="6*" align="center"/>
25613 <colspec colwidth="6*" align="right"/>
25614 <tbody>
25615 <row>
25616 <entry><option>allow_mx_to_ip</option></entry>
25617 <entry>Use: <emphasis>main</emphasis></entry>
25618 <entry>Type: <emphasis>boolean</emphasis></entry>
25619 <entry>Default: <emphasis>false</emphasis></entry>
25620 </row>
25621 </tbody>
25622 </tgroup>
25623 </informaltable>
25624 <para>
25625 <indexterm role="concept">
25626 <primary>MX record</primary>
25627 <secondary>pointing to IP address</secondary>
25628 </indexterm>
25629 It appears that more and more DNS zone administrators are breaking the rules
25630 and putting domain names that look like IP addresses on the right hand side of
25631 MX records. Exim follows the rules and rejects this, giving an error message
25632 that explains the misconfiguration. However, some other MTAs support this
25633 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
25634 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
25635 recommended, except when you have no other choice.
25636 </para>
25637 <para>
25638 <indexterm role="option">
25639 <primary><option>allow_utf8_domains</option></primary>
25640 </indexterm>
25641 </para>
25642 <informaltable frame="all">
25643 <tgroup cols="4" colsep="0" rowsep="0">
25644 <colspec colwidth="8*" align="left"/>
25645 <colspec colwidth="6*" align="center"/>
25646 <colspec colwidth="6*" align="center"/>
25647 <colspec colwidth="6*" align="right"/>
25648 <tbody>
25649 <row>
25650 <entry><option>allow_utf8_domains</option></entry>
25651 <entry>Use: <emphasis>main</emphasis></entry>
25652 <entry>Type: <emphasis>boolean</emphasis></entry>
25653 <entry>Default: <emphasis>false</emphasis></entry>
25654 </row>
25655 </tbody>
25656 </tgroup>
25657 </informaltable>
25658 <para>
25659 <indexterm role="concept">
25660 <primary>domain</primary>
25661 <secondary>UTF-8 characters in</secondary>
25662 </indexterm>
25663 <indexterm role="concept">
25664 <primary>UTF-8</primary>
25665 <secondary>in domain name</secondary>
25666 </indexterm>
25667 Lots of discussion is going on about internationalized domain names. One
25668 camp is strongly in favour of just using UTF-8 characters, and it seems
25669 that at least two other MTAs permit this.
25670 This option allows Exim users to experiment if they wish.
25671 </para>
25672 <para>
25673 If it is set true, Exim&#x2019;s domain parsing function allows valid
25674 UTF-8 multicharacters to appear in domain name components, in addition to
25675 letters, digits, and hyphens.
25676 </para>
25677 <para>
25678 If Exim is built with internationalization support
25679 and the SMTPUTF8 ESMTP option is in use (see chapter <xref linkend="CHAPi18n"/>)
25680 this option can be left as default.
25681 Without that,
25682 if you want to look up such domain names in the DNS, you must also
25683 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
25684 suitable setting is:
25685 </para>
25686 <literallayout class="monospaced">
25687 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
25688   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
25689 </literallayout>
25690 <para>
25691 Alternatively, you can just disable this feature by setting
25692 </para>
25693 <literallayout class="monospaced">
25694 dns_check_names_pattern =
25695 </literallayout>
25696 <para>
25697 That is, set the option to an empty string so that no check is done.
25698 </para>
25699 <para>
25700 <indexterm role="option">
25701 <primary><option>auth_advertise_hosts</option></primary>
25702 </indexterm>
25703 </para>
25704 <informaltable frame="all">
25705 <tgroup cols="4" colsep="0" rowsep="0">
25706 <colspec colwidth="8*" align="left"/>
25707 <colspec colwidth="6*" align="center"/>
25708 <colspec colwidth="6*" align="center"/>
25709 <colspec colwidth="6*" align="right"/>
25710 <tbody>
25711 <row>
25712 <entry><option>auth_advertise_hosts</option></entry>
25713 <entry>Use: <emphasis>main</emphasis></entry>
25714 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25715 <entry>Default: <emphasis>*</emphasis></entry>
25716 </row>
25717 </tbody>
25718 </tgroup>
25719 </informaltable>
25720 <para>
25721 <indexterm role="concept">
25722 <primary>authentication</primary>
25723 <secondary>advertising</secondary>
25724 </indexterm>
25725 <indexterm role="concept">
25726 <primary>AUTH</primary>
25727 <secondary>advertising</secondary>
25728 </indexterm>
25729 <indexterm role="concept">
25730 <primary>ESMTP extensions</primary>
25731 <secondary>AUTH</secondary>
25732 </indexterm>
25733 If any server authentication mechanisms are configured, Exim advertises them in
25734 response to an EHLO command only if the calling host matches this list.
25735 Otherwise, Exim does not advertise AUTH.
25736 Exim does not accept AUTH commands from clients to which it has not
25737 advertised the availability of AUTH. The advertising of individual
25738 authentication mechanisms can be controlled by the use of the
25739 <option>server_advertise_condition</option> generic authenticator option on the individual
25740 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
25741 </para>
25742 <para>
25743 Certain mail clients (for example, Netscape) require the user to provide a name
25744 and password for authentication if AUTH is advertised, even though it may
25745 not be needed (the host may accept messages from hosts on its local LAN without
25746 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
25747 to make these clients more friendly by excluding them from the set of hosts to
25748 which Exim advertises AUTH.
25749 </para>
25750 <para>
25751 <indexterm role="concept">
25752 <primary>AUTH</primary>
25753 <secondary>advertising when encrypted</secondary>
25754 </indexterm>
25755 If you want to advertise the availability of AUTH only when the connection
25756 is encrypted using TLS, you can make use of the fact that the value of this
25757 option is expanded, with a setting like this:
25758 </para>
25759 <literallayout class="monospaced">
25760 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
25761 </literallayout>
25762 <para>
25763 <indexterm role="variable">
25764 <primary><varname>$tls_in_cipher</varname></primary>
25765 </indexterm>
25766 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
25767 the expansion is empty, thus matching no hosts. Otherwise, the result of the
25768 expansion is *, which matches all hosts.
25769 </para>
25770 <para>
25771 <indexterm role="option">
25772 <primary><option>auto_thaw</option></primary>
25773 </indexterm>
25774 </para>
25775 <informaltable frame="all">
25776 <tgroup cols="4" colsep="0" rowsep="0">
25777 <colspec colwidth="8*" align="left"/>
25778 <colspec colwidth="6*" align="center"/>
25779 <colspec colwidth="6*" align="center"/>
25780 <colspec colwidth="6*" align="right"/>
25781 <tbody>
25782 <row>
25783 <entry><option>auto_thaw</option></entry>
25784 <entry>Use: <emphasis>main</emphasis></entry>
25785 <entry>Type: <emphasis>time</emphasis></entry>
25786 <entry>Default: <emphasis>0s</emphasis></entry>
25787 </row>
25788 </tbody>
25789 </tgroup>
25790 </informaltable>
25791 <para>
25792 <indexterm role="concept">
25793 <primary>thawing messages</primary>
25794 </indexterm>
25795 <indexterm role="concept">
25796 <primary>unfreezing messages</primary>
25797 </indexterm>
25798 If this option is set to a time greater than zero, a queue runner will try a
25799 new delivery attempt on any frozen message, other than a bounce message, if
25800 this much time has passed since it was frozen. This may result in the message
25801 being re-frozen if nothing has changed since the last attempt. It is a way of
25802 saying <quote>keep on trying, even though there are big problems</quote>.
25803 </para>
25804 <para>
25805 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
25806 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
25807 thought to be very useful any more, and its use should probably be avoided.
25808 </para>
25809 <para>
25810 <indexterm role="option">
25811 <primary><option>av_scanner</option></primary>
25812 </indexterm>
25813 </para>
25814 <informaltable frame="all">
25815 <tgroup cols="4" colsep="0" rowsep="0">
25816 <colspec colwidth="8*" align="left"/>
25817 <colspec colwidth="6*" align="center"/>
25818 <colspec colwidth="6*" align="center"/>
25819 <colspec colwidth="6*" align="right"/>
25820 <tbody>
25821 <row>
25822 <entry><option>av_scanner</option></entry>
25823 <entry>Use: <emphasis>main</emphasis></entry>
25824 <entry>Type: <emphasis>string</emphasis></entry>
25825 <entry>Default: <emphasis>see below</emphasis></entry>
25826 </row>
25827 </tbody>
25828 </tgroup>
25829 </informaltable>
25830 <para>
25831 This option is available if Exim is built with the content-scanning extension.
25832 It specifies which anti-virus scanner to use. The default value is:
25833 </para>
25834 <literallayout class="monospaced">
25835 sophie:/var/run/sophie
25836 </literallayout>
25837 <para>
25838 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
25839 before use. See section <xref linkend="SECTscanvirus"/> for further details.
25840 </para>
25841 <para>
25842 <indexterm role="option">
25843 <primary><option>bi_command</option></primary>
25844 </indexterm>
25845 </para>
25846 <informaltable frame="all">
25847 <tgroup cols="4" colsep="0" rowsep="0">
25848 <colspec colwidth="8*" align="left"/>
25849 <colspec colwidth="6*" align="center"/>
25850 <colspec colwidth="6*" align="center"/>
25851 <colspec colwidth="6*" align="right"/>
25852 <tbody>
25853 <row>
25854 <entry><option>bi_command</option></entry>
25855 <entry>Use: <emphasis>main</emphasis></entry>
25856 <entry>Type: <emphasis>string</emphasis></entry>
25857 <entry>Default: <emphasis>unset</emphasis></entry>
25858 </row>
25859 </tbody>
25860 </tgroup>
25861 </informaltable>
25862 <para>
25863 <indexterm role="option">
25864 <primary><option>-bi</option></primary>
25865 </indexterm>
25866 This option supplies the name of a command that is run when Exim is called with
25867 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
25868 just the command name, it is not a complete command line. If an argument is
25869 required, it must come from the <option>-oA</option> command line option.
25870 </para>
25871 <para>
25872 <indexterm role="option">
25873 <primary><option>bounce_message_file</option></primary>
25874 </indexterm>
25875 </para>
25876 <informaltable frame="all">
25877 <tgroup cols="4" colsep="0" rowsep="0">
25878 <colspec colwidth="8*" align="left"/>
25879 <colspec colwidth="6*" align="center"/>
25880 <colspec colwidth="6*" align="center"/>
25881 <colspec colwidth="6*" align="right"/>
25882 <tbody>
25883 <row>
25884 <entry><option>bounce_message_file</option></entry>
25885 <entry>Use: <emphasis>main</emphasis></entry>
25886 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25887 <entry>Default: <emphasis>unset</emphasis></entry>
25888 </row>
25889 </tbody>
25890 </tgroup>
25891 </informaltable>
25892 <para>
25893 <indexterm role="concept">
25894 <primary>bounce message</primary>
25895 <secondary>customizing</secondary>
25896 </indexterm>
25897 <indexterm role="concept">
25898 <primary>customizing</primary>
25899 <secondary>bounce message</secondary>
25900 </indexterm>
25901 This option defines a template file containing paragraphs of text to be used
25902 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
25903 chapter <xref linkend="CHAPemsgcust"/>.
25904 <indexterm role="concept">
25905 <primary>bounce_message_file</primary>
25906 <secondary>tainted data</secondary>
25907 </indexterm>
25908 The option is expanded to give the file path, which must be
25909 absolute and untainted.
25910 See also <option>warn_message_file</option>.
25911 </para>
25912 <para>
25913 <indexterm role="option">
25914 <primary><option>bounce_message_text</option></primary>
25915 </indexterm>
25916 </para>
25917 <informaltable frame="all">
25918 <tgroup cols="4" colsep="0" rowsep="0">
25919 <colspec colwidth="8*" align="left"/>
25920 <colspec colwidth="6*" align="center"/>
25921 <colspec colwidth="6*" align="center"/>
25922 <colspec colwidth="6*" align="right"/>
25923 <tbody>
25924 <row>
25925 <entry><option>bounce_message_text</option></entry>
25926 <entry>Use: <emphasis>main</emphasis></entry>
25927 <entry>Type: <emphasis>string</emphasis></entry>
25928 <entry>Default: <emphasis>unset</emphasis></entry>
25929 </row>
25930 </tbody>
25931 </tgroup>
25932 </informaltable>
25933 <para>
25934 When this option is set, its contents are included in the default bounce
25935 message immediately after <quote>This message was created automatically by mail
25936 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
25937 </para>
25938 <para>
25939 <indexterm role="option">
25940 <primary><option>bounce_return_body</option></primary>
25941 </indexterm>
25942 </para>
25943 <informaltable frame="all">
25944 <tgroup cols="4" colsep="0" rowsep="0">
25945 <colspec colwidth="8*" align="left"/>
25946 <colspec colwidth="6*" align="center"/>
25947 <colspec colwidth="6*" align="center"/>
25948 <colspec colwidth="6*" align="right"/>
25949 <tbody>
25950 <row>
25951 <entry><option>bounce_return_body</option></entry>
25952 <entry>Use: <emphasis>main</emphasis></entry>
25953 <entry>Type: <emphasis>boolean</emphasis></entry>
25954 <entry>Default: <emphasis>true</emphasis></entry>
25955 </row>
25956 </tbody>
25957 </tgroup>
25958 </informaltable>
25959 <para>
25960 <indexterm role="concept">
25961 <primary>bounce message</primary>
25962 <secondary>including body</secondary>
25963 </indexterm>
25964 This option controls whether the body of an incoming message is included in a
25965 bounce message when <option>bounce_return_message</option> is true. The default setting
25966 causes the entire message, both header and body, to be returned (subject to the
25967 value of <option>bounce_return_size_limit</option>). If this option is false, only the
25968 message header is included. In the case of a non-SMTP message containing an
25969 error that is detected during reception, only those header lines preceding the
25970 point at which the error was detected are returned.
25971 <indexterm role="concept">
25972 <primary>bounce message</primary>
25973 <secondary>including original</secondary>
25974 </indexterm>
25975 </para>
25976 <para>
25977 <indexterm role="option">
25978 <primary><option>bounce_return_linesize_limit</option></primary>
25979 </indexterm>
25980 </para>
25981 <informaltable frame="all">
25982 <tgroup cols="4" colsep="0" rowsep="0">
25983 <colspec colwidth="8*" align="left"/>
25984 <colspec colwidth="6*" align="center"/>
25985 <colspec colwidth="6*" align="center"/>
25986 <colspec colwidth="6*" align="right"/>
25987 <tbody>
25988 <row>
25989 <entry><option>bounce_return_linesize_limit</option></entry>
25990 <entry>Use: <emphasis>main</emphasis></entry>
25991 <entry>Type: <emphasis>integer</emphasis></entry>
25992 <entry>Default: <emphasis>998</emphasis></entry>
25993 </row>
25994 </tbody>
25995 </tgroup>
25996 </informaltable>
25997 <para>
25998 <indexterm role="concept">
25999 <primary>size</primary>
26000 <secondary>of bounce lines, limit</secondary>
26001 </indexterm>
26002 <indexterm role="concept">
26003 <primary>bounce message</primary>
26004 <secondary>line length limit</secondary>
26005 </indexterm>
26006 <indexterm role="concept">
26007 <primary>limit</primary>
26008 <secondary>bounce message line length</secondary>
26009 </indexterm>
26010 This option sets a limit in bytes on the line length of messages
26011 that are returned to senders due to delivery problems,
26012 when <option>bounce_return_message</option> is true.
26013 The default value corresponds to RFC limits.
26014 If the message being returned has lines longer than this value it is
26015 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
26016 </para>
26017 <para>
26018 The option also applies to bounces returned when an error is detected
26019 during reception of a message.
26020 In this case lines from the original are truncated.
26021 </para>
26022 <para>
26023 The option does not apply to messages generated by an <command>autoreply</command> transport.
26024 </para>
26025 <para>
26026 <indexterm role="option">
26027 <primary><option>bounce_return_message</option></primary>
26028 </indexterm>
26029 </para>
26030 <informaltable frame="all">
26031 <tgroup cols="4" colsep="0" rowsep="0">
26032 <colspec colwidth="8*" align="left"/>
26033 <colspec colwidth="6*" align="center"/>
26034 <colspec colwidth="6*" align="center"/>
26035 <colspec colwidth="6*" align="right"/>
26036 <tbody>
26037 <row>
26038 <entry><option>bounce_return_message</option></entry>
26039 <entry>Use: <emphasis>main</emphasis></entry>
26040 <entry>Type: <emphasis>boolean</emphasis></entry>
26041 <entry>Default: <emphasis>true</emphasis></entry>
26042 </row>
26043 </tbody>
26044 </tgroup>
26045 </informaltable>
26046 <para>
26047 If this option is set false, none of the original message is included in
26048 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
26049 <option>bounce_return_body</option>.
26050 </para>
26051 <para>
26052 <indexterm role="option">
26053 <primary><option>bounce_return_size_limit</option></primary>
26054 </indexterm>
26055 </para>
26056 <informaltable frame="all">
26057 <tgroup cols="4" colsep="0" rowsep="0">
26058 <colspec colwidth="8*" align="left"/>
26059 <colspec colwidth="6*" align="center"/>
26060 <colspec colwidth="6*" align="center"/>
26061 <colspec colwidth="6*" align="right"/>
26062 <tbody>
26063 <row>
26064 <entry><option>bounce_return_size_limit</option></entry>
26065 <entry>Use: <emphasis>main</emphasis></entry>
26066 <entry>Type: <emphasis>integer</emphasis></entry>
26067 <entry>Default: <emphasis>100K</emphasis></entry>
26068 </row>
26069 </tbody>
26070 </tgroup>
26071 </informaltable>
26072 <para>
26073 <indexterm role="concept">
26074 <primary>size</primary>
26075 <secondary>of bounce, limit</secondary>
26076 </indexterm>
26077 <indexterm role="concept">
26078 <primary>bounce message</primary>
26079 <secondary>size limit</secondary>
26080 </indexterm>
26081 <indexterm role="concept">
26082 <primary>limit</primary>
26083 <secondary>bounce message size</secondary>
26084 </indexterm>
26085 This option sets a limit in bytes on the size of messages that are returned to
26086 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
26087 limit should be less than the value of the global <option>message_size_limit</option> and of
26088 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
26089 that Exim generates. If this option is set to zero there is no limit.
26090 </para>
26091 <para>
26092 When the body of any message that is to be included in a bounce message is
26093 greater than the limit, it is truncated, and a comment pointing this out is
26094 added at the top. The actual cutoff may be greater than the value given, owing
26095 to the use of buffering for transferring the message in chunks (typically 8K in
26096 size). The idea is to save bandwidth on those undeliverable 15-megabyte
26097 messages.
26098 </para>
26099 <para>
26100 <indexterm role="option">
26101 <primary><option>bounce_sender_authentication</option></primary>
26102 </indexterm>
26103 </para>
26104 <informaltable frame="all">
26105 <tgroup cols="4" colsep="0" rowsep="0">
26106 <colspec colwidth="8*" align="left"/>
26107 <colspec colwidth="6*" align="center"/>
26108 <colspec colwidth="6*" align="center"/>
26109 <colspec colwidth="6*" align="right"/>
26110 <tbody>
26111 <row>
26112 <entry><option>bounce_sender_authentication</option></entry>
26113 <entry>Use: <emphasis>main</emphasis></entry>
26114 <entry>Type: <emphasis>string</emphasis></entry>
26115 <entry>Default: <emphasis>unset</emphasis></entry>
26116 </row>
26117 </tbody>
26118 </tgroup>
26119 </informaltable>
26120 <para>
26121 <indexterm role="concept">
26122 <primary>bounce message</primary>
26123 <secondary>sender authentication</secondary>
26124 </indexterm>
26125 <indexterm role="concept">
26126 <primary>authentication</primary>
26127 <secondary>bounce message</secondary>
26128 </indexterm>
26129 <indexterm role="concept">
26130 <primary>AUTH</primary>
26131 <secondary>on bounce message</secondary>
26132 </indexterm>
26133 This option provides an authenticated sender address that is sent with any
26134 bounce messages generated by Exim that are sent over an authenticated SMTP
26135 connection. A typical setting might be:
26136 </para>
26137 <literallayout class="monospaced">
26138 bounce_sender_authentication = mailer-daemon@my.domain.example
26139 </literallayout>
26140 <para>
26141 which would cause bounce messages to be sent using the SMTP command:
26142 </para>
26143 <literallayout class="monospaced">
26144 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
26145 </literallayout>
26146 <para>
26147 The value of <option>bounce_sender_authentication</option> must always be a complete email
26148 address.
26149 </para>
26150 <para>
26151 <indexterm role="option">
26152 <primary><option>callout_domain_negative_expire</option></primary>
26153 </indexterm>
26154 </para>
26155 <informaltable frame="all">
26156 <tgroup cols="4" colsep="0" rowsep="0">
26157 <colspec colwidth="8*" align="left"/>
26158 <colspec colwidth="6*" align="center"/>
26159 <colspec colwidth="6*" align="center"/>
26160 <colspec colwidth="6*" align="right"/>
26161 <tbody>
26162 <row>
26163 <entry><option>callout_domain_negative_expire</option></entry>
26164 <entry>Use: <emphasis>main</emphasis></entry>
26165 <entry>Type: <emphasis>time</emphasis></entry>
26166 <entry>Default: <emphasis>3h</emphasis></entry>
26167 </row>
26168 </tbody>
26169 </tgroup>
26170 </informaltable>
26171 <para>
26172 <indexterm role="concept">
26173 <primary>caching</primary>
26174 <secondary>callout timeouts</secondary>
26175 </indexterm>
26176 <indexterm role="concept">
26177 <primary>callout</primary>
26178 <secondary>caching timeouts</secondary>
26179 </indexterm>
26180 This option specifies the expiry time for negative callout cache data for a
26181 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
26182 section <xref linkend="SECTcallvercache"/> for details of the caching.
26183 </para>
26184 <para>
26185 <indexterm role="option">
26186 <primary><option>callout_domain_positive_expire</option></primary>
26187 </indexterm>
26188 </para>
26189 <informaltable frame="all">
26190 <tgroup cols="4" colsep="0" rowsep="0">
26191 <colspec colwidth="8*" align="left"/>
26192 <colspec colwidth="6*" align="center"/>
26193 <colspec colwidth="6*" align="center"/>
26194 <colspec colwidth="6*" align="right"/>
26195 <tbody>
26196 <row>
26197 <entry><option>callout_domain_positive_expire</option></entry>
26198 <entry>Use: <emphasis>main</emphasis></entry>
26199 <entry>Type: <emphasis>time</emphasis></entry>
26200 <entry>Default: <emphasis>7d</emphasis></entry>
26201 </row>
26202 </tbody>
26203 </tgroup>
26204 </informaltable>
26205 <para>
26206 This option specifies the expiry time for positive callout cache data for a
26207 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
26208 section <xref linkend="SECTcallvercache"/> for details of the caching.
26209 </para>
26210 <para>
26211 <indexterm role="option">
26212 <primary><option>callout_negative_expire</option></primary>
26213 </indexterm>
26214 </para>
26215 <informaltable frame="all">
26216 <tgroup cols="4" colsep="0" rowsep="0">
26217 <colspec colwidth="8*" align="left"/>
26218 <colspec colwidth="6*" align="center"/>
26219 <colspec colwidth="6*" align="center"/>
26220 <colspec colwidth="6*" align="right"/>
26221 <tbody>
26222 <row>
26223 <entry><option>callout_negative_expire</option></entry>
26224 <entry>Use: <emphasis>main</emphasis></entry>
26225 <entry>Type: <emphasis>time</emphasis></entry>
26226 <entry>Default: <emphasis>2h</emphasis></entry>
26227 </row>
26228 </tbody>
26229 </tgroup>
26230 </informaltable>
26231 <para>
26232 This option specifies the expiry time for negative callout cache data for an
26233 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
26234 section <xref linkend="SECTcallvercache"/> for details of the caching.
26235 </para>
26236 <para>
26237 <indexterm role="option">
26238 <primary><option>callout_positive_expire</option></primary>
26239 </indexterm>
26240 </para>
26241 <informaltable frame="all">
26242 <tgroup cols="4" colsep="0" rowsep="0">
26243 <colspec colwidth="8*" align="left"/>
26244 <colspec colwidth="6*" align="center"/>
26245 <colspec colwidth="6*" align="center"/>
26246 <colspec colwidth="6*" align="right"/>
26247 <tbody>
26248 <row>
26249 <entry><option>callout_positive_expire</option></entry>
26250 <entry>Use: <emphasis>main</emphasis></entry>
26251 <entry>Type: <emphasis>time</emphasis></entry>
26252 <entry>Default: <emphasis>24h</emphasis></entry>
26253 </row>
26254 </tbody>
26255 </tgroup>
26256 </informaltable>
26257 <para>
26258 This option specifies the expiry time for positive callout cache data for an
26259 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
26260 section <xref linkend="SECTcallvercache"/> for details of the caching.
26261 </para>
26262 <para>
26263 <indexterm role="option">
26264 <primary><option>callout_random_local_part</option></primary>
26265 </indexterm>
26266 </para>
26267 <informaltable frame="all">
26268 <tgroup cols="4" colsep="0" rowsep="0">
26269 <colspec colwidth="8*" align="left"/>
26270 <colspec colwidth="6*" align="center"/>
26271 <colspec colwidth="6*" align="center"/>
26272 <colspec colwidth="6*" align="right"/>
26273 <tbody>
26274 <row>
26275 <entry><option>callout_random_local_part</option></entry>
26276 <entry>Use: <emphasis>main</emphasis></entry>
26277 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26278 <entry>Default: <emphasis>see below</emphasis></entry>
26279 </row>
26280 </tbody>
26281 </tgroup>
26282 </informaltable>
26283 <para>
26284 This option defines the <quote>random</quote> local part that can be used as part of
26285 callout verification. The default value is
26286 </para>
26287 <literallayout class="monospaced">
26288 $primary_hostname-$tod_epoch-testing
26289 </literallayout>
26290 <para>
26291 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
26292 </para>
26293 <para>
26294 <indexterm role="option">
26295 <primary><option>check_log_inodes</option></primary>
26296 </indexterm>
26297 <indexterm role="option">
26298 <primary><option>check_log_space</option></primary>
26299 </indexterm>
26300 </para>
26301 <informaltable frame="all">
26302 <tgroup cols="4" colsep="0" rowsep="0">
26303 <colspec colwidth="8*" align="left"/>
26304 <colspec colwidth="6*" align="center"/>
26305 <colspec colwidth="6*" align="center"/>
26306 <colspec colwidth="6*" align="right"/>
26307 <tbody>
26308 <row>
26309 <entry><option>check_log_inodes</option></entry>
26310 <entry>Use: <emphasis>main</emphasis></entry>
26311 <entry>Type: <emphasis>integer</emphasis></entry>
26312 <entry>Default: <emphasis>100</emphasis></entry>
26313 </row>
26314 <row>
26315 <entry><option>check_log_space</option></entry>
26316 <entry>Use: <emphasis>main</emphasis></entry>
26317 <entry>Type: <emphasis>integer</emphasis></entry>
26318 <entry>Default: <emphasis>10M</emphasis></entry>
26319 </row>
26320 </tbody>
26321 </tgroup>
26322 </informaltable>
26323 <para>
26324 See <option>check_spool_space</option> below.
26325 </para>
26326 <para>
26327 <indexterm role="option">
26328 <primary><option>check_rfc2047_length</option></primary>
26329 </indexterm>
26330 <indexterm role="concept">
26331 <primary>RFC 2047</primary>
26332 <secondary>disabling length check</secondary>
26333 </indexterm>
26334 <indexterm role="option">
26335 <primary><option>check_rfc2047_length</option></primary>
26336 </indexterm>
26337 </para>
26338 <informaltable frame="all">
26339 <tgroup cols="4" colsep="0" rowsep="0">
26340 <colspec colwidth="8*" align="left"/>
26341 <colspec colwidth="6*" align="center"/>
26342 <colspec colwidth="6*" align="center"/>
26343 <colspec colwidth="6*" align="right"/>
26344 <tbody>
26345 <row>
26346 <entry><option>check_rfc2047_length</option></entry>
26347 <entry>Use: <emphasis>main</emphasis></entry>
26348 <entry>Type: <emphasis>boolean</emphasis></entry>
26349 <entry>Default: <emphasis>true</emphasis></entry>
26350 </row>
26351 </tbody>
26352 </tgroup>
26353 </informaltable>
26354 <para>
26355 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
26356 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
26357 word; strings to be encoded that exceed this length are supposed to use
26358 multiple encoded words. By default, Exim does not recognize encoded words that
26359 exceed the maximum length. However, it seems that some software, in violation
26360 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
26361 set false, Exim recognizes encoded words of any length.
26362 </para>
26363 <para>
26364 <indexterm role="option">
26365 <primary><option>check_spool_inodes</option></primary>
26366 </indexterm>
26367 <indexterm role="option">
26368 <primary><option>check_spool_space</option></primary>
26369 </indexterm>
26370 </para>
26371 <informaltable frame="all">
26372 <tgroup cols="4" colsep="0" rowsep="0">
26373 <colspec colwidth="8*" align="left"/>
26374 <colspec colwidth="6*" align="center"/>
26375 <colspec colwidth="6*" align="center"/>
26376 <colspec colwidth="6*" align="right"/>
26377 <tbody>
26378 <row>
26379 <entry><option>check_spool_inodes</option></entry>
26380 <entry>Use: <emphasis>main</emphasis></entry>
26381 <entry>Type: <emphasis>integer</emphasis></entry>
26382 <entry>Default: <emphasis>100</emphasis></entry>
26383 </row>
26384 <row>
26385 <entry><option>check_spool_space</option></entry>
26386 <entry>Use: <emphasis>main</emphasis></entry>
26387 <entry>Type: <emphasis>integer</emphasis></entry>
26388 <entry>Default: <emphasis>10M</emphasis></entry>
26389 </row>
26390 </tbody>
26391 </tgroup>
26392 </informaltable>
26393 <para>
26394 <indexterm role="concept">
26395 <primary>checking disk space</primary>
26396 </indexterm>
26397 <indexterm role="concept">
26398 <primary>disk space, checking</primary>
26399 </indexterm>
26400 <indexterm role="concept">
26401 <primary>spool directory</primary>
26402 <secondary>checking space</secondary>
26403 </indexterm>
26404 The four <option>check_...</option> options allow for checking of disk resources before a
26405 message is accepted.
26406 </para>
26407 <para>
26408 <indexterm role="variable">
26409 <primary><varname>$log_inodes</varname></primary>
26410 </indexterm>
26411 <indexterm role="variable">
26412 <primary><varname>$log_space</varname></primary>
26413 </indexterm>
26414 <indexterm role="variable">
26415 <primary><varname>$spool_inodes</varname></primary>
26416 </indexterm>
26417 <indexterm role="variable">
26418 <primary><varname>$spool_space</varname></primary>
26419 </indexterm>
26420 When any of these options are nonzero, they apply to all incoming messages. If you
26421 want to apply different checks to different kinds of message, you can do so by
26422 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
26423 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
26424 </para>
26425 <para>
26426 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
26427 either value is greater than zero, for example:
26428 </para>
26429 <literallayout class="monospaced">
26430 check_spool_space = 100M
26431 check_spool_inodes = 100
26432 </literallayout>
26433 <para>
26434 The spool partition is the one that contains the directory defined by
26435 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
26436 transit.
26437 </para>
26438 <para>
26439 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
26440 files are written if either is greater than zero. These should be set only if
26441 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
26442 </para>
26443 <para>
26444 If there is less space or fewer inodes than requested, Exim refuses to accept
26445 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
26446 error response to the MAIL command. If ESMTP is in use and there was a
26447 SIZE parameter on the MAIL command, its value is added to the
26448 <option>check_spool_space</option> value, and the check is performed even if
26449 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
26450 </para>
26451 <para>
26452 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
26453 number of kilobytes (though specified in bytes).
26454 If a non-multiple of 1024 is specified, it is rounded up.
26455 </para>
26456 <para>
26457 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
26458 failure a message is written to stderr and Exim exits with a non-zero code, as
26459 it obviously cannot send an error message of any kind.
26460 </para>
26461 <para>
26462 There is a slight performance penalty for these checks.
26463 Versions of Exim preceding 4.88 had these disabled by default;
26464 high-rate installations confident they will never run out of resources
26465 may wish to deliberately disable them.
26466 </para>
26467 <para>
26468 <indexterm role="option">
26469 <primary><option>chunking_advertise_hosts</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>chunking_advertise_hosts</option></entry>
26481 <entry>Use: <emphasis>main</emphasis></entry>
26482 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26483 <entry>Default: <emphasis>*</emphasis></entry>
26484 </row>
26485 </tbody>
26486 </tgroup>
26487 </informaltable>
26488 <para>
26489 <indexterm role="concept">
26490 <primary>CHUNKING</primary>
26491 <secondary>advertisement</secondary>
26492 </indexterm>
26493 <indexterm role="concept">
26494 <primary>RFC 3030</primary>
26495 <secondary>CHUNKING</secondary>
26496 </indexterm>
26497 <indexterm role="concept">
26498 <primary>ESMTP extensions</primary>
26499 <secondary>CHUNKING</secondary>
26500 </indexterm>
26501 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
26502 these hosts.
26503 Hosts may use the BDAT command as an alternate to DATA.
26504 </para>
26505 <para>
26506 <indexterm role="option">
26507 <primary><option>commandline_checks_require_admin</option></primary>
26508 </indexterm>
26509 </para>
26510 <informaltable frame="all">
26511 <tgroup cols="4" colsep="0" rowsep="0">
26512 <colspec colwidth="8*" align="left"/>
26513 <colspec colwidth="6*" align="center"/>
26514 <colspec colwidth="6*" align="center"/>
26515 <colspec colwidth="6*" align="right"/>
26516 <tbody>
26517 <row>
26518 <entry><option>commandline_checks_require_admin</option></entry>
26519 <entry>Use: <emphasis>main</emphasis></entry>
26520 <entry>Type: <emphasis>boolean</emphasis></entry>
26521 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
26522 </row>
26523 </tbody>
26524 </tgroup>
26525 </informaltable>
26526 <para>
26527 <indexterm role="concept">
26528 <primary>restricting access to features</primary>
26529 </indexterm>
26530 This option restricts various basic checking features to require an
26531 administrative user.
26532 This affects most of the <option>-b*</option> options, such as <option>-be</option>.
26533 </para>
26534 <para>
26535 <indexterm role="option">
26536 <primary><option>debug_store</option></primary>
26537 </indexterm>
26538 </para>
26539 <informaltable frame="all">
26540 <tgroup cols="4" colsep="0" rowsep="0">
26541 <colspec colwidth="8*" align="left"/>
26542 <colspec colwidth="6*" align="center"/>
26543 <colspec colwidth="6*" align="center"/>
26544 <colspec colwidth="6*" align="right"/>
26545 <tbody>
26546 <row>
26547 <entry><option>debug_store</option></entry>
26548 <entry>Use: <emphasis>main</emphasis></entry>
26549 <entry>Type: <emphasis>boolean</emphasis></entry>
26550 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
26551 </row>
26552 </tbody>
26553 </tgroup>
26554 </informaltable>
26555 <para>
26556 <indexterm role="concept">
26557 <primary>debugging</primary>
26558 <secondary>memory corruption</secondary>
26559 </indexterm>
26560 <indexterm role="concept">
26561 <primary>memory</primary>
26562 <secondary>debugging</secondary>
26563 </indexterm>
26564 This option, when true, enables extra checking in Exim&#x2019;s internal memory
26565 management.  For use when a memory corruption issue is being investigated,
26566 it should normally be left as default.
26567 </para>
26568 <para>
26569 <indexterm role="option">
26570 <primary><option>daemon_smtp_ports</option></primary>
26571 </indexterm>
26572 </para>
26573 <informaltable frame="all">
26574 <tgroup cols="4" colsep="0" rowsep="0">
26575 <colspec colwidth="8*" align="left"/>
26576 <colspec colwidth="6*" align="center"/>
26577 <colspec colwidth="6*" align="center"/>
26578 <colspec colwidth="6*" align="right"/>
26579 <tbody>
26580 <row>
26581 <entry><option>daemon_smtp_ports</option></entry>
26582 <entry>Use: <emphasis>main</emphasis></entry>
26583 <entry>Type: <emphasis>string</emphasis></entry>
26584 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
26585 </row>
26586 </tbody>
26587 </tgroup>
26588 </informaltable>
26589 <para>
26590 <indexterm role="concept">
26591 <primary>port</primary>
26592 <secondary>for daemon</secondary>
26593 </indexterm>
26594 <indexterm role="concept">
26595 <primary>TCP/IP</primary>
26596 <secondary>setting listening ports</secondary>
26597 </indexterm>
26598 This option specifies one or more default SMTP ports on which the Exim daemon
26599 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
26600 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
26601 </para>
26602 <para>
26603 <indexterm role="option">
26604 <primary><option>daemon_startup_retries</option></primary>
26605 </indexterm>
26606 <indexterm role="option">
26607 <primary><option>daemon_startup_sleep</option></primary>
26608 </indexterm>
26609 </para>
26610 <informaltable frame="all">
26611 <tgroup cols="4" colsep="0" rowsep="0">
26612 <colspec colwidth="8*" align="left"/>
26613 <colspec colwidth="6*" align="center"/>
26614 <colspec colwidth="6*" align="center"/>
26615 <colspec colwidth="6*" align="right"/>
26616 <tbody>
26617 <row>
26618 <entry><option>daemon_startup_retries</option></entry>
26619 <entry>Use: <emphasis>main</emphasis></entry>
26620 <entry>Type: <emphasis>integer</emphasis></entry>
26621 <entry>Default: <emphasis>9</emphasis></entry>
26622 </row>
26623 <row>
26624 <entry><option>daemon_startup_sleep</option></entry>
26625 <entry>Use: <emphasis>main</emphasis></entry>
26626 <entry>Type: <emphasis>time</emphasis></entry>
26627 <entry>Default: <emphasis>30s</emphasis></entry>
26628 </row>
26629 </tbody>
26630 </tgroup>
26631 </informaltable>
26632 <para>
26633 <indexterm role="concept">
26634 <primary>daemon startup, retrying</primary>
26635 </indexterm>
26636 These options control the retrying done by
26637 the daemon at startup when it cannot immediately bind a listening socket
26638 (typically because the socket is already in use): <option>daemon_startup_retries</option>
26639 defines the number of retries after the first failure, and
26640 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
26641 </para>
26642 <para>
26643 <indexterm role="option">
26644 <primary><option>delay_warning</option></primary>
26645 </indexterm>
26646 </para>
26647 <informaltable frame="all">
26648 <tgroup cols="4" colsep="0" rowsep="0">
26649 <colspec colwidth="8*" align="left"/>
26650 <colspec colwidth="6*" align="center"/>
26651 <colspec colwidth="6*" align="center"/>
26652 <colspec colwidth="6*" align="right"/>
26653 <tbody>
26654 <row>
26655 <entry><option>delay_warning</option></entry>
26656 <entry>Use: <emphasis>main</emphasis></entry>
26657 <entry>Type: <emphasis>time list</emphasis></entry>
26658 <entry>Default: <emphasis>24h</emphasis></entry>
26659 </row>
26660 </tbody>
26661 </tgroup>
26662 </informaltable>
26663 <para>
26664 <indexterm role="concept">
26665 <primary>warning of delay</primary>
26666 </indexterm>
26667 <indexterm role="concept">
26668 <primary>delay warning, specifying</primary>
26669 </indexterm>
26670 <indexterm role="concept">
26671 <primary>queue</primary>
26672 <secondary>delay warning</secondary>
26673 </indexterm>
26674 When a message is delayed, Exim sends a warning message to the sender at
26675 intervals specified by this option. The data is a colon-separated list of times
26676 after which to send warning messages. If the value of the option is an empty
26677 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
26678 message has been in the queue for longer than the last time, the last interval
26679 between the times is used to compute subsequent warning times. For example,
26680 with
26681 </para>
26682 <literallayout class="monospaced">
26683 delay_warning = 4h:8h:24h
26684 </literallayout>
26685 <para>
26686 the first message is sent after 4 hours, the second after 8 hours, and
26687 the third one after 24 hours. After that, messages are sent every 16 hours,
26688 because that is the interval between the last two times on the list. If you set
26689 just one time, it specifies the repeat interval. For example, with:
26690 </para>
26691 <literallayout class="monospaced">
26692 delay_warning = 6h
26693 </literallayout>
26694 <para>
26695 messages are repeated every six hours. To stop warnings after a given time, set
26696 a very large time at the end of the list. For example:
26697 </para>
26698 <literallayout class="monospaced">
26699 delay_warning = 2h:12h:99d
26700 </literallayout>
26701 <para>
26702 Note that the option is only evaluated at the time a delivery attempt fails,
26703 which depends on retry and queue-runner configuration.
26704 Typically retries will be configured more frequently than warning messages.
26705 </para>
26706 <para>
26707 <indexterm role="option">
26708 <primary><option>delay_warning_condition</option></primary>
26709 </indexterm>
26710 </para>
26711 <informaltable frame="all">
26712 <tgroup cols="4" colsep="0" rowsep="0">
26713 <colspec colwidth="8*" align="left"/>
26714 <colspec colwidth="6*" align="center"/>
26715 <colspec colwidth="6*" align="center"/>
26716 <colspec colwidth="6*" align="right"/>
26717 <tbody>
26718 <row>
26719 <entry><option>delay_warning_condition</option></entry>
26720 <entry>Use: <emphasis>main</emphasis></entry>
26721 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26722 <entry>Default: <emphasis>see below</emphasis></entry>
26723 </row>
26724 </tbody>
26725 </tgroup>
26726 </informaltable>
26727 <para>
26728 <indexterm role="variable">
26729 <primary><varname>$domain</varname></primary>
26730 </indexterm>
26731 The string is expanded at the time a warning message might be sent. If all the
26732 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
26733 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
26734 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
26735 <quote>false</quote> (the comparison being done caselessly) then the warning message is
26736 not sent. The default is:
26737 </para>
26738 <literallayout class="monospaced">
26739 delay_warning_condition = ${if or {\
26740   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
26741   { match{$h_precedence:}{(?i)bulk|list|junk} }\
26742   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
26743   } {no}{yes}}
26744 </literallayout>
26745 <para>
26746 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
26747 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
26748 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
26749 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
26750 </para>
26751 <para>
26752 <indexterm role="option">
26753 <primary><option>deliver_drop_privilege</option></primary>
26754 </indexterm>
26755 </para>
26756 <informaltable frame="all">
26757 <tgroup cols="4" colsep="0" rowsep="0">
26758 <colspec colwidth="8*" align="left"/>
26759 <colspec colwidth="6*" align="center"/>
26760 <colspec colwidth="6*" align="center"/>
26761 <colspec colwidth="6*" align="right"/>
26762 <tbody>
26763 <row>
26764 <entry><option>deliver_drop_privilege</option></entry>
26765 <entry>Use: <emphasis>main</emphasis></entry>
26766 <entry>Type: <emphasis>boolean</emphasis></entry>
26767 <entry>Default: <emphasis>false</emphasis></entry>
26768 </row>
26769 </tbody>
26770 </tgroup>
26771 </informaltable>
26772 <para>
26773 <indexterm role="concept">
26774 <primary>unprivileged delivery</primary>
26775 </indexterm>
26776 <indexterm role="concept">
26777 <primary>delivery</primary>
26778 <secondary>unprivileged</secondary>
26779 </indexterm>
26780 If this option is set true, Exim drops its root privilege at the start of a
26781 delivery process, and runs as the Exim user throughout. This severely restricts
26782 the kinds of local delivery that are possible, but is viable in certain types
26783 of configuration. There is a discussion about the use of root privilege in
26784 chapter <xref linkend="CHAPsecurity"/>.
26785 </para>
26786 <para>
26787 <indexterm role="option">
26788 <primary><option>deliver_queue_load_max</option></primary>
26789 </indexterm>
26790 </para>
26791 <informaltable frame="all">
26792 <tgroup cols="4" colsep="0" rowsep="0">
26793 <colspec colwidth="8*" align="left"/>
26794 <colspec colwidth="6*" align="center"/>
26795 <colspec colwidth="6*" align="center"/>
26796 <colspec colwidth="6*" align="right"/>
26797 <tbody>
26798 <row>
26799 <entry><option>deliver_queue_load_max</option></entry>
26800 <entry>Use: <emphasis>main</emphasis></entry>
26801 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26802 <entry>Default: <emphasis>unset</emphasis></entry>
26803 </row>
26804 </tbody>
26805 </tgroup>
26806 </informaltable>
26807 <para>
26808 <indexterm role="concept">
26809 <primary>load average</primary>
26810 </indexterm>
26811 <indexterm role="concept">
26812 <primary>queue runner</primary>
26813 <secondary>abandoning</secondary>
26814 </indexterm>
26815 When this option is set, a queue run is abandoned if the system load average
26816 becomes greater than the value of the option. The option has no effect on
26817 ancient operating systems on which Exim cannot determine the load average.
26818 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
26819 </para>
26820 <para>
26821 <indexterm role="option">
26822 <primary><option>delivery_date_remove</option></primary>
26823 </indexterm>
26824 </para>
26825 <informaltable frame="all">
26826 <tgroup cols="4" colsep="0" rowsep="0">
26827 <colspec colwidth="8*" align="left"/>
26828 <colspec colwidth="6*" align="center"/>
26829 <colspec colwidth="6*" align="center"/>
26830 <colspec colwidth="6*" align="right"/>
26831 <tbody>
26832 <row>
26833 <entry><option>delivery_date_remove</option></entry>
26834 <entry>Use: <emphasis>main</emphasis></entry>
26835 <entry>Type: <emphasis>boolean</emphasis></entry>
26836 <entry>Default: <emphasis>true</emphasis></entry>
26837 </row>
26838 </tbody>
26839 </tgroup>
26840 </informaltable>
26841 <para>
26842 <indexterm role="concept">
26843 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
26844 </indexterm>
26845 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
26846 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
26847 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
26848 should not be present in incoming messages, and this option causes them to be
26849 removed at the time the message is received, to avoid any problems that might
26850 occur when a delivered message is subsequently sent on to some other recipient.
26851 </para>
26852 <para>
26853 <indexterm role="option">
26854 <primary><option>disable_fsync</option></primary>
26855 </indexterm>
26856 </para>
26857 <informaltable frame="all">
26858 <tgroup cols="4" colsep="0" rowsep="0">
26859 <colspec colwidth="8*" align="left"/>
26860 <colspec colwidth="6*" align="center"/>
26861 <colspec colwidth="6*" align="center"/>
26862 <colspec colwidth="6*" align="right"/>
26863 <tbody>
26864 <row>
26865 <entry><option>disable_fsync</option></entry>
26866 <entry>Use: <emphasis>main</emphasis></entry>
26867 <entry>Type: <emphasis>boolean</emphasis></entry>
26868 <entry>Default: <emphasis>false</emphasis></entry>
26869 </row>
26870 </tbody>
26871 </tgroup>
26872 </informaltable>
26873 <para>
26874 <indexterm role="concept">
26875 <primary><function>fsync()</function>, disabling</primary>
26876 </indexterm>
26877 This option is available only if Exim was built with the compile-time option
26878 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
26879 a runtime configuration generates an <quote>unknown option</quote> error. You should not
26880 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
26881 really, really, really understand what you are doing. <emphasis>No pre-compiled
26882 distributions of Exim should ever make this option available.</emphasis>
26883 </para>
26884 <para>
26885 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
26886 updated files&#x2019; data to be written to disc before continuing. Unexpected events
26887 such as crashes and power outages may cause data to be lost or scrambled.
26888 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
26889 </para>
26890 <para>
26891 <indexterm role="option">
26892 <primary><option>disable_ipv6</option></primary>
26893 </indexterm>
26894 </para>
26895 <informaltable frame="all">
26896 <tgroup cols="4" colsep="0" rowsep="0">
26897 <colspec colwidth="8*" align="left"/>
26898 <colspec colwidth="6*" align="center"/>
26899 <colspec colwidth="6*" align="center"/>
26900 <colspec colwidth="6*" align="right"/>
26901 <tbody>
26902 <row>
26903 <entry><option>disable_ipv6</option></entry>
26904 <entry>Use: <emphasis>main</emphasis></entry>
26905 <entry>Type: <emphasis>boolean</emphasis></entry>
26906 <entry>Default: <emphasis>false</emphasis></entry>
26907 </row>
26908 </tbody>
26909 </tgroup>
26910 </informaltable>
26911 <para>
26912 <indexterm role="concept">
26913 <primary>IPv6</primary>
26914 <secondary>disabling</secondary>
26915 </indexterm>
26916 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
26917 activities take place. AAAA records are never looked up, and any IPv6 addresses
26918 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
26919 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
26920 to handle IPv6 literal addresses.
26921 </para>
26922 <para>
26923 <indexterm role="option">
26924 <primary><option>dkim_verify_hashes</option></primary>
26925 </indexterm>
26926 </para>
26927 <informaltable frame="all">
26928 <tgroup cols="4" colsep="0" rowsep="0">
26929 <colspec colwidth="8*" align="left"/>
26930 <colspec colwidth="6*" align="center"/>
26931 <colspec colwidth="6*" align="center"/>
26932 <colspec colwidth="6*" align="right"/>
26933 <tbody>
26934 <row>
26935 <entry><option>dkim_verify_hashes</option></entry>
26936 <entry>Use: <emphasis>main</emphasis></entry>
26937 <entry>Type: <emphasis>string list</emphasis></entry>
26938 <entry>Default: <emphasis>sha256 : sha512</emphasis></entry>
26939 </row>
26940 </tbody>
26941 </tgroup>
26942 </informaltable>
26943 <para>
26944 <indexterm role="concept">
26945 <primary>DKIM</primary>
26946 <secondary>selecting signature algorithms</secondary>
26947 </indexterm>
26948 This option gives a list of hash types which are acceptable in signatures,
26949 and an order of processing.
26950 Signatures with algorithms not in the list will be ignored.
26951 </para>
26952 <para>
26953 Acceptable values include:
26954 </para>
26955 <literallayout class="monospaced">
26956 sha1
26957 sha256
26958 sha512
26959 </literallayout>
26960 <para>
26961 Note that the acceptance of sha1 violates RFC 8301.
26962 </para>
26963 <para>
26964 <indexterm role="option">
26965 <primary><option>dkim_verify_keytypes</option></primary>
26966 </indexterm>
26967 </para>
26968 <informaltable frame="all">
26969 <tgroup cols="4" colsep="0" rowsep="0">
26970 <colspec colwidth="8*" align="left"/>
26971 <colspec colwidth="6*" align="center"/>
26972 <colspec colwidth="6*" align="center"/>
26973 <colspec colwidth="6*" align="right"/>
26974 <tbody>
26975 <row>
26976 <entry><option>dkim_verify_keytypes</option></entry>
26977 <entry>Use: <emphasis>main</emphasis></entry>
26978 <entry>Type: <emphasis>string list</emphasis></entry>
26979 <entry>Default: <emphasis>ed25519 : rsa</emphasis></entry>
26980 </row>
26981 </tbody>
26982 </tgroup>
26983 </informaltable>
26984 <para>
26985 This option gives a list of key types which are acceptable in signatures,
26986 and an order of processing.
26987 Signatures with algorithms not in the list will be ignored.
26988 </para>
26989 <para>
26990 <indexterm role="option">
26991 <primary><option>dkim_verify_min_keysizes</option></primary>
26992 </indexterm>
26993 </para>
26994 <informaltable frame="all">
26995 <tgroup cols="4" colsep="0" rowsep="0">
26996 <colspec colwidth="8*" align="left"/>
26997 <colspec colwidth="6*" align="center"/>
26998 <colspec colwidth="6*" align="center"/>
26999 <colspec colwidth="6*" align="right"/>
27000 <tbody>
27001 <row>
27002 <entry><option>dkim_verify_min_keysizes</option></entry>
27003 <entry>Use: <emphasis>main</emphasis></entry>
27004 <entry>Type: <emphasis>string list</emphasis></entry>
27005 <entry>Default: <emphasis>rsa=1024 ed25519=250</emphasis></entry>
27006 </row>
27007 </tbody>
27008 </tgroup>
27009 </informaltable>
27010 <para>
27011 This option gives a list of key sizes which are acceptable in signatures.
27012 The list is keyed by the algorithm type for the key; the values are in bits.
27013 Signatures with keys smaller than given by this option will fail verification.
27014 </para>
27015 <para>
27016 The default enforces the RFC 8301 minimum key size for RSA signatures.
27017 </para>
27018 <para>
27019 <indexterm role="option">
27020 <primary><option>dkim_verify_minimal</option></primary>
27021 </indexterm>
27022 </para>
27023 <informaltable frame="all">
27024 <tgroup cols="4" colsep="0" rowsep="0">
27025 <colspec colwidth="8*" align="left"/>
27026 <colspec colwidth="6*" align="center"/>
27027 <colspec colwidth="6*" align="center"/>
27028 <colspec colwidth="6*" align="right"/>
27029 <tbody>
27030 <row>
27031 <entry><option>dkim_verify_minimal</option></entry>
27032 <entry>Use: <emphasis>main</emphasis></entry>
27033 <entry>Type: <emphasis>boolean</emphasis></entry>
27034 <entry>Default: <emphasis>false</emphasis></entry>
27035 </row>
27036 </tbody>
27037 </tgroup>
27038 </informaltable>
27039 <para>
27040 If set to true, verification of signatures will terminate after the
27041 first success.
27042 </para>
27043 <para>
27044 <indexterm role="option">
27045 <primary><option>dkim_verify_signers</option></primary>
27046 </indexterm>
27047 </para>
27048 <informaltable frame="all">
27049 <tgroup cols="4" colsep="0" rowsep="0">
27050 <colspec colwidth="8*" align="left"/>
27051 <colspec colwidth="6*" align="center"/>
27052 <colspec colwidth="6*" align="center"/>
27053 <colspec colwidth="6*" align="right"/>
27054 <tbody>
27055 <row>
27056 <entry><option>dkim_verify_signers</option></entry>
27057 <entry>Use: <emphasis>main</emphasis></entry>
27058 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27059 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
27060 </row>
27061 </tbody>
27062 </tgroup>
27063 </informaltable>
27064 <para>
27065 <indexterm role="concept">
27066 <primary>DKIM</primary>
27067 <secondary>controlling calls to the ACL</secondary>
27068 </indexterm>
27069 This option gives a list of DKIM domains for which the DKIM ACL is run.
27070 It is expanded after the message is received; by default it runs
27071 the ACL once for each signature in the message.
27072 See section <xref linkend="SECDKIMVFY"/>.
27073 </para>
27074 <para>
27075 <indexterm role="option">
27076 <primary><option>dmarc_forensic_sender</option></primary>
27077 </indexterm>
27078 </para>
27079 <informaltable frame="all">
27080 <tgroup cols="4" colsep="0" rowsep="0">
27081 <colspec colwidth="8*" align="left"/>
27082 <colspec colwidth="6*" align="center"/>
27083 <colspec colwidth="6*" align="center"/>
27084 <colspec colwidth="6*" align="right"/>
27085 <tbody>
27086 <row>
27087 <entry><option>dmarc_forensic_sender</option></entry>
27088 <entry>Use: <emphasis>main</emphasis></entry>
27089 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27090 <entry>Default: <emphasis>unset</emphasis></entry>
27091 </row>
27092 </tbody>
27093 </tgroup>
27094 </informaltable>
27095 <para>
27096 <indexterm role="option">
27097 <primary><option>dmarc_history_file</option></primary>
27098 </indexterm>
27099 </para>
27100 <informaltable frame="all">
27101 <tgroup cols="4" colsep="0" rowsep="0">
27102 <colspec colwidth="8*" align="left"/>
27103 <colspec colwidth="6*" align="center"/>
27104 <colspec colwidth="6*" align="center"/>
27105 <colspec colwidth="6*" align="right"/>
27106 <tbody>
27107 <row>
27108 <entry><option>dmarc_history_file</option></entry>
27109 <entry>Use: <emphasis>main</emphasis></entry>
27110 <entry>Type: <emphasis>string</emphasis></entry>
27111 <entry>Default: <emphasis>unset</emphasis></entry>
27112 </row>
27113 </tbody>
27114 </tgroup>
27115 </informaltable>
27116 <para>
27117 <indexterm role="option">
27118 <primary><option>dmarc_tld_file</option></primary>
27119 </indexterm>
27120 </para>
27121 <informaltable frame="all">
27122 <tgroup cols="4" colsep="0" rowsep="0">
27123 <colspec colwidth="8*" align="left"/>
27124 <colspec colwidth="6*" align="center"/>
27125 <colspec colwidth="6*" align="center"/>
27126 <colspec colwidth="6*" align="right"/>
27127 <tbody>
27128 <row>
27129 <entry><option>dmarc_tld_file</option></entry>
27130 <entry>Use: <emphasis>main</emphasis></entry>
27131 <entry>Type: <emphasis>string</emphasis></entry>
27132 <entry>Default: <emphasis>unset</emphasis></entry>
27133 </row>
27134 </tbody>
27135 </tgroup>
27136 </informaltable>
27137 <para>
27138 <indexterm role="concept">
27139 <primary>DMARC</primary>
27140 <secondary>main section options</secondary>
27141 </indexterm>
27142 These options control DMARC processing.
27143 See section <xref linkend="SECDMARC"/> for details.
27144 </para>
27145 <para>
27146 <indexterm role="option">
27147 <primary><option>dns_again_means_nonexist</option></primary>
27148 </indexterm>
27149 </para>
27150 <informaltable frame="all">
27151 <tgroup cols="4" colsep="0" rowsep="0">
27152 <colspec colwidth="8*" align="left"/>
27153 <colspec colwidth="6*" align="center"/>
27154 <colspec colwidth="6*" align="center"/>
27155 <colspec colwidth="6*" align="right"/>
27156 <tbody>
27157 <row>
27158 <entry><option>dns_again_means_nonexist</option></entry>
27159 <entry>Use: <emphasis>main</emphasis></entry>
27160 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27161 <entry>Default: <emphasis>unset</emphasis></entry>
27162 </row>
27163 </tbody>
27164 </tgroup>
27165 </informaltable>
27166 <para>
27167 <indexterm role="concept">
27168 <primary>DNS</primary>
27169 <secondary><quote>try again</quote> response; overriding</secondary>
27170 </indexterm>
27171 DNS lookups give a <quote>try again</quote> response for the DNS errors
27172 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
27173 keep trying to deliver a message, or to give repeated temporary errors to
27174 incoming mail. Sometimes the effect is caused by a badly set up name server and
27175 may persist for a long time. If a domain which exhibits this problem matches
27176 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
27177 This option should be used with care. You can make it apply to reverse lookups
27178 by a setting such as this:
27179 </para>
27180 <literallayout class="monospaced">
27181 dns_again_means_nonexist = *.in-addr.arpa
27182 </literallayout>
27183 <para>
27184 This option applies to all DNS lookups that Exim does,
27185 </para>
27186 <para revisionflag="changed">
27187 except for TLSA lookups (where knowing about such failures
27188 is security-relevant).
27189 </para>
27190 <para>
27191 It also applies when the
27192 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
27193 since these are most likely to be caused by DNS lookup problems. The
27194 <command>dnslookup</command> router has some options of its own for controlling what happens
27195 when lookups for MX or SRV records give temporary errors. These more specific
27196 options are applied after this global option.
27197 </para>
27198 <para>
27199 <indexterm role="option">
27200 <primary><option>dns_check_names_pattern</option></primary>
27201 </indexterm>
27202 </para>
27203 <informaltable frame="all">
27204 <tgroup cols="4" colsep="0" rowsep="0">
27205 <colspec colwidth="8*" align="left"/>
27206 <colspec colwidth="6*" align="center"/>
27207 <colspec colwidth="6*" align="center"/>
27208 <colspec colwidth="6*" align="right"/>
27209 <tbody>
27210 <row>
27211 <entry><option>dns_check_names_pattern</option></entry>
27212 <entry>Use: <emphasis>main</emphasis></entry>
27213 <entry>Type: <emphasis>string</emphasis></entry>
27214 <entry>Default: <emphasis>see below</emphasis></entry>
27215 </row>
27216 </tbody>
27217 </tgroup>
27218 </informaltable>
27219 <para>
27220 <indexterm role="concept">
27221 <primary>DNS</primary>
27222 <secondary>pre-check of name syntax</secondary>
27223 </indexterm>
27224 When this option is set to a non-empty string, it causes Exim to check domain
27225 names for characters that are not allowed in host names before handing them to
27226 the DNS resolver, because some resolvers give temporary errors for names that
27227 contain unusual characters. If a domain name contains any unwanted characters,
27228 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
27229 done by matching the domain name against a regular expression, which is the
27230 value of this option. The default pattern is
27231 </para>
27232 <literallayout class="monospaced">
27233 dns_check_names_pattern = \
27234   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
27235 </literallayout>
27236 <para>
27237 which permits only letters, digits, slashes, and hyphens in components, but
27238 they must start and end with a letter or digit. Slashes are not, in fact,
27239 permitted in host names, but they are found in certain NS records (which can be
27240 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
27241 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
27242 empty string.
27243 </para>
27244 <para>
27245 <indexterm role="option">
27246 <primary><option>dns_csa_search_limit</option></primary>
27247 </indexterm>
27248 </para>
27249 <informaltable frame="all">
27250 <tgroup cols="4" colsep="0" rowsep="0">
27251 <colspec colwidth="8*" align="left"/>
27252 <colspec colwidth="6*" align="center"/>
27253 <colspec colwidth="6*" align="center"/>
27254 <colspec colwidth="6*" align="right"/>
27255 <tbody>
27256 <row>
27257 <entry><option>dns_csa_search_limit</option></entry>
27258 <entry>Use: <emphasis>main</emphasis></entry>
27259 <entry>Type: <emphasis>integer</emphasis></entry>
27260 <entry>Default: <emphasis>5</emphasis></entry>
27261 </row>
27262 </tbody>
27263 </tgroup>
27264 </informaltable>
27265 <para>
27266 This option controls the depth of parental searching for CSA SRV records in the
27267 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
27268 </para>
27269 <para>
27270 <indexterm role="option">
27271 <primary><option>dns_csa_use_reverse</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>dns_csa_use_reverse</option></entry>
27283 <entry>Use: <emphasis>main</emphasis></entry>
27284 <entry>Type: <emphasis>boolean</emphasis></entry>
27285 <entry>Default: <emphasis>true</emphasis></entry>
27286 </row>
27287 </tbody>
27288 </tgroup>
27289 </informaltable>
27290 <para>
27291 This option controls whether or not an IP address, given as a CSA domain, is
27292 reversed and looked up in the reverse DNS, as described in more detail in
27293 section <xref linkend="SECTverifyCSA"/>.
27294 </para>
27295 <para>
27296 <indexterm role="option">
27297 <primary><option>dns_cname_loops</option></primary>
27298 </indexterm>
27299 </para>
27300 <informaltable frame="all">
27301 <tgroup cols="4" colsep="0" rowsep="0">
27302 <colspec colwidth="8*" align="left"/>
27303 <colspec colwidth="6*" align="center"/>
27304 <colspec colwidth="6*" align="center"/>
27305 <colspec colwidth="6*" align="right"/>
27306 <tbody>
27307 <row>
27308 <entry><option>dns_cname_loops</option></entry>
27309 <entry>Use: <emphasis>main</emphasis></entry>
27310 <entry>Type: <emphasis>integer</emphasis></entry>
27311 <entry>Default: <emphasis>1</emphasis></entry>
27312 </row>
27313 </tbody>
27314 </tgroup>
27315 </informaltable>
27316 <para>
27317 <indexterm role="concept">
27318 <primary>DNS</primary>
27319 <secondary>CNAME following</secondary>
27320 </indexterm>
27321 This option controls the following of CNAME chains, needed if the resolver does
27322 not do it internally.
27323 As of 2018 most should, and the default can be left.
27324 If you have an ancient one, a value of 10 is likely needed.
27325 </para>
27326 <para>
27327 The default value of one CNAME-follow is needed
27328 thanks to the observed return for an MX request,
27329 given no MX presence but a CNAME to an A, of the CNAME.
27330 </para>
27331 <para>
27332 <indexterm role="option">
27333 <primary><option>dns_dnssec_ok</option></primary>
27334 </indexterm>
27335 </para>
27336 <informaltable frame="all">
27337 <tgroup cols="4" colsep="0" rowsep="0">
27338 <colspec colwidth="8*" align="left"/>
27339 <colspec colwidth="6*" align="center"/>
27340 <colspec colwidth="6*" align="center"/>
27341 <colspec colwidth="6*" align="right"/>
27342 <tbody>
27343 <row>
27344 <entry><option>dns_dnssec_ok</option></entry>
27345 <entry>Use: <emphasis>main</emphasis></entry>
27346 <entry>Type: <emphasis>integer</emphasis></entry>
27347 <entry>Default: <emphasis>-1</emphasis></entry>
27348 </row>
27349 </tbody>
27350 </tgroup>
27351 </informaltable>
27352 <para>
27353 <indexterm role="concept">
27354 <primary>DNS</primary>
27355 <secondary>resolver options</secondary>
27356 </indexterm>
27357 <indexterm role="concept">
27358 <primary>DNS</primary>
27359 <secondary>DNSSEC</secondary>
27360 </indexterm>
27361 If this option is set to a non-negative number then Exim will initialise the
27362 DNS resolver library to either use or not use DNSSEC, overriding the system
27363 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
27364 </para>
27365 <para>
27366 If the resolver library does not support DNSSEC then this option has no effect.
27367 </para>
27368 <para>
27369 On Linux with glibc 2.31 or newer this is insufficient, the resolver library
27370 will default to stripping out a successful validation status.
27371 This will break a previously working Exim installation.
27372 Provided that you do trust the resolver (ie, is on localhost) you can tell
27373 glibc to pass through any successful validation with a new option in
27374 <filename>/etc/resolv.conf</filename>:
27375 </para>
27376 <literallayout class="monospaced">
27377 options trust-ad
27378 </literallayout>
27379 <para>
27380 <indexterm role="option">
27381 <primary><option>dns_ipv4_lookup</option></primary>
27382 </indexterm>
27383 </para>
27384 <informaltable frame="all">
27385 <tgroup cols="4" colsep="0" rowsep="0">
27386 <colspec colwidth="8*" align="left"/>
27387 <colspec colwidth="6*" align="center"/>
27388 <colspec colwidth="6*" align="center"/>
27389 <colspec colwidth="6*" align="right"/>
27390 <tbody>
27391 <row>
27392 <entry><option>dns_ipv4_lookup</option></entry>
27393 <entry>Use: <emphasis>main</emphasis></entry>
27394 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27395 <entry>Default: <emphasis>unset</emphasis></entry>
27396 </row>
27397 </tbody>
27398 </tgroup>
27399 </informaltable>
27400 <para>
27401 <indexterm role="concept">
27402 <primary>IPv6</primary>
27403 <secondary>DNS lookup for AAAA records</secondary>
27404 </indexterm>
27405 <indexterm role="concept">
27406 <primary>DNS</primary>
27407 <secondary>IPv6 lookup for AAAA records</secondary>
27408 </indexterm>
27409 <indexterm role="concept">
27410 <primary>DNS</primary>
27411 <secondary>IPv6 disabling</secondary>
27412 </indexterm>
27413 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
27414 looks for IPv6 address records (AAAA records) as well as IPv4 address records
27415 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
27416 domain matches this list.
27417 </para>
27418 <para>
27419 This is a fudge to help with name servers that give big delays or otherwise do
27420 not work for the AAAA record type. In due course, when the world&#x2019;s name
27421 servers have all been upgraded, there should be no need for this option.
27422 Note that all lookups, including those done for verification, are affected;
27423 this will result in verify failure for IPv6 connections or ones using names
27424 only valid for IPv6 addresses.
27425 </para>
27426 <para>
27427 <indexterm role="option">
27428 <primary><option>dns_retrans</option></primary>
27429 </indexterm>
27430 </para>
27431 <informaltable frame="all">
27432 <tgroup cols="4" colsep="0" rowsep="0">
27433 <colspec colwidth="8*" align="left"/>
27434 <colspec colwidth="6*" align="center"/>
27435 <colspec colwidth="6*" align="center"/>
27436 <colspec colwidth="6*" align="right"/>
27437 <tbody>
27438 <row>
27439 <entry><option>dns_retrans</option></entry>
27440 <entry>Use: <emphasis>main</emphasis></entry>
27441 <entry>Type: <emphasis>time</emphasis></entry>
27442 <entry>Default: <emphasis>0s</emphasis></entry>
27443 </row>
27444 </tbody>
27445 </tgroup>
27446 </informaltable>
27447 <para>
27448 <indexterm role="concept">
27449 <primary>DNS</primary>
27450 <secondary>resolver options</secondary>
27451 </indexterm>
27452 <indexterm role="concept">
27453 <primary>timeout</primary>
27454 <secondary>dns lookup</secondary>
27455 </indexterm>
27456 <indexterm role="concept">
27457 <primary>DNS</primary>
27458 <secondary>timeout</secondary>
27459 </indexterm>
27460 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
27461 retransmission and retry parameters for DNS lookups. Values of zero (the
27462 defaults) leave the system default settings unchanged. The first value is the
27463 time between retries, and the second is the number of retries. It isn&#x2019;t
27464 totally clear exactly how these settings affect the total time a DNS lookup may
27465 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
27466 parameter values are available in the external resolver interface structure,
27467 but nowhere does it seem to describe how they are used or what you might want
27468 to set in them.
27469 See also the <option>slow_lookup_log</option> option.
27470 </para>
27471 <para>
27472 <indexterm role="option">
27473 <primary><option>dns_retry</option></primary>
27474 </indexterm>
27475 </para>
27476 <informaltable frame="all">
27477 <tgroup cols="4" colsep="0" rowsep="0">
27478 <colspec colwidth="8*" align="left"/>
27479 <colspec colwidth="6*" align="center"/>
27480 <colspec colwidth="6*" align="center"/>
27481 <colspec colwidth="6*" align="right"/>
27482 <tbody>
27483 <row>
27484 <entry><option>dns_retry</option></entry>
27485 <entry>Use: <emphasis>main</emphasis></entry>
27486 <entry>Type: <emphasis>integer</emphasis></entry>
27487 <entry>Default: <emphasis>0</emphasis></entry>
27488 </row>
27489 </tbody>
27490 </tgroup>
27491 </informaltable>
27492 <para>
27493 See <option>dns_retrans</option> above.
27494 </para>
27495 <para>
27496 <indexterm role="option">
27497 <primary><option>dns_trust_aa</option></primary>
27498 </indexterm>
27499 </para>
27500 <informaltable frame="all">
27501 <tgroup cols="4" colsep="0" rowsep="0">
27502 <colspec colwidth="8*" align="left"/>
27503 <colspec colwidth="6*" align="center"/>
27504 <colspec colwidth="6*" align="center"/>
27505 <colspec colwidth="6*" align="right"/>
27506 <tbody>
27507 <row>
27508 <entry><option>dns_trust_aa</option></entry>
27509 <entry>Use: <emphasis>main</emphasis></entry>
27510 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27511 <entry>Default: <emphasis>unset</emphasis></entry>
27512 </row>
27513 </tbody>
27514 </tgroup>
27515 </informaltable>
27516 <para>
27517 <indexterm role="concept">
27518 <primary>DNS</primary>
27519 <secondary>resolver options</secondary>
27520 </indexterm>
27521 <indexterm role="concept">
27522 <primary>DNS</primary>
27523 <secondary>DNSSEC</secondary>
27524 </indexterm>
27525 If this option is set then lookup results marked with the AA bit
27526 (Authoritative Answer) are trusted the same way as if they were
27527 DNSSEC-verified. The authority section&#x2019;s name of the answer must
27528 match with this expanded domain list.
27529 </para>
27530 <para>
27531 Use this option only if you talk directly to a resolver that is
27532 authoritative for some zones and does not set the AD (Authentic Data)
27533 bit in the answer. Some DNS servers may have an configuration option to
27534 mark the answers from their own zones as verified (they set the AD bit).
27535 Others do not have this option. It is considered as poor practice using
27536 a resolver that is an authoritative server for some zones.
27537 </para>
27538 <para>
27539 Use this option only if you really have to (e.g. if you want
27540 to use DANE for remote delivery to a server that is listed in the DNS
27541 zones that your resolver is authoritative for).
27542 </para>
27543 <para>
27544 If the DNS answer packet has the AA bit set and contains resource record
27545 in the answer section, the name of the first NS record appearing in the
27546 authority section is compared against the list. If the answer packet is
27547 authoritative but the answer section is empty, the name of the first SOA
27548 record in the authoritative section is used instead.
27549 </para>
27550 <para>
27551 <indexterm role="concept">
27552 <primary>DNS</primary>
27553 <secondary>resolver options</secondary>
27554 </indexterm>
27555 <indexterm role="option">
27556 <primary><option>dns_use_edns0</option></primary>
27557 </indexterm>
27558 </para>
27559 <informaltable frame="all">
27560 <tgroup cols="4" colsep="0" rowsep="0">
27561 <colspec colwidth="8*" align="left"/>
27562 <colspec colwidth="6*" align="center"/>
27563 <colspec colwidth="6*" align="center"/>
27564 <colspec colwidth="6*" align="right"/>
27565 <tbody>
27566 <row>
27567 <entry><option>dns_use_edns0</option></entry>
27568 <entry>Use: <emphasis>main</emphasis></entry>
27569 <entry>Type: <emphasis>integer</emphasis></entry>
27570 <entry>Default: <emphasis>-1</emphasis></entry>
27571 </row>
27572 </tbody>
27573 </tgroup>
27574 </informaltable>
27575 <para>
27576 <indexterm role="concept">
27577 <primary>DNS</primary>
27578 <secondary>resolver options</secondary>
27579 </indexterm>
27580 <indexterm role="concept">
27581 <primary>DNS</primary>
27582 <secondary>EDNS0</secondary>
27583 </indexterm>
27584 <indexterm role="concept">
27585 <primary>DNS</primary>
27586 <secondary>OpenBSD</secondary>
27587 </indexterm>
27588 If this option is set to a non-negative number then Exim will initialise the
27589 DNS resolver library to either use or not use EDNS0 extensions, overriding
27590 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
27591 on.
27592 </para>
27593 <para>
27594 If the resolver library does not support EDNS0 then this option has no effect.
27595 </para>
27596 <para>
27597 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
27598 means that DNSSEC will not work with Exim on that platform either, unless Exim
27599 is linked against an alternative DNS client library.
27600 </para>
27601 <para>
27602 <indexterm role="option">
27603 <primary><option>drop_cr</option></primary>
27604 </indexterm>
27605 </para>
27606 <informaltable frame="all">
27607 <tgroup cols="4" colsep="0" rowsep="0">
27608 <colspec colwidth="8*" align="left"/>
27609 <colspec colwidth="6*" align="center"/>
27610 <colspec colwidth="6*" align="center"/>
27611 <colspec colwidth="6*" align="right"/>
27612 <tbody>
27613 <row>
27614 <entry><option>drop_cr</option></entry>
27615 <entry>Use: <emphasis>main</emphasis></entry>
27616 <entry>Type: <emphasis>boolean</emphasis></entry>
27617 <entry>Default: <emphasis>false</emphasis></entry>
27618 </row>
27619 </tbody>
27620 </tgroup>
27621 </informaltable>
27622 <para>
27623 This is an obsolete option that is now a no-op. It used to affect the way Exim
27624 handled CR and LF characters in incoming messages. What happens now is
27625 described in section <xref linkend="SECTlineendings"/>.
27626 </para>
27627 <para>
27628 <indexterm role="option">
27629 <primary><option>dsn_advertise_hosts</option></primary>
27630 </indexterm>
27631 </para>
27632 <informaltable frame="all">
27633 <tgroup cols="4" colsep="0" rowsep="0">
27634 <colspec colwidth="8*" align="left"/>
27635 <colspec colwidth="6*" align="center"/>
27636 <colspec colwidth="6*" align="center"/>
27637 <colspec colwidth="6*" align="right"/>
27638 <tbody>
27639 <row>
27640 <entry><option>dsn_advertise_hosts</option></entry>
27641 <entry>Use: <emphasis>main</emphasis></entry>
27642 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27643 <entry>Default: <emphasis>unset</emphasis></entry>
27644 </row>
27645 </tbody>
27646 </tgroup>
27647 </informaltable>
27648 <para>
27649 <indexterm role="concept">
27650 <primary>bounce messages</primary>
27651 <secondary>success</secondary>
27652 </indexterm>
27653 <indexterm role="concept">
27654 <primary>DSN</primary>
27655 <secondary>success</secondary>
27656 </indexterm>
27657 <indexterm role="concept">
27658 <primary>Delivery Status Notification</primary>
27659 <secondary>success</secondary>
27660 </indexterm>
27661 <indexterm role="concept">
27662 <primary>ESMTP extensions</primary>
27663 <secondary>DSN</secondary>
27664 </indexterm>
27665 DSN extensions (RFC3461) will be advertised in the EHLO message to,
27666 and accepted from, these hosts.
27667 Hosts may use the NOTIFY and ORCPT options on RCPT TO commands,
27668 and RET and ENVID options on MAIL FROM commands.
27669 A NOTIFY=SUCCESS option requests success-DSN messages.
27670 A NOTIFY= option with no argument requests that no delay or failure DSNs
27671 are sent.
27672 <emphasis role="bold">Note</emphasis>: Supplying success-DSN messages has been criticised
27673 on privacy grounds; it can leak details of internal forwarding.
27674 </para>
27675 <para>
27676 <indexterm role="option">
27677 <primary><option>dsn_from</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>dsn_from</option></entry>
27689 <entry>Use: <emphasis>main</emphasis></entry>
27690 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27691 <entry>Default: <emphasis>see below</emphasis></entry>
27692 </row>
27693 </tbody>
27694 </tgroup>
27695 </informaltable>
27696 <para>
27697 <indexterm role="concept">
27698 <primary><emphasis>From:</emphasis> header line</primary>
27699 <secondary>in bounces</secondary>
27700 </indexterm>
27701 <indexterm role="concept">
27702 <primary>bounce messages</primary>
27703 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
27704 </indexterm>
27705 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
27706 bounces and other automatically generated messages (<quote>Delivery Status
27707 Notifications</quote> &ndash; hence the name of the option). The default setting is:
27708 </para>
27709 <literallayout class="monospaced">
27710 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
27711 </literallayout>
27712 <para>
27713 The value is expanded every time it is needed. If the expansion fails, a
27714 panic is logged, and the default value is used.
27715 </para>
27716 <para>
27717 <indexterm role="option">
27718 <primary><option>envelope_to_remove</option></primary>
27719 </indexterm>
27720 </para>
27721 <informaltable frame="all">
27722 <tgroup cols="4" colsep="0" rowsep="0">
27723 <colspec colwidth="8*" align="left"/>
27724 <colspec colwidth="6*" align="center"/>
27725 <colspec colwidth="6*" align="center"/>
27726 <colspec colwidth="6*" align="right"/>
27727 <tbody>
27728 <row>
27729 <entry><option>envelope_to_remove</option></entry>
27730 <entry>Use: <emphasis>main</emphasis></entry>
27731 <entry>Type: <emphasis>boolean</emphasis></entry>
27732 <entry>Default: <emphasis>true</emphasis></entry>
27733 </row>
27734 </tbody>
27735 </tgroup>
27736 </informaltable>
27737 <para>
27738 <indexterm role="concept">
27739 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
27740 </indexterm>
27741 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
27742 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
27743 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
27744 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
27745 be present in incoming messages, and this option causes them to be removed at
27746 the time the message is received, to avoid any problems that might occur when a
27747 delivered message is subsequently sent on to some other recipient.
27748 </para>
27749 <para>
27750 <indexterm role="option">
27751 <primary><option>errors_copy</option></primary>
27752 </indexterm>
27753 </para>
27754 <informaltable frame="all">
27755 <tgroup cols="4" colsep="0" rowsep="0">
27756 <colspec colwidth="8*" align="left"/>
27757 <colspec colwidth="6*" align="center"/>
27758 <colspec colwidth="6*" align="center"/>
27759 <colspec colwidth="6*" align="right"/>
27760 <tbody>
27761 <row>
27762 <entry><option>errors_copy</option></entry>
27763 <entry>Use: <emphasis>main</emphasis></entry>
27764 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27765 <entry>Default: <emphasis>unset</emphasis></entry>
27766 </row>
27767 </tbody>
27768 </tgroup>
27769 </informaltable>
27770 <para>
27771 <indexterm role="concept">
27772 <primary>bounce message</primary>
27773 <secondary>copy to other address</secondary>
27774 </indexterm>
27775 <indexterm role="concept">
27776 <primary>copy of bounce message</primary>
27777 </indexterm>
27778 Setting this option causes Exim to send bcc copies of bounce messages that it
27779 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
27780 coming from elsewhere. The value of the option is a colon-separated list of
27781 items. Each item consists of a pattern, terminated by white space, followed by
27782 a comma-separated list of email addresses. If a pattern contains spaces, it
27783 must be enclosed in double quotes.
27784 </para>
27785 <para>
27786 Each pattern is processed in the same way as a single item in an address list
27787 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
27788 the bounce message, the message is copied to the addresses on the list. The
27789 items are scanned in order, and once a matching one is found, no further items
27790 are examined. For example:
27791 </para>
27792 <literallayout class="monospaced">
27793 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
27794               rqps@mydomain   hostmaster@mydomain.example,\
27795                               postmaster@mydomain.example
27796 </literallayout>
27797 <para>
27798 <indexterm role="variable">
27799 <primary><varname>$domain</varname></primary>
27800 </indexterm>
27801 <indexterm role="variable">
27802 <primary><varname>$local_part</varname></primary>
27803 </indexterm>
27804 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
27805 and <varname>$domain</varname> are set from the original recipient of the error message, and if
27806 there was any wildcard matching in the pattern, the expansion
27807 <indexterm role="concept">
27808 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
27809 <secondary>in <option>errors_copy</option></secondary>
27810 </indexterm>
27811 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
27812 </para>
27813 <para>
27814 <indexterm role="option">
27815 <primary><option>errors_reply_to</option></primary>
27816 </indexterm>
27817 </para>
27818 <informaltable frame="all">
27819 <tgroup cols="4" colsep="0" rowsep="0">
27820 <colspec colwidth="8*" align="left"/>
27821 <colspec colwidth="6*" align="center"/>
27822 <colspec colwidth="6*" align="center"/>
27823 <colspec colwidth="6*" align="right"/>
27824 <tbody>
27825 <row>
27826 <entry><option>errors_reply_to</option></entry>
27827 <entry>Use: <emphasis>main</emphasis></entry>
27828 <entry>Type: <emphasis>string</emphasis></entry>
27829 <entry>Default: <emphasis>unset</emphasis></entry>
27830 </row>
27831 </tbody>
27832 </tgroup>
27833 </informaltable>
27834 <para>
27835 <indexterm role="concept">
27836 <primary>bounce message</primary>
27837 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
27838 </indexterm>
27839 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
27840 </para>
27841 <literallayout>
27842 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
27843 </literallayout>
27844 <para>
27845 <indexterm role="option">
27846 <primary><option>quota_warn_message</option></primary>
27847 </indexterm>
27848 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
27849 A warning message that is generated by the <option>quota_warn_message</option> option in an
27850 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
27851 overrides the default.
27852 </para>
27853 <para>
27854 Experience shows that people reply to bounce messages. If the
27855 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
27856 and warning messages. For example:
27857 </para>
27858 <literallayout class="monospaced">
27859 errors_reply_to = postmaster@my.domain.example
27860 </literallayout>
27861 <para>
27862 The value of the option is not expanded. It must specify a valid RFC 2822
27863 address. However, if a warning message that is generated by the
27864 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
27865 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
27866 not used.
27867 </para>
27868 <para>
27869 <indexterm role="option">
27870 <primary><option>event_action</option></primary>
27871 </indexterm>
27872 </para>
27873 <informaltable frame="all">
27874 <tgroup cols="4" colsep="0" rowsep="0">
27875 <colspec colwidth="8*" align="left"/>
27876 <colspec colwidth="6*" align="center"/>
27877 <colspec colwidth="6*" align="center"/>
27878 <colspec colwidth="6*" align="right"/>
27879 <tbody>
27880 <row>
27881 <entry><option>event_action</option></entry>
27882 <entry>Use: <emphasis>main</emphasis></entry>
27883 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27884 <entry>Default: <emphasis>unset</emphasis></entry>
27885 </row>
27886 </tbody>
27887 </tgroup>
27888 </informaltable>
27889 <para>
27890 <indexterm role="concept">
27891 <primary>events</primary>
27892 </indexterm>
27893 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
27894 For details see chapter <xref linkend="CHAPevents"/>.
27895 </para>
27896 <para>
27897 <indexterm role="option">
27898 <primary><option>exim_group</option></primary>
27899 </indexterm>
27900 </para>
27901 <informaltable frame="all">
27902 <tgroup cols="4" colsep="0" rowsep="0">
27903 <colspec colwidth="8*" align="left"/>
27904 <colspec colwidth="6*" align="center"/>
27905 <colspec colwidth="6*" align="center"/>
27906 <colspec colwidth="6*" align="right"/>
27907 <tbody>
27908 <row>
27909 <entry><option>exim_group</option></entry>
27910 <entry>Use: <emphasis>main</emphasis></entry>
27911 <entry>Type: <emphasis>string</emphasis></entry>
27912 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
27913 </row>
27914 </tbody>
27915 </tgroup>
27916 </informaltable>
27917 <para>
27918 <indexterm role="concept">
27919 <primary>gid (group id)</primary>
27920 <secondary>Exim&#x2019;s own</secondary>
27921 </indexterm>
27922 <indexterm role="concept">
27923 <primary>Exim group</primary>
27924 </indexterm>
27925 This option changes the gid under which Exim runs when it gives up root
27926 privilege. The default value is compiled into the binary. The value of this
27927 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
27928 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
27929 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
27930 security issues.
27931 </para>
27932 <para>
27933 <indexterm role="option">
27934 <primary><option>exim_path</option></primary>
27935 </indexterm>
27936 </para>
27937 <informaltable frame="all">
27938 <tgroup cols="4" colsep="0" rowsep="0">
27939 <colspec colwidth="8*" align="left"/>
27940 <colspec colwidth="6*" align="center"/>
27941 <colspec colwidth="6*" align="center"/>
27942 <colspec colwidth="6*" align="right"/>
27943 <tbody>
27944 <row>
27945 <entry><option>exim_path</option></entry>
27946 <entry>Use: <emphasis>main</emphasis></entry>
27947 <entry>Type: <emphasis>string</emphasis></entry>
27948 <entry>Default: <emphasis>see below</emphasis></entry>
27949 </row>
27950 </tbody>
27951 </tgroup>
27952 </informaltable>
27953 <para>
27954 <indexterm role="concept">
27955 <primary>Exim binary, path name</primary>
27956 </indexterm>
27957 This option specifies the path name of the Exim binary, which is used when Exim
27958 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
27959 the directory configured at compile time by the BIN_DIRECTORY setting. It
27960 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
27961 other place.
27962 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
27963 you will break those Exim utilities that scan the configuration file to find
27964 where the binary is. (They then use the <option>-bP</option> option to extract option
27965 settings such as the value of <option>spool_directory</option>.)
27966 </para>
27967 <para>
27968 <indexterm role="option">
27969 <primary><option>exim_user</option></primary>
27970 </indexterm>
27971 </para>
27972 <informaltable frame="all">
27973 <tgroup cols="4" colsep="0" rowsep="0">
27974 <colspec colwidth="8*" align="left"/>
27975 <colspec colwidth="6*" align="center"/>
27976 <colspec colwidth="6*" align="center"/>
27977 <colspec colwidth="6*" align="right"/>
27978 <tbody>
27979 <row>
27980 <entry><option>exim_user</option></entry>
27981 <entry>Use: <emphasis>main</emphasis></entry>
27982 <entry>Type: <emphasis>string</emphasis></entry>
27983 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
27984 </row>
27985 </tbody>
27986 </tgroup>
27987 </informaltable>
27988 <para>
27989 <indexterm role="concept">
27990 <primary>uid (user id)</primary>
27991 <secondary>Exim&#x2019;s own</secondary>
27992 </indexterm>
27993 <indexterm role="concept">
27994 <primary>Exim user</primary>
27995 </indexterm>
27996 This option changes the uid under which Exim runs when it gives up root
27997 privilege. The default value is compiled into the binary. Ownership of the run
27998 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
27999 options is checked against the values in the binary, not what is set here.
28000 </para>
28001 <para>
28002 Unless it consists entirely of digits, the string is looked up using
28003 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
28004 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
28005 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
28006 </para>
28007 <para>
28008 <indexterm role="option">
28009 <primary><option>exim_version</option></primary>
28010 </indexterm>
28011 </para>
28012 <informaltable frame="all">
28013 <tgroup cols="4" colsep="0" rowsep="0">
28014 <colspec colwidth="8*" align="left"/>
28015 <colspec colwidth="6*" align="center"/>
28016 <colspec colwidth="6*" align="center"/>
28017 <colspec colwidth="6*" align="right"/>
28018 <tbody>
28019 <row>
28020 <entry><option>exim_version</option></entry>
28021 <entry>Use: <emphasis>main</emphasis></entry>
28022 <entry>Type: <emphasis>string</emphasis></entry>
28023 <entry>Default: <emphasis>current version</emphasis></entry>
28024 </row>
28025 </tbody>
28026 </tgroup>
28027 </informaltable>
28028 <para>
28029 <indexterm role="concept">
28030 <primary>Exim version</primary>
28031 </indexterm>
28032 <indexterm role="concept">
28033 <primary>customizing</primary>
28034 <secondary>version number</secondary>
28035 </indexterm>
28036 <indexterm role="concept">
28037 <primary>version number of Exim</primary>
28038 <secondary>override</secondary>
28039 </indexterm>
28040 This option overrides the <varname>$version_number</varname>/<varname>$exim_version</varname> that Exim reports in
28041 various places.  Use with care; this may fool stupid security scanners.
28042 </para>
28043 <para>
28044 <indexterm role="option">
28045 <primary><option>extra_local_interfaces</option></primary>
28046 </indexterm>
28047 </para>
28048 <informaltable frame="all">
28049 <tgroup cols="4" colsep="0" rowsep="0">
28050 <colspec colwidth="8*" align="left"/>
28051 <colspec colwidth="6*" align="center"/>
28052 <colspec colwidth="6*" align="center"/>
28053 <colspec colwidth="6*" align="right"/>
28054 <tbody>
28055 <row>
28056 <entry><option>extra_local_interfaces</option></entry>
28057 <entry>Use: <emphasis>main</emphasis></entry>
28058 <entry>Type: <emphasis>string list</emphasis></entry>
28059 <entry>Default: <emphasis>unset</emphasis></entry>
28060 </row>
28061 </tbody>
28062 </tgroup>
28063 </informaltable>
28064 <para>
28065 This option defines network interfaces that are to be considered local when
28066 routing, but which are not used for listening by the daemon. See section
28067 <xref linkend="SECTreclocipadd"/> for details.
28068 </para>
28069 <para>
28070 <indexterm role="option">
28071 <primary><option>extract_addresses_remove_arguments</option></primary>
28072 </indexterm>
28073 </para>
28074 <informaltable frame="all">
28075 <tgroup cols="4" colsep="0" rowsep="0">
28076 <colspec colwidth="8*" align="left"/>
28077 <colspec colwidth="6*" align="center"/>
28078 <colspec colwidth="6*" align="center"/>
28079 <colspec colwidth="6*" align="right"/>
28080 <tbody>
28081 <row>
28082 <entry><option>extract_addresses_remove_arguments</option></entry>
28083 <entry>Use: <emphasis>main</emphasis></entry>
28084 <entry>Type: <emphasis>boolean</emphasis></entry>
28085 <entry>Default: <emphasis>true</emphasis></entry>
28086 </row>
28087 </tbody>
28088 </tgroup>
28089 </informaltable>
28090 <para>
28091 <indexterm role="option">
28092 <primary><option>-t</option></primary>
28093 </indexterm>
28094 <indexterm role="concept">
28095 <primary>command line</primary>
28096 <secondary>addresses with <option>-t</option></secondary>
28097 </indexterm>
28098 <indexterm role="concept">
28099 <primary>Sendmail compatibility</primary>
28100 <secondary><option>-t</option> option</secondary>
28101 </indexterm>
28102 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
28103 are present on the command line when the <option>-t</option> option is used to build an
28104 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
28105 line addresses are removed from the recipients list. This is also how Smail
28106 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
28107 command line addresses are added to those obtained from the header lines. When
28108 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
28109 argument headers. If it is set false, Exim adds rather than removes argument
28110 addresses.
28111 </para>
28112 <para>
28113 <indexterm role="option">
28114 <primary><option>finduser_retries</option></primary>
28115 </indexterm>
28116 </para>
28117 <informaltable frame="all">
28118 <tgroup cols="4" colsep="0" rowsep="0">
28119 <colspec colwidth="8*" align="left"/>
28120 <colspec colwidth="6*" align="center"/>
28121 <colspec colwidth="6*" align="center"/>
28122 <colspec colwidth="6*" align="right"/>
28123 <tbody>
28124 <row>
28125 <entry><option>finduser_retries</option></entry>
28126 <entry>Use: <emphasis>main</emphasis></entry>
28127 <entry>Type: <emphasis>integer</emphasis></entry>
28128 <entry>Default: <emphasis>0</emphasis></entry>
28129 </row>
28130 </tbody>
28131 </tgroup>
28132 </informaltable>
28133 <para>
28134 <indexterm role="concept">
28135 <primary>NIS, retrying user lookups</primary>
28136 </indexterm>
28137 On systems running NIS or other schemes in which user and group information is
28138 distributed from a remote system, there can be times when <function>getpwnam()</function> and
28139 related functions fail, even when given valid data, because things time out.
28140 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
28141 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
28142 many extra times to find a user or a group, waiting for one second between
28143 retries.
28144 </para>
28145 <para>
28146 <indexterm role="concept">
28147 <primary><filename>/etc/passwd</filename></primary>
28148 <secondary>multiple reading of</secondary>
28149 </indexterm>
28150 You should not set this option greater than zero if your user information is in
28151 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
28152 search the file multiple times for non-existent users, and also cause delay.
28153 </para>
28154 <para>
28155 <indexterm role="option">
28156 <primary><option>freeze_tell</option></primary>
28157 </indexterm>
28158 </para>
28159 <informaltable frame="all">
28160 <tgroup cols="4" colsep="0" rowsep="0">
28161 <colspec colwidth="8*" align="left"/>
28162 <colspec colwidth="6*" align="center"/>
28163 <colspec colwidth="6*" align="center"/>
28164 <colspec colwidth="6*" align="right"/>
28165 <tbody>
28166 <row>
28167 <entry><option>freeze_tell</option></entry>
28168 <entry>Use: <emphasis>main</emphasis></entry>
28169 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
28170 <entry>Default: <emphasis>unset</emphasis></entry>
28171 </row>
28172 </tbody>
28173 </tgroup>
28174 </informaltable>
28175 <para>
28176 <indexterm role="concept">
28177 <primary>freezing messages</primary>
28178 <secondary>sending a message when freezing</secondary>
28179 </indexterm>
28180 <indexterm role="concept">
28181 <primary>frozen messages</primary>
28182 <secondary>sending a message when freezing</secondary>
28183 </indexterm>
28184 On encountering certain errors, or when configured to do so in a system filter,
28185 ACL, or special router, Exim freezes a message. This means that no further
28186 delivery attempts take place until an administrator thaws the message, or the
28187 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
28188 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
28189 warning message whenever it freezes something, unless the message it is
28190 freezing is a locally-generated bounce message. (Without this exception there
28191 is the possibility of looping.) The warning message is sent to the addresses
28192 supplied as the comma-separated value of this option. If several of the
28193 message&#x2019;s addresses cause freezing, only a single message is sent. If the
28194 freezing was automatic, the reason(s) for freezing can be found in the message
28195 log. If you configure freezing in a filter or ACL, you must arrange for any
28196 logging that you require.
28197 </para>
28198 <para>
28199 <indexterm role="option">
28200 <primary><option>gecos_name</option></primary>
28201 </indexterm>
28202 <indexterm role="option">
28203 <primary><option>gecos_pattern</option></primary>
28204 </indexterm>
28205 </para>
28206 <informaltable frame="all">
28207 <tgroup cols="4" colsep="0" rowsep="0">
28208 <colspec colwidth="8*" align="left"/>
28209 <colspec colwidth="6*" align="center"/>
28210 <colspec colwidth="6*" align="center"/>
28211 <colspec colwidth="6*" align="right"/>
28212 <tbody>
28213 <row>
28214 <entry><option>gecos_name</option></entry>
28215 <entry>Use: <emphasis>main</emphasis></entry>
28216 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28217 <entry>Default: <emphasis>unset</emphasis></entry>
28218 </row>
28219 <row>
28220 <entry><option>gecos_pattern</option></entry>
28221 <entry>Use: <emphasis>main</emphasis></entry>
28222 <entry>Type: <emphasis>string</emphasis></entry>
28223 <entry>Default: <emphasis>unset</emphasis></entry>
28224 </row>
28225 </tbody>
28226 </tgroup>
28227 </informaltable>
28228 <para>
28229 <indexterm role="concept">
28230 <primary>HP-UX</primary>
28231 </indexterm>
28232 <indexterm role="concept">
28233 <primary><quote>gecos</quote> field, parsing</primary>
28234 </indexterm>
28235 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
28236 password file to hold other information in addition to users&#x2019; real names. Exim
28237 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
28238 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
28239 of the field are used unchanged, except that, if an ampersand is encountered,
28240 it is replaced by the user&#x2019;s login name with the first character forced to
28241 upper case, since this is a convention that is observed on many systems.
28242 </para>
28243 <para>
28244 When these options are set, <option>gecos_pattern</option> is treated as a regular
28245 expression that is to be applied to the field (again with &amp; replaced by the
28246 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
28247 user&#x2019;s name.
28248 </para>
28249 <para>
28250 <indexterm role="concept">
28251 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
28252 <secondary>in <option>gecos_name</option></secondary>
28253 </indexterm>
28254 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
28255 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
28256 name terminates at the first comma, the following can be used:
28257 </para>
28258 <literallayout class="monospaced">
28259 gecos_pattern = ([^,]*)
28260 gecos_name = $1
28261 </literallayout>
28262 <para>
28263 <indexterm role="option">
28264 <primary><option>gnutls_compat_mode</option></primary>
28265 </indexterm>
28266 </para>
28267 <informaltable frame="all">
28268 <tgroup cols="4" colsep="0" rowsep="0">
28269 <colspec colwidth="8*" align="left"/>
28270 <colspec colwidth="6*" align="center"/>
28271 <colspec colwidth="6*" align="center"/>
28272 <colspec colwidth="6*" align="right"/>
28273 <tbody>
28274 <row>
28275 <entry><option>gnutls_compat_mode</option></entry>
28276 <entry>Use: <emphasis>main</emphasis></entry>
28277 <entry>Type: <emphasis>boolean</emphasis></entry>
28278 <entry>Default: <emphasis>unset</emphasis></entry>
28279 </row>
28280 </tbody>
28281 </tgroup>
28282 </informaltable>
28283 <para>
28284 This option controls whether GnuTLS is used in compatibility mode in an Exim
28285 server. This reduces security slightly, but improves interworking with older
28286 implementations of TLS.
28287 </para>
28288 <para>
28289 <indexterm role="option">
28290 <primary><option>gnutls_allow_auto_pkcs11</option></primary>
28291 </indexterm>
28292 </para>
28293 <informaltable frame="all">
28294 <tgroup cols="4" colsep="0" rowsep="0">
28295 <colspec colwidth="8*" align="left"/>
28296 <colspec colwidth="6*" align="center"/>
28297 <colspec colwidth="6*" align="center"/>
28298 <colspec colwidth="6*" align="right"/>
28299 <tbody>
28300 <row>
28301 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
28302 <entry>Use: <emphasis>main</emphasis></entry>
28303 <entry>Type: <emphasis>boolean</emphasis></entry>
28304 <entry>Default: <emphasis>unset</emphasis></entry>
28305 </row>
28306 </tbody>
28307 </tgroup>
28308 </informaltable>
28309 <para>
28310 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
28311 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
28312 </para>
28313 <para>
28314 See
28315 <emphasis role="bold"><ulink url="https://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs">https://www.gnutls.org/manual/gnutls.html#Smart-cards-and-HSMs</ulink></emphasis>
28316 for documentation.
28317 </para>
28318 <para>
28319 <indexterm role="option">
28320 <primary><option>headers_charset</option></primary>
28321 </indexterm>
28322 </para>
28323 <informaltable frame="all">
28324 <tgroup cols="4" colsep="0" rowsep="0">
28325 <colspec colwidth="8*" align="left"/>
28326 <colspec colwidth="6*" align="center"/>
28327 <colspec colwidth="6*" align="center"/>
28328 <colspec colwidth="6*" align="right"/>
28329 <tbody>
28330 <row>
28331 <entry><option>headers_charset</option></entry>
28332 <entry>Use: <emphasis>main</emphasis></entry>
28333 <entry>Type: <emphasis>string</emphasis></entry>
28334 <entry>Default: <emphasis>see below</emphasis></entry>
28335 </row>
28336 </tbody>
28337 </tgroup>
28338 </informaltable>
28339 <para>
28340 This option sets a default character set for translating from encoded MIME
28341 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
28342 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
28343 ultimate default is ISO-8859-1. For more details see the description of header
28344 insertions in section <xref linkend="SECTexpansionitems"/>.
28345 </para>
28346 <para>
28347 <indexterm role="option">
28348 <primary><option>header_maxsize</option></primary>
28349 </indexterm>
28350 </para>
28351 <informaltable frame="all">
28352 <tgroup cols="4" colsep="0" rowsep="0">
28353 <colspec colwidth="8*" align="left"/>
28354 <colspec colwidth="6*" align="center"/>
28355 <colspec colwidth="6*" align="center"/>
28356 <colspec colwidth="6*" align="right"/>
28357 <tbody>
28358 <row>
28359 <entry><option>header_maxsize</option></entry>
28360 <entry>Use: <emphasis>main</emphasis></entry>
28361 <entry>Type: <emphasis>integer</emphasis></entry>
28362 <entry>Default: <emphasis>see below</emphasis></entry>
28363 </row>
28364 </tbody>
28365 </tgroup>
28366 </informaltable>
28367 <para>
28368 <indexterm role="concept">
28369 <primary>header section</primary>
28370 <secondary>maximum size of</secondary>
28371 </indexterm>
28372 <indexterm role="concept">
28373 <primary>limit</primary>
28374 <secondary>size of message header section</secondary>
28375 </indexterm>
28376 This option controls the overall maximum size of a message&#x2019;s header
28377 section. The default is the value of HEADER_MAXSIZE in
28378 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
28379 sections are rejected.
28380 </para>
28381 <para>
28382 <indexterm role="option">
28383 <primary><option>header_line_maxsize</option></primary>
28384 </indexterm>
28385 </para>
28386 <informaltable frame="all">
28387 <tgroup cols="4" colsep="0" rowsep="0">
28388 <colspec colwidth="8*" align="left"/>
28389 <colspec colwidth="6*" align="center"/>
28390 <colspec colwidth="6*" align="center"/>
28391 <colspec colwidth="6*" align="right"/>
28392 <tbody>
28393 <row>
28394 <entry><option>header_line_maxsize</option></entry>
28395 <entry>Use: <emphasis>main</emphasis></entry>
28396 <entry>Type: <emphasis>integer</emphasis></entry>
28397 <entry>Default: <emphasis>0</emphasis></entry>
28398 </row>
28399 </tbody>
28400 </tgroup>
28401 </informaltable>
28402 <para>
28403 <indexterm role="concept">
28404 <primary>header lines</primary>
28405 <secondary>maximum size of</secondary>
28406 </indexterm>
28407 <indexterm role="concept">
28408 <primary>limit</primary>
28409 <secondary>size of one header line</secondary>
28410 </indexterm>
28411 This option limits the length of any individual header line in a message, after
28412 all the continuations have been joined together. Messages with individual
28413 header lines that are longer than the limit are rejected. The default value of
28414 zero means <quote>no limit</quote>.
28415 </para>
28416 <para>
28417 <indexterm role="option">
28418 <primary><option>helo_accept_junk_hosts</option></primary>
28419 </indexterm>
28420 </para>
28421 <informaltable frame="all">
28422 <tgroup cols="4" colsep="0" rowsep="0">
28423 <colspec colwidth="8*" align="left"/>
28424 <colspec colwidth="6*" align="center"/>
28425 <colspec colwidth="6*" align="center"/>
28426 <colspec colwidth="6*" align="right"/>
28427 <tbody>
28428 <row>
28429 <entry><option>helo_accept_junk_hosts</option></entry>
28430 <entry>Use: <emphasis>main</emphasis></entry>
28431 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28432 <entry>Default: <emphasis>unset</emphasis></entry>
28433 </row>
28434 </tbody>
28435 </tgroup>
28436 </informaltable>
28437 <para>
28438 <indexterm role="concept">
28439 <primary>HELO</primary>
28440 <secondary>accepting junk data</secondary>
28441 </indexterm>
28442 <indexterm role="concept">
28443 <primary>EHLO</primary>
28444 <secondary>accepting junk data</secondary>
28445 </indexterm>
28446 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
28447 mail, and gives an error response for invalid data. Unfortunately, there are
28448 some SMTP clients that send syntactic junk. They can be accommodated by setting
28449 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
28450 if you want to do semantic checking.
28451 See also <option>helo_allow_chars</option> for a way of extending the permitted character
28452 set.
28453 </para>
28454 <para>
28455 <indexterm role="option">
28456 <primary><option>helo_allow_chars</option></primary>
28457 </indexterm>
28458 </para>
28459 <informaltable frame="all">
28460 <tgroup cols="4" colsep="0" rowsep="0">
28461 <colspec colwidth="8*" align="left"/>
28462 <colspec colwidth="6*" align="center"/>
28463 <colspec colwidth="6*" align="center"/>
28464 <colspec colwidth="6*" align="right"/>
28465 <tbody>
28466 <row>
28467 <entry><option>helo_allow_chars</option></entry>
28468 <entry>Use: <emphasis>main</emphasis></entry>
28469 <entry>Type: <emphasis>string</emphasis></entry>
28470 <entry>Default: <emphasis>unset</emphasis></entry>
28471 </row>
28472 </tbody>
28473 </tgroup>
28474 </informaltable>
28475 <para>
28476 <indexterm role="concept">
28477 <primary>HELO</primary>
28478 <secondary>underscores in</secondary>
28479 </indexterm>
28480 <indexterm role="concept">
28481 <primary>EHLO</primary>
28482 <secondary>underscores in</secondary>
28483 </indexterm>
28484 <indexterm role="concept">
28485 <primary>underscore in EHLO/HELO</primary>
28486 </indexterm>
28487 This option can be set to a string of rogue characters that are permitted in
28488 all EHLO and HELO names in addition to the standard letters, digits,
28489 hyphens, and dots. If you really must allow underscores, you can set
28490 </para>
28491 <literallayout class="monospaced">
28492 helo_allow_chars = _
28493 </literallayout>
28494 <para>
28495 Note that the value is one string, not a list.
28496 </para>
28497 <para>
28498 <indexterm role="option">
28499 <primary><option>helo_lookup_domains</option></primary>
28500 </indexterm>
28501 </para>
28502 <informaltable frame="all">
28503 <tgroup cols="4" colsep="0" rowsep="0">
28504 <colspec colwidth="8*" align="left"/>
28505 <colspec colwidth="6*" align="center"/>
28506 <colspec colwidth="6*" align="center"/>
28507 <colspec colwidth="6*" align="right"/>
28508 <tbody>
28509 <row>
28510 <entry><option>helo_lookup_domains</option></entry>
28511 <entry>Use: <emphasis>main</emphasis></entry>
28512 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28513 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
28514 </row>
28515 </tbody>
28516 </tgroup>
28517 </informaltable>
28518 <para>
28519 <indexterm role="concept">
28520 <primary>HELO</primary>
28521 <secondary>forcing reverse lookup</secondary>
28522 </indexterm>
28523 <indexterm role="concept">
28524 <primary>EHLO</primary>
28525 <secondary>forcing reverse lookup</secondary>
28526 </indexterm>
28527 If the domain given by a client in a HELO or EHLO command matches this
28528 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
28529 default forces a lookup if the client host gives the server&#x2019;s name or any of
28530 its IP addresses (in brackets), something that broken clients have been seen to
28531 do.
28532 </para>
28533 <para>
28534 <indexterm role="option">
28535 <primary><option>helo_try_verify_hosts</option></primary>
28536 </indexterm>
28537 </para>
28538 <informaltable frame="all">
28539 <tgroup cols="4" colsep="0" rowsep="0">
28540 <colspec colwidth="8*" align="left"/>
28541 <colspec colwidth="6*" align="center"/>
28542 <colspec colwidth="6*" align="center"/>
28543 <colspec colwidth="6*" align="right"/>
28544 <tbody>
28545 <row>
28546 <entry><option>helo_try_verify_hosts</option></entry>
28547 <entry>Use: <emphasis>main</emphasis></entry>
28548 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28549 <entry>Default: <emphasis>unset</emphasis></entry>
28550 </row>
28551 </tbody>
28552 </tgroup>
28553 </informaltable>
28554 <para>
28555 <indexterm role="concept">
28556 <primary>HELO verifying</primary>
28557 <secondary>optional</secondary>
28558 </indexterm>
28559 <indexterm role="concept">
28560 <primary>EHLO</primary>
28561 <secondary>verifying, optional</secondary>
28562 </indexterm>
28563 By default, Exim just checks the syntax of HELO and EHLO commands (see
28564 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
28565 to do more extensive checking of the data supplied by these commands. The ACL
28566 condition <literal>verify = helo</literal> is provided to make this possible.
28567 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
28568 to force the check to occur. From release 4.53 onwards, this is no longer
28569 necessary. If the check has not been done before <literal>verify = helo</literal> is
28570 encountered, it is done at that time. Consequently, this option is obsolete.
28571 Its specification is retained here for backwards compatibility.
28572 </para>
28573 <para>
28574 When an EHLO or HELO command is received, if the calling host matches
28575 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
28576 EHLO command either:
28577 </para>
28578 <itemizedlist>
28579 <listitem>
28580 <para>
28581 is an IP literal matching the calling address of the host, or
28582 </para>
28583 </listitem>
28584 <listitem>
28585 <para>
28586 <indexterm role="concept">
28587 <primary>DNS</primary>
28588 <secondary>reverse lookup</secondary>
28589 </indexterm>
28590 <indexterm role="concept">
28591 <primary>reverse DNS lookup</primary>
28592 </indexterm>
28593 matches the host name that Exim obtains by doing a reverse lookup of the
28594 calling host address, or
28595 </para>
28596 </listitem>
28597 <listitem>
28598 <para>
28599 when looked up in DNS yields the calling host address.
28600 </para>
28601 </listitem>
28602 </itemizedlist>
28603 <para>
28604 However, the EHLO or HELO command is not rejected if any of the checks
28605 fail. Processing continues, but the result of the check is remembered, and can
28606 be detected later in an ACL by the <literal>verify = helo</literal> condition.
28607 </para>
28608 <para>
28609 If DNS was used for successful verification, the variable
28610 <indexterm role="concept">
28611 <primary>DNS</primary>
28612 <secondary>DNSSEC</secondary>
28613 </indexterm>
28614 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
28615 </para>
28616 <para>
28617 <indexterm role="option">
28618 <primary><option>helo_verify_hosts</option></primary>
28619 </indexterm>
28620 </para>
28621 <informaltable frame="all">
28622 <tgroup cols="4" colsep="0" rowsep="0">
28623 <colspec colwidth="8*" align="left"/>
28624 <colspec colwidth="6*" align="center"/>
28625 <colspec colwidth="6*" align="center"/>
28626 <colspec colwidth="6*" align="right"/>
28627 <tbody>
28628 <row>
28629 <entry><option>helo_verify_hosts</option></entry>
28630 <entry>Use: <emphasis>main</emphasis></entry>
28631 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28632 <entry>Default: <emphasis>unset</emphasis></entry>
28633 </row>
28634 </tbody>
28635 </tgroup>
28636 </informaltable>
28637 <para>
28638 <indexterm role="concept">
28639 <primary>HELO verifying</primary>
28640 <secondary>mandatory</secondary>
28641 </indexterm>
28642 <indexterm role="concept">
28643 <primary>EHLO</primary>
28644 <secondary>verifying, mandatory</secondary>
28645 </indexterm>
28646 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
28647 backwards compatibility. For hosts that match this option, Exim checks the host
28648 name given in the HELO or EHLO in the same way as for
28649 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
28650 rejected with a 550 error, and entries are written to the main and reject logs.
28651 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
28652 error.
28653 </para>
28654 <para>
28655 <indexterm role="option">
28656 <primary><option>hold_domains</option></primary>
28657 </indexterm>
28658 </para>
28659 <informaltable frame="all">
28660 <tgroup cols="4" colsep="0" rowsep="0">
28661 <colspec colwidth="8*" align="left"/>
28662 <colspec colwidth="6*" align="center"/>
28663 <colspec colwidth="6*" align="center"/>
28664 <colspec colwidth="6*" align="right"/>
28665 <tbody>
28666 <row>
28667 <entry><option>hold_domains</option></entry>
28668 <entry>Use: <emphasis>main</emphasis></entry>
28669 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28670 <entry>Default: <emphasis>unset</emphasis></entry>
28671 </row>
28672 </tbody>
28673 </tgroup>
28674 </informaltable>
28675 <para>
28676 <indexterm role="concept">
28677 <primary>domain</primary>
28678 <secondary>delaying delivery</secondary>
28679 </indexterm>
28680 <indexterm role="concept">
28681 <primary>delivery</primary>
28682 <secondary>delaying certain domains</secondary>
28683 </indexterm>
28684 This option allows mail for particular domains to be held in the queue
28685 manually. The option is overridden if a message delivery is forced with the
28686 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
28687 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
28688 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
28689 it is deferred every time the message is looked at.
28690 </para>
28691 <para>
28692 This option is intended as a temporary operational measure for delaying the
28693 delivery of mail while some problem is being sorted out, or some new
28694 configuration tested. If you just want to delay the processing of some
28695 domains until a queue run occurs, you should use <option>queue_domains</option> or
28696 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
28697 </para>
28698 <para>
28699 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
28700 messages from the queue if they have been there longer than the longest retry
28701 time in any retry rule. If you want to hold messages for longer than the normal
28702 retry times, insert a dummy retry rule with a long retry time.
28703 </para>
28704 <para>
28705 <indexterm role="option">
28706 <primary><option>host_lookup</option></primary>
28707 </indexterm>
28708 </para>
28709 <informaltable frame="all">
28710 <tgroup cols="4" colsep="0" rowsep="0">
28711 <colspec colwidth="8*" align="left"/>
28712 <colspec colwidth="6*" align="center"/>
28713 <colspec colwidth="6*" align="center"/>
28714 <colspec colwidth="6*" align="right"/>
28715 <tbody>
28716 <row>
28717 <entry><option>host_lookup</option></entry>
28718 <entry>Use: <emphasis>main</emphasis></entry>
28719 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28720 <entry>Default: <emphasis>unset</emphasis></entry>
28721 </row>
28722 </tbody>
28723 </tgroup>
28724 </informaltable>
28725 <para>
28726 <indexterm role="concept">
28727 <primary>host name</primary>
28728 <secondary>lookup, forcing</secondary>
28729 </indexterm>
28730 Exim does not look up the name of a calling host from its IP address unless it
28731 is required to compare against some host list, or the host matches
28732 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
28733 option (which normally contains IP addresses rather than host names). The
28734 default configuration file contains
28735 </para>
28736 <literallayout class="monospaced">
28737 host_lookup = *
28738 </literallayout>
28739 <para>
28740 which causes a lookup to happen for all hosts. If the expense of these lookups
28741 is felt to be too great, the setting can be changed or removed.
28742 </para>
28743 <para>
28744 After a successful reverse lookup, Exim does a forward lookup on the name it
28745 has obtained, to verify that it yields the IP address that it started with. If
28746 this check fails, Exim behaves as if the name lookup failed.
28747 </para>
28748 <para>
28749 <indexterm role="variable">
28750 <primary><varname>$host_lookup_failed</varname></primary>
28751 </indexterm>
28752 <indexterm role="variable">
28753 <primary><varname>$sender_host_name</varname></primary>
28754 </indexterm>
28755 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
28756 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
28757 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
28758 <literal>verify = reverse_host_lookup</literal> in ACLs.
28759 </para>
28760 <para>
28761 <indexterm role="option">
28762 <primary><option>host_lookup_order</option></primary>
28763 </indexterm>
28764 </para>
28765 <informaltable frame="all">
28766 <tgroup cols="4" colsep="0" rowsep="0">
28767 <colspec colwidth="8*" align="left"/>
28768 <colspec colwidth="6*" align="center"/>
28769 <colspec colwidth="6*" align="center"/>
28770 <colspec colwidth="6*" align="right"/>
28771 <tbody>
28772 <row>
28773 <entry><option>host_lookup_order</option></entry>
28774 <entry>Use: <emphasis>main</emphasis></entry>
28775 <entry>Type: <emphasis>string list</emphasis></entry>
28776 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
28777 </row>
28778 </tbody>
28779 </tgroup>
28780 </informaltable>
28781 <para>
28782 This option specifies the order of different lookup methods when Exim is trying
28783 to find a host name from an IP address. The default is to do a DNS lookup
28784 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
28785 if that fails. You can change the order of these lookups, or omit one entirely,
28786 if you want.
28787 </para>
28788 <para>
28789 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
28790 multiple PTR records in the DNS and the IP address is not listed in
28791 <filename>/etc/hosts</filename>. Different operating systems give different results in this
28792 case. That is why the default tries a DNS lookup first.
28793 </para>
28794 <para>
28795 <indexterm role="option">
28796 <primary><option>host_reject_connection</option></primary>
28797 </indexterm>
28798 </para>
28799 <informaltable frame="all">
28800 <tgroup cols="4" colsep="0" rowsep="0">
28801 <colspec colwidth="8*" align="left"/>
28802 <colspec colwidth="6*" align="center"/>
28803 <colspec colwidth="6*" align="center"/>
28804 <colspec colwidth="6*" align="right"/>
28805 <tbody>
28806 <row>
28807 <entry><option>host_reject_connection</option></entry>
28808 <entry>Use: <emphasis>main</emphasis></entry>
28809 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28810 <entry>Default: <emphasis>unset</emphasis></entry>
28811 </row>
28812 </tbody>
28813 </tgroup>
28814 </informaltable>
28815 <para>
28816 <indexterm role="concept">
28817 <primary>host</primary>
28818 <secondary>rejecting connections from</secondary>
28819 </indexterm>
28820 If this option is set, incoming SMTP calls from the hosts listed are rejected
28821 as soon as the connection is made.
28822 This option is obsolete, and retained only for backward compatibility, because
28823 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
28824 connections immediately.
28825 </para>
28826 <para revisionflag="changed">
28827 If the connection is on a TLS-on-connect port then the TCP connection is
28828 just dropped.  Otherwise, an SMTP error is sent first.
28829 </para>
28830 <para>
28831 The ability to give an immediate rejection (either by this option or using an
28832 ACL) is provided for use in unusual cases. Many hosts will just try again,
28833 sometimes without much delay. Normally, it is better to use an ACL to reject
28834 incoming messages at a later stage, such as after RCPT commands. See
28835 chapter <xref linkend="CHAPACL"/>.
28836 </para>
28837 <para>
28838 <indexterm role="option">
28839 <primary><option>hosts_connection_nolog</option></primary>
28840 </indexterm>
28841 </para>
28842 <informaltable frame="all">
28843 <tgroup cols="4" colsep="0" rowsep="0">
28844 <colspec colwidth="8*" align="left"/>
28845 <colspec colwidth="6*" align="center"/>
28846 <colspec colwidth="6*" align="center"/>
28847 <colspec colwidth="6*" align="right"/>
28848 <tbody>
28849 <row>
28850 <entry><option>hosts_connection_nolog</option></entry>
28851 <entry>Use: <emphasis>main</emphasis></entry>
28852 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28853 <entry>Default: <emphasis>unset</emphasis></entry>
28854 </row>
28855 </tbody>
28856 </tgroup>
28857 </informaltable>
28858 <para>
28859 <indexterm role="concept">
28860 <primary>host</primary>
28861 <secondary>not logging connections from</secondary>
28862 </indexterm>
28863 This option defines a list of hosts for which connection logging does not
28864 happen, even though the <option>smtp_connection</option> log selector is set. For example,
28865 you might want not to log SMTP connections from local processes, or from
28866 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
28867 the daemon; you should therefore strive to restrict its value to a short inline
28868 list of IP addresses and networks. To disable logging SMTP connections from
28869 local processes, you must create a host list with an empty item. For example:
28870 </para>
28871 <literallayout class="monospaced">
28872 hosts_connection_nolog = :
28873 </literallayout>
28874 <para revisionflag="changed">
28875 The hosts affected by this option also do not log "no MAIL in SMTP connection"
28876 lines, as may commonly be produced by a monitoring system.
28877 </para>
28878 <para>
28879 <indexterm role="option">
28880 <primary><option>hosts_require_alpn</option></primary>
28881 </indexterm>
28882 </para>
28883 <informaltable frame="all">
28884 <tgroup cols="4" colsep="0" rowsep="0">
28885 <colspec colwidth="8*" align="left"/>
28886 <colspec colwidth="6*" align="center"/>
28887 <colspec colwidth="6*" align="center"/>
28888 <colspec colwidth="6*" align="right"/>
28889 <tbody>
28890 <row>
28891 <entry><option>hosts_require_alpn</option></entry>
28892 <entry>Use: <emphasis>main</emphasis></entry>
28893 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28894 <entry>Default: <emphasis>unset</emphasis></entry>
28895 </row>
28896 </tbody>
28897 </tgroup>
28898 </informaltable>
28899 <para>
28900 <indexterm role="concept">
28901 <primary>ALPN</primary>
28902 <secondary>require negotiation in server</secondary>
28903 </indexterm>
28904 <indexterm role="concept">
28905 <primary>TLS</primary>
28906 <secondary>ALPN</secondary>
28907 </indexterm>
28908 <indexterm role="concept">
28909 <primary>TLS</primary>
28910 <secondary>Application Layer Protocol Names</secondary>
28911 </indexterm>
28912 If the TLS library supports ALPN
28913 then a successful negotiation of ALPN will be required for any client
28914 matching the list, for TLS to be used.
28915 See also the <option>tls_alpn</option> option.
28916 </para>
28917 <para>
28918 <emphasis role="bold">Note</emphasis>: prevention of fallback to in-clear connection is not
28919 managed by this option, and should be done separately.
28920 </para>
28921 <para>
28922 <indexterm role="option">
28923 <primary><option>hosts_require_helo</option></primary>
28924 </indexterm>
28925 </para>
28926 <informaltable frame="all">
28927 <tgroup cols="4" colsep="0" rowsep="0">
28928 <colspec colwidth="8*" align="left"/>
28929 <colspec colwidth="6*" align="center"/>
28930 <colspec colwidth="6*" align="center"/>
28931 <colspec colwidth="6*" align="right"/>
28932 <tbody>
28933 <row>
28934 <entry><option>hosts_require_helo</option></entry>
28935 <entry>Use: <emphasis>main</emphasis></entry>
28936 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28937 <entry>Default: <emphasis>*</emphasis></entry>
28938 </row>
28939 </tbody>
28940 </tgroup>
28941 </informaltable>
28942 <para>
28943 <indexterm role="concept">
28944 <primary>HELO/EHLO</primary>
28945 <secondary>requiring</secondary>
28946 </indexterm>
28947 Exim will require an accepted HELO or EHLO command from a host matching
28948 this list, before accepting a MAIL command.
28949 </para>
28950 <para>
28951 <indexterm role="option">
28952 <primary><option>hosts_proxy</option></primary>
28953 </indexterm>
28954 </para>
28955 <informaltable frame="all">
28956 <tgroup cols="4" colsep="0" rowsep="0">
28957 <colspec colwidth="8*" align="left"/>
28958 <colspec colwidth="6*" align="center"/>
28959 <colspec colwidth="6*" align="center"/>
28960 <colspec colwidth="6*" align="right"/>
28961 <tbody>
28962 <row>
28963 <entry><option>hosts_proxy</option></entry>
28964 <entry>Use: <emphasis>main</emphasis></entry>
28965 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28966 <entry>Default: <emphasis>unset</emphasis></entry>
28967 </row>
28968 </tbody>
28969 </tgroup>
28970 </informaltable>
28971 <para>
28972 <indexterm role="concept">
28973 <primary>proxy</primary>
28974 <secondary>proxy protocol</secondary>
28975 </indexterm>
28976 This option enables use of Proxy Protocol proxies for incoming
28977 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
28978 </para>
28979 <para>
28980 <indexterm role="option">
28981 <primary><option>hosts_treat_as_local</option></primary>
28982 </indexterm>
28983 </para>
28984 <informaltable frame="all">
28985 <tgroup cols="4" colsep="0" rowsep="0">
28986 <colspec colwidth="8*" align="left"/>
28987 <colspec colwidth="6*" align="center"/>
28988 <colspec colwidth="6*" align="center"/>
28989 <colspec colwidth="6*" align="right"/>
28990 <tbody>
28991 <row>
28992 <entry><option>hosts_treat_as_local</option></entry>
28993 <entry>Use: <emphasis>main</emphasis></entry>
28994 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28995 <entry>Default: <emphasis>unset</emphasis></entry>
28996 </row>
28997 </tbody>
28998 </tgroup>
28999 </informaltable>
29000 <para>
29001 <indexterm role="concept">
29002 <primary>local host</primary>
29003 <secondary>domains treated as</secondary>
29004 </indexterm>
29005 <indexterm role="concept">
29006 <primary>host</primary>
29007 <secondary>treated as local</secondary>
29008 </indexterm>
29009 If this option is set, any host names that match the domain list are treated as
29010 if they were the local host when Exim is scanning host lists obtained from MX
29011 records
29012 or other sources. Note that the value of this option is a domain list, not a
29013 host list, because it is always used to check host names, not IP addresses.
29014 </para>
29015 <para>
29016 This option also applies when Exim is matching the special items
29017 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
29018 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
29019 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
29020 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
29021 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
29022 interfaces and recognizing the local host.
29023 </para>
29024 <para>
29025 <indexterm role="option">
29026 <primary><option>ibase_servers</option></primary>
29027 </indexterm>
29028 </para>
29029 <informaltable frame="all">
29030 <tgroup cols="4" colsep="0" rowsep="0">
29031 <colspec colwidth="8*" align="left"/>
29032 <colspec colwidth="6*" align="center"/>
29033 <colspec colwidth="6*" align="center"/>
29034 <colspec colwidth="6*" align="right"/>
29035 <tbody>
29036 <row>
29037 <entry><option>ibase_servers</option></entry>
29038 <entry>Use: <emphasis>main</emphasis></entry>
29039 <entry>Type: <emphasis>string list</emphasis></entry>
29040 <entry>Default: <emphasis>unset</emphasis></entry>
29041 </row>
29042 </tbody>
29043 </tgroup>
29044 </informaltable>
29045 <para>
29046 <indexterm role="concept">
29047 <primary>InterBase</primary>
29048 <secondary>server list</secondary>
29049 </indexterm>
29050 This option provides a list of InterBase servers and associated connection data,
29051 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
29052 The option is available only if Exim has been built with InterBase support.
29053 </para>
29054 <para>
29055 <indexterm role="option">
29056 <primary><option>ignore_bounce_errors_after</option></primary>
29057 </indexterm>
29058 </para>
29059 <informaltable frame="all">
29060 <tgroup cols="4" colsep="0" rowsep="0">
29061 <colspec colwidth="8*" align="left"/>
29062 <colspec colwidth="6*" align="center"/>
29063 <colspec colwidth="6*" align="center"/>
29064 <colspec colwidth="6*" align="right"/>
29065 <tbody>
29066 <row>
29067 <entry><option>ignore_bounce_errors_after</option></entry>
29068 <entry>Use: <emphasis>main</emphasis></entry>
29069 <entry>Type: <emphasis>time</emphasis></entry>
29070 <entry>Default: <emphasis>10w</emphasis></entry>
29071 </row>
29072 </tbody>
29073 </tgroup>
29074 </informaltable>
29075 <para>
29076 <indexterm role="concept">
29077 <primary>bounce message</primary>
29078 <secondary>discarding</secondary>
29079 </indexterm>
29080 <indexterm role="concept">
29081 <primary>discarding bounce message</primary>
29082 </indexterm>
29083 This option affects the processing of bounce messages that cannot be delivered,
29084 that is, those that suffer a permanent delivery failure. (Bounce messages that
29085 suffer temporary delivery failures are of course retried in the usual way.)
29086 </para>
29087 <para>
29088 After a permanent delivery failure, bounce messages are frozen,
29089 because there is no sender to whom they can be returned. When a frozen bounce
29090 message has been in the queue for more than the given time, it is unfrozen at
29091 the next queue run, and a further delivery is attempted. If delivery fails
29092 again, the bounce message is discarded. This makes it possible to keep failed
29093 bounce messages around for a shorter time than the normal maximum retry time
29094 for frozen messages. For example,
29095 </para>
29096 <literallayout class="monospaced">
29097 ignore_bounce_errors_after = 12h
29098 </literallayout>
29099 <para>
29100 retries failed bounce message deliveries after 12 hours, discarding any further
29101 failures. If the value of this option is set to a zero time period, bounce
29102 failures are discarded immediately. Setting a very long time (as in the default
29103 value) has the effect of disabling this option. For ways of automatically
29104 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
29105 <option>timeout_frozen_after</option>.
29106 </para>
29107 <para>
29108 <indexterm role="option">
29109 <primary><option>ignore_fromline_hosts</option></primary>
29110 </indexterm>
29111 <indexterm role="option">
29112 <primary><option>ignore_fromline_local</option></primary>
29113 </indexterm>
29114 </para>
29115 <informaltable frame="all">
29116 <tgroup cols="4" colsep="0" rowsep="0">
29117 <colspec colwidth="8*" align="left"/>
29118 <colspec colwidth="6*" align="center"/>
29119 <colspec colwidth="6*" align="center"/>
29120 <colspec colwidth="6*" align="right"/>
29121 <tbody>
29122 <row>
29123 <entry><option>ignore_fromline_hosts</option></entry>
29124 <entry>Use: <emphasis>main</emphasis></entry>
29125 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29126 <entry>Default: <emphasis>unset</emphasis></entry>
29127 </row>
29128 <row>
29129 <entry><option>ignore_fromline_local</option></entry>
29130 <entry>Use: <emphasis>main</emphasis></entry>
29131 <entry>Type: <emphasis>boolean</emphasis></entry>
29132 <entry>Default: <emphasis>false</emphasis></entry>
29133 </row>
29134 </tbody>
29135 </tgroup>
29136 </informaltable>
29137 <para>
29138 <indexterm role="concept">
29139 <primary><quote>From</quote> line</primary>
29140 </indexterm>
29141 <indexterm role="concept">
29142 <primary>UUCP</primary>
29143 <secondary><quote>From</quote> line</secondary>
29144 </indexterm>
29145 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
29146 the headers of a message. By default this is treated as the start of the
29147 message&#x2019;s body, which means that any following headers are not recognized as
29148 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
29149 match those hosts that insist on sending it. If the sender is actually a local
29150 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
29151 <option>ignore_fromline_local</option> must be set to achieve this effect.
29152 </para>
29153 <para>
29154 <indexterm role="option">
29155 <primary><option>keep_environment</option></primary>
29156 </indexterm>
29157 </para>
29158 <informaltable frame="all">
29159 <tgroup cols="4" colsep="0" rowsep="0">
29160 <colspec colwidth="8*" align="left"/>
29161 <colspec colwidth="6*" align="center"/>
29162 <colspec colwidth="6*" align="center"/>
29163 <colspec colwidth="6*" align="right"/>
29164 <tbody>
29165 <row>
29166 <entry><option>keep_environment</option></entry>
29167 <entry>Use: <emphasis>main</emphasis></entry>
29168 <entry>Type: <emphasis>string list</emphasis></entry>
29169 <entry>Default: <emphasis>unset</emphasis></entry>
29170 </row>
29171 </tbody>
29172 </tgroup>
29173 </informaltable>
29174 <para>
29175 <indexterm role="concept">
29176 <primary>environment</primary>
29177 <secondary>values from</secondary>
29178 </indexterm>
29179 This option contains a string list of environment variables to keep.
29180 You have to trust these variables or you have to be sure that
29181 these variables do not impose any security risk. Keep in mind that
29182 during the startup phase Exim is running with an effective UID 0 in most
29183 installations. As the default value is an empty list, the default
29184 environment for using libraries, running embedded Perl code, or running
29185 external binaries is empty, and does not not even contain PATH or HOME.
29186 </para>
29187 <para>
29188 Actually the list is interpreted as a list of patterns
29189 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
29190 </para>
29191 <para>
29192 WARNING: Macro substitution is still done first, so having a macro
29193 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
29194 unexpected results. You may work around this using a regular expression
29195 that does not match the macro name: ^[F]OO_HOME$.
29196 </para>
29197 <para>
29198 Current versions of Exim issue a warning during startup if you do not mention
29199 <option>keep_environment</option> in your runtime configuration file and if your
29200 current environment is not empty. Future versions may not issue that warning
29201 anymore.
29202 </para>
29203 <para>
29204 See the <option>add_environment</option> main config option for a way to set
29205 environment variables to a fixed value.  The environment for <command>pipe</command>
29206 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
29207 details.
29208 </para>
29209 <para>
29210 <indexterm role="option">
29211 <primary><option>keep_malformed</option></primary>
29212 </indexterm>
29213 </para>
29214 <informaltable frame="all">
29215 <tgroup cols="4" colsep="0" rowsep="0">
29216 <colspec colwidth="8*" align="left"/>
29217 <colspec colwidth="6*" align="center"/>
29218 <colspec colwidth="6*" align="center"/>
29219 <colspec colwidth="6*" align="right"/>
29220 <tbody>
29221 <row>
29222 <entry><option>keep_malformed</option></entry>
29223 <entry>Use: <emphasis>main</emphasis></entry>
29224 <entry>Type: <emphasis>time</emphasis></entry>
29225 <entry>Default: <emphasis>4d</emphasis></entry>
29226 </row>
29227 </tbody>
29228 </tgroup>
29229 </informaltable>
29230 <para>
29231 This option specifies the length of time to keep messages whose spool files
29232 have been corrupted in some way. This should, of course, never happen. At the
29233 next attempt to deliver such a message, it gets removed. The incident is
29234 logged.
29235 </para>
29236 <para>
29237 <indexterm role="option">
29238 <primary><option>ldap_ca_cert_dir</option></primary>
29239 </indexterm>
29240 </para>
29241 <informaltable frame="all">
29242 <tgroup cols="4" colsep="0" rowsep="0">
29243 <colspec colwidth="8*" align="left"/>
29244 <colspec colwidth="6*" align="center"/>
29245 <colspec colwidth="6*" align="center"/>
29246 <colspec colwidth="6*" align="right"/>
29247 <tbody>
29248 <row>
29249 <entry><option>ldap_ca_cert_dir</option></entry>
29250 <entry>Use: <emphasis>main</emphasis></entry>
29251 <entry>Type: <emphasis>string</emphasis></entry>
29252 <entry>Default: <emphasis>unset</emphasis></entry>
29253 </row>
29254 </tbody>
29255 </tgroup>
29256 </informaltable>
29257 <para>
29258 <indexterm role="concept">
29259 <primary>LDAP</primary>
29260 <secondary>,</secondary>
29261 </indexterm>
29262 <indexterm role="concept">
29263 <primary>certificate</primary>
29264 <secondary>directory for LDAP</secondary>
29265 </indexterm>
29266 This option indicates which directory contains CA certificates for verifying
29267 a TLS certificate presented by an LDAP server.
29268 While Exim does not provide a default value, your SSL library may.
29269 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
29270 and constrained to be a directory.
29271 </para>
29272 <para>
29273 <indexterm role="option">
29274 <primary><option>ldap_ca_cert_file</option></primary>
29275 </indexterm>
29276 </para>
29277 <informaltable frame="all">
29278 <tgroup cols="4" colsep="0" rowsep="0">
29279 <colspec colwidth="8*" align="left"/>
29280 <colspec colwidth="6*" align="center"/>
29281 <colspec colwidth="6*" align="center"/>
29282 <colspec colwidth="6*" align="right"/>
29283 <tbody>
29284 <row>
29285 <entry><option>ldap_ca_cert_file</option></entry>
29286 <entry>Use: <emphasis>main</emphasis></entry>
29287 <entry>Type: <emphasis>string</emphasis></entry>
29288 <entry>Default: <emphasis>unset</emphasis></entry>
29289 </row>
29290 </tbody>
29291 </tgroup>
29292 </informaltable>
29293 <para>
29294 <indexterm role="concept">
29295 <primary>LDAP</primary>
29296 <secondary>,</secondary>
29297 </indexterm>
29298 <indexterm role="concept">
29299 <primary>certificate</primary>
29300 <secondary>file for LDAP</secondary>
29301 </indexterm>
29302 This option indicates which file contains CA certificates for verifying
29303 a TLS certificate presented by an LDAP server.
29304 While Exim does not provide a default value, your SSL library may.
29305 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
29306 and constrained to be a file.
29307 </para>
29308 <para>
29309 <indexterm role="option">
29310 <primary><option>ldap_cert_file</option></primary>
29311 </indexterm>
29312 </para>
29313 <informaltable frame="all">
29314 <tgroup cols="4" colsep="0" rowsep="0">
29315 <colspec colwidth="8*" align="left"/>
29316 <colspec colwidth="6*" align="center"/>
29317 <colspec colwidth="6*" align="center"/>
29318 <colspec colwidth="6*" align="right"/>
29319 <tbody>
29320 <row>
29321 <entry><option>ldap_cert_file</option></entry>
29322 <entry>Use: <emphasis>main</emphasis></entry>
29323 <entry>Type: <emphasis>string</emphasis></entry>
29324 <entry>Default: <emphasis>unset</emphasis></entry>
29325 </row>
29326 </tbody>
29327 </tgroup>
29328 </informaltable>
29329 <para>
29330 <indexterm role="concept">
29331 <primary>LDAP</primary>
29332 <secondary>TLS client certificate file</secondary>
29333 </indexterm>
29334 <indexterm role="concept">
29335 <primary>certificate</primary>
29336 <secondary>file for LDAP</secondary>
29337 </indexterm>
29338 This option indicates which file contains an TLS client certificate which
29339 Exim should present to the LDAP server during TLS negotiation.
29340 Should be used together with <option>ldap_cert_key</option>.
29341 </para>
29342 <para>
29343 <indexterm role="option">
29344 <primary><option>ldap_cert_key</option></primary>
29345 </indexterm>
29346 </para>
29347 <informaltable frame="all">
29348 <tgroup cols="4" colsep="0" rowsep="0">
29349 <colspec colwidth="8*" align="left"/>
29350 <colspec colwidth="6*" align="center"/>
29351 <colspec colwidth="6*" align="center"/>
29352 <colspec colwidth="6*" align="right"/>
29353 <tbody>
29354 <row>
29355 <entry><option>ldap_cert_key</option></entry>
29356 <entry>Use: <emphasis>main</emphasis></entry>
29357 <entry>Type: <emphasis>string</emphasis></entry>
29358 <entry>Default: <emphasis>unset</emphasis></entry>
29359 </row>
29360 </tbody>
29361 </tgroup>
29362 </informaltable>
29363 <para>
29364 <indexterm role="concept">
29365 <primary>LDAP</primary>
29366 <secondary>TLS client key file</secondary>
29367 </indexterm>
29368 <indexterm role="concept">
29369 <primary>certificate</primary>
29370 <secondary>key for LDAP</secondary>
29371 </indexterm>
29372 This option indicates which file contains the secret/private key to use
29373 to prove identity to the LDAP server during TLS negotiation.
29374 Should be used together with <option>ldap_cert_file</option>, which contains the
29375 identity to be proven.
29376 </para>
29377 <para>
29378 <indexterm role="option">
29379 <primary><option>ldap_cipher_suite</option></primary>
29380 </indexterm>
29381 </para>
29382 <informaltable frame="all">
29383 <tgroup cols="4" colsep="0" rowsep="0">
29384 <colspec colwidth="8*" align="left"/>
29385 <colspec colwidth="6*" align="center"/>
29386 <colspec colwidth="6*" align="center"/>
29387 <colspec colwidth="6*" align="right"/>
29388 <tbody>
29389 <row>
29390 <entry><option>ldap_cipher_suite</option></entry>
29391 <entry>Use: <emphasis>main</emphasis></entry>
29392 <entry>Type: <emphasis>string</emphasis></entry>
29393 <entry>Default: <emphasis>unset</emphasis></entry>
29394 </row>
29395 </tbody>
29396 </tgroup>
29397 </informaltable>
29398 <para>
29399 <indexterm role="concept">
29400 <primary>LDAP</primary>
29401 <secondary>TLS cipher suite</secondary>
29402 </indexterm>
29403 This controls the TLS cipher-suite negotiation during TLS negotiation with
29404 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
29405 cipher-suite options with OpenSSL (as used by LDAP client libraries).
29406 </para>
29407 <para>
29408 <indexterm role="option">
29409 <primary><option>ldap_default_servers</option></primary>
29410 </indexterm>
29411 </para>
29412 <informaltable frame="all">
29413 <tgroup cols="4" colsep="0" rowsep="0">
29414 <colspec colwidth="8*" align="left"/>
29415 <colspec colwidth="6*" align="center"/>
29416 <colspec colwidth="6*" align="center"/>
29417 <colspec colwidth="6*" align="right"/>
29418 <tbody>
29419 <row>
29420 <entry><option>ldap_default_servers</option></entry>
29421 <entry>Use: <emphasis>main</emphasis></entry>
29422 <entry>Type: <emphasis>string list</emphasis></entry>
29423 <entry>Default: <emphasis>unset</emphasis></entry>
29424 </row>
29425 </tbody>
29426 </tgroup>
29427 </informaltable>
29428 <para>
29429 <indexterm role="concept">
29430 <primary>LDAP</primary>
29431 <secondary>default servers</secondary>
29432 </indexterm>
29433 This option provides a list of LDAP servers which are tried in turn when an
29434 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
29435 details of LDAP queries. This option is available only when Exim has been built
29436 with LDAP support.
29437 </para>
29438 <para>
29439 <indexterm role="option">
29440 <primary><option>ldap_require_cert</option></primary>
29441 </indexterm>
29442 </para>
29443 <informaltable frame="all">
29444 <tgroup cols="4" colsep="0" rowsep="0">
29445 <colspec colwidth="8*" align="left"/>
29446 <colspec colwidth="6*" align="center"/>
29447 <colspec colwidth="6*" align="center"/>
29448 <colspec colwidth="6*" align="right"/>
29449 <tbody>
29450 <row>
29451 <entry><option>ldap_require_cert</option></entry>
29452 <entry>Use: <emphasis>main</emphasis></entry>
29453 <entry>Type: <emphasis>string</emphasis></entry>
29454 <entry>Default: <emphasis>unset.</emphasis></entry>
29455 </row>
29456 </tbody>
29457 </tgroup>
29458 </informaltable>
29459 <para>
29460 <indexterm role="concept">
29461 <primary>LDAP</primary>
29462 <secondary>policy for LDAP server TLS cert presentation</secondary>
29463 </indexterm>
29464 This should be one of the values "hard", "demand", "allow", "try" or "never".
29465 A value other than one of these is interpreted as "never".
29466 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
29467 Although Exim does not set a default, the LDAP library probably defaults
29468 to hard/demand.
29469 </para>
29470 <para>
29471 <indexterm role="option">
29472 <primary><option>ldap_start_tls</option></primary>
29473 </indexterm>
29474 </para>
29475 <informaltable frame="all">
29476 <tgroup cols="4" colsep="0" rowsep="0">
29477 <colspec colwidth="8*" align="left"/>
29478 <colspec colwidth="6*" align="center"/>
29479 <colspec colwidth="6*" align="center"/>
29480 <colspec colwidth="6*" align="right"/>
29481 <tbody>
29482 <row>
29483 <entry><option>ldap_start_tls</option></entry>
29484 <entry>Use: <emphasis>main</emphasis></entry>
29485 <entry>Type: <emphasis>boolean</emphasis></entry>
29486 <entry>Default: <emphasis>false</emphasis></entry>
29487 </row>
29488 </tbody>
29489 </tgroup>
29490 </informaltable>
29491 <para>
29492 <indexterm role="concept">
29493 <primary>LDAP</primary>
29494 <secondary>whether or not to negotiate TLS</secondary>
29495 </indexterm>
29496 If set, Exim will attempt to negotiate TLS with the LDAP server when
29497 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
29498 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
29499 of SSL-on-connect.
29500 In the event of failure to negotiate TLS, the action taken is controlled
29501 by <option>ldap_require_cert</option>.
29502 This option is ignored for <literal>ldapi</literal> connections.
29503 </para>
29504 <para>
29505 <indexterm role="option">
29506 <primary><option>ldap_version</option></primary>
29507 </indexterm>
29508 </para>
29509 <informaltable frame="all">
29510 <tgroup cols="4" colsep="0" rowsep="0">
29511 <colspec colwidth="8*" align="left"/>
29512 <colspec colwidth="6*" align="center"/>
29513 <colspec colwidth="6*" align="center"/>
29514 <colspec colwidth="6*" align="right"/>
29515 <tbody>
29516 <row>
29517 <entry><option>ldap_version</option></entry>
29518 <entry>Use: <emphasis>main</emphasis></entry>
29519 <entry>Type: <emphasis>integer</emphasis></entry>
29520 <entry>Default: <emphasis>unset</emphasis></entry>
29521 </row>
29522 </tbody>
29523 </tgroup>
29524 </informaltable>
29525 <para>
29526 <indexterm role="concept">
29527 <primary>LDAP</primary>
29528 <secondary>protocol version, forcing</secondary>
29529 </indexterm>
29530 This option can be used to force Exim to set a specific protocol version for
29531 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
29532 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
29533 the LDAP headers; otherwise it is 2. This option is available only when Exim
29534 has been built with LDAP support.
29535 </para>
29536 <para>
29537 <indexterm role="option">
29538 <primary><option>local_from_check</option></primary>
29539 </indexterm>
29540 </para>
29541 <informaltable frame="all">
29542 <tgroup cols="4" colsep="0" rowsep="0">
29543 <colspec colwidth="8*" align="left"/>
29544 <colspec colwidth="6*" align="center"/>
29545 <colspec colwidth="6*" align="center"/>
29546 <colspec colwidth="6*" align="right"/>
29547 <tbody>
29548 <row>
29549 <entry><option>local_from_check</option></entry>
29550 <entry>Use: <emphasis>main</emphasis></entry>
29551 <entry>Type: <emphasis>boolean</emphasis></entry>
29552 <entry>Default: <emphasis>true</emphasis></entry>
29553 </row>
29554 </tbody>
29555 </tgroup>
29556 </informaltable>
29557 <para>
29558 <indexterm role="concept">
29559 <primary><emphasis>Sender:</emphasis> header line</primary>
29560 <secondary>disabling addition of</secondary>
29561 </indexterm>
29562 <indexterm role="concept">
29563 <primary><emphasis>From:</emphasis> header line</primary>
29564 <secondary>disabling checking of</secondary>
29565 </indexterm>
29566 When a message is submitted locally (that is, not over a TCP/IP connection) by
29567 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
29568 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
29569 the domain specified by <option>qualify_domain</option>.
29570 </para>
29571 <para>
29572 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
29573 locally submitted message is automatically qualified by Exim, unless the
29574 <option>-bnq</option> command line option is used.
29575 </para>
29576 <para>
29577 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
29578 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
29579 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
29580 and the default qualify domain.
29581 </para>
29582 <para>
29583 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
29584 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
29585 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
29586 <option>local_sender_retain</option> to be true.
29587 </para>
29588 <para>
29589 <indexterm role="concept">
29590 <primary>envelope from</primary>
29591 </indexterm>
29592 <indexterm role="concept">
29593 <primary>envelope sender</primary>
29594 </indexterm>
29595 These options affect only the header lines in the message. The envelope sender
29596 is still forced to be the login id at the qualify domain unless
29597 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
29598 </para>
29599 <para>
29600 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
29601 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
29602 has more details about <emphasis>Sender:</emphasis> processing.
29603 </para>
29604 <para>
29605 <indexterm role="option">
29606 <primary><option>local_from_prefix</option></primary>
29607 </indexterm>
29608 <indexterm role="option">
29609 <primary><option>local_from_suffix</option></primary>
29610 </indexterm>
29611 </para>
29612 <informaltable frame="all">
29613 <tgroup cols="4" colsep="0" rowsep="0">
29614 <colspec colwidth="8*" align="left"/>
29615 <colspec colwidth="6*" align="center"/>
29616 <colspec colwidth="6*" align="center"/>
29617 <colspec colwidth="6*" align="right"/>
29618 <tbody>
29619 <row>
29620 <entry><option>local_from_prefix</option></entry>
29621 <entry>Use: <emphasis>main</emphasis></entry>
29622 <entry>Type: <emphasis>string</emphasis></entry>
29623 <entry>Default: <emphasis>unset</emphasis></entry>
29624 </row>
29625 <row>
29626 <entry><option>local_from_suffix</option></entry>
29627 <entry>Use: <emphasis>main</emphasis></entry>
29628 <entry>Type: <emphasis>string</emphasis></entry>
29629 <entry>Default: <emphasis>unset</emphasis></entry>
29630 </row>
29631 </tbody>
29632 </tgroup>
29633 </informaltable>
29634 <para>
29635 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
29636 matching the login id (see <option>local_from_check</option> above), it can be configured to
29637 ignore certain prefixes and suffixes in the local part of the address. This is
29638 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
29639 appropriate lists, in the same form as the <option>local_part_prefix</option> and
29640 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
29641 example, if
29642 </para>
29643 <literallayout class="monospaced">
29644 local_from_prefix = *-
29645 </literallayout>
29646 <para>
29647 is set, a <emphasis>From:</emphasis> line containing
29648 </para>
29649 <literallayout class="monospaced">
29650 From: anything-user@your.domain.example
29651 </literallayout>
29652 <para>
29653 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
29654 matches the actual sender address that is constructed from the login name and
29655 qualify domain.
29656 </para>
29657 <para>
29658 <indexterm role="option">
29659 <primary><option>local_interfaces</option></primary>
29660 </indexterm>
29661 </para>
29662 <informaltable frame="all">
29663 <tgroup cols="4" colsep="0" rowsep="0">
29664 <colspec colwidth="8*" align="left"/>
29665 <colspec colwidth="6*" align="center"/>
29666 <colspec colwidth="6*" align="center"/>
29667 <colspec colwidth="6*" align="right"/>
29668 <tbody>
29669 <row>
29670 <entry><option>local_interfaces</option></entry>
29671 <entry>Use: <emphasis>main</emphasis></entry>
29672 <entry>Type: <emphasis>string list</emphasis></entry>
29673 <entry>Default: <emphasis>see below</emphasis></entry>
29674 </row>
29675 </tbody>
29676 </tgroup>
29677 </informaltable>
29678 <para>
29679 This option controls which network interfaces are used by the daemon for
29680 listening; they are also used to identify the local host when routing. Chapter
29681 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
29682 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
29683 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
29684 <option>local_interfaces</option> is
29685 </para>
29686 <literallayout class="monospaced">
29687 local_interfaces = 0.0.0.0
29688 </literallayout>
29689 <para>
29690 when Exim is built without IPv6 support; otherwise it is
29691 </para>
29692 <literallayout class="monospaced">
29693 local_interfaces = &lt;; ::0 ; 0.0.0.0
29694 </literallayout>
29695 <para>
29696 <indexterm role="option">
29697 <primary><option>local_scan_timeout</option></primary>
29698 </indexterm>
29699 </para>
29700 <informaltable frame="all">
29701 <tgroup cols="4" colsep="0" rowsep="0">
29702 <colspec colwidth="8*" align="left"/>
29703 <colspec colwidth="6*" align="center"/>
29704 <colspec colwidth="6*" align="center"/>
29705 <colspec colwidth="6*" align="right"/>
29706 <tbody>
29707 <row>
29708 <entry><option>local_scan_timeout</option></entry>
29709 <entry>Use: <emphasis>main</emphasis></entry>
29710 <entry>Type: <emphasis>time</emphasis></entry>
29711 <entry>Default: <emphasis>5m</emphasis></entry>
29712 </row>
29713 </tbody>
29714 </tgroup>
29715 </informaltable>
29716 <para>
29717 <indexterm role="concept">
29718 <primary>timeout</primary>
29719 <secondary>for <function>local_scan()</function> function</secondary>
29720 </indexterm>
29721 <indexterm role="concept">
29722 <primary><function>local_scan()</function> function</primary>
29723 <secondary>timeout</secondary>
29724 </indexterm>
29725 This timeout applies to the <function>local_scan()</function> function (see chapter
29726 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
29727 the incoming message is rejected with a temporary error if it is an SMTP
29728 message. For a non-SMTP message, the message is dropped and Exim ends with a
29729 non-zero code. The incident is logged on the main and reject logs.
29730 </para>
29731 <para>
29732 <indexterm role="option">
29733 <primary><option>local_sender_retain</option></primary>
29734 </indexterm>
29735 </para>
29736 <informaltable frame="all">
29737 <tgroup cols="4" colsep="0" rowsep="0">
29738 <colspec colwidth="8*" align="left"/>
29739 <colspec colwidth="6*" align="center"/>
29740 <colspec colwidth="6*" align="center"/>
29741 <colspec colwidth="6*" align="right"/>
29742 <tbody>
29743 <row>
29744 <entry><option>local_sender_retain</option></entry>
29745 <entry>Use: <emphasis>main</emphasis></entry>
29746 <entry>Type: <emphasis>boolean</emphasis></entry>
29747 <entry>Default: <emphasis>false</emphasis></entry>
29748 </row>
29749 </tbody>
29750 </tgroup>
29751 </informaltable>
29752 <para>
29753 <indexterm role="concept">
29754 <primary><emphasis>Sender:</emphasis> header line</primary>
29755 <secondary>retaining from local submission</secondary>
29756 </indexterm>
29757 When a message is submitted locally (that is, not over a TCP/IP connection) by
29758 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
29759 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
29760 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
29761 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
29762 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
29763 </para>
29764 <para>
29765 <indexterm role="option">
29766 <primary><option>localhost_number</option></primary>
29767 </indexterm>
29768 </para>
29769 <informaltable frame="all">
29770 <tgroup cols="4" colsep="0" rowsep="0">
29771 <colspec colwidth="8*" align="left"/>
29772 <colspec colwidth="6*" align="center"/>
29773 <colspec colwidth="6*" align="center"/>
29774 <colspec colwidth="6*" align="right"/>
29775 <tbody>
29776 <row>
29777 <entry><option>localhost_number</option></entry>
29778 <entry>Use: <emphasis>main</emphasis></entry>
29779 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29780 <entry>Default: <emphasis>unset</emphasis></entry>
29781 </row>
29782 </tbody>
29783 </tgroup>
29784 </informaltable>
29785 <para>
29786 <indexterm role="concept">
29787 <primary>host</primary>
29788 <secondary>locally unique number for</secondary>
29789 </indexterm>
29790 <indexterm role="concept">
29791 <primary>message ids</primary>
29792 <secondary>with multiple hosts</secondary>
29793 </indexterm>
29794 <indexterm role="variable">
29795 <primary><varname>$localhost_number</varname></primary>
29796 </indexterm>
29797 Exim&#x2019;s message ids are normally unique only within the local host. If
29798 uniqueness among a set of hosts is required, each host must set a different
29799 value for the <option>localhost_number</option> option. The string is expanded immediately
29800 after reading the configuration file (so that a number can be computed from the
29801 host name, for example) and the result of the expansion must be a number in the
29802 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
29803 systems). This is available in subsequent string expansions via the variable
29804 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
29805 characters of the message id, instead of just being a fractional part of the
29806 time, are computed from the time and the local host number as described in
29807 section <xref linkend="SECTmessiden"/>.
29808 </para>
29809 <para>
29810 <indexterm role="option">
29811 <primary><option>log_file_path</option></primary>
29812 </indexterm>
29813 </para>
29814 <informaltable frame="all">
29815 <tgroup cols="4" colsep="0" rowsep="0">
29816 <colspec colwidth="8*" align="left"/>
29817 <colspec colwidth="6*" align="center"/>
29818 <colspec colwidth="6*" align="center"/>
29819 <colspec colwidth="6*" align="right"/>
29820 <tbody>
29821 <row>
29822 <entry><option>log_file_path</option></entry>
29823 <entry>Use: <emphasis>main</emphasis></entry>
29824 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29825 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29826 </row>
29827 </tbody>
29828 </tgroup>
29829 </informaltable>
29830 <para>
29831 <indexterm role="concept">
29832 <primary>log</primary>
29833 <secondary>file path for</secondary>
29834 </indexterm>
29835 This option sets the path which is used to determine the names of Exim&#x2019;s log
29836 files, or indicates that logging is to be to syslog, or both. It is expanded
29837 when Exim is entered, so it can, for example, contain a reference to the host
29838 name. If no specific path is set for the log files at compile or runtime,
29839 or if the option is unset at runtime (i.e.  <literal>log_file_path = </literal>)
29840 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
29841 A path must start with a slash.
29842 To send to syslog, use the word <quote>syslog</quote>.
29843 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
29844 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
29845 used. If this string is fixed at your installation (contains no expansion
29846 variables) it is recommended that you do not set this option in the
29847 configuration file, but instead supply the path using LOG_FILE_PATH in
29848 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
29849 early on &ndash; in particular, failure to read the configuration file.
29850 </para>
29851 <para>
29852 <indexterm role="option">
29853 <primary><option>log_selector</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>log_selector</option></entry>
29865 <entry>Use: <emphasis>main</emphasis></entry>
29866 <entry>Type: <emphasis>string</emphasis></entry>
29867 <entry>Default: <emphasis>unset</emphasis></entry>
29868 </row>
29869 </tbody>
29870 </tgroup>
29871 </informaltable>
29872 <para>
29873 <indexterm role="concept">
29874 <primary>log</primary>
29875 <secondary>selectors</secondary>
29876 </indexterm>
29877 This option can be used to reduce or increase the number of things that Exim
29878 writes to its log files. Its argument is made up of names preceded by plus or
29879 minus characters. For example:
29880 </para>
29881 <literallayout class="monospaced">
29882 log_selector = +arguments -retry_defer
29883 </literallayout>
29884 <para>
29885 A list of possible names and what they control is given in the chapter on
29886 logging, in section <xref linkend="SECTlogselector"/>.
29887 </para>
29888 <para>
29889 <indexterm role="option">
29890 <primary><option>log_timezone</option></primary>
29891 </indexterm>
29892 </para>
29893 <informaltable frame="all">
29894 <tgroup cols="4" colsep="0" rowsep="0">
29895 <colspec colwidth="8*" align="left"/>
29896 <colspec colwidth="6*" align="center"/>
29897 <colspec colwidth="6*" align="center"/>
29898 <colspec colwidth="6*" align="right"/>
29899 <tbody>
29900 <row>
29901 <entry><option>log_timezone</option></entry>
29902 <entry>Use: <emphasis>main</emphasis></entry>
29903 <entry>Type: <emphasis>boolean</emphasis></entry>
29904 <entry>Default: <emphasis>false</emphasis></entry>
29905 </row>
29906 </tbody>
29907 </tgroup>
29908 </informaltable>
29909 <para>
29910 <indexterm role="concept">
29911 <primary>log</primary>
29912 <secondary>timezone for entries</secondary>
29913 </indexterm>
29914 <indexterm role="variable">
29915 <primary><varname>$tod_log</varname></primary>
29916 </indexterm>
29917 <indexterm role="variable">
29918 <primary><varname>$tod_zone</varname></primary>
29919 </indexterm>
29920 By default, the timestamps on log lines are in local time without the
29921 timezone. This means that if your timezone changes twice a year, the timestamps
29922 in log lines are ambiguous for an hour when the clocks go back. One way of
29923 avoiding this problem is to set the timezone to UTC. An alternative is to set
29924 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
29925 timestamps in log lines. Turning on this option can add quite a lot to the size
29926 of log files because each line is extended by 6 characters. Note that the
29927 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
29928 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
29929 </para>
29930 <para>
29931 <indexterm role="option">
29932 <primary><option>lookup_open_max</option></primary>
29933 </indexterm>
29934 </para>
29935 <informaltable frame="all">
29936 <tgroup cols="4" colsep="0" rowsep="0">
29937 <colspec colwidth="8*" align="left"/>
29938 <colspec colwidth="6*" align="center"/>
29939 <colspec colwidth="6*" align="center"/>
29940 <colspec colwidth="6*" align="right"/>
29941 <tbody>
29942 <row>
29943 <entry><option>lookup_open_max</option></entry>
29944 <entry>Use: <emphasis>main</emphasis></entry>
29945 <entry>Type: <emphasis>integer</emphasis></entry>
29946 <entry>Default: <emphasis>25</emphasis></entry>
29947 </row>
29948 </tbody>
29949 </tgroup>
29950 </informaltable>
29951 <para>
29952 <indexterm role="concept">
29953 <primary>too many open files</primary>
29954 </indexterm>
29955 <indexterm role="concept">
29956 <primary>open files, too many</primary>
29957 </indexterm>
29958 <indexterm role="concept">
29959 <primary>file</primary>
29960 <secondary>too many open</secondary>
29961 </indexterm>
29962 <indexterm role="concept">
29963 <primary>lookup</primary>
29964 <secondary>maximum open files</secondary>
29965 </indexterm>
29966 <indexterm role="concept">
29967 <primary>limit</primary>
29968 <secondary>open files for lookups</secondary>
29969 </indexterm>
29970 This option limits the number of simultaneously open files for single-key
29971 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
29972 Exim normally keeps these files open during routing, because often the same
29973 file is required several times. If the limit is reached, Exim closes the least
29974 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
29975 actually opens two files for each logical DBM database, though it still counts
29976 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
29977 open files</quote> errors with NDBM, you need to reduce the value of
29978 <option>lookup_open_max</option>.
29979 </para>
29980 <para>
29981 <indexterm role="option">
29982 <primary><option>max_username_length</option></primary>
29983 </indexterm>
29984 </para>
29985 <informaltable frame="all">
29986 <tgroup cols="4" colsep="0" rowsep="0">
29987 <colspec colwidth="8*" align="left"/>
29988 <colspec colwidth="6*" align="center"/>
29989 <colspec colwidth="6*" align="center"/>
29990 <colspec colwidth="6*" align="right"/>
29991 <tbody>
29992 <row>
29993 <entry><option>max_username_length</option></entry>
29994 <entry>Use: <emphasis>main</emphasis></entry>
29995 <entry>Type: <emphasis>integer</emphasis></entry>
29996 <entry>Default: <emphasis>0</emphasis></entry>
29997 </row>
29998 </tbody>
29999 </tgroup>
30000 </informaltable>
30001 <para>
30002 <indexterm role="concept">
30003 <primary>length of login name</primary>
30004 </indexterm>
30005 <indexterm role="concept">
30006 <primary>user name</primary>
30007 <secondary>maximum length</secondary>
30008 </indexterm>
30009 <indexterm role="concept">
30010 <primary>limit</primary>
30011 <secondary>user name length</secondary>
30012 </indexterm>
30013 Some operating systems are broken in that they truncate long arguments to
30014 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
30015 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
30016 an argument that is longer behaves as if <function>getpwnam()</function> failed.
30017 </para>
30018 <para>
30019 <indexterm role="option">
30020 <primary><option>message_body_newlines</option></primary>
30021 </indexterm>
30022 </para>
30023 <informaltable frame="all">
30024 <tgroup cols="4" colsep="0" rowsep="0">
30025 <colspec colwidth="8*" align="left"/>
30026 <colspec colwidth="6*" align="center"/>
30027 <colspec colwidth="6*" align="center"/>
30028 <colspec colwidth="6*" align="right"/>
30029 <tbody>
30030 <row>
30031 <entry><option>message_body_newlines</option></entry>
30032 <entry>Use: <emphasis>main</emphasis></entry>
30033 <entry>Type: <emphasis>bool</emphasis></entry>
30034 <entry>Default: <emphasis>false</emphasis></entry>
30035 </row>
30036 </tbody>
30037 </tgroup>
30038 </informaltable>
30039 <para>
30040 <indexterm role="concept">
30041 <primary>message body</primary>
30042 <secondary>newlines in variables</secondary>
30043 </indexterm>
30044 <indexterm role="concept">
30045 <primary>newline</primary>
30046 <secondary>in message body variables</secondary>
30047 </indexterm>
30048 <indexterm role="variable">
30049 <primary><varname>$message_body</varname></primary>
30050 </indexterm>
30051 <indexterm role="variable">
30052 <primary><varname>$message_body_end</varname></primary>
30053 </indexterm>
30054 By default, newlines in the message body are replaced by spaces when setting
30055 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
30056 option is set true, this no longer happens.
30057 </para>
30058 <para>
30059 <indexterm role="option">
30060 <primary><option>message_body_visible</option></primary>
30061 </indexterm>
30062 </para>
30063 <informaltable frame="all">
30064 <tgroup cols="4" colsep="0" rowsep="0">
30065 <colspec colwidth="8*" align="left"/>
30066 <colspec colwidth="6*" align="center"/>
30067 <colspec colwidth="6*" align="center"/>
30068 <colspec colwidth="6*" align="right"/>
30069 <tbody>
30070 <row>
30071 <entry><option>message_body_visible</option></entry>
30072 <entry>Use: <emphasis>main</emphasis></entry>
30073 <entry>Type: <emphasis>integer</emphasis></entry>
30074 <entry>Default: <emphasis>500</emphasis></entry>
30075 </row>
30076 </tbody>
30077 </tgroup>
30078 </informaltable>
30079 <para>
30080 <indexterm role="concept">
30081 <primary>body of message</primary>
30082 <secondary>visible size</secondary>
30083 </indexterm>
30084 <indexterm role="concept">
30085 <primary>message body</primary>
30086 <secondary>visible size</secondary>
30087 </indexterm>
30088 <indexterm role="variable">
30089 <primary><varname>$message_body</varname></primary>
30090 </indexterm>
30091 <indexterm role="variable">
30092 <primary><varname>$message_body_end</varname></primary>
30093 </indexterm>
30094 This option specifies how much of a message&#x2019;s body is to be included in the
30095 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
30096 </para>
30097 <para>
30098 <indexterm role="option">
30099 <primary><option>message_id_header_domain</option></primary>
30100 </indexterm>
30101 </para>
30102 <informaltable frame="all">
30103 <tgroup cols="4" colsep="0" rowsep="0">
30104 <colspec colwidth="8*" align="left"/>
30105 <colspec colwidth="6*" align="center"/>
30106 <colspec colwidth="6*" align="center"/>
30107 <colspec colwidth="6*" align="right"/>
30108 <tbody>
30109 <row>
30110 <entry><option>message_id_header_domain</option></entry>
30111 <entry>Use: <emphasis>main</emphasis></entry>
30112 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30113 <entry>Default: <emphasis>unset</emphasis></entry>
30114 </row>
30115 </tbody>
30116 </tgroup>
30117 </informaltable>
30118 <para>
30119 <indexterm role="concept">
30120 <primary><emphasis>Message-ID:</emphasis> header line</primary>
30121 </indexterm>
30122 If this option is set, the string is expanded and used as the right hand side
30123 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
30124 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
30125 means <quote>not received over TCP/IP.</quote>
30126 Otherwise, the primary host name is used.
30127 Only letters, digits, dot and hyphen are accepted; any other characters are
30128 replaced by hyphens. If the expansion is forced to fail, or if the result is an
30129 empty string, the option is ignored.
30130 </para>
30131 <para>
30132 <indexterm role="option">
30133 <primary><option>message_id_header_text</option></primary>
30134 </indexterm>
30135 </para>
30136 <informaltable frame="all">
30137 <tgroup cols="4" colsep="0" rowsep="0">
30138 <colspec colwidth="8*" align="left"/>
30139 <colspec colwidth="6*" align="center"/>
30140 <colspec colwidth="6*" align="center"/>
30141 <colspec colwidth="6*" align="right"/>
30142 <tbody>
30143 <row>
30144 <entry><option>message_id_header_text</option></entry>
30145 <entry>Use: <emphasis>main</emphasis></entry>
30146 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30147 <entry>Default: <emphasis>unset</emphasis></entry>
30148 </row>
30149 </tbody>
30150 </tgroup>
30151 </informaltable>
30152 <para>
30153 If this variable is set, the string is expanded and used to augment the text of
30154 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
30155 message does not have one. The text of this header is required by RFC 2822 to
30156 take the form of an address. By default, Exim uses its internal message id as
30157 the local part, and the primary host name as the domain. If this option is set,
30158 it is expanded, and provided the expansion is not forced to fail, and does not
30159 yield an empty string, the result is inserted into the header immediately
30160 before the @, separated from the internal message id by a dot. Any characters
30161 that are illegal in an address are automatically converted into hyphens. This
30162 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
30163 colons will become hyphens.
30164 </para>
30165 <para>
30166 <indexterm role="option">
30167 <primary><option>message_logs</option></primary>
30168 </indexterm>
30169 </para>
30170 <informaltable frame="all">
30171 <tgroup cols="4" colsep="0" rowsep="0">
30172 <colspec colwidth="8*" align="left"/>
30173 <colspec colwidth="6*" align="center"/>
30174 <colspec colwidth="6*" align="center"/>
30175 <colspec colwidth="6*" align="right"/>
30176 <tbody>
30177 <row>
30178 <entry><option>message_logs</option></entry>
30179 <entry>Use: <emphasis>main</emphasis></entry>
30180 <entry>Type: <emphasis>boolean</emphasis></entry>
30181 <entry>Default: <emphasis>true</emphasis></entry>
30182 </row>
30183 </tbody>
30184 </tgroup>
30185 </informaltable>
30186 <para>
30187 <indexterm role="concept">
30188 <primary>message logs</primary>
30189 <secondary>disabling</secondary>
30190 </indexterm>
30191 <indexterm role="concept">
30192 <primary>log</primary>
30193 <secondary>message log; disabling</secondary>
30194 </indexterm>
30195 If this option is turned off, per-message log files are not created in the
30196 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
30197 Exim, by reducing the number of files involved in handling a message from a
30198 minimum of four (header spool file, body spool file, delivery journal, and
30199 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
30200 which is not affected by this option.
30201 </para>
30202 <para>
30203 <indexterm role="option">
30204 <primary><option>message_size_limit</option></primary>
30205 </indexterm>
30206 </para>
30207 <informaltable frame="all">
30208 <tgroup cols="4" colsep="0" rowsep="0">
30209 <colspec colwidth="8*" align="left"/>
30210 <colspec colwidth="6*" align="center"/>
30211 <colspec colwidth="6*" align="center"/>
30212 <colspec colwidth="6*" align="right"/>
30213 <tbody>
30214 <row>
30215 <entry><option>message_size_limit</option></entry>
30216 <entry>Use: <emphasis>main</emphasis></entry>
30217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30218 <entry>Default: <emphasis>50M</emphasis></entry>
30219 </row>
30220 </tbody>
30221 </tgroup>
30222 </informaltable>
30223 <para>
30224 <indexterm role="concept">
30225 <primary>message</primary>
30226 <secondary>size limit</secondary>
30227 </indexterm>
30228 <indexterm role="concept">
30229 <primary>limit</primary>
30230 <secondary>message size</secondary>
30231 </indexterm>
30232 <indexterm role="concept">
30233 <primary>size</primary>
30234 <secondary>of message, limit</secondary>
30235 </indexterm>
30236 This option limits the maximum size of message that Exim will process. The
30237 value is expanded for each incoming connection so, for example, it can be made
30238 to depend on the IP address of the remote host for messages arriving via
30239 TCP/IP. After expansion, the value must be a sequence of decimal digits,
30240 optionally followed by K or M.
30241 </para>
30242 <para>
30243 <indexterm role="concept">
30244 <primary>SIZE</primary>
30245 <secondary>ESMTP extension, advertising</secondary>
30246 </indexterm>
30247 <indexterm role="concept">
30248 <primary>ESMTP extensions</primary>
30249 <secondary>SIZE</secondary>
30250 </indexterm>
30251 If nonzero the value will be advertised as a parameter to the ESMTP SIZE
30252 service extension keyword.
30253 </para>
30254 <para>
30255 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
30256 other properties of an individual message, because it has to be advertised in
30257 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
30258 error. A value of zero means no limit, but its use is not recommended. See also
30259 <option>bounce_return_size_limit</option>.
30260 </para>
30261 <para>
30262 Incoming SMTP messages are failed with a 552 error if the limit is
30263 exceeded; locally-generated messages either get a stderr message or a delivery
30264 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
30265 an oversized message is logged in both the main and the reject logs. See also
30266 the generic transport option <option>message_size_limit</option>, which limits the size of
30267 message that an individual transport can process.
30268 </para>
30269 <para>
30270 If you use a virus-scanner and set this option to to a value larger than the
30271 maximum size that your virus-scanner is configured to support, you may get
30272 failures triggered by large mails.  The right size to configure for the
30273 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
30274 probably safest to just set it to a little larger than this value.  E.g., with a
30275 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
30276 some problems may result.
30277 </para>
30278 <para>
30279 A value of 0 will disable size limit checking; Exim will still advertise the
30280 SIZE extension in an EHLO response, but without a limit, so as to permit
30281 SMTP clients to still indicate the message size along with the MAIL verb.
30282 </para>
30283 <para>
30284 <indexterm role="option">
30285 <primary><option>move_frozen_messages</option></primary>
30286 </indexterm>
30287 </para>
30288 <informaltable frame="all">
30289 <tgroup cols="4" colsep="0" rowsep="0">
30290 <colspec colwidth="8*" align="left"/>
30291 <colspec colwidth="6*" align="center"/>
30292 <colspec colwidth="6*" align="center"/>
30293 <colspec colwidth="6*" align="right"/>
30294 <tbody>
30295 <row>
30296 <entry><option>move_frozen_messages</option></entry>
30297 <entry>Use: <emphasis>main</emphasis></entry>
30298 <entry>Type: <emphasis>boolean</emphasis></entry>
30299 <entry>Default: <emphasis>false</emphasis></entry>
30300 </row>
30301 </tbody>
30302 </tgroup>
30303 </informaltable>
30304 <para>
30305 <indexterm role="concept">
30306 <primary>frozen messages</primary>
30307 <secondary>moving</secondary>
30308 </indexterm>
30309 This option, which is available only if Exim has been built with the setting
30310 </para>
30311 <literallayout class="monospaced">
30312 SUPPORT_MOVE_FROZEN_MESSAGES=yes
30313 </literallayout>
30314 <para>
30315 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
30316 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
30317 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
30318 standard utilities for handling such moved messages, and they do not show up in
30319 lists generated by <option>-bp</option> or by the Exim monitor.
30320 </para>
30321 <para>
30322 <indexterm role="option">
30323 <primary><option>mua_wrapper</option></primary>
30324 </indexterm>
30325 </para>
30326 <informaltable frame="all">
30327 <tgroup cols="4" colsep="0" rowsep="0">
30328 <colspec colwidth="8*" align="left"/>
30329 <colspec colwidth="6*" align="center"/>
30330 <colspec colwidth="6*" align="center"/>
30331 <colspec colwidth="6*" align="right"/>
30332 <tbody>
30333 <row>
30334 <entry><option>mua_wrapper</option></entry>
30335 <entry>Use: <emphasis>main</emphasis></entry>
30336 <entry>Type: <emphasis>boolean</emphasis></entry>
30337 <entry>Default: <emphasis>false</emphasis></entry>
30338 </row>
30339 </tbody>
30340 </tgroup>
30341 </informaltable>
30342 <para>
30343 Setting this option true causes Exim to run in a very restrictive mode in which
30344 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
30345 contains a full description of this facility.
30346 </para>
30347 <para>
30348 <indexterm role="option">
30349 <primary><option>mysql_servers</option></primary>
30350 </indexterm>
30351 </para>
30352 <informaltable frame="all">
30353 <tgroup cols="4" colsep="0" rowsep="0">
30354 <colspec colwidth="8*" align="left"/>
30355 <colspec colwidth="6*" align="center"/>
30356 <colspec colwidth="6*" align="center"/>
30357 <colspec colwidth="6*" align="right"/>
30358 <tbody>
30359 <row>
30360 <entry><option>mysql_servers</option></entry>
30361 <entry>Use: <emphasis>main</emphasis></entry>
30362 <entry>Type: <emphasis>string list</emphasis></entry>
30363 <entry>Default: <emphasis>unset</emphasis></entry>
30364 </row>
30365 </tbody>
30366 </tgroup>
30367 </informaltable>
30368 <para>
30369 <indexterm role="concept">
30370 <primary>MySQL</primary>
30371 <secondary>server list</secondary>
30372 </indexterm>
30373 This option provides a list of MySQL servers and associated connection data, to
30374 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
30375 option is available only if Exim has been built with MySQL support.
30376 </para>
30377 <para>
30378 <indexterm role="option">
30379 <primary><option>never_users</option></primary>
30380 </indexterm>
30381 </para>
30382 <informaltable frame="all">
30383 <tgroup cols="4" colsep="0" rowsep="0">
30384 <colspec colwidth="8*" align="left"/>
30385 <colspec colwidth="6*" align="center"/>
30386 <colspec colwidth="6*" align="center"/>
30387 <colspec colwidth="6*" align="right"/>
30388 <tbody>
30389 <row>
30390 <entry><option>never_users</option></entry>
30391 <entry>Use: <emphasis>main</emphasis></entry>
30392 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30393 <entry>Default: <emphasis>unset</emphasis></entry>
30394 </row>
30395 </tbody>
30396 </tgroup>
30397 </informaltable>
30398 <para>
30399 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
30400 message deliveries are normally run in processes that are setuid to the
30401 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
30402 It is usually desirable to prevent any deliveries from running as root, as a
30403 safety precaution.
30404 </para>
30405 <para>
30406 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
30407 list of users that must not be used for local deliveries. This list is fixed in
30408 the binary and cannot be overridden by the configuration file. By default, it
30409 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
30410 can be used to add more users to the fixed list.
30411 </para>
30412 <para>
30413 If a message is to be delivered as one of the users on the fixed list or the
30414 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
30415 example is
30416 </para>
30417 <literallayout class="monospaced">
30418 never_users = root:daemon:bin
30419 </literallayout>
30420 <para>
30421 Including root is redundant if it is also on the fixed list, but it does no
30422 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
30423 transport driver.
30424 </para>
30425 <para>
30426 <indexterm role="option">
30427 <primary><option>notifier_socket</option></primary>
30428 </indexterm>
30429 </para>
30430 <informaltable frame="all">
30431 <tgroup cols="4" colsep="0" rowsep="0">
30432 <colspec colwidth="8*" align="left"/>
30433 <colspec colwidth="6*" align="center"/>
30434 <colspec colwidth="6*" align="center"/>
30435 <colspec colwidth="6*" align="right"/>
30436 <tbody>
30437 <row>
30438 <entry><option>notifier_socket</option></entry>
30439 <entry>Use: <emphasis>main</emphasis></entry>
30440 <entry>Type: <emphasis>string</emphasis></entry>
30441 <entry>Default: <emphasis>$spool_directory/exim_daemon_notify</emphasis></entry>
30442 </row>
30443 </tbody>
30444 </tgroup>
30445 </informaltable>
30446 <para>
30447 This option gives the name for a unix-domain socket on which the daemon
30448 listens for work and information-requests.
30449 Only installations running multiple daemons sharing a spool directory
30450 should need to modify the default.
30451 </para>
30452 <para>
30453 The option is expanded before use.
30454 If the platform supports Linux-style abstract socket names, the result
30455 is used with a nul byte prefixed.
30456 Otherwise,
30457 it should be a full path name and use a directory accessible
30458 to Exim.
30459 </para>
30460 <para>
30461 If this option is set as empty,
30462 or the command line <option>-oY</option> option is used, or
30463 the command line uses a <option>-oX</option> option and does not use <option>-oP</option>,
30464 then a notifier socket is not created.
30465 </para>
30466 <para>
30467 <indexterm role="option">
30468 <primary><option>openssl_options</option></primary>
30469 </indexterm>
30470 </para>
30471 <informaltable frame="all">
30472 <tgroup cols="4" colsep="0" rowsep="0">
30473 <colspec colwidth="8*" align="left"/>
30474 <colspec colwidth="6*" align="center"/>
30475 <colspec colwidth="6*" align="center"/>
30476 <colspec colwidth="6*" align="right"/>
30477 <tbody>
30478 <row>
30479 <entry><option>openssl_options</option></entry>
30480 <entry>Use: <emphasis>main</emphasis></entry>
30481 <entry>Type: <emphasis>string list</emphasis></entry>
30482 <entry>Default: <emphasis>+no_sslv2 +no_sslv3 +single_dh_use +no_ticket +no_renegotiation</emphasis></entry>
30483 </row>
30484 </tbody>
30485 </tgroup>
30486 </informaltable>
30487 <para>
30488 <indexterm role="concept">
30489 <primary>OpenSSL </primary>
30490 <secondary>compatibility</secondary>
30491 </indexterm>
30492 This option allows an administrator to adjust the SSL options applied
30493 by OpenSSL to connections.  It is given as a space-separated list of items,
30494 each one to be +added or -subtracted from the current value.
30495 </para>
30496 <para>
30497 This option is only available if Exim is built against OpenSSL.  The values
30498 available for this option vary according to the age of your OpenSSL install.
30499 The <quote>all</quote> value controls a subset of flags which are available, typically
30500 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
30501 list the values known on your system and Exim should support all the
30502 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
30503 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
30504 </para>
30505 <para>
30506 Note that adjusting the options can have severe impact upon the security of
30507 SSL as used by Exim.  It is possible to disable safety checks and shoot
30508 yourself in the foot in various unpleasant ways.  This option should not be
30509 adjusted lightly.  An unrecognised item will be detected at startup, by
30510 invoking Exim with the <option>-bV</option> flag.
30511 </para>
30512 <para>
30513 The option affects Exim operating both as a server and as a client.
30514 </para>
30515 <para>
30516 Historical note: prior to release 4.80, Exim defaulted this value to
30517 "+dont_insert_empty_fragments", which may still be needed for compatibility
30518 with some clients, but which lowers security by increasing exposure to
30519 some now infamous attacks.
30520 </para>
30521 <para>
30522 Examples:
30523 </para>
30524 <literallayout class="monospaced">
30525 # Make both old MS and old Eudora happy:
30526 openssl_options = -all +microsoft_big_sslv3_buffer \
30527                        +dont_insert_empty_fragments
30528
30529 # Disable older protocol versions:
30530 openssl_options = +no_sslv2 +no_sslv3
30531 </literallayout>
30532 <para>
30533 Possible options may include:
30534 </para>
30535 <itemizedlist>
30536 <listitem>
30537 <para>
30538 <literal>all</literal>
30539 </para>
30540 </listitem>
30541 <listitem>
30542 <para>
30543 <literal>allow_unsafe_legacy_renegotiation</literal>
30544 </para>
30545 </listitem>
30546 <listitem>
30547 <para>
30548 <literal>cipher_server_preference</literal>
30549 </para>
30550 </listitem>
30551 <listitem>
30552 <para>
30553 <literal>dont_insert_empty_fragments</literal>
30554 </para>
30555 </listitem>
30556 <listitem>
30557 <para>
30558 <literal>ephemeral_rsa</literal>
30559 </para>
30560 </listitem>
30561 <listitem>
30562 <para>
30563 <literal>legacy_server_connect</literal>
30564 </para>
30565 </listitem>
30566 <listitem>
30567 <para>
30568 <literal>microsoft_big_sslv3_buffer</literal>
30569 </para>
30570 </listitem>
30571 <listitem>
30572 <para>
30573 <literal>microsoft_sess_id_bug</literal>
30574 </para>
30575 </listitem>
30576 <listitem>
30577 <para>
30578 <literal>msie_sslv2_rsa_padding</literal>
30579 </para>
30580 </listitem>
30581 <listitem>
30582 <para>
30583 <literal>netscape_challenge_bug</literal>
30584 </para>
30585 </listitem>
30586 <listitem>
30587 <para>
30588 <literal>netscape_reuse_cipher_change_bug</literal>
30589 </para>
30590 </listitem>
30591 <listitem>
30592 <para>
30593 <literal>no_compression</literal>
30594 </para>
30595 </listitem>
30596 <listitem>
30597 <para>
30598 <literal>no_session_resumption_on_renegotiation</literal>
30599 </para>
30600 </listitem>
30601 <listitem>
30602 <para>
30603 <literal>no_sslv2</literal>
30604 </para>
30605 </listitem>
30606 <listitem>
30607 <para>
30608 <literal>no_sslv3</literal>
30609 </para>
30610 </listitem>
30611 <listitem>
30612 <para>
30613 <literal>no_ticket</literal>
30614 </para>
30615 </listitem>
30616 <listitem>
30617 <para>
30618 <literal>no_tlsv1</literal>
30619 </para>
30620 </listitem>
30621 <listitem>
30622 <para>
30623 <literal>no_tlsv1_1</literal>
30624 </para>
30625 </listitem>
30626 <listitem>
30627 <para>
30628 <literal>no_tlsv1_2</literal>
30629 </para>
30630 </listitem>
30631 <listitem>
30632 <para>
30633 <literal>safari_ecdhe_ecdsa_bug</literal>
30634 </para>
30635 </listitem>
30636 <listitem>
30637 <para>
30638 <literal>single_dh_use</literal>
30639 </para>
30640 </listitem>
30641 <listitem>
30642 <para>
30643 <literal>single_ecdh_use</literal>
30644 </para>
30645 </listitem>
30646 <listitem>
30647 <para>
30648 <literal>ssleay_080_client_dh_bug</literal>
30649 </para>
30650 </listitem>
30651 <listitem>
30652 <para>
30653 <literal>sslref2_reuse_cert_type_bug</literal>
30654 </para>
30655 </listitem>
30656 <listitem>
30657 <para>
30658 <literal>tls_block_padding_bug</literal>
30659 </para>
30660 </listitem>
30661 <listitem>
30662 <para>
30663 <literal>tls_d5_bug</literal>
30664 </para>
30665 </listitem>
30666 <listitem>
30667 <para>
30668 <literal>tls_rollback_bug</literal>
30669 </para>
30670 </listitem>
30671 </itemizedlist>
30672 <para>
30673 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
30674 all clients connecting using the MacOS SecureTransport TLS facility prior
30675 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
30676 to negotiate TLS then this option value might help, provided that your OpenSSL
30677 release is new enough to contain this work-around.  This may be a situation
30678 where you have to upgrade OpenSSL to get buggy clients working.
30679 </para>
30680 <para>
30681 <indexterm role="option">
30682 <primary><option>oracle_servers</option></primary>
30683 </indexterm>
30684 </para>
30685 <informaltable frame="all">
30686 <tgroup cols="4" colsep="0" rowsep="0">
30687 <colspec colwidth="8*" align="left"/>
30688 <colspec colwidth="6*" align="center"/>
30689 <colspec colwidth="6*" align="center"/>
30690 <colspec colwidth="6*" align="right"/>
30691 <tbody>
30692 <row>
30693 <entry><option>oracle_servers</option></entry>
30694 <entry>Use: <emphasis>main</emphasis></entry>
30695 <entry>Type: <emphasis>string list</emphasis></entry>
30696 <entry>Default: <emphasis>unset</emphasis></entry>
30697 </row>
30698 </tbody>
30699 </tgroup>
30700 </informaltable>
30701 <para>
30702 <indexterm role="concept">
30703 <primary>Oracle</primary>
30704 <secondary>server list</secondary>
30705 </indexterm>
30706 This option provides a list of Oracle servers and associated connection data,
30707 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
30708 The option is available only if Exim has been built with Oracle support.
30709 </para>
30710 <para revisionflag="changed">
30711 <indexterm role="option">
30712 <primary><option>panic_coredump</option></primary>
30713 </indexterm>
30714 </para>
30715 <informaltable frame="all" revisionflag="changed">
30716 <tgroup cols="4" colsep="0" rowsep="0">
30717 <colspec colwidth="8*" align="left"/>
30718 <colspec colwidth="6*" align="center"/>
30719 <colspec colwidth="6*" align="center"/>
30720 <colspec colwidth="6*" align="right"/>
30721 <tbody>
30722 <row>
30723 <entry><option>panic_coredump</option></entry>
30724 <entry>Use: <emphasis>main</emphasis></entry>
30725 <entry>Type: <emphasis>boolean</emphasis></entry>
30726 <entry>Default: <emphasis>false</emphasis></entry>
30727 </row>
30728 </tbody>
30729 </tgroup>
30730 </informaltable>
30731 <para revisionflag="changed">
30732 This option is rarely needed but can help for some debugging investigations.
30733 If set, when an internal error is detected by Exim which is sufficient
30734 to terminate the process
30735 (all such are logged in the paniclog)
30736 then a coredump is requested.
30737 </para>
30738 <para revisionflag="changed">
30739 Note that most systems require additional administrative configuration
30740 to permit write a core file for a setuid program, which is Exim&#x2019;s
30741 common installed configuration.
30742 </para>
30743 <para>
30744 <indexterm role="option">
30745 <primary><option>percent_hack_domains</option></primary>
30746 </indexterm>
30747 </para>
30748 <informaltable frame="all">
30749 <tgroup cols="4" colsep="0" rowsep="0">
30750 <colspec colwidth="8*" align="left"/>
30751 <colspec colwidth="6*" align="center"/>
30752 <colspec colwidth="6*" align="center"/>
30753 <colspec colwidth="6*" align="right"/>
30754 <tbody>
30755 <row>
30756 <entry><option>percent_hack_domains</option></entry>
30757 <entry>Use: <emphasis>main</emphasis></entry>
30758 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30759 <entry>Default: <emphasis>unset</emphasis></entry>
30760 </row>
30761 </tbody>
30762 </tgroup>
30763 </informaltable>
30764 <para>
30765 <indexterm role="concept">
30766 <primary><quote>percent hack</quote></primary>
30767 </indexterm>
30768 <indexterm role="concept">
30769 <primary>source routing</primary>
30770 <secondary>in email address</secondary>
30771 </indexterm>
30772 <indexterm role="concept">
30773 <primary>address</primary>
30774 <secondary>source-routed</secondary>
30775 </indexterm>
30776 The <quote>percent hack</quote> is the convention whereby a local part containing a
30777 percent sign is re-interpreted as a new email address, with the percent
30778 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
30779 also applied to RFC 2822 addresses that begin with an @ character. If this
30780 option is set, Exim implements the percent facility for those domains listed,
30781 but no others. This happens before an incoming SMTP address is tested against
30782 an ACL.
30783 </para>
30784 <para>
30785 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
30786 trying to get round relaying restrictions. For this reason, it is best avoided
30787 if at all possible. Unfortunately, a number of less security-conscious MTAs
30788 implement it unconditionally. If you are running Exim on a gateway host, and
30789 routing mail through to internal MTAs without processing the local parts, it is
30790 a good idea to reject recipient addresses with percent characters in their
30791 local parts. Exim&#x2019;s default configuration does this.
30792 </para>
30793 <para>
30794 <indexterm role="option">
30795 <primary><option>perl_at_start</option></primary>
30796 </indexterm>
30797 <indexterm role="option">
30798 <primary><option>perl_startup</option></primary>
30799 </indexterm>
30800 </para>
30801 <informaltable frame="all">
30802 <tgroup cols="4" colsep="0" rowsep="0">
30803 <colspec colwidth="8*" align="left"/>
30804 <colspec colwidth="6*" align="center"/>
30805 <colspec colwidth="6*" align="center"/>
30806 <colspec colwidth="6*" align="right"/>
30807 <tbody>
30808 <row>
30809 <entry><option>perl_at_start</option></entry>
30810 <entry>Use: <emphasis>main</emphasis></entry>
30811 <entry>Type: <emphasis>boolean</emphasis></entry>
30812 <entry>Default: <emphasis>false</emphasis></entry>
30813 </row>
30814 <row>
30815 <entry><option>perl_startup</option></entry>
30816 <entry>Use: <emphasis>main</emphasis></entry>
30817 <entry>Type: <emphasis>string</emphasis></entry>
30818 <entry>Default: <emphasis>unset</emphasis></entry>
30819 </row>
30820 </tbody>
30821 </tgroup>
30822 </informaltable>
30823 <para>
30824 <indexterm role="concept">
30825 <primary>Perl</primary>
30826 </indexterm>
30827 These options are available only when Exim is built with an embedded Perl
30828 interpreter. See chapter <xref linkend="CHAPperl"/> for details of their use.
30829 </para>
30830 <para>
30831 <indexterm role="option">
30832 <primary><option>perl_taintmode</option></primary>
30833 </indexterm>
30834 </para>
30835 <informaltable frame="all">
30836 <tgroup cols="4" colsep="0" rowsep="0">
30837 <colspec colwidth="8*" align="left"/>
30838 <colspec colwidth="6*" align="center"/>
30839 <colspec colwidth="6*" align="center"/>
30840 <colspec colwidth="6*" align="right"/>
30841 <tbody>
30842 <row>
30843 <entry><option>perl_taintmode</option></entry>
30844 <entry>Use: <emphasis>main</emphasis></entry>
30845 <entry>Type: <emphasis>boolean</emphasis></entry>
30846 <entry>Default: <emphasis>false</emphasis></entry>
30847 </row>
30848 </tbody>
30849 </tgroup>
30850 </informaltable>
30851 <para>
30852 <indexterm role="concept">
30853 <primary>Perl</primary>
30854 </indexterm>
30855 This option enables the taint mode of the embedded Perl interpreter.
30856 </para>
30857 <para>
30858 <indexterm role="option">
30859 <primary><option>pgsql_servers</option></primary>
30860 </indexterm>
30861 </para>
30862 <informaltable frame="all">
30863 <tgroup cols="4" colsep="0" rowsep="0">
30864 <colspec colwidth="8*" align="left"/>
30865 <colspec colwidth="6*" align="center"/>
30866 <colspec colwidth="6*" align="center"/>
30867 <colspec colwidth="6*" align="right"/>
30868 <tbody>
30869 <row>
30870 <entry><option>pgsql_servers</option></entry>
30871 <entry>Use: <emphasis>main</emphasis></entry>
30872 <entry>Type: <emphasis>string list</emphasis></entry>
30873 <entry>Default: <emphasis>unset</emphasis></entry>
30874 </row>
30875 </tbody>
30876 </tgroup>
30877 </informaltable>
30878 <para>
30879 <indexterm role="concept">
30880 <primary>PostgreSQL lookup type</primary>
30881 <secondary>server list</secondary>
30882 </indexterm>
30883 This option provides a list of PostgreSQL servers and associated connection
30884 data, to be used in conjunction with <command>pgsql</command> lookups (see section
30885 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
30886 PostgreSQL support.
30887 </para>
30888 <para>
30889 <indexterm role="option">
30890 <primary><option>pid_file_path</option></primary>
30891 </indexterm>
30892 </para>
30893 <informaltable frame="all">
30894 <tgroup cols="4" colsep="0" rowsep="0">
30895 <colspec colwidth="8*" align="left"/>
30896 <colspec colwidth="6*" align="center"/>
30897 <colspec colwidth="6*" align="center"/>
30898 <colspec colwidth="6*" align="right"/>
30899 <tbody>
30900 <row>
30901 <entry><option>pid_file_path</option></entry>
30902 <entry>Use: <emphasis>main</emphasis></entry>
30903 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30904 <entry>Default: <emphasis>set at compile time</emphasis></entry>
30905 </row>
30906 </tbody>
30907 </tgroup>
30908 </informaltable>
30909 <para>
30910 <indexterm role="concept">
30911 <primary>daemon</primary>
30912 <secondary>pid file path</secondary>
30913 </indexterm>
30914 <indexterm role="concept">
30915 <primary>pid file, path for</primary>
30916 </indexterm>
30917 This option sets the name of the file to which the Exim daemon writes its
30918 process id. The string is expanded, so it can contain, for example, references
30919 to the host name:
30920 </para>
30921 <literallayout class="monospaced">
30922 pid_file_path = /var/log/$primary_hostname/exim.pid
30923 </literallayout>
30924 <para>
30925 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
30926 spool directory.
30927 The value set by the option can be overridden by the <option>-oP</option> command line
30928 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
30929 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
30930 </para>
30931 <para>
30932 <indexterm role="option">
30933 <primary><option>pipelining_advertise_hosts</option></primary>
30934 </indexterm>
30935 </para>
30936 <informaltable frame="all">
30937 <tgroup cols="4" colsep="0" rowsep="0">
30938 <colspec colwidth="8*" align="left"/>
30939 <colspec colwidth="6*" align="center"/>
30940 <colspec colwidth="6*" align="center"/>
30941 <colspec colwidth="6*" align="right"/>
30942 <tbody>
30943 <row>
30944 <entry><option>pipelining_advertise_hosts</option></entry>
30945 <entry>Use: <emphasis>main</emphasis></entry>
30946 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30947 <entry>Default: <emphasis>*</emphasis></entry>
30948 </row>
30949 </tbody>
30950 </tgroup>
30951 </informaltable>
30952 <para>
30953 <indexterm role="concept">
30954 <primary>PIPELINING</primary>
30955 <secondary>suppressing advertising</secondary>
30956 </indexterm>
30957 <indexterm role="concept">
30958 <primary>ESMTP extensions</primary>
30959 <secondary>PIPELINING</secondary>
30960 </indexterm>
30961 This option can be used to suppress the advertisement of the SMTP
30962 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
30963 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
30964 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
30965 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
30966 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
30967 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
30968 </para>
30969 <para>
30970 <indexterm role="option">
30971 <primary><option>pipelining_connect_advertise_hosts</option></primary>
30972 </indexterm>
30973 </para>
30974 <informaltable frame="all">
30975 <tgroup cols="4" colsep="0" rowsep="0">
30976 <colspec colwidth="8*" align="left"/>
30977 <colspec colwidth="6*" align="center"/>
30978 <colspec colwidth="6*" align="center"/>
30979 <colspec colwidth="6*" align="right"/>
30980 <tbody>
30981 <row>
30982 <entry><option>pipelining_connect_advertise_hosts</option></entry>
30983 <entry>Use: <emphasis>main</emphasis></entry>
30984 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30985 <entry>Default: <emphasis>*</emphasis></entry>
30986 </row>
30987 </tbody>
30988 </tgroup>
30989 </informaltable>
30990 <para>
30991 <indexterm role="concept">
30992 <primary>pipelining</primary>
30993 <secondary>early connection</secondary>
30994 </indexterm>
30995 <indexterm role="concept">
30996 <primary>pipelining</primary>
30997 <secondary>PIPECONNECT</secondary>
30998 </indexterm>
30999 <indexterm role="concept">
31000 <primary>ESMTP extensions</primary>
31001 <secondary>PIPECONNECT</secondary>
31002 </indexterm>
31003 If Exim is built without the DISABLE_PIPE_CONNECT build option
31004 this option controls which hosts the facility is advertised to
31005 and from which pipeline early-connection (before MAIL) SMTP
31006 commands are acceptable.
31007 When used, the pipelining saves on roundtrip times.
31008 </para>
31009 <para>
31010 See also the <option>hosts_pipe_connect</option> smtp transport option.
31011 </para>
31012 <para>
31013 The SMTP service extension keyword advertised is <quote>PIPECONNECT</quote>;
31014 it permits the client to pipeline
31015 TCP connection and hello command (inclear phase),
31016 or TLS-establishment and hello command (encrypted phase),
31017 on later connections to the same host.
31018 </para>
31019 <para>
31020 <indexterm role="option">
31021 <primary><option>prdr_enable</option></primary>
31022 </indexterm>
31023 </para>
31024 <informaltable frame="all">
31025 <tgroup cols="4" colsep="0" rowsep="0">
31026 <colspec colwidth="8*" align="left"/>
31027 <colspec colwidth="6*" align="center"/>
31028 <colspec colwidth="6*" align="center"/>
31029 <colspec colwidth="6*" align="right"/>
31030 <tbody>
31031 <row>
31032 <entry><option>prdr_enable</option></entry>
31033 <entry>Use: <emphasis>main</emphasis></entry>
31034 <entry>Type: <emphasis>boolean</emphasis></entry>
31035 <entry>Default: <emphasis>false</emphasis></entry>
31036 </row>
31037 </tbody>
31038 </tgroup>
31039 </informaltable>
31040 <para>
31041 <indexterm role="concept">
31042 <primary>PRDR</primary>
31043 <secondary>enabling on server</secondary>
31044 </indexterm>
31045 <indexterm role="concept">
31046 <primary>ESMTP extensions</primary>
31047 <secondary>PRDR</secondary>
31048 </indexterm>
31049 This option can be used to enable the Per-Recipient Data Response extension
31050 to SMTP, defined by Eric Hall.
31051 If the option is set, PRDR is advertised by Exim when operating as a server.
31052 If the client requests PRDR, and more than one recipient, for a message
31053 an additional ACL is called for each recipient after the message content
31054 is received.  See section <xref linkend="SECTPRDRACL"/>.
31055 </para>
31056 <para>
31057 <indexterm role="option">
31058 <primary><option>preserve_message_logs</option></primary>
31059 </indexterm>
31060 </para>
31061 <informaltable frame="all">
31062 <tgroup cols="4" colsep="0" rowsep="0">
31063 <colspec colwidth="8*" align="left"/>
31064 <colspec colwidth="6*" align="center"/>
31065 <colspec colwidth="6*" align="center"/>
31066 <colspec colwidth="6*" align="right"/>
31067 <tbody>
31068 <row>
31069 <entry><option>preserve_message_logs</option></entry>
31070 <entry>Use: <emphasis>main</emphasis></entry>
31071 <entry>Type: <emphasis>boolean</emphasis></entry>
31072 <entry>Default: <emphasis>false</emphasis></entry>
31073 </row>
31074 </tbody>
31075 </tgroup>
31076 </informaltable>
31077 <para>
31078 <indexterm role="concept">
31079 <primary>message logs</primary>
31080 <secondary>preserving</secondary>
31081 </indexterm>
31082 If this option is set, message log files are not deleted when messages are
31083 completed. Instead, they are moved to a sub-directory of the spool directory
31084 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
31085 purposes. This is a dangerous option to set on systems with any appreciable
31086 volume of mail. Use with care!
31087 </para>
31088 <para>
31089 <indexterm role="option">
31090 <primary><option>primary_hostname</option></primary>
31091 </indexterm>
31092 </para>
31093 <informaltable frame="all">
31094 <tgroup cols="4" colsep="0" rowsep="0">
31095 <colspec colwidth="8*" align="left"/>
31096 <colspec colwidth="6*" align="center"/>
31097 <colspec colwidth="6*" align="center"/>
31098 <colspec colwidth="6*" align="right"/>
31099 <tbody>
31100 <row>
31101 <entry><option>primary_hostname</option></entry>
31102 <entry>Use: <emphasis>main</emphasis></entry>
31103 <entry>Type: <emphasis>string</emphasis></entry>
31104 <entry>Default: <emphasis>see below</emphasis></entry>
31105 </row>
31106 </tbody>
31107 </tgroup>
31108 </informaltable>
31109 <para>
31110 <indexterm role="concept">
31111 <primary>name</primary>
31112 <secondary>of local host</secondary>
31113 </indexterm>
31114 <indexterm role="concept">
31115 <primary>host</primary>
31116 <secondary>name of local</secondary>
31117 </indexterm>
31118 <indexterm role="concept">
31119 <primary>local host</primary>
31120 <secondary>name of</secondary>
31121 </indexterm>
31122 <indexterm role="variable">
31123 <primary><varname>$primary_hostname</varname></primary>
31124 </indexterm>
31125 This specifies the name of the current host. It is used in the default EHLO or
31126 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
31127 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
31128 The value is also used by default in some SMTP response messages from an Exim
31129 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
31130 </para>
31131 <para>
31132 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
31133 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
31134 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
31135 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
31136 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
31137 explicitly by this option, or defaulted.
31138 </para>
31139 <para>
31140 <indexterm role="option">
31141 <primary><option>print_topbitchars</option></primary>
31142 </indexterm>
31143 </para>
31144 <informaltable frame="all">
31145 <tgroup cols="4" colsep="0" rowsep="0">
31146 <colspec colwidth="8*" align="left"/>
31147 <colspec colwidth="6*" align="center"/>
31148 <colspec colwidth="6*" align="center"/>
31149 <colspec colwidth="6*" align="right"/>
31150 <tbody>
31151 <row>
31152 <entry><option>print_topbitchars</option></entry>
31153 <entry>Use: <emphasis>main</emphasis></entry>
31154 <entry>Type: <emphasis>boolean</emphasis></entry>
31155 <entry>Default: <emphasis>false</emphasis></entry>
31156 </row>
31157 </tbody>
31158 </tgroup>
31159 </informaltable>
31160 <para>
31161 <indexterm role="concept">
31162 <primary>printing characters</primary>
31163 </indexterm>
31164 <indexterm role="concept">
31165 <primary>8-bit characters</primary>
31166 </indexterm>
31167 By default, Exim considers only those characters whose codes lie in the range
31168 32&ndash;126 to be printing characters. In a number of circumstances (for example,
31169 when writing log entries) non-printing characters are converted into escape
31170 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
31171 is set, code values of 128 and above are also considered to be printing
31172 characters.
31173 </para>
31174 <para>
31175 This option also affects the header syntax checks performed by the
31176 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
31177 the user&#x2019;s full name when constructing From: and Sender: addresses (as
31178 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
31179 Exim to generate eight bit message headers that do not conform to the
31180 standards.
31181 </para>
31182 <para>
31183 <indexterm role="option">
31184 <primary><option>process_log_path</option></primary>
31185 </indexterm>
31186 </para>
31187 <informaltable frame="all">
31188 <tgroup cols="4" colsep="0" rowsep="0">
31189 <colspec colwidth="8*" align="left"/>
31190 <colspec colwidth="6*" align="center"/>
31191 <colspec colwidth="6*" align="center"/>
31192 <colspec colwidth="6*" align="right"/>
31193 <tbody>
31194 <row>
31195 <entry><option>process_log_path</option></entry>
31196 <entry>Use: <emphasis>main</emphasis></entry>
31197 <entry>Type: <emphasis>string</emphasis></entry>
31198 <entry>Default: <emphasis>unset</emphasis></entry>
31199 </row>
31200 </tbody>
31201 </tgroup>
31202 </informaltable>
31203 <para>
31204 <indexterm role="concept">
31205 <primary>process log path</primary>
31206 </indexterm>
31207 <indexterm role="concept">
31208 <primary>log</primary>
31209 <secondary>process log</secondary>
31210 </indexterm>
31211 <indexterm role="concept">
31212 <primary><emphasis>exiwhat</emphasis></primary>
31213 </indexterm>
31214 This option sets the name of the file to which an Exim process writes its
31215 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
31216 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
31217 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
31218 can be useful in environments where two different Exims are running, using
31219 different spool directories.
31220 </para>
31221 <para>
31222 <indexterm role="option">
31223 <primary><option>prod_requires_admin</option></primary>
31224 </indexterm>
31225 </para>
31226 <informaltable frame="all">
31227 <tgroup cols="4" colsep="0" rowsep="0">
31228 <colspec colwidth="8*" align="left"/>
31229 <colspec colwidth="6*" align="center"/>
31230 <colspec colwidth="6*" align="center"/>
31231 <colspec colwidth="6*" align="right"/>
31232 <tbody>
31233 <row>
31234 <entry><option>prod_requires_admin</option></entry>
31235 <entry>Use: <emphasis>main</emphasis></entry>
31236 <entry>Type: <emphasis>boolean</emphasis></entry>
31237 <entry>Default: <emphasis>true</emphasis></entry>
31238 </row>
31239 </tbody>
31240 </tgroup>
31241 </informaltable>
31242 <para>
31243 <indexterm role="concept">
31244 <primary>restricting access to features</primary>
31245 </indexterm>
31246 <indexterm role="option">
31247 <primary><option>-M</option></primary>
31248 </indexterm>
31249 <indexterm role="option">
31250 <primary><option>-R</option></primary>
31251 </indexterm>
31252 <indexterm role="option">
31253 <primary><option>-q</option></primary>
31254 </indexterm>
31255 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
31256 admin user unless <option>prod_requires_admin</option> is set false. See also
31257 <option>queue_list_requires_admin</option> and <option>commandline_checks_require_admin</option>.
31258 </para>
31259 <para>
31260 <indexterm role="option">
31261 <primary><option>proxy_protocol_timeout</option></primary>
31262 </indexterm>
31263 </para>
31264 <informaltable frame="all">
31265 <tgroup cols="4" colsep="0" rowsep="0">
31266 <colspec colwidth="8*" align="left"/>
31267 <colspec colwidth="6*" align="center"/>
31268 <colspec colwidth="6*" align="center"/>
31269 <colspec colwidth="6*" align="right"/>
31270 <tbody>
31271 <row>
31272 <entry><option>proxy_protocol_timeout</option></entry>
31273 <entry>Use: <emphasis>main</emphasis></entry>
31274 <entry>Type: <emphasis>time</emphasis></entry>
31275 <entry>Default: <emphasis>3s</emphasis></entry>
31276 </row>
31277 </tbody>
31278 </tgroup>
31279 </informaltable>
31280 <para>
31281 <indexterm role="concept">
31282 <primary>proxy</primary>
31283 <secondary>proxy protocol</secondary>
31284 </indexterm>
31285 This option sets the timeout for proxy protocol negotiation.
31286 For details see section <xref linkend="SECTproxyInbound"/>.
31287 </para>
31288 <para>
31289 <indexterm role="option">
31290 <primary><option>qualify_domain</option></primary>
31291 </indexterm>
31292 </para>
31293 <informaltable frame="all">
31294 <tgroup cols="4" colsep="0" rowsep="0">
31295 <colspec colwidth="8*" align="left"/>
31296 <colspec colwidth="6*" align="center"/>
31297 <colspec colwidth="6*" align="center"/>
31298 <colspec colwidth="6*" align="right"/>
31299 <tbody>
31300 <row>
31301 <entry><option>qualify_domain</option></entry>
31302 <entry>Use: <emphasis>main</emphasis></entry>
31303 <entry>Type: <emphasis>string</emphasis></entry>
31304 <entry>Default: <emphasis>see below</emphasis></entry>
31305 </row>
31306 </tbody>
31307 </tgroup>
31308 </informaltable>
31309 <para>
31310 <indexterm role="concept">
31311 <primary>domain</primary>
31312 <secondary>for qualifying addresses</secondary>
31313 </indexterm>
31314 <indexterm role="concept">
31315 <primary>address</primary>
31316 <secondary>qualification</secondary>
31317 </indexterm>
31318 This option specifies the domain name that is added to any envelope sender
31319 addresses that do not have a domain qualification. It also applies to
31320 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
31321 are accepted by default only for locally-generated messages. Qualification is
31322 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
31323 locally-generated messages, unless the <option>-bnq</option> command line option is used.
31324 </para>
31325 <para>
31326 Messages from external sources must always contain fully qualified addresses,
31327 unless the sending host matches <option>sender_unqualified_hosts</option> or
31328 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
31329 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
31330 necessary. Internally, Exim always works with fully qualified envelope
31331 addresses. If <option>qualify_domain</option> is not set, it defaults to the
31332 <option>primary_hostname</option> value.
31333 </para>
31334 <para>
31335 <indexterm role="option">
31336 <primary><option>qualify_recipient</option></primary>
31337 </indexterm>
31338 </para>
31339 <informaltable frame="all">
31340 <tgroup cols="4" colsep="0" rowsep="0">
31341 <colspec colwidth="8*" align="left"/>
31342 <colspec colwidth="6*" align="center"/>
31343 <colspec colwidth="6*" align="center"/>
31344 <colspec colwidth="6*" align="right"/>
31345 <tbody>
31346 <row>
31347 <entry><option>qualify_recipient</option></entry>
31348 <entry>Use: <emphasis>main</emphasis></entry>
31349 <entry>Type: <emphasis>string</emphasis></entry>
31350 <entry>Default: <emphasis>see below</emphasis></entry>
31351 </row>
31352 </tbody>
31353 </tgroup>
31354 </informaltable>
31355 <para>
31356 This option allows you to specify a different domain for qualifying recipient
31357 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
31358 </para>
31359 <para>
31360 <indexterm role="option">
31361 <primary><option>queue_domains</option></primary>
31362 </indexterm>
31363 </para>
31364 <informaltable frame="all">
31365 <tgroup cols="4" colsep="0" rowsep="0">
31366 <colspec colwidth="8*" align="left"/>
31367 <colspec colwidth="6*" align="center"/>
31368 <colspec colwidth="6*" align="center"/>
31369 <colspec colwidth="6*" align="right"/>
31370 <tbody>
31371 <row>
31372 <entry><option>queue_domains</option></entry>
31373 <entry>Use: <emphasis>main</emphasis></entry>
31374 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31375 <entry>Default: <emphasis>unset</emphasis></entry>
31376 </row>
31377 </tbody>
31378 </tgroup>
31379 </informaltable>
31380 <para>
31381 <indexterm role="concept">
31382 <primary>domain</primary>
31383 <secondary>specifying non-immediate delivery</secondary>
31384 </indexterm>
31385 <indexterm role="concept">
31386 <primary>queueing incoming messages</primary>
31387 </indexterm>
31388 <indexterm role="concept">
31389 <primary>message</primary>
31390 <secondary>queueing certain domains</secondary>
31391 </indexterm>
31392 This option lists domains for which immediate delivery is not required.
31393 A delivery process is started whenever a message is received, but only those
31394 domains that do not match are processed. All other deliveries wait until the
31395 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
31396 </para>
31397 <para>
31398 <indexterm role="option">
31399 <primary><option>queue_fast_ramp</option></primary>
31400 </indexterm>
31401 </para>
31402 <informaltable frame="all">
31403 <tgroup cols="4" colsep="0" rowsep="0">
31404 <colspec colwidth="8*" align="left"/>
31405 <colspec colwidth="6*" align="center"/>
31406 <colspec colwidth="6*" align="center"/>
31407 <colspec colwidth="6*" align="right"/>
31408 <tbody>
31409 <row>
31410 <entry><option>queue_fast_ramp</option></entry>
31411 <entry>Use: <emphasis>main</emphasis></entry>
31412 <entry>Type: <emphasis>boolean</emphasis></entry>
31413 <entry>Default: <emphasis>true</emphasis></entry>
31414 </row>
31415 </tbody>
31416 </tgroup>
31417 </informaltable>
31418 <para>
31419 <indexterm role="concept">
31420 <primary>queue runner</primary>
31421 <secondary>two phase</secondary>
31422 </indexterm>
31423 <indexterm role="concept">
31424 <primary>queue</primary>
31425 <secondary>double scanning</secondary>
31426 </indexterm>
31427 If set to true, two-phase queue runs, initiated using <option>-qq</option> on the
31428 command line, may start parallel delivery processes during their first
31429 phase.  This will be done when a threshold number of messages have been
31430 routed for a single host.
31431 </para>
31432 <para>
31433 <indexterm role="option">
31434 <primary><option>queue_list_requires_admin</option></primary>
31435 </indexterm>
31436 </para>
31437 <informaltable frame="all">
31438 <tgroup cols="4" colsep="0" rowsep="0">
31439 <colspec colwidth="8*" align="left"/>
31440 <colspec colwidth="6*" align="center"/>
31441 <colspec colwidth="6*" align="center"/>
31442 <colspec colwidth="6*" align="right"/>
31443 <tbody>
31444 <row>
31445 <entry><option>queue_list_requires_admin</option></entry>
31446 <entry>Use: <emphasis>main</emphasis></entry>
31447 <entry>Type: <emphasis>boolean</emphasis></entry>
31448 <entry>Default: <emphasis>true</emphasis></entry>
31449 </row>
31450 </tbody>
31451 </tgroup>
31452 </informaltable>
31453 <para>
31454 <indexterm role="concept">
31455 <primary>restricting access to features</primary>
31456 </indexterm>
31457 <indexterm role="option">
31458 <primary><option>-bp</option></primary>
31459 </indexterm>
31460 The <option>-bp</option> command-line option, which lists the messages that are on the
31461 queue, requires the caller to be an admin user unless
31462 <option>queue_list_requires_admin</option> is set false.
31463 See also <option>prod_requires_admin</option> and <option>commandline_checks_require_admin</option>.
31464 </para>
31465 <para>
31466 <indexterm role="option">
31467 <primary><option>queue_only</option></primary>
31468 </indexterm>
31469 </para>
31470 <informaltable frame="all">
31471 <tgroup cols="4" colsep="0" rowsep="0">
31472 <colspec colwidth="8*" align="left"/>
31473 <colspec colwidth="6*" align="center"/>
31474 <colspec colwidth="6*" align="center"/>
31475 <colspec colwidth="6*" align="right"/>
31476 <tbody>
31477 <row>
31478 <entry><option>queue_only</option></entry>
31479 <entry>Use: <emphasis>main</emphasis></entry>
31480 <entry>Type: <emphasis>boolean</emphasis></entry>
31481 <entry>Default: <emphasis>false</emphasis></entry>
31482 </row>
31483 </tbody>
31484 </tgroup>
31485 </informaltable>
31486 <para>
31487 <indexterm role="concept">
31488 <primary>queueing incoming messages</primary>
31489 </indexterm>
31490 <indexterm role="concept">
31491 <primary>message</primary>
31492 <secondary>queueing unconditionally</secondary>
31493 </indexterm>
31494 If <option>queue_only</option> is set, a delivery process is not automatically started
31495 whenever a message is received. Instead, the message waits in the queue for the
31496 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
31497 delivered immediately when certain conditions (such as heavy load) occur.
31498 </para>
31499 <para>
31500 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
31501 and <option>-odi</option> command line options override <option>queue_only</option> unless
31502 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
31503 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
31504 </para>
31505 <para>
31506 <indexterm role="option">
31507 <primary><option>queue_only_file</option></primary>
31508 </indexterm>
31509 </para>
31510 <informaltable frame="all">
31511 <tgroup cols="4" colsep="0" rowsep="0">
31512 <colspec colwidth="8*" align="left"/>
31513 <colspec colwidth="6*" align="center"/>
31514 <colspec colwidth="6*" align="center"/>
31515 <colspec colwidth="6*" align="right"/>
31516 <tbody>
31517 <row>
31518 <entry><option>queue_only_file</option></entry>
31519 <entry>Use: <emphasis>main</emphasis></entry>
31520 <entry>Type: <emphasis>string list</emphasis></entry>
31521 <entry>Default: <emphasis>unset</emphasis></entry>
31522 </row>
31523 </tbody>
31524 </tgroup>
31525 </informaltable>
31526 <para>
31527 <indexterm role="concept">
31528 <primary>queueing incoming messages</primary>
31529 </indexterm>
31530 <indexterm role="concept">
31531 <primary>message</primary>
31532 <secondary>queueing by file existence</secondary>
31533 </indexterm>
31534 This option can be set to a colon-separated list of absolute path names, each
31535 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
31536 it tests for the existence of each listed path using a call to <function>stat()</function>. For
31537 each path that exists, the corresponding queueing option is set.
31538 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
31539 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
31540 </para>
31541 <literallayout class="monospaced">
31542 queue_only_file = smtp/some/file
31543 </literallayout>
31544 <para>
31545 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
31546 <filename>/some/file</filename> exists.
31547 </para>
31548 <para>
31549 <indexterm role="option">
31550 <primary><option>queue_only_load</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>queue_only_load</option></entry>
31562 <entry>Use: <emphasis>main</emphasis></entry>
31563 <entry>Type: <emphasis>fixed-point</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>load average</primary>
31572 </indexterm>
31573 <indexterm role="concept">
31574 <primary>queueing incoming messages</primary>
31575 </indexterm>
31576 <indexterm role="concept">
31577 <primary>message</primary>
31578 <secondary>queueing by load</secondary>
31579 </indexterm>
31580 If the system load average is higher than this value, incoming messages from
31581 all sources are queued, and no automatic deliveries are started. If this
31582 happens during local or remote SMTP input, all subsequent messages received on
31583 the same SMTP connection are queued by default, whatever happens to the load in
31584 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
31585 false.
31586 </para>
31587 <para>
31588 Deliveries will subsequently be performed by queue runner processes. This
31589 option has no effect on ancient operating systems on which Exim cannot
31590 determine the load average. See also <option>deliver_queue_load_max</option> and
31591 <option>smtp_load_reserve</option>.
31592 </para>
31593 <para>
31594 <indexterm role="option">
31595 <primary><option>queue_only_load_latch</option></primary>
31596 </indexterm>
31597 </para>
31598 <informaltable frame="all">
31599 <tgroup cols="4" colsep="0" rowsep="0">
31600 <colspec colwidth="8*" align="left"/>
31601 <colspec colwidth="6*" align="center"/>
31602 <colspec colwidth="6*" align="center"/>
31603 <colspec colwidth="6*" align="right"/>
31604 <tbody>
31605 <row>
31606 <entry><option>queue_only_load_latch</option></entry>
31607 <entry>Use: <emphasis>main</emphasis></entry>
31608 <entry>Type: <emphasis>boolean</emphasis></entry>
31609 <entry>Default: <emphasis>true</emphasis></entry>
31610 </row>
31611 </tbody>
31612 </tgroup>
31613 </informaltable>
31614 <para>
31615 <indexterm role="concept">
31616 <primary>load average</primary>
31617 <secondary>re-evaluating per message</secondary>
31618 </indexterm>
31619 When this option is true (the default), once one message has been queued
31620 because the load average is higher than the value set by <option>queue_only_load</option>,
31621 all subsequent messages received on the same SMTP connection are also queued.
31622 This is a deliberate choice; even though the load average may fall below the
31623 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
31624 connection when not delivering earlier ones. However, there are special
31625 circumstances such as very long-lived connections from scanning appliances
31626 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
31627 should be set false. This causes the value of the load average to be
31628 re-evaluated for each message.
31629 </para>
31630 <para>
31631 <indexterm role="option">
31632 <primary><option>queue_only_override</option></primary>
31633 </indexterm>
31634 </para>
31635 <informaltable frame="all">
31636 <tgroup cols="4" colsep="0" rowsep="0">
31637 <colspec colwidth="8*" align="left"/>
31638 <colspec colwidth="6*" align="center"/>
31639 <colspec colwidth="6*" align="center"/>
31640 <colspec colwidth="6*" align="right"/>
31641 <tbody>
31642 <row>
31643 <entry><option>queue_only_override</option></entry>
31644 <entry>Use: <emphasis>main</emphasis></entry>
31645 <entry>Type: <emphasis>boolean</emphasis></entry>
31646 <entry>Default: <emphasis>true</emphasis></entry>
31647 </row>
31648 </tbody>
31649 </tgroup>
31650 </informaltable>
31651 <para>
31652 <indexterm role="concept">
31653 <primary>queueing incoming messages</primary>
31654 </indexterm>
31655 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
31656 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
31657 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
31658 to override; they are accepted, but ignored.
31659 </para>
31660 <para>
31661 <indexterm role="option">
31662 <primary><option>queue_run_in_order</option></primary>
31663 </indexterm>
31664 </para>
31665 <informaltable frame="all">
31666 <tgroup cols="4" colsep="0" rowsep="0">
31667 <colspec colwidth="8*" align="left"/>
31668 <colspec colwidth="6*" align="center"/>
31669 <colspec colwidth="6*" align="center"/>
31670 <colspec colwidth="6*" align="right"/>
31671 <tbody>
31672 <row>
31673 <entry><option>queue_run_in_order</option></entry>
31674 <entry>Use: <emphasis>main</emphasis></entry>
31675 <entry>Type: <emphasis>boolean</emphasis></entry>
31676 <entry>Default: <emphasis>false</emphasis></entry>
31677 </row>
31678 </tbody>
31679 </tgroup>
31680 </informaltable>
31681 <para>
31682 <indexterm role="concept">
31683 <primary>queue runner</primary>
31684 <secondary>processing messages in order</secondary>
31685 </indexterm>
31686 If this option is set, queue runs happen in order of message arrival instead of
31687 in an arbitrary order. For this to happen, a complete list of the entire queue
31688 must be set up before the deliveries start. When the queue is all held in a
31689 single directory (the default), a single list is created for both the ordered
31690 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
31691 single list is not created when <option>queue_run_in_order</option> is false. In this case,
31692 the sub-directories are processed one at a time (in a random order), and this
31693 avoids setting up one huge list for the whole queue. Thus, setting
31694 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
31695 when the queue is large, because of the extra work in setting up the single,
31696 large list. In most situations, <option>queue_run_in_order</option> should not be set.
31697 </para>
31698 <para>
31699 <indexterm role="option">
31700 <primary><option>queue_run_max</option></primary>
31701 </indexterm>
31702 </para>
31703 <informaltable frame="all">
31704 <tgroup cols="4" colsep="0" rowsep="0">
31705 <colspec colwidth="8*" align="left"/>
31706 <colspec colwidth="6*" align="center"/>
31707 <colspec colwidth="6*" align="center"/>
31708 <colspec colwidth="6*" align="right"/>
31709 <tbody>
31710 <row>
31711 <entry><option>queue_run_max</option></entry>
31712 <entry>Use: <emphasis>main</emphasis></entry>
31713 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
31714 <entry>Default: <emphasis>5</emphasis></entry>
31715 </row>
31716 </tbody>
31717 </tgroup>
31718 </informaltable>
31719 <para>
31720 <indexterm role="concept">
31721 <primary>queue runner</primary>
31722 <secondary>maximum number of</secondary>
31723 </indexterm>
31724 This controls the maximum number of queue runner processes that an Exim daemon
31725 can run simultaneously. This does not mean that it starts them all at once,
31726 but rather that if the maximum number are still running when the time comes to
31727 start another one, it refrains from starting another one. This can happen with
31728 very large queues and/or very sluggish deliveries. This option does not,
31729 however, interlock with other processes, so additional queue runners can be
31730 started by other means, or by killing and restarting the daemon.
31731 </para>
31732 <para>
31733 Setting this option to zero does not suppress queue runs; rather, it disables
31734 the limit, allowing any number of simultaneous queue runner processes to be
31735 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
31736 the daemon&#x2019;s command line.
31737 </para>
31738 <para>
31739 <indexterm role="concept">
31740 <primary>queues</primary>
31741 <secondary>named</secondary>
31742 </indexterm>
31743 <indexterm role="concept">
31744 <primary>named queues</primary>
31745 <secondary>resource limit</secondary>
31746 </indexterm>
31747 To set limits for different named queues use
31748 an expansion depending on the <varname>$queue_name</varname> variable.
31749 </para>
31750 <para>
31751 <indexterm role="option">
31752 <primary><option>queue_smtp_domains</option></primary>
31753 </indexterm>
31754 </para>
31755 <informaltable frame="all">
31756 <tgroup cols="4" colsep="0" rowsep="0">
31757 <colspec colwidth="8*" align="left"/>
31758 <colspec colwidth="6*" align="center"/>
31759 <colspec colwidth="6*" align="center"/>
31760 <colspec colwidth="6*" align="right"/>
31761 <tbody>
31762 <row>
31763 <entry><option>queue_smtp_domains</option></entry>
31764 <entry>Use: <emphasis>main</emphasis></entry>
31765 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31766 <entry>Default: <emphasis>unset</emphasis></entry>
31767 </row>
31768 </tbody>
31769 </tgroup>
31770 </informaltable>
31771 <para>
31772 <indexterm role="concept">
31773 <primary>queueing incoming messages</primary>
31774 </indexterm>
31775 <indexterm role="concept">
31776 <primary>message</primary>
31777 <secondary>queueing remote deliveries</secondary>
31778 </indexterm>
31779 <indexterm role="concept">
31780 <primary>first pass routing</primary>
31781 </indexterm>
31782 When this option is set, a delivery process is started whenever a message is
31783 received, routing is performed, and local deliveries take place.
31784 However, if any SMTP deliveries are required for domains that match
31785 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
31786 message waits in the queue for the next queue run. Since routing of the message
31787 has taken place, Exim knows to which remote hosts it must be delivered, and so
31788 when the queue run happens, multiple messages for the same host are delivered
31789 over a single SMTP connection. The <option>-odqs</option> command line option causes all
31790 SMTP deliveries to be queued in this way, and is equivalent to setting
31791 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
31792 <option>queue_domains</option>.
31793 </para>
31794 <para>
31795 <indexterm role="option">
31796 <primary><option>receive_timeout</option></primary>
31797 </indexterm>
31798 </para>
31799 <informaltable frame="all">
31800 <tgroup cols="4" colsep="0" rowsep="0">
31801 <colspec colwidth="8*" align="left"/>
31802 <colspec colwidth="6*" align="center"/>
31803 <colspec colwidth="6*" align="center"/>
31804 <colspec colwidth="6*" align="right"/>
31805 <tbody>
31806 <row>
31807 <entry><option>receive_timeout</option></entry>
31808 <entry>Use: <emphasis>main</emphasis></entry>
31809 <entry>Type: <emphasis>time</emphasis></entry>
31810 <entry>Default: <emphasis>0s</emphasis></entry>
31811 </row>
31812 </tbody>
31813 </tgroup>
31814 </informaltable>
31815 <para>
31816 <indexterm role="concept">
31817 <primary>timeout</primary>
31818 <secondary>for non-SMTP input</secondary>
31819 </indexterm>
31820 This option sets the timeout for accepting a non-SMTP message, that is, the
31821 maximum time that Exim waits when reading a message on the standard input. If
31822 the value is zero, it will wait forever. This setting is overridden by the
31823 <option>-or</option> command line option. The timeout for incoming SMTP messages is
31824 controlled by <option>smtp_receive_timeout</option>.
31825 </para>
31826 <para>
31827 <indexterm role="option">
31828 <primary><option>received_header_text</option></primary>
31829 </indexterm>
31830 </para>
31831 <informaltable frame="all">
31832 <tgroup cols="4" colsep="0" rowsep="0">
31833 <colspec colwidth="8*" align="left"/>
31834 <colspec colwidth="6*" align="center"/>
31835 <colspec colwidth="6*" align="center"/>
31836 <colspec colwidth="6*" align="right"/>
31837 <tbody>
31838 <row>
31839 <entry><option>received_header_text</option></entry>
31840 <entry>Use: <emphasis>main</emphasis></entry>
31841 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31842 <entry>Default: <emphasis>see below</emphasis></entry>
31843 </row>
31844 </tbody>
31845 </tgroup>
31846 </informaltable>
31847 <para>
31848 <indexterm role="concept">
31849 <primary>customizing</primary>
31850 <secondary><emphasis>Received:</emphasis> header</secondary>
31851 </indexterm>
31852 <indexterm role="concept">
31853 <primary><emphasis>Received:</emphasis> header line</primary>
31854 <secondary>customizing</secondary>
31855 </indexterm>
31856 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
31857 added to each message, except for the timestamp, which is automatically added
31858 on at the end (preceded by a semicolon). The string is expanded each time it is
31859 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
31860 added to the message. Otherwise, the string should start with the text
31861 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
31862 header lines.
31863 The default setting is:
31864 </para>
31865 <literallayout class="monospaced">
31866 received_header_text = Received: \
31867   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
31868     {${if def:sender_ident \
31869       {from ${quote_local_part:$sender_ident} }}\
31870         ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
31871   by $primary_hostname \
31872   ${if def:received_protocol {with $received_protocol }}\
31873   ${if def:tls_in_ver        { ($tls_in_ver)}}\
31874   ${if def:tls_in_cipher_std { tls $tls_in_cipher_std\n\t}}\
31875   (Exim $version_number)\n\t\
31876   ${if def:sender_address \
31877   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
31878   id $message_exim_id\
31879   ${if def:received_for {\n\tfor $received_for}}
31880 </literallayout>
31881 <para>
31882 The references to the TLS version and cipher are
31883 omitted when Exim is built without TLS
31884 support. The use of conditional expansions ensures that this works for both
31885 locally generated messages and messages received from remote hosts, giving
31886 header lines such as the following:
31887 </para>
31888 <literallayout class="monospaced">
31889 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
31890 by marley.carol.example with esmtp (Exim 4.00)
31891 (envelope-from &lt;bob@carol.example&gt;)
31892 id 16IOWa-00019l-00
31893 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
31894 Received: by scrooge.carol.example with local (Exim 4.00)
31895 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
31896 </literallayout>
31897 <para>
31898 Until the body of the message has been received, the timestamp is the time when
31899 the message started to be received. Once the body has arrived, and all policy
31900 checks have taken place, the timestamp is updated to the time at which the
31901 message was accepted.
31902 </para>
31903 <para>
31904 <indexterm role="option">
31905 <primary><option>received_headers_max</option></primary>
31906 </indexterm>
31907 </para>
31908 <informaltable frame="all">
31909 <tgroup cols="4" colsep="0" rowsep="0">
31910 <colspec colwidth="8*" align="left"/>
31911 <colspec colwidth="6*" align="center"/>
31912 <colspec colwidth="6*" align="center"/>
31913 <colspec colwidth="6*" align="right"/>
31914 <tbody>
31915 <row>
31916 <entry><option>received_headers_max</option></entry>
31917 <entry>Use: <emphasis>main</emphasis></entry>
31918 <entry>Type: <emphasis>integer</emphasis></entry>
31919 <entry>Default: <emphasis>30</emphasis></entry>
31920 </row>
31921 </tbody>
31922 </tgroup>
31923 </informaltable>
31924 <para>
31925 <indexterm role="concept">
31926 <primary>loop</primary>
31927 <secondary>prevention</secondary>
31928 </indexterm>
31929 <indexterm role="concept">
31930 <primary>mail loop prevention</primary>
31931 </indexterm>
31932 <indexterm role="concept">
31933 <primary><emphasis>Received:</emphasis> header line</primary>
31934 <secondary>counting</secondary>
31935 </indexterm>
31936 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
31937 counted, and if it is greater than this parameter, a mail loop is assumed to
31938 have occurred, the delivery is abandoned, and an error message is generated.
31939 This applies to both local and remote deliveries.
31940 </para>
31941 <para>
31942 <indexterm role="option">
31943 <primary><option>recipient_unqualified_hosts</option></primary>
31944 </indexterm>
31945 </para>
31946 <informaltable frame="all">
31947 <tgroup cols="4" colsep="0" rowsep="0">
31948 <colspec colwidth="8*" align="left"/>
31949 <colspec colwidth="6*" align="center"/>
31950 <colspec colwidth="6*" align="center"/>
31951 <colspec colwidth="6*" align="right"/>
31952 <tbody>
31953 <row>
31954 <entry><option>recipient_unqualified_hosts</option></entry>
31955 <entry>Use: <emphasis>main</emphasis></entry>
31956 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31957 <entry>Default: <emphasis>unset</emphasis></entry>
31958 </row>
31959 </tbody>
31960 </tgroup>
31961 </informaltable>
31962 <para>
31963 <indexterm role="concept">
31964 <primary>unqualified addresses</primary>
31965 </indexterm>
31966 <indexterm role="concept">
31967 <primary>host</primary>
31968 <secondary>unqualified addresses from</secondary>
31969 </indexterm>
31970 This option lists those hosts from which Exim is prepared to accept unqualified
31971 recipient addresses in message envelopes. The addresses are made fully
31972 qualified by the addition of the <option>qualify_recipient</option> value. This option also
31973 affects message header lines. Exim does not reject unqualified recipient
31974 addresses in headers, but it qualifies them only if the message came from a
31975 host that matches <option>recipient_unqualified_hosts</option>,
31976 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
31977 option was not set.
31978 </para>
31979 <para>
31980 <indexterm role="option">
31981 <primary><option>recipients_max</option></primary>
31982 </indexterm>
31983 </para>
31984 <informaltable frame="all">
31985 <tgroup cols="4" colsep="0" rowsep="0">
31986 <colspec colwidth="8*" align="left"/>
31987 <colspec colwidth="6*" align="center"/>
31988 <colspec colwidth="6*" align="center"/>
31989 <colspec colwidth="6*" align="right"/>
31990 <tbody>
31991 <row>
31992 <entry><option>recipients_max</option></entry>
31993 <entry>Use: <emphasis>main</emphasis></entry>
31994 <entry>Type: <emphasis>integer</emphasis></entry>
31995 <entry>Default: <emphasis>50000</emphasis></entry>
31996 </row>
31997 </tbody>
31998 </tgroup>
31999 </informaltable>
32000 <para>
32001 <indexterm role="concept">
32002 <primary>limit</primary>
32003 <secondary>number of recipients</secondary>
32004 </indexterm>
32005 <indexterm role="concept">
32006 <primary>recipient</primary>
32007 <secondary>maximum number</secondary>
32008 </indexterm>
32009 If this option is set greater than zero, it specifies the maximum number of
32010 original recipients for any message. Additional recipients that are generated
32011 by aliasing or forwarding do not count. SMTP messages get a 452 response for
32012 all recipients over the limit; earlier recipients are delivered as normal.
32013 Non-SMTP messages with too many recipients are failed, and no deliveries are
32014 done.
32015 </para>
32016 <para>
32017 <indexterm role="concept">
32018 <primary>RCPT</primary>
32019 <secondary>maximum number of incoming</secondary>
32020 </indexterm>
32021 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
32022 RCPT commands in a single message.
32023 </para>
32024 <para>
32025 <indexterm role="option">
32026 <primary><option>recipients_max_reject</option></primary>
32027 </indexterm>
32028 </para>
32029 <informaltable frame="all">
32030 <tgroup cols="4" colsep="0" rowsep="0">
32031 <colspec colwidth="8*" align="left"/>
32032 <colspec colwidth="6*" align="center"/>
32033 <colspec colwidth="6*" align="center"/>
32034 <colspec colwidth="6*" align="right"/>
32035 <tbody>
32036 <row>
32037 <entry><option>recipients_max_reject</option></entry>
32038 <entry>Use: <emphasis>main</emphasis></entry>
32039 <entry>Type: <emphasis>boolean</emphasis></entry>
32040 <entry>Default: <emphasis>false</emphasis></entry>
32041 </row>
32042 </tbody>
32043 </tgroup>
32044 </informaltable>
32045 <para>
32046 If this option is set true, Exim rejects SMTP messages containing too many
32047 recipients by giving 552 errors to the surplus RCPT commands, and a 554
32048 error to the eventual DATA command. Otherwise (the default) it gives a 452
32049 error to the surplus RCPT commands and accepts the message on behalf of the
32050 initial set of recipients. The remote server should then re-send the message
32051 for the remaining recipients at a later time.
32052 </para>
32053 <para>
32054 <indexterm role="option">
32055 <primary><option>remote_max_parallel</option></primary>
32056 </indexterm>
32057 </para>
32058 <informaltable frame="all">
32059 <tgroup cols="4" colsep="0" rowsep="0">
32060 <colspec colwidth="8*" align="left"/>
32061 <colspec colwidth="6*" align="center"/>
32062 <colspec colwidth="6*" align="center"/>
32063 <colspec colwidth="6*" align="right"/>
32064 <tbody>
32065 <row>
32066 <entry><option>remote_max_parallel</option></entry>
32067 <entry>Use: <emphasis>main</emphasis></entry>
32068 <entry>Type: <emphasis>integer</emphasis></entry>
32069 <entry>Default: <emphasis>4</emphasis></entry>
32070 </row>
32071 </tbody>
32072 </tgroup>
32073 </informaltable>
32074 <para>
32075 <indexterm role="concept">
32076 <primary>delivery</primary>
32077 <secondary>parallelism for remote</secondary>
32078 </indexterm>
32079 This option controls parallel delivery of one message to a number of remote
32080 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
32081 does all the remote deliveries for a message one by one. Otherwise, if a single
32082 message has to be delivered to more than one remote host, or if several copies
32083 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
32084 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
32085 deliveries are required, the maximum number of processes are started, and as
32086 each one finishes, another is begun. The order of starting processes is the
32087 same as if sequential delivery were being done, and can be controlled by the
32088 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
32089 with debugging turned on, the debugging output from each delivery process is
32090 tagged with its process id.
32091 </para>
32092 <para>
32093 This option controls only the maximum number of parallel deliveries for one
32094 message in one Exim delivery process. Because Exim has no central queue
32095 manager, there is no way of controlling the total number of simultaneous
32096 deliveries if the configuration allows a delivery attempt as soon as a message
32097 is received.
32098 </para>
32099 <para>
32100 See also the <option>max_parallel</option> generic transport option,
32101 and the <option>serialize_hosts</option> smtp transport option.
32102 </para>
32103 <para>
32104 <indexterm role="concept">
32105 <primary>number of deliveries</primary>
32106 </indexterm>
32107 <indexterm role="concept">
32108 <primary>delivery</primary>
32109 <secondary>maximum number of</secondary>
32110 </indexterm>
32111 If you want to control the total number of deliveries on the system, you
32112 need to set the <option>queue_only</option> option. This ensures that all incoming messages
32113 are added to the queue without starting a delivery process. Then set up an Exim
32114 daemon to start queue runner processes at appropriate intervals (probably
32115 fairly often, for example, every minute), and limit the total number of queue
32116 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
32117 delivers only one message at a time, the maximum number of deliveries that can
32118 then take place at once is <option>queue_run_max</option> multiplied by
32119 <option>remote_max_parallel</option>.
32120 </para>
32121 <para>
32122 If it is purely remote deliveries you want to control, use
32123 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
32124 doing the SMTP routing before queueing, so that several messages for the same
32125 host will eventually get delivered down the same connection.
32126 </para>
32127 <para>
32128 <indexterm role="option">
32129 <primary><option>remote_sort_domains</option></primary>
32130 </indexterm>
32131 </para>
32132 <informaltable frame="all">
32133 <tgroup cols="4" colsep="0" rowsep="0">
32134 <colspec colwidth="8*" align="left"/>
32135 <colspec colwidth="6*" align="center"/>
32136 <colspec colwidth="6*" align="center"/>
32137 <colspec colwidth="6*" align="right"/>
32138 <tbody>
32139 <row>
32140 <entry><option>remote_sort_domains</option></entry>
32141 <entry>Use: <emphasis>main</emphasis></entry>
32142 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
32143 <entry>Default: <emphasis>unset</emphasis></entry>
32144 </row>
32145 </tbody>
32146 </tgroup>
32147 </informaltable>
32148 <para>
32149 <indexterm role="concept">
32150 <primary>sorting remote deliveries</primary>
32151 </indexterm>
32152 <indexterm role="concept">
32153 <primary>delivery</primary>
32154 <secondary>sorting remote</secondary>
32155 </indexterm>
32156 When there are a number of remote deliveries for a message, they are sorted by
32157 domain into the order given by this list. For example,
32158 </para>
32159 <literallayout class="monospaced">
32160 remote_sort_domains = *.cam.ac.uk:*.uk
32161 </literallayout>
32162 <para>
32163 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
32164 then to those in the <option>uk</option> domain, then to any others.
32165 </para>
32166 <para>
32167 <indexterm role="option">
32168 <primary><option>retry_data_expire</option></primary>
32169 </indexterm>
32170 </para>
32171 <informaltable frame="all">
32172 <tgroup cols="4" colsep="0" rowsep="0">
32173 <colspec colwidth="8*" align="left"/>
32174 <colspec colwidth="6*" align="center"/>
32175 <colspec colwidth="6*" align="center"/>
32176 <colspec colwidth="6*" align="right"/>
32177 <tbody>
32178 <row>
32179 <entry><option>retry_data_expire</option></entry>
32180 <entry>Use: <emphasis>main</emphasis></entry>
32181 <entry>Type: <emphasis>time</emphasis></entry>
32182 <entry>Default: <emphasis>7d</emphasis></entry>
32183 </row>
32184 </tbody>
32185 </tgroup>
32186 </informaltable>
32187 <para>
32188 <indexterm role="concept">
32189 <primary>hints database</primary>
32190 <secondary>data expiry</secondary>
32191 </indexterm>
32192 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
32193 database. Any older retry data is ignored. This means that, for example, once a
32194 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
32195 past failures.
32196 </para>
32197 <para>
32198 <indexterm role="option">
32199 <primary><option>retry_interval_max</option></primary>
32200 </indexterm>
32201 </para>
32202 <informaltable frame="all">
32203 <tgroup cols="4" colsep="0" rowsep="0">
32204 <colspec colwidth="8*" align="left"/>
32205 <colspec colwidth="6*" align="center"/>
32206 <colspec colwidth="6*" align="center"/>
32207 <colspec colwidth="6*" align="right"/>
32208 <tbody>
32209 <row>
32210 <entry><option>retry_interval_max</option></entry>
32211 <entry>Use: <emphasis>main</emphasis></entry>
32212 <entry>Type: <emphasis>time</emphasis></entry>
32213 <entry>Default: <emphasis>24h</emphasis></entry>
32214 </row>
32215 </tbody>
32216 </tgroup>
32217 </informaltable>
32218 <para>
32219 <indexterm role="concept">
32220 <primary>retry</primary>
32221 <secondary>limit on interval</secondary>
32222 </indexterm>
32223 <indexterm role="concept">
32224 <primary>limit</primary>
32225 <secondary>on retry interval</secondary>
32226 </indexterm>
32227 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
32228 intervals between delivery attempts for messages that cannot be delivered
32229 straight away. This option sets an overall limit to the length of time between
32230 retries. It cannot be set greater than 24 hours; any attempt to do so forces
32231 the default value.
32232 </para>
32233 <para>
32234 <indexterm role="option">
32235 <primary><option>return_path_remove</option></primary>
32236 </indexterm>
32237 </para>
32238 <informaltable frame="all">
32239 <tgroup cols="4" colsep="0" rowsep="0">
32240 <colspec colwidth="8*" align="left"/>
32241 <colspec colwidth="6*" align="center"/>
32242 <colspec colwidth="6*" align="center"/>
32243 <colspec colwidth="6*" align="right"/>
32244 <tbody>
32245 <row>
32246 <entry><option>return_path_remove</option></entry>
32247 <entry>Use: <emphasis>main</emphasis></entry>
32248 <entry>Type: <emphasis>boolean</emphasis></entry>
32249 <entry>Default: <emphasis>true</emphasis></entry>
32250 </row>
32251 </tbody>
32252 </tgroup>
32253 </informaltable>
32254 <para>
32255 <indexterm role="concept">
32256 <primary><emphasis>Return-path:</emphasis> header line</primary>
32257 <secondary>removing</secondary>
32258 </indexterm>
32259 RFC 2821, section 4.4, states that an SMTP server must insert a
32260 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
32261 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
32262 MAIL command. This description implies that this header should not be present
32263 in an incoming message. If <option>return_path_remove</option> is true, any existing
32264 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
32265 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
32266 the time of delivery. They are normally used only for final local deliveries.
32267 </para>
32268 <para>
32269 <indexterm role="option">
32270 <primary><option>return_size_limit</option></primary>
32271 </indexterm>
32272 </para>
32273 <informaltable frame="all">
32274 <tgroup cols="4" colsep="0" rowsep="0">
32275 <colspec colwidth="8*" align="left"/>
32276 <colspec colwidth="6*" align="center"/>
32277 <colspec colwidth="6*" align="center"/>
32278 <colspec colwidth="6*" align="right"/>
32279 <tbody>
32280 <row>
32281 <entry><option>return_size_limit</option></entry>
32282 <entry>Use: <emphasis>main</emphasis></entry>
32283 <entry>Type: <emphasis>integer</emphasis></entry>
32284 <entry>Default: <emphasis>100K</emphasis></entry>
32285 </row>
32286 </tbody>
32287 </tgroup>
32288 </informaltable>
32289 <para>
32290 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
32291 </para>
32292 <para>
32293 <indexterm role="option">
32294 <primary><option>rfc1413_hosts</option></primary>
32295 </indexterm>
32296 </para>
32297 <informaltable frame="all">
32298 <tgroup cols="4" colsep="0" rowsep="0">
32299 <colspec colwidth="8*" align="left"/>
32300 <colspec colwidth="6*" align="center"/>
32301 <colspec colwidth="6*" align="center"/>
32302 <colspec colwidth="6*" align="right"/>
32303 <tbody>
32304 <row>
32305 <entry><option>rfc1413_hosts</option></entry>
32306 <entry>Use: <emphasis>main</emphasis></entry>
32307 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32308 <entry>Default: <emphasis>@[]</emphasis></entry>
32309 </row>
32310 </tbody>
32311 </tgroup>
32312 </informaltable>
32313 <para>
32314 <indexterm role="concept">
32315 <primary>RFC 1413</primary>
32316 </indexterm>
32317 <indexterm role="concept">
32318 <primary>host</primary>
32319 <secondary>for RFC 1413 calls</secondary>
32320 </indexterm>
32321 RFC 1413 identification calls are made to any client host which matches
32322 an item in the list.
32323 The default value specifies just this host, being any local interface
32324 for the system.
32325 </para>
32326 <para>
32327 <indexterm role="option">
32328 <primary><option>rfc1413_query_timeout</option></primary>
32329 </indexterm>
32330 </para>
32331 <informaltable frame="all">
32332 <tgroup cols="4" colsep="0" rowsep="0">
32333 <colspec colwidth="8*" align="left"/>
32334 <colspec colwidth="6*" align="center"/>
32335 <colspec colwidth="6*" align="center"/>
32336 <colspec colwidth="6*" align="right"/>
32337 <tbody>
32338 <row>
32339 <entry><option>rfc1413_query_timeout</option></entry>
32340 <entry>Use: <emphasis>main</emphasis></entry>
32341 <entry>Type: <emphasis>time</emphasis></entry>
32342 <entry>Default: <emphasis>0s</emphasis></entry>
32343 </row>
32344 </tbody>
32345 </tgroup>
32346 </informaltable>
32347 <para>
32348 <indexterm role="concept">
32349 <primary>RFC 1413</primary>
32350 <secondary>query timeout</secondary>
32351 </indexterm>
32352 <indexterm role="concept">
32353 <primary>timeout</primary>
32354 <secondary>for RFC 1413 call</secondary>
32355 </indexterm>
32356 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
32357 no RFC 1413 calls are ever made.
32358 </para>
32359 <para>
32360 <indexterm role="option">
32361 <primary><option>sender_unqualified_hosts</option></primary>
32362 </indexterm>
32363 </para>
32364 <informaltable frame="all">
32365 <tgroup cols="4" colsep="0" rowsep="0">
32366 <colspec colwidth="8*" align="left"/>
32367 <colspec colwidth="6*" align="center"/>
32368 <colspec colwidth="6*" align="center"/>
32369 <colspec colwidth="6*" align="right"/>
32370 <tbody>
32371 <row>
32372 <entry><option>sender_unqualified_hosts</option></entry>
32373 <entry>Use: <emphasis>main</emphasis></entry>
32374 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32375 <entry>Default: <emphasis>unset</emphasis></entry>
32376 </row>
32377 </tbody>
32378 </tgroup>
32379 </informaltable>
32380 <para>
32381 <indexterm role="concept">
32382 <primary>unqualified addresses</primary>
32383 </indexterm>
32384 <indexterm role="concept">
32385 <primary>host</primary>
32386 <secondary>unqualified addresses from</secondary>
32387 </indexterm>
32388 This option lists those hosts from which Exim is prepared to accept unqualified
32389 sender addresses. The addresses are made fully qualified by the addition of
32390 <option>qualify_domain</option>. This option also affects message header lines. Exim does
32391 not reject unqualified addresses in headers that contain sender addresses, but
32392 it qualifies them only if the message came from a host that matches
32393 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
32394 using TCP/IP), and the <option>-bnq</option> option was not set.
32395 </para>
32396 <para>
32397 <indexterm role="option">
32398 <primary><option>slow_lookup_log</option></primary>
32399 </indexterm>
32400 </para>
32401 <informaltable frame="all">
32402 <tgroup cols="4" colsep="0" rowsep="0">
32403 <colspec colwidth="8*" align="left"/>
32404 <colspec colwidth="6*" align="center"/>
32405 <colspec colwidth="6*" align="center"/>
32406 <colspec colwidth="6*" align="right"/>
32407 <tbody>
32408 <row>
32409 <entry><option>slow_lookup_log</option></entry>
32410 <entry>Use: <emphasis>main</emphasis></entry>
32411 <entry>Type: <emphasis>integer</emphasis></entry>
32412 <entry>Default: <emphasis>0</emphasis></entry>
32413 </row>
32414 </tbody>
32415 </tgroup>
32416 </informaltable>
32417 <para>
32418 <indexterm role="concept">
32419 <primary>logging</primary>
32420 <secondary>slow lookups</secondary>
32421 </indexterm>
32422 <indexterm role="concept">
32423 <primary>dns</primary>
32424 <secondary>logging slow lookups</secondary>
32425 </indexterm>
32426 This option controls logging of slow lookups.
32427 If the value is nonzero it is taken as a number of milliseconds
32428 and lookups taking longer than this are logged.
32429 Currently this applies only to DNS lookups.
32430 </para>
32431 <para>
32432 <indexterm role="option">
32433 <primary><option>smtp_accept_keepalive</option></primary>
32434 </indexterm>
32435 </para>
32436 <informaltable frame="all">
32437 <tgroup cols="4" colsep="0" rowsep="0">
32438 <colspec colwidth="8*" align="left"/>
32439 <colspec colwidth="6*" align="center"/>
32440 <colspec colwidth="6*" align="center"/>
32441 <colspec colwidth="6*" align="right"/>
32442 <tbody>
32443 <row>
32444 <entry><option>smtp_accept_keepalive</option></entry>
32445 <entry>Use: <emphasis>main</emphasis></entry>
32446 <entry>Type: <emphasis>boolean</emphasis></entry>
32447 <entry>Default: <emphasis>true</emphasis></entry>
32448 </row>
32449 </tbody>
32450 </tgroup>
32451 </informaltable>
32452 <para>
32453 <indexterm role="concept">
32454 <primary>keepalive</primary>
32455 <secondary>on incoming connection</secondary>
32456 </indexterm>
32457 This option controls the setting of the SO_KEEPALIVE option on incoming
32458 TCP/IP socket connections. When set, it causes the kernel to probe idle
32459 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
32460 other end of the connection should send an acknowledgment if the connection is
32461 still okay or a reset if the connection has been aborted. The reason for doing
32462 this is that it has the beneficial effect of freeing up certain types of
32463 connection that can get stuck when the remote host is disconnected without
32464 tidying up the TCP/IP call properly. The keepalive mechanism takes several
32465 hours to detect unreachable hosts.
32466 </para>
32467 <para>
32468 <indexterm role="option">
32469 <primary><option>smtp_accept_max</option></primary>
32470 </indexterm>
32471 </para>
32472 <informaltable frame="all">
32473 <tgroup cols="4" colsep="0" rowsep="0">
32474 <colspec colwidth="8*" align="left"/>
32475 <colspec colwidth="6*" align="center"/>
32476 <colspec colwidth="6*" align="center"/>
32477 <colspec colwidth="6*" align="right"/>
32478 <tbody>
32479 <row>
32480 <entry><option>smtp_accept_max</option></entry>
32481 <entry>Use: <emphasis>main</emphasis></entry>
32482 <entry>Type: <emphasis>integer</emphasis></entry>
32483 <entry>Default: <emphasis>20</emphasis></entry>
32484 </row>
32485 </tbody>
32486 </tgroup>
32487 </informaltable>
32488 <para>
32489 <indexterm role="concept">
32490 <primary>limit</primary>
32491 <secondary>incoming SMTP connections</secondary>
32492 </indexterm>
32493 <indexterm role="concept">
32494 <primary>SMTP</primary>
32495 <secondary>incoming connection count</secondary>
32496 </indexterm>
32497 <indexterm role="concept">
32498 <primary>inetd</primary>
32499 </indexterm>
32500 This option specifies the maximum number of simultaneous incoming SMTP calls
32501 that Exim will accept. It applies only to the listening daemon; there is no
32502 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
32503 value is set to zero, no limit is applied. However, it is required to be
32504 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
32505 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
32506 </para>
32507 <para>
32508 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
32509 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
32510 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
32511 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
32512 </para>
32513 <para>
32514 <indexterm role="option">
32515 <primary><option>smtp_accept_max_nonmail</option></primary>
32516 </indexterm>
32517 </para>
32518 <informaltable frame="all">
32519 <tgroup cols="4" colsep="0" rowsep="0">
32520 <colspec colwidth="8*" align="left"/>
32521 <colspec colwidth="6*" align="center"/>
32522 <colspec colwidth="6*" align="center"/>
32523 <colspec colwidth="6*" align="right"/>
32524 <tbody>
32525 <row>
32526 <entry><option>smtp_accept_max_nonmail</option></entry>
32527 <entry>Use: <emphasis>main</emphasis></entry>
32528 <entry>Type: <emphasis>integer</emphasis></entry>
32529 <entry>Default: <emphasis>10</emphasis></entry>
32530 </row>
32531 </tbody>
32532 </tgroup>
32533 </informaltable>
32534 <para>
32535 <indexterm role="concept">
32536 <primary>limit</primary>
32537 <secondary>non-mail SMTP commands</secondary>
32538 </indexterm>
32539 <indexterm role="concept">
32540 <primary>SMTP</primary>
32541 <secondary>limiting non-mail commands</secondary>
32542 </indexterm>
32543 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
32544 the connection if there are too many. This option defines <quote>too many</quote>. The
32545 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
32546 client looping sending EHLO, for example. The check is applied only if the
32547 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
32548 </para>
32549 <para>
32550 When a new message is expected, one occurrence of RSET is not counted. This
32551 allows a client to send one RSET between messages (this is not necessary,
32552 but some clients do it). Exim also allows one uncounted occurrence of HELO
32553 or EHLO, and one occurrence of STARTTLS between messages. After
32554 starting up a TLS session, another EHLO is expected, and so it too is not
32555 counted. The first occurrence of AUTH in a connection, or immediately
32556 following STARTTLS is not counted. Otherwise, all commands other than
32557 MAIL, RCPT, DATA, and QUIT are counted.
32558 </para>
32559 <para>
32560 <indexterm role="option">
32561 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
32562 </indexterm>
32563 </para>
32564 <informaltable frame="all">
32565 <tgroup cols="4" colsep="0" rowsep="0">
32566 <colspec colwidth="8*" align="left"/>
32567 <colspec colwidth="6*" align="center"/>
32568 <colspec colwidth="6*" align="center"/>
32569 <colspec colwidth="6*" align="right"/>
32570 <tbody>
32571 <row>
32572 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
32573 <entry>Use: <emphasis>main</emphasis></entry>
32574 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32575 <entry>Default: <emphasis>*</emphasis></entry>
32576 </row>
32577 </tbody>
32578 </tgroup>
32579 </informaltable>
32580 <para>
32581 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
32582 check by setting this option. The default value makes it apply to all hosts. By
32583 changing the value, you can exclude any badly-behaved hosts that you have to
32584 live with.
32585 </para>
32586 <para>
32587 <indexterm role="option">
32588 <primary><option>smtp_accept_max_per_connection</option></primary>
32589 </indexterm>
32590 </para>
32591 <informaltable frame="all">
32592 <tgroup cols="4" colsep="0" rowsep="0">
32593 <colspec colwidth="8*" align="left"/>
32594 <colspec colwidth="6*" align="center"/>
32595 <colspec colwidth="6*" align="center"/>
32596 <colspec colwidth="6*" align="right"/>
32597 <tbody>
32598 <row>
32599 <entry><option>smtp_accept_max_per_connection</option></entry>
32600 <entry>Use: <emphasis>main</emphasis></entry>
32601 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
32602 <entry>Default: <emphasis>1000</emphasis></entry>
32603 </row>
32604 </tbody>
32605 </tgroup>
32606 </informaltable>
32607 <para>
32608 <indexterm role="concept">
32609 <primary>SMTP</primary>
32610 <secondary>limiting incoming message count</secondary>
32611 </indexterm>
32612 <indexterm role="concept">
32613 <primary>limit</primary>
32614 <secondary>messages per SMTP connection</secondary>
32615 </indexterm>
32616 The value of this option limits the number of MAIL commands that Exim is
32617 prepared to accept over a single SMTP connection, whether or not each command
32618 results in the transfer of a message. After the limit is reached, a 421
32619 response is given to subsequent MAIL commands. This limit is a safety
32620 precaution against a client that goes mad (incidents of this type have been
32621 seen).
32622 The option is expanded after the HELO or EHLO is received
32623 and may depend on values available at that time.
32624 An empty or zero value after expansion removes the limit.
32625 </para>
32626 <para>
32627 <indexterm role="option">
32628 <primary><option>smtp_accept_max_per_host</option></primary>
32629 </indexterm>
32630 </para>
32631 <informaltable frame="all">
32632 <tgroup cols="4" colsep="0" rowsep="0">
32633 <colspec colwidth="8*" align="left"/>
32634 <colspec colwidth="6*" align="center"/>
32635 <colspec colwidth="6*" align="center"/>
32636 <colspec colwidth="6*" align="right"/>
32637 <tbody>
32638 <row>
32639 <entry><option>smtp_accept_max_per_host</option></entry>
32640 <entry>Use: <emphasis>main</emphasis></entry>
32641 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32642 <entry>Default: <emphasis>unset</emphasis></entry>
32643 </row>
32644 </tbody>
32645 </tgroup>
32646 </informaltable>
32647 <para>
32648 <indexterm role="concept">
32649 <primary>limit</primary>
32650 <secondary>SMTP connections from one host</secondary>
32651 </indexterm>
32652 <indexterm role="concept">
32653 <primary>host</primary>
32654 <secondary>limiting SMTP connections from</secondary>
32655 </indexterm>
32656 This option restricts the number of simultaneous IP connections from a single
32657 host (strictly, from a single IP address) to the Exim daemon. The option is
32658 expanded, to enable different limits to be applied to different hosts by
32659 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
32660 connection attempts from the same host are rejected with error code 421. This
32661 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
32662 of zero imposes no limit. If this option is set greater than zero, it is
32663 required that <option>smtp_accept_max</option> be non-zero.
32664 </para>
32665 <para>
32666 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
32667 constructions that take an appreciable amount of time. The expansion and test
32668 happen in the main daemon loop, in order to reject additional connections
32669 without forking additional processes (otherwise a denial-of-service attack
32670 could cause a vast number or processes to be created). While the daemon is
32671 doing this processing, it cannot accept any other incoming connections.
32672 </para>
32673 <para>
32674 <indexterm role="option">
32675 <primary><option>smtp_accept_queue</option></primary>
32676 </indexterm>
32677 </para>
32678 <informaltable frame="all">
32679 <tgroup cols="4" colsep="0" rowsep="0">
32680 <colspec colwidth="8*" align="left"/>
32681 <colspec colwidth="6*" align="center"/>
32682 <colspec colwidth="6*" align="center"/>
32683 <colspec colwidth="6*" align="right"/>
32684 <tbody>
32685 <row>
32686 <entry><option>smtp_accept_queue</option></entry>
32687 <entry>Use: <emphasis>main</emphasis></entry>
32688 <entry>Type: <emphasis>integer</emphasis></entry>
32689 <entry>Default: <emphasis>0</emphasis></entry>
32690 </row>
32691 </tbody>
32692 </tgroup>
32693 </informaltable>
32694 <para>
32695 <indexterm role="concept">
32696 <primary>SMTP</primary>
32697 <secondary>incoming connection count</secondary>
32698 </indexterm>
32699 <indexterm role="concept">
32700 <primary>queueing incoming messages</primary>
32701 </indexterm>
32702 <indexterm role="concept">
32703 <primary>message</primary>
32704 <secondary>queueing by SMTP connection count</secondary>
32705 </indexterm>
32706 If the number of simultaneous incoming SMTP connections being handled via the
32707 listening daemon exceeds this value, messages received by SMTP are just placed
32708 in the queue; no delivery processes are started automatically. The count is
32709 fixed at the start of an SMTP connection. It cannot be updated in the
32710 subprocess that receives messages, and so the queueing or not queueing applies
32711 to all messages received in the same connection.
32712 </para>
32713 <para>
32714 A value of zero implies no limit, and clearly any non-zero value is useful only
32715 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
32716 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
32717 various <option>-od</option><emphasis>x</emphasis> command line options.
32718 </para>
32719 <para>
32720 <indexterm role="option">
32721 <primary><option>smtp_accept_queue_per_connection</option></primary>
32722 </indexterm>
32723 </para>
32724 <informaltable frame="all">
32725 <tgroup cols="4" colsep="0" rowsep="0">
32726 <colspec colwidth="8*" align="left"/>
32727 <colspec colwidth="6*" align="center"/>
32728 <colspec colwidth="6*" align="center"/>
32729 <colspec colwidth="6*" align="right"/>
32730 <tbody>
32731 <row>
32732 <entry><option>smtp_accept_queue_per_connection</option></entry>
32733 <entry>Use: <emphasis>main</emphasis></entry>
32734 <entry>Type: <emphasis>integer</emphasis></entry>
32735 <entry>Default: <emphasis>10</emphasis></entry>
32736 </row>
32737 </tbody>
32738 </tgroup>
32739 </informaltable>
32740 <para>
32741 <indexterm role="concept">
32742 <primary>queueing incoming messages</primary>
32743 </indexterm>
32744 <indexterm role="concept">
32745 <primary>message</primary>
32746 <secondary>queueing by message count</secondary>
32747 </indexterm>
32748 This option limits the number of delivery processes that Exim starts
32749 automatically when receiving messages via SMTP, whether via the daemon or by
32750 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
32751 and the number of messages received in a single SMTP session exceeds this
32752 number, subsequent messages are placed in the queue, but no delivery processes
32753 are started. This helps to limit the number of Exim processes when a server
32754 restarts after downtime and there is a lot of mail waiting for it on other
32755 systems. On large systems, the default should probably be increased, and on
32756 dial-in client systems it should probably be set to zero (that is, disabled).
32757 </para>
32758 <para>
32759 <indexterm role="option">
32760 <primary><option>smtp_accept_reserve</option></primary>
32761 </indexterm>
32762 </para>
32763 <informaltable frame="all">
32764 <tgroup cols="4" colsep="0" rowsep="0">
32765 <colspec colwidth="8*" align="left"/>
32766 <colspec colwidth="6*" align="center"/>
32767 <colspec colwidth="6*" align="center"/>
32768 <colspec colwidth="6*" align="right"/>
32769 <tbody>
32770 <row>
32771 <entry><option>smtp_accept_reserve</option></entry>
32772 <entry>Use: <emphasis>main</emphasis></entry>
32773 <entry>Type: <emphasis>integer</emphasis></entry>
32774 <entry>Default: <emphasis>0</emphasis></entry>
32775 </row>
32776 </tbody>
32777 </tgroup>
32778 </informaltable>
32779 <para>
32780 <indexterm role="concept">
32781 <primary>SMTP</primary>
32782 <secondary>incoming call count</secondary>
32783 </indexterm>
32784 <indexterm role="concept">
32785 <primary>host</primary>
32786 <secondary>reserved</secondary>
32787 </indexterm>
32788 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
32789 number of SMTP connections that are reserved for connections from the hosts
32790 that are specified in <option>smtp_reserve_hosts</option>. The value set in
32791 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
32792 restricted to this number of connections; the option specifies a minimum number
32793 of connection slots for them, not a maximum. It is a guarantee that this group
32794 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
32795 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
32796 individual host.
32797 </para>
32798 <para>
32799 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
32800 set to 5, once there are 45 active connections (from any hosts), new
32801 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
32802 provided the other criteria for acceptance are met.
32803 </para>
32804 <para>
32805 <indexterm role="option">
32806 <primary><option>smtp_active_hostname</option></primary>
32807 </indexterm>
32808 </para>
32809 <informaltable frame="all">
32810 <tgroup cols="4" colsep="0" rowsep="0">
32811 <colspec colwidth="8*" align="left"/>
32812 <colspec colwidth="6*" align="center"/>
32813 <colspec colwidth="6*" align="center"/>
32814 <colspec colwidth="6*" align="right"/>
32815 <tbody>
32816 <row>
32817 <entry><option>smtp_active_hostname</option></entry>
32818 <entry>Use: <emphasis>main</emphasis></entry>
32819 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32820 <entry>Default: <emphasis>unset</emphasis></entry>
32821 </row>
32822 </tbody>
32823 </tgroup>
32824 </informaltable>
32825 <para>
32826 <indexterm role="concept">
32827 <primary>host</primary>
32828 <secondary>name in SMTP responses</secondary>
32829 </indexterm>
32830 <indexterm role="concept">
32831 <primary>SMTP</primary>
32832 <secondary>host name in responses</secondary>
32833 </indexterm>
32834 <indexterm role="variable">
32835 <primary><varname>$primary_hostname</varname></primary>
32836 </indexterm>
32837 This option is provided for multi-homed servers that want to masquerade as
32838 several different hosts. At the start of an incoming SMTP connection, its value
32839 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
32840 responses. For example, it is used as domain name in the response to an
32841 incoming HELO or EHLO command.
32842 </para>
32843 <para>
32844 <indexterm role="variable">
32845 <primary><varname>$smtp_active_hostname</varname></primary>
32846 </indexterm>
32847 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
32848 is saved with any messages that are received. It is therefore available for use
32849 in routers and transports when the message is later delivered.
32850 </para>
32851 <para>
32852 If this option is unset, or if its expansion is forced to fail, or if the
32853 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
32854 used. Other expansion failures cause a message to be written to the main and
32855 panic logs, and the SMTP command receives a temporary error. Typically, the
32856 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
32857 For example:
32858 </para>
32859 <literallayout class="monospaced">
32860 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
32861   {cox.mydomain}{box.mydomain}}
32862 </literallayout>
32863 <para>
32864 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
32865 messages, it is also used as the default for HELO commands in callout
32866 verification if there is no remote transport from which to obtain a
32867 <option>helo_data</option> value.
32868 </para>
32869 <para>
32870 <indexterm role="option">
32871 <primary><option>smtp_backlog_monitor</option></primary>
32872 </indexterm>
32873 </para>
32874 <informaltable frame="all">
32875 <tgroup cols="4" colsep="0" rowsep="0">
32876 <colspec colwidth="8*" align="left"/>
32877 <colspec colwidth="6*" align="center"/>
32878 <colspec colwidth="6*" align="center"/>
32879 <colspec colwidth="6*" align="right"/>
32880 <tbody>
32881 <row>
32882 <entry><option>smtp_backlog_monitor</option></entry>
32883 <entry>Use: <emphasis>main</emphasis></entry>
32884 <entry>Type: <emphasis>integer</emphasis></entry>
32885 <entry>Default: <emphasis>0</emphasis></entry>
32886 </row>
32887 </tbody>
32888 </tgroup>
32889 </informaltable>
32890 <para>
32891 <indexterm role="concept">
32892 <primary>connection backlog</primary>
32893 <secondary>monitoring</secondary>
32894 </indexterm>
32895 If this option is set to greater than zero, and the backlog of available
32896 TCP connections on a socket listening for SMTP is larger than it, a line
32897 is logged giving the value and the socket address and port.
32898 The value is retrived jsut before an accept call.
32899 This facility is only available on Linux.
32900 </para>
32901 <para>
32902 <indexterm role="option">
32903 <primary><option>smtp_banner</option></primary>
32904 </indexterm>
32905 </para>
32906 <informaltable frame="all">
32907 <tgroup cols="4" colsep="0" rowsep="0">
32908 <colspec colwidth="8*" align="left"/>
32909 <colspec colwidth="6*" align="center"/>
32910 <colspec colwidth="6*" align="center"/>
32911 <colspec colwidth="6*" align="right"/>
32912 <tbody>
32913 <row>
32914 <entry><option>smtp_banner</option></entry>
32915 <entry>Use: <emphasis>main</emphasis></entry>
32916 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32917 <entry>Default: <emphasis>see below</emphasis></entry>
32918 </row>
32919 </tbody>
32920 </tgroup>
32921 </informaltable>
32922 <para>
32923 <indexterm role="concept">
32924 <primary>SMTP</primary>
32925 <secondary>welcome banner</secondary>
32926 </indexterm>
32927 <indexterm role="concept">
32928 <primary>banner for SMTP</primary>
32929 </indexterm>
32930 <indexterm role="concept">
32931 <primary>welcome banner for SMTP</primary>
32932 </indexterm>
32933 <indexterm role="concept">
32934 <primary>customizing</primary>
32935 <secondary>SMTP banner</secondary>
32936 </indexterm>
32937 If a connect ACL does not supply a message,
32938 this string (which is expanded every time it is used) is output as the initial
32939 positive response to an SMTP connection. The default setting is:
32940 </para>
32941 <literallayout class="monospaced">
32942 smtp_banner = $smtp_active_hostname ESMTP Exim \
32943   $version_number $tod_full
32944 </literallayout>
32945 <para revisionflag="changed">
32946 Failure to expand the string causes a panic error;
32947 a forced fail just closes the connection.
32948 </para>
32949 <para>
32950 If you want to create a
32951 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
32952 appropriate points, but not at the end. Note that the 220 code is not included
32953 in this string. Exim adds it automatically (several times in the case of a
32954 multiline response).
32955 </para>
32956 <para>
32957 <indexterm role="option">
32958 <primary><option>smtp_check_spool_space</option></primary>
32959 </indexterm>
32960 </para>
32961 <informaltable frame="all">
32962 <tgroup cols="4" colsep="0" rowsep="0">
32963 <colspec colwidth="8*" align="left"/>
32964 <colspec colwidth="6*" align="center"/>
32965 <colspec colwidth="6*" align="center"/>
32966 <colspec colwidth="6*" align="right"/>
32967 <tbody>
32968 <row>
32969 <entry><option>smtp_check_spool_space</option></entry>
32970 <entry>Use: <emphasis>main</emphasis></entry>
32971 <entry>Type: <emphasis>boolean</emphasis></entry>
32972 <entry>Default: <emphasis>true</emphasis></entry>
32973 </row>
32974 </tbody>
32975 </tgroup>
32976 </informaltable>
32977 <para>
32978 <indexterm role="concept">
32979 <primary>checking disk space</primary>
32980 </indexterm>
32981 <indexterm role="concept">
32982 <primary>disk space, checking</primary>
32983 </indexterm>
32984 <indexterm role="concept">
32985 <primary>spool directory</primary>
32986 <secondary>checking space</secondary>
32987 </indexterm>
32988 When this option is set, if an incoming SMTP session encounters the SIZE
32989 option on a MAIL command, it checks that there is enough space in the
32990 spool directory&#x2019;s partition to accept a message of that size, while still
32991 leaving free the amount specified by <option>check_spool_space</option> (even if that value
32992 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
32993 </para>
32994 <para>
32995 <indexterm role="option">
32996 <primary><option>smtp_connect_backlog</option></primary>
32997 </indexterm>
32998 </para>
32999 <informaltable frame="all">
33000 <tgroup cols="4" colsep="0" rowsep="0">
33001 <colspec colwidth="8*" align="left"/>
33002 <colspec colwidth="6*" align="center"/>
33003 <colspec colwidth="6*" align="center"/>
33004 <colspec colwidth="6*" align="right"/>
33005 <tbody>
33006 <row>
33007 <entry><option>smtp_connect_backlog</option></entry>
33008 <entry>Use: <emphasis>main</emphasis></entry>
33009 <entry>Type: <emphasis>integer</emphasis></entry>
33010 <entry>Default: <emphasis>20</emphasis></entry>
33011 </row>
33012 </tbody>
33013 </tgroup>
33014 </informaltable>
33015 <para>
33016 <indexterm role="concept">
33017 <primary>connection backlog</primary>
33018 <secondary>set maximum</secondary>
33019 </indexterm>
33020 <indexterm role="concept">
33021 <primary>SMTP</primary>
33022 <secondary>connection backlog</secondary>
33023 </indexterm>
33024 <indexterm role="concept">
33025 <primary>backlog of connections</primary>
33026 </indexterm>
33027 This option specifies a maximum number of waiting SMTP connections. Exim passes
33028 this value to the TCP/IP system when it sets up its listener. Once this number
33029 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
33030 attempts are refused at the TCP/IP level. At least, that is what the manuals
33031 say; in some circumstances such connection attempts have been observed to time
33032 out instead. For large systems it is probably a good idea to increase the
33033 value (to 50, say). It also gives some protection against denial-of-service
33034 attacks by SYN flooding.
33035 </para>
33036 <para>
33037 <indexterm role="option">
33038 <primary><option>smtp_enforce_sync</option></primary>
33039 </indexterm>
33040 </para>
33041 <informaltable frame="all">
33042 <tgroup cols="4" colsep="0" rowsep="0">
33043 <colspec colwidth="8*" align="left"/>
33044 <colspec colwidth="6*" align="center"/>
33045 <colspec colwidth="6*" align="center"/>
33046 <colspec colwidth="6*" align="right"/>
33047 <tbody>
33048 <row>
33049 <entry><option>smtp_enforce_sync</option></entry>
33050 <entry>Use: <emphasis>main</emphasis></entry>
33051 <entry>Type: <emphasis>boolean</emphasis></entry>
33052 <entry>Default: <emphasis>true</emphasis></entry>
33053 </row>
33054 </tbody>
33055 </tgroup>
33056 </informaltable>
33057 <para>
33058 <indexterm role="concept">
33059 <primary>SMTP</primary>
33060 <secondary>synchronization checking</secondary>
33061 </indexterm>
33062 <indexterm role="concept">
33063 <primary>synchronization checking in SMTP</primary>
33064 </indexterm>
33065 The SMTP protocol specification requires the client to wait for a response from
33066 the server at certain points in the dialogue. Without PIPELINING these
33067 synchronization points are after every command; with PIPELINING they are
33068 fewer, but they still exist.
33069 </para>
33070 <para>
33071 Some spamming sites send out a complete set of SMTP commands without waiting
33072 for any response. Exim protects against this by rejecting a message if the
33073 client has sent further input when it should not have. The error response <quote>554
33074 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
33075 for this error cannot be perfect because of transmission delays (unexpected
33076 input may be on its way but not yet received when Exim checks). However, it
33077 does detect many instances.
33078 </para>
33079 <para>
33080 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
33081 If you want to disable the check selectively (for example, only for certain
33082 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
33083 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
33084 </para>
33085 <para>
33086 <indexterm role="option">
33087 <primary><option>smtp_etrn_command</option></primary>
33088 </indexterm>
33089 </para>
33090 <informaltable frame="all">
33091 <tgroup cols="4" colsep="0" rowsep="0">
33092 <colspec colwidth="8*" align="left"/>
33093 <colspec colwidth="6*" align="center"/>
33094 <colspec colwidth="6*" align="center"/>
33095 <colspec colwidth="6*" align="right"/>
33096 <tbody>
33097 <row>
33098 <entry><option>smtp_etrn_command</option></entry>
33099 <entry>Use: <emphasis>main</emphasis></entry>
33100 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33101 <entry>Default: <emphasis>unset</emphasis></entry>
33102 </row>
33103 </tbody>
33104 </tgroup>
33105 </informaltable>
33106 <para>
33107 <indexterm role="concept">
33108 <primary>ETRN</primary>
33109 <secondary>command to be run</secondary>
33110 </indexterm>
33111 <indexterm role="concept">
33112 <primary>ESMTP extensions</primary>
33113 <secondary>ETRN</secondary>
33114 </indexterm>
33115 <indexterm role="variable">
33116 <primary><varname>$domain</varname></primary>
33117 </indexterm>
33118 If this option is set, the given command is run whenever an SMTP ETRN
33119 command is received from a host that is permitted to issue such commands (see
33120 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
33121 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
33122 argument of the ETRN command, and no syntax checking is done on it. For
33123 example:
33124 </para>
33125 <literallayout class="monospaced">
33126 smtp_etrn_command = /etc/etrn_command $domain \
33127                     $sender_host_address
33128 </literallayout>
33129 <para>
33130 If the option is not set, the argument for the ETRN command must
33131 be a <emphasis>#</emphasis> followed by an address string.
33132 In this case an <emphasis>exim -R &lt;string&gt;</emphasis> command is used;
33133 if the ETRN ACL has set up a named-queue then <emphasis>-MCG &lt;queue&gt;</emphasis> is appended.
33134 </para>
33135 <para>
33136 A new process is created to run the command, but Exim does not wait for it to
33137 complete. Consequently, its status cannot be checked. If the command cannot be
33138 run, a line is written to the panic log, but the ETRN caller still receives
33139 a 250 success response. Exim is normally running under its own uid when
33140 receiving SMTP, so it is not possible for it to change the uid before running
33141 the command.
33142 </para>
33143 <para>
33144 <indexterm role="option">
33145 <primary><option>smtp_etrn_serialize</option></primary>
33146 </indexterm>
33147 </para>
33148 <informaltable frame="all">
33149 <tgroup cols="4" colsep="0" rowsep="0">
33150 <colspec colwidth="8*" align="left"/>
33151 <colspec colwidth="6*" align="center"/>
33152 <colspec colwidth="6*" align="center"/>
33153 <colspec colwidth="6*" align="right"/>
33154 <tbody>
33155 <row>
33156 <entry><option>smtp_etrn_serialize</option></entry>
33157 <entry>Use: <emphasis>main</emphasis></entry>
33158 <entry>Type: <emphasis>boolean</emphasis></entry>
33159 <entry>Default: <emphasis>true</emphasis></entry>
33160 </row>
33161 </tbody>
33162 </tgroup>
33163 </informaltable>
33164 <para>
33165 <indexterm role="concept">
33166 <primary>ETRN</primary>
33167 <secondary>serializing</secondary>
33168 </indexterm>
33169 When this option is set, it prevents the simultaneous execution of more than
33170 one identical command as a result of ETRN in an SMTP connection. See
33171 section <xref linkend="SECTETRN"/> for details.
33172 </para>
33173 <para>
33174 <indexterm role="option">
33175 <primary><option>smtp_load_reserve</option></primary>
33176 </indexterm>
33177 </para>
33178 <informaltable frame="all">
33179 <tgroup cols="4" colsep="0" rowsep="0">
33180 <colspec colwidth="8*" align="left"/>
33181 <colspec colwidth="6*" align="center"/>
33182 <colspec colwidth="6*" align="center"/>
33183 <colspec colwidth="6*" align="right"/>
33184 <tbody>
33185 <row>
33186 <entry><option>smtp_load_reserve</option></entry>
33187 <entry>Use: <emphasis>main</emphasis></entry>
33188 <entry>Type: <emphasis>fixed-point</emphasis></entry>
33189 <entry>Default: <emphasis>unset</emphasis></entry>
33190 </row>
33191 </tbody>
33192 </tgroup>
33193 </informaltable>
33194 <para>
33195 <indexterm role="concept">
33196 <primary>load average</primary>
33197 </indexterm>
33198 If the system load average ever gets higher than this, incoming SMTP calls are
33199 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
33200 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
33201 the load is over the limit. The option has no effect on ancient operating
33202 systems on which Exim cannot determine the load average. See also
33203 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
33204 </para>
33205 <para>
33206 <indexterm role="option">
33207 <primary><option>smtp_max_synprot_errors</option></primary>
33208 </indexterm>
33209 </para>
33210 <informaltable frame="all">
33211 <tgroup cols="4" colsep="0" rowsep="0">
33212 <colspec colwidth="8*" align="left"/>
33213 <colspec colwidth="6*" align="center"/>
33214 <colspec colwidth="6*" align="center"/>
33215 <colspec colwidth="6*" align="right"/>
33216 <tbody>
33217 <row>
33218 <entry><option>smtp_max_synprot_errors</option></entry>
33219 <entry>Use: <emphasis>main</emphasis></entry>
33220 <entry>Type: <emphasis>integer</emphasis></entry>
33221 <entry>Default: <emphasis>3</emphasis></entry>
33222 </row>
33223 </tbody>
33224 </tgroup>
33225 </informaltable>
33226 <para>
33227 <indexterm role="concept">
33228 <primary>SMTP</primary>
33229 <secondary>limiting syntax and protocol errors</secondary>
33230 </indexterm>
33231 <indexterm role="concept">
33232 <primary>limit</primary>
33233 <secondary>SMTP syntax and protocol errors</secondary>
33234 </indexterm>
33235 Exim rejects SMTP commands that contain syntax or protocol errors. In
33236 particular, a syntactically invalid email address, as in this command:
33237 </para>
33238 <literallayout class="monospaced">
33239 RCPT TO:&lt;abc xyz@a.b.c&gt;
33240 </literallayout>
33241 <para>
33242 causes immediate rejection of the command, before any other tests are done.
33243 (The ACL cannot be run if there is no valid address to set up for it.) An
33244 example of a protocol error is receiving RCPT before MAIL. If there are
33245 too many syntax or protocol errors in one SMTP session, the connection is
33246 dropped. The limit is set by this option.
33247 </para>
33248 <para>
33249 <indexterm role="concept">
33250 <primary>PIPELINING</primary>
33251 <secondary>expected errors</secondary>
33252 </indexterm>
33253 When the PIPELINING extension to SMTP is in use, some protocol errors are
33254 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
33255 Exim assumes that PIPELINING will be used if it advertises it (see
33256 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
33257 not count towards the limit.
33258 </para>
33259 <para>
33260 <indexterm role="option">
33261 <primary><option>smtp_max_unknown_commands</option></primary>
33262 </indexterm>
33263 </para>
33264 <informaltable frame="all">
33265 <tgroup cols="4" colsep="0" rowsep="0">
33266 <colspec colwidth="8*" align="left"/>
33267 <colspec colwidth="6*" align="center"/>
33268 <colspec colwidth="6*" align="center"/>
33269 <colspec colwidth="6*" align="right"/>
33270 <tbody>
33271 <row>
33272 <entry><option>smtp_max_unknown_commands</option></entry>
33273 <entry>Use: <emphasis>main</emphasis></entry>
33274 <entry>Type: <emphasis>integer</emphasis></entry>
33275 <entry>Default: <emphasis>3</emphasis></entry>
33276 </row>
33277 </tbody>
33278 </tgroup>
33279 </informaltable>
33280 <para>
33281 <indexterm role="concept">
33282 <primary>SMTP</primary>
33283 <secondary>limiting unknown commands</secondary>
33284 </indexterm>
33285 <indexterm role="concept">
33286 <primary>limit</primary>
33287 <secondary>unknown SMTP commands</secondary>
33288 </indexterm>
33289 If there are too many unrecognized commands in an incoming SMTP session, an
33290 Exim server drops the connection. This is a defence against some kinds of abuse
33291 that subvert web
33292 clients
33293 into making connections to SMTP ports; in these circumstances, a number of
33294 non-SMTP command lines are sent first.
33295 </para>
33296 <para>
33297 <indexterm role="option">
33298 <primary><option>smtp_ratelimit_hosts</option></primary>
33299 </indexterm>
33300 <indexterm role="option">
33301 <primary><option>smtp_ratelimit_mail</option></primary>
33302 </indexterm>
33303 <indexterm role="option">
33304 <primary><option>smtp_ratelimit_rcpt</option></primary>
33305 </indexterm>
33306 </para>
33307 <informaltable frame="all">
33308 <tgroup cols="4" colsep="0" rowsep="0">
33309 <colspec colwidth="8*" align="left"/>
33310 <colspec colwidth="6*" align="center"/>
33311 <colspec colwidth="6*" align="center"/>
33312 <colspec colwidth="6*" align="right"/>
33313 <tbody>
33314 <row>
33315 <entry><option>smtp_ratelimit_hosts</option></entry>
33316 <entry>Use: <emphasis>main</emphasis></entry>
33317 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33318 <entry>Default: <emphasis>unset</emphasis></entry>
33319 </row>
33320 <row>
33321 <entry><option>smtp_ratelimit_mail</option></entry>
33322 <entry>Use: <emphasis>main</emphasis></entry>
33323 <entry>Type: <emphasis>string</emphasis></entry>
33324 <entry>Default: <emphasis>unset</emphasis></entry>
33325 </row>
33326 <row>
33327 <entry><option>smtp_ratelimit_rcpt</option></entry>
33328 <entry>Use: <emphasis>main</emphasis></entry>
33329 <entry>Type: <emphasis>string</emphasis></entry>
33330 <entry>Default: <emphasis>unset</emphasis></entry>
33331 </row>
33332 </tbody>
33333 </tgroup>
33334 </informaltable>
33335 <para>
33336 <indexterm role="concept">
33337 <primary>SMTP</primary>
33338 <secondary>rate limiting</secondary>
33339 </indexterm>
33340 <indexterm role="concept">
33341 <primary>limit</primary>
33342 <secondary>rate of message arrival</secondary>
33343 </indexterm>
33344 <indexterm role="concept">
33345 <primary>RCPT</primary>
33346 <secondary>rate limiting</secondary>
33347 </indexterm>
33348 Some sites find it helpful to be able to limit the rate at which certain hosts
33349 can send them messages, and the rate at which an individual message can specify
33350 recipients.
33351 </para>
33352 <para>
33353 Exim has two rate-limiting facilities. This section describes the older
33354 facility, which can limit rates within a single connection. The newer
33355 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
33356 <xref linkend="SECTratelimiting"/> for details of the newer facility.
33357 </para>
33358 <para>
33359 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
33360 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
33361 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
33362 respectively. Each option, if set, must contain a set of four comma-separated
33363 values:
33364 </para>
33365 <itemizedlist>
33366 <listitem>
33367 <para>
33368 A threshold, before which there is no rate limiting.
33369 </para>
33370 </listitem>
33371 <listitem>
33372 <para>
33373 An initial time delay. Unlike other times in Exim, numbers with decimal
33374 fractional parts are allowed here.
33375 </para>
33376 </listitem>
33377 <listitem>
33378 <para>
33379 A factor by which to increase the delay each time.
33380 </para>
33381 </listitem>
33382 <listitem>
33383 <para>
33384 A maximum value for the delay. This should normally be less than 5 minutes,
33385 because after that time, the client is liable to timeout the SMTP command.
33386 </para>
33387 </listitem>
33388 </itemizedlist>
33389 <para>
33390 For example, these settings have been used successfully at the site which
33391 first suggested this feature, for controlling mail from their customers:
33392 </para>
33393 <literallayout class="monospaced">
33394 smtp_ratelimit_mail = 2,0.5s,1.05,4m
33395 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
33396 </literallayout>
33397 <para>
33398 The first setting specifies delays that are applied to MAIL commands after
33399 two have been received over a single connection. The initial delay is 0.5
33400 seconds, increasing by a factor of 1.05 each time. The second setting applies
33401 delays to RCPT commands when more than four occur in a single message.
33402 </para>
33403 <para>
33404 <indexterm role="option">
33405 <primary><option>smtp_receive_timeout</option></primary>
33406 </indexterm>
33407 </para>
33408 <informaltable frame="all">
33409 <tgroup cols="4" colsep="0" rowsep="0">
33410 <colspec colwidth="8*" align="left"/>
33411 <colspec colwidth="6*" align="center"/>
33412 <colspec colwidth="6*" align="center"/>
33413 <colspec colwidth="6*" align="right"/>
33414 <tbody>
33415 <row>
33416 <entry><option>smtp_receive_timeout</option></entry>
33417 <entry>Use: <emphasis>main</emphasis></entry>
33418 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
33419 <entry>Default: <emphasis>5m</emphasis></entry>
33420 </row>
33421 </tbody>
33422 </tgroup>
33423 </informaltable>
33424 <para>
33425 <indexterm role="concept">
33426 <primary>timeout</primary>
33427 <secondary>for SMTP input</secondary>
33428 </indexterm>
33429 <indexterm role="concept">
33430 <primary>SMTP</primary>
33431 <secondary>input timeout</secondary>
33432 </indexterm>
33433 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
33434 input, including batch SMTP. If a line of input (either an SMTP command or a
33435 data line) is not received within this time, the SMTP connection is dropped and
33436 the message is abandoned.
33437 A line is written to the log containing one of the following messages:
33438 </para>
33439 <literallayout class="monospaced">
33440 SMTP command timeout on connection from...
33441 SMTP data timeout on connection from...
33442 </literallayout>
33443 <para>
33444 The former means that Exim was expecting to read an SMTP command; the latter
33445 means that it was in the DATA phase, reading the contents of a message.
33446 </para>
33447 <para>
33448 If the first character of the option is a <quote>$</quote> the option is
33449 expanded before use and may depend on
33450 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
33451 </para>
33452 <para>
33453 <indexterm role="option">
33454 <primary><option>-os</option></primary>
33455 </indexterm>
33456 The value set by this option can be overridden by the
33457 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
33458 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
33459 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
33460 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
33461 </para>
33462 <para>
33463 <indexterm role="option">
33464 <primary><option>smtp_reserve_hosts</option></primary>
33465 </indexterm>
33466 </para>
33467 <informaltable frame="all">
33468 <tgroup cols="4" colsep="0" rowsep="0">
33469 <colspec colwidth="8*" align="left"/>
33470 <colspec colwidth="6*" align="center"/>
33471 <colspec colwidth="6*" align="center"/>
33472 <colspec colwidth="6*" align="right"/>
33473 <tbody>
33474 <row>
33475 <entry><option>smtp_reserve_hosts</option></entry>
33476 <entry>Use: <emphasis>main</emphasis></entry>
33477 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33478 <entry>Default: <emphasis>unset</emphasis></entry>
33479 </row>
33480 </tbody>
33481 </tgroup>
33482 </informaltable>
33483 <para>
33484 This option defines hosts for which SMTP connections are reserved; see
33485 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
33486 </para>
33487 <para>
33488 <indexterm role="option">
33489 <primary><option>smtp_return_error_details</option></primary>
33490 </indexterm>
33491 </para>
33492 <informaltable frame="all">
33493 <tgroup cols="4" colsep="0" rowsep="0">
33494 <colspec colwidth="8*" align="left"/>
33495 <colspec colwidth="6*" align="center"/>
33496 <colspec colwidth="6*" align="center"/>
33497 <colspec colwidth="6*" align="right"/>
33498 <tbody>
33499 <row>
33500 <entry><option>smtp_return_error_details</option></entry>
33501 <entry>Use: <emphasis>main</emphasis></entry>
33502 <entry>Type: <emphasis>boolean</emphasis></entry>
33503 <entry>Default: <emphasis>false</emphasis></entry>
33504 </row>
33505 </tbody>
33506 </tgroup>
33507 </informaltable>
33508 <para>
33509 <indexterm role="concept">
33510 <primary>SMTP</primary>
33511 <secondary>details policy failures</secondary>
33512 </indexterm>
33513 <indexterm role="concept">
33514 <primary>policy control</primary>
33515 <secondary>rejection, returning details</secondary>
33516 </indexterm>
33517 In the default state, Exim uses bland messages such as
33518 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
33519 reasons. Many sysadmins like this because it gives away little information
33520 to spammers. However, some other sysadmins who are applying strict checking
33521 policies want to give out much fuller information about failures. Setting
33522 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
33523 example, instead of <quote>Administrative prohibition</quote>, it might give:
33524 </para>
33525 <literallayout class="monospaced">
33526 550-Rejected after DATA: '&gt;' missing at end of address:
33527 550 failing address in "From" header is: &lt;user@dom.ain
33528 </literallayout>
33529 <para>
33530 <indexterm role="option">
33531 <primary><option>smtputf8_advertise_hosts</option></primary>
33532 </indexterm>
33533 </para>
33534 <informaltable frame="all">
33535 <tgroup cols="4" colsep="0" rowsep="0">
33536 <colspec colwidth="8*" align="left"/>
33537 <colspec colwidth="6*" align="center"/>
33538 <colspec colwidth="6*" align="center"/>
33539 <colspec colwidth="6*" align="right"/>
33540 <tbody>
33541 <row>
33542 <entry><option>smtputf8_advertise_hosts</option></entry>
33543 <entry>Use: <emphasis>main</emphasis></entry>
33544 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33545 <entry>Default: <emphasis>*</emphasis></entry>
33546 </row>
33547 </tbody>
33548 </tgroup>
33549 </informaltable>
33550 <para>
33551 <indexterm role="concept">
33552 <primary>SMTPUTF8</primary>
33553 <secondary>ESMTP extension, advertising</secondary>
33554 </indexterm>
33555 <indexterm role="concept">
33556 <primary>ESMTP extensions</primary>
33557 <secondary>SMTPUTF8</secondary>
33558 </indexterm>
33559 When Exim is built with support for internationalised mail names,
33560 the availability thereof is advertised in
33561 response to EHLO only to those client hosts that match this option. See
33562 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
33563 </para>
33564 <para>
33565 <indexterm role="option">
33566 <primary><option>spamd_address</option></primary>
33567 </indexterm>
33568 </para>
33569 <informaltable frame="all">
33570 <tgroup cols="4" colsep="0" rowsep="0">
33571 <colspec colwidth="8*" align="left"/>
33572 <colspec colwidth="6*" align="center"/>
33573 <colspec colwidth="6*" align="center"/>
33574 <colspec colwidth="6*" align="right"/>
33575 <tbody>
33576 <row>
33577 <entry><option>spamd_address</option></entry>
33578 <entry>Use: <emphasis>main</emphasis></entry>
33579 <entry>Type: <emphasis>string</emphasis></entry>
33580 <entry>Default: <emphasis>127.0.0.1 783</emphasis></entry>
33581 </row>
33582 </tbody>
33583 </tgroup>
33584 </informaltable>
33585 <para>
33586 This option is available when Exim is compiled with the content-scanning
33587 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
33588 See section <xref linkend="SECTscanspamass"/> for more details.
33589 </para>
33590 <para>
33591 <indexterm role="option">
33592 <primary><option>spf_guess</option></primary>
33593 </indexterm>
33594 </para>
33595 <informaltable frame="all">
33596 <tgroup cols="4" colsep="0" rowsep="0">
33597 <colspec colwidth="8*" align="left"/>
33598 <colspec colwidth="6*" align="center"/>
33599 <colspec colwidth="6*" align="center"/>
33600 <colspec colwidth="6*" align="right"/>
33601 <tbody>
33602 <row>
33603 <entry><option>spf_guess</option></entry>
33604 <entry>Use: <emphasis>main</emphasis></entry>
33605 <entry>Type: <emphasis>string</emphasis></entry>
33606 <entry>Default: <emphasis>v=spf1 a/24 mx/24 ptr ?all</emphasis></entry>
33607 </row>
33608 </tbody>
33609 </tgroup>
33610 </informaltable>
33611 <para>
33612 This option is available when Exim is compiled with SPF support.
33613 See section <xref linkend="SECSPF"/> for more details.
33614 </para>
33615 <para>
33616 <indexterm role="option">
33617 <primary><option>spf_smtp_comment_template</option></primary>
33618 </indexterm>
33619 </para>
33620 <informaltable frame="all">
33621 <tgroup cols="4" colsep="0" rowsep="0">
33622 <colspec colwidth="8*" align="left"/>
33623 <colspec colwidth="6*" align="center"/>
33624 <colspec colwidth="6*" align="center"/>
33625 <colspec colwidth="6*" align="right"/>
33626 <tbody>
33627 <row>
33628 <entry><option>spf_smtp_comment_template</option></entry>
33629 <entry>Use: <emphasis>main</emphasis></entry>
33630 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33631 <entry>Default: <emphasis>Please%_see%_http://www.open-spf.org/Why</emphasis></entry>
33632 </row>
33633 </tbody>
33634 </tgroup>
33635 </informaltable>
33636 <para>
33637 This option is available when Exim is compiled with SPF support.  It
33638 allows the customisation of the SMTP comment that the SPF library
33639 generates.  You are strongly encouraged to link to your own explanative
33640 site. The template must not contain spaces. If you need spaces in the
33641 output, use the proper placeholder. If libspf2 can not parse the
33642 template, it uses a built-in default broken link. The following placeholders
33643 (along with Exim variables (but see below)) are allowed in the template:
33644 </para>
33645 <itemizedlist>
33646 <listitem>
33647 <para>
33648 <emphasis role="bold">%_</emphasis>: A space.
33649 </para>
33650 </listitem>
33651 <listitem>
33652 <para>
33653 <emphasis role="bold">%{L}</emphasis>: Envelope sender&#x2019;s local part.
33654 </para>
33655 </listitem>
33656 <listitem>
33657 <para>
33658 <emphasis role="bold">%{S}</emphasis>: Envelope sender.
33659 </para>
33660 </listitem>
33661 <listitem>
33662 <para>
33663 <emphasis role="bold">%{O}</emphasis>: Envelope sender&#x2019;s domain.
33664 </para>
33665 </listitem>
33666 <listitem>
33667 <para>
33668 <emphasis role="bold">%{D}</emphasis>: Current(?) domain.
33669 </para>
33670 </listitem>
33671 <listitem>
33672 <para>
33673 <emphasis role="bold">%{I}</emphasis>: SMTP client Ip.
33674 </para>
33675 </listitem>
33676 <listitem>
33677 <para>
33678 <emphasis role="bold">%{C}</emphasis>: SMTP client pretty IP.
33679 </para>
33680 </listitem>
33681 <listitem>
33682 <para>
33683 <emphasis role="bold">%{T}</emphasis>: Epoch time (UTC).
33684 </para>
33685 </listitem>
33686 <listitem>
33687 <para>
33688 <emphasis role="bold">%{P}</emphasis>: SMTP client domain name.
33689 </para>
33690 </listitem>
33691 <listitem>
33692 <para>
33693 <emphasis role="bold">%{V}</emphasis>: IP version.
33694 </para>
33695 </listitem>
33696 <listitem>
33697 <para>
33698 <emphasis role="bold">%{H}</emphasis>: EHLO/HELO domain.
33699 </para>
33700 </listitem>
33701 <listitem>
33702 <para>
33703 <emphasis role="bold">%{R}</emphasis>: Receiving domain.
33704 </para>
33705 </listitem>
33706 </itemizedlist>
33707 <para>
33708 The capitalized placeholders do proper URL encoding, if you use them
33709 lowercased, no encoding takes place.  This list was compiled from the
33710 libspf2 sources.
33711 </para>
33712 <para>
33713 A note on using Exim variables: As
33714 currently the SPF library is initialized before the SMTP EHLO phase,
33715 the variables useful for expansion are quite limited.
33716 </para>
33717 <para>
33718 <indexterm role="option">
33719 <primary><option>split_spool_directory</option></primary>
33720 </indexterm>
33721 </para>
33722 <informaltable frame="all">
33723 <tgroup cols="4" colsep="0" rowsep="0">
33724 <colspec colwidth="8*" align="left"/>
33725 <colspec colwidth="6*" align="center"/>
33726 <colspec colwidth="6*" align="center"/>
33727 <colspec colwidth="6*" align="right"/>
33728 <tbody>
33729 <row>
33730 <entry><option>split_spool_directory</option></entry>
33731 <entry>Use: <emphasis>main</emphasis></entry>
33732 <entry>Type: <emphasis>boolean</emphasis></entry>
33733 <entry>Default: <emphasis>false</emphasis></entry>
33734 </row>
33735 </tbody>
33736 </tgroup>
33737 </informaltable>
33738 <para>
33739 <indexterm role="concept">
33740 <primary>multiple spool directories</primary>
33741 </indexterm>
33742 <indexterm role="concept">
33743 <primary>spool directory</primary>
33744 <secondary>split</secondary>
33745 </indexterm>
33746 <indexterm role="concept">
33747 <primary>directories, multiple</primary>
33748 </indexterm>
33749 If this option is set, it causes Exim to split its input directory into 62
33750 subdirectories, each with a single alphanumeric character as its name. The
33751 sixth character of the message id is used to allocate messages to
33752 subdirectories; this is the least significant base-62 digit of the time of
33753 arrival of the message.
33754 </para>
33755 <para>
33756 Splitting up the spool in this way may provide better performance on systems
33757 where there are long mail queues, by reducing the number of files in any one
33758 directory. The msglog directory is also split up in a similar way to the input
33759 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
33760 are still placed in the single directory <filename>msglog.OLD</filename>.
33761 </para>
33762 <para>
33763 It is not necessary to take any special action for existing messages when
33764 changing <option>split_spool_directory</option>. Exim notices messages that are in the
33765 <quote>wrong</quote> place, and continues to process them. If the option is turned off
33766 after a period of being on, the subdirectories will eventually empty and be
33767 automatically deleted.
33768 </para>
33769 <para>
33770 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
33771 changes. Instead of creating a list of all messages in the queue, and then
33772 trying to deliver each one, in turn, it constructs a list of those in one
33773 sub-directory and tries to deliver them, before moving on to the next
33774 sub-directory. The sub-directories are processed in a random order. This
33775 spreads out the scanning of the input directories, and uses less memory. It is
33776 particularly beneficial when there are lots of messages in the queue. However,
33777 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
33778 entire queue has to be scanned and sorted before any deliveries can start.
33779 </para>
33780 <para>
33781 <indexterm role="option">
33782 <primary><option>spool_directory</option></primary>
33783 </indexterm>
33784 </para>
33785 <informaltable frame="all">
33786 <tgroup cols="4" colsep="0" rowsep="0">
33787 <colspec colwidth="8*" align="left"/>
33788 <colspec colwidth="6*" align="center"/>
33789 <colspec colwidth="6*" align="center"/>
33790 <colspec colwidth="6*" align="right"/>
33791 <tbody>
33792 <row>
33793 <entry><option>spool_directory</option></entry>
33794 <entry>Use: <emphasis>main</emphasis></entry>
33795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33796 <entry>Default: <emphasis>set at compile time</emphasis></entry>
33797 </row>
33798 </tbody>
33799 </tgroup>
33800 </informaltable>
33801 <para>
33802 <indexterm role="concept">
33803 <primary>spool directory</primary>
33804 <secondary>path to</secondary>
33805 </indexterm>
33806 This defines the directory in which Exim keeps its spool, that is, the messages
33807 it is waiting to deliver. The default value is taken from the compile-time
33808 configuration setting, if there is one. If not, this option must be set. The
33809 string is expanded, so it can contain, for example, a reference to
33810 <varname>$primary_hostname</varname>.
33811 </para>
33812 <para>
33813 If the spool directory name is fixed on your installation, it is recommended
33814 that you set it at build time rather than from this option, particularly if the
33815 log files are being written to the spool directory (see <option>log_file_path</option>).
33816 Otherwise log files cannot be used for errors that are detected early on, such
33817 as failures in the configuration file.
33818 </para>
33819 <para>
33820 By using this option to override the compiled-in path, it is possible to run
33821 tests of Exim without using the standard spool.
33822 </para>
33823 <para>
33824 <indexterm role="option">
33825 <primary><option>spool_wireformat</option></primary>
33826 </indexterm>
33827 </para>
33828 <informaltable frame="all">
33829 <tgroup cols="4" colsep="0" rowsep="0">
33830 <colspec colwidth="8*" align="left"/>
33831 <colspec colwidth="6*" align="center"/>
33832 <colspec colwidth="6*" align="center"/>
33833 <colspec colwidth="6*" align="right"/>
33834 <tbody>
33835 <row>
33836 <entry><option>spool_wireformat</option></entry>
33837 <entry>Use: <emphasis>main</emphasis></entry>
33838 <entry>Type: <emphasis>boolean</emphasis></entry>
33839 <entry>Default: <emphasis>false</emphasis></entry>
33840 </row>
33841 </tbody>
33842 </tgroup>
33843 </informaltable>
33844 <para>
33845 <indexterm role="concept">
33846 <primary>spool directory</primary>
33847 <secondary>file formats</secondary>
33848 </indexterm>
33849 If this option is set, Exim may for some messages use an alternative format
33850 for data-files in the spool which matches the wire format.
33851 Doing this permits more efficient message reception and transmission.
33852 Currently it is only done for messages received using the ESMTP CHUNKING
33853 option.
33854 </para>
33855 <para>
33856 The following variables will not have useful values:
33857 </para>
33858 <literallayout class="monospaced">
33859 $max_received_linelength
33860 $body_linecount
33861 $body_zerocount
33862 </literallayout>
33863 <para>
33864 Users of the local_scan() API (see <xref linkend="CHAPlocalscan"/>),
33865 and any external programs which are passed a reference to a message data file
33866 (except via the <quote>regex</quote>, <quote>malware</quote> or <quote>spam</quote>) ACL conditions)
33867 will need to be aware of the different formats potentially available.
33868 </para>
33869 <para>
33870 Using any of the ACL conditions noted will negate the reception benefit
33871 (as a Unix-mbox-format file is constructed for them).
33872 The transmission benefit is maintained.
33873 </para>
33874 <para>
33875 <indexterm role="option">
33876 <primary><option>sqlite_lock_timeout</option></primary>
33877 </indexterm>
33878 </para>
33879 <informaltable frame="all">
33880 <tgroup cols="4" colsep="0" rowsep="0">
33881 <colspec colwidth="8*" align="left"/>
33882 <colspec colwidth="6*" align="center"/>
33883 <colspec colwidth="6*" align="center"/>
33884 <colspec colwidth="6*" align="right"/>
33885 <tbody>
33886 <row>
33887 <entry><option>sqlite_lock_timeout</option></entry>
33888 <entry>Use: <emphasis>main</emphasis></entry>
33889 <entry>Type: <emphasis>time</emphasis></entry>
33890 <entry>Default: <emphasis>5s</emphasis></entry>
33891 </row>
33892 </tbody>
33893 </tgroup>
33894 </informaltable>
33895 <para>
33896 <indexterm role="concept">
33897 <primary>sqlite lookup type</primary>
33898 <secondary>lock timeout</secondary>
33899 </indexterm>
33900 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
33901 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
33902 </para>
33903 <para>
33904 <indexterm role="option">
33905 <primary><option>strict_acl_vars</option></primary>
33906 </indexterm>
33907 </para>
33908 <informaltable frame="all">
33909 <tgroup cols="4" colsep="0" rowsep="0">
33910 <colspec colwidth="8*" align="left"/>
33911 <colspec colwidth="6*" align="center"/>
33912 <colspec colwidth="6*" align="center"/>
33913 <colspec colwidth="6*" align="right"/>
33914 <tbody>
33915 <row>
33916 <entry><option>strict_acl_vars</option></entry>
33917 <entry>Use: <emphasis>main</emphasis></entry>
33918 <entry>Type: <emphasis>boolean</emphasis></entry>
33919 <entry>Default: <emphasis>false</emphasis></entry>
33920 </row>
33921 </tbody>
33922 </tgroup>
33923 </informaltable>
33924 <para>
33925 <indexterm role="concept">
33926 <primary>access control lists (ACLs)</primary>
33927 <secondary>variables, handling unset</secondary>
33928 </indexterm>
33929 This option controls what happens if a syntactically valid but undefined ACL
33930 variable is referenced. If it is false (the default), an empty string
33931 is substituted; if it is true, an error is generated. See section
33932 <xref linkend="SECTaclvariables"/> for details of ACL variables.
33933 </para>
33934 <para>
33935 <indexterm role="option">
33936 <primary><option>strip_excess_angle_brackets</option></primary>
33937 </indexterm>
33938 </para>
33939 <informaltable frame="all">
33940 <tgroup cols="4" colsep="0" rowsep="0">
33941 <colspec colwidth="8*" align="left"/>
33942 <colspec colwidth="6*" align="center"/>
33943 <colspec colwidth="6*" align="center"/>
33944 <colspec colwidth="6*" align="right"/>
33945 <tbody>
33946 <row>
33947 <entry><option>strip_excess_angle_brackets</option></entry>
33948 <entry>Use: <emphasis>main</emphasis></entry>
33949 <entry>Type: <emphasis>boolean</emphasis></entry>
33950 <entry>Default: <emphasis>false</emphasis></entry>
33951 </row>
33952 </tbody>
33953 </tgroup>
33954 </informaltable>
33955 <para>
33956 <indexterm role="concept">
33957 <primary>angle brackets, excess</primary>
33958 </indexterm>
33959 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
33960 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
33961 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
33962 passed on to another MTA, the excess angle brackets are not passed on. If this
33963 option is not set, multiple pairs of angle brackets cause a syntax error.
33964 </para>
33965 <para>
33966 <indexterm role="option">
33967 <primary><option>strip_trailing_dot</option></primary>
33968 </indexterm>
33969 </para>
33970 <informaltable frame="all">
33971 <tgroup cols="4" colsep="0" rowsep="0">
33972 <colspec colwidth="8*" align="left"/>
33973 <colspec colwidth="6*" align="center"/>
33974 <colspec colwidth="6*" align="center"/>
33975 <colspec colwidth="6*" align="right"/>
33976 <tbody>
33977 <row>
33978 <entry><option>strip_trailing_dot</option></entry>
33979 <entry>Use: <emphasis>main</emphasis></entry>
33980 <entry>Type: <emphasis>boolean</emphasis></entry>
33981 <entry>Default: <emphasis>false</emphasis></entry>
33982 </row>
33983 </tbody>
33984 </tgroup>
33985 </informaltable>
33986 <para>
33987 <indexterm role="concept">
33988 <primary>trailing dot on domain</primary>
33989 </indexterm>
33990 <indexterm role="concept">
33991 <primary>dot</primary>
33992 <secondary>trailing on domain</secondary>
33993 </indexterm>
33994 If this option is set, a trailing dot at the end of a domain in an address is
33995 ignored. If this is in the envelope and the message is passed on to another
33996 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
33997 domain causes a syntax error.
33998 However, addresses in header lines are checked only when an ACL requests header
33999 syntax checking.
34000 </para>
34001 <para>
34002 <indexterm role="option">
34003 <primary><option>syslog_duplication</option></primary>
34004 </indexterm>
34005 </para>
34006 <informaltable frame="all">
34007 <tgroup cols="4" colsep="0" rowsep="0">
34008 <colspec colwidth="8*" align="left"/>
34009 <colspec colwidth="6*" align="center"/>
34010 <colspec colwidth="6*" align="center"/>
34011 <colspec colwidth="6*" align="right"/>
34012 <tbody>
34013 <row>
34014 <entry><option>syslog_duplication</option></entry>
34015 <entry>Use: <emphasis>main</emphasis></entry>
34016 <entry>Type: <emphasis>boolean</emphasis></entry>
34017 <entry>Default: <emphasis>true</emphasis></entry>
34018 </row>
34019 </tbody>
34020 </tgroup>
34021 </informaltable>
34022 <para>
34023 <indexterm role="concept">
34024 <primary>syslog</primary>
34025 <secondary>duplicate log lines; suppressing</secondary>
34026 </indexterm>
34027 When Exim is logging to syslog, it writes the log lines for its three
34028 separate logs at different syslog priorities so that they can in principle
34029 be separated on the logging hosts. Some installations do not require this
34030 separation, and in those cases, the duplication of certain log lines is a
34031 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
34032 particular log line is written to syslog. For lines that normally go to
34033 both the main log and the reject log, the reject log version (possibly
34034 containing message header lines) is written, at LOG_NOTICE priority.
34035 Lines that normally go to both the main and the panic log are written at
34036 the LOG_ALERT priority.
34037 </para>
34038 <para>
34039 <indexterm role="option">
34040 <primary><option>syslog_facility</option></primary>
34041 </indexterm>
34042 </para>
34043 <informaltable frame="all">
34044 <tgroup cols="4" colsep="0" rowsep="0">
34045 <colspec colwidth="8*" align="left"/>
34046 <colspec colwidth="6*" align="center"/>
34047 <colspec colwidth="6*" align="center"/>
34048 <colspec colwidth="6*" align="right"/>
34049 <tbody>
34050 <row>
34051 <entry><option>syslog_facility</option></entry>
34052 <entry>Use: <emphasis>main</emphasis></entry>
34053 <entry>Type: <emphasis>string</emphasis></entry>
34054 <entry>Default: <emphasis>unset</emphasis></entry>
34055 </row>
34056 </tbody>
34057 </tgroup>
34058 </informaltable>
34059 <para>
34060 <indexterm role="concept">
34061 <primary>syslog</primary>
34062 <secondary>facility; setting</secondary>
34063 </indexterm>
34064 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
34065 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
34066 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
34067 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
34068 details of Exim&#x2019;s logging.
34069 </para>
34070 <para>
34071 <indexterm role="option">
34072 <primary><option>syslog_pid</option></primary>
34073 </indexterm>
34074 </para>
34075 <informaltable frame="all">
34076 <tgroup cols="4" colsep="0" rowsep="0">
34077 <colspec colwidth="8*" align="left"/>
34078 <colspec colwidth="6*" align="center"/>
34079 <colspec colwidth="6*" align="center"/>
34080 <colspec colwidth="6*" align="right"/>
34081 <tbody>
34082 <row>
34083 <entry><option>syslog_pid</option></entry>
34084 <entry>Use: <emphasis>main</emphasis></entry>
34085 <entry>Type: <emphasis>boolean</emphasis></entry>
34086 <entry>Default: <emphasis>true</emphasis></entry>
34087 </row>
34088 </tbody>
34089 </tgroup>
34090 </informaltable>
34091 <para>
34092 <indexterm role="concept">
34093 <primary>syslog</primary>
34094 <secondary>pid</secondary>
34095 </indexterm>
34096 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
34097 omitted when these lines are sent to syslog. (Syslog normally prefixes
34098 the log lines with the PID of the logging process automatically.) You need
34099 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
34100 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
34101 </para>
34102 <para>
34103 <indexterm role="option">
34104 <primary><option>syslog_processname</option></primary>
34105 </indexterm>
34106 </para>
34107 <informaltable frame="all">
34108 <tgroup cols="4" colsep="0" rowsep="0">
34109 <colspec colwidth="8*" align="left"/>
34110 <colspec colwidth="6*" align="center"/>
34111 <colspec colwidth="6*" align="center"/>
34112 <colspec colwidth="6*" align="right"/>
34113 <tbody>
34114 <row>
34115 <entry><option>syslog_processname</option></entry>
34116 <entry>Use: <emphasis>main</emphasis></entry>
34117 <entry>Type: <emphasis>string</emphasis></entry>
34118 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
34119 </row>
34120 </tbody>
34121 </tgroup>
34122 </informaltable>
34123 <para>
34124 <indexterm role="concept">
34125 <primary>syslog</primary>
34126 <secondary>process name; setting</secondary>
34127 </indexterm>
34128 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
34129 syslog. The value must be no longer than 32 characters. See chapter
34130 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
34131 </para>
34132 <para>
34133 <indexterm role="option">
34134 <primary><option>syslog_timestamp</option></primary>
34135 </indexterm>
34136 </para>
34137 <informaltable frame="all">
34138 <tgroup cols="4" colsep="0" rowsep="0">
34139 <colspec colwidth="8*" align="left"/>
34140 <colspec colwidth="6*" align="center"/>
34141 <colspec colwidth="6*" align="center"/>
34142 <colspec colwidth="6*" align="right"/>
34143 <tbody>
34144 <row>
34145 <entry><option>syslog_timestamp</option></entry>
34146 <entry>Use: <emphasis>main</emphasis></entry>
34147 <entry>Type: <emphasis>boolean</emphasis></entry>
34148 <entry>Default: <emphasis>true</emphasis></entry>
34149 </row>
34150 </tbody>
34151 </tgroup>
34152 </informaltable>
34153 <para>
34154 <indexterm role="concept">
34155 <primary>syslog</primary>
34156 <secondary>timestamps</secondary>
34157 </indexterm>
34158 <indexterm role="concept">
34159 <primary>timestamps</primary>
34160 <secondary>syslog</secondary>
34161 </indexterm>
34162 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
34163 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
34164 details of Exim&#x2019;s logging.
34165 </para>
34166 <para>
34167 <indexterm role="option">
34168 <primary><option>system_filter</option></primary>
34169 </indexterm>
34170 </para>
34171 <informaltable frame="all">
34172 <tgroup cols="4" colsep="0" rowsep="0">
34173 <colspec colwidth="8*" align="left"/>
34174 <colspec colwidth="6*" align="center"/>
34175 <colspec colwidth="6*" align="center"/>
34176 <colspec colwidth="6*" align="right"/>
34177 <tbody>
34178 <row>
34179 <entry><option>system_filter</option></entry>
34180 <entry>Use: <emphasis>main</emphasis></entry>
34181 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34182 <entry>Default: <emphasis>unset</emphasis></entry>
34183 </row>
34184 </tbody>
34185 </tgroup>
34186 </informaltable>
34187 <para>
34188 <indexterm role="concept">
34189 <primary>filter</primary>
34190 <secondary>system filter</secondary>
34191 </indexterm>
34192 <indexterm role="concept">
34193 <primary>system filter</primary>
34194 <secondary>specifying</secondary>
34195 </indexterm>
34196 <indexterm role="concept">
34197 <primary>Sieve filter</primary>
34198 <secondary>not available for system filter</secondary>
34199 </indexterm>
34200 This option specifies an Exim filter file that is applied to all messages at
34201 the start of each delivery attempt, before any routing is done. System filters
34202 must be Exim filters; they cannot be Sieve filters. If the system filter
34203 generates any deliveries to files or pipes, or any new mail messages, the
34204 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
34205 which transports are to be used. Details of this facility are given in chapter
34206 <xref linkend="CHAPsystemfilter"/>.
34207 A forced expansion failure results in no filter operation.
34208 </para>
34209 <para>
34210 <indexterm role="option">
34211 <primary><option>system_filter_directory_transport</option></primary>
34212 </indexterm>
34213 </para>
34214 <informaltable frame="all">
34215 <tgroup cols="4" colsep="0" rowsep="0">
34216 <colspec colwidth="8*" align="left"/>
34217 <colspec colwidth="6*" align="center"/>
34218 <colspec colwidth="6*" align="center"/>
34219 <colspec colwidth="6*" align="right"/>
34220 <tbody>
34221 <row>
34222 <entry><option>system_filter_directory_transport</option></entry>
34223 <entry>Use: <emphasis>main</emphasis></entry>
34224 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34225 <entry>Default: <emphasis>unset</emphasis></entry>
34226 </row>
34227 </tbody>
34228 </tgroup>
34229 </informaltable>
34230 <para>
34231 <indexterm role="variable">
34232 <primary><varname>$address_file</varname></primary>
34233 </indexterm>
34234 This sets the name of the transport driver that is to be used when the
34235 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
34236 implying delivery of each message into a separate file in some directory.
34237 During the delivery, the variable <varname>$address_file</varname> contains the path name.
34238 </para>
34239 <para>
34240 <indexterm role="option">
34241 <primary><option>system_filter_file_transport</option></primary>
34242 </indexterm>
34243 </para>
34244 <informaltable frame="all">
34245 <tgroup cols="4" colsep="0" rowsep="0">
34246 <colspec colwidth="8*" align="left"/>
34247 <colspec colwidth="6*" align="center"/>
34248 <colspec colwidth="6*" align="center"/>
34249 <colspec colwidth="6*" align="right"/>
34250 <tbody>
34251 <row>
34252 <entry><option>system_filter_file_transport</option></entry>
34253 <entry>Use: <emphasis>main</emphasis></entry>
34254 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34255 <entry>Default: <emphasis>unset</emphasis></entry>
34256 </row>
34257 </tbody>
34258 </tgroup>
34259 </informaltable>
34260 <para>
34261 <indexterm role="concept">
34262 <primary>file</primary>
34263 <secondary>transport for system filter</secondary>
34264 </indexterm>
34265 This sets the name of the transport driver that is to be used when the <option>save</option>
34266 command in a system message filter specifies a path not ending in <quote>/</quote>. During
34267 the delivery, the variable <varname>$address_file</varname> contains the path name.
34268 </para>
34269 <para>
34270 <indexterm role="option">
34271 <primary><option>system_filter_group</option></primary>
34272 </indexterm>
34273 </para>
34274 <informaltable frame="all">
34275 <tgroup cols="4" colsep="0" rowsep="0">
34276 <colspec colwidth="8*" align="left"/>
34277 <colspec colwidth="6*" align="center"/>
34278 <colspec colwidth="6*" align="center"/>
34279 <colspec colwidth="6*" align="right"/>
34280 <tbody>
34281 <row>
34282 <entry><option>system_filter_group</option></entry>
34283 <entry>Use: <emphasis>main</emphasis></entry>
34284 <entry>Type: <emphasis>string</emphasis></entry>
34285 <entry>Default: <emphasis>unset</emphasis></entry>
34286 </row>
34287 </tbody>
34288 </tgroup>
34289 </informaltable>
34290 <para>
34291 <indexterm role="concept">
34292 <primary>gid (group id)</primary>
34293 <secondary>system filter</secondary>
34294 </indexterm>
34295 This option is used only when <option>system_filter_user</option> is also set. It sets the
34296 gid under which the system filter is run, overriding any gid that is associated
34297 with the user. The value may be numerical or symbolic.
34298 </para>
34299 <para>
34300 <indexterm role="option">
34301 <primary><option>system_filter_pipe_transport</option></primary>
34302 </indexterm>
34303 </para>
34304 <informaltable frame="all">
34305 <tgroup cols="4" colsep="0" rowsep="0">
34306 <colspec colwidth="8*" align="left"/>
34307 <colspec colwidth="6*" align="center"/>
34308 <colspec colwidth="6*" align="center"/>
34309 <colspec colwidth="6*" align="right"/>
34310 <tbody>
34311 <row>
34312 <entry><option>system_filter_pipe_transport</option></entry>
34313 <entry>Use: <emphasis>main</emphasis></entry>
34314 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34315 <entry>Default: <emphasis>unset</emphasis></entry>
34316 </row>
34317 </tbody>
34318 </tgroup>
34319 </informaltable>
34320 <para>
34321 <indexterm role="concept">
34322 <primary><command>pipe</command> transport</primary>
34323 <secondary>for system filter</secondary>
34324 </indexterm>
34325 <indexterm role="variable">
34326 <primary><varname>$address_pipe</varname></primary>
34327 </indexterm>
34328 This specifies the transport driver that is to be used when a <option>pipe</option> command
34329 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
34330 contains the pipe command.
34331 </para>
34332 <para>
34333 <indexterm role="option">
34334 <primary><option>system_filter_reply_transport</option></primary>
34335 </indexterm>
34336 </para>
34337 <informaltable frame="all">
34338 <tgroup cols="4" colsep="0" rowsep="0">
34339 <colspec colwidth="8*" align="left"/>
34340 <colspec colwidth="6*" align="center"/>
34341 <colspec colwidth="6*" align="center"/>
34342 <colspec colwidth="6*" align="right"/>
34343 <tbody>
34344 <row>
34345 <entry><option>system_filter_reply_transport</option></entry>
34346 <entry>Use: <emphasis>main</emphasis></entry>
34347 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34348 <entry>Default: <emphasis>unset</emphasis></entry>
34349 </row>
34350 </tbody>
34351 </tgroup>
34352 </informaltable>
34353 <para>
34354 <indexterm role="concept">
34355 <primary><command>autoreply</command> transport</primary>
34356 <secondary>for system filter</secondary>
34357 </indexterm>
34358 This specifies the transport driver that is to be used when a <option>mail</option> command
34359 is used in a system filter.
34360 </para>
34361 <para>
34362 <indexterm role="option">
34363 <primary><option>system_filter_user</option></primary>
34364 </indexterm>
34365 </para>
34366 <informaltable frame="all">
34367 <tgroup cols="4" colsep="0" rowsep="0">
34368 <colspec colwidth="8*" align="left"/>
34369 <colspec colwidth="6*" align="center"/>
34370 <colspec colwidth="6*" align="center"/>
34371 <colspec colwidth="6*" align="right"/>
34372 <tbody>
34373 <row>
34374 <entry><option>system_filter_user</option></entry>
34375 <entry>Use: <emphasis>main</emphasis></entry>
34376 <entry>Type: <emphasis>string</emphasis></entry>
34377 <entry>Default: <emphasis>unset</emphasis></entry>
34378 </row>
34379 </tbody>
34380 </tgroup>
34381 </informaltable>
34382 <para>
34383 <indexterm role="concept">
34384 <primary>uid (user id)</primary>
34385 <secondary>system filter</secondary>
34386 </indexterm>
34387 If this option is set to root, the system filter is run in the main Exim
34388 delivery process, as root.  Otherwise, the system filter runs in a separate
34389 process, as the given user, defaulting to the Exim run-time user.
34390 Unless the string consists entirely of digits, it
34391 is looked up in the password data. Failure to find the named user causes a
34392 configuration error. The gid is either taken from the password data, or
34393 specified by <option>system_filter_group</option>. When the uid is specified numerically,
34394 <option>system_filter_group</option> is required to be set.
34395 </para>
34396 <para>
34397 If the system filter generates any pipe, file, or reply deliveries, the uid
34398 under which the filter is run is used when transporting them, unless a
34399 transport option overrides.
34400 </para>
34401 <para>
34402 <indexterm role="option">
34403 <primary><option>tcp_nodelay</option></primary>
34404 </indexterm>
34405 </para>
34406 <informaltable frame="all">
34407 <tgroup cols="4" colsep="0" rowsep="0">
34408 <colspec colwidth="8*" align="left"/>
34409 <colspec colwidth="6*" align="center"/>
34410 <colspec colwidth="6*" align="center"/>
34411 <colspec colwidth="6*" align="right"/>
34412 <tbody>
34413 <row>
34414 <entry><option>tcp_nodelay</option></entry>
34415 <entry>Use: <emphasis>main</emphasis></entry>
34416 <entry>Type: <emphasis>boolean</emphasis></entry>
34417 <entry>Default: <emphasis>true</emphasis></entry>
34418 </row>
34419 </tbody>
34420 </tgroup>
34421 </informaltable>
34422 <para>
34423 <indexterm role="concept">
34424 <primary>daemon</primary>
34425 <secondary>TCP_NODELAY on sockets</secondary>
34426 </indexterm>
34427 <indexterm role="concept">
34428 <primary>Nagle algorithm</primary>
34429 </indexterm>
34430 <indexterm role="concept">
34431 <primary>TCP_NODELAY on listening sockets</primary>
34432 </indexterm>
34433 If this option is set false, it stops the Exim daemon setting the
34434 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
34435 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
34436 performance in interactive (character-by-character) situations. Turning it off
34437 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
34438 However, it appears that some broken clients cannot cope, and time out. Hence
34439 this option. It affects only those sockets that are set up for listening by the
34440 daemon. Sockets created by the smtp transport for delivering mail always set
34441 TCP_NODELAY.
34442 </para>
34443 <para>
34444 <indexterm role="option">
34445 <primary><option>timeout_frozen_after</option></primary>
34446 </indexterm>
34447 </para>
34448 <informaltable frame="all">
34449 <tgroup cols="4" colsep="0" rowsep="0">
34450 <colspec colwidth="8*" align="left"/>
34451 <colspec colwidth="6*" align="center"/>
34452 <colspec colwidth="6*" align="center"/>
34453 <colspec colwidth="6*" align="right"/>
34454 <tbody>
34455 <row>
34456 <entry><option>timeout_frozen_after</option></entry>
34457 <entry>Use: <emphasis>main</emphasis></entry>
34458 <entry>Type: <emphasis>time</emphasis></entry>
34459 <entry>Default: <emphasis>0s</emphasis></entry>
34460 </row>
34461 </tbody>
34462 </tgroup>
34463 </informaltable>
34464 <para>
34465 <indexterm role="concept">
34466 <primary>frozen messages</primary>
34467 <secondary>timing out</secondary>
34468 </indexterm>
34469 <indexterm role="concept">
34470 <primary>timeout</primary>
34471 <secondary>frozen messages</secondary>
34472 </indexterm>
34473 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
34474 message of any kind that has been in the queue for longer than the given time
34475 is automatically cancelled at the next queue run. If the frozen message is a
34476 bounce message, it is just discarded; otherwise, a bounce is sent to the
34477 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
34478 If you want to timeout frozen bounce messages earlier than other kinds of
34479 frozen message, see <option>ignore_bounce_errors_after</option>.
34480 </para>
34481 <para>
34482 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
34483 frozen messages remain in the queue forever (except for any frozen bounce
34484 messages that are released by <option>ignore_bounce_errors_after</option>).
34485 </para>
34486 <para>
34487 <indexterm role="option">
34488 <primary><option>timezone</option></primary>
34489 </indexterm>
34490 </para>
34491 <informaltable frame="all">
34492 <tgroup cols="4" colsep="0" rowsep="0">
34493 <colspec colwidth="8*" align="left"/>
34494 <colspec colwidth="6*" align="center"/>
34495 <colspec colwidth="6*" align="center"/>
34496 <colspec colwidth="6*" align="right"/>
34497 <tbody>
34498 <row>
34499 <entry><option>timezone</option></entry>
34500 <entry>Use: <emphasis>main</emphasis></entry>
34501 <entry>Type: <emphasis>string</emphasis></entry>
34502 <entry>Default: <emphasis>unset</emphasis></entry>
34503 </row>
34504 </tbody>
34505 </tgroup>
34506 </informaltable>
34507 <para>
34508 <indexterm role="concept">
34509 <primary>timezone, setting</primary>
34510 </indexterm>
34511 <indexterm role="concept">
34512 <primary>environment</primary>
34513 <secondary>values from</secondary>
34514 </indexterm>
34515 The value of <option>timezone</option> is used to set the environment variable TZ while
34516 running Exim (if it is different on entry). This ensures that all timestamps
34517 created by Exim are in the required timezone. If you want all your timestamps
34518 to be in UTC (aka GMT) you should set
34519 </para>
34520 <literallayout class="monospaced">
34521 timezone = UTC
34522 </literallayout>
34523 <para>
34524 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
34525 or, if that is not set, from the value of the TZ environment variable when Exim
34526 is built. If <option>timezone</option> is set to the empty string, either at build or run
34527 time, any existing TZ variable is removed from the environment when Exim
34528 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
34529 unfortunately not all, operating systems.
34530 </para>
34531 <para>
34532 <indexterm role="option">
34533 <primary><option>tls_advertise_hosts</option></primary>
34534 </indexterm>
34535 </para>
34536 <informaltable frame="all">
34537 <tgroup cols="4" colsep="0" rowsep="0">
34538 <colspec colwidth="8*" align="left"/>
34539 <colspec colwidth="6*" align="center"/>
34540 <colspec colwidth="6*" align="center"/>
34541 <colspec colwidth="6*" align="right"/>
34542 <tbody>
34543 <row>
34544 <entry><option>tls_advertise_hosts</option></entry>
34545 <entry>Use: <emphasis>main</emphasis></entry>
34546 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
34547 <entry>Default: <emphasis>*</emphasis></entry>
34548 </row>
34549 </tbody>
34550 </tgroup>
34551 </informaltable>
34552 <para>
34553 <indexterm role="concept">
34554 <primary>TLS</primary>
34555 <secondary>advertising</secondary>
34556 </indexterm>
34557 <indexterm role="concept">
34558 <primary>encryption</primary>
34559 <secondary>on SMTP connection</secondary>
34560 </indexterm>
34561 <indexterm role="concept">
34562 <primary>SMTP</primary>
34563 <secondary>encrypted connection</secondary>
34564 </indexterm>
34565 <indexterm role="concept">
34566 <primary>ESMTP extensions</primary>
34567 <secondary>STARTTLS</secondary>
34568 </indexterm>
34569 When Exim is built with support for TLS encrypted connections, the availability
34570 of the STARTTLS command to set up an encrypted session is advertised in
34571 response to EHLO only to those client hosts that match this option. See
34572 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
34573 Note that the default value requires that a certificate be supplied
34574 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
34575 is not required the <option>tls_advertise_hosts</option> option should be set empty.
34576 </para>
34577 <para>
34578 <indexterm role="option">
34579 <primary><option>tls_alpn</option></primary>
34580 </indexterm>
34581 </para>
34582 <informaltable frame="all">
34583 <tgroup cols="4" colsep="0" rowsep="0">
34584 <colspec colwidth="8*" align="left"/>
34585 <colspec colwidth="6*" align="center"/>
34586 <colspec colwidth="6*" align="center"/>
34587 <colspec colwidth="6*" align="right"/>
34588 <tbody>
34589 <row>
34590 <entry><option>tls_alpn</option></entry>
34591 <entry>Use: <emphasis>main</emphasis></entry>
34592 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34593 <entry>Default: <emphasis>smtp : esmtp</emphasis></entry>
34594 </row>
34595 </tbody>
34596 </tgroup>
34597 </informaltable>
34598 <para>
34599 <indexterm role="concept">
34600 <primary>TLS</primary>
34601 <secondary>Application Layer Protocol Names</secondary>
34602 </indexterm>
34603 <indexterm role="concept">
34604 <primary>TLS</primary>
34605 <secondary>ALPN</secondary>
34606 </indexterm>
34607 <indexterm role="concept">
34608 <primary>ALPN</primary>
34609 <secondary>set acceptable names for server</secondary>
34610 </indexterm>
34611 If this option is set,
34612 the TLS library supports ALPN,
34613 and the client offers either more than one
34614 ALPN name or a name which does not match the list,
34615 the TLS connection is declined.
34616 </para>
34617 <para>
34618 <indexterm role="option">
34619 <primary><option>tls_certificate</option></primary>
34620 </indexterm>
34621 </para>
34622 <informaltable frame="all">
34623 <tgroup cols="4" colsep="0" rowsep="0">
34624 <colspec colwidth="8*" align="left"/>
34625 <colspec colwidth="6*" align="center"/>
34626 <colspec colwidth="6*" align="center"/>
34627 <colspec colwidth="6*" align="right"/>
34628 <tbody>
34629 <row>
34630 <entry><option>tls_certificate</option></entry>
34631 <entry>Use: <emphasis>main</emphasis></entry>
34632 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34633 <entry>Default: <emphasis>unset</emphasis></entry>
34634 </row>
34635 </tbody>
34636 </tgroup>
34637 </informaltable>
34638 <para>
34639 <indexterm role="concept">
34640 <primary>TLS</primary>
34641 <secondary>server certificate; location of</secondary>
34642 </indexterm>
34643 <indexterm role="concept">
34644 <primary>certificate</primary>
34645 <secondary>server, location of</secondary>
34646 </indexterm>
34647 The value of this option is expanded, and must then be a list of absolute paths to
34648 files which contain the server&#x2019;s certificates (in PEM format).
34649 Commonly only one file is needed.
34650 The server&#x2019;s private key is also
34651 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
34652 <xref linkend="CHAPTLS"/> for further details.
34653 </para>
34654 <para>
34655 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
34656 receiving incoming messages as a server. If you want to supply certificates for
34657 use when sending messages as a client, you must set the <option>tls_certificate</option>
34658 option in the relevant <command>smtp</command> transport.
34659 </para>
34660 <para>
34661 <emphasis role="bold">Note</emphasis>: If you use filenames based on IP addresses, change the list
34662 separator in the usual way (<xref linkend="SECTlistsepchange"/>) to avoid confusion under IPv6.
34663 </para>
34664 <para>
34665 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
34666 when a list of more than one
34667 file is used, the <varname>$tls_in_ourcert</varname> variable is unreliable.
34668 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
34669 </para>
34670 <para>
34671 <indexterm role="concept">
34672 <primary>SNI</primary>
34673 <secondary>selecting server certificate based on</secondary>
34674 </indexterm>
34675 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
34676 if the OpenSSL build supports TLS extensions and the TLS client sends the
34677 Server Name Indication extension, then this option and others documented in
34678 <xref linkend="SECTtlssni"/> will be re-expanded.
34679 </para>
34680 <para>
34681 If this option is unset or empty a self-signed certificate will be
34682 used.
34683 Under Linux this is generated at daemon startup; on other platforms it will be
34684 generated fresh for every connection.
34685 </para>
34686 <para>
34687 <indexterm role="option">
34688 <primary><option>tls_crl</option></primary>
34689 </indexterm>
34690 </para>
34691 <informaltable frame="all">
34692 <tgroup cols="4" colsep="0" rowsep="0">
34693 <colspec colwidth="8*" align="left"/>
34694 <colspec colwidth="6*" align="center"/>
34695 <colspec colwidth="6*" align="center"/>
34696 <colspec colwidth="6*" align="right"/>
34697 <tbody>
34698 <row>
34699 <entry><option>tls_crl</option></entry>
34700 <entry>Use: <emphasis>main</emphasis></entry>
34701 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34702 <entry>Default: <emphasis>unset</emphasis></entry>
34703 </row>
34704 </tbody>
34705 </tgroup>
34706 </informaltable>
34707 <para>
34708 <indexterm role="concept">
34709 <primary>TLS</primary>
34710 <secondary>server certificate revocation list</secondary>
34711 </indexterm>
34712 <indexterm role="concept">
34713 <primary>certificate</primary>
34714 <secondary>revocation list for server</secondary>
34715 </indexterm>
34716 This option specifies a certificate revocation list. The expanded value must
34717 be the name of a file that contains CRLs in PEM format.
34718 </para>
34719 <para>
34720 Under OpenSSL the option can specify a directory with CRL files.
34721 </para>
34722 <para>
34723 <emphasis role="bold">Note:</emphasis> Under OpenSSL the option must, if given, supply a CRL
34724 for each signing element of the certificate chain (i.e. all but the leaf).
34725 For the file variant this can be multiple PEM blocks in the one file.
34726 </para>
34727 <para>
34728 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
34729 </para>
34730 <para>
34731 <indexterm role="option">
34732 <primary><option>tls_dh_max_bits</option></primary>
34733 </indexterm>
34734 </para>
34735 <informaltable frame="all">
34736 <tgroup cols="4" colsep="0" rowsep="0">
34737 <colspec colwidth="8*" align="left"/>
34738 <colspec colwidth="6*" align="center"/>
34739 <colspec colwidth="6*" align="center"/>
34740 <colspec colwidth="6*" align="right"/>
34741 <tbody>
34742 <row>
34743 <entry><option>tls_dh_max_bits</option></entry>
34744 <entry>Use: <emphasis>main</emphasis></entry>
34745 <entry>Type: <emphasis>integer</emphasis></entry>
34746 <entry>Default: <emphasis>2236</emphasis></entry>
34747 </row>
34748 </tbody>
34749 </tgroup>
34750 </informaltable>
34751 <para>
34752 <indexterm role="concept">
34753 <primary>TLS</primary>
34754 <secondary>D-H bit count</secondary>
34755 </indexterm>
34756 The number of bits used for Diffie-Hellman key-exchange may be suggested by
34757 the chosen TLS library.  That value might prove to be too high for
34758 interoperability.  This option provides a maximum clamp on the value
34759 suggested, trading off security for interoperability.
34760 </para>
34761 <para>
34762 The value must be at least 1024.
34763 </para>
34764 <para>
34765 The value 2236 was chosen because, at time of adding the option, it was the
34766 hard-coded maximum value supported by the NSS cryptographic library, as used
34767 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
34768 </para>
34769 <para>
34770 If you prefer more security and are willing to break some clients, raise this
34771 number.
34772 </para>
34773 <para>
34774 Note that the value passed to GnuTLS for *generating* a new prime may be a
34775 little less than this figure, because GnuTLS is inexact and may produce a
34776 larger prime than requested.
34777 </para>
34778 <para>
34779 <indexterm role="option">
34780 <primary><option>tls_dhparam</option></primary>
34781 </indexterm>
34782 </para>
34783 <informaltable frame="all">
34784 <tgroup cols="4" colsep="0" rowsep="0">
34785 <colspec colwidth="8*" align="left"/>
34786 <colspec colwidth="6*" align="center"/>
34787 <colspec colwidth="6*" align="center"/>
34788 <colspec colwidth="6*" align="right"/>
34789 <tbody>
34790 <row>
34791 <entry><option>tls_dhparam</option></entry>
34792 <entry>Use: <emphasis>main</emphasis></entry>
34793 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34794 <entry>Default: <emphasis>unset</emphasis></entry>
34795 </row>
34796 </tbody>
34797 </tgroup>
34798 </informaltable>
34799 <para>
34800 <indexterm role="concept">
34801 <primary>TLS</primary>
34802 <secondary>D-H parameters for server</secondary>
34803 </indexterm>
34804 The value of this option is expanded and indicates the source of DH parameters
34805 to be used by Exim.
34806 </para>
34807 <para>
34808 <emphasis role="bold">Note: The Exim Maintainers strongly recommend using a filename with site-generated
34809 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
34810 other specific constants available are a fallback so that even when
34811 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
34812 </para>
34813 <para>
34814 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
34815 then it names a file from which DH
34816 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
34817 PKCS#3 representation of the DH prime.  If the file does not exist, for
34818 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
34819 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
34820 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
34821 and treated as though the <option>tls_dhparam</option> were set to "none".
34822 </para>
34823 <para>
34824 If this option expands to the string "none", then no DH parameters will be
34825 loaded by Exim.
34826 </para>
34827 <para>
34828 If this option expands to the string "historic" and Exim is using GnuTLS, then
34829 Exim will attempt to load a file from inside the spool directory.  If the file
34830 does not exist, Exim will attempt to create it.
34831 See section <xref linkend="SECTgnutlsparam"/> for further details.
34832 </para>
34833 <para>
34834 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
34835 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
34836 </para>
34837 <para>
34838 In older versions of Exim the default was the 2048 bit prime described in section
34839 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
34840 in IKE is assigned number 23.
34841 </para>
34842 <para>
34843 Otherwise, the option must expand to the name used by Exim for any of a number
34844 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
34845 sources.  As names, Exim uses a standard specified name, else "ike" followed by
34846 the number used by IKE, or "default" which corresponds to
34847 <literal>exim.dev.20160529.3</literal>.
34848 </para>
34849 <para>
34850 The available standard primes are:
34851 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
34852 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
34853 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
34854 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
34855 </para>
34856 <para>
34857 The available additional primes are:
34858 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
34859 </para>
34860 <para>
34861 Some of these will be too small to be accepted by clients.
34862 Some may be too large to be accepted by clients.
34863 The open cryptographic community has suspicions about the integrity of some
34864 of the later IKE values, which led into RFC7919 providing new fixed constants
34865 (the "ffdhe" identifiers).
34866 </para>
34867 <para>
34868 At this point, all of the "ike" values should be considered obsolete;
34869 they are still in Exim to avoid breaking unusual configurations, but are
34870 candidates for removal the next time we have backwards-incompatible changes.
34871 Two of them in particular (<literal>ike1</literal> and <literal>ike22</literal>) are called out by RFC 8247
34872 as MUST NOT use for IPSEC, and two more (<literal>ike23</literal> and <literal>ike24</literal>) as
34873 SHOULD NOT.
34874 Because of this, Exim regards them as deprecated; if either of the first pair
34875 are used, warnings will be logged in the paniclog, and if any are used then
34876 warnings will be logged in the mainlog.
34877 All four will be removed in a future Exim release.
34878 </para>
34879 <para>
34880 The TLS protocol does not negotiate an acceptable size for this; clients tend
34881 to hard-drop connections if what is offered by the server is unacceptable,
34882 whether too large or too small, and there&#x2019;s no provision for the client to
34883 tell the server what these constraints are.  Thus, as a server operator, you
34884 need to make an educated guess as to what is most likely to work for your
34885 userbase.
34886 </para>
34887 <para>
34888 Some known size constraints suggest that a bit-size in the range 2048 to 2236
34889 is most likely to maximise interoperability.  The upper bound comes from
34890 applications using the Mozilla Network Security Services (NSS) library, which
34891 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
34892 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
34893 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
34894 acceptable bound from 1024 to 2048.
34895 </para>
34896 <para>
34897 <indexterm role="option">
34898 <primary><option><literal>auto</literal></option></primary>
34899 </indexterm>
34900 </para>
34901 <informaltable frame="all">
34902 <tgroup cols="4" colsep="0" rowsep="0">
34903 <colspec colwidth="8*" align="left"/>
34904 <colspec colwidth="6*" align="center"/>
34905 <colspec colwidth="6*" align="center"/>
34906 <colspec colwidth="6*" align="right"/>
34907 <tbody>
34908 <row>
34909 <entry><option>tls_eccurve</option></entry>
34910 <entry>Use: <emphasis>main</emphasis></entry>
34911 <entry>Type: <emphasis>string</emphasis></entry>
34912 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
34913 </row>
34914 </tbody>
34915 </tgroup>
34916 </informaltable>
34917 <para>
34918 <indexterm role="concept">
34919 <primary>TLS</primary>
34920 <secondary>EC cryptography</secondary>
34921 </indexterm>
34922 This option selects EC curves for use by Exim when used with OpenSSL.
34923 It has no effect when Exim is used with GnuTLS
34924 (the equivalent can be done using a priority string for the
34925 <option>tls_require_ciphers</option> option).
34926 </para>
34927 <para>
34928 After expansion it must contain
34929 </para>
34930 <para revisionflag="changed">
34931 one or (only for OpenSSL versiona 1.1.1 onwards) more
34932 </para>
34933 <para>
34934 EC curve names, such as <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-521</literal>.
34935 Consult your OpenSSL manual for valid curve names.
34936 </para>
34937 <para>
34938 For OpenSSL versions before (and not including) 1.0.2, the string
34939 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
34940 <literal>auto</literal> tells the library to choose.
34941 </para>
34942 <para revisionflag="changed">
34943 If the option expands to an empty string, the effect is undefined.
34944 </para>
34945 <para>
34946 <indexterm role="option">
34947 <primary><option>tls_ocsp_file</option></primary>
34948 </indexterm>
34949 </para>
34950 <informaltable frame="all">
34951 <tgroup cols="4" colsep="0" rowsep="0">
34952 <colspec colwidth="8*" align="left"/>
34953 <colspec colwidth="6*" align="center"/>
34954 <colspec colwidth="6*" align="center"/>
34955 <colspec colwidth="6*" align="right"/>
34956 <tbody>
34957 <row>
34958 <entry><option>tls_ocsp_file</option></entry>
34959 <entry>Use: <emphasis>main</emphasis></entry>
34960 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34961 <entry>Default: <emphasis>unset</emphasis></entry>
34962 </row>
34963 </tbody>
34964 </tgroup>
34965 </informaltable>
34966 <para>
34967 <indexterm role="concept">
34968 <primary>TLS</primary>
34969 <secondary>certificate status</secondary>
34970 </indexterm>
34971 <indexterm role="concept">
34972 <primary>TLS</primary>
34973 <secondary>OCSP proof file</secondary>
34974 </indexterm>
34975 This option
34976 must if set expand to the absolute path to a file which contains a current
34977 status proof for the server&#x2019;s certificate, as obtained from the
34978 Certificate Authority.
34979 </para>
34980 <para>
34981 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
34982 The macro "_HAVE_TLS_OCSP" will be defined for those versions.
34983 </para>
34984 <para>
34985 For OpenSSL 1.1.0 or later, and
34986 for GnuTLS 3.5.6 or later the expanded value of this option can be a list
34987 of files, to match a list given for the <option>tls_certificate</option> option.
34988 The ordering of the two lists must match.
34989 The macro "_HAVE_TLS_OCSP_LIST" will be defined for those versions.
34990 </para>
34991 <para>
34992 The file(s) should be in DER format,
34993 except for GnuTLS 3.6.3 or later
34994 or for OpenSSL,
34995 when an optional filetype prefix can be used.
34996 The prefix must be one of "DER" or "PEM", followed by
34997 a single space.  If one is used it sets the format for subsequent
34998 files in the list; the initial format is DER.
34999 If multiple proofs are wanted, for multiple chain elements
35000 (this only works under TLS1.3)
35001 they must be coded as a combined OCSP response.
35002 </para>
35003 <para>
35004 Although GnuTLS will accept PEM files with multiple separate
35005 PEM blobs (ie. separate OCSP responses), it sends them in the
35006 TLS Certificate record interleaved with the certificates of the chain;
35007 although a GnuTLS client is happy with that, an OpenSSL client is not.
35008 </para>
35009 <para>
35010 <indexterm role="option">
35011 <primary><option>tls_on_connect_ports</option></primary>
35012 </indexterm>
35013 </para>
35014 <informaltable frame="all">
35015 <tgroup cols="4" colsep="0" rowsep="0">
35016 <colspec colwidth="8*" align="left"/>
35017 <colspec colwidth="6*" align="center"/>
35018 <colspec colwidth="6*" align="center"/>
35019 <colspec colwidth="6*" align="right"/>
35020 <tbody>
35021 <row>
35022 <entry><option>tls_on_connect_ports</option></entry>
35023 <entry>Use: <emphasis>main</emphasis></entry>
35024 <entry>Type: <emphasis>string list</emphasis></entry>
35025 <entry>Default: <emphasis>unset</emphasis></entry>
35026 </row>
35027 </tbody>
35028 </tgroup>
35029 </informaltable>
35030 <para>
35031 <indexterm role="concept">
35032 <primary>SSMTP</primary>
35033 </indexterm>
35034 <indexterm role="concept">
35035 <primary>SMTPS</primary>
35036 </indexterm>
35037 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
35038 operate the SSMTP (SMTPS) protocol, where a TLS session is immediately
35039 set up without waiting for the client to issue a STARTTLS command. For
35040 further details, see section <xref linkend="SECTsupobssmt"/>.
35041 </para>
35042 <para>
35043 <indexterm role="option">
35044 <primary><option>tls_privatekey</option></primary>
35045 </indexterm>
35046 </para>
35047 <informaltable frame="all">
35048 <tgroup cols="4" colsep="0" rowsep="0">
35049 <colspec colwidth="8*" align="left"/>
35050 <colspec colwidth="6*" align="center"/>
35051 <colspec colwidth="6*" align="center"/>
35052 <colspec colwidth="6*" align="right"/>
35053 <tbody>
35054 <row>
35055 <entry><option>tls_privatekey</option></entry>
35056 <entry>Use: <emphasis>main</emphasis></entry>
35057 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
35058 <entry>Default: <emphasis>unset</emphasis></entry>
35059 </row>
35060 </tbody>
35061 </tgroup>
35062 </informaltable>
35063 <para>
35064 <indexterm role="concept">
35065 <primary>TLS</primary>
35066 <secondary>server private key; location of</secondary>
35067 </indexterm>
35068 The value of this option is expanded, and must then be a list of absolute paths to
35069 files which contains the server&#x2019;s private keys.
35070 If this option is unset, or if
35071 the expansion is forced to fail, or the result is an empty string, the private
35072 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
35073 <xref linkend="CHAPTLS"/> for further details.
35074 </para>
35075 <para>
35076 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
35077 </para>
35078 <para>
35079 <indexterm role="option">
35080 <primary><option>tls_remember_esmtp</option></primary>
35081 </indexterm>
35082 </para>
35083 <informaltable frame="all">
35084 <tgroup cols="4" colsep="0" rowsep="0">
35085 <colspec colwidth="8*" align="left"/>
35086 <colspec colwidth="6*" align="center"/>
35087 <colspec colwidth="6*" align="center"/>
35088 <colspec colwidth="6*" align="right"/>
35089 <tbody>
35090 <row>
35091 <entry><option>tls_remember_esmtp</option></entry>
35092 <entry>Use: <emphasis>main</emphasis></entry>
35093 <entry>Type: <emphasis>boolean</emphasis></entry>
35094 <entry>Default: <emphasis>false</emphasis></entry>
35095 </row>
35096 </tbody>
35097 </tgroup>
35098 </informaltable>
35099 <para>
35100 <indexterm role="concept">
35101 <primary>TLS</primary>
35102 <secondary>esmtp state; remembering</secondary>
35103 </indexterm>
35104 <indexterm role="concept">
35105 <primary>TLS</primary>
35106 <secondary>broken clients</secondary>
35107 </indexterm>
35108 If this option is set true, Exim violates the RFCs by remembering that it is in
35109 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
35110 support for broken clients that fail to send a new EHLO after starting a
35111 TLS session.
35112 </para>
35113 <para>
35114 <indexterm role="option">
35115 <primary><option>tls_require_ciphers</option></primary>
35116 </indexterm>
35117 </para>
35118 <informaltable frame="all">
35119 <tgroup cols="4" colsep="0" rowsep="0">
35120 <colspec colwidth="8*" align="left"/>
35121 <colspec colwidth="6*" align="center"/>
35122 <colspec colwidth="6*" align="center"/>
35123 <colspec colwidth="6*" align="right"/>
35124 <tbody>
35125 <row>
35126 <entry><option>tls_require_ciphers</option></entry>
35127 <entry>Use: <emphasis>main</emphasis></entry>
35128 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35129 <entry>Default: <emphasis>unset</emphasis></entry>
35130 </row>
35131 </tbody>
35132 </tgroup>
35133 </informaltable>
35134 <para>
35135 <indexterm role="concept">
35136 <primary>TLS</primary>
35137 <secondary>requiring specific ciphers</secondary>
35138 </indexterm>
35139 <indexterm role="concept">
35140 <primary>cipher</primary>
35141 <secondary>requiring specific</secondary>
35142 </indexterm>
35143 This option controls which ciphers can be used for incoming TLS connections.
35144 The <command>smtp</command> transport has an option of the same name for controlling outgoing
35145 connections. This option is expanded for each connection, so can be varied for
35146 different clients if required. The value of this option must be a list of
35147 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
35148 in somewhat different ways. If GnuTLS is being used, the client controls the
35149 preference order of the available ciphers. Details are given in sections
35150 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
35151 </para>
35152 <para>
35153 <indexterm role="option">
35154 <primary><option>tls_resumption_hosts</option></primary>
35155 </indexterm>
35156 </para>
35157 <informaltable frame="all">
35158 <tgroup cols="4" colsep="0" rowsep="0">
35159 <colspec colwidth="8*" align="left"/>
35160 <colspec colwidth="6*" align="center"/>
35161 <colspec colwidth="6*" align="center"/>
35162 <colspec colwidth="6*" align="right"/>
35163 <tbody>
35164 <row>
35165 <entry><option>tls_resumption_hosts</option></entry>
35166 <entry>Use: <emphasis>main</emphasis></entry>
35167 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35168 <entry>Default: <emphasis>unset</emphasis></entry>
35169 </row>
35170 </tbody>
35171 </tgroup>
35172 </informaltable>
35173 <para>
35174 <indexterm role="concept">
35175 <primary>TLS</primary>
35176 <secondary>resumption</secondary>
35177 </indexterm>
35178 This option controls which connections to offer the TLS resumption feature.
35179 See <xref linkend="SECTresumption"/> for details.
35180 </para>
35181 <para>
35182 <indexterm role="option">
35183 <primary><option>tls_try_verify_hosts</option></primary>
35184 </indexterm>
35185 </para>
35186 <informaltable frame="all">
35187 <tgroup cols="4" colsep="0" rowsep="0">
35188 <colspec colwidth="8*" align="left"/>
35189 <colspec colwidth="6*" align="center"/>
35190 <colspec colwidth="6*" align="center"/>
35191 <colspec colwidth="6*" align="right"/>
35192 <tbody>
35193 <row>
35194 <entry><option>tls_try_verify_hosts</option></entry>
35195 <entry>Use: <emphasis>main</emphasis></entry>
35196 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35197 <entry>Default: <emphasis>unset</emphasis></entry>
35198 </row>
35199 </tbody>
35200 </tgroup>
35201 </informaltable>
35202 <para>
35203 <indexterm role="concept">
35204 <primary>TLS</primary>
35205 <secondary>client certificate verification</secondary>
35206 </indexterm>
35207 <indexterm role="concept">
35208 <primary>certificate</primary>
35209 <secondary>verification of client</secondary>
35210 </indexterm>
35211 See <option>tls_verify_hosts</option> below.
35212 </para>
35213 <para>
35214 <indexterm role="option">
35215 <primary><option>tls_verify_certificates</option></primary>
35216 </indexterm>
35217 </para>
35218 <informaltable frame="all">
35219 <tgroup cols="4" colsep="0" rowsep="0">
35220 <colspec colwidth="8*" align="left"/>
35221 <colspec colwidth="6*" align="center"/>
35222 <colspec colwidth="6*" align="center"/>
35223 <colspec colwidth="6*" align="right"/>
35224 <tbody>
35225 <row>
35226 <entry><option>tls_verify_certificates</option></entry>
35227 <entry>Use: <emphasis>main</emphasis></entry>
35228 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35229 <entry>Default: <emphasis>system</emphasis></entry>
35230 </row>
35231 </tbody>
35232 </tgroup>
35233 </informaltable>
35234 <para>
35235 <indexterm role="concept">
35236 <primary>TLS</primary>
35237 <secondary>client certificate verification</secondary>
35238 </indexterm>
35239 <indexterm role="concept">
35240 <primary>certificate</primary>
35241 <secondary>verification of client</secondary>
35242 </indexterm>
35243 The value of this option is expanded, and must then be either the
35244 word "system"
35245 or the absolute path to
35246 a file or directory containing permitted certificates for clients that
35247 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
35248 </para>
35249 <para>
35250 The "system" value for the option will use a
35251 system default location compiled into the SSL library.
35252 This is not available for GnuTLS versions preceding 3.0.20,
35253 and will be taken as empty; an explicit location
35254 must be specified.
35255 </para>
35256 <para>
35257 The use of a directory for the option value is not available for GnuTLS versions
35258 preceding 3.3.6 and a single file must be used.
35259 </para>
35260 <para>
35261 With OpenSSL the certificates specified
35262 explicitly
35263 either by file or directory
35264 are added to those given by the system default location.
35265 </para>
35266 <para>
35267 These certificates should be for the certificate authorities trusted, rather
35268 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
35269 the value is a file then the certificates are sent by Exim as a server to
35270 connecting clients, defining the list of accepted certificate authorities.
35271 Thus the values defined should be considered public data.  To avoid this,
35272 use the explicit directory version. (If your peer is Exim up to 4.85,
35273 using GnuTLS, you may need to send the CAs (thus using the file
35274 variant). Otherwise the peer doesn&#x2019;t send its certificate.)
35275 </para>
35276 <para>
35277 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
35278 </para>
35279 <para>
35280 A forced expansion failure or setting to an empty string is equivalent to
35281 being unset.
35282 </para>
35283 <para>
35284 <indexterm role="option">
35285 <primary><option>tls_verify_hosts</option></primary>
35286 </indexterm>
35287 </para>
35288 <informaltable frame="all">
35289 <tgroup cols="4" colsep="0" rowsep="0">
35290 <colspec colwidth="8*" align="left"/>
35291 <colspec colwidth="6*" align="center"/>
35292 <colspec colwidth="6*" align="center"/>
35293 <colspec colwidth="6*" align="right"/>
35294 <tbody>
35295 <row>
35296 <entry><option>tls_verify_hosts</option></entry>
35297 <entry>Use: <emphasis>main</emphasis></entry>
35298 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35299 <entry>Default: <emphasis>unset</emphasis></entry>
35300 </row>
35301 </tbody>
35302 </tgroup>
35303 </informaltable>
35304 <para>
35305 <indexterm role="concept">
35306 <primary>TLS</primary>
35307 <secondary>client certificate verification</secondary>
35308 </indexterm>
35309 <indexterm role="concept">
35310 <primary>certificate</primary>
35311 <secondary>verification of client</secondary>
35312 </indexterm>
35313 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
35314 certificates from clients. The expected certificates are defined by
35315 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
35316 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
35317 <option>tls_verify_certificates</option> is not set.
35318 </para>
35319 <para>
35320 Any client that matches <option>tls_verify_hosts</option> is constrained by
35321 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
35322 present one of the listed certificates. If it does not, the connection is
35323 aborted.
35324 <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
35325 the host to use TLS. It can still send SMTP commands through unencrypted
35326 connections. Forcing a client to use TLS has to be done separately using an
35327 ACL to reject inappropriate commands when the connection is not encrypted.
35328 </para>
35329 <para>
35330 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
35331 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
35332 certificate and checks it against <option>tls_verify_certificates</option>, but does not
35333 abort the connection if there is no certificate or if it does not match. This
35334 state can be detected in an ACL, which makes it possible to implement policies
35335 such as <quote>accept for relay only if a verified certificate has been received,
35336 but accept for local delivery if encrypted, even without a verified
35337 certificate</quote>.
35338 </para>
35339 <para>
35340 Client hosts that match neither of these lists are not asked to present
35341 certificates.
35342 </para>
35343 <para>
35344 <indexterm role="option">
35345 <primary><option>trusted_groups</option></primary>
35346 </indexterm>
35347 </para>
35348 <informaltable frame="all">
35349 <tgroup cols="4" colsep="0" rowsep="0">
35350 <colspec colwidth="8*" align="left"/>
35351 <colspec colwidth="6*" align="center"/>
35352 <colspec colwidth="6*" align="center"/>
35353 <colspec colwidth="6*" align="right"/>
35354 <tbody>
35355 <row>
35356 <entry><option>trusted_groups</option></entry>
35357 <entry>Use: <emphasis>main</emphasis></entry>
35358 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
35359 <entry>Default: <emphasis>unset</emphasis></entry>
35360 </row>
35361 </tbody>
35362 </tgroup>
35363 </informaltable>
35364 <para>
35365 <indexterm role="concept">
35366 <primary>trusted groups</primary>
35367 </indexterm>
35368 <indexterm role="concept">
35369 <primary>groups</primary>
35370 <secondary>trusted</secondary>
35371 </indexterm>
35372 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
35373 option is set, any process that is running in one of the listed groups, or
35374 which has one of them as a supplementary group, is trusted. The groups can be
35375 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
35376 details of what trusted callers are permitted to do. If neither
35377 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
35378 are trusted.
35379 </para>
35380 <para>
35381 <indexterm role="option">
35382 <primary><option>trusted_users</option></primary>
35383 </indexterm>
35384 </para>
35385 <informaltable frame="all">
35386 <tgroup cols="4" colsep="0" rowsep="0">
35387 <colspec colwidth="8*" align="left"/>
35388 <colspec colwidth="6*" align="center"/>
35389 <colspec colwidth="6*" align="center"/>
35390 <colspec colwidth="6*" align="right"/>
35391 <tbody>
35392 <row>
35393 <entry><option>trusted_users</option></entry>
35394 <entry>Use: <emphasis>main</emphasis></entry>
35395 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
35396 <entry>Default: <emphasis>unset</emphasis></entry>
35397 </row>
35398 </tbody>
35399 </tgroup>
35400 </informaltable>
35401 <para>
35402 <indexterm role="concept">
35403 <primary>trusted users</primary>
35404 </indexterm>
35405 <indexterm role="concept">
35406 <primary>user</primary>
35407 <secondary>trusted</secondary>
35408 </indexterm>
35409 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
35410 option is set, any process that is running as one of the listed users is
35411 trusted. The users can be specified numerically or by name. See section
35412 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
35413 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
35414 Exim user are trusted.
35415 </para>
35416 <para>
35417 <indexterm role="option">
35418 <primary><option>unknown_login</option></primary>
35419 </indexterm>
35420 </para>
35421 <informaltable frame="all">
35422 <tgroup cols="4" colsep="0" rowsep="0">
35423 <colspec colwidth="8*" align="left"/>
35424 <colspec colwidth="6*" align="center"/>
35425 <colspec colwidth="6*" align="center"/>
35426 <colspec colwidth="6*" align="right"/>
35427 <tbody>
35428 <row>
35429 <entry><option>unknown_login</option></entry>
35430 <entry>Use: <emphasis>main</emphasis></entry>
35431 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35432 <entry>Default: <emphasis>unset</emphasis></entry>
35433 </row>
35434 </tbody>
35435 </tgroup>
35436 </informaltable>
35437 <para>
35438 <indexterm role="concept">
35439 <primary>uid (user id)</primary>
35440 <secondary>unknown caller</secondary>
35441 </indexterm>
35442 <indexterm role="variable">
35443 <primary><varname>$caller_uid</varname></primary>
35444 </indexterm>
35445 This is a specialized feature for use in unusual configurations. By default, if
35446 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
35447 gives up. The <option>unknown_login</option> option can be used to set a login name to be
35448 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
35449 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
35450 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
35451 <option>-F</option> option.
35452 </para>
35453 <para>
35454 <indexterm role="option">
35455 <primary><option>unknown_username</option></primary>
35456 </indexterm>
35457 </para>
35458 <informaltable frame="all">
35459 <tgroup cols="4" colsep="0" rowsep="0">
35460 <colspec colwidth="8*" align="left"/>
35461 <colspec colwidth="6*" align="center"/>
35462 <colspec colwidth="6*" align="center"/>
35463 <colspec colwidth="6*" align="right"/>
35464 <tbody>
35465 <row>
35466 <entry><option>unknown_username</option></entry>
35467 <entry>Use: <emphasis>main</emphasis></entry>
35468 <entry>Type: <emphasis>string</emphasis></entry>
35469 <entry>Default: <emphasis>unset</emphasis></entry>
35470 </row>
35471 </tbody>
35472 </tgroup>
35473 </informaltable>
35474 <para>
35475 See <option>unknown_login</option>.
35476 </para>
35477 <para>
35478 <indexterm role="option">
35479 <primary><option>untrusted_set_sender</option></primary>
35480 </indexterm>
35481 </para>
35482 <informaltable frame="all">
35483 <tgroup cols="4" colsep="0" rowsep="0">
35484 <colspec colwidth="8*" align="left"/>
35485 <colspec colwidth="6*" align="center"/>
35486 <colspec colwidth="6*" align="center"/>
35487 <colspec colwidth="6*" align="right"/>
35488 <tbody>
35489 <row>
35490 <entry><option>untrusted_set_sender</option></entry>
35491 <entry>Use: <emphasis>main</emphasis></entry>
35492 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
35493 <entry>Default: <emphasis>unset</emphasis></entry>
35494 </row>
35495 </tbody>
35496 </tgroup>
35497 </informaltable>
35498 <para>
35499 <indexterm role="concept">
35500 <primary>trusted users</primary>
35501 </indexterm>
35502 <indexterm role="concept">
35503 <primary>sender</primary>
35504 <secondary>setting by untrusted user</secondary>
35505 </indexterm>
35506 <indexterm role="concept">
35507 <primary>untrusted user setting sender</primary>
35508 </indexterm>
35509 <indexterm role="concept">
35510 <primary>user</primary>
35511 <secondary>untrusted setting sender</secondary>
35512 </indexterm>
35513 <indexterm role="concept">
35514 <primary>envelope from</primary>
35515 </indexterm>
35516 <indexterm role="concept">
35517 <primary>envelope sender</primary>
35518 </indexterm>
35519 When an untrusted user submits a message to Exim using the standard input, Exim
35520 normally creates an envelope sender address from the user&#x2019;s login and the
35521 default qualification domain. Data from the <option>-f</option> option (for setting envelope
35522 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
35523 is used) is ignored.
35524 </para>
35525 <para>
35526 However, untrusted users are permitted to set an empty envelope sender address,
35527 to declare that a message should never generate any bounces. For example:
35528 </para>
35529 <literallayout class="monospaced">
35530 exim -f '&lt;&gt;' user@domain.example
35531 </literallayout>
35532 <para>
35533 <indexterm role="variable">
35534 <primary><varname>$sender_ident</varname></primary>
35535 </indexterm>
35536 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
35537 other envelope sender addresses in a controlled way. When it is set, untrusted
35538 users are allowed to set envelope sender addresses that match any of the
35539 patterns in the list. Like all address lists, the string is expanded. The
35540 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
35541 users to setting senders that start with their login ids
35542 followed by a hyphen
35543 by a setting like this:
35544 </para>
35545 <literallayout class="monospaced">
35546 untrusted_set_sender = ^$sender_ident-
35547 </literallayout>
35548 <para>
35549 If you want to allow untrusted users to set envelope sender addresses without
35550 restriction, you can use
35551 </para>
35552 <literallayout class="monospaced">
35553 untrusted_set_sender = *
35554 </literallayout>
35555 <para>
35556 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
35557 only to the setting of the envelope sender. It does not permit untrusted users
35558 to use the other options which trusted user can use to override message
35559 parameters. Furthermore, it does not stop Exim from removing an existing
35560 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
35561 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
35562 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
35563 described in section <xref linkend="SECTthesenhea"/>.
35564 </para>
35565 <para>
35566 The log line for a message&#x2019;s arrival shows the envelope sender following
35567 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
35568 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
35569 envelope sender address, the user&#x2019;s login is shown in parentheses after the
35570 sender address.
35571 </para>
35572 <para>
35573 <indexterm role="option">
35574 <primary><option>uucp_from_pattern</option></primary>
35575 </indexterm>
35576 </para>
35577 <informaltable frame="all">
35578 <tgroup cols="4" colsep="0" rowsep="0">
35579 <colspec colwidth="8*" align="left"/>
35580 <colspec colwidth="6*" align="center"/>
35581 <colspec colwidth="6*" align="center"/>
35582 <colspec colwidth="6*" align="right"/>
35583 <tbody>
35584 <row>
35585 <entry><option>uucp_from_pattern</option></entry>
35586 <entry>Use: <emphasis>main</emphasis></entry>
35587 <entry>Type: <emphasis>string</emphasis></entry>
35588 <entry>Default: <emphasis>see below</emphasis></entry>
35589 </row>
35590 </tbody>
35591 </tgroup>
35592 </informaltable>
35593 <para>
35594 <indexterm role="concept">
35595 <primary><quote>From</quote> line</primary>
35596 </indexterm>
35597 <indexterm role="concept">
35598 <primary>UUCP</primary>
35599 <secondary><quote>From</quote> line</secondary>
35600 </indexterm>
35601 Some applications that pass messages to an MTA via a command line interface use
35602 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
35603 particular, this is used by UUCP software. Exim recognizes such a line by means
35604 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
35605 matches, the sender address is constructed by expanding the contents of
35606 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
35607 default pattern recognizes lines in the following two forms:
35608 </para>
35609 <literallayout class="monospaced">
35610 From ph10 Fri Jan  5 12:35 GMT 1996
35611 From ph10 Fri, 7 Jan 97 14:00:00 GMT
35612 </literallayout>
35613 <para>
35614 The pattern can be seen by running
35615 </para>
35616 <literallayout class="monospaced">
35617 exim -bP uucp_from_pattern
35618 </literallayout>
35619 <para>
35620 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
35621 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
35622 regular expression by a parenthesized subpattern. The default value for
35623 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
35624 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
35625 <option>ignore_fromline_hosts</option>.
35626 </para>
35627 <para>
35628 <indexterm role="option">
35629 <primary><option>uucp_from_sender</option></primary>
35630 </indexterm>
35631 </para>
35632 <informaltable frame="all">
35633 <tgroup cols="4" colsep="0" rowsep="0">
35634 <colspec colwidth="8*" align="left"/>
35635 <colspec colwidth="6*" align="center"/>
35636 <colspec colwidth="6*" align="center"/>
35637 <colspec colwidth="6*" align="right"/>
35638 <tbody>
35639 <row>
35640 <entry><option>uucp_from_sender</option></entry>
35641 <entry>Use: <emphasis>main</emphasis></entry>
35642 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35643 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
35644 </row>
35645 </tbody>
35646 </tgroup>
35647 </informaltable>
35648 <para>
35649 See <option>uucp_from_pattern</option> above.
35650 </para>
35651 <para>
35652 <indexterm role="option">
35653 <primary><option>warn_message_file</option></primary>
35654 </indexterm>
35655 </para>
35656 <informaltable frame="all">
35657 <tgroup cols="4" colsep="0" rowsep="0">
35658 <colspec colwidth="8*" align="left"/>
35659 <colspec colwidth="6*" align="center"/>
35660 <colspec colwidth="6*" align="center"/>
35661 <colspec colwidth="6*" align="right"/>
35662 <tbody>
35663 <row>
35664 <entry><option>warn_message_file</option></entry>
35665 <entry>Use: <emphasis>main</emphasis></entry>
35666 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35667 <entry>Default: <emphasis>unset</emphasis></entry>
35668 </row>
35669 </tbody>
35670 </tgroup>
35671 </informaltable>
35672 <para>
35673 <indexterm role="concept">
35674 <primary>warning of delay</primary>
35675 <secondary>customizing the message</secondary>
35676 </indexterm>
35677 <indexterm role="concept">
35678 <primary>customizing</primary>
35679 <secondary>warning message</secondary>
35680 </indexterm>
35681 This option defines a template file containing paragraphs of text to be used
35682 for constructing the warning message which is sent by Exim when a message has
35683 been in the queue for a specified amount of time, as specified by
35684 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
35685 <xref linkend="CHAPemsgcust"/>.
35686 <indexterm role="concept">
35687 <primary>warn_message_file</primary>
35688 <secondary>tainted data</secondary>
35689 </indexterm>
35690 The option is expanded to give the file path, which must be
35691 absolute and untainted.
35692 See also <option>bounce_message_file</option>.
35693 </para>
35694 <para>
35695 <indexterm role="option">
35696 <primary><option>write_rejectlog</option></primary>
35697 </indexterm>
35698 </para>
35699 <informaltable frame="all">
35700 <tgroup cols="4" colsep="0" rowsep="0">
35701 <colspec colwidth="8*" align="left"/>
35702 <colspec colwidth="6*" align="center"/>
35703 <colspec colwidth="6*" align="center"/>
35704 <colspec colwidth="6*" align="right"/>
35705 <tbody>
35706 <row>
35707 <entry><option>write_rejectlog</option></entry>
35708 <entry>Use: <emphasis>main</emphasis></entry>
35709 <entry>Type: <emphasis>boolean</emphasis></entry>
35710 <entry>Default: <emphasis>true</emphasis></entry>
35711 </row>
35712 </tbody>
35713 </tgroup>
35714 </informaltable>
35715 <para>
35716 <indexterm role="concept">
35717 <primary>reject log</primary>
35718 <secondary>disabling</secondary>
35719 </indexterm>
35720 If this option is set false, Exim no longer writes anything to the reject log.
35721 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
35722 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
35723 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
35724 </para>
35725 </section>
35726 </chapter>
35727
35728 <chapter id="CHAProutergeneric">
35729 <title>Generic options for routers</title>
35730 <para>
35731 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
35732 <primary>options</primary>
35733 <secondary>generic; for routers</secondary>
35734 </indexterm>
35735 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
35736 <primary>generic options</primary>
35737 <secondary>router</secondary>
35738 </indexterm>
35739 This chapter describes the generic options that apply to all routers.
35740 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
35741 </para>
35742 <para>
35743 For a general description of how a router operates, see sections
35744 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
35745 which the preconditions are tested. The order of expansion of the options that
35746 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
35747 <option>headers_remove</option>, <option>transport</option>.
35748 </para>
35749 <para>
35750 The name of a router is limited to be 64 ASCII characters long;
35751 prior to Exim 4.95 names would be silently truncated at this length, but now
35752 it is enforced.
35753 </para>
35754 <para>
35755 <indexterm role="option">
35756 <primary><option>address_data</option></primary>
35757 </indexterm>
35758 </para>
35759 <informaltable frame="all">
35760 <tgroup cols="4" colsep="0" rowsep="0">
35761 <colspec colwidth="8*" align="left"/>
35762 <colspec colwidth="6*" align="center"/>
35763 <colspec colwidth="6*" align="center"/>
35764 <colspec colwidth="6*" align="right"/>
35765 <tbody>
35766 <row>
35767 <entry><option>address_data</option></entry>
35768 <entry>Use: <emphasis>routers</emphasis></entry>
35769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35770 <entry>Default: <emphasis>unset</emphasis></entry>
35771 </row>
35772 </tbody>
35773 </tgroup>
35774 </informaltable>
35775 <para>
35776 <indexterm role="concept">
35777 <primary>router</primary>
35778 <secondary>data attached to address</secondary>
35779 </indexterm>
35780 The string is expanded just before the router is run, that is, after all the
35781 precondition tests have succeeded. If the expansion is forced to fail, the
35782 router declines, the value of <option>address_data</option> remains unchanged, and the
35783 <option>more</option> option controls what happens next. Other expansion failures cause
35784 delivery of the address to be deferred.
35785 </para>
35786 <para>
35787 <indexterm role="variable">
35788 <primary><varname>$address_data</varname></primary>
35789 </indexterm>
35790 When the expansion succeeds, the value is retained with the address, and can be
35791 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
35792 routers, and the eventual transport.
35793 </para>
35794 <para>
35795 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
35796 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
35797 in the filter. This is not normally a problem, because such data is usually
35798 either not confidential or it <quote>belongs</quote> to the current user, but if you do
35799 put confidential data into <varname>$address_data</varname> you need to remember this point.
35800 </para>
35801 <para>
35802 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
35803 with the address, though it can be changed by another <option>address_data</option> setting
35804 on a subsequent router. If a router generates child addresses, the value of
35805 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
35806 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
35807 </para>
35808 <para>
35809 The idea of <option>address_data</option> is that you can use it to look up a lot of data
35810 for the address once, and then pick out parts of the data later. For example,
35811 you could use a single LDAP lookup to return a string of the form
35812 </para>
35813 <literallayout class="monospaced">
35814 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
35815 </literallayout>
35816 <para>
35817 In the transport you could pick out the mailbox by a setting such as
35818 </para>
35819 <literallayout class="monospaced">
35820 file = ${extract{mailbox}{$address_data}}
35821 </literallayout>
35822 <para>
35823 This makes the configuration file less messy, and also reduces the number of
35824 lookups (though Exim does cache lookups).
35825 </para>
35826 <para>
35827 See also the <option>set</option> option below.
35828 </para>
35829 <para>
35830 <indexterm role="variable">
35831 <primary><varname>$sender_address_data</varname></primary>
35832 </indexterm>
35833 <indexterm role="variable">
35834 <primary><varname>$address_data</varname></primary>
35835 </indexterm>
35836 The <option>address_data</option> facility is also useful as a means of passing information
35837 from one router to another, and from a router to a transport. In addition, if
35838 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
35839 ACL, it remains available for use in the rest of the ACL statement. After
35840 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
35841 </para>
35842 <para>
35843 <indexterm role="option">
35844 <primary><option>address_test</option></primary>
35845 </indexterm>
35846 </para>
35847 <informaltable frame="all">
35848 <tgroup cols="4" colsep="0" rowsep="0">
35849 <colspec colwidth="8*" align="left"/>
35850 <colspec colwidth="6*" align="center"/>
35851 <colspec colwidth="6*" align="center"/>
35852 <colspec colwidth="6*" align="right"/>
35853 <tbody>
35854 <row>
35855 <entry><option>address_test</option></entry>
35856 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35857 <entry>Type: <emphasis>boolean</emphasis></entry>
35858 <entry>Default: <emphasis>true</emphasis></entry>
35859 </row>
35860 </tbody>
35861 </tgroup>
35862 </informaltable>
35863 <para>
35864 <indexterm role="option">
35865 <primary><option>-bt</option></primary>
35866 </indexterm>
35867 <indexterm role="concept">
35868 <primary>router</primary>
35869 <secondary>skipping when address testing</secondary>
35870 </indexterm>
35871 If this option is set false, the router is skipped when routing is being tested
35872 by means of the <option>-bt</option> command line option. This can be a convenience when
35873 your first router sends messages to an external scanner, because it saves you
35874 having to set the <quote>already scanned</quote> indicator when testing real address
35875 routing.
35876 </para>
35877 <para>
35878 <indexterm role="option">
35879 <primary><option>cannot_route_message</option></primary>
35880 </indexterm>
35881 </para>
35882 <informaltable frame="all">
35883 <tgroup cols="4" colsep="0" rowsep="0">
35884 <colspec colwidth="8*" align="left"/>
35885 <colspec colwidth="6*" align="center"/>
35886 <colspec colwidth="6*" align="center"/>
35887 <colspec colwidth="6*" align="right"/>
35888 <tbody>
35889 <row>
35890 <entry><option>cannot_route_message</option></entry>
35891 <entry>Use: <emphasis>routers</emphasis></entry>
35892 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35893 <entry>Default: <emphasis>unset</emphasis></entry>
35894 </row>
35895 </tbody>
35896 </tgroup>
35897 </informaltable>
35898 <para>
35899 <indexterm role="concept">
35900 <primary>router</primary>
35901 <secondary>customizing <quote>cannot route</quote> message</secondary>
35902 </indexterm>
35903 <indexterm role="concept">
35904 <primary>customizing</primary>
35905 <secondary><quote>cannot route</quote> message</secondary>
35906 </indexterm>
35907 This option specifies a text message that is used when an address cannot be
35908 routed because Exim has run out of routers. The default message is
35909 <quote>Unrouteable address</quote>. This option is useful only on routers that have
35910 <option>more</option> set false, or on the very last router in a configuration, because the
35911 value that is used is taken from the last router that is considered. This
35912 includes a router that is skipped because its preconditions are not met, as
35913 well as a router that declines. For example, using the default configuration,
35914 you could put:
35915 </para>
35916 <literallayout class="monospaced">
35917 cannot_route_message = Remote domain not found in DNS
35918 </literallayout>
35919 <para>
35920 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
35921 and
35922 </para>
35923 <literallayout class="monospaced">
35924 cannot_route_message = Unknown local user
35925 </literallayout>
35926 <para>
35927 on the final router that checks for local users. If string expansion fails for
35928 this option, the default message is used. Unless the expansion failure was
35929 explicitly forced, a message about the failure is written to the main and panic
35930 logs, in addition to the normal message about the routing failure.
35931 </para>
35932 <para>
35933 <indexterm role="option">
35934 <primary><option>caseful_local_part</option></primary>
35935 </indexterm>
35936 </para>
35937 <informaltable frame="all">
35938 <tgroup cols="4" colsep="0" rowsep="0">
35939 <colspec colwidth="8*" align="left"/>
35940 <colspec colwidth="6*" align="center"/>
35941 <colspec colwidth="6*" align="center"/>
35942 <colspec colwidth="6*" align="right"/>
35943 <tbody>
35944 <row>
35945 <entry><option>caseful_local_part</option></entry>
35946 <entry>Use: <emphasis>routers</emphasis></entry>
35947 <entry>Type: <emphasis>boolean</emphasis></entry>
35948 <entry>Default: <emphasis>false</emphasis></entry>
35949 </row>
35950 </tbody>
35951 </tgroup>
35952 </informaltable>
35953 <para>
35954 <indexterm role="concept">
35955 <primary>case of local parts</primary>
35956 </indexterm>
35957 <indexterm role="concept">
35958 <primary>router</primary>
35959 <secondary>case of local parts</secondary>
35960 </indexterm>
35961 By default, routers handle the local parts of addresses in a case-insensitive
35962 manner, though the actual case is preserved for transmission with the message.
35963 If you want the case of letters to be significant in a router, you must set
35964 this option true. For individual router options that contain address or local
35965 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
35966 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
35967 more details.
35968 </para>
35969 <para>
35970 <indexterm role="variable">
35971 <primary><varname>$local_part</varname></primary>
35972 </indexterm>
35973 <indexterm role="variable">
35974 <primary><varname>$original_local_part</varname></primary>
35975 </indexterm>
35976 <indexterm role="variable">
35977 <primary><varname>$parent_local_part</varname></primary>
35978 </indexterm>
35979 The value of the <varname>$local_part</varname> variable is forced to lower case while a
35980 router is running unless <option>caseful_local_part</option> is set. When a router assigns
35981 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
35982 is the same as it was in the router. Similarly, when a router generates child
35983 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
35984 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
35985 </para>
35986 <para>
35987 This option applies to the processing of an address by a router. When a
35988 recipient address is being processed in an ACL, there is a separate <option>control</option>
35989 modifier that can be used to specify case-sensitive processing within the ACL
35990 (see section <xref linkend="SECTcontrols"/>).
35991 </para>
35992 <para>
35993 <indexterm role="option">
35994 <primary><option>check_local_user</option></primary>
35995 </indexterm>
35996 </para>
35997 <informaltable frame="all">
35998 <tgroup cols="4" colsep="0" rowsep="0">
35999 <colspec colwidth="8*" align="left"/>
36000 <colspec colwidth="6*" align="center"/>
36001 <colspec colwidth="6*" align="center"/>
36002 <colspec colwidth="6*" align="right"/>
36003 <tbody>
36004 <row>
36005 <entry><option>check_local_user</option></entry>
36006 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36007 <entry>Type: <emphasis>boolean</emphasis></entry>
36008 <entry>Default: <emphasis>false</emphasis></entry>
36009 </row>
36010 </tbody>
36011 </tgroup>
36012 </informaltable>
36013 <para>
36014 <indexterm role="concept">
36015 <primary>local user, checking in router</primary>
36016 </indexterm>
36017 <indexterm role="concept">
36018 <primary>router</primary>
36019 <secondary>checking for local user</secondary>
36020 </indexterm>
36021 <indexterm role="concept">
36022 <primary><filename>/etc/passwd</filename></primary>
36023 </indexterm>
36024 <indexterm role="variable">
36025 <primary><varname>$home</varname></primary>
36026 </indexterm>
36027 When this option is true, Exim checks that the local part of the recipient
36028 address (with affixes removed if relevant) is the name of an account on the
36029 local system. The check is done by calling the <function>getpwnam()</function> function rather
36030 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
36031 holding password data (such as NIS) are supported. If the local part is a local
36032 user,
36033 <indexterm role="concept">
36034 <primary>tainted data</primary>
36035 <secondary>de-tainting</secondary>
36036 </indexterm>
36037 <indexterm role="concept">
36038 <primary>de-tainting</primary>
36039 <secondary>using router check_local_user option</secondary>
36040 </indexterm>
36041 <varname>$local_part_data</varname> is set to an untainted version of the local part and
36042 <varname>$home</varname> is set from the password data. The latter can be tested in other
36043 preconditions that are evaluated after this one (the order of evaluation is
36044 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
36045 overridden by <option>router_home_directory</option>. If the local part is not a local user,
36046 the router is skipped.
36047 </para>
36048 <para>
36049 If you want to check that the local part is either the name of a local user
36050 or matches something else, you cannot combine <option>check_local_user</option> with a
36051 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
36052 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
36053 setting to achieve this. For example:
36054 </para>
36055 <literallayout class="monospaced">
36056 local_parts = passwd;$local_part : lsearch;/etc/other/users
36057 </literallayout>
36058 <para>
36059 Note, however, that the side effects of <option>check_local_user</option> (such as setting
36060 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
36061 <option>local_parts</option> (or any other) precondition.
36062 </para>
36063 <para>
36064 <indexterm role="option">
36065 <primary><option>condition</option></primary>
36066 </indexterm>
36067 </para>
36068 <informaltable frame="all">
36069 <tgroup cols="4" colsep="0" rowsep="0">
36070 <colspec colwidth="8*" align="left"/>
36071 <colspec colwidth="6*" align="center"/>
36072 <colspec colwidth="6*" align="center"/>
36073 <colspec colwidth="6*" align="right"/>
36074 <tbody>
36075 <row>
36076 <entry><option>condition</option></entry>
36077 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36078 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36079 <entry>Default: <emphasis>unset</emphasis></entry>
36080 </row>
36081 </tbody>
36082 </tgroup>
36083 </informaltable>
36084 <para>
36085 <indexterm role="concept">
36086 <primary>router</primary>
36087 <secondary>customized precondition</secondary>
36088 </indexterm>
36089 This option specifies a general precondition test that has to succeed for the
36090 router to be called. The <option>condition</option> option is the last precondition to be
36091 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
36092 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
36093 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
36094 router is skipped, and the address is offered to the next one.
36095 </para>
36096 <para>
36097 If the result is any other value, the router is run (as this is the last
36098 precondition to be evaluated, all the other preconditions must be true).
36099 </para>
36100 <para>
36101 This option is unusual in that multiple <option>condition</option> options may be present.
36102 All <option>condition</option> options must succeed.
36103 </para>
36104 <para>
36105 The <option>condition</option> option provides a means of applying custom conditions to the
36106 running of routers. Note that in the case of a simple conditional expansion,
36107 the default expansion values are exactly what is wanted. For example:
36108 </para>
36109 <literallayout class="monospaced">
36110 condition = ${if &gt;{$message_age}{600}}
36111 </literallayout>
36112 <para>
36113 Because of the default behaviour of the string expansion, this is equivalent to
36114 </para>
36115 <literallayout class="monospaced">
36116 condition = ${if &gt;{$message_age}{600}{true}{}}
36117 </literallayout>
36118 <para>
36119 A multiple condition example, which succeeds:
36120 </para>
36121 <literallayout class="monospaced">
36122 condition = ${if &gt;{$message_age}{600}}
36123 condition = ${if !eq{${lc:$local_part}}{postmaster}}
36124 condition = foobar
36125 </literallayout>
36126 <para>
36127 If the expansion fails (other than forced failure) delivery is deferred. Some
36128 of the other precondition options are common special cases that could in fact
36129 be specified using <option>condition</option>.
36130 </para>
36131 <para>
36132 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
36133 are far older, and use one set of semantics.  ACLs are newer and when
36134 they were created, the ACL <option>condition</option> process was given far stricter
36135 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
36136 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
36137 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
36138 Router rules processing behavior.
36139 </para>
36140 <para>
36141 This is best illustrated in an example:
36142 </para>
36143 <literallayout class="monospaced">
36144 # If used in an ACL condition will fail with a syntax error, but
36145 # in a router condition any extra characters are treated as a string
36146
36147 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
36148 true {yes} {no}}
36149
36150 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
36151  {yes} {no}}
36152 </literallayout>
36153 <para>
36154 In each example above, the <option>if</option> statement actually ends after
36155 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
36156 default <option>if</option> behavior is to return a boolean true or a null answer
36157 (which evaluates to false). The rest of the line is then treated as a
36158 string. So the first example resulted in the boolean answer <quote>true</quote>
36159 with the string <quote> {yes} {no}}</quote> appended to it. The second example
36160 resulted in the null output (indicating false) with the string
36161 <quote> {yes} {no}}</quote> appended to it.
36162 </para>
36163 <para>
36164 In fact you can put excess forward braces in too.  In the router
36165 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
36166 mean something, like after a <quote>$</quote> or when required as part of a
36167 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
36168 string characters.
36169 </para>
36170 <para>
36171 Thus, in a Router, the above expansion strings will both always evaluate
36172 true, as the result of expansion is a non-empty string which doesn&#x2019;t
36173 match an explicit false value.  This can be tricky to debug.  By
36174 contrast, in an ACL either of those strings will always result in an
36175 expansion error because the result doesn&#x2019;t look sufficiently boolean.
36176 </para>
36177 <para>
36178 <indexterm role="option">
36179 <primary><option>debug_print</option></primary>
36180 </indexterm>
36181 </para>
36182 <informaltable frame="all">
36183 <tgroup cols="4" colsep="0" rowsep="0">
36184 <colspec colwidth="8*" align="left"/>
36185 <colspec colwidth="6*" align="center"/>
36186 <colspec colwidth="6*" align="center"/>
36187 <colspec colwidth="6*" align="right"/>
36188 <tbody>
36189 <row>
36190 <entry><option>debug_print</option></entry>
36191 <entry>Use: <emphasis>routers</emphasis></entry>
36192 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36193 <entry>Default: <emphasis>unset</emphasis></entry>
36194 </row>
36195 </tbody>
36196 </tgroup>
36197 </informaltable>
36198 <para>
36199 <indexterm role="concept">
36200 <primary>testing</primary>
36201 <secondary>variables in drivers</secondary>
36202 </indexterm>
36203 If this option is set and debugging is enabled (see the <option>-d</option> command line
36204 option) or in address-testing mode (see the <option>-bt</option> command line option),
36205 the string is expanded and included in the debugging output.
36206 If expansion of the string fails, the error message is written to the debugging
36207 output, and Exim carries on processing.
36208 This option is provided to help with checking out the values of variables and
36209 so on when debugging router configurations. For example, if a <option>condition</option>
36210 option appears not to be working, <option>debug_print</option> can be used to output the
36211 variables it references. The output happens after checks for <option>domains</option>,
36212 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
36213 are tested. A newline is added to the text if it does not end with one.
36214 The variable <varname>$router_name</varname> contains the name of the router.
36215 </para>
36216 <para>
36217 <indexterm role="option">
36218 <primary><option>disable_logging</option></primary>
36219 </indexterm>
36220 </para>
36221 <informaltable frame="all">
36222 <tgroup cols="4" colsep="0" rowsep="0">
36223 <colspec colwidth="8*" align="left"/>
36224 <colspec colwidth="6*" align="center"/>
36225 <colspec colwidth="6*" align="center"/>
36226 <colspec colwidth="6*" align="right"/>
36227 <tbody>
36228 <row>
36229 <entry><option>disable_logging</option></entry>
36230 <entry>Use: <emphasis>routers</emphasis></entry>
36231 <entry>Type: <emphasis>boolean</emphasis></entry>
36232 <entry>Default: <emphasis>false</emphasis></entry>
36233 </row>
36234 </tbody>
36235 </tgroup>
36236 </informaltable>
36237 <para>
36238 If this option is set true, nothing is logged for any routing errors
36239 or for any deliveries caused by this router. You should not set this option
36240 unless you really, really know what you are doing. See also the generic
36241 transport option of the same name.
36242 </para>
36243 <para>
36244 <indexterm role="option">
36245 <primary><option>dnssec_request_domains</option></primary>
36246 </indexterm>
36247 </para>
36248 <informaltable frame="all">
36249 <tgroup cols="4" colsep="0" rowsep="0">
36250 <colspec colwidth="8*" align="left"/>
36251 <colspec colwidth="6*" align="center"/>
36252 <colspec colwidth="6*" align="center"/>
36253 <colspec colwidth="6*" align="right"/>
36254 <tbody>
36255 <row>
36256 <entry><option>dnssec_request_domains</option></entry>
36257 <entry>Use: <emphasis>routers</emphasis></entry>
36258 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36259 <entry>Default: <emphasis>*</emphasis></entry>
36260 </row>
36261 </tbody>
36262 </tgroup>
36263 </informaltable>
36264 <para>
36265 <indexterm role="concept">
36266 <primary>MX record</primary>
36267 <secondary>security</secondary>
36268 </indexterm>
36269 <indexterm role="concept">
36270 <primary>DNSSEC</primary>
36271 <secondary>MX lookup</secondary>
36272 </indexterm>
36273 <indexterm role="concept">
36274 <primary>security</primary>
36275 <secondary>MX lookup</secondary>
36276 </indexterm>
36277 <indexterm role="concept">
36278 <primary>DNS</primary>
36279 <secondary>DNSSEC</secondary>
36280 </indexterm>
36281 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
36282 the DNSSEC request bit set.
36283 This applies to all of the SRV, MX, AAAA, A lookup sequence.
36284 </para>
36285 <para>
36286 <indexterm role="option">
36287 <primary><option>dnssec_require_domains</option></primary>
36288 </indexterm>
36289 </para>
36290 <informaltable frame="all">
36291 <tgroup cols="4" colsep="0" rowsep="0">
36292 <colspec colwidth="8*" align="left"/>
36293 <colspec colwidth="6*" align="center"/>
36294 <colspec colwidth="6*" align="center"/>
36295 <colspec colwidth="6*" align="right"/>
36296 <tbody>
36297 <row>
36298 <entry><option>dnssec_require_domains</option></entry>
36299 <entry>Use: <emphasis>routers</emphasis></entry>
36300 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36301 <entry>Default: <emphasis>unset</emphasis></entry>
36302 </row>
36303 </tbody>
36304 </tgroup>
36305 </informaltable>
36306 <para>
36307 <indexterm role="concept">
36308 <primary>MX record</primary>
36309 <secondary>security</secondary>
36310 </indexterm>
36311 <indexterm role="concept">
36312 <primary>DNSSEC</primary>
36313 <secondary>MX lookup</secondary>
36314 </indexterm>
36315 <indexterm role="concept">
36316 <primary>security</primary>
36317 <secondary>MX lookup</secondary>
36318 </indexterm>
36319 <indexterm role="concept">
36320 <primary>DNS</primary>
36321 <secondary>DNSSEC</secondary>
36322 </indexterm>
36323 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
36324 the DNSSEC request bit set.  Any returns not having the Authenticated Data bit
36325 (AD bit) set will be ignored and logged as a host-lookup failure.
36326 This applies to all of the SRV, MX, AAAA, A lookup sequence.
36327 </para>
36328 <para>
36329 <indexterm role="option">
36330 <primary><option>domains</option></primary>
36331 </indexterm>
36332 </para>
36333 <informaltable frame="all">
36334 <tgroup cols="4" colsep="0" rowsep="0">
36335 <colspec colwidth="8*" align="left"/>
36336 <colspec colwidth="6*" align="center"/>
36337 <colspec colwidth="6*" align="center"/>
36338 <colspec colwidth="6*" align="right"/>
36339 <tbody>
36340 <row>
36341 <entry><option>domains</option></entry>
36342 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36343 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36344 <entry>Default: <emphasis>unset</emphasis></entry>
36345 </row>
36346 </tbody>
36347 </tgroup>
36348 </informaltable>
36349 <para>
36350 <indexterm role="concept">
36351 <primary>router</primary>
36352 <secondary>restricting to specific domains</secondary>
36353 </indexterm>
36354 <indexterm role="variable">
36355 <primary><varname>$domain_data</varname></primary>
36356 </indexterm>
36357 If this option is set, the router is skipped unless the current domain matches
36358 the list.
36359 The data returned by the list check
36360 is placed in <varname>$domain_data</varname> for use in string
36361 expansions of the driver&#x2019;s private options and in the transport.
36362 See section <xref linkend="SECTrouprecon"/> for
36363 a list of the order in which preconditions are evaluated.
36364 </para>
36365 <para>
36366 A complex example, using a file like:
36367 </para>
36368 <literallayout class="monospaced">
36369 alice@dom1
36370 bill@dom1
36371 maggie@dom1
36372 </literallayout>
36373 <para>
36374 and checking both domain and local_part
36375 </para>
36376 <literallayout class="monospaced">
36377 domains =         ${domain:${lookup {$local_part@$domain} lseach,ret=key {/path/to/accountsfile}}}
36378 local_parts = ${local_part:${lookup {$local_part@$domain} lseach,ret=key {/path/to/accountsfile}}}
36379 </literallayout>
36380 <para>
36381 <indexterm role="option">
36382 <primary><option>driver</option></primary>
36383 </indexterm>
36384 </para>
36385 <informaltable frame="all">
36386 <tgroup cols="4" colsep="0" rowsep="0">
36387 <colspec colwidth="8*" align="left"/>
36388 <colspec colwidth="6*" align="center"/>
36389 <colspec colwidth="6*" align="center"/>
36390 <colspec colwidth="6*" align="right"/>
36391 <tbody>
36392 <row>
36393 <entry><option>driver</option></entry>
36394 <entry>Use: <emphasis>routers</emphasis></entry>
36395 <entry>Type: <emphasis>string</emphasis></entry>
36396 <entry>Default: <emphasis>unset</emphasis></entry>
36397 </row>
36398 </tbody>
36399 </tgroup>
36400 </informaltable>
36401 <para>
36402 This option must always be set. It specifies which of the available routers is
36403 to be used.
36404 </para>
36405 <para>
36406 <indexterm role="option">
36407 <primary><option>dsn_lasthop</option></primary>
36408 </indexterm>
36409 </para>
36410 <informaltable frame="all">
36411 <tgroup cols="4" colsep="0" rowsep="0">
36412 <colspec colwidth="8*" align="left"/>
36413 <colspec colwidth="6*" align="center"/>
36414 <colspec colwidth="6*" align="center"/>
36415 <colspec colwidth="6*" align="right"/>
36416 <tbody>
36417 <row>
36418 <entry><option>dsn_lasthop</option></entry>
36419 <entry>Use: <emphasis>routers</emphasis></entry>
36420 <entry>Type: <emphasis>boolean</emphasis></entry>
36421 <entry>Default: <emphasis>false</emphasis></entry>
36422 </row>
36423 </tbody>
36424 </tgroup>
36425 </informaltable>
36426 <para>
36427 <indexterm role="concept">
36428 <primary>DSN</primary>
36429 <secondary>success</secondary>
36430 </indexterm>
36431 <indexterm role="concept">
36432 <primary>Delivery Status Notification</primary>
36433 <secondary>success</secondary>
36434 </indexterm>
36435 If this option is set true, and extended DSN (RFC3461) processing is in effect,
36436 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
36437 instead send a success DSN as if the next hop does not support DSN.
36438 Not effective on redirect routers.
36439 </para>
36440 <para>
36441 <indexterm role="option">
36442 <primary><option>errors_to</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>errors_to</option></entry>
36454 <entry>Use: <emphasis>routers</emphasis></entry>
36455 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36456 <entry>Default: <emphasis>unset</emphasis></entry>
36457 </row>
36458 </tbody>
36459 </tgroup>
36460 </informaltable>
36461 <para>
36462 <indexterm role="concept">
36463 <primary>envelope from</primary>
36464 </indexterm>
36465 <indexterm role="concept">
36466 <primary>envelope sender</primary>
36467 </indexterm>
36468 <indexterm role="concept">
36469 <primary>router</primary>
36470 <secondary>changing address for errors</secondary>
36471 </indexterm>
36472 If a router successfully handles an address, it may assign the address to a
36473 transport for delivery or it may generate child addresses. In both cases, if
36474 there is a delivery problem during later processing, the resulting bounce
36475 message is sent to the address that results from expanding this string,
36476 provided that the address verifies successfully. The <option>errors_to</option> option is
36477 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
36478 </para>
36479 <para>
36480 The <option>errors_to</option> setting associated with an address can be overridden if it
36481 subsequently passes through other routers that have their own <option>errors_to</option>
36482 settings, or if the message is delivered by a transport with a <option>return_path</option>
36483 setting.
36484 </para>
36485 <para>
36486 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
36487 the expansion fails to verify, the errors address associated with the incoming
36488 address is used. At top level, this is the envelope sender. A non-forced
36489 expansion failure causes delivery to be deferred.
36490 </para>
36491 <para>
36492 If an address for which <option>errors_to</option> has been set ends up being delivered over
36493 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
36494 any bounces that are generated by other MTAs on the delivery route are also
36495 sent there. You can set <option>errors_to</option> to the empty string by either of these
36496 settings:
36497 </para>
36498 <literallayout class="monospaced">
36499 errors_to =
36500 errors_to = ""
36501 </literallayout>
36502 <para>
36503 An expansion item that yields an empty string has the same effect. If you do
36504 this, a locally detected delivery error for addresses processed by this router
36505 no longer gives rise to a bounce message; the error is discarded. If the
36506 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
36507 overridden by the <option>return_path</option> option on the transport.
36508 </para>
36509 <para>
36510 <indexterm role="variable">
36511 <primary><varname>$address_data</varname></primary>
36512 </indexterm>
36513 If for some reason you want to discard local errors, but use a non-empty
36514 MAIL command for remote delivery, you can preserve the original return
36515 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
36516 setting <option>return_path</option>.
36517 </para>
36518 <para>
36519 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
36520 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
36521 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
36522 </para>
36523 <para>
36524 <indexterm role="option">
36525 <primary><option>expn</option></primary>
36526 </indexterm>
36527 </para>
36528 <informaltable frame="all">
36529 <tgroup cols="4" colsep="0" rowsep="0">
36530 <colspec colwidth="8*" align="left"/>
36531 <colspec colwidth="6*" align="center"/>
36532 <colspec colwidth="6*" align="center"/>
36533 <colspec colwidth="6*" align="right"/>
36534 <tbody>
36535 <row>
36536 <entry><option>expn</option></entry>
36537 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36538 <entry>Type: <emphasis>boolean</emphasis></entry>
36539 <entry>Default: <emphasis>true</emphasis></entry>
36540 </row>
36541 </tbody>
36542 </tgroup>
36543 </informaltable>
36544 <para>
36545 <indexterm role="concept">
36546 <primary>address</primary>
36547 <secondary>testing</secondary>
36548 </indexterm>
36549 <indexterm role="concept">
36550 <primary>testing</primary>
36551 <secondary>addresses</secondary>
36552 </indexterm>
36553 <indexterm role="concept">
36554 <primary>EXPN</primary>
36555 <secondary>router skipping</secondary>
36556 </indexterm>
36557 <indexterm role="concept">
36558 <primary>router</primary>
36559 <secondary>skipping for EXPN</secondary>
36560 </indexterm>
36561 If this option is turned off, the router is skipped when testing an address
36562 as a result of processing an SMTP EXPN command. You might, for example,
36563 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
36564 on for the system alias file.
36565 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
36566 are evaluated.
36567 </para>
36568 <para>
36569 The use of the SMTP EXPN command is controlled by an ACL (see chapter
36570 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
36571 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
36572 </para>
36573 <para>
36574 <indexterm role="option">
36575 <primary><option>fail_verify</option></primary>
36576 </indexterm>
36577 </para>
36578 <informaltable frame="all">
36579 <tgroup cols="4" colsep="0" rowsep="0">
36580 <colspec colwidth="8*" align="left"/>
36581 <colspec colwidth="6*" align="center"/>
36582 <colspec colwidth="6*" align="center"/>
36583 <colspec colwidth="6*" align="right"/>
36584 <tbody>
36585 <row>
36586 <entry><option>fail_verify</option></entry>
36587 <entry>Use: <emphasis>routers</emphasis></entry>
36588 <entry>Type: <emphasis>boolean</emphasis></entry>
36589 <entry>Default: <emphasis>false</emphasis></entry>
36590 </row>
36591 </tbody>
36592 </tgroup>
36593 </informaltable>
36594 <para>
36595 <indexterm role="concept">
36596 <primary>router</primary>
36597 <secondary>forcing verification failure</secondary>
36598 </indexterm>
36599 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
36600 <option>fail_verify_recipient</option> to the same value.
36601 </para>
36602 <para>
36603 <indexterm role="option">
36604 <primary><option>fail_verify_recipient</option></primary>
36605 </indexterm>
36606 </para>
36607 <informaltable frame="all">
36608 <tgroup cols="4" colsep="0" rowsep="0">
36609 <colspec colwidth="8*" align="left"/>
36610 <colspec colwidth="6*" align="center"/>
36611 <colspec colwidth="6*" align="center"/>
36612 <colspec colwidth="6*" align="right"/>
36613 <tbody>
36614 <row>
36615 <entry><option>fail_verify_recipient</option></entry>
36616 <entry>Use: <emphasis>routers</emphasis></entry>
36617 <entry>Type: <emphasis>boolean</emphasis></entry>
36618 <entry>Default: <emphasis>false</emphasis></entry>
36619 </row>
36620 </tbody>
36621 </tgroup>
36622 </informaltable>
36623 <para>
36624 If this option is true and an address is accepted by this router when
36625 verifying a recipient, verification fails.
36626 </para>
36627 <para>
36628 <indexterm role="option">
36629 <primary><option>fail_verify_sender</option></primary>
36630 </indexterm>
36631 </para>
36632 <informaltable frame="all">
36633 <tgroup cols="4" colsep="0" rowsep="0">
36634 <colspec colwidth="8*" align="left"/>
36635 <colspec colwidth="6*" align="center"/>
36636 <colspec colwidth="6*" align="center"/>
36637 <colspec colwidth="6*" align="right"/>
36638 <tbody>
36639 <row>
36640 <entry><option>fail_verify_sender</option></entry>
36641 <entry>Use: <emphasis>routers</emphasis></entry>
36642 <entry>Type: <emphasis>boolean</emphasis></entry>
36643 <entry>Default: <emphasis>false</emphasis></entry>
36644 </row>
36645 </tbody>
36646 </tgroup>
36647 </informaltable>
36648 <para>
36649 If this option is true and an address is accepted by this router when
36650 verifying a sender, verification fails.
36651 </para>
36652 <para>
36653 <indexterm role="option">
36654 <primary><option>fallback_hosts</option></primary>
36655 </indexterm>
36656 </para>
36657 <informaltable frame="all">
36658 <tgroup cols="4" colsep="0" rowsep="0">
36659 <colspec colwidth="8*" align="left"/>
36660 <colspec colwidth="6*" align="center"/>
36661 <colspec colwidth="6*" align="center"/>
36662 <colspec colwidth="6*" align="right"/>
36663 <tbody>
36664 <row>
36665 <entry><option>fallback_hosts</option></entry>
36666 <entry>Use: <emphasis>routers</emphasis></entry>
36667 <entry>Type: <emphasis>string list</emphasis></entry>
36668 <entry>Default: <emphasis>unset</emphasis></entry>
36669 </row>
36670 </tbody>
36671 </tgroup>
36672 </informaltable>
36673 <para>
36674 <indexterm role="concept">
36675 <primary>router</primary>
36676 <secondary>fallback hosts</secondary>
36677 </indexterm>
36678 <indexterm role="concept">
36679 <primary>fallback</primary>
36680 <secondary>hosts specified on router</secondary>
36681 </indexterm>
36682 String expansion is not applied to this option. The argument must be a
36683 colon-separated list of host names or IP addresses. The list separator can be
36684 changed (see section <xref linkend="SECTlistsepchange"/>), and a port can be specified with
36685 each name or address. In fact, the format of each item is exactly the same as
36686 defined for the list of hosts in a <command>manualroute</command> router (see section
36687 <xref linkend="SECTformatonehostitem"/>).
36688 </para>
36689 <para>
36690 If a router queues an address for a remote transport, this host list is
36691 associated with the address, and used instead of the transport&#x2019;s fallback host
36692 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
36693 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
36694 transport for further details.
36695 </para>
36696 <para>
36697 <indexterm role="option">
36698 <primary><option>group</option></primary>
36699 </indexterm>
36700 </para>
36701 <informaltable frame="all">
36702 <tgroup cols="4" colsep="0" rowsep="0">
36703 <colspec colwidth="8*" align="left"/>
36704 <colspec colwidth="6*" align="center"/>
36705 <colspec colwidth="6*" align="center"/>
36706 <colspec colwidth="6*" align="right"/>
36707 <tbody>
36708 <row>
36709 <entry><option>group</option></entry>
36710 <entry>Use: <emphasis>routers</emphasis></entry>
36711 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36712 <entry>Default: <emphasis>see below</emphasis></entry>
36713 </row>
36714 </tbody>
36715 </tgroup>
36716 </informaltable>
36717 <para>
36718 <indexterm role="concept">
36719 <primary>gid (group id)</primary>
36720 <secondary>local delivery</secondary>
36721 </indexterm>
36722 <indexterm role="concept">
36723 <primary>local transports</primary>
36724 <secondary>uid and gid</secondary>
36725 </indexterm>
36726 <indexterm role="concept">
36727 <primary>transport</primary>
36728 <secondary>local</secondary>
36729 </indexterm>
36730 <indexterm role="concept">
36731 <primary>router</primary>
36732 <secondary>setting group</secondary>
36733 </indexterm>
36734 When a router queues an address for a transport, and the transport does not
36735 specify a group, the group given here is used when running the delivery
36736 process.
36737 The group may be specified numerically or by name. If expansion fails, the
36738 error is logged and delivery is deferred.
36739 The default is unset, unless <option>check_local_user</option> is set, when the default
36740 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
36741 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
36742 </para>
36743 <para>
36744 <indexterm role="option">
36745 <primary><option>headers_add</option></primary>
36746 </indexterm>
36747 </para>
36748 <informaltable frame="all">
36749 <tgroup cols="4" colsep="0" rowsep="0">
36750 <colspec colwidth="8*" align="left"/>
36751 <colspec colwidth="6*" align="center"/>
36752 <colspec colwidth="6*" align="center"/>
36753 <colspec colwidth="6*" align="right"/>
36754 <tbody>
36755 <row>
36756 <entry><option>headers_add</option></entry>
36757 <entry>Use: <emphasis>routers</emphasis></entry>
36758 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
36759 <entry>Default: <emphasis>unset</emphasis></entry>
36760 </row>
36761 </tbody>
36762 </tgroup>
36763 </informaltable>
36764 <para>
36765 <indexterm role="concept">
36766 <primary>header lines</primary>
36767 <secondary>adding</secondary>
36768 </indexterm>
36769 <indexterm role="concept">
36770 <primary>router</primary>
36771 <secondary>adding header lines</secondary>
36772 </indexterm>
36773 This option specifies a list of text headers,
36774 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
36775 that is associated with any addresses that are accepted by the router.
36776 Each item is separately expanded, at routing time.  However, this
36777 option has no effect when an address is just being verified. The way in which
36778 the text is used to add header lines at transport time is described in section
36779 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
36780 message is in the process of being transported. This means that references to
36781 header lines in string expansions in the transport&#x2019;s configuration do not
36782 <quote>see</quote> the added header lines.
36783 </para>
36784 <para>
36785 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
36786 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
36787 an item expansion is forced to fail, the item has no effect. Other expansion
36788 failures are treated as configuration errors.
36789 </para>
36790 <para>
36791 Unlike most options, <option>headers_add</option> can be specified multiple times
36792 for a router; all listed headers are added.
36793 </para>
36794 <para>
36795 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
36796 router that has the <option>one_time</option> option set.
36797 </para>
36798 <para>
36799 <indexterm role="concept">
36800 <primary>duplicate addresses</primary>
36801 </indexterm>
36802 <indexterm role="option">
36803 <primary><option>unseen</option></primary>
36804 </indexterm>
36805 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
36806 additions are deleted when the address is passed on to subsequent routers.
36807 For a <option>redirect</option> router, if a generated address is the same as the incoming
36808 address, this can lead to duplicate addresses with different header
36809 modifications. Exim does not do duplicate deliveries (except, in certain
36810 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
36811 which of the duplicates is discarded, so this ambiguous situation should be
36812 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
36813 </para>
36814 <para>
36815 <indexterm role="option">
36816 <primary><option>headers_remove</option></primary>
36817 </indexterm>
36818 </para>
36819 <informaltable frame="all">
36820 <tgroup cols="4" colsep="0" rowsep="0">
36821 <colspec colwidth="8*" align="left"/>
36822 <colspec colwidth="6*" align="center"/>
36823 <colspec colwidth="6*" align="center"/>
36824 <colspec colwidth="6*" align="right"/>
36825 <tbody>
36826 <row>
36827 <entry><option>headers_remove</option></entry>
36828 <entry>Use: <emphasis>routers</emphasis></entry>
36829 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
36830 <entry>Default: <emphasis>unset</emphasis></entry>
36831 </row>
36832 </tbody>
36833 </tgroup>
36834 </informaltable>
36835 <para>
36836 <indexterm role="concept">
36837 <primary>header lines</primary>
36838 <secondary>removing</secondary>
36839 </indexterm>
36840 <indexterm role="concept">
36841 <primary>router</primary>
36842 <secondary>removing header lines</secondary>
36843 </indexterm>
36844 This option specifies a list of text headers,
36845 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
36846 that is associated with any addresses that are accepted by the router.
36847 However, the option has no effect when an address is just being verified.
36848 Each list item is separately expanded, at transport time.
36849 If an item ends in *, it will match any header with the given prefix.
36850 The way in which
36851 the text is used to remove header lines at transport time is described in
36852 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
36853 the message is in the process of being transported. This means that references
36854 to header lines in string expansions in the transport&#x2019;s configuration still
36855 <quote>see</quote> the original header lines.
36856 </para>
36857 <para>
36858 The <option>headers_remove</option> option is handled after <option>errors_to</option> and
36859 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
36860 the item has no effect. Other expansion failures are treated as configuration
36861 errors.
36862 </para>
36863 <para>
36864 Unlike most options, <option>headers_remove</option> can be specified multiple times
36865 for a router; all listed headers are removed.
36866 </para>
36867 <para>
36868 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
36869 router that has the <option>one_time</option> option set.
36870 </para>
36871 <para>
36872 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
36873 removal requests are deleted when the address is passed on to subsequent
36874 routers, and this can lead to problems with duplicates -- see the similar
36875 warning for <option>headers_add</option> above.
36876 </para>
36877 <para>
36878 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
36879 items that contain a list separator must have it doubled.
36880 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
36881 </para>
36882 <para>
36883 <indexterm role="option">
36884 <primary><option>ignore_target_hosts</option></primary>
36885 </indexterm>
36886 </para>
36887 <informaltable frame="all">
36888 <tgroup cols="4" colsep="0" rowsep="0">
36889 <colspec colwidth="8*" align="left"/>
36890 <colspec colwidth="6*" align="center"/>
36891 <colspec colwidth="6*" align="center"/>
36892 <colspec colwidth="6*" align="right"/>
36893 <tbody>
36894 <row>
36895 <entry><option>ignore_target_hosts</option></entry>
36896 <entry>Use: <emphasis>routers</emphasis></entry>
36897 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
36898 <entry>Default: <emphasis>unset</emphasis></entry>
36899 </row>
36900 </tbody>
36901 </tgroup>
36902 </informaltable>
36903 <para>
36904 <indexterm role="concept">
36905 <primary>IP address</primary>
36906 <secondary>discarding</secondary>
36907 </indexterm>
36908 <indexterm role="concept">
36909 <primary>router</primary>
36910 <secondary>discarding IP addresses</secondary>
36911 </indexterm>
36912 Although this option is a host list, it should normally contain IP address
36913 entries rather than names. If any host that is looked up by the router has an
36914 IP address that matches an item in this list, Exim behaves as if that IP
36915 address did not exist. This option allows you to cope with rogue DNS entries
36916 like
36917 </para>
36918 <literallayout class="monospaced">
36919 remote.domain.example.  A  127.0.0.1
36920 </literallayout>
36921 <para>
36922 by setting
36923 </para>
36924 <literallayout class="monospaced">
36925 ignore_target_hosts = 127.0.0.1
36926 </literallayout>
36927 <para>
36928 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
36929 discarded in this way, the router declines. In a conventional configuration, an
36930 attempt to mail to such a domain would normally provoke the <quote>unrouteable
36931 domain</quote> error, and an attempt to verify an address in the domain would fail.
36932 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
36933 router declines if presented with one of the listed addresses.
36934 </para>
36935 <para>
36936 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
36937 means of the first or the second of the following settings, respectively:
36938 </para>
36939 <literallayout class="monospaced">
36940 ignore_target_hosts = 0.0.0.0/0
36941 ignore_target_hosts = &lt;; 0::0/0
36942 </literallayout>
36943 <para>
36944 The pattern in the first line matches all IPv4 addresses, whereas the pattern
36945 in the second line matches all IPv6 addresses.
36946 </para>
36947 <para>
36948 This option may also be useful for ignoring link-local and site-local IPv6
36949 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
36950 is expanded before use as a list, it is possible to make it dependent on the
36951 domain that is being routed.
36952 </para>
36953 <para>
36954 <indexterm role="variable">
36955 <primary><varname>$host_address</varname></primary>
36956 </indexterm>
36957 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
36958 checked.
36959 </para>
36960 <para>
36961 <indexterm role="option">
36962 <primary><option>initgroups</option></primary>
36963 </indexterm>
36964 </para>
36965 <informaltable frame="all">
36966 <tgroup cols="4" colsep="0" rowsep="0">
36967 <colspec colwidth="8*" align="left"/>
36968 <colspec colwidth="6*" align="center"/>
36969 <colspec colwidth="6*" align="center"/>
36970 <colspec colwidth="6*" align="right"/>
36971 <tbody>
36972 <row>
36973 <entry><option>initgroups</option></entry>
36974 <entry>Use: <emphasis>routers</emphasis></entry>
36975 <entry>Type: <emphasis>boolean</emphasis></entry>
36976 <entry>Default: <emphasis>false</emphasis></entry>
36977 </row>
36978 </tbody>
36979 </tgroup>
36980 </informaltable>
36981 <para>
36982 <indexterm role="concept">
36983 <primary>additional groups</primary>
36984 </indexterm>
36985 <indexterm role="concept">
36986 <primary>groups</primary>
36987 <secondary>additional</secondary>
36988 </indexterm>
36989 <indexterm role="concept">
36990 <primary>local transports</primary>
36991 <secondary>uid and gid</secondary>
36992 </indexterm>
36993 <indexterm role="concept">
36994 <primary>transport</primary>
36995 <secondary>local</secondary>
36996 </indexterm>
36997 If the router queues an address for a transport, and this option is true, and
36998 the uid supplied by the router is not overridden by the transport, the
36999 <function>initgroups()</function> function is called when running the transport to ensure that
37000 any additional groups associated with the uid are set up. See also <option>group</option>
37001 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
37002 </para>
37003 <para>
37004 <indexterm role="option">
37005 <primary><option>local_part_prefix</option></primary>
37006 </indexterm>
37007 </para>
37008 <informaltable frame="all">
37009 <tgroup cols="4" colsep="0" rowsep="0">
37010 <colspec colwidth="8*" align="left"/>
37011 <colspec colwidth="6*" align="center"/>
37012 <colspec colwidth="6*" align="center"/>
37013 <colspec colwidth="6*" align="right"/>
37014 <tbody>
37015 <row>
37016 <entry><option>local_part_prefix</option></entry>
37017 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37018 <entry>Type: <emphasis>string list</emphasis></entry>
37019 <entry>Default: <emphasis>unset</emphasis></entry>
37020 </row>
37021 </tbody>
37022 </tgroup>
37023 </informaltable>
37024 <para>
37025 <indexterm role="concept">
37026 <primary>affix</primary>
37027 <secondary>router precondition</secondary>
37028 </indexterm>
37029 <indexterm role="concept">
37030 <primary>router</primary>
37031 <secondary>prefix for local part</secondary>
37032 </indexterm>
37033 <indexterm role="concept">
37034 <primary>prefix</primary>
37035 <secondary>for local part, used in router</secondary>
37036 </indexterm>
37037 If this option is set, the router is skipped unless the local part starts with
37038 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
37039 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
37040 evaluated.
37041 </para>
37042 <para>
37043 The list is scanned from left to right, and the first prefix that matches is
37044 used. A limited form of wildcard is available; if the prefix begins with an
37045 asterisk, it matches the longest possible sequence of arbitrary characters at
37046 the start of the local part. An asterisk should therefore always be followed by
37047 some character that does not occur in normal local parts.
37048 <indexterm role="concept">
37049 <primary>multiple mailboxes</primary>
37050 </indexterm>
37051 <indexterm role="concept">
37052 <primary>mailbox</primary>
37053 <secondary>multiple</secondary>
37054 </indexterm>
37055 Wildcarding can be used to set up multiple user mailboxes, as described in
37056 section <xref linkend="SECTmulbox"/>.
37057 </para>
37058 <para>
37059 <indexterm role="variable">
37060 <primary><varname>$local_part</varname></primary>
37061 </indexterm>
37062 <indexterm role="variable">
37063 <primary><varname>$local_part_prefix</varname></primary>
37064 </indexterm>
37065 During the testing of the <option>local_parts</option> option, and while the router is
37066 running, the prefix is removed from the local part, and is available in the
37067 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
37068 the router accepts the address, this remains true during subsequent delivery by
37069 a transport. In particular, the local part that is transmitted in the RCPT
37070 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
37071 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
37072 the relevant transport.
37073 </para>
37074 <para>
37075 <indexterm role="variable">
37076 <primary><varname>$local_part_prefix_v</varname></primary>
37077 </indexterm>
37078 If wildcarding (above) was used then the part of the prefix matching the
37079 wildcard is available in <varname>$local_part_prefix_v</varname>.
37080 </para>
37081 <para>
37082 When an address is being verified, <option>local_part_prefix</option> affects only the
37083 behaviour of the router. If the callout feature of verification is in use, this
37084 means that the full address, including the prefix, will be used during the
37085 callout.
37086 </para>
37087 <para>
37088 The prefix facility is commonly used to handle local parts of the form
37089 <option>owner-something</option>. Another common use is to support local parts of the form
37090 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
37091 to tell a user their forwarding is broken &ndash; by placing a router like this one
37092 immediately before the router that handles <filename>.forward</filename> files:
37093 </para>
37094 <literallayout class="monospaced">
37095 real_localuser:
37096   driver = accept
37097   local_part_prefix = real-
37098   check_local_user
37099   transport = local_delivery
37100 </literallayout>
37101 <para>
37102 For security, it would probably be a good idea to restrict the use of this
37103 router to locally-generated messages, using a condition such as this:
37104 </para>
37105 <literallayout class="monospaced">
37106   condition = ${if match {$sender_host_address}\
37107                          {\N^(|127\.0\.0\.1)$\N}}
37108 </literallayout>
37109 <para>
37110 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
37111 both conditions must be met if not optional. Care must be taken if wildcards
37112 are used in both a prefix and a suffix on the same router. Different
37113 separator characters must be used to avoid ambiguity.
37114 </para>
37115 <para>
37116 <indexterm role="option">
37117 <primary><option>local_part_prefix_optional</option></primary>
37118 </indexterm>
37119 </para>
37120 <informaltable frame="all">
37121 <tgroup cols="4" colsep="0" rowsep="0">
37122 <colspec colwidth="8*" align="left"/>
37123 <colspec colwidth="6*" align="center"/>
37124 <colspec colwidth="6*" align="center"/>
37125 <colspec colwidth="6*" align="right"/>
37126 <tbody>
37127 <row>
37128 <entry><option>local_part_prefix_optional</option></entry>
37129 <entry>Use: <emphasis>routers</emphasis></entry>
37130 <entry>Type: <emphasis>boolean</emphasis></entry>
37131 <entry>Default: <emphasis>false</emphasis></entry>
37132 </row>
37133 </tbody>
37134 </tgroup>
37135 </informaltable>
37136 <para>
37137 See <option>local_part_prefix</option> above.
37138 </para>
37139 <para>
37140 <indexterm role="option">
37141 <primary><option>local_part_suffix</option></primary>
37142 </indexterm>
37143 </para>
37144 <informaltable frame="all">
37145 <tgroup cols="4" colsep="0" rowsep="0">
37146 <colspec colwidth="8*" align="left"/>
37147 <colspec colwidth="6*" align="center"/>
37148 <colspec colwidth="6*" align="center"/>
37149 <colspec colwidth="6*" align="right"/>
37150 <tbody>
37151 <row>
37152 <entry><option>local_part_suffix</option></entry>
37153 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37154 <entry>Type: <emphasis>string list</emphasis></entry>
37155 <entry>Default: <emphasis>unset</emphasis></entry>
37156 </row>
37157 </tbody>
37158 </tgroup>
37159 </informaltable>
37160 <para>
37161 <indexterm role="concept">
37162 <primary>router</primary>
37163 <secondary>suffix for local part</secondary>
37164 </indexterm>
37165 <indexterm role="concept">
37166 <primary>suffix for local part</primary>
37167 <secondary>used in router</secondary>
37168 </indexterm>
37169 This option operates in the same way as <option>local_part_prefix</option>, except that the
37170 local part must end (rather than start) with the given string, the
37171 <option>local_part_suffix_optional</option> option determines whether the suffix is
37172 mandatory, and the wildcard * character, if present, must be the last
37173 character of the suffix. This option facility is commonly used to handle local
37174 parts of the form <option>something-request</option> and multiple user mailboxes of the form
37175 <option>username-foo</option>.
37176 </para>
37177 <para>
37178 <indexterm role="option">
37179 <primary><option>local_part_suffix_optional</option></primary>
37180 </indexterm>
37181 </para>
37182 <informaltable frame="all">
37183 <tgroup cols="4" colsep="0" rowsep="0">
37184 <colspec colwidth="8*" align="left"/>
37185 <colspec colwidth="6*" align="center"/>
37186 <colspec colwidth="6*" align="center"/>
37187 <colspec colwidth="6*" align="right"/>
37188 <tbody>
37189 <row>
37190 <entry><option>local_part_suffix_optional</option></entry>
37191 <entry>Use: <emphasis>routers</emphasis></entry>
37192 <entry>Type: <emphasis>boolean</emphasis></entry>
37193 <entry>Default: <emphasis>false</emphasis></entry>
37194 </row>
37195 </tbody>
37196 </tgroup>
37197 </informaltable>
37198 <para>
37199 See <option>local_part_suffix</option> above.
37200 </para>
37201 <para>
37202 <indexterm role="option">
37203 <primary><option>local_parts</option></primary>
37204 </indexterm>
37205 </para>
37206 <informaltable frame="all">
37207 <tgroup cols="4" colsep="0" rowsep="0">
37208 <colspec colwidth="8*" align="left"/>
37209 <colspec colwidth="6*" align="center"/>
37210 <colspec colwidth="6*" align="center"/>
37211 <colspec colwidth="6*" align="right"/>
37212 <tbody>
37213 <row>
37214 <entry><option>local_parts</option></entry>
37215 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37216 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
37217 <entry>Default: <emphasis>unset</emphasis></entry>
37218 </row>
37219 </tbody>
37220 </tgroup>
37221 </informaltable>
37222 <para>
37223 <indexterm role="concept">
37224 <primary>router</primary>
37225 <secondary>restricting to specific local parts</secondary>
37226 </indexterm>
37227 <indexterm role="concept">
37228 <primary>local part</primary>
37229 <secondary>checking in router</secondary>
37230 </indexterm>
37231 The router is run only if the local part of the address matches the list.
37232 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37233 are evaluated, and
37234 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
37235 string is expanded, it is possible to make it depend on the domain, for
37236 example:
37237 </para>
37238 <literallayout class="monospaced">
37239 local_parts = dbm;/usr/local/specials/$domain_data
37240 </literallayout>
37241 <para>
37242 <indexterm role="variable">
37243 <primary><varname>$local_part_data</varname></primary>
37244 </indexterm>
37245 the data returned by the list check
37246 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
37247 expansions of the router&#x2019;s private options or in the transport.
37248 You might use this option, for
37249 example, if you have a large number of local virtual domains, and you want to
37250 send all postmaster mail to the same place without having to set up an alias in
37251 each virtual domain:
37252 </para>
37253 <literallayout class="monospaced">
37254 postmaster:
37255   driver = redirect
37256   local_parts = postmaster
37257   data = postmaster@real.domain.example
37258 </literallayout>
37259 <para>
37260 <indexterm role="option">
37261 <primary><option>log_as_local</option></primary>
37262 </indexterm>
37263 </para>
37264 <informaltable frame="all">
37265 <tgroup cols="4" colsep="0" rowsep="0">
37266 <colspec colwidth="8*" align="left"/>
37267 <colspec colwidth="6*" align="center"/>
37268 <colspec colwidth="6*" align="center"/>
37269 <colspec colwidth="6*" align="right"/>
37270 <tbody>
37271 <row>
37272 <entry><option>log_as_local</option></entry>
37273 <entry>Use: <emphasis>routers</emphasis></entry>
37274 <entry>Type: <emphasis>boolean</emphasis></entry>
37275 <entry>Default: <emphasis>see below</emphasis></entry>
37276 </row>
37277 </tbody>
37278 </tgroup>
37279 </informaltable>
37280 <para>
37281 <indexterm role="concept">
37282 <primary>log</primary>
37283 <secondary>delivery line</secondary>
37284 </indexterm>
37285 <indexterm role="concept">
37286 <primary>delivery</primary>
37287 <secondary>log line format</secondary>
37288 </indexterm>
37289 Exim has two logging styles for delivery, the idea being to make local
37290 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
37291 recipient address is given just as the local part, without a domain. The use of
37292 this style is controlled by this option. It defaults to true for the <command>accept</command>
37293 router, and false for all the others. This option applies only when a
37294 router assigns an address to a transport. It has no effect on routers that
37295 redirect addresses.
37296 </para>
37297 <para>
37298 <indexterm role="option">
37299 <primary><option>more</option></primary>
37300 </indexterm>
37301 </para>
37302 <informaltable frame="all">
37303 <tgroup cols="4" colsep="0" rowsep="0">
37304 <colspec colwidth="8*" align="left"/>
37305 <colspec colwidth="6*" align="center"/>
37306 <colspec colwidth="6*" align="center"/>
37307 <colspec colwidth="6*" align="right"/>
37308 <tbody>
37309 <row>
37310 <entry><option>more</option></entry>
37311 <entry>Use: <emphasis>routers</emphasis></entry>
37312 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
37313 <entry>Default: <emphasis>true</emphasis></entry>
37314 </row>
37315 </tbody>
37316 </tgroup>
37317 </informaltable>
37318 <para>
37319 The result of string expansion for this option must be a valid boolean value,
37320 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
37321 result causes an error, and delivery is deferred. If the expansion is forced to
37322 fail, the default value for the option (true) is used. Other failures cause
37323 delivery to be deferred.
37324 </para>
37325 <para>
37326 If this option is set false, and the router declines to handle the address, no
37327 further routers are tried, routing fails, and the address is bounced.
37328 <indexterm role="option">
37329 <primary><option>self</option></primary>
37330 </indexterm>
37331 However, if the router explicitly passes an address to the following router by
37332 means of the setting
37333 </para>
37334 <literallayout class="monospaced">
37335 self = pass
37336 </literallayout>
37337 <para>
37338 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
37339 does not affect the behaviour if one of the precondition tests fails. In that
37340 case, the address is always passed to the next router.
37341 </para>
37342 <para>
37343 Note that <option>address_data</option> is not considered to be a precondition. If its
37344 expansion is forced to fail, the router declines, and the value of <option>more</option>
37345 controls what happens next.
37346 </para>
37347 <para>
37348 <indexterm role="option">
37349 <primary><option>pass_on_timeout</option></primary>
37350 </indexterm>
37351 </para>
37352 <informaltable frame="all">
37353 <tgroup cols="4" colsep="0" rowsep="0">
37354 <colspec colwidth="8*" align="left"/>
37355 <colspec colwidth="6*" align="center"/>
37356 <colspec colwidth="6*" align="center"/>
37357 <colspec colwidth="6*" align="right"/>
37358 <tbody>
37359 <row>
37360 <entry><option>pass_on_timeout</option></entry>
37361 <entry>Use: <emphasis>routers</emphasis></entry>
37362 <entry>Type: <emphasis>boolean</emphasis></entry>
37363 <entry>Default: <emphasis>false</emphasis></entry>
37364 </row>
37365 </tbody>
37366 </tgroup>
37367 </informaltable>
37368 <para>
37369 <indexterm role="concept">
37370 <primary>timeout</primary>
37371 <secondary>of router</secondary>
37372 </indexterm>
37373 <indexterm role="concept">
37374 <primary>router</primary>
37375 <secondary>timeout</secondary>
37376 </indexterm>
37377 If a router times out during a host lookup, it normally causes deferral of the
37378 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
37379 router, overriding <option>no_more</option>. This may be helpful for systems that are
37380 intermittently connected to the Internet, or those that want to pass to a smart
37381 host any messages that cannot immediately be delivered.
37382 </para>
37383 <para>
37384 There are occasional other temporary errors that can occur while doing DNS
37385 lookups. They are treated in the same way as a timeout, and this option
37386 applies to all of them.
37387 </para>
37388 <para>
37389 <indexterm role="option">
37390 <primary><option>pass_router</option></primary>
37391 </indexterm>
37392 </para>
37393 <informaltable frame="all">
37394 <tgroup cols="4" colsep="0" rowsep="0">
37395 <colspec colwidth="8*" align="left"/>
37396 <colspec colwidth="6*" align="center"/>
37397 <colspec colwidth="6*" align="center"/>
37398 <colspec colwidth="6*" align="right"/>
37399 <tbody>
37400 <row>
37401 <entry><option>pass_router</option></entry>
37402 <entry>Use: <emphasis>routers</emphasis></entry>
37403 <entry>Type: <emphasis>string</emphasis></entry>
37404 <entry>Default: <emphasis>unset</emphasis></entry>
37405 </row>
37406 </tbody>
37407 </tgroup>
37408 </informaltable>
37409 <para>
37410 <indexterm role="concept">
37411 <primary>router</primary>
37412 <secondary>go to after <quote>pass</quote></secondary>
37413 </indexterm>
37414 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
37415 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
37416 routing to continue, and overriding a false setting of <option>more</option>. When one of
37417 these routers returns <quote>pass</quote>, the address is normally handed on to the next
37418 router in sequence. This can be changed by setting <option>pass_router</option> to the name
37419 of another router. However (unlike <option>redirect_router</option>) the named router must
37420 be below the current router, to avoid loops. Note that this option applies only
37421 to the special case of <quote>pass</quote>. It does not apply when a router returns
37422 <quote>decline</quote> because it cannot handle an address.
37423 </para>
37424 <para>
37425 <indexterm role="option">
37426 <primary><option>redirect_router</option></primary>
37427 </indexterm>
37428 </para>
37429 <informaltable frame="all">
37430 <tgroup cols="4" colsep="0" rowsep="0">
37431 <colspec colwidth="8*" align="left"/>
37432 <colspec colwidth="6*" align="center"/>
37433 <colspec colwidth="6*" align="center"/>
37434 <colspec colwidth="6*" align="right"/>
37435 <tbody>
37436 <row>
37437 <entry><option>redirect_router</option></entry>
37438 <entry>Use: <emphasis>routers</emphasis></entry>
37439 <entry>Type: <emphasis>string</emphasis></entry>
37440 <entry>Default: <emphasis>unset</emphasis></entry>
37441 </row>
37442 </tbody>
37443 </tgroup>
37444 </informaltable>
37445 <para>
37446 <indexterm role="concept">
37447 <primary>router</primary>
37448 <secondary>start at after redirection</secondary>
37449 </indexterm>
37450 Sometimes an administrator knows that it is pointless to reprocess addresses
37451 generated from alias or forward files with the same router again. For
37452 example, if an alias file translates real names into login ids there is no
37453 point searching the alias file a second time, especially if it is a large file.
37454 </para>
37455 <para>
37456 The <option>redirect_router</option> option can be set to the name of any router instance.
37457 It causes the routing of any generated addresses to start at the named router
37458 instead of at the first router. This option has no effect if the router in
37459 which it is set does not generate new addresses.
37460 </para>
37461 <para>
37462 <indexterm role="option">
37463 <primary><option>require_files</option></primary>
37464 </indexterm>
37465 </para>
37466 <informaltable frame="all">
37467 <tgroup cols="4" colsep="0" rowsep="0">
37468 <colspec colwidth="8*" align="left"/>
37469 <colspec colwidth="6*" align="center"/>
37470 <colspec colwidth="6*" align="center"/>
37471 <colspec colwidth="6*" align="right"/>
37472 <tbody>
37473 <row>
37474 <entry><option>require_files</option></entry>
37475 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37476 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
37477 <entry>Default: <emphasis>unset</emphasis></entry>
37478 </row>
37479 </tbody>
37480 </tgroup>
37481 </informaltable>
37482 <para>
37483 <indexterm role="concept">
37484 <primary>file</primary>
37485 <secondary>requiring for router</secondary>
37486 </indexterm>
37487 <indexterm role="concept">
37488 <primary>router</primary>
37489 <secondary>requiring file existence</secondary>
37490 </indexterm>
37491 This option provides a general mechanism for predicating the running of a
37492 router on the existence or non-existence of certain files or directories.
37493 Before running a router, as one of its precondition tests, Exim works its way
37494 through the <option>require_files</option> list, expanding each item separately.
37495 </para>
37496 <para>
37497 Because the list is split before expansion, any colons in expansion items must
37498 be doubled, or the facility for using a different list separator must be used
37499 (<xref linkend="SECTlistsepchange"/>).
37500 If any expansion is forced to fail, the item is ignored. Other expansion
37501 failures cause routing of the address to be deferred.
37502 </para>
37503 <para>
37504 If any expanded string is empty, it is ignored. Otherwise, except as described
37505 below, each string must be a fully qualified file path, optionally preceded by
37506 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
37507 existence of the files or directories. The router is skipped if any paths not
37508 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
37509 </para>
37510 <para>
37511 <indexterm role="concept">
37512 <primary>NFS</primary>
37513 </indexterm>
37514 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
37515 the message is deferred. This can happen when NFS-mounted filesystems are
37516 unavailable.
37517 </para>
37518 <para>
37519 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
37520 options, so you cannot use it to check for the existence of a file in which to
37521 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
37522 full list of the order in which preconditions are evaluated.) However, as
37523 these options are all expanded, you can use the <option>exists</option> expansion condition
37524 to make such tests. The <option>require_files</option> option is intended for checking files
37525 that the router may be going to use internally, or which are needed by a
37526 transport (e.g., <filename>.procmailrc</filename>).
37527 </para>
37528 <para>
37529 During delivery, the <function>stat()</function> function is run as root, but there is a
37530 facility for some checking of the accessibility of a file by another user.
37531 This is not a proper permissions check, but just a <quote>rough</quote> check that
37532 operates as follows:
37533 </para>
37534 <para>
37535 If an item in a <option>require_files</option> list does not contain any forward slash
37536 characters, it is taken to be the user (and optional group, separated by a
37537 comma) to be checked for subsequent files in the list. If no group is specified
37538 but the user is specified symbolically, the gid associated with the uid is
37539 used. For example:
37540 </para>
37541 <literallayout class="monospaced">
37542 require_files = mail:/some/file
37543 require_files = $local_part_data:$home/.procmailrc
37544 </literallayout>
37545 <para>
37546 If a user or group name in a <option>require_files</option> list does not exist, the
37547 <option>require_files</option> condition fails.
37548 </para>
37549 <para>
37550 Exim performs the check by scanning along the components of the file path, and
37551 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
37552 directories, and <quote>r</quote> access on the final file. Note that this means that file
37553 access control lists, if the operating system has them, are ignored.
37554 </para>
37555 <para>
37556 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
37557 incoming SMTP message, Exim is not running as root, but under its own uid. This
37558 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
37559 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
37560 user is not permitted to read one of the directories on the file&#x2019;s path.
37561 </para>
37562 <para>
37563 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
37564 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
37565 without root access. In this case, if a check for access by a particular user
37566 is requested, Exim creates a subprocess that runs as that user, and tries the
37567 check again in that process.
37568 </para>
37569 <para>
37570 The default action for handling an unresolved EACCES is to consider it to
37571 be caused by a configuration error, and routing is deferred because the
37572 existence or non-existence of the file cannot be determined. However, in some
37573 circumstances it may be desirable to treat this condition as if the file did
37574 not exist. If the filename (or the exclamation mark that precedes the filename
37575 for non-existence) is preceded by a plus sign, the EACCES error is treated
37576 as if the file did not exist. For example:
37577 </para>
37578 <literallayout class="monospaced">
37579 require_files = +/some/file
37580 </literallayout>
37581 <para>
37582 If the router is not an essential part of verification (for example, it
37583 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
37584 option false so that the router is skipped when verifying.
37585 </para>
37586 <para>
37587 <indexterm role="option">
37588 <primary><option>retry_use_local_part</option></primary>
37589 </indexterm>
37590 </para>
37591 <informaltable frame="all">
37592 <tgroup cols="4" colsep="0" rowsep="0">
37593 <colspec colwidth="8*" align="left"/>
37594 <colspec colwidth="6*" align="center"/>
37595 <colspec colwidth="6*" align="center"/>
37596 <colspec colwidth="6*" align="right"/>
37597 <tbody>
37598 <row>
37599 <entry><option>retry_use_local_part</option></entry>
37600 <entry>Use: <emphasis>routers</emphasis></entry>
37601 <entry>Type: <emphasis>boolean</emphasis></entry>
37602 <entry>Default: <emphasis>see below</emphasis></entry>
37603 </row>
37604 </tbody>
37605 </tgroup>
37606 </informaltable>
37607 <para>
37608 <indexterm role="concept">
37609 <primary>hints database</primary>
37610 <secondary>retry keys</secondary>
37611 </indexterm>
37612 <indexterm role="concept">
37613 <primary>local part</primary>
37614 <secondary>in retry keys</secondary>
37615 </indexterm>
37616 When a delivery suffers a temporary routing failure, a retry record is created
37617 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
37618 domain, the key for the retry record should not involve the local part, but for
37619 other addresses, both the domain and the local part should be included.
37620 Usually, remote routing is of the former kind, and local routing is of the
37621 latter kind.
37622 </para>
37623 <para>
37624 This option controls whether the local part is used to form the key for retry
37625 hints for addresses that suffer temporary errors while being handled by this
37626 router. The default value is true for any router that has any of
37627 <option>check_local_user</option>,
37628 <option>local_parts</option>,
37629 <option>condition</option>,
37630 <option>local_part_prefix</option>,
37631 <option>local_part_suffix</option>,
37632 <option>senders</option> or
37633 <option>require_files</option>
37634 set, and false otherwise. Note that this option does not apply to hints keys
37635 for transport delays; they are controlled by a generic transport option of the
37636 same name.
37637 </para>
37638 <para>
37639 Failing to set this option when it is needed
37640 (because a remote router handles only some of the local-parts for a domain)
37641 can result in incorrect error messages being generated.
37642 </para>
37643 <para>
37644 The setting of <option>retry_use_local_part</option> applies only to the router on which it
37645 appears. If the router generates child addresses, they are routed
37646 independently; this setting does not become attached to them.
37647 </para>
37648 <para>
37649 <indexterm role="option">
37650 <primary><option>router_home_directory</option></primary>
37651 </indexterm>
37652 </para>
37653 <informaltable frame="all">
37654 <tgroup cols="4" colsep="0" rowsep="0">
37655 <colspec colwidth="8*" align="left"/>
37656 <colspec colwidth="6*" align="center"/>
37657 <colspec colwidth="6*" align="center"/>
37658 <colspec colwidth="6*" align="right"/>
37659 <tbody>
37660 <row>
37661 <entry><option>router_home_directory</option></entry>
37662 <entry>Use: <emphasis>routers</emphasis></entry>
37663 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37664 <entry>Default: <emphasis>unset</emphasis></entry>
37665 </row>
37666 </tbody>
37667 </tgroup>
37668 </informaltable>
37669 <para>
37670 <indexterm role="concept">
37671 <primary>router</primary>
37672 <secondary>home directory for</secondary>
37673 </indexterm>
37674 <indexterm role="concept">
37675 <primary>home directory</primary>
37676 <secondary>for router</secondary>
37677 </indexterm>
37678 <indexterm role="variable">
37679 <primary><varname>$home</varname></primary>
37680 </indexterm>
37681 This option sets a home directory for use while the router is running. (Compare
37682 <option>transport_home_directory</option>, which sets a home directory for later
37683 transporting.) In particular, if used on a <command>redirect</command> router, this option
37684 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
37685 forced expansion failure causes the option to be ignored &ndash; other failures
37686 cause the router to defer.
37687 </para>
37688 <para>
37689 Expansion of <option>router_home_directory</option> happens immediately after the
37690 <option>check_local_user</option> test (if configured), before any further expansions take
37691 place.
37692 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37693 are evaluated.)
37694 While the router is running, <option>router_home_directory</option> overrides the value of
37695 <varname>$home</varname> that came from <option>check_local_user</option>.
37696 </para>
37697 <para>
37698 When a router accepts an address and assigns it to a local transport (including
37699 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
37700 delivery), the home directory setting for the transport is taken from the first
37701 of these values that is set:
37702 </para>
37703 <itemizedlist>
37704 <listitem>
37705 <para>
37706 The <option>home_directory</option> option on the transport;
37707 </para>
37708 </listitem>
37709 <listitem>
37710 <para>
37711 The <option>transport_home_directory</option> option on the router;
37712 </para>
37713 </listitem>
37714 <listitem>
37715 <para>
37716 The password data if <option>check_local_user</option> is set on the router;
37717 </para>
37718 </listitem>
37719 <listitem>
37720 <para>
37721 The <option>router_home_directory</option> option on the router.
37722 </para>
37723 </listitem>
37724 </itemizedlist>
37725 <para>
37726 In other words, <option>router_home_directory</option> overrides the password data for the
37727 router, but not for the transport.
37728 </para>
37729 <para>
37730 <indexterm role="option">
37731 <primary><option>self</option></primary>
37732 </indexterm>
37733 </para>
37734 <informaltable frame="all">
37735 <tgroup cols="4" colsep="0" rowsep="0">
37736 <colspec colwidth="8*" align="left"/>
37737 <colspec colwidth="6*" align="center"/>
37738 <colspec colwidth="6*" align="center"/>
37739 <colspec colwidth="6*" align="right"/>
37740 <tbody>
37741 <row>
37742 <entry><option>self</option></entry>
37743 <entry>Use: <emphasis>routers</emphasis></entry>
37744 <entry>Type: <emphasis>string</emphasis></entry>
37745 <entry>Default: <emphasis>freeze</emphasis></entry>
37746 </row>
37747 </tbody>
37748 </tgroup>
37749 </informaltable>
37750 <para>
37751 <indexterm role="concept">
37752 <primary>MX record</primary>
37753 <secondary>pointing to local host</secondary>
37754 </indexterm>
37755 <indexterm role="concept">
37756 <primary>local host</primary>
37757 <secondary>MX pointing to</secondary>
37758 </indexterm>
37759 This option applies to those routers that use a recipient address to find a
37760 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
37761 and <command>manualroute</command> routers.
37762 Certain configurations of the <command>queryprogram</command> router can also specify a list
37763 of remote hosts.
37764 Usually such routers are configured to send the message to a remote host via an
37765 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
37766 host on the list turns out to be the local host.
37767 The way in which Exim checks for the local host is described in section
37768 <xref linkend="SECTreclocipadd"/>.
37769 </para>
37770 <para>
37771 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
37772 example, the router should be configured not to process this domain), or an
37773 error in the DNS (for example, the MX should not point to this host). For this
37774 reason, the default action is to log the incident, defer the address, and
37775 freeze the message. The following alternatives are provided for use in special
37776 cases:
37777 </para>
37778 <variablelist>
37779 <varlistentry>
37780 <term><option>defer</option></term>
37781 <listitem>
37782 <para>
37783 Delivery of the message is tried again later, but the message is not frozen.
37784 </para>
37785 </listitem></varlistentry>
37786 <varlistentry>
37787 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
37788 <listitem>
37789 <para>
37790 The domain is changed to the given domain, and the address is passed back to
37791 be reprocessed by the routers. No rewriting of headers takes place. This
37792 behaviour is essentially a redirection.
37793 </para>
37794 </listitem></varlistentry>
37795 <varlistentry>
37796 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
37797 <listitem>
37798 <para>
37799 The domain is changed to the given domain, and the address is passed back to be
37800 reprocessed by the routers. Any headers that contain the original domain are
37801 rewritten.
37802 </para>
37803 </listitem></varlistentry>
37804 <varlistentry>
37805 <term><option>pass</option></term>
37806 <listitem>
37807 <para>
37808 <indexterm role="option">
37809 <primary><option>more</option></primary>
37810 </indexterm>
37811 <indexterm role="variable">
37812 <primary><varname>$self_hostname</varname></primary>
37813 </indexterm>
37814 The router passes the address to the next router, or to the router named in the
37815 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
37816 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
37817 name of the local host that the router encountered. This can be used to
37818 distinguish between different cases for hosts with multiple names. The
37819 combination
37820 </para>
37821 <literallayout class="monospaced">
37822 self = pass
37823 no_more
37824 </literallayout>
37825 <para>
37826 ensures that only those addresses that routed to the local host are passed on.
37827 Without <option>no_more</option>, addresses that were declined for other reasons would also
37828 be passed to the next router.
37829 </para>
37830 </listitem></varlistentry>
37831 <varlistentry>
37832 <term><option>fail</option></term>
37833 <listitem>
37834 <para>
37835 Delivery fails and an error report is generated.
37836 </para>
37837 </listitem></varlistentry>
37838 <varlistentry>
37839 <term><option>send</option></term>
37840 <listitem>
37841 <para>
37842 <indexterm role="concept">
37843 <primary>local host</primary>
37844 <secondary>sending to</secondary>
37845 </indexterm>
37846 The anomaly is ignored and the address is queued for the transport. This
37847 setting should be used with extreme caution. For an <command>smtp</command> transport, it
37848 makes sense only in cases where the program that is listening on the SMTP port
37849 is not this version of Exim. That is, it must be some other MTA, or Exim with a
37850 different configuration file that handles the domain in another way.
37851 </para>
37852 </listitem></varlistentry>
37853 </variablelist>
37854 <para>
37855 <indexterm role="option">
37856 <primary><option>senders</option></primary>
37857 </indexterm>
37858 </para>
37859 <informaltable frame="all">
37860 <tgroup cols="4" colsep="0" rowsep="0">
37861 <colspec colwidth="8*" align="left"/>
37862 <colspec colwidth="6*" align="center"/>
37863 <colspec colwidth="6*" align="center"/>
37864 <colspec colwidth="6*" align="right"/>
37865 <tbody>
37866 <row>
37867 <entry><option>senders</option></entry>
37868 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37869 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
37870 <entry>Default: <emphasis>unset</emphasis></entry>
37871 </row>
37872 </tbody>
37873 </tgroup>
37874 </informaltable>
37875 <para>
37876 <indexterm role="concept">
37877 <primary>router</primary>
37878 <secondary>checking senders</secondary>
37879 </indexterm>
37880 If this option is set, the router is skipped unless the message&#x2019;s sender
37881 address matches something on the list.
37882 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37883 are evaluated.
37884 </para>
37885 <para>
37886 There are issues concerning verification when the running of routers is
37887 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
37888 setting, it sets the sender to the null string. When using the <option>-bt</option> option
37889 to check a configuration file, it is necessary also to use the <option>-f</option> option to
37890 set an appropriate sender. For incoming mail, the sender is unset when
37891 verifying the sender, but is available when verifying any recipients. If the
37892 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
37893 matters.
37894 </para>
37895 <para>
37896 <indexterm role="option">
37897 <primary><option>set</option></primary>
37898 </indexterm>
37899 </para>
37900 <informaltable frame="all">
37901 <tgroup cols="4" colsep="0" rowsep="0">
37902 <colspec colwidth="8*" align="left"/>
37903 <colspec colwidth="6*" align="center"/>
37904 <colspec colwidth="6*" align="center"/>
37905 <colspec colwidth="6*" align="right"/>
37906 <tbody>
37907 <row>
37908 <entry><option>set</option></entry>
37909 <entry>Use: <emphasis>routers</emphasis></entry>
37910 <entry>Type: <emphasis>string list</emphasis></entry>
37911 <entry>Default: <emphasis>unset</emphasis></entry>
37912 </row>
37913 </tbody>
37914 </tgroup>
37915 </informaltable>
37916 <para>
37917 <indexterm role="concept">
37918 <primary>router</primary>
37919 <secondary>variables</secondary>
37920 </indexterm>
37921 This option may be used multiple times on a router;
37922 because of this the list aspect is mostly irrelevant.
37923 The list separator is a semicolon but can be changed in the
37924 usual way.
37925 </para>
37926 <para>
37927 Each list-element given must be of the form <quote>name = value</quote>
37928 and the names used must start with the string <quote>r_</quote>.
37929 Values containing a list-separator should have them doubled.
37930 When a router runs, the strings are evaluated in order,
37931 to create variables which are added to the set associated with
37932 the address.
37933 This is done immediately after all the preconditions, before the
37934 evaluation of the <option>address_data</option> option.
37935 The variable is set with the expansion of the value.
37936 The variables can be used by the router options
37937 (not including any preconditions)
37938 and by the transport.
37939 Later definitions of a given named variable will override former ones.
37940 Variable use is via the usual <varname>$r_...</varname> syntax.
37941 </para>
37942 <para>
37943 This is similar to the <option>address_data</option> option, except that
37944 many independent variables can be used, with choice of naming.
37945 </para>
37946 <para>
37947 <indexterm role="option">
37948 <primary><option>translate_ip_address</option></primary>
37949 </indexterm>
37950 </para>
37951 <informaltable frame="all">
37952 <tgroup cols="4" colsep="0" rowsep="0">
37953 <colspec colwidth="8*" align="left"/>
37954 <colspec colwidth="6*" align="center"/>
37955 <colspec colwidth="6*" align="center"/>
37956 <colspec colwidth="6*" align="right"/>
37957 <tbody>
37958 <row>
37959 <entry><option>translate_ip_address</option></entry>
37960 <entry>Use: <emphasis>routers</emphasis></entry>
37961 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37962 <entry>Default: <emphasis>unset</emphasis></entry>
37963 </row>
37964 </tbody>
37965 </tgroup>
37966 </informaltable>
37967 <para>
37968 <indexterm role="concept">
37969 <primary>IP address</primary>
37970 <secondary>translating</secondary>
37971 </indexterm>
37972 <indexterm role="concept">
37973 <primary>packet radio</primary>
37974 </indexterm>
37975 <indexterm role="concept">
37976 <primary>router</primary>
37977 <secondary>IP address translation</secondary>
37978 </indexterm>
37979 There exist some rare networking situations (for example, packet radio) where
37980 it is helpful to be able to translate IP addresses generated by normal routing
37981 mechanisms into other IP addresses, thus performing a kind of manual IP
37982 routing. This should be done only if the normal IP routing of the TCP/IP stack
37983 is inadequate or broken. Because this is an extremely uncommon requirement, the
37984 code to support this option is not included in the Exim binary unless
37985 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
37986 </para>
37987 <para>
37988 <indexterm role="variable">
37989 <primary><varname>$host_address</varname></primary>
37990 </indexterm>
37991 The <option>translate_ip_address</option> string is expanded for every IP address generated
37992 by the router, with the generated address set in <varname>$host_address</varname>. If the
37993 expansion is forced to fail, no action is taken.
37994 For any other expansion error, delivery of the message is deferred.
37995 If the result of the expansion is an IP address, that replaces the original
37996 address; otherwise the result is assumed to be a host name &ndash; this is looked
37997 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
37998 produce one or more replacement IP addresses. For example, to subvert all IP
37999 addresses in some specific networks, this could be added to a router:
38000 </para>
38001 <literallayout class="monospaced">
38002 translate_ip_address = \
38003   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
38004     {$value}fail}}
38005 </literallayout>
38006 <para>
38007 The file would contain lines like
38008 </para>
38009 <literallayout class="monospaced">
38010 10.2.3.128/26    some.host
38011 10.8.4.34/26     10.44.8.15
38012 </literallayout>
38013 <para>
38014 You should not make use of this facility unless you really understand what you
38015 are doing.
38016 </para>
38017 <para>
38018 <indexterm role="option">
38019 <primary><option>transport</option></primary>
38020 </indexterm>
38021 </para>
38022 <informaltable frame="all">
38023 <tgroup cols="4" colsep="0" rowsep="0">
38024 <colspec colwidth="8*" align="left"/>
38025 <colspec colwidth="6*" align="center"/>
38026 <colspec colwidth="6*" align="center"/>
38027 <colspec colwidth="6*" align="right"/>
38028 <tbody>
38029 <row>
38030 <entry><option>transport</option></entry>
38031 <entry>Use: <emphasis>routers</emphasis></entry>
38032 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38033 <entry>Default: <emphasis>unset</emphasis></entry>
38034 </row>
38035 </tbody>
38036 </tgroup>
38037 </informaltable>
38038 <para>
38039 This option specifies the transport to be used when a router accepts an address
38040 and sets it up for delivery. A transport is never needed if a router is used
38041 only for verification. The value of the option is expanded at routing time,
38042 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
38043 and result must be the name of one of the configured transports. If it is not,
38044 delivery is deferred.
38045 </para>
38046 <para>
38047 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
38048 have some private options that set up transports for pipe and file deliveries
38049 (see chapter <xref linkend="CHAPredirect"/>).
38050 </para>
38051 <para>
38052 <indexterm role="option">
38053 <primary><option>transport_current_directory</option></primary>
38054 </indexterm>
38055 </para>
38056 <informaltable frame="all">
38057 <tgroup cols="4" colsep="0" rowsep="0">
38058 <colspec colwidth="8*" align="left"/>
38059 <colspec colwidth="6*" align="center"/>
38060 <colspec colwidth="6*" align="center"/>
38061 <colspec colwidth="6*" align="right"/>
38062 <tbody>
38063 <row>
38064 <entry><option>transport_current_directory</option></entry>
38065 <entry>Use: <emphasis>routers</emphasis></entry>
38066 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38067 <entry>Default: <emphasis>unset</emphasis></entry>
38068 </row>
38069 </tbody>
38070 </tgroup>
38071 </informaltable>
38072 <para>
38073 <indexterm role="concept">
38074 <primary>current directory for local transport</primary>
38075 </indexterm>
38076 This option associates a current directory with any address that is routed
38077 to a local transport. This can happen either because a transport is
38078 explicitly configured for the router, or because it generates a delivery to a
38079 file or a pipe. During the delivery process (that is, at transport time), this
38080 option string is expanded and is set as the current directory, unless
38081 overridden by a setting on the transport.
38082 If the expansion fails for any reason, including forced failure, an error is
38083 logged, and delivery is deferred.
38084 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
38085 environment.
38086 </para>
38087 <para>
38088 <indexterm role="option">
38089 <primary><option>transport_home_directory</option></primary>
38090 </indexterm>
38091 </para>
38092 <informaltable frame="all">
38093 <tgroup cols="4" colsep="0" rowsep="0">
38094 <colspec colwidth="8*" align="left"/>
38095 <colspec colwidth="6*" align="center"/>
38096 <colspec colwidth="6*" align="center"/>
38097 <colspec colwidth="6*" align="right"/>
38098 <tbody>
38099 <row>
38100 <entry><option>transport_home_directory</option></entry>
38101 <entry>Use: <emphasis>routers</emphasis></entry>
38102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38103 <entry>Default: <emphasis>see below</emphasis></entry>
38104 </row>
38105 </tbody>
38106 </tgroup>
38107 </informaltable>
38108 <para>
38109 <indexterm role="concept">
38110 <primary>home directory</primary>
38111 <secondary>for local transport</secondary>
38112 </indexterm>
38113 This option associates a home directory with any address that is routed to a
38114 local transport. This can happen either because a transport is explicitly
38115 configured for the router, or because it generates a delivery to a file or a
38116 pipe. During the delivery process (that is, at transport time), the option
38117 string is expanded and is set as the home directory, unless overridden by a
38118 setting of <option>home_directory</option> on the transport.
38119 If the expansion fails for any reason, including forced failure, an error is
38120 logged, and delivery is deferred.
38121 </para>
38122 <para>
38123 If the transport does not specify a home directory, and
38124 <option>transport_home_directory</option> is not set for the router, the home directory for
38125 the transport is taken from the password data if <option>check_local_user</option> is set for
38126 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
38127 is set; if not, no home directory is set for the transport.
38128 </para>
38129 <para>
38130 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
38131 environment.
38132 </para>
38133 <para>
38134 <indexterm role="option">
38135 <primary><option>unseen</option></primary>
38136 </indexterm>
38137 </para>
38138 <informaltable frame="all">
38139 <tgroup cols="4" colsep="0" rowsep="0">
38140 <colspec colwidth="8*" align="left"/>
38141 <colspec colwidth="6*" align="center"/>
38142 <colspec colwidth="6*" align="center"/>
38143 <colspec colwidth="6*" align="right"/>
38144 <tbody>
38145 <row>
38146 <entry><option>unseen</option></entry>
38147 <entry>Use: <emphasis>routers</emphasis></entry>
38148 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
38149 <entry>Default: <emphasis>false</emphasis></entry>
38150 </row>
38151 </tbody>
38152 </tgroup>
38153 </informaltable>
38154 <para>
38155 <indexterm role="concept">
38156 <primary>router</primary>
38157 <secondary>carrying on after success</secondary>
38158 </indexterm>
38159 The result of string expansion for this option must be a valid boolean value,
38160 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
38161 result causes an error, and delivery is deferred. If the expansion is forced to
38162 fail, the default value for the option (false) is used. Other failures cause
38163 delivery to be deferred.
38164 </para>
38165 <para>
38166 When this option is set true, routing does not cease if the router accepts the
38167 address. Instead, a copy of the incoming address is passed to the next router,
38168 overriding a false setting of <option>more</option>. There is little point in setting
38169 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
38170 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
38171 sometimes true and sometimes false).
38172 </para>
38173 <para>
38174 <indexterm role="concept">
38175 <primary>copy of message (<option>unseen</option> option)</primary>
38176 </indexterm>
38177 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
38178 qualifier in filter files. It can be used to cause copies of messages to be
38179 delivered to some other destination, while also carrying out a normal delivery.
38180 In effect, the current address is made into a <quote>parent</quote> that has two children
38181 &ndash; one that is delivered as specified by this router, and a clone that goes on
38182 to be routed further. For this reason, <option>unseen</option> may not be combined with the
38183 <option>one_time</option> option in a <command>redirect</command> router.
38184 </para>
38185 <para>
38186 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
38187 this router or by previous routers affect the <quote>unseen</quote> copy of the message
38188 only. The clone that continues to be processed by further routers starts with
38189 no added headers and none specified for removal. For a <option>redirect</option> router, if
38190 a generated address is the same as the incoming address, this can lead to
38191 duplicate addresses with different header modifications. Exim does not do
38192 duplicate deliveries (except, in certain circumstances, to pipes -- see section
38193 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
38194 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
38195 <option>redirect</option> router may be of help.
38196 </para>
38197 <para>
38198 Unlike the handling of header modifications, any data that was set by the
38199 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
38200 subsequent routers.
38201 </para>
38202 <para>
38203 <indexterm role="option">
38204 <primary><option>user</option></primary>
38205 </indexterm>
38206 </para>
38207 <informaltable frame="all">
38208 <tgroup cols="4" colsep="0" rowsep="0">
38209 <colspec colwidth="8*" align="left"/>
38210 <colspec colwidth="6*" align="center"/>
38211 <colspec colwidth="6*" align="center"/>
38212 <colspec colwidth="6*" align="right"/>
38213 <tbody>
38214 <row>
38215 <entry><option>user</option></entry>
38216 <entry>Use: <emphasis>routers</emphasis></entry>
38217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38218 <entry>Default: <emphasis>see below</emphasis></entry>
38219 </row>
38220 </tbody>
38221 </tgroup>
38222 </informaltable>
38223 <para>
38224 <indexterm role="concept">
38225 <primary>uid (user id)</primary>
38226 <secondary>local delivery</secondary>
38227 </indexterm>
38228 <indexterm role="concept">
38229 <primary>local transports</primary>
38230 <secondary>uid and gid</secondary>
38231 </indexterm>
38232 <indexterm role="concept">
38233 <primary>transport</primary>
38234 <secondary>local</secondary>
38235 </indexterm>
38236 <indexterm role="concept">
38237 <primary>router</primary>
38238 <secondary>user for filter processing</secondary>
38239 </indexterm>
38240 <indexterm role="concept">
38241 <primary>filter</primary>
38242 <secondary>user for processing</secondary>
38243 </indexterm>
38244 When a router queues an address for a transport, and the transport does not
38245 specify a user, the user given here is used when running the delivery process.
38246 The user may be specified numerically or by name. If expansion fails, the
38247 error is logged and delivery is deferred.
38248 This user is also used by the <command>redirect</command> router when running a filter file.
38249 The default is unset, except when <option>check_local_user</option> is set. In this case,
38250 the default is taken from the password information. If the user is specified as
38251 a name, and <option>group</option> is not set, the group associated with the user is used.
38252 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
38253 <xref linkend="CHAPenvironment"/>.
38254 </para>
38255 <para>
38256 <indexterm role="option">
38257 <primary><option>verify</option></primary>
38258 </indexterm>
38259 </para>
38260 <informaltable frame="all">
38261 <tgroup cols="4" colsep="0" rowsep="0">
38262 <colspec colwidth="8*" align="left"/>
38263 <colspec colwidth="6*" align="center"/>
38264 <colspec colwidth="6*" align="center"/>
38265 <colspec colwidth="6*" align="right"/>
38266 <tbody>
38267 <row>
38268 <entry><option>verify</option></entry>
38269 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38270 <entry>Type: <emphasis>boolean</emphasis></entry>
38271 <entry>Default: <emphasis>true</emphasis></entry>
38272 </row>
38273 </tbody>
38274 </tgroup>
38275 </informaltable>
38276 <para>
38277 Setting this option has the effect of setting <option>verify_sender</option> and
38278 <option>verify_recipient</option> to the same value.
38279 </para>
38280 <para>
38281 <indexterm role="option">
38282 <primary><option>verify_only</option></primary>
38283 </indexterm>
38284 </para>
38285 <informaltable frame="all">
38286 <tgroup cols="4" colsep="0" rowsep="0">
38287 <colspec colwidth="8*" align="left"/>
38288 <colspec colwidth="6*" align="center"/>
38289 <colspec colwidth="6*" align="center"/>
38290 <colspec colwidth="6*" align="right"/>
38291 <tbody>
38292 <row>
38293 <entry><option>verify_only</option></entry>
38294 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38295 <entry>Type: <emphasis>boolean</emphasis></entry>
38296 <entry>Default: <emphasis>false</emphasis></entry>
38297 </row>
38298 </tbody>
38299 </tgroup>
38300 </informaltable>
38301 <para>
38302 <indexterm role="concept">
38303 <primary>EXPN</primary>
38304 <secondary>with <option>verify_only</option></secondary>
38305 </indexterm>
38306 <indexterm role="option">
38307 <primary><option>-bv</option></primary>
38308 </indexterm>
38309 <indexterm role="concept">
38310 <primary>router</primary>
38311 <secondary>used only when verifying</secondary>
38312 </indexterm>
38313 If this option is set, the router is used only when verifying an address,
38314 delivering in cutthrough mode or
38315 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
38316 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
38317 restricted to verifying only senders or recipients by means of
38318 <option>verify_sender</option> and <option>verify_recipient</option>.
38319 </para>
38320 <para>
38321 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
38322 SMTP message, Exim is not running as root, but under its own uid. If the router
38323 accesses any files, you need to make sure that they are accessible to the Exim
38324 user or group.
38325 </para>
38326 <para>
38327 <indexterm role="option">
38328 <primary><option>verify_recipient</option></primary>
38329 </indexterm>
38330 </para>
38331 <informaltable frame="all">
38332 <tgroup cols="4" colsep="0" rowsep="0">
38333 <colspec colwidth="8*" align="left"/>
38334 <colspec colwidth="6*" align="center"/>
38335 <colspec colwidth="6*" align="center"/>
38336 <colspec colwidth="6*" align="right"/>
38337 <tbody>
38338 <row>
38339 <entry><option>verify_recipient</option></entry>
38340 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38341 <entry>Type: <emphasis>boolean</emphasis></entry>
38342 <entry>Default: <emphasis>true</emphasis></entry>
38343 </row>
38344 </tbody>
38345 </tgroup>
38346 </informaltable>
38347 <para>
38348 If this option is false, the router is skipped when verifying recipient
38349 addresses,
38350 delivering in cutthrough mode
38351 or testing recipient verification using <option>-bv</option>.
38352 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
38353 are evaluated.
38354 See also the <varname>$verify_mode</varname> variable.
38355 </para>
38356 <para>
38357 <indexterm role="option">
38358 <primary><option>verify_sender</option></primary>
38359 </indexterm>
38360 </para>
38361 <informaltable frame="all">
38362 <tgroup cols="4" colsep="0" rowsep="0">
38363 <colspec colwidth="8*" align="left"/>
38364 <colspec colwidth="6*" align="center"/>
38365 <colspec colwidth="6*" align="center"/>
38366 <colspec colwidth="6*" align="right"/>
38367 <tbody>
38368 <row>
38369 <entry><option>verify_sender</option></entry>
38370 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38371 <entry>Type: <emphasis>boolean</emphasis></entry>
38372 <entry>Default: <emphasis>true</emphasis></entry>
38373 </row>
38374 </tbody>
38375 </tgroup>
38376 </informaltable>
38377 <para>
38378 If this option is false, the router is skipped when verifying sender addresses
38379 or testing sender verification using <option>-bvs</option>.
38380 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
38381 are evaluated.
38382 See also the <varname>$verify_mode</varname> variable.
38383 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
38384 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
38385 </para>
38386 </chapter>
38387
38388 <chapter id="CHID4">
38389 <title>The accept router</title>
38390 <para>
38391 <indexterm role="concept">
38392 <primary><command>accept</command> router</primary>
38393 </indexterm>
38394 <indexterm role="concept">
38395 <primary>routers</primary>
38396 <secondary><command>accept</command></secondary>
38397 </indexterm>
38398 The <command>accept</command> router has no private options of its own. Unless it is being
38399 used purely for verification (see <option>verify_only</option>) a transport is required to
38400 be defined by the generic <option>transport</option> option. If the preconditions that are
38401 specified by generic options are met, the router accepts the address and queues
38402 it for the given transport. The most common use of this router is for setting
38403 up deliveries to local mailboxes. For example:
38404 </para>
38405 <literallayout class="monospaced">
38406 localusers:
38407   driver = accept
38408   domains = mydomain.example
38409   check_local_user
38410   transport = local_delivery
38411 </literallayout>
38412 <para>
38413 The <option>domains</option> condition in this example checks the domain of the address, and
38414 <option>check_local_user</option> checks that the local part is the login of a local user.
38415 When both preconditions are met, the <command>accept</command> router runs, and queues the
38416 address for the <command>local_delivery</command> transport.
38417 </para>
38418 </chapter>
38419
38420 <chapter id="CHAPdnslookup">
38421 <title>The dnslookup router</title>
38422 <para>
38423 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
38424 <primary><command>dnslookup</command> router</primary>
38425 </indexterm>
38426 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
38427 <primary>routers</primary>
38428 <secondary><command>dnslookup</command></secondary>
38429 </indexterm>
38430 The <command>dnslookup</command> router looks up the hosts that handle mail for the
38431 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
38432 unless <option>verify_only</option> is set.
38433 </para>
38434 <para>
38435 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
38436 SRV records. If none are found, or if SRV support is not configured,
38437 MX records are looked up. If no MX records exist, address records are sought.
38438 However, <option>mx_domains</option> can be set to disable the direct use of address
38439 records.
38440 </para>
38441 <para>
38442 MX records of equal priority are sorted by Exim into a random order. Exim then
38443 looks for address records for the host names obtained from MX or SRV records.
38444 When a host has more than one IP address, they are sorted into a random order,
38445 except that IPv6 addresses are sorted before IPv4 addresses. If all the
38446 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
38447 generic option, the router declines.
38448 </para>
38449 <para>
38450 Unless they have the highest priority (lowest MX value), MX records that point
38451 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
38452 are discarded, together with any other MX records of equal or lower priority.
38453 </para>
38454 <para>
38455 <indexterm role="concept">
38456 <primary>MX record</primary>
38457 <secondary>pointing to local host</secondary>
38458 </indexterm>
38459 <indexterm role="concept">
38460 <primary>local host</primary>
38461 <secondary>MX pointing to</secondary>
38462 </indexterm>
38463 <indexterm role="option">
38464 <primary><option>self</option></primary>
38465 <secondary>in <command>dnslookup</command> router</secondary>
38466 </indexterm>
38467 If the host pointed to by the highest priority MX record, or looked up as an
38468 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
38469 happens is controlled by the generic <option>self</option> option.
38470 </para>
38471 <section id="SECTprowitdnsloo">
38472 <title>Problems with DNS lookups</title>
38473 <para>
38474 There have been problems with DNS servers when SRV records are looked up.
38475 Some misbehaving servers return a DNS error or timeout when a non-existent
38476 SRV record is sought. Similar problems have in the past been reported for
38477 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
38478 problem, but it is heavy-handed because it is a global option.
38479 </para>
38480 <para>
38481 For this reason, there are two options, <option>srv_fail_domains</option> and
38482 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
38483 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
38484 an attempt to look up an SRV or MX record causes one of these results, and the
38485 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
38486 such record</quote>. In the case of an SRV lookup, this means that the router
38487 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
38488 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
38489 case routing fails.
38490 </para>
38491 </section>
38492 <section id="SECTdnslookupdecline">
38493 <title>Declining addresses by dnslookup</title>
38494 <para>
38495 <indexterm role="concept">
38496 <primary><command>dnslookup</command> router</primary>
38497 <secondary>declines</secondary>
38498 </indexterm>
38499 There are a few cases where a <command>dnslookup</command> router will decline to accept
38500 an address; if such a router is expected to handle "all remaining non-local
38501 domains", then it is important to set <option>no_more</option>.
38502 </para>
38503 <para>
38504 The router will defer rather than decline if the domain
38505 is found in the <option>fail_defer_domains</option> router option.
38506 </para>
38507 <para>
38508 Reasons for a <command>dnslookup</command> router to decline currently include:
38509 </para>
38510 <itemizedlist>
38511 <listitem>
38512 <para>
38513 The domain does not exist in DNS
38514 </para>
38515 </listitem>
38516 <listitem>
38517 <para>
38518 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
38519 convention (borrowed from SRV) used to indicate that there is no such service
38520 for this domain and to not fall back to trying A/AAAA records.
38521 </para>
38522 </listitem>
38523 <listitem>
38524 <para>
38525 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
38526 </para>
38527 </listitem>
38528 <listitem>
38529 <para>
38530 MX record points to a non-existent host.
38531 </para>
38532 </listitem>
38533 <listitem>
38534 <para>
38535 MX record points to an IP address and the main section option
38536 <option>allow_mx_to_ip</option> is not set.
38537 </para>
38538 </listitem>
38539 <listitem>
38540 <para>
38541 MX records exist and point to valid hosts, but all hosts resolve only to
38542 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
38543 </para>
38544 </listitem>
38545 <listitem>
38546 <para>
38547 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
38548 <option>dns_check_names_pattern</option> for handling one variant of this)
38549 </para>
38550 </listitem>
38551 <listitem>
38552 <para>
38553 <option>check_secondary_mx</option> is set on this router but the local host can
38554 not be found in the MX records (see below)
38555 </para>
38556 </listitem>
38557 </itemizedlist>
38558 </section>
38559 <section id="SECID118">
38560 <title>Private options for dnslookup</title>
38561 <para>
38562 <indexterm role="concept">
38563 <primary>options</primary>
38564 <secondary><command>dnslookup</command> router</secondary>
38565 </indexterm>
38566 The private options for the <command>dnslookup</command> router are as follows:
38567 </para>
38568 <para>
38569 <indexterm role="option">
38570 <primary><option>check_secondary_mx</option></primary>
38571 </indexterm>
38572 </para>
38573 <informaltable frame="all">
38574 <tgroup cols="4" colsep="0" rowsep="0">
38575 <colspec colwidth="8*" align="left"/>
38576 <colspec colwidth="6*" align="center"/>
38577 <colspec colwidth="6*" align="center"/>
38578 <colspec colwidth="6*" align="right"/>
38579 <tbody>
38580 <row>
38581 <entry><option>check_secondary_mx</option></entry>
38582 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38583 <entry>Type: <emphasis>boolean</emphasis></entry>
38584 <entry>Default: <emphasis>false</emphasis></entry>
38585 </row>
38586 </tbody>
38587 </tgroup>
38588 </informaltable>
38589 <para>
38590 <indexterm role="concept">
38591 <primary>MX record</primary>
38592 <secondary>checking for secondary</secondary>
38593 </indexterm>
38594 If this option is set, the router declines unless the local host is found in
38595 (and removed from) the list of hosts obtained by MX lookup. This can be used to
38596 process domains for which the local host is a secondary mail exchanger
38597 differently to other domains. The way in which Exim decides whether a host is
38598 the local host is described in section <xref linkend="SECTreclocipadd"/>.
38599 </para>
38600 <para>
38601 <indexterm role="option">
38602 <primary><option>check_srv</option></primary>
38603 </indexterm>
38604 </para>
38605 <informaltable frame="all">
38606 <tgroup cols="4" colsep="0" rowsep="0">
38607 <colspec colwidth="8*" align="left"/>
38608 <colspec colwidth="6*" align="center"/>
38609 <colspec colwidth="6*" align="center"/>
38610 <colspec colwidth="6*" align="right"/>
38611 <tbody>
38612 <row>
38613 <entry><option>check_srv</option></entry>
38614 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38615 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38616 <entry>Default: <emphasis>unset</emphasis></entry>
38617 </row>
38618 </tbody>
38619 </tgroup>
38620 </informaltable>
38621 <para>
38622 <indexterm role="concept">
38623 <primary>SRV record</primary>
38624 <secondary>enabling use of</secondary>
38625 </indexterm>
38626 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
38627 addition to MX and address records. The support is disabled by default. To
38628 enable SRV support, set the <option>check_srv</option> option to the name of the service
38629 required. For example,
38630 </para>
38631 <literallayout class="monospaced">
38632 check_srv = smtp
38633 </literallayout>
38634 <para>
38635 looks for SRV records that refer to the normal smtp service. The option is
38636 expanded, so the service name can vary from message to message or address
38637 to address. This might be helpful if SRV records are being used for a
38638 submission service. If the expansion is forced to fail, the <option>check_srv</option>
38639 option is ignored, and the router proceeds to look for MX records in the
38640 normal way.
38641 </para>
38642 <para>
38643 When the expansion succeeds, the router searches first for SRV records for
38644 the given service (it assumes TCP protocol). A single SRV record with a
38645 host name that consists of just a single dot indicates <quote>no such service for
38646 this domain</quote>; if this is encountered, the router declines. If other kinds of
38647 SRV record are found, they are used to construct a host list for delivery
38648 according to the rules of RFC 2782. MX records are not sought in this case.
38649 </para>
38650 <para>
38651 When no SRV records are found, MX records (and address records) are sought in
38652 the traditional way. In other words, SRV records take precedence over MX
38653 records, just as MX records take precedence over address records. Note that
38654 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
38655 defined it. It is apparently believed that MX records are sufficient for email
38656 and that SRV records should not be used for this purpose. However, SRV records
38657 have an additional <quote>weight</quote> feature which some people might find useful when
38658 trying to split an SMTP load between hosts of different power.
38659 </para>
38660 <para>
38661 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
38662 when there is a DNS lookup error.
38663 </para>
38664 <para>
38665 <indexterm role="option">
38666 <primary><option>fail_defer_domains</option></primary>
38667 </indexterm>
38668 </para>
38669 <informaltable frame="all">
38670 <tgroup cols="4" colsep="0" rowsep="0">
38671 <colspec colwidth="8*" align="left"/>
38672 <colspec colwidth="6*" align="center"/>
38673 <colspec colwidth="6*" align="center"/>
38674 <colspec colwidth="6*" align="right"/>
38675 <tbody>
38676 <row>
38677 <entry><option>fail_defer_domains</option></entry>
38678 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38679 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
38680 <entry>Default: <emphasis>unset</emphasis></entry>
38681 </row>
38682 </tbody>
38683 </tgroup>
38684 </informaltable>
38685 <para>
38686 <indexterm role="concept">
38687 <primary>MX record</primary>
38688 <secondary>not found</secondary>
38689 </indexterm>
38690 DNS lookups for domains matching <option>fail_defer_domains</option>
38691 which find no matching record will cause the router to defer
38692 rather than the default behaviour of decline.
38693 This maybe be useful for queueing messages for a newly created
38694 domain while the DNS configuration is not ready.
38695 However, it will result in any message with mistyped domains
38696 also being queued.
38697 </para>
38698 <para>
38699 <indexterm role="option">
38700 <primary><option>ipv4_only</option></primary>
38701 </indexterm>
38702 </para>
38703 <informaltable frame="all">
38704 <tgroup cols="4" colsep="0" rowsep="0">
38705 <colspec colwidth="8*" align="left"/>
38706 <colspec colwidth="6*" align="center"/>
38707 <colspec colwidth="6*" align="center"/>
38708 <colspec colwidth="6*" align="right"/>
38709 <tbody>
38710 <row>
38711 <entry><option>ipv4_only</option></entry>
38712 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38713 <entry>Type: <emphasis>unset</emphasis></entry>
38714 <entry>Default: <emphasis></emphasis></entry>
38715 </row>
38716 </tbody>
38717 </tgroup>
38718 </informaltable>
38719 <para>
38720 <indexterm role="concept">
38721 <primary>IPv6</primary>
38722 <secondary>disabling</secondary>
38723 </indexterm>
38724 <indexterm role="concept">
38725 <primary>DNS</primary>
38726 <secondary>IPv6 disabling</secondary>
38727 </indexterm>
38728 The string is expanded, and if the result is anything but a forced failure,
38729 or an empty string, or one of the strings “0” or “no” or “false”
38730 (checked without regard to the case of the letters),
38731 only A records are used.
38732 </para>
38733 <para>
38734 <indexterm role="option">
38735 <primary><option>ipv4_prefer</option></primary>
38736 </indexterm>
38737 </para>
38738 <informaltable frame="all">
38739 <tgroup cols="4" colsep="0" rowsep="0">
38740 <colspec colwidth="8*" align="left"/>
38741 <colspec colwidth="6*" align="center"/>
38742 <colspec colwidth="6*" align="center"/>
38743 <colspec colwidth="6*" align="right"/>
38744 <tbody>
38745 <row>
38746 <entry><option>ipv4_prefer</option></entry>
38747 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38748 <entry>Type: <emphasis>unset</emphasis></entry>
38749 <entry>Default: <emphasis></emphasis></entry>
38750 </row>
38751 </tbody>
38752 </tgroup>
38753 </informaltable>
38754 <para>
38755 <indexterm role="concept">
38756 <primary>IPv4</primary>
38757 <secondary>preference</secondary>
38758 </indexterm>
38759 <indexterm role="concept">
38760 <primary>DNS</primary>
38761 <secondary>IPv4 preference</secondary>
38762 </indexterm>
38763 The string is expanded, and if the result is anything but a forced failure,
38764 or an empty string, or one of the strings “0” or “no” or “false”
38765 (checked without regard to the case of the letters),
38766 A records are sorted before AAAA records (inverting the default).
38767 </para>
38768 <para>
38769 <indexterm role="option">
38770 <primary><option>mx_domains</option></primary>
38771 </indexterm>
38772 </para>
38773 <informaltable frame="all">
38774 <tgroup cols="4" colsep="0" rowsep="0">
38775 <colspec colwidth="8*" align="left"/>
38776 <colspec colwidth="6*" align="center"/>
38777 <colspec colwidth="6*" align="center"/>
38778 <colspec colwidth="6*" align="right"/>
38779 <tbody>
38780 <row>
38781 <entry><option>mx_domains</option></entry>
38782 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38783 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
38784 <entry>Default: <emphasis>unset</emphasis></entry>
38785 </row>
38786 </tbody>
38787 </tgroup>
38788 </informaltable>
38789 <para>
38790 <indexterm role="concept">
38791 <primary>MX record</primary>
38792 <secondary>required to exist</secondary>
38793 </indexterm>
38794 <indexterm role="concept">
38795 <primary>SRV record</primary>
38796 <secondary>required to exist</secondary>
38797 </indexterm>
38798 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
38799 record in order to be recognized. (The name of this option could be improved.)
38800 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
38801 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
38802 setting:
38803 </para>
38804 <literallayout class="monospaced">
38805 mx_domains = ! *.discworld.fict.example : *.fict.example
38806 </literallayout>
38807 <para>
38808 This specifies that messages addressed to a domain that matches the list but
38809 has no MX record should be bounced immediately instead of being routed using
38810 the address record.
38811 </para>
38812 <para>
38813 <indexterm role="option">
38814 <primary><option>mx_fail_domains</option></primary>
38815 </indexterm>
38816 </para>
38817 <informaltable frame="all">
38818 <tgroup cols="4" colsep="0" rowsep="0">
38819 <colspec colwidth="8*" align="left"/>
38820 <colspec colwidth="6*" align="center"/>
38821 <colspec colwidth="6*" align="center"/>
38822 <colspec colwidth="6*" align="right"/>
38823 <tbody>
38824 <row>
38825 <entry><option>mx_fail_domains</option></entry>
38826 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38827 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
38828 <entry>Default: <emphasis>unset</emphasis></entry>
38829 </row>
38830 </tbody>
38831 </tgroup>
38832 </informaltable>
38833 <para>
38834 If the DNS lookup for MX records for one of the domains in this list causes a
38835 DNS lookup error, Exim behaves as if no MX records were found. See section
38836 <xref linkend="SECTprowitdnsloo"/> for more discussion.
38837 </para>
38838 <para>
38839 <indexterm role="option">
38840 <primary><option>qualify_single</option></primary>
38841 </indexterm>
38842 </para>
38843 <informaltable frame="all">
38844 <tgroup cols="4" colsep="0" rowsep="0">
38845 <colspec colwidth="8*" align="left"/>
38846 <colspec colwidth="6*" align="center"/>
38847 <colspec colwidth="6*" align="center"/>
38848 <colspec colwidth="6*" align="right"/>
38849 <tbody>
38850 <row>
38851 <entry><option>qualify_single</option></entry>
38852 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38853 <entry>Type: <emphasis>boolean</emphasis></entry>
38854 <entry>Default: <emphasis>true</emphasis></entry>
38855 </row>
38856 </tbody>
38857 </tgroup>
38858 </informaltable>
38859 <para>
38860 <indexterm role="concept">
38861 <primary>DNS</primary>
38862 <secondary>resolver options</secondary>
38863 </indexterm>
38864 <indexterm role="concept">
38865 <primary>DNS</primary>
38866 <secondary>qualifying single-component names</secondary>
38867 </indexterm>
38868 When this option is true, the resolver option RES_DEFNAMES is set for DNS
38869 lookups. Typically, but not standardly, this causes the resolver to qualify
38870 single-component names with the default domain. For example, on a machine
38871 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
38872 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
38873 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
38874 <emphasis>resolv.conf</emphasis>.
38875 </para>
38876 <para>
38877 <indexterm role="option">
38878 <primary><option>rewrite_headers</option></primary>
38879 </indexterm>
38880 </para>
38881 <informaltable frame="all">
38882 <tgroup cols="4" colsep="0" rowsep="0">
38883 <colspec colwidth="8*" align="left"/>
38884 <colspec colwidth="6*" align="center"/>
38885 <colspec colwidth="6*" align="center"/>
38886 <colspec colwidth="6*" align="right"/>
38887 <tbody>
38888 <row>
38889 <entry><option>rewrite_headers</option></entry>
38890 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38891 <entry>Type: <emphasis>boolean</emphasis></entry>
38892 <entry>Default: <emphasis>true</emphasis></entry>
38893 </row>
38894 </tbody>
38895 </tgroup>
38896 </informaltable>
38897 <para>
38898 <indexterm role="concept">
38899 <primary>rewriting</primary>
38900 <secondary>header lines</secondary>
38901 </indexterm>
38902 <indexterm role="concept">
38903 <primary>header lines</primary>
38904 <secondary>rewriting</secondary>
38905 </indexterm>
38906 If the domain name in the address that is being processed is not fully
38907 qualified, it may be expanded to its full form by a DNS lookup. For example, if
38908 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
38909 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
38910 occur as a result of setting the <option>widen_domains</option> option. If
38911 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
38912 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
38913 header lines of the message are rewritten with the full domain name.
38914 </para>
38915 <para>
38916 This option should be turned off only when it is known that no message is
38917 ever going to be sent outside an environment where the abbreviation makes
38918 sense.
38919 </para>
38920 <para>
38921 When an MX record is looked up in the DNS and matches a wildcard record, name
38922 servers normally return a record containing the name that has been looked up,
38923 making it impossible to detect whether a wildcard was present or not. However,
38924 some name servers have recently been seen to return the wildcard entry. If the
38925 name returned by a DNS lookup begins with an asterisk, it is not used for
38926 header rewriting.
38927 </para>
38928 <para>
38929 <indexterm role="option">
38930 <primary><option>same_domain_copy_routing</option></primary>
38931 </indexterm>
38932 </para>
38933 <informaltable frame="all">
38934 <tgroup cols="4" colsep="0" rowsep="0">
38935 <colspec colwidth="8*" align="left"/>
38936 <colspec colwidth="6*" align="center"/>
38937 <colspec colwidth="6*" align="center"/>
38938 <colspec colwidth="6*" align="right"/>
38939 <tbody>
38940 <row>
38941 <entry><option>same_domain_copy_routing</option></entry>
38942 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38943 <entry>Type: <emphasis>boolean</emphasis></entry>
38944 <entry>Default: <emphasis>false</emphasis></entry>
38945 </row>
38946 </tbody>
38947 </tgroup>
38948 </informaltable>
38949 <para>
38950 <indexterm role="concept">
38951 <primary>address</primary>
38952 <secondary>copying routing</secondary>
38953 </indexterm>
38954 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
38955 to the same list of hosts. However, this cannot be presumed, because the router
38956 options and preconditions may refer to the local part of the address. By
38957 default, therefore, Exim routes each address in a message independently. DNS
38958 servers run caches, so repeated DNS lookups are not normally expensive, and in
38959 any case, personal messages rarely have more than a few recipients.
38960 </para>
38961 <para>
38962 If you are running mailing lists with large numbers of subscribers at the same
38963 domain, and you are using a <command>dnslookup</command> router which is independent of the
38964 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
38965 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
38966 routes an address to a remote transport, any other unrouted addresses in the
38967 message that have the same domain are automatically given the same routing
38968 without processing them independently,
38969 provided the following conditions are met:
38970 </para>
38971 <itemizedlist>
38972 <listitem>
38973 <para>
38974 No router that processed the address specified <option>headers_add</option> or
38975 <option>headers_remove</option>.
38976 </para>
38977 </listitem>
38978 <listitem>
38979 <para>
38980 The router did not change the address in any way, for example, by <quote>widening</quote>
38981 the domain.
38982 </para>
38983 </listitem>
38984 </itemizedlist>
38985 <para>
38986 <indexterm role="option">
38987 <primary><option>search_parents</option></primary>
38988 </indexterm>
38989 </para>
38990 <informaltable frame="all">
38991 <tgroup cols="4" colsep="0" rowsep="0">
38992 <colspec colwidth="8*" align="left"/>
38993 <colspec colwidth="6*" align="center"/>
38994 <colspec colwidth="6*" align="center"/>
38995 <colspec colwidth="6*" align="right"/>
38996 <tbody>
38997 <row>
38998 <entry><option>search_parents</option></entry>
38999 <entry>Use: <emphasis>dnslookup</emphasis></entry>
39000 <entry>Type: <emphasis>boolean</emphasis></entry>
39001 <entry>Default: <emphasis>false</emphasis></entry>
39002 </row>
39003 </tbody>
39004 </tgroup>
39005 </informaltable>
39006 <para>
39007 <indexterm role="concept">
39008 <primary>DNS</primary>
39009 <secondary>resolver options</secondary>
39010 </indexterm>
39011 When this option is true, the resolver option RES_DNSRCH is set for DNS
39012 lookups. This is different from the <option>qualify_single</option> option in that it
39013 applies to domains containing dots. Typically, but not standardly, it causes
39014 the resolver to search for the name in the current domain and in parent
39015 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
39016 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
39017 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
39018 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
39019 </para>
39020 <para>
39021 Setting this option true can cause problems in domains that have a wildcard MX
39022 record, because any domain that does not have its own MX record matches the
39023 local wildcard.
39024 </para>
39025 <para>
39026 <indexterm role="option">
39027 <primary><option>srv_fail_domains</option></primary>
39028 </indexterm>
39029 </para>
39030 <informaltable frame="all">
39031 <tgroup cols="4" colsep="0" rowsep="0">
39032 <colspec colwidth="8*" align="left"/>
39033 <colspec colwidth="6*" align="center"/>
39034 <colspec colwidth="6*" align="center"/>
39035 <colspec colwidth="6*" align="right"/>
39036 <tbody>
39037 <row>
39038 <entry><option>srv_fail_domains</option></entry>
39039 <entry>Use: <emphasis>dnslookup</emphasis></entry>
39040 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
39041 <entry>Default: <emphasis>unset</emphasis></entry>
39042 </row>
39043 </tbody>
39044 </tgroup>
39045 </informaltable>
39046 <para>
39047 If the DNS lookup for SRV records for one of the domains in this list causes a
39048 DNS lookup error, Exim behaves as if no SRV records were found. See section
39049 <xref linkend="SECTprowitdnsloo"/> for more discussion.
39050 </para>
39051 <para>
39052 <indexterm role="option">
39053 <primary><option>widen_domains</option></primary>
39054 </indexterm>
39055 </para>
39056 <informaltable frame="all">
39057 <tgroup cols="4" colsep="0" rowsep="0">
39058 <colspec colwidth="8*" align="left"/>
39059 <colspec colwidth="6*" align="center"/>
39060 <colspec colwidth="6*" align="center"/>
39061 <colspec colwidth="6*" align="right"/>
39062 <tbody>
39063 <row>
39064 <entry><option>widen_domains</option></entry>
39065 <entry>Use: <emphasis>dnslookup</emphasis></entry>
39066 <entry>Type: <emphasis>string list</emphasis></entry>
39067 <entry>Default: <emphasis>unset</emphasis></entry>
39068 </row>
39069 </tbody>
39070 </tgroup>
39071 </informaltable>
39072 <para>
39073 <indexterm role="concept">
39074 <primary>domain</primary>
39075 <secondary>partial; widening</secondary>
39076 </indexterm>
39077 If a DNS lookup fails and this option is set, each of its strings in turn is
39078 added onto the end of the domain, and the lookup is tried again. For example,
39079 if
39080 </para>
39081 <literallayout class="monospaced">
39082 widen_domains = fict.example:ref.example
39083 </literallayout>
39084 <para>
39085 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
39086 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
39087 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
39088 and <option>search_parents</option> options can cause some widening to be undertaken inside
39089 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
39090 when verifying, unless <option>rewrite_headers</option> is false (not the default).
39091 </para>
39092 </section>
39093 <section id="SECID119">
39094 <title>Effect of qualify_single and search_parents</title>
39095 <para>
39096 When a domain from an envelope recipient is changed by the resolver as a result
39097 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
39098 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
39099 is set false. Exim then re-routes the address, using the full domain.
39100 </para>
39101 <para>
39102 These two options affect only the DNS lookup that takes place inside the router
39103 for the domain of the address that is being routed. They do not affect lookups
39104 such as that implied by
39105 </para>
39106 <literallayout class="monospaced">
39107 domains = @mx_any
39108 </literallayout>
39109 <para>
39110 that may happen while processing a router precondition before the router is
39111 entered. No widening ever takes place for these lookups.
39112 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
39113 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
39114 </para>
39115 </section>
39116 </chapter>
39117
39118 <chapter id="CHID5">
39119 <title>The ipliteral router</title>
39120 <para>
39121 <indexterm role="concept">
39122 <primary><command>ipliteral</command> router</primary>
39123 </indexterm>
39124 <indexterm role="concept">
39125 <primary>domain literal</primary>
39126 <secondary>routing</secondary>
39127 </indexterm>
39128 <indexterm role="concept">
39129 <primary>routers</primary>
39130 <secondary><command>ipliteral</command></secondary>
39131 </indexterm>
39132 This router has no private options. Unless it is being used purely for
39133 verification (see <option>verify_only</option>) a transport is required to be defined by the
39134 generic <option>transport</option> option. The router accepts the address if its domain part
39135 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
39136 router handles the address
39137 </para>
39138 <literallayout class="monospaced">
39139 root@[192.168.1.1]
39140 </literallayout>
39141 <para>
39142 by setting up delivery to the host with that IP address. IPv4 domain literals
39143 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
39144 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
39145 </para>
39146 <literallayout class="monospaced">
39147 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
39148 </literallayout>
39149 <para>
39150 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
39151 grounds that sooner or later somebody will try it.
39152 </para>
39153 <para>
39154 <indexterm role="option">
39155 <primary><option>self</option></primary>
39156 <secondary>in <command>ipliteral</command> router</secondary>
39157 </indexterm>
39158 If the IP address matches something in <option>ignore_target_hosts</option>, the router
39159 declines. If an IP literal turns out to refer to the local host, the generic
39160 <option>self</option> option determines what happens.
39161 </para>
39162 <para>
39163 The RFCs require support for domain literals; however, their use is
39164 controversial in today&#x2019;s Internet. If you want to use this router, you must
39165 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
39166 Exim will not recognize the domain literal syntax in addresses.
39167 </para>
39168 </chapter>
39169
39170 <chapter id="CHID6">
39171 <title>The iplookup router</title>
39172 <para>
39173 <indexterm role="concept">
39174 <primary><command>iplookup</command> router</primary>
39175 </indexterm>
39176 <indexterm role="concept">
39177 <primary>routers</primary>
39178 <secondary><command>iplookup</command></secondary>
39179 </indexterm>
39180 The <command>iplookup</command> router was written to fulfil a specific requirement in
39181 Cambridge University (which in fact no longer exists). For this reason, it is
39182 not included in the binary of Exim by default. If you want to include it, you
39183 must set
39184 </para>
39185 <literallayout class="monospaced">
39186 ROUTER_IPLOOKUP=yes
39187 </literallayout>
39188 <para>
39189 in your <filename>Local/Makefile</filename> configuration file.
39190 </para>
39191 <para>
39192 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
39193 connection to one or more specific hosts. The host can then return the same or
39194 a different address &ndash; in effect rewriting the recipient address in the
39195 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
39196 this process fails, the address can be passed on to other routers, or delivery
39197 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
39198 must not be specified for it.
39199 </para>
39200 <para>
39201 <indexterm role="concept">
39202 <primary>options</primary>
39203 <secondary><command>iplookup</command> router</secondary>
39204 </indexterm>
39205 <indexterm role="option">
39206 <primary><option>hosts</option></primary>
39207 </indexterm>
39208 </para>
39209 <informaltable frame="all">
39210 <tgroup cols="4" colsep="0" rowsep="0">
39211 <colspec colwidth="8*" align="left"/>
39212 <colspec colwidth="6*" align="center"/>
39213 <colspec colwidth="6*" align="center"/>
39214 <colspec colwidth="6*" align="right"/>
39215 <tbody>
39216 <row>
39217 <entry><option>hosts</option></entry>
39218 <entry>Use: <emphasis>iplookup</emphasis></entry>
39219 <entry>Type: <emphasis>string</emphasis></entry>
39220 <entry>Default: <emphasis>unset</emphasis></entry>
39221 </row>
39222 </tbody>
39223 </tgroup>
39224 </informaltable>
39225 <para>
39226 This option must be supplied. Its value is a colon-separated list of host
39227 names. The hosts are looked up using <function>gethostbyname()</function>
39228 (or <function>getipnodebyname()</function> when available)
39229 and are tried in order until one responds to the query. If none respond, what
39230 happens is controlled by <option>optional</option>.
39231 </para>
39232 <para>
39233 <indexterm role="option">
39234 <primary><option>optional</option></primary>
39235 </indexterm>
39236 </para>
39237 <informaltable frame="all">
39238 <tgroup cols="4" colsep="0" rowsep="0">
39239 <colspec colwidth="8*" align="left"/>
39240 <colspec colwidth="6*" align="center"/>
39241 <colspec colwidth="6*" align="center"/>
39242 <colspec colwidth="6*" align="right"/>
39243 <tbody>
39244 <row>
39245 <entry><option>optional</option></entry>
39246 <entry>Use: <emphasis>iplookup</emphasis></entry>
39247 <entry>Type: <emphasis>boolean</emphasis></entry>
39248 <entry>Default: <emphasis>false</emphasis></entry>
39249 </row>
39250 </tbody>
39251 </tgroup>
39252 </informaltable>
39253 <para>
39254 If <option>optional</option> is true, if no response is obtained from any host, the address
39255 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
39256 delivery to the address is deferred.
39257 </para>
39258 <para>
39259 <indexterm role="option">
39260 <primary><option>port</option></primary>
39261 </indexterm>
39262 </para>
39263 <informaltable frame="all">
39264 <tgroup cols="4" colsep="0" rowsep="0">
39265 <colspec colwidth="8*" align="left"/>
39266 <colspec colwidth="6*" align="center"/>
39267 <colspec colwidth="6*" align="center"/>
39268 <colspec colwidth="6*" align="right"/>
39269 <tbody>
39270 <row>
39271 <entry><option>port</option></entry>
39272 <entry>Use: <emphasis>iplookup</emphasis></entry>
39273 <entry>Type: <emphasis>integer</emphasis></entry>
39274 <entry>Default: <emphasis>0</emphasis></entry>
39275 </row>
39276 </tbody>
39277 </tgroup>
39278 </informaltable>
39279 <para>
39280 <indexterm role="concept">
39281 <primary>port</primary>
39282 <secondary><command>iplookup</command> router</secondary>
39283 </indexterm>
39284 This option must be supplied. It specifies the port number for the TCP or UDP
39285 call.
39286 </para>
39287 <para>
39288 <indexterm role="option">
39289 <primary><option>protocol</option></primary>
39290 </indexterm>
39291 </para>
39292 <informaltable frame="all">
39293 <tgroup cols="4" colsep="0" rowsep="0">
39294 <colspec colwidth="8*" align="left"/>
39295 <colspec colwidth="6*" align="center"/>
39296 <colspec colwidth="6*" align="center"/>
39297 <colspec colwidth="6*" align="right"/>
39298 <tbody>
39299 <row>
39300 <entry><option>protocol</option></entry>
39301 <entry>Use: <emphasis>iplookup</emphasis></entry>
39302 <entry>Type: <emphasis>string</emphasis></entry>
39303 <entry>Default: <emphasis>udp</emphasis></entry>
39304 </row>
39305 </tbody>
39306 </tgroup>
39307 </informaltable>
39308 <para>
39309 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
39310 protocols is to be used.
39311 </para>
39312 <para>
39313 <indexterm role="option">
39314 <primary><option>query</option></primary>
39315 </indexterm>
39316 </para>
39317 <informaltable frame="all">
39318 <tgroup cols="4" colsep="0" rowsep="0">
39319 <colspec colwidth="8*" align="left"/>
39320 <colspec colwidth="6*" align="center"/>
39321 <colspec colwidth="6*" align="center"/>
39322 <colspec colwidth="6*" align="right"/>
39323 <tbody>
39324 <row>
39325 <entry><option>query</option></entry>
39326 <entry>Use: <emphasis>iplookup</emphasis></entry>
39327 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39328 <entry>Default: <emphasis>see below</emphasis></entry>
39329 </row>
39330 </tbody>
39331 </tgroup>
39332 </informaltable>
39333 <para>
39334 This defines the content of the query that is sent to the remote hosts. The
39335 default value is:
39336 </para>
39337 <literallayout class="monospaced">
39338 $local_part@$domain $local_part@$domain
39339 </literallayout>
39340 <para>
39341 The repetition serves as a way of checking that a response is to the correct
39342 query in the default case (see <option>response_pattern</option> below).
39343 </para>
39344 <para>
39345 <indexterm role="option">
39346 <primary><option>reroute</option></primary>
39347 </indexterm>
39348 </para>
39349 <informaltable frame="all">
39350 <tgroup cols="4" colsep="0" rowsep="0">
39351 <colspec colwidth="8*" align="left"/>
39352 <colspec colwidth="6*" align="center"/>
39353 <colspec colwidth="6*" align="center"/>
39354 <colspec colwidth="6*" align="right"/>
39355 <tbody>
39356 <row>
39357 <entry><option>reroute</option></entry>
39358 <entry>Use: <emphasis>iplookup</emphasis></entry>
39359 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39360 <entry>Default: <emphasis>unset</emphasis></entry>
39361 </row>
39362 </tbody>
39363 </tgroup>
39364 </informaltable>
39365 <para>
39366 If this option is not set, the rerouted address is precisely the byte string
39367 returned by the remote host, up to the first white space, if any. If set, the
39368 string is expanded to form the rerouted address. It can include parts matched
39369 in the response by <option>response_pattern</option> by means of numeric variables such as
39370 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
39371 whether or not a pattern is in use. In all cases, the rerouted address must end
39372 up in the form <emphasis>local_part@domain</emphasis>.
39373 </para>
39374 <para>
39375 <indexterm role="option">
39376 <primary><option>response_pattern</option></primary>
39377 </indexterm>
39378 </para>
39379 <informaltable frame="all">
39380 <tgroup cols="4" colsep="0" rowsep="0">
39381 <colspec colwidth="8*" align="left"/>
39382 <colspec colwidth="6*" align="center"/>
39383 <colspec colwidth="6*" align="center"/>
39384 <colspec colwidth="6*" align="right"/>
39385 <tbody>
39386 <row>
39387 <entry><option>response_pattern</option></entry>
39388 <entry>Use: <emphasis>iplookup</emphasis></entry>
39389 <entry>Type: <emphasis>string</emphasis></entry>
39390 <entry>Default: <emphasis>unset</emphasis></entry>
39391 </row>
39392 </tbody>
39393 </tgroup>
39394 </informaltable>
39395 <para>
39396 This option can be set to a regular expression that is applied to the string
39397 returned from the remote host. If the pattern does not match the response, the
39398 router declines. If <option>response_pattern</option> is not set, no checking of the
39399 response is done, unless the query was defaulted, in which case there is a
39400 check that the text returned after the first white space is the original
39401 address. This checks that the answer that has been received is in response to
39402 the correct question. For example, if the response is just a new domain, the
39403 following could be used:
39404 </para>
39405 <literallayout class="monospaced">
39406 response_pattern = ^([^@]+)$
39407 reroute = $local_part@$1
39408 </literallayout>
39409 <para>
39410 <indexterm role="option">
39411 <primary><option>timeout</option></primary>
39412 </indexterm>
39413 </para>
39414 <informaltable frame="all">
39415 <tgroup cols="4" colsep="0" rowsep="0">
39416 <colspec colwidth="8*" align="left"/>
39417 <colspec colwidth="6*" align="center"/>
39418 <colspec colwidth="6*" align="center"/>
39419 <colspec colwidth="6*" align="right"/>
39420 <tbody>
39421 <row>
39422 <entry><option>timeout</option></entry>
39423 <entry>Use: <emphasis>iplookup</emphasis></entry>
39424 <entry>Type: <emphasis>time</emphasis></entry>
39425 <entry>Default: <emphasis>5s</emphasis></entry>
39426 </row>
39427 </tbody>
39428 </tgroup>
39429 </informaltable>
39430 <para>
39431 This specifies the amount of time to wait for a response from the remote
39432 machine. The same timeout is used for the <function>connect()</function> function for a TCP
39433 call. It does not apply to UDP.
39434 </para>
39435 </chapter>
39436
39437 <chapter id="CHID7">
39438 <title>The manualroute router</title>
39439 <para>
39440 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
39441 <primary><command>manualroute</command> router</primary>
39442 </indexterm>
39443 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
39444 <primary>routers</primary>
39445 <secondary><command>manualroute</command></secondary>
39446 </indexterm>
39447 <indexterm role="concept">
39448 <primary>domain</primary>
39449 <secondary>manually routing</secondary>
39450 </indexterm>
39451 The <command>manualroute</command> router is so-called because it provides a way of manually
39452 routing an address according to its domain. It is mainly used when you want to
39453 route addresses to remote hosts according to your own rules, bypassing the
39454 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
39455 route to local transports, a facility that may be useful if you want to save
39456 messages for dial-in hosts in local files.
39457 </para>
39458 <para>
39459 The <command>manualroute</command> router compares a list of domain patterns with the domain
39460 it is trying to route. If there is no match, the router declines. Each pattern
39461 has associated with it a list of hosts and some other optional data, which may
39462 include a transport. The combination of a pattern and its data is called a
39463 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
39464 generic <option>transport</option> option must specify a transport, unless the router is
39465 being used purely for verification (see <option>verify_only</option>).
39466 </para>
39467 <para>
39468 <indexterm role="variable">
39469 <primary><varname>$host</varname></primary>
39470 </indexterm>
39471 In the case of verification, matching the domain pattern is sufficient for the
39472 router to accept the address. When actually routing an address for delivery,
39473 an address that matches a domain pattern is queued for the associated
39474 transport. If the transport is not a local one, a host list must be associated
39475 with the pattern; IP addresses are looked up for the hosts, and these are
39476 passed to the transport along with the mail address. For local transports, a
39477 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
39478 text string.
39479 </para>
39480 <para>
39481 The list of routing rules can be provided as an inline string in
39482 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
39483 or database by setting <option>route_data</option>. Only one of these settings may appear in
39484 any one instance of <command>manualroute</command>. The format of routing rules is described
39485 below, following the list of private options.
39486 </para>
39487 <section id="SECTprioptman">
39488 <title>Private options for manualroute</title>
39489 <para>
39490 <indexterm role="concept">
39491 <primary>options</primary>
39492 <secondary><command>manualroute</command> router</secondary>
39493 </indexterm>
39494 The private options for the <command>manualroute</command> router are as follows:
39495 </para>
39496 <para>
39497 <indexterm role="option">
39498 <primary><option>host_all_ignored</option></primary>
39499 </indexterm>
39500 </para>
39501 <informaltable frame="all">
39502 <tgroup cols="4" colsep="0" rowsep="0">
39503 <colspec colwidth="8*" align="left"/>
39504 <colspec colwidth="6*" align="center"/>
39505 <colspec colwidth="6*" align="center"/>
39506 <colspec colwidth="6*" align="right"/>
39507 <tbody>
39508 <row>
39509 <entry><option>host_all_ignored</option></entry>
39510 <entry>Use: <emphasis>manualroute</emphasis></entry>
39511 <entry>Type: <emphasis>string</emphasis></entry>
39512 <entry>Default: <emphasis>defer</emphasis></entry>
39513 </row>
39514 </tbody>
39515 </tgroup>
39516 </informaltable>
39517 <para>
39518 See <option>host_find_failed</option>.
39519 </para>
39520 <para>
39521 <indexterm role="option">
39522 <primary><option>host_find_failed</option></primary>
39523 </indexterm>
39524 </para>
39525 <informaltable frame="all">
39526 <tgroup cols="4" colsep="0" rowsep="0">
39527 <colspec colwidth="8*" align="left"/>
39528 <colspec colwidth="6*" align="center"/>
39529 <colspec colwidth="6*" align="center"/>
39530 <colspec colwidth="6*" align="right"/>
39531 <tbody>
39532 <row>
39533 <entry><option>host_find_failed</option></entry>
39534 <entry>Use: <emphasis>manualroute</emphasis></entry>
39535 <entry>Type: <emphasis>string</emphasis></entry>
39536 <entry>Default: <emphasis>freeze</emphasis></entry>
39537 </row>
39538 </tbody>
39539 </tgroup>
39540 </informaltable>
39541 <para>
39542 This option controls what happens when <command>manualroute</command> tries to find an IP
39543 address for a host, and the host does not exist. The option can be set to one
39544 of the following values:
39545 </para>
39546 <literallayout class="monospaced">
39547 decline
39548 defer
39549 fail
39550 freeze
39551 ignore
39552 pass
39553 </literallayout>
39554 <para>
39555 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
39556 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
39557 forces the address to be passed to the next router (or the router defined by
39558 <option>pass_router</option>),
39559 <indexterm role="option">
39560 <primary><option>more</option></primary>
39561 </indexterm>
39562 overriding <option>no_more</option>, whereas the latter passes the address to the next
39563 router only if <option>more</option> is true.
39564 </para>
39565 <para>
39566 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
39567 cannot be found. If all the hosts in the list are ignored, the behaviour is
39568 controlled by the <option>host_all_ignored</option> option. This takes the same values
39569 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
39570 </para>
39571 <para>
39572 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
39573 state; if a host lookup gets a temporary error, delivery is deferred unless the
39574 generic <option>pass_on_timeout</option> option is set.
39575 </para>
39576 <para>
39577 <indexterm role="option">
39578 <primary><option>hosts_randomize</option></primary>
39579 </indexterm>
39580 </para>
39581 <informaltable frame="all">
39582 <tgroup cols="4" colsep="0" rowsep="0">
39583 <colspec colwidth="8*" align="left"/>
39584 <colspec colwidth="6*" align="center"/>
39585 <colspec colwidth="6*" align="center"/>
39586 <colspec colwidth="6*" align="right"/>
39587 <tbody>
39588 <row>
39589 <entry><option>hosts_randomize</option></entry>
39590 <entry>Use: <emphasis>manualroute</emphasis></entry>
39591 <entry>Type: <emphasis>boolean</emphasis></entry>
39592 <entry>Default: <emphasis>false</emphasis></entry>
39593 </row>
39594 </tbody>
39595 </tgroup>
39596 </informaltable>
39597 <para>
39598 <indexterm role="concept">
39599 <primary>randomized host list</primary>
39600 </indexterm>
39601 <indexterm role="concept">
39602 <primary>host</primary>
39603 <secondary>list of; randomized</secondary>
39604 </indexterm>
39605 If this option is set, the order of the items in a host list in a routing rule
39606 is randomized each time the list is used, unless an option in the routing rule
39607 overrides (see below). Randomizing the order of a host list can be used to do
39608 crude load sharing. However, if more than one mail address is routed by the
39609 same router to the same host list, the host lists are considered to be the same
39610 (even though they may be randomized into different orders) for the purpose of
39611 deciding whether to batch the deliveries into a single SMTP transaction.
39612 </para>
39613 <para>
39614 When <option>hosts_randomize</option> is true, a host list may be split
39615 into groups whose order is separately randomized. This makes it possible to
39616 set up MX-like behaviour. The boundaries between groups are indicated by an
39617 item that is just <literal>+</literal> in the host list. For example:
39618 </para>
39619 <literallayout class="monospaced">
39620 route_list = * host1:host2:host3:+:host4:host5
39621 </literallayout>
39622 <para>
39623 The order of the first three hosts and the order of the last two hosts is
39624 randomized for each use, but the first three always end up before the last two.
39625 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
39626 randomized host list is passed to an <command>smtp</command> transport that also has
39627 <option>hosts_randomize set</option>, the list is not re-randomized.
39628 </para>
39629 <para>
39630 <indexterm role="option">
39631 <primary><option>route_data</option></primary>
39632 </indexterm>
39633 </para>
39634 <informaltable frame="all">
39635 <tgroup cols="4" colsep="0" rowsep="0">
39636 <colspec colwidth="8*" align="left"/>
39637 <colspec colwidth="6*" align="center"/>
39638 <colspec colwidth="6*" align="center"/>
39639 <colspec colwidth="6*" align="right"/>
39640 <tbody>
39641 <row>
39642 <entry><option>route_data</option></entry>
39643 <entry>Use: <emphasis>manualroute</emphasis></entry>
39644 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39645 <entry>Default: <emphasis>unset</emphasis></entry>
39646 </row>
39647 </tbody>
39648 </tgroup>
39649 </informaltable>
39650 <para>
39651 If this option is set, it must expand to yield the data part of a routing rule.
39652 Typically, the expansion string includes a lookup based on the domain. For
39653 example:
39654 </para>
39655 <literallayout class="monospaced">
39656 route_data = ${lookup{$domain}dbm{/etc/routes}}
39657 </literallayout>
39658 <para>
39659 If the expansion is forced to fail, or the result is an empty string, the
39660 router declines. Other kinds of expansion failure cause delivery to be
39661 deferred.
39662 </para>
39663 <para>
39664 <indexterm role="option">
39665 <primary><option>route_list</option></primary>
39666 </indexterm>
39667 </para>
39668 <informaltable frame="all">
39669 <tgroup cols="4" colsep="0" rowsep="0">
39670 <colspec colwidth="8*" align="left"/>
39671 <colspec colwidth="6*" align="center"/>
39672 <colspec colwidth="6*" align="center"/>
39673 <colspec colwidth="6*" align="right"/>
39674 <tbody>
39675 <row>
39676 <entry><option>route_list</option></entry>
39677 <entry>Use: <emphasis>manualroute</emphasis></entry>
39678 <entry>Type: <emphasis>string list</emphasis></entry>
39679 <entry>Default: <emphasis>unset</emphasis></entry>
39680 </row>
39681 </tbody>
39682 </tgroup>
39683 </informaltable>
39684 <para>
39685 This string is a list of routing rules, in the form defined below. Note that,
39686 unlike most string lists, the items are separated by semicolons. This is so
39687 that they may contain colon-separated host lists.
39688 </para>
39689 <para>
39690 <indexterm role="option">
39691 <primary><option>same_domain_copy_routing</option></primary>
39692 </indexterm>
39693 </para>
39694 <informaltable frame="all">
39695 <tgroup cols="4" colsep="0" rowsep="0">
39696 <colspec colwidth="8*" align="left"/>
39697 <colspec colwidth="6*" align="center"/>
39698 <colspec colwidth="6*" align="center"/>
39699 <colspec colwidth="6*" align="right"/>
39700 <tbody>
39701 <row>
39702 <entry><option>same_domain_copy_routing</option></entry>
39703 <entry>Use: <emphasis>manualroute</emphasis></entry>
39704 <entry>Type: <emphasis>boolean</emphasis></entry>
39705 <entry>Default: <emphasis>false</emphasis></entry>
39706 </row>
39707 </tbody>
39708 </tgroup>
39709 </informaltable>
39710 <para>
39711 <indexterm role="concept">
39712 <primary>address</primary>
39713 <secondary>copying routing</secondary>
39714 </indexterm>
39715 Addresses with the same domain are normally routed by the <command>manualroute</command>
39716 router to the same list of hosts. However, this cannot be presumed, because the
39717 router options and preconditions may refer to the local part of the address. By
39718 default, therefore, Exim routes each address in a message independently. DNS
39719 servers run caches, so repeated DNS lookups are not normally expensive, and in
39720 any case, personal messages rarely have more than a few recipients.
39721 </para>
39722 <para>
39723 If you are running mailing lists with large numbers of subscribers at the same
39724 domain, and you are using a <command>manualroute</command> router which is independent of the
39725 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
39726 lookups for identical domains in one message. In this case, when
39727 <command>manualroute</command> routes an address to a remote transport, any other unrouted
39728 addresses in the message that have the same domain are automatically given the
39729 same routing without processing them independently. However, this is only done
39730 if <option>headers_add</option> and <option>headers_remove</option> are unset.
39731 </para>
39732 </section>
39733 <section id="SECID120">
39734 <title>Routing rules in route_list</title>
39735 <para>
39736 The value of <option>route_list</option> is a string consisting of a sequence of routing
39737 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
39738 entered as two semicolons. Alternatively, the list separator can be changed as
39739 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
39740 Empty rules are ignored. The format of each rule is
39741 </para>
39742 <literallayout>
39743 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
39744 </literallayout>
39745 <para>
39746 The following example contains two rules, each with a simple domain pattern and
39747 no options:
39748 </para>
39749 <literallayout class="monospaced">
39750 route_list = \
39751   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
39752   thes.ref.example  mail-3.ref.example:mail-4.ref.example
39753 </literallayout>
39754 <para>
39755 The three parts of a rule are separated by white space. The pattern and the
39756 list of hosts can be enclosed in quotes if necessary, and if they are, the
39757 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
39758 single domain pattern, which is the only mandatory item in the rule. The
39759 pattern is in the same format as one item in a domain list (see section
39760 <xref linkend="SECTdomainlist"/>),
39761 except that it may not be the name of an interpolated file.
39762 That is, it may be wildcarded, or a regular expression, or a file or database
39763 lookup (with semicolons doubled, because of the use of semicolon as a separator
39764 in a <option>route_list</option>).
39765 </para>
39766 <para>
39767 The rules in <option>route_list</option> are searched in order until one of the patterns
39768 matches the domain that is being routed. The list of hosts and then options are
39769 then used as described below. If there is no match, the router declines. When
39770 <option>route_list</option> is set, <option>route_data</option> must not be set.
39771 </para>
39772 </section>
39773 <section id="SECID121">
39774 <title>Routing rules in route_data</title>
39775 <para>
39776 The use of <option>route_list</option> is convenient when there are only a small number of
39777 routing rules. For larger numbers, it is easier to use a file or database to
39778 hold the routing information, and use the <option>route_data</option> option instead.
39779 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
39780 Most commonly, <option>route_data</option> is set as a string that contains an
39781 expansion lookup. For example, suppose we place two routing rules in a file
39782 like this:
39783 </para>
39784 <literallayout class="monospaced">
39785 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
39786 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
39787 </literallayout>
39788 <para>
39789 This data can be accessed by setting
39790 </para>
39791 <literallayout class="monospaced">
39792 route_data = ${lookup{$domain}lsearch{/the/file/name}}
39793 </literallayout>
39794 <para>
39795 Failure of the lookup results in an empty string, causing the router to
39796 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
39797 requirement is that the result of expanding the string is a list of hosts,
39798 possibly followed by options, separated by white space. The list of hosts must
39799 be enclosed in quotes if it contains white space.
39800 </para>
39801 </section>
39802 <section id="SECID122">
39803 <title>Format of the list of hosts</title>
39804 <para>
39805 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
39806 always separately expanded before use. If the expansion fails, the router
39807 declines. The result of the expansion must be a colon-separated list of names
39808 and/or IP addresses, optionally also including ports.
39809 If the list is written with spaces, it must be protected with quotes.
39810 The format of each item
39811 in the list is described in the next section. The list separator can be changed
39812 as described in section <xref linkend="SECTlistsepchange"/>.
39813 </para>
39814 <para>
39815 If the list of hosts was obtained from a <option>route_list</option> item, the following
39816 variables are set during its expansion:
39817 </para>
39818 <itemizedlist>
39819 <listitem>
39820 <para>
39821 <indexterm role="concept">
39822 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
39823 <secondary>in <command>manualroute</command> router</secondary>
39824 </indexterm>
39825 If the domain was matched against a regular expression, the numeric variables
39826 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
39827 </para>
39828 <literallayout class="monospaced">
39829 route_list = ^domain(\d+)   host-$1.text.example
39830 </literallayout>
39831 </listitem>
39832 <listitem>
39833 <para>
39834 <varname>$0</varname> is always set to the entire domain.
39835 </para>
39836 </listitem>
39837 <listitem>
39838 <para>
39839 <varname>$1</varname> is also set when partial matching is done in a file lookup.
39840 </para>
39841 </listitem>
39842 <listitem>
39843 <para>
39844 <indexterm role="variable">
39845 <primary><varname>$value</varname></primary>
39846 </indexterm>
39847 If the pattern that matched the domain was a lookup item, the data that was
39848 looked up is available in the expansion variable <varname>$value</varname>. For example:
39849 </para>
39850 <literallayout class="monospaced">
39851 route_list = lsearch;;/some/file.routes  $value
39852 </literallayout>
39853 </listitem>
39854 </itemizedlist>
39855 <para>
39856 Note the doubling of the semicolon in the pattern that is necessary because
39857 semicolon is the default route list separator.
39858 </para>
39859 </section>
39860 <section id="SECTformatonehostitem">
39861 <title>Format of one host item</title>
39862 <para>
39863 Each item in the list of hosts can be either a host name or an IP address,
39864 optionally with an attached port number, or it can be a single "+"
39865 (see <option>hosts_randomize</option>).
39866 When no port is given, an IP address
39867 is not enclosed in brackets. When a port is specified, it overrides the port
39868 specification on the transport. The port is separated from the name or address
39869 by a colon. This leads to some complications:
39870 </para>
39871 <itemizedlist>
39872 <listitem>
39873 <para>
39874 Because colon is the default separator for the list of hosts, either
39875 the colon that specifies a port must be doubled, or the list separator must
39876 be changed. The following two examples have the same effect:
39877 </para>
39878 <literallayout class="monospaced">
39879 route_list = * "host1.tld::1225 : host2.tld::1226"
39880 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
39881 </literallayout>
39882 </listitem>
39883 <listitem>
39884 <para>
39885 When IPv6 addresses are involved, it gets worse, because they contain
39886 colons of their own. To make this case easier, it is permitted to
39887 enclose an IP address (either v4 or v6) in square brackets if a port
39888 number follows. For example:
39889 </para>
39890 <literallayout class="monospaced">
39891 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
39892 </literallayout>
39893 </listitem>
39894 </itemizedlist>
39895 </section>
39896 <section id="SECThostshowused">
39897 <title>How the list of hosts is used</title>
39898 <para>
39899 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
39900 the hosts is tried, in the order specified, when carrying out the SMTP
39901 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
39902 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
39903 transport.
39904 </para>
39905 <para>
39906 Hosts may be listed by name or by IP address. An unadorned name in the list of
39907 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
39908 interpreted as an indirection to a sublist of hosts obtained by looking up MX
39909 records in the DNS. For example:
39910 </para>
39911 <literallayout class="monospaced">
39912 route_list = *  x.y.z:p.q.r/MX:e.f.g
39913 </literallayout>
39914 <para>
39915 If this feature is used with a port specifier, the port must come last. For
39916 example:
39917 </para>
39918 <literallayout class="monospaced">
39919 route_list = *  dom1.tld/mx::1225
39920 </literallayout>
39921 <para>
39922 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
39923 randomized before any lookups are done. Exim then scans the list; for any name
39924 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
39925 be an interface on the local host and the item is not the first in the list,
39926 Exim discards it and any subsequent items. If it is the first item, what
39927 happens is controlled by the
39928 <indexterm role="option">
39929 <primary><option>self</option></primary>
39930 <secondary>in <command>manualroute</command> router</secondary>
39931 </indexterm>
39932 <option>self</option> option of the router.
39933 </para>
39934 <para>
39935 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
39936 hosts obtained by looking up MX records for the name. This is always a DNS
39937 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
39938 below) are not relevant here. The order of these hosts is determined by the
39939 preference values in the MX records, according to the usual rules. Because
39940 randomizing happens before the MX lookup, it does not affect the order that is
39941 defined by MX preferences.
39942 </para>
39943 <para>
39944 If the local host is present in the sublist obtained from MX records, but is
39945 not the most preferred host in that list, it and any equally or less
39946 preferred hosts are removed before the sublist is inserted into the main list.
39947 </para>
39948 <para>
39949 If the local host is the most preferred host in the MX list, what happens
39950 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
39951 is not the first item (that is, there are previous hosts in the main list),
39952 Exim discards this name and any subsequent items in the main list.
39953 </para>
39954 <para>
39955 If the MX item is first in the list of hosts, and the local host is the
39956 most preferred host, what happens is controlled by the <option>self</option> option of the
39957 router.
39958 </para>
39959 <para>
39960 DNS failures when lookup up the MX records are treated in the same way as DNS
39961 failures when looking up IP addresses: <option>pass_on_timeout</option> and
39962 <option>host_find_failed</option> are used when relevant.
39963 </para>
39964 <para>
39965 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
39966 whether obtained from an MX lookup or not.
39967 </para>
39968 </section>
39969 <section id="SECThowoptused">
39970 <title>How the options are used</title>
39971 <para>
39972 The options are a sequence of words, space-separated.
39973 One of the words can be the name of a transport; this overrides the
39974 <option>transport</option> option on the router for this particular routing rule only. The
39975 other words (if present) control randomization of the list of hosts on a
39976 per-rule basis, and how the IP addresses of the hosts are to be found when
39977 routing to a remote transport. These options are as follows:
39978 </para>
39979 <itemizedlist>
39980 <listitem>
39981 <para>
39982 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
39983 setting of <option>hosts_randomize</option> for this routing rule only.
39984 </para>
39985 </listitem>
39986 <listitem>
39987 <para>
39988 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
39989 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
39990 </para>
39991 </listitem>
39992 <listitem>
39993 <para>
39994 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
39995 find IP addresses. This function may ultimately cause a DNS lookup, but it may
39996 also look in <filename>/etc/hosts</filename> or other sources of information.
39997 </para>
39998 </listitem>
39999 <listitem>
40000 <para>
40001 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
40002 no address records are found. If there is a temporary DNS error (such as a
40003 timeout), delivery is deferred.
40004 </para>
40005 </listitem>
40006 <listitem>
40007 <para>
40008 <option>ipv4_only</option>: in direct DNS lookups, look up only A records.
40009 </para>
40010 </listitem>
40011 <listitem>
40012 <para>
40013 <option>ipv4_prefer</option>: in direct DNS lookups, sort A records before AAAA records.
40014 </para>
40015 </listitem>
40016 </itemizedlist>
40017 <para>
40018 For example:
40019 </para>
40020 <literallayout class="monospaced">
40021 route_list = domain1  host1:host2:host3  randomize bydns;\
40022              domain2  host4:host5
40023 </literallayout>
40024 <para>
40025 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
40026 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
40027 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
40028 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
40029 call.
40030 </para>
40031 <para>
40032 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
40033 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
40034 instead of TRY_AGAIN. That is why the default action is to try a DNS
40035 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
40036 function called.
40037 </para>
40038 <para>
40039 <emphasis role="bold">Compatibility</emphasis>: From Exim 4.85 until fixed for 4.90, there was an
40040 inadvertent constraint that a transport name as an option had to be the last
40041 option specified.
40042 </para>
40043 <para>
40044 If no IP address for a host can be found, what happens is controlled by the
40045 <option>host_find_failed</option> option.
40046 </para>
40047 <para>
40048 <indexterm role="variable">
40049 <primary><varname>$host</varname></primary>
40050 </indexterm>
40051 When an address is routed to a local transport, IP addresses are not looked up.
40052 The host list is passed to the transport in the <varname>$host</varname> variable.
40053 </para>
40054 </section>
40055 <section id="SECID123">
40056 <title>Manualroute examples</title>
40057 <para>
40058 In some of the examples that follow, the presence of the <option>remote_smtp</option>
40059 transport, as defined in the default configuration file, is assumed:
40060 </para>
40061 <itemizedlist>
40062 <listitem>
40063 <para>
40064 <indexterm role="concept">
40065 <primary>smart host</primary>
40066 <secondary>example router</secondary>
40067 </indexterm>
40068 The <command>manualroute</command> router can be used to forward all external mail to a
40069 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
40070 named domain list that contains your local domains, for example:
40071 </para>
40072 <literallayout class="monospaced">
40073 domainlist local_domains = my.domain.example
40074 </literallayout>
40075 <para>
40076 You can arrange for all other domains to be routed to a smart host by making
40077 your first router something like this:
40078 </para>
40079 <literallayout class="monospaced">
40080 smart_route:
40081   driver = manualroute
40082   domains = !+local_domains
40083   transport = remote_smtp
40084   route_list = * smarthost.ref.example
40085 </literallayout>
40086 <para>
40087 This causes all non-local addresses to be sent to the single host
40088 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
40089 they are tried in order
40090 (but you can use <option>hosts_randomize</option> to vary the order each time).
40091 Another way of configuring the same thing is this:
40092 </para>
40093 <literallayout class="monospaced">
40094 smart_route:
40095   driver = manualroute
40096   transport = remote_smtp
40097   route_list = !+local_domains  smarthost.ref.example
40098 </literallayout>
40099 <para>
40100 There is no difference in behaviour between these two routers as they stand.
40101 However, they behave differently if <option>no_more</option> is added to them. In the first
40102 example, the router is skipped if the domain does not match the <option>domains</option>
40103 precondition; the following router is always tried. If the router runs, it
40104 always matches the domain and so can never decline. Therefore, <option>no_more</option>
40105 would have no effect. In the second case, the router is never skipped; it
40106 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
40107 <option>no_more</option> would prevent subsequent routers from running.
40108 </para>
40109 </listitem>
40110 <listitem>
40111 <para>
40112 <indexterm role="concept">
40113 <primary>mail hub example</primary>
40114 </indexterm>
40115 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
40116 records in the DNS and delivers it via its own private routing mechanism. Often
40117 the final destinations are behind a firewall, with the mail hub being the one
40118 machine that can connect to machines both inside and outside the firewall. The
40119 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
40120 to the correct hosts. For a small number of domains, the routing can be inline,
40121 using the <option>route_list</option> option, but for a larger number a file or database
40122 lookup is easier to manage.
40123 </para>
40124 <para>
40125 If the domain names are in fact the names of the machines to which the mail is
40126 to be sent by the mail hub, the configuration can be quite simple. For
40127 example:
40128 </para>
40129 <literallayout class="monospaced">
40130 hub_route:
40131   driver = manualroute
40132   transport = remote_smtp
40133   route_list = *.rhodes.tvs.example  $domain
40134 </literallayout>
40135 <para>
40136 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
40137 whose names are the same as the mail domains. A similar approach can be taken
40138 if the host name can be obtained from the domain name by a string manipulation
40139 that the expansion facilities can handle. Otherwise, a lookup based on the
40140 domain can be used to find the host:
40141 </para>
40142 <literallayout class="monospaced">
40143 through_firewall:
40144   driver = manualroute
40145   transport = remote_smtp
40146   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
40147 </literallayout>
40148 <para>
40149 The result of the lookup must be the name or IP address of the host (or
40150 hosts) to which the address is to be routed. If the lookup fails, the route
40151 data is empty, causing the router to decline. The address then passes to the
40152 next router.
40153 </para>
40154 </listitem>
40155 <listitem>
40156 <para>
40157 <indexterm role="concept">
40158 <primary>batched SMTP output example</primary>
40159 </indexterm>
40160 <indexterm role="concept">
40161 <primary>SMTP</primary>
40162 <secondary>batched outgoing; example</secondary>
40163 </indexterm>
40164 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
40165 SMTP format for onward transportation by some other means. This is one way of
40166 storing mail for a dial-up host when it is not connected. The route list entry
40167 can be as simple as a single domain name in a configuration like this:
40168 </para>
40169 <literallayout class="monospaced">
40170 save_in_file:
40171   driver = manualroute
40172   transport = batchsmtp_appendfile
40173   route_list = saved.domain.example
40174 </literallayout>
40175 <para>
40176 though often a pattern is used to pick up more than one domain. If there are
40177 several domains or groups of domains with different transport requirements,
40178 different transports can be listed in the routing information:
40179 </para>
40180 <literallayout class="monospaced">
40181 save_in_file:
40182   driver = manualroute
40183   route_list = \
40184     *.saved.domain1.example  $domain  batch_appendfile; \
40185     *.saved.domain2.example  \
40186       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
40187       batch_pipe
40188 </literallayout>
40189 <para>
40190 <indexterm role="variable">
40191 <primary><varname>$domain</varname></primary>
40192 </indexterm>
40193 <indexterm role="variable">
40194 <primary><varname>$host</varname></primary>
40195 </indexterm>
40196 The first of these just passes the domain in the <varname>$host</varname> variable, which
40197 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
40198 file lookup to find a value to pass, causing the router to decline to handle
40199 the address if the lookup fails.
40200 </para>
40201 </listitem>
40202 <listitem>
40203 <para>
40204 <indexterm role="concept">
40205 <primary>UUCP</primary>
40206 <secondary>example of router for</secondary>
40207 </indexterm>
40208 Routing mail directly to UUCP software is a specific case of the use of
40209 <command>manualroute</command> in a gateway to another mail environment. This is an example of
40210 one way it can be done:
40211 </para>
40212 <literallayout class="monospaced">
40213 # Transport
40214 uucp:
40215   driver = pipe
40216   user = nobody
40217   command = /usr/local/bin/uux -r - \
40218     ${substr_-5:$host}!rmail ${local_part}
40219   return_fail_output = true
40220
40221 # Router
40222 uucphost:
40223   transport = uucp
40224   driver = manualroute
40225   route_data = \
40226     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
40227 </literallayout>
40228 <para>
40229 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
40230 </para>
40231 <literallayout class="monospaced">
40232 darksite.ethereal.example:           darksite.UUCP
40233 </literallayout>
40234 <para>
40235 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
40236 makes clear the distinction between the domain name
40237 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
40238 </para>
40239 </listitem>
40240 </itemizedlist>
40241 <para>
40242 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
40243 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
40244 </para>
40245 </section>
40246 </chapter>
40247
40248 <chapter id="CHAPdriverlast">
40249 <title>The queryprogram router</title>
40250 <para>
40251 <indexterm role="concept" id="IIDquerou1" class="startofrange">
40252 <primary><command>queryprogram</command> router</primary>
40253 </indexterm>
40254 <indexterm role="concept" id="IIDquerou2" class="startofrange">
40255 <primary>routers</primary>
40256 <secondary><command>queryprogram</command></secondary>
40257 </indexterm>
40258 <indexterm role="concept">
40259 <primary>routing</primary>
40260 <secondary>by external program</secondary>
40261 </indexterm>
40262 The <command>queryprogram</command> router routes an address by running an external command
40263 and acting on its output. This is an expensive way to route, and is intended
40264 mainly for use in lightly-loaded systems, or for performing experiments.
40265 However, if it is possible to use the precondition options (<option>domains</option>,
40266 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
40267 be used in special cases, even on a busy host. There are the following private
40268 options:
40269 <indexterm role="concept">
40270 <primary>options</primary>
40271 <secondary><command>queryprogram</command> router</secondary>
40272 </indexterm>
40273 </para>
40274 <para>
40275 <indexterm role="option">
40276 <primary><option>command</option></primary>
40277 </indexterm>
40278 </para>
40279 <informaltable frame="all">
40280 <tgroup cols="4" colsep="0" rowsep="0">
40281 <colspec colwidth="8*" align="left"/>
40282 <colspec colwidth="6*" align="center"/>
40283 <colspec colwidth="6*" align="center"/>
40284 <colspec colwidth="6*" align="right"/>
40285 <tbody>
40286 <row>
40287 <entry><option>command</option></entry>
40288 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40290 <entry>Default: <emphasis>unset</emphasis></entry>
40291 </row>
40292 </tbody>
40293 </tgroup>
40294 </informaltable>
40295 <para>
40296 This option must be set. It specifies the command that is to be run. The
40297 command is split up into a command name and arguments, and then each is
40298 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
40299 <xref linkend="CHAPpipetransport"/>).
40300 </para>
40301 <para>
40302 <indexterm role="option">
40303 <primary><option>command_group</option></primary>
40304 </indexterm>
40305 </para>
40306 <informaltable frame="all">
40307 <tgroup cols="4" colsep="0" rowsep="0">
40308 <colspec colwidth="8*" align="left"/>
40309 <colspec colwidth="6*" align="center"/>
40310 <colspec colwidth="6*" align="center"/>
40311 <colspec colwidth="6*" align="right"/>
40312 <tbody>
40313 <row>
40314 <entry><option>command_group</option></entry>
40315 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40316 <entry>Type: <emphasis>string</emphasis></entry>
40317 <entry>Default: <emphasis>unset</emphasis></entry>
40318 </row>
40319 </tbody>
40320 </tgroup>
40321 </informaltable>
40322 <para>
40323 <indexterm role="concept">
40324 <primary>gid (group id)</primary>
40325 <secondary>in <command>queryprogram</command> router</secondary>
40326 </indexterm>
40327 This option specifies a gid to be set when running the command while routing an
40328 address for deliver. It must be set if <option>command_user</option> specifies a numerical
40329 uid. If it begins with a digit, it is interpreted as the numerical value of the
40330 gid. Otherwise it is looked up using <function>getgrnam()</function>.
40331 </para>
40332 <para>
40333 <indexterm role="option">
40334 <primary><option>command_user</option></primary>
40335 </indexterm>
40336 </para>
40337 <informaltable frame="all">
40338 <tgroup cols="4" colsep="0" rowsep="0">
40339 <colspec colwidth="8*" align="left"/>
40340 <colspec colwidth="6*" align="center"/>
40341 <colspec colwidth="6*" align="center"/>
40342 <colspec colwidth="6*" align="right"/>
40343 <tbody>
40344 <row>
40345 <entry><option>command_user</option></entry>
40346 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40347 <entry>Type: <emphasis>string</emphasis></entry>
40348 <entry>Default: <emphasis>unset</emphasis></entry>
40349 </row>
40350 </tbody>
40351 </tgroup>
40352 </informaltable>
40353 <para>
40354 <indexterm role="concept">
40355 <primary>uid (user id)</primary>
40356 <secondary>for <command>queryprogram</command></secondary>
40357 </indexterm>
40358 This option must be set. It specifies the uid which is set when running the
40359 command while routing an address for delivery. If the value begins with a digit,
40360 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
40361 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
40362 not set, a value for the gid also.
40363 </para>
40364 <para>
40365 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
40366 root, which it does during a normal delivery in a conventional configuration.
40367 However, when an address is being verified during message reception, Exim is
40368 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
40369 is called from a non-root process, Exim cannot change uid or gid before running
40370 the command. In this circumstance the command runs under the current uid and
40371 gid.
40372 </para>
40373 <para>
40374 <indexterm role="option">
40375 <primary><option>current_directory</option></primary>
40376 </indexterm>
40377 </para>
40378 <informaltable frame="all">
40379 <tgroup cols="4" colsep="0" rowsep="0">
40380 <colspec colwidth="8*" align="left"/>
40381 <colspec colwidth="6*" align="center"/>
40382 <colspec colwidth="6*" align="center"/>
40383 <colspec colwidth="6*" align="right"/>
40384 <tbody>
40385 <row>
40386 <entry><option>current_directory</option></entry>
40387 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40388 <entry>Type: <emphasis>string</emphasis></entry>
40389 <entry>Default: <emphasis>/</emphasis></entry>
40390 </row>
40391 </tbody>
40392 </tgroup>
40393 </informaltable>
40394 <para>
40395 This option specifies an absolute path which is made the current directory
40396 before running the command.
40397 </para>
40398 <para>
40399 <indexterm role="option">
40400 <primary><option>timeout</option></primary>
40401 </indexterm>
40402 </para>
40403 <informaltable frame="all">
40404 <tgroup cols="4" colsep="0" rowsep="0">
40405 <colspec colwidth="8*" align="left"/>
40406 <colspec colwidth="6*" align="center"/>
40407 <colspec colwidth="6*" align="center"/>
40408 <colspec colwidth="6*" align="right"/>
40409 <tbody>
40410 <row>
40411 <entry><option>timeout</option></entry>
40412 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40413 <entry>Type: <emphasis>time</emphasis></entry>
40414 <entry>Default: <emphasis>1h</emphasis></entry>
40415 </row>
40416 </tbody>
40417 </tgroup>
40418 </informaltable>
40419 <para>
40420 If the command does not complete within the timeout period, its process group
40421 is killed and the message is frozen. A value of zero time specifies no
40422 timeout.
40423 </para>
40424 <para>
40425 The standard output of the command is connected to a pipe, which is read when
40426 the command terminates. It should consist of a single line of output,
40427 containing up to five fields, separated by white space. The maximum length of
40428 the line is 1023 characters. Longer lines are silently truncated. The first
40429 field is one of the following words (case-insensitive):
40430 </para>
40431 <itemizedlist>
40432 <listitem>
40433 <para>
40434 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
40435 below).
40436 </para>
40437 </listitem>
40438 <listitem>
40439 <para>
40440 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
40441 <option>no_more</option> is set.
40442 </para>
40443 </listitem>
40444 <listitem>
40445 <para>
40446 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
40447 subsequent text on the line is an error message. If the router is run as part
40448 of address verification during an incoming SMTP message, the message is
40449 included in the SMTP response.
40450 </para>
40451 </listitem>
40452 <listitem>
40453 <para>
40454 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
40455 subsequent text on the line is an error message which is logged. It is not
40456 included in any SMTP response.
40457 </para>
40458 </listitem>
40459 <listitem>
40460 <para>
40461 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
40462 </para>
40463 </listitem>
40464 <listitem>
40465 <para>
40466 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
40467 <option>pass_router</option>), overriding <option>no_more</option>.
40468 </para>
40469 </listitem>
40470 <listitem>
40471 <para>
40472 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
40473 new addresses, which are routed independently, starting with the first router,
40474 or the router specified by <option>redirect_router</option>, if set.
40475 </para>
40476 </listitem>
40477 </itemizedlist>
40478 <para>
40479 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
40480 number of keyed data values, as follows (split into two lines here, to fit on
40481 the page):
40482 </para>
40483 <literallayout class="monospaced">
40484 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
40485 LOOKUP=byname|bydns DATA=&lt;text&gt;
40486 </literallayout>
40487 <para>
40488 The data items can be given in any order, and all are optional. If no transport
40489 is included, the transport specified by the generic <option>transport</option> option is
40490 used. The list of hosts and the lookup type are needed only if the transport is
40491 an <command>smtp</command> transport that does not itself supply a list of hosts.
40492 </para>
40493 <para>
40494 The format of the list of hosts is the same as for the <command>manualroute</command> router.
40495 As well as host names and IP addresses with optional port numbers, as described
40496 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
40497 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
40498 (see section <xref linkend="SECThostshowused"/>).
40499 </para>
40500 <para>
40501 If the lookup type is not specified, Exim behaves as follows when trying to
40502 find an IP address for each host: First, a DNS lookup is done. If this yields
40503 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
40504 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
40505 result of the lookup is the result of that call.
40506 </para>
40507 <para>
40508 <indexterm role="variable">
40509 <primary><varname>$address_data</varname></primary>
40510 </indexterm>
40511 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
40512 variable. For example, this return line
40513 </para>
40514 <literallayout class="monospaced">
40515 accept hosts=x1.y.example:x2.y.example data="rule1"
40516 </literallayout>
40517 <para>
40518 routes the address to the default transport, passing a list of two hosts. When
40519 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
40520 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
40521 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
40522 </para>
40523 </chapter>
40524
40525 <chapter id="CHAPredirect">
40526 <title>The redirect router</title>
40527 <para>
40528 <indexterm role="concept" id="IIDredrou1" class="startofrange">
40529 <primary><command>redirect</command> router</primary>
40530 </indexterm>
40531 <indexterm role="concept" id="IIDredrou2" class="startofrange">
40532 <primary>routers</primary>
40533 <secondary><command>redirect</command></secondary>
40534 </indexterm>
40535 <indexterm role="concept">
40536 <primary>alias file</primary>
40537 <secondary>in a <command>redirect</command> router</secondary>
40538 </indexterm>
40539 <indexterm role="concept">
40540 <primary>address redirection</primary>
40541 <secondary><command>redirect</command> router</secondary>
40542 </indexterm>
40543 The <command>redirect</command> router handles several kinds of address redirection. Its most
40544 common uses are for resolving local part aliases from a central alias file
40545 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
40546 files, but it has many other potential uses. The incoming address can be
40547 redirected in several different ways:
40548 </para>
40549 <itemizedlist>
40550 <listitem>
40551 <para>
40552 It can be replaced by one or more new addresses which are themselves routed
40553 independently.
40554 </para>
40555 </listitem>
40556 <listitem>
40557 <para>
40558 It can be routed to be delivered to a given file or directory.
40559 </para>
40560 </listitem>
40561 <listitem>
40562 <para>
40563 It can be routed to be delivered to a specified pipe command.
40564 </para>
40565 </listitem>
40566 <listitem>
40567 <para>
40568 It can cause an automatic reply to be generated.
40569 </para>
40570 </listitem>
40571 <listitem>
40572 <para>
40573 It can be forced to fail, optionally with a custom error message.
40574 </para>
40575 </listitem>
40576 <listitem>
40577 <para>
40578 It can be temporarily deferred, optionally with a custom message.
40579 </para>
40580 </listitem>
40581 <listitem>
40582 <para>
40583 It can be discarded.
40584 </para>
40585 </listitem>
40586 </itemizedlist>
40587 <para>
40588 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
40589 However, there are some private options which define transports for delivery to
40590 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
40591 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
40592 </para>
40593 <para>
40594 If success DSNs have been requested
40595 <indexterm role="concept">
40596 <primary>DSN</primary>
40597 <secondary>success</secondary>
40598 </indexterm>
40599 <indexterm role="concept">
40600 <primary>Delivery Status Notification</primary>
40601 <secondary>success</secondary>
40602 </indexterm>
40603 redirection triggers one and the DSN options are not passed any further.
40604 </para>
40605 <section id="SECID124">
40606 <title>Redirection data</title>
40607 <para>
40608 The router operates by interpreting a text string which it obtains either by
40609 expanding the contents of the <option>data</option> option, or by reading the entire
40610 contents of a file whose name is given in the <option>file</option> option. These two
40611 options are mutually exclusive. The first is commonly used for handling system
40612 aliases, in a configuration like this:
40613 </para>
40614 <literallayout class="monospaced">
40615 system_aliases:
40616   driver = redirect
40617   data = ${lookup{$local_part}lsearch{/etc/aliases}}
40618 </literallayout>
40619 <para>
40620 If the lookup fails, the expanded string in this example is empty. When the
40621 expansion of <option>data</option> results in an empty string, the router declines. A forced
40622 expansion failure also causes the router to decline; other expansion failures
40623 cause delivery to be deferred.
40624 </para>
40625 <para>
40626 A configuration using <option>file</option> is commonly used for handling users&#x2019;
40627 <filename>.forward</filename> files, like this:
40628 </para>
40629 <literallayout class="monospaced">
40630 userforward:
40631   driver = redirect
40632   check_local_user
40633   file = $home/.forward
40634   no_verify
40635 </literallayout>
40636 <para>
40637 If the file does not exist, or causes no action to be taken (for example, it is
40638 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
40639 is not the case when the file contains syntactically valid items that happen to
40640 yield empty addresses, for example, items containing only RFC 2822 address
40641 comments.
40642 </para>
40643 <para>
40644 <indexterm role="concept">
40645 <primary>tainted data</primary>
40646 <secondary>in filenames</secondary>
40647 </indexterm>
40648 <indexterm role="concept">
40649 <primary>redirect</primary>
40650 <secondary>tainted data</secondary>
40651 </indexterm>
40652 Tainted data may not be used for a filename.
40653 </para>
40654 <para>
40655 <emphasis role="bold">Warning</emphasis>: It is unwise to use <varname>$local_part</varname> or <varname>$domain</varname>
40656 directly for redirection,
40657 as they are provided by a potential attacker.
40658 In the examples above, <varname>$local_part</varname> is used for looking up data held locally
40659 on the system, and not used directly (the second example derives <varname>$home</varname> via
40660 the passsword file or database, using <varname>$local_part</varname>).
40661 </para>
40662 </section>
40663 <section id="SECID125">
40664 <title>Forward files and address verification</title>
40665 <para>
40666 <indexterm role="concept">
40667 <primary>address redirection</primary>
40668 <secondary>while verifying</secondary>
40669 </indexterm>
40670 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
40671 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
40672 </para>
40673 <itemizedlist>
40674 <listitem>
40675 <para>
40676 When Exim is receiving an incoming SMTP message from a remote host, it is
40677 running under the Exim uid, not as root. Exim is unable to change uid to read
40678 the file as the user, and it may not be able to read it as the Exim user. So in
40679 practice the router may not be able to operate.
40680 </para>
40681 </listitem>
40682 <listitem>
40683 <para>
40684 However, even when the router can operate, the existence of a <filename>.forward</filename> file
40685 is unimportant when verifying an address. What should be checked is whether the
40686 local part is a valid user name or not. Cutting out the redirection processing
40687 saves some resources.
40688 </para>
40689 </listitem>
40690 </itemizedlist>
40691 </section>
40692 <section id="SECID126">
40693 <title>Interpreting redirection data</title>
40694 <para>
40695 <indexterm role="concept">
40696 <primary>Sieve filter</primary>
40697 <secondary>specifying in redirection data</secondary>
40698 </indexterm>
40699 <indexterm role="concept">
40700 <primary>filter</primary>
40701 <secondary>specifying in redirection data</secondary>
40702 </indexterm>
40703 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
40704 can be interpreted in two different ways:
40705 </para>
40706 <itemizedlist>
40707 <listitem>
40708 <para>
40709 If the <option>allow_filter</option> option is set true, and the data begins with the text
40710 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
40711 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
40712 respectively. Details of the syntax and semantics of filter files are described
40713 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
40714 document is intended for use by end users.
40715 </para>
40716 </listitem>
40717 <listitem>
40718 <para>
40719 Otherwise, the data must be a comma-separated list of redirection items, as
40720 described in the next section.
40721 </para>
40722 </listitem>
40723 </itemizedlist>
40724 <para>
40725 When a message is redirected to a file (a <quote>mail folder</quote>), the filename given
40726 in a non-filter redirection list must always be an absolute path. A filter may
40727 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
40728 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
40729 for the <command>appendfile</command> transport.
40730 </para>
40731 </section>
40732 <section id="SECTitenonfilred">
40733 <title>Items in a non-filter redirection list</title>
40734 <para>
40735 <indexterm role="concept">
40736 <primary>address redirection</primary>
40737 <secondary>non-filter list items</secondary>
40738 </indexterm>
40739 When the redirection data is not an Exim or Sieve filter, for example, if it
40740 comes from a conventional alias or forward file, it consists of a list of
40741 addresses, filenames, pipe commands, or certain special items (see section
40742 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
40743 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
40744 depending on their default values. The items in the list are separated by
40745 commas or newlines.
40746 If a comma is required in an item, the entire item must be enclosed in double
40747 quotes.
40748 </para>
40749 <para>
40750 Lines starting with a # character are comments, and are ignored, and # may
40751 also appear following a comma, in which case everything between the # and the
40752 next newline character is ignored.
40753 </para>
40754 <para>
40755 If an item is entirely enclosed in double quotes, these are removed. Otherwise
40756 double quotes are retained because some forms of mail address require their use
40757 (but never to enclose the entire address). In the following description,
40758 <quote>item</quote> refers to what remains after any surrounding double quotes have been
40759 removed.
40760 </para>
40761 <para>
40762 <indexterm role="variable">
40763 <primary><varname>$local_part</varname></primary>
40764 </indexterm>
40765 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
40766 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
40767 of the <option>quote_local_part</option> expansion operator, in case the local part contains
40768 special characters. For example, to redirect all mail for the domain
40769 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
40770 setting:
40771 </para>
40772 <literallayout class="monospaced">
40773 data = ${quote_local_part:$local_part}@newdomain.example
40774 </literallayout>
40775 </section>
40776 <section id="SECTredlocmai">
40777 <title>Redirecting to a local mailbox</title>
40778 <para>
40779 <indexterm role="concept">
40780 <primary>routing</primary>
40781 <secondary>loops in</secondary>
40782 </indexterm>
40783 <indexterm role="concept">
40784 <primary>loop</primary>
40785 <secondary>while routing, avoidance of</secondary>
40786 </indexterm>
40787 <indexterm role="concept">
40788 <primary>address redirection</primary>
40789 <secondary>to local mailbox</secondary>
40790 </indexterm>
40791 A redirection item may safely be the same as the address currently under
40792 consideration. This does not cause a routing loop, because a router is
40793 automatically skipped if any ancestor of the address that is being processed
40794 is the same as the current address and was processed by the current router.
40795 Such an address is therefore passed to the following routers, so it is handled
40796 as if there were no redirection. When making this loop-avoidance test, the
40797 complete local part, including any prefix or suffix, is used.
40798 </para>
40799 <para>
40800 <indexterm role="concept">
40801 <primary>address redirection</primary>
40802 <secondary>local part without domain</secondary>
40803 </indexterm>
40804 Specifying the same local part without a domain is a common usage in personal
40805 filter files when the user wants to have messages delivered to the local
40806 mailbox and also forwarded elsewhere. For example, the user whose login is
40807 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
40808 </para>
40809 <literallayout class="monospaced">
40810 cleo, cleopatra@egypt.example
40811 </literallayout>
40812 <para>
40813 <indexterm role="concept">
40814 <primary>backslash in alias file</primary>
40815 </indexterm>
40816 <indexterm role="concept">
40817 <primary>alias file</primary>
40818 <secondary>backslash in</secondary>
40819 </indexterm>
40820 For compatibility with other MTAs, such unqualified local parts may be
40821 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
40822 it does make a difference if more than one domain is being handled
40823 synonymously.
40824 </para>
40825 <para>
40826 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
40827 2822 address that does not include a domain, the item is qualified using the
40828 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
40829 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
40830 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
40831 </para>
40832 <para>
40833 Care must be taken if there are alias names for local users.
40834 Consider an MTA handling a single local domain where the system alias file
40835 contains:
40836 </para>
40837 <literallayout class="monospaced">
40838 Sam.Reman: spqr
40839 </literallayout>
40840 <para>
40841 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
40842 messages in the local mailbox, and also forward copies elsewhere. He creates
40843 this forward file:
40844 </para>
40845 <literallayout class="monospaced">
40846 Sam.Reman, spqr@reme.elsewhere.example
40847 </literallayout>
40848 <para>
40849 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
40850 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
40851 second time round, because it has previously routed it,
40852 and the following routers presumably cannot handle the alias. The forward file
40853 should really contain
40854 </para>
40855 <literallayout class="monospaced">
40856 spqr, spqr@reme.elsewhere.example
40857 </literallayout>
40858 <para>
40859 but because this is such a common error, the <option>check_ancestor</option> option (see
40860 below) exists to provide a way to get round it. This is normally set on a
40861 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
40862 </para>
40863 </section>
40864 <section id="SECTspecitredli">
40865 <title>Special items in redirection lists</title>
40866 <para>
40867 In addition to addresses, the following types of item may appear in redirection
40868 lists (that is, in non-filter redirection data):
40869 </para>
40870 <itemizedlist>
40871 <listitem>
40872 <para>
40873 <indexterm role="concept">
40874 <primary>pipe</primary>
40875 <secondary>in redirection list</secondary>
40876 </indexterm>
40877 <indexterm role="concept">
40878 <primary>address redirection</primary>
40879 <secondary>to pipe</secondary>
40880 </indexterm>
40881 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
40882 as a valid RFC 2822 address that includes a domain. A transport for running the
40883 command must be specified by the <option>pipe_transport</option> option.
40884 Normally, either the router or the transport specifies a user and a group under
40885 which to run the delivery. The default is to use the Exim user and group.
40886 </para>
40887 <para>
40888 Single or double quotes can be used for enclosing the individual arguments of
40889 the pipe command; no interpretation of escapes is done for single quotes. If
40890 the command contains a comma character, it is necessary to put the whole item
40891 in double quotes, for example:
40892 </para>
40893 <literallayout class="monospaced">
40894 "|/some/command ready,steady,go"
40895 </literallayout>
40896 <para>
40897 since items in redirection lists are terminated by commas. Do not, however,
40898 quote just the command. An item such as
40899 </para>
40900 <literallayout class="monospaced">
40901 |"/some/command ready,steady,go"
40902 </literallayout>
40903 <para>
40904 is interpreted as a pipe with a rather strange command name, and no arguments.
40905 </para>
40906 <para>
40907 Note that the above example assumes that the text comes from a lookup source
40908 of some sort, so that the quotes are part of the data.  If composing a
40909 redirect router with a <option>data</option> option directly specifying this command, the
40910 quotes will be used by the configuration parser to define the extent of one
40911 string, but will not be passed down into the redirect router itself.  There
40912 are two main approaches to get around this: escape quotes to be part of the
40913 data itself, or avoid using this mechanism and instead create a custom
40914 transport with the <option>command</option> option set and reference that transport from
40915 an <option>accept</option> router.
40916 </para>
40917 </listitem>
40918 <listitem>
40919 <para>
40920 <indexterm role="concept">
40921 <primary>file</primary>
40922 <secondary>in redirection list</secondary>
40923 </indexterm>
40924 <indexterm role="concept">
40925 <primary>address redirection</primary>
40926 <secondary>to file</secondary>
40927 </indexterm>
40928 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
40929 parse as a valid RFC 2822 address that includes a domain. For example,
40930 </para>
40931 <literallayout class="monospaced">
40932 /home/world/minbari
40933 </literallayout>
40934 <para>
40935 is treated as a filename, but
40936 </para>
40937 <literallayout class="monospaced">
40938 /s=molari/o=babylon/@x400gate.way
40939 </literallayout>
40940 <para>
40941 is treated as an address. For a filename, a transport must be specified using
40942 the <option>file_transport</option> option. However, if the generated path name ends with a
40943 forward slash character, it is interpreted as a directory name rather than a
40944 filename, and <option>directory_transport</option> is used instead.
40945 </para>
40946 <para>
40947 Normally, either the router or the transport specifies a user and a group under
40948 which to run the delivery. The default is to use the Exim user and group.
40949 </para>
40950 <para>
40951 <indexterm role="concept">
40952 <primary><filename>/dev/null</filename></primary>
40953 </indexterm>
40954 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
40955 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
40956 instead of a transport name. In this case the user and group are not used.
40957 </para>
40958 </listitem>
40959 <listitem>
40960 <para>
40961 <indexterm role="concept">
40962 <primary>included address list</primary>
40963 </indexterm>
40964 <indexterm role="concept">
40965 <primary>address redirection</primary>
40966 <secondary>included external list</secondary>
40967 </indexterm>
40968 If an item is of the form
40969 </para>
40970 <literallayout class="monospaced">
40971 :include:&lt;path name&gt;
40972 </literallayout>
40973 <para>
40974 a list of further items is taken from the given file and included at that
40975 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
40976 out-of-line addition to the list. The items in the included list are separated
40977 by commas or newlines and are not subject to expansion. If this is the first
40978 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
40979 the alias name. This example is incorrect:
40980 </para>
40981 <literallayout class="monospaced">
40982 list1    :include:/opt/lists/list1
40983 </literallayout>
40984 <para>
40985 It must be given as
40986 </para>
40987 <literallayout class="monospaced">
40988 list1:   :include:/opt/lists/list1
40989 </literallayout>
40990 <para>
40991 <indexterm role="concept">
40992 <primary>tainted data</primary>
40993 <secondary>in filenames</secondary>
40994 </indexterm>
40995 <indexterm role="concept">
40996 <primary>redirect</primary>
40997 <secondary>tainted data</secondary>
40998 </indexterm>
40999 Tainted data may not be used for a filename.
41000 </para>
41001 </listitem>
41002 <listitem>
41003 <para>
41004 <indexterm role="concept">
41005 <primary>address redirection</primary>
41006 <secondary>to black hole</secondary>
41007 </indexterm>
41008 <indexterm role="concept">
41009 <primary>delivery</primary>
41010 <secondary>discard</secondary>
41011 </indexterm>
41012 <indexterm role="concept">
41013 <primary>delivery</primary>
41014 <secondary>blackhole</secondary>
41015 </indexterm>
41016 <indexterm role="concept">
41017 <primary>black hole</primary>
41018 </indexterm>
41019 <indexterm role="concept">
41020 <primary>abandoning mail</primary>
41021 </indexterm>
41022 Sometimes you want to throw away mail to a particular local part.  Making the
41023 <option>data</option> option expand to an empty string does not work, because that causes
41024 the router to decline. Instead, the alias item
41025 </para>
41026 <literallayout class="monospaced">
41027 :blackhole:
41028 </literallayout>
41029 <para>
41030 can be used. It does what its name implies. No delivery is
41031 done, and no error message is generated. This has the same effect as specifying
41032 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
41033 </para>
41034 <para>
41035 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
41036 delivery is done for the original local part, even if other redirection items
41037 are present. If you are generating a multi-item list (for example, by reading a
41038 database) and need the ability to provide a no-op item, you must use
41039 <filename>/dev/null</filename>.
41040 </para>
41041 </listitem>
41042 <listitem>
41043 <para>
41044 <indexterm role="concept">
41045 <primary>delivery</primary>
41046 <secondary>forcing failure</secondary>
41047 </indexterm>
41048 <indexterm role="concept">
41049 <primary>delivery</primary>
41050 <secondary>forcing deferral</secondary>
41051 </indexterm>
41052 <indexterm role="concept">
41053 <primary>failing delivery</primary>
41054 <secondary>forcing</secondary>
41055 </indexterm>
41056 <indexterm role="concept">
41057 <primary>deferred delivery, forcing</primary>
41058 </indexterm>
41059 <indexterm role="concept">
41060 <primary>customizing</primary>
41061 <secondary>failure message</secondary>
41062 </indexterm>
41063 An attempt to deliver a particular address can be deferred or forced to fail by
41064 redirection items of the form
41065 </para>
41066 <literallayout class="monospaced">
41067 :defer:
41068 :fail:
41069 </literallayout>
41070 <para>
41071 respectively. When a redirection list contains such an item, it applies
41072 to the entire redirection; any other items in the list are ignored. Any
41073 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
41074 associated with the failure. For example, an alias file might contain:
41075 </para>
41076 <literallayout class="monospaced">
41077 X.Employee:  :fail: Gone away, no forwarding address
41078 </literallayout>
41079 <para>
41080 In the case of an address that is being verified from an ACL or as the subject
41081 of a
41082 <indexterm role="concept">
41083 <primary>VRFY</primary>
41084 <secondary>error text, display of</secondary>
41085 </indexterm>
41086 VRFY command, the text is included in the SMTP error response by
41087 default.
41088 <indexterm role="concept">
41089 <primary>EXPN</primary>
41090 <secondary>error text, display of</secondary>
41091 </indexterm>
41092 The text is not included in the response to an EXPN command. In non-SMTP cases
41093 the text is included in the error message that Exim generates.
41094 </para>
41095 <para>
41096 <indexterm role="concept">
41097 <primary>SMTP</primary>
41098 <secondary>error codes</secondary>
41099 </indexterm>
41100 By default for verify, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
41101 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
41102 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
41103 followed by a space, and the very first digit is the same as the default error
41104 code, the code from the message is used instead. If the very first digit is
41105 incorrect, a panic error is logged, and the default code is used. You can
41106 suppress the use of the supplied code in a redirect router by setting the
41107 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
41108 ignored.
41109 </para>
41110 <para>
41111 <indexterm role="variable">
41112 <primary><varname>$acl_verify_message</varname></primary>
41113 </indexterm>
41114 In an ACL, an explicitly provided message overrides the default, but the
41115 default message is available in the variable <varname>$acl_verify_message</varname> and can
41116 therefore be included in a custom message if this is desired.
41117 </para>
41118 <para>
41119 Normally the error text is the rest of the redirection list &ndash; a comma does
41120 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
41121 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
41122 as part of the continuation process, but they may exist in other kinds of
41123 lookup and in <emphasis>:include:</emphasis> files.
41124 </para>
41125 <para>
41126 During routing for message delivery (as opposed to verification), a redirection
41127 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
41128 whereas <emphasis>:defer:</emphasis> causes the message to remain in the queue so that a
41129 subsequent delivery attempt can happen at a later time. If an address is
41130 deferred for too long, it will ultimately fail, because the normal retry
41131 rules still apply.
41132 </para>
41133 </listitem>
41134 <listitem>
41135 <para>
41136 <indexterm role="concept">
41137 <primary>alias file</primary>
41138 <secondary>exception to default</secondary>
41139 </indexterm>
41140 Sometimes it is useful to use a single-key search type with a default (see
41141 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
41142 for exceptions to the default. These can be handled by aliasing them to
41143 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
41144 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
41145 results in an empty redirection list has the same effect.
41146 </para>
41147 </listitem>
41148 </itemizedlist>
41149 </section>
41150 <section id="SECTdupaddr">
41151 <title>Duplicate addresses</title>
41152 <para>
41153 <indexterm role="concept">
41154 <primary>duplicate addresses</primary>
41155 </indexterm>
41156 <indexterm role="concept">
41157 <primary>address duplicate, discarding</primary>
41158 </indexterm>
41159 <indexterm role="concept">
41160 <primary>pipe</primary>
41161 <secondary>duplicated</secondary>
41162 </indexterm>
41163 Exim removes duplicate addresses from the list to which it is delivering, so as
41164 to deliver just one copy to each address. This does not apply to deliveries
41165 routed to pipes by different immediate parent addresses, but an indirect
41166 aliasing scheme of the type
41167 </para>
41168 <literallayout class="monospaced">
41169 pipe:       |/some/command $local_part
41170 localpart1: pipe
41171 localpart2: pipe
41172 </literallayout>
41173 <para>
41174 does not work with a message that is addressed to both local parts, because
41175 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
41176 discarded as being the same as a previously handled address. However, a scheme
41177 such as
41178 </para>
41179 <literallayout class="monospaced">
41180 localpart1: |/some/command $local_part
41181 localpart2: |/some/command $local_part
41182 </literallayout>
41183 <para>
41184 does result in two different pipe deliveries, because the immediate parents of
41185 the pipes are distinct.
41186 </para>
41187 </section>
41188 <section id="SECID128">
41189 <title>Repeated redirection expansion</title>
41190 <para>
41191 <indexterm role="concept">
41192 <primary>repeated redirection expansion</primary>
41193 </indexterm>
41194 <indexterm role="concept">
41195 <primary>address redirection</primary>
41196 <secondary>repeated for each delivery attempt</secondary>
41197 </indexterm>
41198 When a message cannot be delivered to all of its recipients immediately,
41199 leading to two or more delivery attempts, redirection expansion is carried out
41200 afresh each time for those addresses whose children were not all previously
41201 delivered. If redirection is being used as a mailing list, this can lead to new
41202 members of the list receiving copies of old messages. The <option>one_time</option> option
41203 can be used to avoid this.
41204 </para>
41205 </section>
41206 <section id="SECID129">
41207 <title>Errors in redirection lists</title>
41208 <para>
41209 <indexterm role="concept">
41210 <primary>address redirection</primary>
41211 <secondary>errors</secondary>
41212 </indexterm>
41213 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
41214 error is skipped, and an entry is written to the main log. This may be useful
41215 for mailing lists that are automatically managed. Otherwise, if an error is
41216 detected while generating the list of new addresses, the original address is
41217 deferred. See also <option>syntax_errors_to</option>.
41218 </para>
41219 </section>
41220 <section id="SECID130">
41221 <title>Private options for the redirect router</title>
41222 <para>
41223 <indexterm role="concept">
41224 <primary>options</primary>
41225 <secondary><command>redirect</command> router</secondary>
41226 </indexterm>
41227 The private options for the <command>redirect</command> router are as follows:
41228 </para>
41229 <para>
41230 <indexterm role="option">
41231 <primary><option>allow_defer</option></primary>
41232 </indexterm>
41233 </para>
41234 <informaltable frame="all">
41235 <tgroup cols="4" colsep="0" rowsep="0">
41236 <colspec colwidth="8*" align="left"/>
41237 <colspec colwidth="6*" align="center"/>
41238 <colspec colwidth="6*" align="center"/>
41239 <colspec colwidth="6*" align="right"/>
41240 <tbody>
41241 <row>
41242 <entry><option>allow_defer</option></entry>
41243 <entry>Use: <emphasis>redirect</emphasis></entry>
41244 <entry>Type: <emphasis>boolean</emphasis></entry>
41245 <entry>Default: <emphasis>false</emphasis></entry>
41246 </row>
41247 </tbody>
41248 </tgroup>
41249 </informaltable>
41250 <para>
41251 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
41252 data, or the <option>defer</option> command in an Exim filter file.
41253 </para>
41254 <para>
41255 <indexterm role="option">
41256 <primary><option>allow_fail</option></primary>
41257 </indexterm>
41258 </para>
41259 <informaltable frame="all">
41260 <tgroup cols="4" colsep="0" rowsep="0">
41261 <colspec colwidth="8*" align="left"/>
41262 <colspec colwidth="6*" align="center"/>
41263 <colspec colwidth="6*" align="center"/>
41264 <colspec colwidth="6*" align="right"/>
41265 <tbody>
41266 <row>
41267 <entry><option>allow_fail</option></entry>
41268 <entry>Use: <emphasis>redirect</emphasis></entry>
41269 <entry>Type: <emphasis>boolean</emphasis></entry>
41270 <entry>Default: <emphasis>false</emphasis></entry>
41271 </row>
41272 </tbody>
41273 </tgroup>
41274 </informaltable>
41275 <para>
41276 <indexterm role="concept">
41277 <primary>failing delivery</primary>
41278 <secondary>from filter</secondary>
41279 </indexterm>
41280 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
41281 and the <option>fail</option> command may be used in an Exim filter file.
41282 </para>
41283 <para>
41284 <indexterm role="option">
41285 <primary><option>allow_filter</option></primary>
41286 </indexterm>
41287 </para>
41288 <informaltable frame="all">
41289 <tgroup cols="4" colsep="0" rowsep="0">
41290 <colspec colwidth="8*" align="left"/>
41291 <colspec colwidth="6*" align="center"/>
41292 <colspec colwidth="6*" align="center"/>
41293 <colspec colwidth="6*" align="right"/>
41294 <tbody>
41295 <row>
41296 <entry><option>allow_filter</option></entry>
41297 <entry>Use: <emphasis>redirect</emphasis></entry>
41298 <entry>Type: <emphasis>boolean</emphasis></entry>
41299 <entry>Default: <emphasis>false</emphasis></entry>
41300 </row>
41301 </tbody>
41302 </tgroup>
41303 </informaltable>
41304 <para>
41305 <indexterm role="concept">
41306 <primary>filter</primary>
41307 <secondary>enabling use of</secondary>
41308 </indexterm>
41309 <indexterm role="concept">
41310 <primary>Sieve filter</primary>
41311 <secondary>enabling use of</secondary>
41312 </indexterm>
41313 Setting this option allows Exim to interpret redirection data that starts with
41314 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
41315 are some features of Exim filter files that some administrators may wish to
41316 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
41317 </para>
41318 <para>
41319 It is also possible to lock out Exim filters or Sieve filters while allowing
41320 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
41321 </para>
41322 <para>
41323 The filter is run using the uid and gid set by the generic <option>user</option> and
41324 <option>group</option> options. These take their defaults from the password data if
41325 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
41326 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
41327 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
41328 </para>
41329 <para>
41330 <indexterm role="option">
41331 <primary><option>allow_freeze</option></primary>
41332 </indexterm>
41333 </para>
41334 <informaltable frame="all">
41335 <tgroup cols="4" colsep="0" rowsep="0">
41336 <colspec colwidth="8*" align="left"/>
41337 <colspec colwidth="6*" align="center"/>
41338 <colspec colwidth="6*" align="center"/>
41339 <colspec colwidth="6*" align="right"/>
41340 <tbody>
41341 <row>
41342 <entry><option>allow_freeze</option></entry>
41343 <entry>Use: <emphasis>redirect</emphasis></entry>
41344 <entry>Type: <emphasis>boolean</emphasis></entry>
41345 <entry>Default: <emphasis>false</emphasis></entry>
41346 </row>
41347 </tbody>
41348 </tgroup>
41349 </informaltable>
41350 <para>
41351 <indexterm role="concept">
41352 <primary>freezing messages</primary>
41353 <secondary>allowing in filter</secondary>
41354 </indexterm>
41355 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
41356 This command is more normally encountered in system filters, and is disabled by
41357 default for redirection filters because it isn&#x2019;t something you usually want to
41358 let ordinary users do.
41359 </para>
41360 <para>
41361 <indexterm role="option">
41362 <primary><option>check_ancestor</option></primary>
41363 </indexterm>
41364 </para>
41365 <informaltable frame="all">
41366 <tgroup cols="4" colsep="0" rowsep="0">
41367 <colspec colwidth="8*" align="left"/>
41368 <colspec colwidth="6*" align="center"/>
41369 <colspec colwidth="6*" align="center"/>
41370 <colspec colwidth="6*" align="right"/>
41371 <tbody>
41372 <row>
41373 <entry><option>check_ancestor</option></entry>
41374 <entry>Use: <emphasis>redirect</emphasis></entry>
41375 <entry>Type: <emphasis>boolean</emphasis></entry>
41376 <entry>Default: <emphasis>false</emphasis></entry>
41377 </row>
41378 </tbody>
41379 </tgroup>
41380 </informaltable>
41381 <para>
41382 This option is concerned with handling generated addresses that are the same
41383 as some address in the list of redirection ancestors of the current address.
41384 Although it is turned off by default in the code, it is set in the default
41385 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
41386 for this use of the <command>redirect</command> router.
41387 </para>
41388 <para>
41389 When <option>check_ancestor</option> is set, if a generated address (including the domain)
41390 is the same as any ancestor of the current address, it is replaced by a copy of
41391 the current address. This helps in the case where local part A is aliased to B,
41392 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
41393 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
41394 <filename>&nbsp;jb/.forward</filename> contains:
41395 </para>
41396 <literallayout class="monospaced">
41397 \Joe.Bloggs, &lt;other item(s)&gt;
41398 </literallayout>
41399 <para>
41400 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
41401 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
41402 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
41403 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
41404 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
41405 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
41406 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
41407 original address. See also the <option>repeat_use</option> option below.
41408 </para>
41409 <para>
41410 <indexterm role="option">
41411 <primary><option>check_group</option></primary>
41412 </indexterm>
41413 </para>
41414 <informaltable frame="all">
41415 <tgroup cols="4" colsep="0" rowsep="0">
41416 <colspec colwidth="8*" align="left"/>
41417 <colspec colwidth="6*" align="center"/>
41418 <colspec colwidth="6*" align="center"/>
41419 <colspec colwidth="6*" align="right"/>
41420 <tbody>
41421 <row>
41422 <entry><option>check_group</option></entry>
41423 <entry>Use: <emphasis>redirect</emphasis></entry>
41424 <entry>Type: <emphasis>boolean</emphasis></entry>
41425 <entry>Default: <emphasis>see below</emphasis></entry>
41426 </row>
41427 </tbody>
41428 </tgroup>
41429 </informaltable>
41430 <para>
41431 When the <option>file</option> option is used, the group owner of the file is checked only
41432 when this option is set. The permitted groups are those listed in the
41433 <option>owngroups</option> option, together with the user&#x2019;s default group if
41434 <option>check_local_user</option> is set. If the file has the wrong group, routing is
41435 deferred. The default setting for this option is true if <option>check_local_user</option>
41436 is set and the <option>modemask</option> option permits the group write bit, or if the
41437 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
41438 </para>
41439 <para>
41440 <indexterm role="option">
41441 <primary><option>check_owner</option></primary>
41442 </indexterm>
41443 </para>
41444 <informaltable frame="all">
41445 <tgroup cols="4" colsep="0" rowsep="0">
41446 <colspec colwidth="8*" align="left"/>
41447 <colspec colwidth="6*" align="center"/>
41448 <colspec colwidth="6*" align="center"/>
41449 <colspec colwidth="6*" align="right"/>
41450 <tbody>
41451 <row>
41452 <entry><option>check_owner</option></entry>
41453 <entry>Use: <emphasis>redirect</emphasis></entry>
41454 <entry>Type: <emphasis>boolean</emphasis></entry>
41455 <entry>Default: <emphasis>see below</emphasis></entry>
41456 </row>
41457 </tbody>
41458 </tgroup>
41459 </informaltable>
41460 <para>
41461 When the <option>file</option> option is used, the owner of the file is checked only when
41462 this option is set. If <option>check_local_user</option> is set, the local user is
41463 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
41464 option. The default value for this option is true if <option>check_local_user</option> or
41465 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
41466 </para>
41467 <para>
41468 <indexterm role="option">
41469 <primary><option>data</option></primary>
41470 </indexterm>
41471 </para>
41472 <informaltable frame="all">
41473 <tgroup cols="4" colsep="0" rowsep="0">
41474 <colspec colwidth="8*" align="left"/>
41475 <colspec colwidth="6*" align="center"/>
41476 <colspec colwidth="6*" align="center"/>
41477 <colspec colwidth="6*" align="right"/>
41478 <tbody>
41479 <row>
41480 <entry><option>data</option></entry>
41481 <entry>Use: <emphasis>redirect</emphasis></entry>
41482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41483 <entry>Default: <emphasis>unset</emphasis></entry>
41484 </row>
41485 </tbody>
41486 </tgroup>
41487 </informaltable>
41488 <para>
41489 This option is mutually exclusive with <option>file</option>. One or other of them must be
41490 set, but not both. The contents of <option>data</option> are expanded, and then used as the
41491 list of forwarding items, or as a set of filtering instructions. If the
41492 expansion is forced to fail, or the result is an empty string or a string that
41493 has no effect (consists entirely of comments), the router declines.
41494 </para>
41495 <para>
41496 When filtering instructions are used, the string must begin with <quote>#Exim
41497 filter</quote>, and all comments in the string, including this initial one, must be
41498 terminated with newline characters. For example:
41499 </para>
41500 <literallayout class="monospaced">
41501 data = #Exim filter\n\
41502        if $h_to: contains Exim then save $home/mail/exim endif
41503 </literallayout>
41504 <para>
41505 If you are reading the data from a database where newlines cannot be included,
41506 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
41507 choice into a newline.
41508 </para>
41509 <para>
41510 <indexterm role="option">
41511 <primary><option>directory_transport</option></primary>
41512 </indexterm>
41513 </para>
41514 <informaltable frame="all">
41515 <tgroup cols="4" colsep="0" rowsep="0">
41516 <colspec colwidth="8*" align="left"/>
41517 <colspec colwidth="6*" align="center"/>
41518 <colspec colwidth="6*" align="center"/>
41519 <colspec colwidth="6*" align="right"/>
41520 <tbody>
41521 <row>
41522 <entry><option>directory_transport</option></entry>
41523 <entry>Use: <emphasis>redirect</emphasis></entry>
41524 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41525 <entry>Default: <emphasis>unset</emphasis></entry>
41526 </row>
41527 </tbody>
41528 </tgroup>
41529 </informaltable>
41530 <para>
41531 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
41532 ending with a slash is specified as a new <quote>address</quote>. The transport used is
41533 specified by this option, which, after expansion, must be the name of a
41534 configured transport. This should normally be an <command>appendfile</command> transport.
41535 </para>
41536 <para>
41537 <indexterm role="option">
41538 <primary><option>file</option></primary>
41539 </indexterm>
41540 </para>
41541 <informaltable frame="all">
41542 <tgroup cols="4" colsep="0" rowsep="0">
41543 <colspec colwidth="8*" align="left"/>
41544 <colspec colwidth="6*" align="center"/>
41545 <colspec colwidth="6*" align="center"/>
41546 <colspec colwidth="6*" align="right"/>
41547 <tbody>
41548 <row>
41549 <entry><option>file</option></entry>
41550 <entry>Use: <emphasis>redirect</emphasis></entry>
41551 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41552 <entry>Default: <emphasis>unset</emphasis></entry>
41553 </row>
41554 </tbody>
41555 </tgroup>
41556 </informaltable>
41557 <para>
41558 This option specifies the name of a file that contains the redirection data. It
41559 is mutually exclusive with the <option>data</option> option. The string is expanded before
41560 use; if the expansion is forced to fail, the router declines. Other expansion
41561 failures cause delivery to be deferred. The result of a successful expansion
41562 must be an absolute path. The entire file is read and used as the redirection
41563 data. If the data is an empty string or a string that has no effect (consists
41564 entirely of comments), the router declines.
41565 </para>
41566 <para>
41567 <indexterm role="concept">
41568 <primary>NFS</primary>
41569 <secondary>checking for file existence</secondary>
41570 </indexterm>
41571 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
41572 runs a check on the containing directory,
41573 unless <option>ignore_enotdir</option> is true (see below).
41574 If the directory does not appear to exist, delivery is deferred. This can
41575 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
41576 is a mount problem. If the containing directory does exist, but the file does
41577 not, the router declines.
41578 </para>
41579 <para>
41580 <indexterm role="option">
41581 <primary><option>file_transport</option></primary>
41582 </indexterm>
41583 </para>
41584 <informaltable frame="all">
41585 <tgroup cols="4" colsep="0" rowsep="0">
41586 <colspec colwidth="8*" align="left"/>
41587 <colspec colwidth="6*" align="center"/>
41588 <colspec colwidth="6*" align="center"/>
41589 <colspec colwidth="6*" align="right"/>
41590 <tbody>
41591 <row>
41592 <entry><option>file_transport</option></entry>
41593 <entry>Use: <emphasis>redirect</emphasis></entry>
41594 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41595 <entry>Default: <emphasis>unset</emphasis></entry>
41596 </row>
41597 </tbody>
41598 </tgroup>
41599 </informaltable>
41600 <para>
41601 <indexterm role="variable">
41602 <primary><varname>$address_file</varname></primary>
41603 </indexterm>
41604 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
41605 ending in a slash is specified as a new <quote>address</quote>. The transport used is
41606 specified by this option, which, after expansion, must be the name of a
41607 configured transport. This should normally be an <command>appendfile</command> transport. When
41608 it is running, the filename is in <varname>$address_file</varname>.
41609 </para>
41610 <para>
41611 <indexterm role="option">
41612 <primary><option>filter_prepend_home</option></primary>
41613 </indexterm>
41614 </para>
41615 <informaltable frame="all">
41616 <tgroup cols="4" colsep="0" rowsep="0">
41617 <colspec colwidth="8*" align="left"/>
41618 <colspec colwidth="6*" align="center"/>
41619 <colspec colwidth="6*" align="center"/>
41620 <colspec colwidth="6*" align="right"/>
41621 <tbody>
41622 <row>
41623 <entry><option>filter_prepend_home</option></entry>
41624 <entry>Use: <emphasis>redirect</emphasis></entry>
41625 <entry>Type: <emphasis>boolean</emphasis></entry>
41626 <entry>Default: <emphasis>true</emphasis></entry>
41627 </row>
41628 </tbody>
41629 </tgroup>
41630 </informaltable>
41631 <para>
41632 When this option is true, if a <command>save</command> command in an Exim filter specifies a
41633 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
41634 relative path. If this option is set false, this action does not happen. The
41635 relative path is then passed to the transport unmodified.
41636 </para>
41637 <para>
41638 <indexterm role="option">
41639 <primary><option>forbid_blackhole</option></primary>
41640 </indexterm>
41641 </para>
41642 <informaltable frame="all">
41643 <tgroup cols="4" colsep="0" rowsep="0">
41644 <colspec colwidth="8*" align="left"/>
41645 <colspec colwidth="6*" align="center"/>
41646 <colspec colwidth="6*" align="center"/>
41647 <colspec colwidth="6*" align="right"/>
41648 <tbody>
41649 <row>
41650 <entry><option>forbid_blackhole</option></entry>
41651 <entry>Use: <emphasis>redirect</emphasis></entry>
41652 <entry>Type: <emphasis>boolean</emphasis></entry>
41653 <entry>Default: <emphasis>false</emphasis></entry>
41654 </row>
41655 </tbody>
41656 </tgroup>
41657 </informaltable>
41658 <para>
41659 <indexterm role="concept">
41660 <primary>restricting access to features</primary>
41661 </indexterm>
41662 <indexterm role="concept">
41663 <primary>filter</primary>
41664 <secondary>locking out certain features</secondary>
41665 </indexterm>
41666 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
41667 redirection list.
41668 </para>
41669 <para>
41670 <indexterm role="option">
41671 <primary><option>forbid_exim_filter</option></primary>
41672 </indexterm>
41673 </para>
41674 <informaltable frame="all">
41675 <tgroup cols="4" colsep="0" rowsep="0">
41676 <colspec colwidth="8*" align="left"/>
41677 <colspec colwidth="6*" align="center"/>
41678 <colspec colwidth="6*" align="center"/>
41679 <colspec colwidth="6*" align="right"/>
41680 <tbody>
41681 <row>
41682 <entry><option>forbid_exim_filter</option></entry>
41683 <entry>Use: <emphasis>redirect</emphasis></entry>
41684 <entry>Type: <emphasis>boolean</emphasis></entry>
41685 <entry>Default: <emphasis>false</emphasis></entry>
41686 </row>
41687 </tbody>
41688 </tgroup>
41689 </informaltable>
41690 <para>
41691 <indexterm role="concept">
41692 <primary>restricting access to features</primary>
41693 </indexterm>
41694 <indexterm role="concept">
41695 <primary>filter</primary>
41696 <secondary>locking out certain features</secondary>
41697 </indexterm>
41698 If this option is set true, only Sieve filters are permitted when
41699 <option>allow_filter</option> is true.
41700 </para>
41701 <para>
41702 <indexterm role="option">
41703 <primary><option>forbid_file</option></primary>
41704 </indexterm>
41705 </para>
41706 <informaltable frame="all">
41707 <tgroup cols="4" colsep="0" rowsep="0">
41708 <colspec colwidth="8*" align="left"/>
41709 <colspec colwidth="6*" align="center"/>
41710 <colspec colwidth="6*" align="center"/>
41711 <colspec colwidth="6*" align="right"/>
41712 <tbody>
41713 <row>
41714 <entry><option>forbid_file</option></entry>
41715 <entry>Use: <emphasis>redirect</emphasis></entry>
41716 <entry>Type: <emphasis>boolean</emphasis></entry>
41717 <entry>Default: <emphasis>false</emphasis></entry>
41718 </row>
41719 </tbody>
41720 </tgroup>
41721 </informaltable>
41722 <para>
41723 <indexterm role="concept">
41724 <primary>restricting access to features</primary>
41725 </indexterm>
41726 <indexterm role="concept">
41727 <primary>delivery</primary>
41728 <secondary>to file; forbidding</secondary>
41729 </indexterm>
41730 <indexterm role="concept">
41731 <primary>filter</primary>
41732 <secondary>locking out certain features</secondary>
41733 </indexterm>
41734 <indexterm role="concept">
41735 <primary>Sieve filter</primary>
41736 <secondary>forbidding delivery to a file</secondary>
41737 </indexterm>
41738 <indexterm role="concept">
41739 <primary>Sieve filter</primary>
41740 <secondary><quote>keep</quote> facility; disabling</secondary>
41741 </indexterm>
41742 If this option is true, this router may not generate a new address that
41743 specifies delivery to a local file or directory, either from a filter or from a
41744 conventional forward file. This option is forced to be true if <option>one_time</option> is
41745 set. It applies to Sieve filters as well as to Exim filters, but if true, it
41746 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
41747 </para>
41748 <para>
41749 <indexterm role="option">
41750 <primary><option>forbid_filter_dlfunc</option></primary>
41751 </indexterm>
41752 </para>
41753 <informaltable frame="all">
41754 <tgroup cols="4" colsep="0" rowsep="0">
41755 <colspec colwidth="8*" align="left"/>
41756 <colspec colwidth="6*" align="center"/>
41757 <colspec colwidth="6*" align="center"/>
41758 <colspec colwidth="6*" align="right"/>
41759 <tbody>
41760 <row>
41761 <entry><option>forbid_filter_dlfunc</option></entry>
41762 <entry>Use: <emphasis>redirect</emphasis></entry>
41763 <entry>Type: <emphasis>boolean</emphasis></entry>
41764 <entry>Default: <emphasis>false</emphasis></entry>
41765 </row>
41766 </tbody>
41767 </tgroup>
41768 </informaltable>
41769 <para>
41770 <indexterm role="concept">
41771 <primary>restricting access to features</primary>
41772 </indexterm>
41773 <indexterm role="concept">
41774 <primary>filter</primary>
41775 <secondary>locking out certain features</secondary>
41776 </indexterm>
41777 If this option is true, string expansions in Exim filters are not allowed to
41778 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
41779 functions.
41780 </para>
41781 <para>
41782 <indexterm role="option">
41783 <primary><option>forbid_filter_existstest</option></primary>
41784 </indexterm>
41785 </para>
41786 <informaltable frame="all">
41787 <tgroup cols="4" colsep="0" rowsep="0">
41788 <colspec colwidth="8*" align="left"/>
41789 <colspec colwidth="6*" align="center"/>
41790 <colspec colwidth="6*" align="center"/>
41791 <colspec colwidth="6*" align="right"/>
41792 <tbody>
41793 <row>
41794 <entry><option>forbid_filter_existstest</option></entry>
41795 <entry>Use: <emphasis>redirect</emphasis></entry>
41796 <entry>Type: <emphasis>boolean</emphasis></entry>
41797 <entry>Default: <emphasis>false</emphasis></entry>
41798 </row>
41799 </tbody>
41800 </tgroup>
41801 </informaltable>
41802 <para>
41803 <indexterm role="concept">
41804 <primary>restricting access to features</primary>
41805 </indexterm>
41806 <indexterm role="concept">
41807 <primary>filter</primary>
41808 <secondary>locking out certain features</secondary>
41809 </indexterm>
41810 <indexterm role="concept">
41811 <primary>expansion</primary>
41812 <secondary>statting a file</secondary>
41813 </indexterm>
41814 If this option is true, string expansions in Exim filters are not allowed to
41815 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
41816 </para>
41817 <para>
41818 <indexterm role="option">
41819 <primary><option>forbid_filter_logwrite</option></primary>
41820 </indexterm>
41821 </para>
41822 <informaltable frame="all">
41823 <tgroup cols="4" colsep="0" rowsep="0">
41824 <colspec colwidth="8*" align="left"/>
41825 <colspec colwidth="6*" align="center"/>
41826 <colspec colwidth="6*" align="center"/>
41827 <colspec colwidth="6*" align="right"/>
41828 <tbody>
41829 <row>
41830 <entry><option>forbid_filter_logwrite</option></entry>
41831 <entry>Use: <emphasis>redirect</emphasis></entry>
41832 <entry>Type: <emphasis>boolean</emphasis></entry>
41833 <entry>Default: <emphasis>false</emphasis></entry>
41834 </row>
41835 </tbody>
41836 </tgroup>
41837 </informaltable>
41838 <para>
41839 <indexterm role="concept">
41840 <primary>restricting access to features</primary>
41841 </indexterm>
41842 <indexterm role="concept">
41843 <primary>filter</primary>
41844 <secondary>locking out certain features</secondary>
41845 </indexterm>
41846 If this option is true, use of the logging facility in Exim filters is not
41847 permitted. Logging is in any case available only if the filter is being run
41848 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
41849 <filename>.forward</filename> files).
41850 </para>
41851 <para>
41852 <indexterm role="option">
41853 <primary><option>forbid_filter_lookup</option></primary>
41854 </indexterm>
41855 </para>
41856 <informaltable frame="all">
41857 <tgroup cols="4" colsep="0" rowsep="0">
41858 <colspec colwidth="8*" align="left"/>
41859 <colspec colwidth="6*" align="center"/>
41860 <colspec colwidth="6*" align="center"/>
41861 <colspec colwidth="6*" align="right"/>
41862 <tbody>
41863 <row>
41864 <entry><option>forbid_filter_lookup</option></entry>
41865 <entry>Use: <emphasis>redirect</emphasis></entry>
41866 <entry>Type: <emphasis>boolean</emphasis></entry>
41867 <entry>Default: <emphasis>false</emphasis></entry>
41868 </row>
41869 </tbody>
41870 </tgroup>
41871 </informaltable>
41872 <para>
41873 <indexterm role="concept">
41874 <primary>restricting access to features</primary>
41875 </indexterm>
41876 <indexterm role="concept">
41877 <primary>filter</primary>
41878 <secondary>locking out certain features</secondary>
41879 </indexterm>
41880 If this option is true, string expansions in Exim filter files are not allowed
41881 to make use of <option>lookup</option> items.
41882 </para>
41883 <para>
41884 <indexterm role="option">
41885 <primary><option>forbid_filter_perl</option></primary>
41886 </indexterm>
41887 </para>
41888 <informaltable frame="all">
41889 <tgroup cols="4" colsep="0" rowsep="0">
41890 <colspec colwidth="8*" align="left"/>
41891 <colspec colwidth="6*" align="center"/>
41892 <colspec colwidth="6*" align="center"/>
41893 <colspec colwidth="6*" align="right"/>
41894 <tbody>
41895 <row>
41896 <entry><option>forbid_filter_perl</option></entry>
41897 <entry>Use: <emphasis>redirect</emphasis></entry>
41898 <entry>Type: <emphasis>boolean</emphasis></entry>
41899 <entry>Default: <emphasis>false</emphasis></entry>
41900 </row>
41901 </tbody>
41902 </tgroup>
41903 </informaltable>
41904 <para>
41905 <indexterm role="concept">
41906 <primary>restricting access to features</primary>
41907 </indexterm>
41908 <indexterm role="concept">
41909 <primary>filter</primary>
41910 <secondary>locking out certain features</secondary>
41911 </indexterm>
41912 This option has an effect only if Exim is built with embedded Perl support. If
41913 it is true, string expansions in Exim filter files are not allowed to make use
41914 of the embedded Perl support.
41915 </para>
41916 <para>
41917 <indexterm role="option">
41918 <primary><option>forbid_filter_readfile</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>forbid_filter_readfile</option></entry>
41930 <entry>Use: <emphasis>redirect</emphasis></entry>
41931 <entry>Type: <emphasis>boolean</emphasis></entry>
41932 <entry>Default: <emphasis>false</emphasis></entry>
41933 </row>
41934 </tbody>
41935 </tgroup>
41936 </informaltable>
41937 <para>
41938 <indexterm role="concept">
41939 <primary>restricting access to features</primary>
41940 </indexterm>
41941 <indexterm role="concept">
41942 <primary>filter</primary>
41943 <secondary>locking out certain features</secondary>
41944 </indexterm>
41945 If this option is true, string expansions in Exim filter files are not allowed
41946 to make use of <option>readfile</option> items.
41947 </para>
41948 <para>
41949 <indexterm role="option">
41950 <primary><option>forbid_filter_readsocket</option></primary>
41951 </indexterm>
41952 </para>
41953 <informaltable frame="all">
41954 <tgroup cols="4" colsep="0" rowsep="0">
41955 <colspec colwidth="8*" align="left"/>
41956 <colspec colwidth="6*" align="center"/>
41957 <colspec colwidth="6*" align="center"/>
41958 <colspec colwidth="6*" align="right"/>
41959 <tbody>
41960 <row>
41961 <entry><option>forbid_filter_readsocket</option></entry>
41962 <entry>Use: <emphasis>redirect</emphasis></entry>
41963 <entry>Type: <emphasis>boolean</emphasis></entry>
41964 <entry>Default: <emphasis>false</emphasis></entry>
41965 </row>
41966 </tbody>
41967 </tgroup>
41968 </informaltable>
41969 <para>
41970 <indexterm role="concept">
41971 <primary>restricting access to features</primary>
41972 </indexterm>
41973 <indexterm role="concept">
41974 <primary>filter</primary>
41975 <secondary>locking out certain features</secondary>
41976 </indexterm>
41977 If this option is true, string expansions in Exim filter files are not allowed
41978 to make use of <option>readsocket</option> items.
41979 </para>
41980 <para>
41981 <indexterm role="option">
41982 <primary><option>forbid_filter_reply</option></primary>
41983 </indexterm>
41984 </para>
41985 <informaltable frame="all">
41986 <tgroup cols="4" colsep="0" rowsep="0">
41987 <colspec colwidth="8*" align="left"/>
41988 <colspec colwidth="6*" align="center"/>
41989 <colspec colwidth="6*" align="center"/>
41990 <colspec colwidth="6*" align="right"/>
41991 <tbody>
41992 <row>
41993 <entry><option>forbid_filter_reply</option></entry>
41994 <entry>Use: <emphasis>redirect</emphasis></entry>
41995 <entry>Type: <emphasis>boolean</emphasis></entry>
41996 <entry>Default: <emphasis>false</emphasis></entry>
41997 </row>
41998 </tbody>
41999 </tgroup>
42000 </informaltable>
42001 <para>
42002 <indexterm role="concept">
42003 <primary>restricting access to features</primary>
42004 </indexterm>
42005 <indexterm role="concept">
42006 <primary>filter</primary>
42007 <secondary>locking out certain features</secondary>
42008 </indexterm>
42009 If this option is true, this router may not generate an automatic reply
42010 message. Automatic replies can be generated only from Exim or Sieve filter
42011 files, not from traditional forward files. This option is forced to be true if
42012 <option>one_time</option> is set.
42013 </para>
42014 <para>
42015 <indexterm role="option">
42016 <primary><option>forbid_filter_run</option></primary>
42017 </indexterm>
42018 </para>
42019 <informaltable frame="all">
42020 <tgroup cols="4" colsep="0" rowsep="0">
42021 <colspec colwidth="8*" align="left"/>
42022 <colspec colwidth="6*" align="center"/>
42023 <colspec colwidth="6*" align="center"/>
42024 <colspec colwidth="6*" align="right"/>
42025 <tbody>
42026 <row>
42027 <entry><option>forbid_filter_run</option></entry>
42028 <entry>Use: <emphasis>redirect</emphasis></entry>
42029 <entry>Type: <emphasis>boolean</emphasis></entry>
42030 <entry>Default: <emphasis>false</emphasis></entry>
42031 </row>
42032 </tbody>
42033 </tgroup>
42034 </informaltable>
42035 <para>
42036 <indexterm role="concept">
42037 <primary>restricting access to features</primary>
42038 </indexterm>
42039 <indexterm role="concept">
42040 <primary>filter</primary>
42041 <secondary>locking out certain features</secondary>
42042 </indexterm>
42043 If this option is true, string expansions in Exim filter files are not allowed
42044 to make use of <option>run</option> items.
42045 </para>
42046 <para>
42047 <indexterm role="option">
42048 <primary><option>forbid_include</option></primary>
42049 </indexterm>
42050 </para>
42051 <informaltable frame="all">
42052 <tgroup cols="4" colsep="0" rowsep="0">
42053 <colspec colwidth="8*" align="left"/>
42054 <colspec colwidth="6*" align="center"/>
42055 <colspec colwidth="6*" align="center"/>
42056 <colspec colwidth="6*" align="right"/>
42057 <tbody>
42058 <row>
42059 <entry><option>forbid_include</option></entry>
42060 <entry>Use: <emphasis>redirect</emphasis></entry>
42061 <entry>Type: <emphasis>boolean</emphasis></entry>
42062 <entry>Default: <emphasis>false</emphasis></entry>
42063 </row>
42064 </tbody>
42065 </tgroup>
42066 </informaltable>
42067 <para>
42068 <indexterm role="concept">
42069 <primary>restricting access to features</primary>
42070 </indexterm>
42071 <indexterm role="concept">
42072 <primary>filter</primary>
42073 <secondary>locking out certain features</secondary>
42074 </indexterm>
42075 If this option is true, items of the form
42076 </para>
42077 <literallayout class="monospaced">
42078 :include:&lt;path name&gt;
42079 </literallayout>
42080 <para>
42081 are not permitted in non-filter redirection lists.
42082 </para>
42083 <para>
42084 <indexterm role="option">
42085 <primary><option>forbid_pipe</option></primary>
42086 </indexterm>
42087 </para>
42088 <informaltable frame="all">
42089 <tgroup cols="4" colsep="0" rowsep="0">
42090 <colspec colwidth="8*" align="left"/>
42091 <colspec colwidth="6*" align="center"/>
42092 <colspec colwidth="6*" align="center"/>
42093 <colspec colwidth="6*" align="right"/>
42094 <tbody>
42095 <row>
42096 <entry><option>forbid_pipe</option></entry>
42097 <entry>Use: <emphasis>redirect</emphasis></entry>
42098 <entry>Type: <emphasis>boolean</emphasis></entry>
42099 <entry>Default: <emphasis>false</emphasis></entry>
42100 </row>
42101 </tbody>
42102 </tgroup>
42103 </informaltable>
42104 <para>
42105 <indexterm role="concept">
42106 <primary>restricting access to features</primary>
42107 </indexterm>
42108 <indexterm role="concept">
42109 <primary>filter</primary>
42110 <secondary>locking out certain features</secondary>
42111 </indexterm>
42112 <indexterm role="concept">
42113 <primary>delivery</primary>
42114 <secondary>to pipe; forbidding</secondary>
42115 </indexterm>
42116 If this option is true, this router may not generate a new address which
42117 specifies delivery to a pipe, either from an Exim filter or from a conventional
42118 forward file. This option is forced to be true if <option>one_time</option> is set.
42119 </para>
42120 <para>
42121 <indexterm role="option">
42122 <primary><option>forbid_sieve_filter</option></primary>
42123 </indexterm>
42124 </para>
42125 <informaltable frame="all">
42126 <tgroup cols="4" colsep="0" rowsep="0">
42127 <colspec colwidth="8*" align="left"/>
42128 <colspec colwidth="6*" align="center"/>
42129 <colspec colwidth="6*" align="center"/>
42130 <colspec colwidth="6*" align="right"/>
42131 <tbody>
42132 <row>
42133 <entry><option>forbid_sieve_filter</option></entry>
42134 <entry>Use: <emphasis>redirect</emphasis></entry>
42135 <entry>Type: <emphasis>boolean</emphasis></entry>
42136 <entry>Default: <emphasis>false</emphasis></entry>
42137 </row>
42138 </tbody>
42139 </tgroup>
42140 </informaltable>
42141 <para>
42142 <indexterm role="concept">
42143 <primary>restricting access to features</primary>
42144 </indexterm>
42145 <indexterm role="concept">
42146 <primary>filter</primary>
42147 <secondary>locking out certain features</secondary>
42148 </indexterm>
42149 If this option is set true, only Exim filters are permitted when
42150 <option>allow_filter</option> is true.
42151 </para>
42152 <para>
42153 <indexterm role="concept">
42154 <primary>SMTP</primary>
42155 <secondary>error codes</secondary>
42156 </indexterm>
42157 <indexterm role="option">
42158 <primary><option>forbid_smtp_code</option></primary>
42159 </indexterm>
42160 </para>
42161 <informaltable frame="all">
42162 <tgroup cols="4" colsep="0" rowsep="0">
42163 <colspec colwidth="8*" align="left"/>
42164 <colspec colwidth="6*" align="center"/>
42165 <colspec colwidth="6*" align="center"/>
42166 <colspec colwidth="6*" align="right"/>
42167 <tbody>
42168 <row>
42169 <entry><option>forbid_smtp_code</option></entry>
42170 <entry>Use: <emphasis>redirect</emphasis></entry>
42171 <entry>Type: <emphasis>boolean</emphasis></entry>
42172 <entry>Default: <emphasis>false</emphasis></entry>
42173 </row>
42174 </tbody>
42175 </tgroup>
42176 </informaltable>
42177 <para>
42178 If this option is set true, any SMTP error codes that are present at the start
42179 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
42180 the default codes (451 and 550, respectively) are always used.
42181 </para>
42182 <para>
42183 <indexterm role="option">
42184 <primary><option>hide_child_in_errmsg</option></primary>
42185 </indexterm>
42186 </para>
42187 <informaltable frame="all">
42188 <tgroup cols="4" colsep="0" rowsep="0">
42189 <colspec colwidth="8*" align="left"/>
42190 <colspec colwidth="6*" align="center"/>
42191 <colspec colwidth="6*" align="center"/>
42192 <colspec colwidth="6*" align="right"/>
42193 <tbody>
42194 <row>
42195 <entry><option>hide_child_in_errmsg</option></entry>
42196 <entry>Use: <emphasis>redirect</emphasis></entry>
42197 <entry>Type: <emphasis>boolean</emphasis></entry>
42198 <entry>Default: <emphasis>false</emphasis></entry>
42199 </row>
42200 </tbody>
42201 </tgroup>
42202 </informaltable>
42203 <para>
42204 <indexterm role="concept">
42205 <primary>bounce message</primary>
42206 <secondary>redirection details; suppressing</secondary>
42207 </indexterm>
42208 If this option is true, it prevents Exim from quoting a child address if it
42209 generates a bounce or delay message for it. Instead it says <quote>an address
42210 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
42211 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
42212 bounce may well quote the generated address.
42213 </para>
42214 <para>
42215 <indexterm role="option">
42216 <primary><option>ignore_eacces</option></primary>
42217 </indexterm>
42218 </para>
42219 <informaltable frame="all">
42220 <tgroup cols="4" colsep="0" rowsep="0">
42221 <colspec colwidth="8*" align="left"/>
42222 <colspec colwidth="6*" align="center"/>
42223 <colspec colwidth="6*" align="center"/>
42224 <colspec colwidth="6*" align="right"/>
42225 <tbody>
42226 <row>
42227 <entry><option>ignore_eacces</option></entry>
42228 <entry>Use: <emphasis>redirect</emphasis></entry>
42229 <entry>Type: <emphasis>boolean</emphasis></entry>
42230 <entry>Default: <emphasis>false</emphasis></entry>
42231 </row>
42232 </tbody>
42233 </tgroup>
42234 </informaltable>
42235 <para>
42236 <indexterm role="concept">
42237 <primary>EACCES</primary>
42238 </indexterm>
42239 If this option is set and an attempt to open a redirection file yields the
42240 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
42241 file did not exist.
42242 </para>
42243 <para>
42244 <indexterm role="option">
42245 <primary><option>ignore_enotdir</option></primary>
42246 </indexterm>
42247 </para>
42248 <informaltable frame="all">
42249 <tgroup cols="4" colsep="0" rowsep="0">
42250 <colspec colwidth="8*" align="left"/>
42251 <colspec colwidth="6*" align="center"/>
42252 <colspec colwidth="6*" align="center"/>
42253 <colspec colwidth="6*" align="right"/>
42254 <tbody>
42255 <row>
42256 <entry><option>ignore_enotdir</option></entry>
42257 <entry>Use: <emphasis>redirect</emphasis></entry>
42258 <entry>Type: <emphasis>boolean</emphasis></entry>
42259 <entry>Default: <emphasis>false</emphasis></entry>
42260 </row>
42261 </tbody>
42262 </tgroup>
42263 </informaltable>
42264 <para>
42265 <indexterm role="concept">
42266 <primary>ENOTDIR</primary>
42267 </indexterm>
42268 If this option is set and an attempt to open a redirection file yields the
42269 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
42270 router behaves as if the file did not exist.
42271 </para>
42272 <para>
42273 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
42274 router that has the <option>file</option> option set discovers that the file does not exist
42275 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
42276 against unmounted NFS directories. If the parent can not be statted, delivery
42277 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
42278 is set, because that option tells Exim to ignore <quote>something on the path is not
42279 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
42280 that some operating systems give ENOENT where others give ENOTDIR.
42281 </para>
42282 <para>
42283 <indexterm role="option">
42284 <primary><option>include_directory</option></primary>
42285 </indexterm>
42286 </para>
42287 <informaltable frame="all">
42288 <tgroup cols="4" colsep="0" rowsep="0">
42289 <colspec colwidth="8*" align="left"/>
42290 <colspec colwidth="6*" align="center"/>
42291 <colspec colwidth="6*" align="center"/>
42292 <colspec colwidth="6*" align="right"/>
42293 <tbody>
42294 <row>
42295 <entry><option>include_directory</option></entry>
42296 <entry>Use: <emphasis>redirect</emphasis></entry>
42297 <entry>Type: <emphasis>string</emphasis></entry>
42298 <entry>Default: <emphasis>unset</emphasis></entry>
42299 </row>
42300 </tbody>
42301 </tgroup>
42302 </informaltable>
42303 <para>
42304 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
42305 redirection list must start with this directory.
42306 </para>
42307 <para>
42308 <indexterm role="option">
42309 <primary><option>modemask</option></primary>
42310 </indexterm>
42311 </para>
42312 <informaltable frame="all">
42313 <tgroup cols="4" colsep="0" rowsep="0">
42314 <colspec colwidth="8*" align="left"/>
42315 <colspec colwidth="6*" align="center"/>
42316 <colspec colwidth="6*" align="center"/>
42317 <colspec colwidth="6*" align="right"/>
42318 <tbody>
42319 <row>
42320 <entry><option>modemask</option></entry>
42321 <entry>Use: <emphasis>redirect</emphasis></entry>
42322 <entry>Type: <emphasis>octal integer</emphasis></entry>
42323 <entry>Default: <emphasis>022</emphasis></entry>
42324 </row>
42325 </tbody>
42326 </tgroup>
42327 </informaltable>
42328 <para>
42329 This specifies mode bits which must not be set for a file specified by the
42330 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
42331 </para>
42332 <para>
42333 <indexterm role="option">
42334 <primary><option>one_time</option></primary>
42335 </indexterm>
42336 </para>
42337 <informaltable frame="all">
42338 <tgroup cols="4" colsep="0" rowsep="0">
42339 <colspec colwidth="8*" align="left"/>
42340 <colspec colwidth="6*" align="center"/>
42341 <colspec colwidth="6*" align="center"/>
42342 <colspec colwidth="6*" align="right"/>
42343 <tbody>
42344 <row>
42345 <entry><option>one_time</option></entry>
42346 <entry>Use: <emphasis>redirect</emphasis></entry>
42347 <entry>Type: <emphasis>boolean</emphasis></entry>
42348 <entry>Default: <emphasis>false</emphasis></entry>
42349 </row>
42350 </tbody>
42351 </tgroup>
42352 </informaltable>
42353 <para>
42354 <indexterm role="concept">
42355 <primary>one-time aliasing/forwarding expansion</primary>
42356 </indexterm>
42357 <indexterm role="concept">
42358 <primary>alias file</primary>
42359 <secondary>one-time expansion</secondary>
42360 </indexterm>
42361 <indexterm role="concept">
42362 <primary>forward file</primary>
42363 <secondary>one-time expansion</secondary>
42364 </indexterm>
42365 <indexterm role="concept">
42366 <primary>mailing lists</primary>
42367 <secondary>one-time expansion</secondary>
42368 </indexterm>
42369 <indexterm role="concept">
42370 <primary>address redirection</primary>
42371 <secondary>one-time expansion</secondary>
42372 </indexterm>
42373 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
42374 files each time it tries to deliver a message causes a problem when one or more
42375 of the generated addresses fails be delivered at the first attempt. The problem
42376 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
42377 but of what happens when the redirection list changes during the time that the
42378 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
42379 lists, where new subscribers might receive copies of messages that were posted
42380 before they subscribed.
42381 </para>
42382 <para>
42383 If <option>one_time</option> is set and any addresses generated by the router fail to
42384 deliver at the first attempt, the failing addresses are added to the message as
42385 <quote>top level</quote> addresses, and the parent address that generated them is marked
42386 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
42387 attempt.
42388 </para>
42389 <para>
42390 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
42391 router would be lost if delivery did not succeed at the first attempt. For this
42392 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
42393 permitted when <option>one_time</option> is set.
42394 </para>
42395 <para>
42396 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
42397 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
42398 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
42399 </para>
42400 <para>
42401 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
42402 <option>one_time</option>.
42403 </para>
42404 <para>
42405 The original top-level address is remembered with each of the generated
42406 addresses, and is output in any log messages. However, any intermediate parent
42407 addresses are not recorded. This makes a difference to the log only if
42408 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
42409 typically be used for mailing lists, where there is normally just one level of
42410 expansion.
42411 </para>
42412 <para>
42413 <indexterm role="option">
42414 <primary><option>owners</option></primary>
42415 </indexterm>
42416 </para>
42417 <informaltable frame="all">
42418 <tgroup cols="4" colsep="0" rowsep="0">
42419 <colspec colwidth="8*" align="left"/>
42420 <colspec colwidth="6*" align="center"/>
42421 <colspec colwidth="6*" align="center"/>
42422 <colspec colwidth="6*" align="right"/>
42423 <tbody>
42424 <row>
42425 <entry><option>owners</option></entry>
42426 <entry>Use: <emphasis>redirect</emphasis></entry>
42427 <entry>Type: <emphasis>string list</emphasis></entry>
42428 <entry>Default: <emphasis>unset</emphasis></entry>
42429 </row>
42430 </tbody>
42431 </tgroup>
42432 </informaltable>
42433 <para>
42434 <indexterm role="concept">
42435 <primary>ownership</primary>
42436 <secondary>alias file</secondary>
42437 </indexterm>
42438 <indexterm role="concept">
42439 <primary>ownership</primary>
42440 <secondary>forward file</secondary>
42441 </indexterm>
42442 <indexterm role="concept">
42443 <primary>alias file</primary>
42444 <secondary>ownership</secondary>
42445 </indexterm>
42446 <indexterm role="concept">
42447 <primary>forward file</primary>
42448 <secondary>ownership</secondary>
42449 </indexterm>
42450 This specifies a list of permitted owners for the file specified by <option>file</option>.
42451 This list is in addition to the local user when <option>check_local_user</option> is set.
42452 See <option>check_owner</option> above.
42453 </para>
42454 <para>
42455 <indexterm role="option">
42456 <primary><option>owngroups</option></primary>
42457 </indexterm>
42458 </para>
42459 <informaltable frame="all">
42460 <tgroup cols="4" colsep="0" rowsep="0">
42461 <colspec colwidth="8*" align="left"/>
42462 <colspec colwidth="6*" align="center"/>
42463 <colspec colwidth="6*" align="center"/>
42464 <colspec colwidth="6*" align="right"/>
42465 <tbody>
42466 <row>
42467 <entry><option>owngroups</option></entry>
42468 <entry>Use: <emphasis>redirect</emphasis></entry>
42469 <entry>Type: <emphasis>string list</emphasis></entry>
42470 <entry>Default: <emphasis>unset</emphasis></entry>
42471 </row>
42472 </tbody>
42473 </tgroup>
42474 </informaltable>
42475 <para>
42476 This specifies a list of permitted groups for the file specified by <option>file</option>.
42477 The list is in addition to the local user&#x2019;s primary group when
42478 <option>check_local_user</option> is set. See <option>check_group</option> above.
42479 </para>
42480 <para>
42481 <indexterm role="option">
42482 <primary><option>pipe_transport</option></primary>
42483 </indexterm>
42484 </para>
42485 <informaltable frame="all">
42486 <tgroup cols="4" colsep="0" rowsep="0">
42487 <colspec colwidth="8*" align="left"/>
42488 <colspec colwidth="6*" align="center"/>
42489 <colspec colwidth="6*" align="center"/>
42490 <colspec colwidth="6*" align="right"/>
42491 <tbody>
42492 <row>
42493 <entry><option>pipe_transport</option></entry>
42494 <entry>Use: <emphasis>redirect</emphasis></entry>
42495 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42496 <entry>Default: <emphasis>unset</emphasis></entry>
42497 </row>
42498 </tbody>
42499 </tgroup>
42500 </informaltable>
42501 <para>
42502 <indexterm role="variable">
42503 <primary><varname>$address_pipe</varname></primary>
42504 </indexterm>
42505 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
42506 starting with a vertical bar character is specified as a new <quote>address</quote>. The
42507 transport used is specified by this option, which, after expansion, must be the
42508 name of a configured transport. This should normally be a <command>pipe</command> transport.
42509 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
42510 </para>
42511 <para>
42512 <indexterm role="option">
42513 <primary><option>qualify_domain</option></primary>
42514 </indexterm>
42515 </para>
42516 <informaltable frame="all">
42517 <tgroup cols="4" colsep="0" rowsep="0">
42518 <colspec colwidth="8*" align="left"/>
42519 <colspec colwidth="6*" align="center"/>
42520 <colspec colwidth="6*" align="center"/>
42521 <colspec colwidth="6*" align="right"/>
42522 <tbody>
42523 <row>
42524 <entry><option>qualify_domain</option></entry>
42525 <entry>Use: <emphasis>redirect</emphasis></entry>
42526 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42527 <entry>Default: <emphasis>unset</emphasis></entry>
42528 </row>
42529 </tbody>
42530 </tgroup>
42531 </informaltable>
42532 <para>
42533 <indexterm role="variable">
42534 <primary><varname>$qualify_recipient</varname></primary>
42535 </indexterm>
42536 If this option is set, and an unqualified address (one without a domain) is
42537 generated, and that address would normally be qualified by the global setting
42538 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
42539 expanding this string. If the expansion fails, the router declines. If you want
42540 to revert to the default, you can have the expansion generate
42541 <varname>$qualify_recipient</varname>.
42542 </para>
42543 <para>
42544 This option applies to all unqualified addresses generated by Exim filters,
42545 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
42546 not preceded by a backslash. Sieve filters cannot generate unqualified
42547 addresses.
42548 </para>
42549 <para>
42550 <indexterm role="option">
42551 <primary><option>qualify_preserve_domain</option></primary>
42552 </indexterm>
42553 </para>
42554 <informaltable frame="all">
42555 <tgroup cols="4" colsep="0" rowsep="0">
42556 <colspec colwidth="8*" align="left"/>
42557 <colspec colwidth="6*" align="center"/>
42558 <colspec colwidth="6*" align="center"/>
42559 <colspec colwidth="6*" align="right"/>
42560 <tbody>
42561 <row>
42562 <entry><option>qualify_preserve_domain</option></entry>
42563 <entry>Use: <emphasis>redirect</emphasis></entry>
42564 <entry>Type: <emphasis>boolean</emphasis></entry>
42565 <entry>Default: <emphasis>false</emphasis></entry>
42566 </row>
42567 </tbody>
42568 </tgroup>
42569 </informaltable>
42570 <para>
42571 <indexterm role="concept">
42572 <primary>domain</primary>
42573 <secondary>in redirection; preserving</secondary>
42574 </indexterm>
42575 <indexterm role="concept">
42576 <primary>preserving domain in redirection</primary>
42577 </indexterm>
42578 <indexterm role="concept">
42579 <primary>address redirection</primary>
42580 <secondary>domain; preserving</secondary>
42581 </indexterm>
42582 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
42583 set (a configuration error occurs if it is). If an unqualified address (one
42584 without a domain) is generated, it is qualified with the domain of the parent
42585 address (the immediately preceding ancestor) instead of the global
42586 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
42587 this applies whether or not the address is preceded by a backslash.
42588 </para>
42589 <para>
42590 <indexterm role="option">
42591 <primary><option>repeat_use</option></primary>
42592 </indexterm>
42593 </para>
42594 <informaltable frame="all">
42595 <tgroup cols="4" colsep="0" rowsep="0">
42596 <colspec colwidth="8*" align="left"/>
42597 <colspec colwidth="6*" align="center"/>
42598 <colspec colwidth="6*" align="center"/>
42599 <colspec colwidth="6*" align="right"/>
42600 <tbody>
42601 <row>
42602 <entry><option>repeat_use</option></entry>
42603 <entry>Use: <emphasis>redirect</emphasis></entry>
42604 <entry>Type: <emphasis>boolean</emphasis></entry>
42605 <entry>Default: <emphasis>true</emphasis></entry>
42606 </row>
42607 </tbody>
42608 </tgroup>
42609 </informaltable>
42610 <para>
42611 If this option is set false, the router is skipped for a child address that has
42612 any ancestor that was routed by this router. This test happens before any of
42613 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
42614 only when the ancestor is the same as the current address. See also
42615 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
42616 </para>
42617 <para>
42618 <indexterm role="option">
42619 <primary><option>reply_transport</option></primary>
42620 </indexterm>
42621 </para>
42622 <informaltable frame="all">
42623 <tgroup cols="4" colsep="0" rowsep="0">
42624 <colspec colwidth="8*" align="left"/>
42625 <colspec colwidth="6*" align="center"/>
42626 <colspec colwidth="6*" align="center"/>
42627 <colspec colwidth="6*" align="right"/>
42628 <tbody>
42629 <row>
42630 <entry><option>reply_transport</option></entry>
42631 <entry>Use: <emphasis>redirect</emphasis></entry>
42632 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42633 <entry>Default: <emphasis>unset</emphasis></entry>
42634 </row>
42635 </tbody>
42636 </tgroup>
42637 </informaltable>
42638 <para>
42639 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
42640 <option>vacation</option> command is used in a filter file. The transport used is specified
42641 by this option, which, after expansion, must be the name of a configured
42642 transport. This should normally be an <command>autoreply</command> transport. Other transports
42643 are unlikely to do anything sensible or useful.
42644 </para>
42645 <para>
42646 <indexterm role="option">
42647 <primary><option>rewrite</option></primary>
42648 </indexterm>
42649 </para>
42650 <informaltable frame="all">
42651 <tgroup cols="4" colsep="0" rowsep="0">
42652 <colspec colwidth="8*" align="left"/>
42653 <colspec colwidth="6*" align="center"/>
42654 <colspec colwidth="6*" align="center"/>
42655 <colspec colwidth="6*" align="right"/>
42656 <tbody>
42657 <row>
42658 <entry><option>rewrite</option></entry>
42659 <entry>Use: <emphasis>redirect</emphasis></entry>
42660 <entry>Type: <emphasis>boolean</emphasis></entry>
42661 <entry>Default: <emphasis>true</emphasis></entry>
42662 </row>
42663 </tbody>
42664 </tgroup>
42665 </informaltable>
42666 <para>
42667 <indexterm role="concept">
42668 <primary>address redirection</primary>
42669 <secondary>disabling rewriting</secondary>
42670 </indexterm>
42671 If this option is set false, addresses generated by the router are not
42672 subject to address rewriting. Otherwise, they are treated like new addresses
42673 and are rewritten according to the global rewriting rules.
42674 </para>
42675 <para>
42676 <indexterm role="option">
42677 <primary><option>sieve_subaddress</option></primary>
42678 </indexterm>
42679 </para>
42680 <informaltable frame="all">
42681 <tgroup cols="4" colsep="0" rowsep="0">
42682 <colspec colwidth="8*" align="left"/>
42683 <colspec colwidth="6*" align="center"/>
42684 <colspec colwidth="6*" align="center"/>
42685 <colspec colwidth="6*" align="right"/>
42686 <tbody>
42687 <row>
42688 <entry><option>sieve_subaddress</option></entry>
42689 <entry>Use: <emphasis>redirect</emphasis></entry>
42690 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42691 <entry>Default: <emphasis>unset</emphasis></entry>
42692 </row>
42693 </tbody>
42694 </tgroup>
42695 </informaltable>
42696 <para>
42697 The value of this option is passed to a Sieve filter to specify the
42698 :subaddress part of an address.
42699 </para>
42700 <para>
42701 <indexterm role="option">
42702 <primary><option>sieve_useraddress</option></primary>
42703 </indexterm>
42704 </para>
42705 <informaltable frame="all">
42706 <tgroup cols="4" colsep="0" rowsep="0">
42707 <colspec colwidth="8*" align="left"/>
42708 <colspec colwidth="6*" align="center"/>
42709 <colspec colwidth="6*" align="center"/>
42710 <colspec colwidth="6*" align="right"/>
42711 <tbody>
42712 <row>
42713 <entry><option>sieve_useraddress</option></entry>
42714 <entry>Use: <emphasis>redirect</emphasis></entry>
42715 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42716 <entry>Default: <emphasis>unset</emphasis></entry>
42717 </row>
42718 </tbody>
42719 </tgroup>
42720 </informaltable>
42721 <para>
42722 The value of this option is passed to a Sieve filter to specify the :user part
42723 of an address. However, if it is unset, the entire original local part
42724 (including any prefix or suffix) is used for :user.
42725 </para>
42726 <para>
42727 <indexterm role="option">
42728 <primary><option>sieve_vacation_directory</option></primary>
42729 </indexterm>
42730 </para>
42731 <informaltable frame="all">
42732 <tgroup cols="4" colsep="0" rowsep="0">
42733 <colspec colwidth="8*" align="left"/>
42734 <colspec colwidth="6*" align="center"/>
42735 <colspec colwidth="6*" align="center"/>
42736 <colspec colwidth="6*" align="right"/>
42737 <tbody>
42738 <row>
42739 <entry><option>sieve_vacation_directory</option></entry>
42740 <entry>Use: <emphasis>redirect</emphasis></entry>
42741 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42742 <entry>Default: <emphasis>unset</emphasis></entry>
42743 </row>
42744 </tbody>
42745 </tgroup>
42746 </informaltable>
42747 <para>
42748 <indexterm role="concept">
42749 <primary>Sieve filter</primary>
42750 <secondary>vacation directory</secondary>
42751 </indexterm>
42752 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
42753 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
42754 (do not put anything else in that directory), and ensure that the
42755 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
42756 needs their own directory; Exim will create it if necessary.
42757 </para>
42758 <para>
42759 <indexterm role="option">
42760 <primary><option>skip_syntax_errors</option></primary>
42761 </indexterm>
42762 </para>
42763 <informaltable frame="all">
42764 <tgroup cols="4" colsep="0" rowsep="0">
42765 <colspec colwidth="8*" align="left"/>
42766 <colspec colwidth="6*" align="center"/>
42767 <colspec colwidth="6*" align="center"/>
42768 <colspec colwidth="6*" align="right"/>
42769 <tbody>
42770 <row>
42771 <entry><option>skip_syntax_errors</option></entry>
42772 <entry>Use: <emphasis>redirect</emphasis></entry>
42773 <entry>Type: <emphasis>boolean</emphasis></entry>
42774 <entry>Default: <emphasis>false</emphasis></entry>
42775 </row>
42776 </tbody>
42777 </tgroup>
42778 </informaltable>
42779 <para>
42780 <indexterm role="concept">
42781 <primary>forward file</primary>
42782 <secondary>broken</secondary>
42783 </indexterm>
42784 <indexterm role="concept">
42785 <primary>address redirection</primary>
42786 <secondary>broken files</secondary>
42787 </indexterm>
42788 <indexterm role="concept">
42789 <primary>alias file</primary>
42790 <secondary>broken</secondary>
42791 </indexterm>
42792 <indexterm role="concept">
42793 <primary>broken alias or forward files</primary>
42794 </indexterm>
42795 <indexterm role="concept">
42796 <primary>ignoring faulty addresses</primary>
42797 </indexterm>
42798 <indexterm role="concept">
42799 <primary>skipping faulty addresses</primary>
42800 </indexterm>
42801 <indexterm role="concept">
42802 <primary>error</primary>
42803 <secondary>skipping bad syntax</secondary>
42804 </indexterm>
42805 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
42806 non-filter redirection data are skipped, and each failing address is logged. If
42807 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
42808 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
42809 are expanded and placed at the head of the error message generated by
42810 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
42811 be the same address as the generic <option>errors_to</option> option. The
42812 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
42813 </para>
42814 <para>
42815 If all the addresses in a redirection list are skipped because of syntax
42816 errors, the router declines to handle the original address, and it is passed to
42817 the following routers.
42818 </para>
42819 <para>
42820 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
42821 error in the filter causes filtering to be abandoned without any action being
42822 taken. The incident is logged, and the router declines to handle the address,
42823 so it is passed to the following routers.
42824 </para>
42825 <para>
42826 <indexterm role="concept">
42827 <primary>Sieve filter</primary>
42828 <secondary>syntax errors in</secondary>
42829 </indexterm>
42830 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
42831 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
42832 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
42833 </para>
42834 <para>
42835 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
42836 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
42837 option, used with an address that does not get redirected, can be used to
42838 notify users of these errors, by means of a router like this:
42839 </para>
42840 <literallayout class="monospaced">
42841 userforward:
42842   driver = redirect
42843   allow_filter
42844   check_local_user
42845   file = $home/.forward
42846   file_transport = address_file
42847   pipe_transport = address_pipe
42848   reply_transport = address_reply
42849   no_verify
42850   skip_syntax_errors
42851   syntax_errors_to = real-$local_part@$domain
42852   syntax_errors_text = \
42853    This is an automatically generated message. An error has\n\
42854    been found in your .forward file. Details of the error are\n\
42855    reported below. While this error persists, you will receive\n\
42856    a copy of this message for every message that is addressed\n\
42857    to you. If your .forward file is a filter file, or if it is\n\
42858    a non-filter file containing no valid forwarding addresses,\n\
42859    a copy of each incoming message will be put in your normal\n\
42860    mailbox. If a non-filter file contains at least one valid\n\
42861    forwarding address, forwarding to the valid addresses will\n\
42862    happen, and those will be the only deliveries that occur.
42863 </literallayout>
42864 <para>
42865 You also need a router to ensure that local addresses that are prefixed by
42866 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
42867 put this immediately before the <command>userforward</command> router:
42868 </para>
42869 <literallayout class="monospaced">
42870 real_localuser:
42871   driver = accept
42872   check_local_user
42873   local_part_prefix = real-
42874   transport = local_delivery
42875 </literallayout>
42876 <para>
42877 For security, it would probably be a good idea to restrict the use of this
42878 router to locally-generated messages, using a condition such as this:
42879 </para>
42880 <literallayout class="monospaced">
42881   condition = ${if match {$sender_host_address}\
42882                          {\N^(|127\.0\.0\.1)$\N}}
42883 </literallayout>
42884 <para>
42885 <indexterm role="option">
42886 <primary><option>syntax_errors_text</option></primary>
42887 </indexterm>
42888 </para>
42889 <informaltable frame="all">
42890 <tgroup cols="4" colsep="0" rowsep="0">
42891 <colspec colwidth="8*" align="left"/>
42892 <colspec colwidth="6*" align="center"/>
42893 <colspec colwidth="6*" align="center"/>
42894 <colspec colwidth="6*" align="right"/>
42895 <tbody>
42896 <row>
42897 <entry><option>syntax_errors_text</option></entry>
42898 <entry>Use: <emphasis>redirect</emphasis></entry>
42899 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42900 <entry>Default: <emphasis>unset</emphasis></entry>
42901 </row>
42902 </tbody>
42903 </tgroup>
42904 </informaltable>
42905 <para>
42906 See <option>skip_syntax_errors</option> above.
42907 </para>
42908 <para>
42909 <indexterm role="option">
42910 <primary><option>syntax_errors_to</option></primary>
42911 </indexterm>
42912 </para>
42913 <informaltable frame="all">
42914 <tgroup cols="4" colsep="0" rowsep="0">
42915 <colspec colwidth="8*" align="left"/>
42916 <colspec colwidth="6*" align="center"/>
42917 <colspec colwidth="6*" align="center"/>
42918 <colspec colwidth="6*" align="right"/>
42919 <tbody>
42920 <row>
42921 <entry><option>syntax_errors_to</option></entry>
42922 <entry>Use: <emphasis>redirect</emphasis></entry>
42923 <entry>Type: <emphasis>string</emphasis></entry>
42924 <entry>Default: <emphasis>unset</emphasis></entry>
42925 </row>
42926 </tbody>
42927 </tgroup>
42928 </informaltable>
42929 <para>
42930 See <option>skip_syntax_errors</option> above.
42931 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
42932 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
42933 </para>
42934 </section>
42935 </chapter>
42936
42937 <chapter id="CHAPenvironment">
42938 <title>Environment for running local transports</title>
42939 <titleabbrev>Environment for local transports</titleabbrev>
42940 <para>
42941 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
42942 <primary>local transports</primary>
42943 <secondary>environment for</secondary>
42944 </indexterm>
42945 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
42946 <primary>environment</primary>
42947 <secondary>local transports</secondary>
42948 </indexterm>
42949 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
42950 <primary>transport</primary>
42951 <secondary>local; environment for</secondary>
42952 </indexterm>
42953 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
42954 transport can be thought of as similar to a pipe.) Exim always runs transports
42955 in subprocesses, under specified uids and gids. Typical deliveries to local
42956 mailboxes run under the uid and gid of the local user.
42957 </para>
42958 <para>
42959 Exim also sets a specific current directory while running the transport; for
42960 some transports a home directory setting is also relevant. The <command>pipe</command>
42961 transport is the only one that sets up environment variables; see section
42962 <xref linkend="SECTpipeenv"/> for details.
42963 </para>
42964 <para>
42965 The values used for the uid, gid, and the directories may come from several
42966 different places. In many cases, the router that handles the address associates
42967 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
42968 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
42969 configuration, and these override anything that comes from the router.
42970 </para>
42971 <section id="SECID131">
42972 <title>Concurrent deliveries</title>
42973 <para>
42974 <indexterm role="concept">
42975 <primary>concurrent deliveries</primary>
42976 </indexterm>
42977 <indexterm role="concept">
42978 <primary>simultaneous deliveries</primary>
42979 </indexterm>
42980 If two different messages for the same local recipient arrive more or less
42981 simultaneously, the two delivery processes are likely to run concurrently. When
42982 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
42983 rules to stop concurrent processes from writing to the same file at the same
42984 time.
42985 </para>
42986 <para>
42987 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
42988 locking that is needed. Here is a silly example:
42989 </para>
42990 <literallayout class="monospaced">
42991 my_transport:
42992   driver = pipe
42993   command = /bin/sh -c 'cat &gt;&gt;/some/file'
42994 </literallayout>
42995 <para>
42996 This is supposed to write the message at the end of the file. However, if two
42997 messages arrive at the same time, the file will be scrambled. You can use the
42998 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
42999 file using the same algorithm that Exim itself uses.
43000 </para>
43001 </section>
43002 <section id="SECTenvuidgid">
43003 <title>Uids and gids</title>
43004 <para>
43005 <indexterm role="concept">
43006 <primary>local transports</primary>
43007 <secondary>uid and gid</secondary>
43008 </indexterm>
43009 <indexterm role="concept">
43010 <primary>transport</primary>
43011 <secondary>local; uid and gid</secondary>
43012 </indexterm>
43013 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
43014 overrides any group that the router set in the address, even if <option>user</option> is not
43015 set for the transport. This makes it possible, for example, to run local mail
43016 delivery under the uid of the recipient (set by the router), but in a special
43017 group (set by the transport). For example:
43018 </para>
43019 <literallayout class="monospaced">
43020 # Routers ...
43021 # User/group are set by check_local_user in this router
43022 local_users:
43023   driver = accept
43024   check_local_user
43025   transport = group_delivery
43026
43027 # Transports ...
43028 # This transport overrides the group
43029 group_delivery:
43030   driver = appendfile
43031   file = /var/spool/mail/$local_part_data
43032   group = mail
43033 </literallayout>
43034 <para>
43035 If <option>user</option> is set for a transport, its value overrides what is set in the
43036 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
43037 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
43038 set.
43039 </para>
43040 <para>
43041 <indexterm role="option">
43042 <primary><option>initgroups</option></primary>
43043 </indexterm>
43044 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
43045 function is called for the groups associated with that uid if the
43046 <option>initgroups</option> option is set for the transport. When the uid is not specified
43047 by the transport, but is associated with the address by a router, the option
43048 for calling <function>initgroups()</function> is taken from the router configuration.
43049 </para>
43050 <para>
43051 <indexterm role="concept">
43052 <primary><command>pipe</command> transport</primary>
43053 <secondary>uid for</secondary>
43054 </indexterm>
43055 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
43056 is set and <option>user</option> is not set, the uid of the process that called Exim to
43057 receive the message is used, and if <option>group</option> is not set, the corresponding
43058 original gid is also used.
43059 </para>
43060 <para>
43061 This is the detailed preference order for obtaining a gid; the first of the
43062 following that is set is used:
43063 </para>
43064 <itemizedlist>
43065 <listitem>
43066 <para>
43067 A <option>group</option> setting of the transport;
43068 </para>
43069 </listitem>
43070 <listitem>
43071 <para>
43072 A <option>group</option> setting of the router;
43073 </para>
43074 </listitem>
43075 <listitem>
43076 <para>
43077 A gid associated with a user setting of the router, either as a result of
43078 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
43079 </para>
43080 </listitem>
43081 <listitem>
43082 <para>
43083 The group associated with a non-numeric <option>user</option> setting of the transport;
43084 </para>
43085 </listitem>
43086 <listitem>
43087 <para>
43088 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
43089 the uid is the creator&#x2019;s uid;
43090 </para>
43091 </listitem>
43092 <listitem>
43093 <para>
43094 The Exim gid if the Exim uid is being used as a default.
43095 </para>
43096 </listitem>
43097 </itemizedlist>
43098 <para>
43099 If, for example, the user is specified numerically on the router and there are
43100 no group settings, no gid is available. In this situation, an error occurs.
43101 This is different for the uid, for which there always is an ultimate default.
43102 The first of the following that is set is used:
43103 </para>
43104 <itemizedlist>
43105 <listitem>
43106 <para>
43107 A <option>user</option> setting of the transport;
43108 </para>
43109 </listitem>
43110 <listitem>
43111 <para>
43112 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
43113 </para>
43114 </listitem>
43115 <listitem>
43116 <para>
43117 A <option>user</option> setting of the router;
43118 </para>
43119 </listitem>
43120 <listitem>
43121 <para>
43122 A <option>check_local_user</option> setting of the router;
43123 </para>
43124 </listitem>
43125 <listitem>
43126 <para>
43127 The Exim uid.
43128 </para>
43129 </listitem>
43130 </itemizedlist>
43131 <para>
43132 Of course, an error will still occur if the uid that is chosen is on the
43133 <option>never_users</option> list.
43134 </para>
43135 </section>
43136 <section id="SECID132">
43137 <title>Current and home directories</title>
43138 <para>
43139 <indexterm role="concept">
43140 <primary>current directory for local transport</primary>
43141 </indexterm>
43142 <indexterm role="concept">
43143 <primary>home directory</primary>
43144 <secondary>for local transport</secondary>
43145 </indexterm>
43146 <indexterm role="concept">
43147 <primary>transport</primary>
43148 <secondary>local; home directory for</secondary>
43149 </indexterm>
43150 <indexterm role="concept">
43151 <primary>transport</primary>
43152 <secondary>local; current directory for</secondary>
43153 </indexterm>
43154 Routers may set current and home directories for local transports by means of
43155 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
43156 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
43157 are set, they override the router&#x2019;s values. In detail, the home directory
43158 for a local transport is taken from the first of these values that is set:
43159 </para>
43160 <itemizedlist>
43161 <listitem>
43162 <para>
43163 The <option>home_directory</option> option on the transport;
43164 </para>
43165 </listitem>
43166 <listitem>
43167 <para>
43168 The <option>transport_home_directory</option> option on the router;
43169 </para>
43170 </listitem>
43171 <listitem>
43172 <para>
43173 The password data if <option>check_local_user</option> is set on the router;
43174 </para>
43175 </listitem>
43176 <listitem>
43177 <para>
43178 The <option>router_home_directory</option> option on the router.
43179 </para>
43180 </listitem>
43181 </itemizedlist>
43182 <para>
43183 The current directory is taken from the first of these values that is set:
43184 </para>
43185 <itemizedlist>
43186 <listitem>
43187 <para>
43188 The <option>current_directory</option> option on the transport;
43189 </para>
43190 </listitem>
43191 <listitem>
43192 <para>
43193 The <option>transport_current_directory</option> option on the router.
43194 </para>
43195 </listitem>
43196 </itemizedlist>
43197 <para>
43198 If neither the router nor the transport sets a current directory, Exim uses the
43199 value of the home directory, if it is set. Otherwise it sets the current
43200 directory to <filename>/</filename> before running a local transport.
43201 </para>
43202 </section>
43203 <section id="SECID133">
43204 <title>Expansion variables derived from the address</title>
43205 <para>
43206 <indexterm role="variable">
43207 <primary><varname>$domain</varname></primary>
43208 </indexterm>
43209 <indexterm role="variable">
43210 <primary><varname>$local_part</varname></primary>
43211 </indexterm>
43212 <indexterm role="variable">
43213 <primary><varname>$original_domain</varname></primary>
43214 </indexterm>
43215 Normally a local delivery is handling a single address, and in that case the
43216 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
43217 deliveries. However, in some circumstances more than one address may be handled
43218 at once (for example, while writing batch SMTP for onward transmission by some
43219 other means). In this case, the variables associated with the local part are
43220 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
43221 and <varname>$original_domain</varname> is never set.
43222 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
43223 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
43224 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
43225 </para>
43226 </section>
43227 </chapter>
43228
43229 <chapter id="CHAPtransportgeneric">
43230 <title>Generic options for transports</title>
43231 <para>
43232 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
43233 <primary>generic options</primary>
43234 <secondary>transport</secondary>
43235 </indexterm>
43236 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
43237 <primary>options</primary>
43238 <secondary>generic; for transports</secondary>
43239 </indexterm>
43240 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
43241 <primary>transport</primary>
43242 <secondary>generic options for</secondary>
43243 </indexterm>
43244 The name of a transport is limited to be 64 ASCII characters long;
43245 prior to Exim 4.95 names would be silently truncated at this length, but now
43246 it is enforced.
43247 </para>
43248 <para>
43249 The following generic options apply to all transports:
43250 </para>
43251 <para>
43252 <indexterm role="option">
43253 <primary><option>body_only</option></primary>
43254 </indexterm>
43255 </para>
43256 <informaltable frame="all">
43257 <tgroup cols="4" colsep="0" rowsep="0">
43258 <colspec colwidth="8*" align="left"/>
43259 <colspec colwidth="6*" align="center"/>
43260 <colspec colwidth="6*" align="center"/>
43261 <colspec colwidth="6*" align="right"/>
43262 <tbody>
43263 <row>
43264 <entry><option>body_only</option></entry>
43265 <entry>Use: <emphasis>transports</emphasis></entry>
43266 <entry>Type: <emphasis>boolean</emphasis></entry>
43267 <entry>Default: <emphasis>false</emphasis></entry>
43268 </row>
43269 </tbody>
43270 </tgroup>
43271 </informaltable>
43272 <para>
43273 <indexterm role="concept">
43274 <primary>transport</primary>
43275 <secondary>body only</secondary>
43276 </indexterm>
43277 <indexterm role="concept">
43278 <primary>message</primary>
43279 <secondary>transporting body only</secondary>
43280 </indexterm>
43281 <indexterm role="concept">
43282 <primary>body of message</primary>
43283 <secondary>transporting</secondary>
43284 </indexterm>
43285 If this option is set, the message&#x2019;s headers are not transported. It is
43286 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
43287 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
43288 <option>message_suffix</option> should be checked, because this option does not
43289 automatically suppress them.
43290 </para>
43291 <para>
43292 <indexterm role="option">
43293 <primary><option>current_directory</option></primary>
43294 </indexterm>
43295 </para>
43296 <informaltable frame="all">
43297 <tgroup cols="4" colsep="0" rowsep="0">
43298 <colspec colwidth="8*" align="left"/>
43299 <colspec colwidth="6*" align="center"/>
43300 <colspec colwidth="6*" align="center"/>
43301 <colspec colwidth="6*" align="right"/>
43302 <tbody>
43303 <row>
43304 <entry><option>current_directory</option></entry>
43305 <entry>Use: <emphasis>transports</emphasis></entry>
43306 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43307 <entry>Default: <emphasis>unset</emphasis></entry>
43308 </row>
43309 </tbody>
43310 </tgroup>
43311 </informaltable>
43312 <para>
43313 <indexterm role="concept">
43314 <primary>transport</primary>
43315 <secondary>current directory for</secondary>
43316 </indexterm>
43317 This specifies the current directory that is to be set while running the
43318 transport, overriding any value that may have been set by the router.
43319 If the expansion fails for any reason, including forced failure, an error is
43320 logged, and delivery is deferred.
43321 </para>
43322 <para>
43323 <indexterm role="option">
43324 <primary><option>disable_logging</option></primary>
43325 </indexterm>
43326 </para>
43327 <informaltable frame="all">
43328 <tgroup cols="4" colsep="0" rowsep="0">
43329 <colspec colwidth="8*" align="left"/>
43330 <colspec colwidth="6*" align="center"/>
43331 <colspec colwidth="6*" align="center"/>
43332 <colspec colwidth="6*" align="right"/>
43333 <tbody>
43334 <row>
43335 <entry><option>disable_logging</option></entry>
43336 <entry>Use: <emphasis>transports</emphasis></entry>
43337 <entry>Type: <emphasis>boolean</emphasis></entry>
43338 <entry>Default: <emphasis>false</emphasis></entry>
43339 </row>
43340 </tbody>
43341 </tgroup>
43342 </informaltable>
43343 <para>
43344 If this option is set true, nothing is logged for any
43345 deliveries by the transport or for any
43346 transport errors. You should not set this option unless you really, really know
43347 what you are doing.
43348 </para>
43349 <para>
43350 <indexterm role="option">
43351 <primary><option>debug_print</option></primary>
43352 </indexterm>
43353 </para>
43354 <informaltable frame="all">
43355 <tgroup cols="4" colsep="0" rowsep="0">
43356 <colspec colwidth="8*" align="left"/>
43357 <colspec colwidth="6*" align="center"/>
43358 <colspec colwidth="6*" align="center"/>
43359 <colspec colwidth="6*" align="right"/>
43360 <tbody>
43361 <row>
43362 <entry><option>debug_print</option></entry>
43363 <entry>Use: <emphasis>transports</emphasis></entry>
43364 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43365 <entry>Default: <emphasis>unset</emphasis></entry>
43366 </row>
43367 </tbody>
43368 </tgroup>
43369 </informaltable>
43370 <para>
43371 <indexterm role="concept">
43372 <primary>testing</primary>
43373 <secondary>variables in drivers</secondary>
43374 </indexterm>
43375 If this option is set and debugging is enabled (see the <option>-d</option> command line
43376 option), the string is expanded and included in the debugging output when the
43377 transport is run.
43378 If expansion of the string fails, the error message is written to the debugging
43379 output, and Exim carries on processing.
43380 This facility is provided to help with checking out the values of variables and
43381 so on when debugging driver configurations. For example, if a <option>headers_add</option>
43382 option is not working properly, <option>debug_print</option> could be used to output the
43383 variables it references. A newline is added to the text if it does not end with
43384 one.
43385 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
43386 transport and the router that called it.
43387 </para>
43388 <para>
43389 <indexterm role="option">
43390 <primary><option>delivery_date_add</option></primary>
43391 </indexterm>
43392 </para>
43393 <informaltable frame="all">
43394 <tgroup cols="4" colsep="0" rowsep="0">
43395 <colspec colwidth="8*" align="left"/>
43396 <colspec colwidth="6*" align="center"/>
43397 <colspec colwidth="6*" align="center"/>
43398 <colspec colwidth="6*" align="right"/>
43399 <tbody>
43400 <row>
43401 <entry><option>delivery_date_add</option></entry>
43402 <entry>Use: <emphasis>transports</emphasis></entry>
43403 <entry>Type: <emphasis>boolean</emphasis></entry>
43404 <entry>Default: <emphasis>false</emphasis></entry>
43405 </row>
43406 </tbody>
43407 </tgroup>
43408 </informaltable>
43409 <para>
43410 <indexterm role="concept">
43411 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
43412 </indexterm>
43413 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
43414 This gives the actual time the delivery was made. As this is not a standard
43415 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
43416 requests its removal from incoming messages, so that delivered messages can
43417 safely be resent to other recipients.
43418 </para>
43419 <para>
43420 <indexterm role="option">
43421 <primary><option>driver</option></primary>
43422 </indexterm>
43423 </para>
43424 <informaltable frame="all">
43425 <tgroup cols="4" colsep="0" rowsep="0">
43426 <colspec colwidth="8*" align="left"/>
43427 <colspec colwidth="6*" align="center"/>
43428 <colspec colwidth="6*" align="center"/>
43429 <colspec colwidth="6*" align="right"/>
43430 <tbody>
43431 <row>
43432 <entry><option>driver</option></entry>
43433 <entry>Use: <emphasis>transports</emphasis></entry>
43434 <entry>Type: <emphasis>string</emphasis></entry>
43435 <entry>Default: <emphasis>unset</emphasis></entry>
43436 </row>
43437 </tbody>
43438 </tgroup>
43439 </informaltable>
43440 <para>
43441 This specifies which of the available transport drivers is to be used.
43442 There is no default, and this option must be set for every transport.
43443 </para>
43444 <para>
43445 <indexterm role="option">
43446 <primary><option>envelope_to_add</option></primary>
43447 </indexterm>
43448 </para>
43449 <informaltable frame="all">
43450 <tgroup cols="4" colsep="0" rowsep="0">
43451 <colspec colwidth="8*" align="left"/>
43452 <colspec colwidth="6*" align="center"/>
43453 <colspec colwidth="6*" align="center"/>
43454 <colspec colwidth="6*" align="right"/>
43455 <tbody>
43456 <row>
43457 <entry><option>envelope_to_add</option></entry>
43458 <entry>Use: <emphasis>transports</emphasis></entry>
43459 <entry>Type: <emphasis>boolean</emphasis></entry>
43460 <entry>Default: <emphasis>false</emphasis></entry>
43461 </row>
43462 </tbody>
43463 </tgroup>
43464 </informaltable>
43465 <para>
43466 <indexterm role="concept">
43467 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
43468 </indexterm>
43469 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
43470 This gives the original address(es) in the incoming envelope that caused this
43471 delivery to happen. More than one address may be present if the transport is
43472 configured to handle several addresses at once, or if more than one original
43473 address was redirected to the same final address. As this is not a standard
43474 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
43475 its removal from incoming messages, so that delivered messages can safely be
43476 resent to other recipients.
43477 </para>
43478 <para>
43479 <emphasis role="bold">Note:</emphasis> If used on a transport handling multiple recipients
43480 (the smtp transport unless <option>max_rcpt</option> is 1, the appendfile, pipe or lmtp
43481 transport if <option>batch_max</option> is greater than 1)
43482 then information about Bcc recipients will be leaked.
43483 Doing so is generally not advised.
43484 </para>
43485 <para>
43486 <indexterm role="option">
43487 <primary><option>event_action</option></primary>
43488 </indexterm>
43489 </para>
43490 <informaltable frame="all">
43491 <tgroup cols="4" colsep="0" rowsep="0">
43492 <colspec colwidth="8*" align="left"/>
43493 <colspec colwidth="6*" align="center"/>
43494 <colspec colwidth="6*" align="center"/>
43495 <colspec colwidth="6*" align="right"/>
43496 <tbody>
43497 <row>
43498 <entry><option>event_action</option></entry>
43499 <entry>Use: <emphasis>transports</emphasis></entry>
43500 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43501 <entry>Default: <emphasis>unset</emphasis></entry>
43502 </row>
43503 </tbody>
43504 </tgroup>
43505 </informaltable>
43506 <para>
43507 <indexterm role="concept">
43508 <primary>events</primary>
43509 </indexterm>
43510 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
43511 For details see chapter <xref linkend="CHAPevents"/>.
43512 </para>
43513 <para>
43514 <indexterm role="option">
43515 <primary><option>group</option></primary>
43516 </indexterm>
43517 </para>
43518 <informaltable frame="all">
43519 <tgroup cols="4" colsep="0" rowsep="0">
43520 <colspec colwidth="8*" align="left"/>
43521 <colspec colwidth="6*" align="center"/>
43522 <colspec colwidth="6*" align="center"/>
43523 <colspec colwidth="6*" align="right"/>
43524 <tbody>
43525 <row>
43526 <entry><option>group</option></entry>
43527 <entry>Use: <emphasis>transports</emphasis></entry>
43528 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43529 <entry>Default: <emphasis>Exim group</emphasis></entry>
43530 </row>
43531 </tbody>
43532 </tgroup>
43533 </informaltable>
43534 <para>
43535 <indexterm role="concept">
43536 <primary>transport</primary>
43537 <secondary>group; specifying</secondary>
43538 </indexterm>
43539 This option specifies a gid for running the transport process, overriding any
43540 value that the router supplies, and also overriding any value associated with
43541 <option>user</option> (see below).
43542 </para>
43543 <para>
43544 <indexterm role="option">
43545 <primary><option>headers_add</option></primary>
43546 </indexterm>
43547 </para>
43548 <informaltable frame="all">
43549 <tgroup cols="4" colsep="0" rowsep="0">
43550 <colspec colwidth="8*" align="left"/>
43551 <colspec colwidth="6*" align="center"/>
43552 <colspec colwidth="6*" align="center"/>
43553 <colspec colwidth="6*" align="right"/>
43554 <tbody>
43555 <row>
43556 <entry><option>headers_add</option></entry>
43557 <entry>Use: <emphasis>transports</emphasis></entry>
43558 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
43559 <entry>Default: <emphasis>unset</emphasis></entry>
43560 </row>
43561 </tbody>
43562 </tgroup>
43563 </informaltable>
43564 <para>
43565 <indexterm role="concept">
43566 <primary>header lines</primary>
43567 <secondary>adding in transport</secondary>
43568 </indexterm>
43569 <indexterm role="concept">
43570 <primary>transport</primary>
43571 <secondary>header lines; adding</secondary>
43572 </indexterm>
43573 This option specifies a list of text headers,
43574 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
43575 which are (separately) expanded and added to the header
43576 portion of a message as it is transported, as described in section
43577 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
43578 routers. If the result of the expansion is an empty string, or if the expansion
43579 is forced to fail, no action is taken. Other expansion failures are treated as
43580 errors and cause the delivery to be deferred.
43581 </para>
43582 <para>
43583 Unlike most options, <option>headers_add</option> can be specified multiple times
43584 for a transport; all listed headers are added.
43585 </para>
43586 <para>
43587 <indexterm role="option">
43588 <primary><option>headers_only</option></primary>
43589 </indexterm>
43590 </para>
43591 <informaltable frame="all">
43592 <tgroup cols="4" colsep="0" rowsep="0">
43593 <colspec colwidth="8*" align="left"/>
43594 <colspec colwidth="6*" align="center"/>
43595 <colspec colwidth="6*" align="center"/>
43596 <colspec colwidth="6*" align="right"/>
43597 <tbody>
43598 <row>
43599 <entry><option>headers_only</option></entry>
43600 <entry>Use: <emphasis>transports</emphasis></entry>
43601 <entry>Type: <emphasis>boolean</emphasis></entry>
43602 <entry>Default: <emphasis>false</emphasis></entry>
43603 </row>
43604 </tbody>
43605 </tgroup>
43606 </informaltable>
43607 <para>
43608 <indexterm role="concept">
43609 <primary>transport</primary>
43610 <secondary>header lines only</secondary>
43611 </indexterm>
43612 <indexterm role="concept">
43613 <primary>message</primary>
43614 <secondary>transporting headers only</secondary>
43615 </indexterm>
43616 <indexterm role="concept">
43617 <primary>header lines</primary>
43618 <secondary>transporting</secondary>
43619 </indexterm>
43620 If this option is set, the message&#x2019;s body is not transported. It is mutually
43621 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
43622 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
43623 checked, since this option does not automatically suppress them.
43624 </para>
43625 <para>
43626 <indexterm role="option">
43627 <primary><option>headers_remove</option></primary>
43628 </indexterm>
43629 </para>
43630 <informaltable frame="all">
43631 <tgroup cols="4" colsep="0" rowsep="0">
43632 <colspec colwidth="8*" align="left"/>
43633 <colspec colwidth="6*" align="center"/>
43634 <colspec colwidth="6*" align="center"/>
43635 <colspec colwidth="6*" align="right"/>
43636 <tbody>
43637 <row>
43638 <entry><option>headers_remove</option></entry>
43639 <entry>Use: <emphasis>transports</emphasis></entry>
43640 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
43641 <entry>Default: <emphasis>unset</emphasis></entry>
43642 </row>
43643 </tbody>
43644 </tgroup>
43645 </informaltable>
43646 <para>
43647 <indexterm role="concept">
43648 <primary>header lines</primary>
43649 <secondary>removing</secondary>
43650 </indexterm>
43651 <indexterm role="concept">
43652 <primary>transport</primary>
43653 <secondary>header lines; removing</secondary>
43654 </indexterm>
43655 This option specifies a list of text headers,
43656 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
43657 to be removed from the message.
43658 However, the option has no effect when an address is just being verified.
43659 Each list item is separately expanded.
43660 If the result of the expansion is an empty string, or if the expansion
43661 is forced to fail, no action is taken. Other expansion failures are treated as
43662 errors and cause the delivery to be deferred.
43663 If an item ends in *, it will match any header with the given prefix.
43664 </para>
43665 <para>
43666 Matching headers are omitted from the message as it is transported, as described
43667 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
43668 routers.
43669 </para>
43670 <para>
43671 Unlike most options, <option>headers_remove</option> can be specified multiple times
43672 for a transport; all listed headers are removed.
43673 </para>
43674 <para>
43675 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
43676 items that contain a list separator must have it doubled.
43677 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
43678 </para>
43679 <para>
43680 <indexterm role="option">
43681 <primary><option>headers_rewrite</option></primary>
43682 </indexterm>
43683 </para>
43684 <informaltable frame="all">
43685 <tgroup cols="4" colsep="0" rowsep="0">
43686 <colspec colwidth="8*" align="left"/>
43687 <colspec colwidth="6*" align="center"/>
43688 <colspec colwidth="6*" align="center"/>
43689 <colspec colwidth="6*" align="right"/>
43690 <tbody>
43691 <row>
43692 <entry><option>headers_rewrite</option></entry>
43693 <entry>Use: <emphasis>transports</emphasis></entry>
43694 <entry>Type: <emphasis>string</emphasis></entry>
43695 <entry>Default: <emphasis>unset</emphasis></entry>
43696 </row>
43697 </tbody>
43698 </tgroup>
43699 </informaltable>
43700 <para>
43701 <indexterm role="concept">
43702 <primary>transport</primary>
43703 <secondary>header lines; rewriting</secondary>
43704 </indexterm>
43705 <indexterm role="concept">
43706 <primary>rewriting</primary>
43707 <secondary>at transport time</secondary>
43708 </indexterm>
43709 This option allows addresses in header lines to be rewritten at transport time,
43710 that is, as the message is being copied to its destination. The contents of the
43711 option are a colon-separated list of rewriting rules. Each rule is in exactly
43712 the same form as one of the general rewriting rules that are applied when a
43713 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
43714 example,
43715 </para>
43716 <literallayout class="monospaced">
43717 headers_rewrite = a@b c@d f : \
43718                   x@y w@z
43719 </literallayout>
43720 <para>
43721 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
43722 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
43723 header lines just before they are written out at transport time, so they affect
43724 only those copies of the message that pass through the transport. However, only
43725 the message&#x2019;s original header lines, and any that were added by a system
43726 filter, are rewritten. If a router or transport adds header lines, they are not
43727 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
43728 envelope. You can change the return path using <option>return_path</option>, but you cannot
43729 change envelope recipients at this time.
43730 </para>
43731 <para>
43732 <indexterm role="option">
43733 <primary><option>home_directory</option></primary>
43734 </indexterm>
43735 </para>
43736 <informaltable frame="all">
43737 <tgroup cols="4" colsep="0" rowsep="0">
43738 <colspec colwidth="8*" align="left"/>
43739 <colspec colwidth="6*" align="center"/>
43740 <colspec colwidth="6*" align="center"/>
43741 <colspec colwidth="6*" align="right"/>
43742 <tbody>
43743 <row>
43744 <entry><option>home_directory</option></entry>
43745 <entry>Use: <emphasis>transports</emphasis></entry>
43746 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43747 <entry>Default: <emphasis>unset</emphasis></entry>
43748 </row>
43749 </tbody>
43750 </tgroup>
43751 </informaltable>
43752 <para>
43753 <indexterm role="concept">
43754 <primary>transport</primary>
43755 <secondary>home directory for</secondary>
43756 </indexterm>
43757 <indexterm role="variable">
43758 <primary><varname>$home</varname></primary>
43759 </indexterm>
43760 This option specifies a home directory setting for a local transport,
43761 overriding any value that may be set by the router. The home directory is
43762 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
43763 used as the current directory if no current directory is set by the
43764 <option>current_directory</option> option on the transport or the
43765 <option>transport_current_directory</option> option on the router. If the expansion fails
43766 for any reason, including forced failure, an error is logged, and delivery is
43767 deferred.
43768 </para>
43769 <para>
43770 <indexterm role="option">
43771 <primary><option>initgroups</option></primary>
43772 </indexterm>
43773 </para>
43774 <informaltable frame="all">
43775 <tgroup cols="4" colsep="0" rowsep="0">
43776 <colspec colwidth="8*" align="left"/>
43777 <colspec colwidth="6*" align="center"/>
43778 <colspec colwidth="6*" align="center"/>
43779 <colspec colwidth="6*" align="right"/>
43780 <tbody>
43781 <row>
43782 <entry><option>initgroups</option></entry>
43783 <entry>Use: <emphasis>transports</emphasis></entry>
43784 <entry>Type: <emphasis>boolean</emphasis></entry>
43785 <entry>Default: <emphasis>false</emphasis></entry>
43786 </row>
43787 </tbody>
43788 </tgroup>
43789 </informaltable>
43790 <para>
43791 <indexterm role="concept">
43792 <primary>additional groups</primary>
43793 </indexterm>
43794 <indexterm role="concept">
43795 <primary>groups</primary>
43796 <secondary>additional</secondary>
43797 </indexterm>
43798 <indexterm role="concept">
43799 <primary>transport</primary>
43800 <secondary>group; additional</secondary>
43801 </indexterm>
43802 If this option is true and the uid for the delivery process is provided by the
43803 transport, the <function>initgroups()</function> function is called when running the transport
43804 to ensure that any additional groups associated with the uid are set up.
43805 </para>
43806 <para>
43807 <indexterm role="option">
43808 <primary><option>max_parallel</option></primary>
43809 </indexterm>
43810 </para>
43811 <informaltable frame="all">
43812 <tgroup cols="4" colsep="0" rowsep="0">
43813 <colspec colwidth="8*" align="left"/>
43814 <colspec colwidth="6*" align="center"/>
43815 <colspec colwidth="6*" align="center"/>
43816 <colspec colwidth="6*" align="right"/>
43817 <tbody>
43818 <row>
43819 <entry><option>max_parallel</option></entry>
43820 <entry>Use: <emphasis>transports</emphasis></entry>
43821 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
43822 <entry>Default: <emphasis>unset</emphasis></entry>
43823 </row>
43824 </tbody>
43825 </tgroup>
43826 </informaltable>
43827 <para>
43828 <indexterm role="concept">
43829 <primary>limit</primary>
43830 <secondary>transport parallelism</secondary>
43831 </indexterm>
43832 <indexterm role="concept">
43833 <primary>transport</primary>
43834 <secondary>parallel processes</secondary>
43835 </indexterm>
43836 <indexterm role="concept">
43837 <primary>transport</primary>
43838 <secondary>concurrency limit</secondary>
43839 </indexterm>
43840 <indexterm role="concept">
43841 <primary>delivery</primary>
43842 <secondary>parallelism for transport</secondary>
43843 </indexterm>
43844 If this option is set and expands to an integer greater than zero
43845 it limits the number of concurrent runs of the transport.
43846 The control does not apply to shadow transports.
43847 </para>
43848 <para>
43849 <indexterm role="concept">
43850 <primary>hints database</primary>
43851 <secondary>transport concurrency control</secondary>
43852 </indexterm>
43853 Exim implements this control by means of a hints database in which a record is
43854 incremented whenever a transport process is being created. The record
43855 is decremented and possibly removed when the process terminates.
43856 Obviously there is scope for
43857 records to get left lying around if there is a system or program crash. To
43858 guard against this, Exim ignores any records that are more than six hours old.
43859 </para>
43860 <para>
43861 If you use this option, you should also arrange to delete the
43862 relevant hints database whenever your system reboots. The names of the files
43863 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
43864 may be one or two files, depending on the type of DBM in use. The same files
43865 are used for ETRN and smtp transport serialization.
43866 </para>
43867 <para>
43868 <indexterm role="option">
43869 <primary><option>message_size_limit</option></primary>
43870 </indexterm>
43871 </para>
43872 <informaltable frame="all">
43873 <tgroup cols="4" colsep="0" rowsep="0">
43874 <colspec colwidth="8*" align="left"/>
43875 <colspec colwidth="6*" align="center"/>
43876 <colspec colwidth="6*" align="center"/>
43877 <colspec colwidth="6*" align="right"/>
43878 <tbody>
43879 <row>
43880 <entry><option>message_size_limit</option></entry>
43881 <entry>Use: <emphasis>transports</emphasis></entry>
43882 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43883 <entry>Default: <emphasis>0</emphasis></entry>
43884 </row>
43885 </tbody>
43886 </tgroup>
43887 </informaltable>
43888 <para>
43889 <indexterm role="concept">
43890 <primary>limit</primary>
43891 <secondary>message size per transport</secondary>
43892 </indexterm>
43893 <indexterm role="concept">
43894 <primary>size</primary>
43895 <secondary>of message, limit</secondary>
43896 </indexterm>
43897 <indexterm role="concept">
43898 <primary>transport</primary>
43899 <secondary>message size; limiting</secondary>
43900 </indexterm>
43901 This option controls the size of messages passed through the transport. It is
43902 expanded before use; the result of the expansion must be a sequence of decimal
43903 digits, optionally followed by K or M. If the expansion fails for any reason,
43904 including forced failure, or if the result is not of the required form,
43905 delivery is deferred. If the value is greater than zero and the size of a
43906 message exceeds this limit, the address is failed. If there is any chance that
43907 the resulting bounce message could be routed to the same transport, you should
43908 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
43909 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
43910 delivered.
43911 </para>
43912 <para>
43913 <indexterm role="option">
43914 <primary><option>rcpt_include_affixes</option></primary>
43915 </indexterm>
43916 </para>
43917 <informaltable frame="all">
43918 <tgroup cols="4" colsep="0" rowsep="0">
43919 <colspec colwidth="8*" align="left"/>
43920 <colspec colwidth="6*" align="center"/>
43921 <colspec colwidth="6*" align="center"/>
43922 <colspec colwidth="6*" align="right"/>
43923 <tbody>
43924 <row>
43925 <entry><option>rcpt_include_affixes</option></entry>
43926 <entry>Use: <emphasis>transports</emphasis></entry>
43927 <entry>Type: <emphasis>boolean</emphasis></entry>
43928 <entry>Default: <emphasis>false</emphasis></entry>
43929 </row>
43930 </tbody>
43931 </tgroup>
43932 </informaltable>
43933 <para>
43934 <indexterm role="concept">
43935 <primary>prefix</primary>
43936 <secondary>for local part, including in envelope</secondary>
43937 </indexterm>
43938 <indexterm role="concept">
43939 <primary>suffix for local part</primary>
43940 <secondary>including in envelope</secondary>
43941 </indexterm>
43942 <indexterm role="concept">
43943 <primary>local part</primary>
43944 <secondary>prefix</secondary>
43945 </indexterm>
43946 <indexterm role="concept">
43947 <primary>local part</primary>
43948 <secondary>suffix</secondary>
43949 </indexterm>
43950 When this option is false (the default), and an address that has had any
43951 affixes (prefixes or suffixes) removed from the local part is delivered by any
43952 form of SMTP or LMTP, the affixes are not included. For example, if a router
43953 that contains
43954 </para>
43955 <literallayout class="monospaced">
43956 local_part_prefix = *-
43957 </literallayout>
43958 <para>
43959 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
43960 is delivered with
43961 </para>
43962 <literallayout class="monospaced">
43963 RCPT TO:&lt;xyz@some.domain&gt;
43964 </literallayout>
43965 <para>
43966 This is also the case when an ACL-time callout is being used to verify a
43967 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
43968 whole local part is included in the RCPT command. This option applies to BSMTP
43969 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
43970 <command>lmtp</command> and <command>smtp</command> transports.
43971 </para>
43972 <para>
43973 <indexterm role="option">
43974 <primary><option>retry_use_local_part</option></primary>
43975 </indexterm>
43976 </para>
43977 <informaltable frame="all">
43978 <tgroup cols="4" colsep="0" rowsep="0">
43979 <colspec colwidth="8*" align="left"/>
43980 <colspec colwidth="6*" align="center"/>
43981 <colspec colwidth="6*" align="center"/>
43982 <colspec colwidth="6*" align="right"/>
43983 <tbody>
43984 <row>
43985 <entry><option>retry_use_local_part</option></entry>
43986 <entry>Use: <emphasis>transports</emphasis></entry>
43987 <entry>Type: <emphasis>boolean</emphasis></entry>
43988 <entry>Default: <emphasis>see below</emphasis></entry>
43989 </row>
43990 </tbody>
43991 </tgroup>
43992 </informaltable>
43993 <para>
43994 <indexterm role="concept">
43995 <primary>hints database</primary>
43996 <secondary>retry keys</secondary>
43997 </indexterm>
43998 When a delivery suffers a temporary failure, a retry record is created
43999 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
44000 is based on the name and/or IP address of the failing remote host. For local
44001 deliveries, the key is normally the entire address, including both the local
44002 part and the domain. This is suitable for most common cases of local delivery
44003 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
44004 deliveries to that mailbox, not to the whole domain.
44005 </para>
44006 <para>
44007 However, in some special cases you may want to treat a temporary local delivery
44008 as a failure associated with the domain, and not with a particular local part.
44009 (For example, if you are storing all mail for some domain in files.) You can do
44010 this by setting <option>retry_use_local_part</option> false.
44011 </para>
44012 <para>
44013 For all the local transports, its default value is true. For remote transports,
44014 the default value is false for tidiness, but changing the value has no effect
44015 on a remote transport in the current implementation.
44016 </para>
44017 <para>
44018 <indexterm role="option">
44019 <primary><option>return_path</option></primary>
44020 </indexterm>
44021 </para>
44022 <informaltable frame="all">
44023 <tgroup cols="4" colsep="0" rowsep="0">
44024 <colspec colwidth="8*" align="left"/>
44025 <colspec colwidth="6*" align="center"/>
44026 <colspec colwidth="6*" align="center"/>
44027 <colspec colwidth="6*" align="right"/>
44028 <tbody>
44029 <row>
44030 <entry><option>return_path</option></entry>
44031 <entry>Use: <emphasis>transports</emphasis></entry>
44032 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44033 <entry>Default: <emphasis>unset</emphasis></entry>
44034 </row>
44035 </tbody>
44036 </tgroup>
44037 </informaltable>
44038 <para>
44039 <indexterm role="concept">
44040 <primary>envelope sender</primary>
44041 </indexterm>
44042 <indexterm role="concept">
44043 <primary>envelope from</primary>
44044 </indexterm>
44045 <indexterm role="concept">
44046 <primary>transport</primary>
44047 <secondary>return path; changing</secondary>
44048 </indexterm>
44049 <indexterm role="concept">
44050 <primary>return path</primary>
44051 <secondary>changing in transport</secondary>
44052 </indexterm>
44053 If this option is set, the string is expanded at transport time and replaces
44054 the existing return path (envelope sender) value in the copy of the message
44055 that is being delivered. An empty return path is permitted. This feature is
44056 designed for remote deliveries, where the value of this option is used in the
44057 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
44058 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
44059 header line, if one is added to the message (see the next option).
44060 </para>
44061 <para>
44062 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
44063 <option>return_path_on_delivery</option> to the log selector.
44064 </para>
44065 <para>
44066 <indexterm role="variable">
44067 <primary><varname>$return_path</varname></primary>
44068 </indexterm>
44069 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
44070 either the message&#x2019;s envelope sender, or an address set by the
44071 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
44072 replacement occurs; if it fails for another reason, delivery is deferred. This
44073 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
44074 section <xref linkend="SECTverp"/>.
44075 </para>
44076 <para>
44077 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
44078 remote server rejects a message at SMTP time, the bounce message is not sent to
44079 the value of this option. It is sent to the previously set errors address.
44080 This defaults to the incoming sender address, but can be changed by setting
44081 <option>errors_to</option> in a router.
44082 </para>
44083 <para>
44084 <indexterm role="option">
44085 <primary><option>return_path_add</option></primary>
44086 </indexterm>
44087 </para>
44088 <informaltable frame="all">
44089 <tgroup cols="4" colsep="0" rowsep="0">
44090 <colspec colwidth="8*" align="left"/>
44091 <colspec colwidth="6*" align="center"/>
44092 <colspec colwidth="6*" align="center"/>
44093 <colspec colwidth="6*" align="right"/>
44094 <tbody>
44095 <row>
44096 <entry><option>return_path_add</option></entry>
44097 <entry>Use: <emphasis>transports</emphasis></entry>
44098 <entry>Type: <emphasis>boolean</emphasis></entry>
44099 <entry>Default: <emphasis>false</emphasis></entry>
44100 </row>
44101 </tbody>
44102 </tgroup>
44103 </informaltable>
44104 <para>
44105 <indexterm role="concept">
44106 <primary><emphasis>Return-path:</emphasis> header line</primary>
44107 </indexterm>
44108 <indexterm role="concept">
44109 <primary>header lines</primary>
44110 <secondary>Return-path:</secondary>
44111 </indexterm>
44112 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
44113 Although the return path is normally available in the prefix line of BSD
44114 mailboxes, this is commonly not displayed by MUAs, and so the user does not
44115 have easy access to it.
44116 </para>
44117 <para>
44118 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
44119 the delivery SMTP server makes the final delivery</quote>. This implies that this
44120 header should not be present in incoming messages. Exim has a configuration
44121 option, <option>return_path_remove</option>, which requests removal of this header from
44122 incoming messages, so that delivered messages can safely be resent to other
44123 recipients.
44124 </para>
44125 <para>
44126 <indexterm role="option">
44127 <primary><option>shadow_condition</option></primary>
44128 </indexterm>
44129 </para>
44130 <informaltable frame="all">
44131 <tgroup cols="4" colsep="0" rowsep="0">
44132 <colspec colwidth="8*" align="left"/>
44133 <colspec colwidth="6*" align="center"/>
44134 <colspec colwidth="6*" align="center"/>
44135 <colspec colwidth="6*" align="right"/>
44136 <tbody>
44137 <row>
44138 <entry><option>shadow_condition</option></entry>
44139 <entry>Use: <emphasis>transports</emphasis></entry>
44140 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44141 <entry>Default: <emphasis>unset</emphasis></entry>
44142 </row>
44143 </tbody>
44144 </tgroup>
44145 </informaltable>
44146 <para>
44147 See <option>shadow_transport</option> below.
44148 </para>
44149 <para>
44150 <indexterm role="option">
44151 <primary><option>shadow_transport</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>shadow_transport</option></entry>
44163 <entry>Use: <emphasis>transports</emphasis></entry>
44164 <entry>Type: <emphasis>string</emphasis></entry>
44165 <entry>Default: <emphasis>unset</emphasis></entry>
44166 </row>
44167 </tbody>
44168 </tgroup>
44169 </informaltable>
44170 <para>
44171 <indexterm role="concept">
44172 <primary>shadow transport</primary>
44173 </indexterm>
44174 <indexterm role="concept">
44175 <primary>transport</primary>
44176 <secondary>shadow</secondary>
44177 </indexterm>
44178 A local transport may set the <option>shadow_transport</option> option to the name of
44179 another local transport. Shadow remote transports are not supported.
44180 </para>
44181 <para>
44182 Whenever a delivery to the main transport succeeds, and either
44183 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
44184 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
44185 passed to the shadow transport, with the same delivery address or addresses. If
44186 expansion fails, no action is taken except that non-forced expansion failures
44187 cause a log line to be written.
44188 </para>
44189 <para>
44190 The result of the shadow transport is discarded and does not affect the
44191 subsequent processing of the message. Only a single level of shadowing is
44192 provided; the <option>shadow_transport</option> option is ignored on any transport when it
44193 is running as a shadow. Options concerned with output from pipes are also
44194 ignored. The log line for the successful delivery has an item added on the end,
44195 of the form
44196 </para>
44197 <literallayout class="monospaced">
44198 ST=&lt;shadow transport name&gt;
44199 </literallayout>
44200 <para>
44201 If the shadow transport did not succeed, the error message is put in
44202 parentheses afterwards. Shadow transports can be used for a number of different
44203 purposes, including keeping more detailed log information than Exim normally
44204 provides, and implementing automatic acknowledgment policies based on message
44205 headers that some sites insist on.
44206 </para>
44207 <para>
44208 <indexterm role="option">
44209 <primary><option>transport_filter</option></primary>
44210 </indexterm>
44211 </para>
44212 <informaltable frame="all">
44213 <tgroup cols="4" colsep="0" rowsep="0">
44214 <colspec colwidth="8*" align="left"/>
44215 <colspec colwidth="6*" align="center"/>
44216 <colspec colwidth="6*" align="center"/>
44217 <colspec colwidth="6*" align="right"/>
44218 <tbody>
44219 <row>
44220 <entry><option>transport_filter</option></entry>
44221 <entry>Use: <emphasis>transports</emphasis></entry>
44222 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44223 <entry>Default: <emphasis>unset</emphasis></entry>
44224 </row>
44225 </tbody>
44226 </tgroup>
44227 </informaltable>
44228 <para>
44229 <indexterm role="concept">
44230 <primary>transport</primary>
44231 <secondary>filter</secondary>
44232 </indexterm>
44233 <indexterm role="concept">
44234 <primary>filter</primary>
44235 <secondary>transport filter</secondary>
44236 </indexterm>
44237 This option sets up a filtering (in the Unix shell sense) process for messages
44238 at transport time. It should not be confused with mail filtering as set up by
44239 individual users or via a system filter.
44240 If unset, or expanding to an empty string, no filtering is done.
44241 </para>
44242 <para>
44243 When the message is about to be written out, the command specified by
44244 <option>transport_filter</option> is started up in a separate, parallel process, and
44245 the entire message, including the header lines, is passed to it on its standard
44246 input (this in fact is done from a third process, to avoid deadlock). The
44247 command must be specified as an absolute path.
44248 </para>
44249 <para>
44250 The lines of the message that are written to the transport filter are
44251 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
44252 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
44253 lines beginning with a dot, and also before any processing implied by the
44254 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
44255 <command>pipe</command> transports.
44256 </para>
44257 <para>
44258 The standard error for the filter process is set to the same destination as its
44259 standard output; this is read and written to the message&#x2019;s ultimate
44260 destination. The process that writes the message to the filter, the
44261 filter itself, and the original process that reads the result and delivers it
44262 are all run in parallel, like a shell pipeline.
44263 </para>
44264 <para>
44265 The filter can perform any transformations it likes, but of course should take
44266 care not to break RFC 2822 syntax. Exim does not check the result, except to
44267 test for a final newline when SMTP is in use. All messages transmitted over
44268 SMTP must end with a newline, so Exim supplies one if it is missing.
44269 </para>
44270 <para>
44271 <indexterm role="concept">
44272 <primary>content scanning</primary>
44273 <secondary>per user</secondary>
44274 </indexterm>
44275 A transport filter can be used to provide content-scanning on a per-user basis
44276 at delivery time if the only required effect of the scan is to modify the
44277 message. For example, a content scan could insert a new header line containing
44278 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
44279 not possible to discard a message at this stage.
44280 </para>
44281 <para>
44282 <indexterm role="concept">
44283 <primary>SIZE</primary>
44284 <secondary>ESMTP extension</secondary>
44285 </indexterm>
44286 A problem might arise if the filter increases the size of a message that is
44287 being sent down an SMTP connection. If the receiving SMTP server has indicated
44288 support for the SIZE parameter, Exim will have sent the size of the message
44289 at the start of the SMTP session. If what is actually sent is substantially
44290 more, the server might reject the message. This can be worked round by setting
44291 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
44292 additions to the message, or to disable the use of SIZE altogether.
44293 </para>
44294 <para>
44295 <indexterm role="variable">
44296 <primary><varname>$pipe_addresses</varname></primary>
44297 </indexterm>
44298 The value of the <option>transport_filter</option> option is the command string for starting
44299 the filter, which is run directly from Exim, not under a shell. The string is
44300 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
44301 Exim breaks it up into arguments and then expands each argument separately (see
44302 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
44303 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
44304 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
44305 an ideal name for this feature here, but as it was already implemented for the
44306 <command>pipe</command> transport, it seemed sensible not to change it.)
44307 </para>
44308 <para>
44309 <indexterm role="variable">
44310 <primary><varname>$host</varname></primary>
44311 </indexterm>
44312 <indexterm role="variable">
44313 <primary><varname>$host_address</varname></primary>
44314 </indexterm>
44315 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
44316 transport is a remote one. They contain the name and IP address of the host to
44317 which the message is being sent. For example:
44318 </para>
44319 <literallayout class="monospaced">
44320 transport_filter = /some/directory/transport-filter.pl \
44321   $host $host_address $pipe_addresses
44322 </literallayout>
44323 <para>
44324 Two problems arise if you want to use more complicated expansion items to
44325 generate transport filter commands, both of which due to the fact that the
44326 command is split up <emphasis>before</emphasis> expansion.
44327 </para>
44328 <itemizedlist>
44329 <listitem>
44330 <para>
44331 If an expansion item contains white space, you must quote it, so that it is all
44332 part of the same command item. If the entire option setting is one such
44333 expansion item, you have to take care what kind of quoting you use. For
44334 example:
44335 </para>
44336 <literallayout class="monospaced">
44337 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
44338 </literallayout>
44339 <para>
44340 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
44341 <command>/bin/cmd2</command> otherwise.
44342 </para>
44343 <para>
44344 Option strings in general have any fully-surrounding double quote wrapping
44345 removed early in parsing (see <xref linkend="SECTstrings"/>).
44346 Then, for this option, quotes protect against whitespace being
44347 regarded as a separator while splitting into the command argument vector.
44348 Either double or single quotes can be used here;
44349 the former interprets backlash-quoted charachters
44350 and the latter does not.
44351 </para>
44352 <para>
44353 If double quotes had been used in this example, they would have been
44354 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
44355 the single quotes were missing, the line would be split into two items,
44356 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
44357 Exim tried to expand the first one.
44358 </para>
44359 </listitem>
44360 <listitem>
44361 <para>
44362 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
44363 expansion cannot generate multiple arguments, or a command name followed by
44364 arguments. Consider this example:
44365 </para>
44366 <literallayout class="monospaced">
44367 transport_filter = ${lookup{$host}lsearch{/a/file}\
44368                     {$value}{/bin/cat}}
44369 </literallayout>
44370 <para>
44371 The result of the lookup is interpreted as the name of the command, even
44372 if it contains white space. The simplest way round this is to use a shell:
44373 </para>
44374 <literallayout class="monospaced">
44375 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
44376                                {$value}{/bin/cat}}
44377 </literallayout>
44378 </listitem>
44379 </itemizedlist>
44380 <para>
44381 The filter process is run under the same uid and gid as the normal delivery.
44382 For remote deliveries this is the Exim uid/gid by default. The command should
44383 normally yield a zero return code. Transport filters are not supposed to fail.
44384 A non-zero code is taken to mean that the transport filter encountered some
44385 serious problem. Delivery of the message is deferred; the message remains on
44386 the queue and is tried again later. It is not possible to cause a message to be
44387 bounced from a transport filter.
44388 </para>
44389 <para>
44390 If a transport filter is set on an autoreply transport, the original message is
44391 passed through the filter as it is being copied into the newly generated
44392 message, which happens if the <option>return_message</option> option is set.
44393 </para>
44394 <para>
44395 <indexterm role="option">
44396 <primary><option>transport_filter_timeout</option></primary>
44397 </indexterm>
44398 </para>
44399 <informaltable frame="all">
44400 <tgroup cols="4" colsep="0" rowsep="0">
44401 <colspec colwidth="8*" align="left"/>
44402 <colspec colwidth="6*" align="center"/>
44403 <colspec colwidth="6*" align="center"/>
44404 <colspec colwidth="6*" align="right"/>
44405 <tbody>
44406 <row>
44407 <entry><option>transport_filter_timeout</option></entry>
44408 <entry>Use: <emphasis>transports</emphasis></entry>
44409 <entry>Type: <emphasis>time</emphasis></entry>
44410 <entry>Default: <emphasis>5m</emphasis></entry>
44411 </row>
44412 </tbody>
44413 </tgroup>
44414 </informaltable>
44415 <para>
44416 <indexterm role="concept">
44417 <primary>transport</primary>
44418 <secondary>filter, timeout</secondary>
44419 </indexterm>
44420 When Exim is reading the output of a transport filter, it applies a timeout
44421 that can be set by this option. Exceeding the timeout is normally treated as a
44422 temporary delivery failure. However, if a transport filter is used with a
44423 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
44424 way as a timeout in the pipe command itself. By default, a timeout is a hard
44425 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
44426 becomes a temporary error.
44427 </para>
44428 <para>
44429 <indexterm role="option">
44430 <primary><option>user</option></primary>
44431 </indexterm>
44432 </para>
44433 <informaltable frame="all">
44434 <tgroup cols="4" colsep="0" rowsep="0">
44435 <colspec colwidth="8*" align="left"/>
44436 <colspec colwidth="6*" align="center"/>
44437 <colspec colwidth="6*" align="center"/>
44438 <colspec colwidth="6*" align="right"/>
44439 <tbody>
44440 <row>
44441 <entry><option>user</option></entry>
44442 <entry>Use: <emphasis>transports</emphasis></entry>
44443 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44444 <entry>Default: <emphasis>Exim user</emphasis></entry>
44445 </row>
44446 </tbody>
44447 </tgroup>
44448 </informaltable>
44449 <para>
44450 <indexterm role="concept">
44451 <primary>uid (user id)</primary>
44452 <secondary>local delivery</secondary>
44453 </indexterm>
44454 <indexterm role="concept">
44455 <primary>transport</primary>
44456 <secondary>user, specifying</secondary>
44457 </indexterm>
44458 This option specifies the user under whose uid the delivery process is to be
44459 run, overriding any uid that may have been set by the router. If the user is
44460 given as a name, the uid is looked up from the password data, and the
44461 associated group is taken as the value of the gid to be used if the <option>group</option>
44462 option is not set.
44463 </para>
44464 <para>
44465 For deliveries that use local transports, a user and group are normally
44466 specified explicitly or implicitly (for example, as a result of
44467 <option>check_local_user</option>) by the router or transport.
44468 </para>
44469 <para>
44470 <indexterm role="concept">
44471 <primary>hints database</primary>
44472 <secondary>access by remote transport</secondary>
44473 </indexterm>
44474 For remote transports, you should leave this option unset unless you really are
44475 sure you know what you are doing. When a remote transport is running, it needs
44476 to be able to access Exim&#x2019;s hints databases, because each host may have its own
44477 retry data.
44478 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
44479 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
44480 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
44481 </para>
44482 </chapter>
44483
44484 <chapter id="CHAPbatching">
44485 <title>Address batching in local transports</title>
44486 <titleabbrev>Address batching</titleabbrev>
44487 <para>
44488 <indexterm role="concept">
44489 <primary>transport</primary>
44490 <secondary>local; address batching in</secondary>
44491 </indexterm>
44492 The only remote transport (<command>smtp</command>) is normally configured to handle more than
44493 one address at a time, so that when several addresses are routed to the same
44494 remote host, just one copy of the message is sent. Local transports, however,
44495 normally handle one address at a time. That is, a separate instance of the
44496 transport is run for each address that is routed to the transport. A separate
44497 copy of the message is delivered each time.
44498 </para>
44499 <para>
44500 <indexterm role="concept">
44501 <primary>batched local delivery</primary>
44502 </indexterm>
44503 <indexterm role="option">
44504 <primary><option>batch_max</option></primary>
44505 </indexterm>
44506 <indexterm role="option">
44507 <primary><option>batch_id</option></primary>
44508 </indexterm>
44509 In special cases, it may be desirable to handle several addresses at once in a
44510 local transport, for example:
44511 </para>
44512 <itemizedlist>
44513 <listitem>
44514 <para>
44515 In an <command>appendfile</command> transport, when storing messages in files for later
44516 delivery by some other means, a single copy of the message with multiple
44517 recipients saves space.
44518 </para>
44519 </listitem>
44520 <listitem>
44521 <para>
44522 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
44523 a single copy saves time, and is the normal way LMTP is expected to work.
44524 </para>
44525 </listitem>
44526 <listitem>
44527 <para>
44528 In a <command>pipe</command> transport, when passing the message
44529 to a scanner program or
44530 to some other delivery mechanism such as UUCP, multiple recipients may be
44531 acceptable.
44532 </para>
44533 </listitem>
44534 </itemizedlist>
44535 <para>
44536 These three local transports all have the same options for controlling multiple
44537 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
44538 repeating the information for each transport, these options are described here.
44539 </para>
44540 <para>
44541 The <option>batch_max</option> option specifies the maximum number of addresses that can be
44542 delivered together in a single run of the transport. Its default value is one
44543 (no batching). When more than one address is routed to a transport that has a
44544 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
44545 (that is, in a single run of the transport with multiple recipients), subject
44546 to certain conditions:
44547 </para>
44548 <itemizedlist>
44549 <listitem>
44550 <para>
44551 <indexterm role="variable">
44552 <primary><varname>$local_part</varname></primary>
44553 </indexterm>
44554 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
44555 batching is possible.
44556 </para>
44557 </listitem>
44558 <listitem>
44559 <para>
44560 <indexterm role="variable">
44561 <primary><varname>$domain</varname></primary>
44562 </indexterm>
44563 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
44564 addresses with the same domain are batched.
44565 </para>
44566 </listitem>
44567 <listitem>
44568 <para>
44569 <indexterm role="concept">
44570 <primary>customizing</primary>
44571 <secondary>batching condition</secondary>
44572 </indexterm>
44573 If <option>batch_id</option> is set, it is expanded for each address, and only those
44574 addresses with the same expanded value are batched. This allows you to specify
44575 customized batching conditions. Failure of the expansion for any reason,
44576 including forced failure, disables batching, but it does not stop the delivery
44577 from taking place.
44578 </para>
44579 </listitem>
44580 <listitem>
44581 <para>
44582 Batched addresses must also have the same errors address (where to send
44583 delivery errors), the same header additions and removals, the same user and
44584 group for the transport, and if a host list is present, the first host must
44585 be the same.
44586 </para>
44587 </listitem>
44588 </itemizedlist>
44589 <para>
44590 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
44591 both when the file or pipe command is specified in the transport, and when it
44592 is specified by a <command>redirect</command> router, but all the batched addresses must of
44593 course be routed to the same file or pipe command. These two transports have an
44594 option called <option>use_bsmtp</option>, which causes them to deliver the message in
44595 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
44596 <option>check_string</option> and <option>escape_string</option> options are forced to the values
44597 </para>
44598 <literallayout class="monospaced">
44599 check_string = "."
44600 escape_string = ".."
44601 </literallayout>
44602 <para>
44603 when batched SMTP is in use. A full description of the batch SMTP mechanism is
44604 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
44605 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
44606 </para>
44607 <para>
44608 <indexterm role="concept">
44609 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
44610 </indexterm>
44611 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
44612 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
44613 that are being processed together. If you are using a batching <command>appendfile</command>
44614 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
44615 addresses is to set the <option>envelope_to_add</option> option.
44616 </para>
44617 <para>
44618 <indexterm role="concept">
44619 <primary><command>pipe</command> transport</primary>
44620 <secondary>with multiple addresses</secondary>
44621 </indexterm>
44622 <indexterm role="variable">
44623 <primary><varname>$pipe_addresses</varname></primary>
44624 </indexterm>
44625 If you are using a <command>pipe</command> transport without BSMTP, and setting the
44626 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
44627 the command. This is not a true variable; it is a bit of magic that causes each
44628 of the recipient addresses to be inserted into the command as a separate
44629 argument. This provides a way of accessing all the addresses that are being
44630 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
44631 are specified by a <command>redirect</command> router.
44632 </para>
44633 </chapter>
44634
44635 <chapter id="CHAPappendfile">
44636 <title>The appendfile transport</title>
44637 <para>
44638 <indexterm role="concept" id="IIDapptra1" class="startofrange">
44639 <primary><command>appendfile</command> transport</primary>
44640 </indexterm>
44641 <indexterm role="concept" id="IIDapptra2" class="startofrange">
44642 <primary>transports</primary>
44643 <secondary><command>appendfile</command></secondary>
44644 </indexterm>
44645 <indexterm role="concept">
44646 <primary>directory creation</primary>
44647 </indexterm>
44648 <indexterm role="concept">
44649 <primary>creating directories</primary>
44650 </indexterm>
44651 The <command>appendfile</command> transport delivers a message by appending it to an existing
44652 file, or by creating an entirely new file in a specified directory. Single
44653 files to which messages are appended can be in the traditional Unix mailbox
44654 format, or optionally in the MBX format supported by the Pine MUA and
44655 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
44656 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
44657 to give added protection against failures that happen part-way through the
44658 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
44659 supported. For all file formats, Exim attempts to create as many levels of
44660 directory as necessary, provided that <option>create_directory</option> is set.
44661 </para>
44662 <para>
44663 The code for the optional formats is not included in the Exim binary by
44664 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
44665 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
44666 included.
44667 </para>
44668 <para>
44669 <indexterm role="concept">
44670 <primary>quota</primary>
44671 <secondary>system</secondary>
44672 </indexterm>
44673 Exim recognizes system quota errors, and generates an appropriate message. Exim
44674 also supports its own quota control within the transport, for use when the
44675 system facility is unavailable or cannot be used for some reason.
44676 </para>
44677 <para>
44678 If there is an error while appending to a file (for example, quota exceeded or
44679 partition filled), Exim attempts to reset the file&#x2019;s length and last
44680 modification time back to what they were before. If there is an error while
44681 creating an entirely new file, the new file is removed.
44682 </para>
44683 <para>
44684 Before appending to a file, a number of security checks are made, and the
44685 file is locked. A detailed description is given below, after the list of
44686 private options.
44687 </para>
44688 <para>
44689 The <command>appendfile</command> transport is most commonly used for local deliveries to
44690 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
44691 putting messages into files for remote delivery by some means other than Exim.
44692 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
44693 option).
44694 </para>
44695 <section id="SECTfildiropt">
44696 <title>The file and directory options</title>
44697 <para>
44698 The <option>file</option> option specifies a single file, to which the message is appended;
44699 the <option>directory</option> option specifies a directory, in which a new file containing
44700 the message is created. Only one of these two options can be set, and for
44701 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
44702 </para>
44703 <para>
44704 <indexterm role="variable">
44705 <primary><varname>$address_file</varname></primary>
44706 </indexterm>
44707 <indexterm role="variable">
44708 <primary><varname>$local_part</varname></primary>
44709 </indexterm>
44710 However, <command>appendfile</command> is also used for delivering messages to files or
44711 directories whose names (or parts of names) are obtained from alias,
44712 forwarding, or filtering operations (for example, a <option>save</option> command in a
44713 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
44714 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
44715 name (or partial name) of the file or directory generated by the redirection
44716 operation. There are two cases:
44717 </para>
44718 <itemizedlist>
44719 <listitem>
44720 <para>
44721 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
44722 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
44723 common case when users with local accounts use filtering to sort mail into
44724 different folders. See for example, the <command>address_file</command> transport in the
44725 default configuration. If the path ends with a slash, it is assumed to be the
44726 name of a directory. A delivery to a directory can also be forced by setting
44727 <option>maildir_format</option> or <option>mailstore_format</option>.
44728 </para>
44729 </listitem>
44730 <listitem>
44731 <para>
44732 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
44733 used to determine the file or directory name for the delivery. Normally, the
44734 contents of <varname>$address_file</varname> are used in some way in the string expansion.
44735 </para>
44736 </listitem>
44737 </itemizedlist>
44738 <para>
44739 If the <option>create_file</option> option is set to a path which
44740 matches (see the option definition below for details)
44741 a file or directory name
44742 for the delivery, that name becomes de-tainted.
44743 </para>
44744 <para>
44745 <indexterm role="concept">
44746 <primary>tainted data</primary>
44747 <secondary>in filenames</secondary>
44748 </indexterm>
44749 <indexterm role="concept">
44750 <primary>appendfile</primary>
44751 <secondary>tainted data</secondary>
44752 </indexterm>
44753 Tainted data may not be used for a file or directory name.
44754 This means that, for instance, <varname>$local_part</varname> cannot be used directly
44755 as a component of a path.  It can however be used as the key for a lookup
44756 which returns a path (or component).
44757 </para>
44758 <para>
44759 <indexterm role="concept">
44760 <primary>Sieve filter</primary>
44761 <secondary>configuring <command>appendfile</command></secondary>
44762 </indexterm>
44763 <indexterm role="concept">
44764 <primary>Sieve filter</primary>
44765 <secondary>relative mailbox path handling</secondary>
44766 </indexterm>
44767 As an example of the second case, consider an environment where users do not
44768 have home directories. They may be permitted to use Exim filter commands of the
44769 form:
44770 </para>
44771 <literallayout class="monospaced">
44772 save folder23
44773 </literallayout>
44774 <para>
44775 or Sieve filter commands of the form:
44776 </para>
44777 <literallayout class="monospaced">
44778 require "fileinto";
44779 fileinto "folder23";
44780 </literallayout>
44781 <para>
44782 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
44783 must transform the relative path into an appropriate absolute filename. In the
44784 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
44785 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
44786 way of handling this requirement:
44787 </para>
44788 <literallayout class="monospaced">
44789 file = ${if eq{$address_file}{inbox} \
44790             {/var/mail/$local_part_data} \
44791             {${if eq{${substr_0_1:$address_file}}{/} \
44792                   {$address_file} \
44793                   {$home/mail/$address_file} \
44794             }} \
44795        }
44796 </literallayout>
44797 <para>
44798 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
44799 location, absolute paths are used without change, and other folders are in the
44800 <filename>mail</filename> directory within the home directory.
44801 </para>
44802 <para>
44803 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
44804 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
44805 the router. In particular, this is the case if <option>check_local_user</option> is set. If
44806 you want to prevent this happening at routing time, you can set
44807 <option>router_home_directory</option> empty. This forces the router to pass the relative
44808 path to the transport.
44809 </para>
44810 <para>
44811 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
44812 the <option>file</option> or <option>directory</option> option is still used if it is set.
44813 </para>
44814 </section>
44815 <section id="SECID134">
44816 <title>Private options for appendfile</title>
44817 <para>
44818 <indexterm role="concept">
44819 <primary>options</primary>
44820 <secondary><command>appendfile</command> transport</secondary>
44821 </indexterm>
44822 </para>
44823 <para>
44824 <indexterm role="option">
44825 <primary><option>allow_fifo</option></primary>
44826 </indexterm>
44827 </para>
44828 <informaltable frame="all">
44829 <tgroup cols="4" colsep="0" rowsep="0">
44830 <colspec colwidth="8*" align="left"/>
44831 <colspec colwidth="6*" align="center"/>
44832 <colspec colwidth="6*" align="center"/>
44833 <colspec colwidth="6*" align="right"/>
44834 <tbody>
44835 <row>
44836 <entry><option>allow_fifo</option></entry>
44837 <entry>Use: <emphasis>appendfile</emphasis></entry>
44838 <entry>Type: <emphasis>boolean</emphasis></entry>
44839 <entry>Default: <emphasis>false</emphasis></entry>
44840 </row>
44841 </tbody>
44842 </tgroup>
44843 </informaltable>
44844 <para>
44845 <indexterm role="concept">
44846 <primary>fifo (named pipe)</primary>
44847 </indexterm>
44848 <indexterm role="concept">
44849 <primary>named pipe (fifo)</primary>
44850 </indexterm>
44851 <indexterm role="concept">
44852 <primary>pipe</primary>
44853 <secondary>named (fifo)</secondary>
44854 </indexterm>
44855 Setting this option permits delivery to named pipes (FIFOs) as well as to
44856 regular files. If no process is reading the named pipe at delivery time, the
44857 delivery is deferred.
44858 </para>
44859 <para>
44860 <indexterm role="option">
44861 <primary><option>allow_symlink</option></primary>
44862 </indexterm>
44863 </para>
44864 <informaltable frame="all">
44865 <tgroup cols="4" colsep="0" rowsep="0">
44866 <colspec colwidth="8*" align="left"/>
44867 <colspec colwidth="6*" align="center"/>
44868 <colspec colwidth="6*" align="center"/>
44869 <colspec colwidth="6*" align="right"/>
44870 <tbody>
44871 <row>
44872 <entry><option>allow_symlink</option></entry>
44873 <entry>Use: <emphasis>appendfile</emphasis></entry>
44874 <entry>Type: <emphasis>boolean</emphasis></entry>
44875 <entry>Default: <emphasis>false</emphasis></entry>
44876 </row>
44877 </tbody>
44878 </tgroup>
44879 </informaltable>
44880 <para>
44881 <indexterm role="concept">
44882 <primary>symbolic link</primary>
44883 <secondary>to mailbox</secondary>
44884 </indexterm>
44885 <indexterm role="concept">
44886 <primary>mailbox</primary>
44887 <secondary>symbolic link</secondary>
44888 </indexterm>
44889 By default, <command>appendfile</command> will not deliver if the path name for the file is
44890 that of a symbolic link. Setting this option relaxes that constraint, but there
44891 are security issues involved in the use of symbolic links. Be sure you know
44892 what you are doing if you set this. Details of exactly what this option affects
44893 are included in the discussion which follows this list of options.
44894 </para>
44895 <para>
44896 <indexterm role="option">
44897 <primary><option>batch_id</option></primary>
44898 </indexterm>
44899 </para>
44900 <informaltable frame="all">
44901 <tgroup cols="4" colsep="0" rowsep="0">
44902 <colspec colwidth="8*" align="left"/>
44903 <colspec colwidth="6*" align="center"/>
44904 <colspec colwidth="6*" align="center"/>
44905 <colspec colwidth="6*" align="right"/>
44906 <tbody>
44907 <row>
44908 <entry><option>batch_id</option></entry>
44909 <entry>Use: <emphasis>appendfile</emphasis></entry>
44910 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44911 <entry>Default: <emphasis>unset</emphasis></entry>
44912 </row>
44913 </tbody>
44914 </tgroup>
44915 </informaltable>
44916 <para>
44917 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44918 However, batching is automatically disabled for <command>appendfile</command> deliveries that
44919 happen as a result of forwarding or aliasing or other redirection directly to a
44920 file.
44921 </para>
44922 <para>
44923 <indexterm role="option">
44924 <primary><option>batch_max</option></primary>
44925 </indexterm>
44926 </para>
44927 <informaltable frame="all">
44928 <tgroup cols="4" colsep="0" rowsep="0">
44929 <colspec colwidth="8*" align="left"/>
44930 <colspec colwidth="6*" align="center"/>
44931 <colspec colwidth="6*" align="center"/>
44932 <colspec colwidth="6*" align="right"/>
44933 <tbody>
44934 <row>
44935 <entry><option>batch_max</option></entry>
44936 <entry>Use: <emphasis>appendfile</emphasis></entry>
44937 <entry>Type: <emphasis>integer</emphasis></entry>
44938 <entry>Default: <emphasis>1</emphasis></entry>
44939 </row>
44940 </tbody>
44941 </tgroup>
44942 </informaltable>
44943 <para>
44944 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44945 </para>
44946 <para>
44947 <indexterm role="option">
44948 <primary><option>check_group</option></primary>
44949 </indexterm>
44950 </para>
44951 <informaltable frame="all">
44952 <tgroup cols="4" colsep="0" rowsep="0">
44953 <colspec colwidth="8*" align="left"/>
44954 <colspec colwidth="6*" align="center"/>
44955 <colspec colwidth="6*" align="center"/>
44956 <colspec colwidth="6*" align="right"/>
44957 <tbody>
44958 <row>
44959 <entry><option>check_group</option></entry>
44960 <entry>Use: <emphasis>appendfile</emphasis></entry>
44961 <entry>Type: <emphasis>boolean</emphasis></entry>
44962 <entry>Default: <emphasis>false</emphasis></entry>
44963 </row>
44964 </tbody>
44965 </tgroup>
44966 </informaltable>
44967 <para>
44968 When this option is set, the group owner of the file defined by the <option>file</option>
44969 option is checked to see that it is the same as the group under which the
44970 delivery process is running. The default setting is false because the default
44971 file mode is 0600, which means that the group is irrelevant.
44972 </para>
44973 <para>
44974 <indexterm role="option">
44975 <primary><option>check_owner</option></primary>
44976 </indexterm>
44977 </para>
44978 <informaltable frame="all">
44979 <tgroup cols="4" colsep="0" rowsep="0">
44980 <colspec colwidth="8*" align="left"/>
44981 <colspec colwidth="6*" align="center"/>
44982 <colspec colwidth="6*" align="center"/>
44983 <colspec colwidth="6*" align="right"/>
44984 <tbody>
44985 <row>
44986 <entry><option>check_owner</option></entry>
44987 <entry>Use: <emphasis>appendfile</emphasis></entry>
44988 <entry>Type: <emphasis>boolean</emphasis></entry>
44989 <entry>Default: <emphasis>true</emphasis></entry>
44990 </row>
44991 </tbody>
44992 </tgroup>
44993 </informaltable>
44994 <para>
44995 When this option is set, the owner of the file defined by the <option>file</option> option
44996 is checked to ensure that it is the same as the user under which the delivery
44997 process is running.
44998 </para>
44999 <para>
45000 <indexterm role="option">
45001 <primary><option>check_string</option></primary>
45002 </indexterm>
45003 </para>
45004 <informaltable frame="all">
45005 <tgroup cols="4" colsep="0" rowsep="0">
45006 <colspec colwidth="8*" align="left"/>
45007 <colspec colwidth="6*" align="center"/>
45008 <colspec colwidth="6*" align="center"/>
45009 <colspec colwidth="6*" align="right"/>
45010 <tbody>
45011 <row>
45012 <entry><option>check_string</option></entry>
45013 <entry>Use: <emphasis>appendfile</emphasis></entry>
45014 <entry>Type: <emphasis>string</emphasis></entry>
45015 <entry>Default: <emphasis>see below</emphasis></entry>
45016 </row>
45017 </tbody>
45018 </tgroup>
45019 </informaltable>
45020 <para>
45021 <indexterm role="concept">
45022 <primary><quote>From</quote> line</primary>
45023 </indexterm>
45024 As <command>appendfile</command> writes the message, the start of each line is tested for
45025 matching <option>check_string</option>, and if it does, the initial matching characters are
45026 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
45027 a literal string, not a regular expression, and the case of any letters it
45028 contains is significant.
45029 </para>
45030 <para>
45031 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
45032 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
45033 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
45034 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
45035 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
45036 </para>
45037 <para>
45038 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
45039 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
45040 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
45041 if another format is used. For example, to deliver to mailboxes in MMDF format:
45042 <indexterm role="concept">
45043 <primary>MMDF format mailbox</primary>
45044 </indexterm>
45045 <indexterm role="concept">
45046 <primary>mailbox</primary>
45047 <secondary>MMDF format</secondary>
45048 </indexterm>
45049 </para>
45050 <literallayout class="monospaced">
45051 check_string = "\1\1\1\1\n"
45052 escape_string = "\1\1\1\1 \n"
45053 message_prefix = "\1\1\1\1\n"
45054 message_suffix = "\1\1\1\1\n"
45055 </literallayout>
45056 <para>
45057 <indexterm role="option">
45058 <primary><option>create_directory</option></primary>
45059 </indexterm>
45060 </para>
45061 <informaltable frame="all">
45062 <tgroup cols="4" colsep="0" rowsep="0">
45063 <colspec colwidth="8*" align="left"/>
45064 <colspec colwidth="6*" align="center"/>
45065 <colspec colwidth="6*" align="center"/>
45066 <colspec colwidth="6*" align="right"/>
45067 <tbody>
45068 <row>
45069 <entry><option>create_directory</option></entry>
45070 <entry>Use: <emphasis>appendfile</emphasis></entry>
45071 <entry>Type: <emphasis>boolean</emphasis></entry>
45072 <entry>Default: <emphasis>true</emphasis></entry>
45073 </row>
45074 </tbody>
45075 </tgroup>
45076 </informaltable>
45077 <para>
45078 <indexterm role="concept">
45079 <primary>directory creation</primary>
45080 </indexterm>
45081 When this option is true, Exim attempts to create any missing superior
45082 directories for the file that it is about to write. A created directory&#x2019;s mode
45083 is given by the <option>directory_mode</option> option.
45084 </para>
45085 <para>
45086 The group ownership of a newly created directory is highly dependent on the
45087 operating system (and possibly the file system) that is being used. For
45088 example, in Solaris, if the parent directory has the setgid bit set, its group
45089 is propagated to the child; if not, the currently set group is used. However,
45090 in FreeBSD, the parent&#x2019;s group is always used.
45091 </para>
45092 <para>
45093 <indexterm role="option">
45094 <primary><option>create_file</option></primary>
45095 </indexterm>
45096 </para>
45097 <informaltable frame="all">
45098 <tgroup cols="4" colsep="0" rowsep="0">
45099 <colspec colwidth="8*" align="left"/>
45100 <colspec colwidth="6*" align="center"/>
45101 <colspec colwidth="6*" align="center"/>
45102 <colspec colwidth="6*" align="right"/>
45103 <tbody>
45104 <row>
45105 <entry><option>create_file</option></entry>
45106 <entry>Use: <emphasis>appendfile</emphasis></entry>
45107 <entry>Type: <emphasis>string</emphasis></entry>
45108 <entry>Default: <emphasis>anywhere</emphasis></entry>
45109 </row>
45110 </tbody>
45111 </tgroup>
45112 </informaltable>
45113 <para>
45114 This option constrains the location of files and directories that are created
45115 by this transport. It applies to files defined by the <option>file</option> option and
45116 directories defined by the <option>directory</option> option. In the case of maildir
45117 delivery, it applies to the top level directory, not the maildir directories
45118 beneath.
45119 </para>
45120 <para>
45121 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
45122 <quote>belowhome</quote>, or to an absolute path.
45123 </para>
45124 <para>
45125 In the second and third cases, a home directory must have been
45126 set for the transport, and the file or directory being created must
45127 reside within it.
45128 The "belowhome" checking additionally checks for attempts to use "../"
45129 to evade the testing.
45130 This option is not useful when an explicit filename is
45131 given for normal mailbox deliveries. It is intended for the case when filenames
45132 are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
45133 by an <command>appendfile</command> transport called <option>address_file</option>. See also
45134 <option>file_must_exist</option>.
45135 </para>
45136 <para>
45137 In the fourth case,
45138 the value given for this option must be an absolute path for an
45139 existing directory.
45140 The value is used for checking instead of a home directory;
45141 checking is done in "belowhome" mode.
45142 </para>
45143 <para>
45144 <indexterm role="concept">
45145 <primary>tainted data</primary>
45146 <secondary>de-tainting</secondary>
45147 </indexterm>
45148 <indexterm role="concept">
45149 <primary>de-tainting</primary>
45150 <secondary>using appendfile create_file option</secondary>
45151 </indexterm>
45152 If "belowhome" checking is used, the file or directory path
45153 becomes de-tainted.
45154 </para>
45155 <para>
45156 <indexterm role="option">
45157 <primary><option>directory</option></primary>
45158 </indexterm>
45159 </para>
45160 <informaltable frame="all">
45161 <tgroup cols="4" colsep="0" rowsep="0">
45162 <colspec colwidth="8*" align="left"/>
45163 <colspec colwidth="6*" align="center"/>
45164 <colspec colwidth="6*" align="center"/>
45165 <colspec colwidth="6*" align="right"/>
45166 <tbody>
45167 <row>
45168 <entry><option>directory</option></entry>
45169 <entry>Use: <emphasis>appendfile</emphasis></entry>
45170 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45171 <entry>Default: <emphasis>unset</emphasis></entry>
45172 </row>
45173 </tbody>
45174 </tgroup>
45175 </informaltable>
45176 <para>
45177 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
45178 or <option>directory</option> must be set, unless the delivery is the direct result of a
45179 redirection (see section <xref linkend="SECTfildiropt"/>).
45180 </para>
45181 <para>
45182 When <option>directory</option> is set, the string is expanded, and the message is delivered
45183 into a new file or files in or below the given directory, instead of being
45184 appended to a single mailbox file. A number of different formats are provided
45185 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
45186 <xref linkend="SECTopdir"/> for further details of this form of delivery.
45187 </para>
45188 <para>
45189 The result of expansion must not be tainted, unless the <option>create_file</option> option
45190 specifies a path.
45191 </para>
45192 <para>
45193 <indexterm role="option">
45194 <primary><option>directory_file</option></primary>
45195 </indexterm>
45196 </para>
45197 <informaltable frame="all">
45198 <tgroup cols="4" colsep="0" rowsep="0">
45199 <colspec colwidth="8*" align="left"/>
45200 <colspec colwidth="6*" align="center"/>
45201 <colspec colwidth="6*" align="center"/>
45202 <colspec colwidth="6*" align="right"/>
45203 <tbody>
45204 <row>
45205 <entry><option>directory_file</option></entry>
45206 <entry>Use: <emphasis>appendfile</emphasis></entry>
45207 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45208 <entry>Default: <emphasis>see below</emphasis></entry>
45209 </row>
45210 </tbody>
45211 </tgroup>
45212 </informaltable>
45213 <para>
45214 <indexterm role="concept">
45215 <primary>base62</primary>
45216 </indexterm>
45217 <indexterm role="variable">
45218 <primary><varname>$inode</varname></primary>
45219 </indexterm>
45220 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
45221 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
45222 whose name is obtained by expanding this string. The default value is:
45223 </para>
45224 <literallayout class="monospaced">
45225 q${base62:$tod_epoch}-$inode
45226 </literallayout>
45227 <para>
45228 This generates a unique name from the current time, in base 62 form, and the
45229 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
45230 option.
45231 </para>
45232 <para>
45233 <indexterm role="option">
45234 <primary><option>directory_mode</option></primary>
45235 </indexterm>
45236 </para>
45237 <informaltable frame="all">
45238 <tgroup cols="4" colsep="0" rowsep="0">
45239 <colspec colwidth="8*" align="left"/>
45240 <colspec colwidth="6*" align="center"/>
45241 <colspec colwidth="6*" align="center"/>
45242 <colspec colwidth="6*" align="right"/>
45243 <tbody>
45244 <row>
45245 <entry><option>directory_mode</option></entry>
45246 <entry>Use: <emphasis>appendfile</emphasis></entry>
45247 <entry>Type: <emphasis>octal integer</emphasis></entry>
45248 <entry>Default: <emphasis>0700</emphasis></entry>
45249 </row>
45250 </tbody>
45251 </tgroup>
45252 </informaltable>
45253 <para>
45254 If <command>appendfile</command> creates any directories as a result of the
45255 <option>create_directory</option> option, their mode is specified by this option.
45256 </para>
45257 <para>
45258 <indexterm role="option">
45259 <primary><option>escape_string</option></primary>
45260 </indexterm>
45261 </para>
45262 <informaltable frame="all">
45263 <tgroup cols="4" colsep="0" rowsep="0">
45264 <colspec colwidth="8*" align="left"/>
45265 <colspec colwidth="6*" align="center"/>
45266 <colspec colwidth="6*" align="center"/>
45267 <colspec colwidth="6*" align="right"/>
45268 <tbody>
45269 <row>
45270 <entry><option>escape_string</option></entry>
45271 <entry>Use: <emphasis>appendfile</emphasis></entry>
45272 <entry>Type: <emphasis>string</emphasis></entry>
45273 <entry>Default: <emphasis>see description</emphasis></entry>
45274 </row>
45275 </tbody>
45276 </tgroup>
45277 </informaltable>
45278 <para>
45279 See <option>check_string</option> above.
45280 </para>
45281 <para>
45282 <indexterm role="option">
45283 <primary><option>file</option></primary>
45284 </indexterm>
45285 </para>
45286 <informaltable frame="all">
45287 <tgroup cols="4" colsep="0" rowsep="0">
45288 <colspec colwidth="8*" align="left"/>
45289 <colspec colwidth="6*" align="center"/>
45290 <colspec colwidth="6*" align="center"/>
45291 <colspec colwidth="6*" align="right"/>
45292 <tbody>
45293 <row>
45294 <entry><option>file</option></entry>
45295 <entry>Use: <emphasis>appendfile</emphasis></entry>
45296 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45297 <entry>Default: <emphasis>unset</emphasis></entry>
45298 </row>
45299 </tbody>
45300 </tgroup>
45301 </informaltable>
45302 <para>
45303 This option is mutually exclusive with the <option>directory</option> option, but one of
45304 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
45305 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
45306 specifies a single file, to which the message is appended. One or more of
45307 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
45308 <option>file</option>.
45309 </para>
45310 <para>
45311 The result of expansion must not be tainted, unless the <option>create_file</option> option
45312 specifies a path.
45313 </para>
45314 <para>
45315 <indexterm role="concept">
45316 <primary>NFS</primary>
45317 <secondary>lock file</secondary>
45318 </indexterm>
45319 <indexterm role="concept">
45320 <primary>locking files</primary>
45321 </indexterm>
45322 <indexterm role="concept">
45323 <primary>lock files</primary>
45324 </indexterm>
45325 If you are using more than one host to deliver over NFS into the same
45326 mailboxes, you should always use lock files.
45327 </para>
45328 <para>
45329 The string value is expanded for each delivery, and must yield an absolute
45330 path. The most common settings of this option are variations on one of these
45331 examples:
45332 </para>
45333 <literallayout class="monospaced">
45334 file = /var/spool/mail/$local_part_data
45335 file = /home/$local_part_data/inbox
45336 file = $home/inbox
45337 </literallayout>
45338 <para>
45339 <indexterm role="concept">
45340 <primary><quote>sticky</quote> bit</primary>
45341 </indexterm>
45342 In the first example, all deliveries are done into the same directory. If Exim
45343 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
45344 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
45345 deliveries to be possible, or alternatively the <option>group</option> option can be used to
45346 run the delivery under a group id which has write access to the directory.
45347 </para>
45348 <para>
45349 <indexterm role="option">
45350 <primary><option>file_format</option></primary>
45351 </indexterm>
45352 </para>
45353 <informaltable frame="all">
45354 <tgroup cols="4" colsep="0" rowsep="0">
45355 <colspec colwidth="8*" align="left"/>
45356 <colspec colwidth="6*" align="center"/>
45357 <colspec colwidth="6*" align="center"/>
45358 <colspec colwidth="6*" align="right"/>
45359 <tbody>
45360 <row>
45361 <entry><option>file_format</option></entry>
45362 <entry>Use: <emphasis>appendfile</emphasis></entry>
45363 <entry>Type: <emphasis>string</emphasis></entry>
45364 <entry>Default: <emphasis>unset</emphasis></entry>
45365 </row>
45366 </tbody>
45367 </tgroup>
45368 </informaltable>
45369 <para>
45370 <indexterm role="concept">
45371 <primary>file</primary>
45372 <secondary>mailbox; checking existing format</secondary>
45373 </indexterm>
45374 This option requests the transport to check the format of an existing file
45375 before adding to it. The check consists of matching a specific string at the
45376 start of the file. The value of the option consists of an even number of
45377 colon-separated strings. The first of each pair is the test string, and the
45378 second is the name of a transport. If the transport associated with a matched
45379 string is not the current transport, control is passed over to the other
45380 transport. For example, suppose the standard <command>local_delivery</command> transport has
45381 this added to it:
45382 </para>
45383 <literallayout class="monospaced">
45384 file_format = "From       : local_delivery :\
45385                \1\1\1\1\n : local_mmdf_delivery"
45386 </literallayout>
45387 <para>
45388 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
45389 a mailbox begins with four binary ones followed by a newline, control is passed
45390 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
45391 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
45392 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
45393 match any string, or if the transport named for a given string is not defined,
45394 delivery is deferred.
45395 </para>
45396 <para>
45397 <indexterm role="option">
45398 <primary><option>file_must_exist</option></primary>
45399 </indexterm>
45400 </para>
45401 <informaltable frame="all">
45402 <tgroup cols="4" colsep="0" rowsep="0">
45403 <colspec colwidth="8*" align="left"/>
45404 <colspec colwidth="6*" align="center"/>
45405 <colspec colwidth="6*" align="center"/>
45406 <colspec colwidth="6*" align="right"/>
45407 <tbody>
45408 <row>
45409 <entry><option>file_must_exist</option></entry>
45410 <entry>Use: <emphasis>appendfile</emphasis></entry>
45411 <entry>Type: <emphasis>boolean</emphasis></entry>
45412 <entry>Default: <emphasis>false</emphasis></entry>
45413 </row>
45414 </tbody>
45415 </tgroup>
45416 </informaltable>
45417 <para>
45418 If this option is true, the file specified by the <option>file</option> option must exist.
45419 A temporary error occurs if it does not, causing delivery to be deferred.
45420 If this option is false, the file is created if it does not exist.
45421 </para>
45422 <para>
45423 <indexterm role="option">
45424 <primary><option>lock_fcntl_timeout</option></primary>
45425 </indexterm>
45426 </para>
45427 <informaltable frame="all">
45428 <tgroup cols="4" colsep="0" rowsep="0">
45429 <colspec colwidth="8*" align="left"/>
45430 <colspec colwidth="6*" align="center"/>
45431 <colspec colwidth="6*" align="center"/>
45432 <colspec colwidth="6*" align="right"/>
45433 <tbody>
45434 <row>
45435 <entry><option>lock_fcntl_timeout</option></entry>
45436 <entry>Use: <emphasis>appendfile</emphasis></entry>
45437 <entry>Type: <emphasis>time</emphasis></entry>
45438 <entry>Default: <emphasis>0s</emphasis></entry>
45439 </row>
45440 </tbody>
45441 </tgroup>
45442 </informaltable>
45443 <para>
45444 <indexterm role="concept">
45445 <primary>timeout</primary>
45446 <secondary>mailbox locking</secondary>
45447 </indexterm>
45448 <indexterm role="concept">
45449 <primary>mailbox</primary>
45450 <secondary>locking, blocking and non-blocking</secondary>
45451 </indexterm>
45452 <indexterm role="concept">
45453 <primary>locking files</primary>
45454 </indexterm>
45455 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
45456 when locking an open mailbox file. If the call fails, the delivery process
45457 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
45458 Non-blocking calls are used so that the file is not kept open during the wait
45459 for the lock; the reason for this is to make it as safe as possible for
45460 deliveries over NFS in the case when processes might be accessing an NFS
45461 mailbox without using a lock file. This should not be done, but
45462 misunderstandings and hence misconfigurations are not unknown.
45463 </para>
45464 <para>
45465 On a busy system, however, the performance of a non-blocking lock approach is
45466 not as good as using a blocking lock with a timeout. In this case, the waiting
45467 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
45468 and can proceed as soon as the previous lock holder releases it.
45469 </para>
45470 <para>
45471 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
45472 timeout, are used. There may still be some retrying: the maximum number of
45473 retries is
45474 </para>
45475 <literallayout class="monospaced">
45476 (lock_retries * lock_interval) / lock_fcntl_timeout
45477 </literallayout>
45478 <para>
45479 rounded up to the next whole number. In other words, the total time during
45480 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
45481 <option>lock_fcntl_timeout</option> is set very large.
45482 </para>
45483 <para>
45484 You should consider setting this option if you are getting a lot of delayed
45485 local deliveries because of errors of the form
45486 </para>
45487 <literallayout class="monospaced">
45488 failed to lock mailbox /some/file (fcntl)
45489 </literallayout>
45490 <para>
45491 <indexterm role="option">
45492 <primary><option>lock_flock_timeout</option></primary>
45493 </indexterm>
45494 </para>
45495 <informaltable frame="all">
45496 <tgroup cols="4" colsep="0" rowsep="0">
45497 <colspec colwidth="8*" align="left"/>
45498 <colspec colwidth="6*" align="center"/>
45499 <colspec colwidth="6*" align="center"/>
45500 <colspec colwidth="6*" align="right"/>
45501 <tbody>
45502 <row>
45503 <entry><option>lock_flock_timeout</option></entry>
45504 <entry>Use: <emphasis>appendfile</emphasis></entry>
45505 <entry>Type: <emphasis>time</emphasis></entry>
45506 <entry>Default: <emphasis>0s</emphasis></entry>
45507 </row>
45508 </tbody>
45509 </tgroup>
45510 </informaltable>
45511 <para>
45512 This timeout applies to file locking when using <function>flock()</function> (see
45513 <option>use_flock</option>); the timeout operates in a similar manner to
45514 <option>lock_fcntl_timeout</option>.
45515 </para>
45516 <para>
45517 <indexterm role="option">
45518 <primary><option>lock_interval</option></primary>
45519 </indexterm>
45520 </para>
45521 <informaltable frame="all">
45522 <tgroup cols="4" colsep="0" rowsep="0">
45523 <colspec colwidth="8*" align="left"/>
45524 <colspec colwidth="6*" align="center"/>
45525 <colspec colwidth="6*" align="center"/>
45526 <colspec colwidth="6*" align="right"/>
45527 <tbody>
45528 <row>
45529 <entry><option>lock_interval</option></entry>
45530 <entry>Use: <emphasis>appendfile</emphasis></entry>
45531 <entry>Type: <emphasis>time</emphasis></entry>
45532 <entry>Default: <emphasis>3s</emphasis></entry>
45533 </row>
45534 </tbody>
45535 </tgroup>
45536 </informaltable>
45537 <para>
45538 This specifies the time to wait between attempts to lock the file. See below
45539 for details of locking.
45540 </para>
45541 <para>
45542 <indexterm role="option">
45543 <primary><option>lock_retries</option></primary>
45544 </indexterm>
45545 </para>
45546 <informaltable frame="all">
45547 <tgroup cols="4" colsep="0" rowsep="0">
45548 <colspec colwidth="8*" align="left"/>
45549 <colspec colwidth="6*" align="center"/>
45550 <colspec colwidth="6*" align="center"/>
45551 <colspec colwidth="6*" align="right"/>
45552 <tbody>
45553 <row>
45554 <entry><option>lock_retries</option></entry>
45555 <entry>Use: <emphasis>appendfile</emphasis></entry>
45556 <entry>Type: <emphasis>integer</emphasis></entry>
45557 <entry>Default: <emphasis>10</emphasis></entry>
45558 </row>
45559 </tbody>
45560 </tgroup>
45561 </informaltable>
45562 <para>
45563 This specifies the maximum number of attempts to lock the file. A value of zero
45564 is treated as 1. See below for details of locking.
45565 </para>
45566 <para>
45567 <indexterm role="option">
45568 <primary><option>lockfile_mode</option></primary>
45569 </indexterm>
45570 </para>
45571 <informaltable frame="all">
45572 <tgroup cols="4" colsep="0" rowsep="0">
45573 <colspec colwidth="8*" align="left"/>
45574 <colspec colwidth="6*" align="center"/>
45575 <colspec colwidth="6*" align="center"/>
45576 <colspec colwidth="6*" align="right"/>
45577 <tbody>
45578 <row>
45579 <entry><option>lockfile_mode</option></entry>
45580 <entry>Use: <emphasis>appendfile</emphasis></entry>
45581 <entry>Type: <emphasis>octal integer</emphasis></entry>
45582 <entry>Default: <emphasis>0600</emphasis></entry>
45583 </row>
45584 </tbody>
45585 </tgroup>
45586 </informaltable>
45587 <para>
45588 This specifies the mode of the created lock file, when a lock file is being
45589 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
45590 </para>
45591 <para>
45592 <indexterm role="option">
45593 <primary><option>lockfile_timeout</option></primary>
45594 </indexterm>
45595 </para>
45596 <informaltable frame="all">
45597 <tgroup cols="4" colsep="0" rowsep="0">
45598 <colspec colwidth="8*" align="left"/>
45599 <colspec colwidth="6*" align="center"/>
45600 <colspec colwidth="6*" align="center"/>
45601 <colspec colwidth="6*" align="right"/>
45602 <tbody>
45603 <row>
45604 <entry><option>lockfile_timeout</option></entry>
45605 <entry>Use: <emphasis>appendfile</emphasis></entry>
45606 <entry>Type: <emphasis>time</emphasis></entry>
45607 <entry>Default: <emphasis>30m</emphasis></entry>
45608 </row>
45609 </tbody>
45610 </tgroup>
45611 </informaltable>
45612 <para>
45613 <indexterm role="concept">
45614 <primary>timeout</primary>
45615 <secondary>mailbox locking</secondary>
45616 </indexterm>
45617 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
45618 exists and is older than this value, it is assumed to have been left behind by
45619 accident, and Exim attempts to remove it.
45620 </para>
45621 <para>
45622 <indexterm role="option">
45623 <primary><option>mailbox_filecount</option></primary>
45624 </indexterm>
45625 </para>
45626 <informaltable frame="all">
45627 <tgroup cols="4" colsep="0" rowsep="0">
45628 <colspec colwidth="8*" align="left"/>
45629 <colspec colwidth="6*" align="center"/>
45630 <colspec colwidth="6*" align="center"/>
45631 <colspec colwidth="6*" align="right"/>
45632 <tbody>
45633 <row>
45634 <entry><option>mailbox_filecount</option></entry>
45635 <entry>Use: <emphasis>appendfile</emphasis></entry>
45636 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45637 <entry>Default: <emphasis>unset</emphasis></entry>
45638 </row>
45639 </tbody>
45640 </tgroup>
45641 </informaltable>
45642 <para>
45643 <indexterm role="concept">
45644 <primary>mailbox</primary>
45645 <secondary>specifying size of</secondary>
45646 </indexterm>
45647 <indexterm role="concept">
45648 <primary>size</primary>
45649 <secondary>of mailbox</secondary>
45650 </indexterm>
45651 If this option is set, it is expanded, and the result is taken as the current
45652 number of files in the mailbox. It must be a decimal number, optionally
45653 followed by K or M. This provides a way of obtaining this information from an
45654 external source that maintains the data.
45655 </para>
45656 <para>
45657 <indexterm role="option">
45658 <primary><option>mailbox_size</option></primary>
45659 </indexterm>
45660 </para>
45661 <informaltable frame="all">
45662 <tgroup cols="4" colsep="0" rowsep="0">
45663 <colspec colwidth="8*" align="left"/>
45664 <colspec colwidth="6*" align="center"/>
45665 <colspec colwidth="6*" align="center"/>
45666 <colspec colwidth="6*" align="right"/>
45667 <tbody>
45668 <row>
45669 <entry><option>mailbox_size</option></entry>
45670 <entry>Use: <emphasis>appendfile</emphasis></entry>
45671 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45672 <entry>Default: <emphasis>unset</emphasis></entry>
45673 </row>
45674 </tbody>
45675 </tgroup>
45676 </informaltable>
45677 <para>
45678 <indexterm role="concept">
45679 <primary>mailbox</primary>
45680 <secondary>specifying size of</secondary>
45681 </indexterm>
45682 <indexterm role="concept">
45683 <primary>size</primary>
45684 <secondary>of mailbox</secondary>
45685 </indexterm>
45686 If this option is set, it is expanded, and the result is taken as the current
45687 size the mailbox. It must be a decimal number, optionally followed by K or M.
45688 This provides a way of obtaining this information from an external source that
45689 maintains the data. This is likely to be helpful for maildir deliveries where
45690 it is computationally expensive to compute the size of a mailbox.
45691 </para>
45692 <para>
45693 <indexterm role="option">
45694 <primary><option>maildir_format</option></primary>
45695 </indexterm>
45696 </para>
45697 <informaltable frame="all">
45698 <tgroup cols="4" colsep="0" rowsep="0">
45699 <colspec colwidth="8*" align="left"/>
45700 <colspec colwidth="6*" align="center"/>
45701 <colspec colwidth="6*" align="center"/>
45702 <colspec colwidth="6*" align="right"/>
45703 <tbody>
45704 <row>
45705 <entry><option>maildir_format</option></entry>
45706 <entry>Use: <emphasis>appendfile</emphasis></entry>
45707 <entry>Type: <emphasis>boolean</emphasis></entry>
45708 <entry>Default: <emphasis>false</emphasis></entry>
45709 </row>
45710 </tbody>
45711 </tgroup>
45712 </informaltable>
45713 <para>
45714 <indexterm role="concept">
45715 <primary>maildir format</primary>
45716 <secondary>specifying</secondary>
45717 </indexterm>
45718 If this option is set with the <option>directory</option> option, the delivery is into a new
45719 file, in the <quote>maildir</quote> format that is used by other mail software. When the
45720 transport is activated directly from a <command>redirect</command> router (for example, the
45721 <command>address_file</command> transport in the default configuration), setting
45722 <option>maildir_format</option> causes the path received from the router to be treated as a
45723 directory, whether or not it ends with <literal>/</literal>. This option is available only if
45724 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
45725 <xref linkend="SECTmaildirdelivery"/> below for further details.
45726 </para>
45727 <para>
45728 <indexterm role="option">
45729 <primary><option>maildir_quota_directory_regex</option></primary>
45730 </indexterm>
45731 </para>
45732 <informaltable frame="all">
45733 <tgroup cols="4" colsep="0" rowsep="0">
45734 <colspec colwidth="8*" align="left"/>
45735 <colspec colwidth="6*" align="center"/>
45736 <colspec colwidth="6*" align="center"/>
45737 <colspec colwidth="6*" align="right"/>
45738 <tbody>
45739 <row>
45740 <entry><option>maildir_quota_directory_regex</option></entry>
45741 <entry>Use: <emphasis>appendfile</emphasis></entry>
45742 <entry>Type: <emphasis>string</emphasis></entry>
45743 <entry>Default: <emphasis>See below</emphasis></entry>
45744 </row>
45745 </tbody>
45746 </tgroup>
45747 </informaltable>
45748 <para>
45749 <indexterm role="concept">
45750 <primary>maildir format</primary>
45751 <secondary>quota; directories included in</secondary>
45752 </indexterm>
45753 <indexterm role="concept">
45754 <primary>quota</primary>
45755 <secondary>maildir; directories included in</secondary>
45756 </indexterm>
45757 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
45758 a regular expression for specifying directories, relative to the quota
45759 directory (see <option>quota_directory</option>), that should be included in the quota
45760 calculation. The default value is:
45761 </para>
45762 <literallayout class="monospaced">
45763 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
45764 </literallayout>
45765 <para>
45766 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
45767 (directories whose names begin with a dot). If you want to exclude the
45768 <filename>Trash</filename>
45769 folder from the count (as some sites do), you need to change this setting to
45770 </para>
45771 <literallayout class="monospaced">
45772 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
45773 </literallayout>
45774 <para>
45775 This uses a negative lookahead in the regular expression to exclude the
45776 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
45777 calculations, quota processing is bypassed for any messages that are delivered
45778 directly into that directory.
45779 </para>
45780 <para>
45781 <indexterm role="option">
45782 <primary><option>maildir_retries</option></primary>
45783 </indexterm>
45784 </para>
45785 <informaltable frame="all">
45786 <tgroup cols="4" colsep="0" rowsep="0">
45787 <colspec colwidth="8*" align="left"/>
45788 <colspec colwidth="6*" align="center"/>
45789 <colspec colwidth="6*" align="center"/>
45790 <colspec colwidth="6*" align="right"/>
45791 <tbody>
45792 <row>
45793 <entry><option>maildir_retries</option></entry>
45794 <entry>Use: <emphasis>appendfile</emphasis></entry>
45795 <entry>Type: <emphasis>integer</emphasis></entry>
45796 <entry>Default: <emphasis>10</emphasis></entry>
45797 </row>
45798 </tbody>
45799 </tgroup>
45800 </informaltable>
45801 <para>
45802 This option specifies the number of times to retry when writing a file in
45803 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
45804 </para>
45805 <para>
45806 <indexterm role="option">
45807 <primary><option>maildir_tag</option></primary>
45808 </indexterm>
45809 </para>
45810 <informaltable frame="all">
45811 <tgroup cols="4" colsep="0" rowsep="0">
45812 <colspec colwidth="8*" align="left"/>
45813 <colspec colwidth="6*" align="center"/>
45814 <colspec colwidth="6*" align="center"/>
45815 <colspec colwidth="6*" align="right"/>
45816 <tbody>
45817 <row>
45818 <entry><option>maildir_tag</option></entry>
45819 <entry>Use: <emphasis>appendfile</emphasis></entry>
45820 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45821 <entry>Default: <emphasis>unset</emphasis></entry>
45822 </row>
45823 </tbody>
45824 </tgroup>
45825 </informaltable>
45826 <para>
45827 This option applies only to deliveries in maildir format, and is described in
45828 section <xref linkend="SECTmaildirdelivery"/> below.
45829 </para>
45830 <para>
45831 <indexterm role="option">
45832 <primary><option>maildir_use_size_file</option></primary>
45833 </indexterm>
45834 </para>
45835 <informaltable frame="all">
45836 <tgroup cols="4" colsep="0" rowsep="0">
45837 <colspec colwidth="8*" align="left"/>
45838 <colspec colwidth="6*" align="center"/>
45839 <colspec colwidth="6*" align="center"/>
45840 <colspec colwidth="6*" align="right"/>
45841 <tbody>
45842 <row>
45843 <entry><option>maildir_use_size_file</option></entry>
45844 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
45845 <entry>Type: <emphasis>boolean</emphasis></entry>
45846 <entry>Default: <emphasis>false</emphasis></entry>
45847 </row>
45848 </tbody>
45849 </tgroup>
45850 </informaltable>
45851 <para>
45852 <indexterm role="concept">
45853 <primary>maildir format</primary>
45854 <secondary><filename>maildirsize</filename> file</secondary>
45855 </indexterm>
45856 The result of string expansion for this option must be a valid boolean value.
45857 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
45858 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
45859 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
45860 value is zero. See <option>maildir_quota_directory_regex</option> above and section
45861 <xref linkend="SECTmaildirdelivery"/> below for further details.
45862 </para>
45863 <para>
45864 <indexterm role="option">
45865 <primary><option>maildirfolder_create_regex</option></primary>
45866 </indexterm>
45867 </para>
45868 <informaltable frame="all">
45869 <tgroup cols="4" colsep="0" rowsep="0">
45870 <colspec colwidth="8*" align="left"/>
45871 <colspec colwidth="6*" align="center"/>
45872 <colspec colwidth="6*" align="center"/>
45873 <colspec colwidth="6*" align="right"/>
45874 <tbody>
45875 <row>
45876 <entry><option>maildirfolder_create_regex</option></entry>
45877 <entry>Use: <emphasis>appendfile</emphasis></entry>
45878 <entry>Type: <emphasis>string</emphasis></entry>
45879 <entry>Default: <emphasis>unset</emphasis></entry>
45880 </row>
45881 </tbody>
45882 </tgroup>
45883 </informaltable>
45884 <para>
45885 <indexterm role="concept">
45886 <primary>maildir format</primary>
45887 <secondary><filename>maildirfolder</filename> file</secondary>
45888 </indexterm>
45889 <indexterm role="concept">
45890 <primary><filename>maildirfolder</filename>, creating</primary>
45891 </indexterm>
45892 The value of this option is a regular expression. If it is unset, it has no
45893 effect. Otherwise, before a maildir delivery takes place, the pattern is
45894 matched against the name of the maildir directory, that is, the directory
45895 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
45896 delivery. If there is a match, Exim checks for the existence of a file called
45897 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
45898 See section <xref linkend="SECTmaildirdelivery"/> for more details.
45899 </para>
45900 <para>
45901 <indexterm role="option">
45902 <primary><option>mailstore_format</option></primary>
45903 </indexterm>
45904 </para>
45905 <informaltable frame="all">
45906 <tgroup cols="4" colsep="0" rowsep="0">
45907 <colspec colwidth="8*" align="left"/>
45908 <colspec colwidth="6*" align="center"/>
45909 <colspec colwidth="6*" align="center"/>
45910 <colspec colwidth="6*" align="right"/>
45911 <tbody>
45912 <row>
45913 <entry><option>mailstore_format</option></entry>
45914 <entry>Use: <emphasis>appendfile</emphasis></entry>
45915 <entry>Type: <emphasis>boolean</emphasis></entry>
45916 <entry>Default: <emphasis>false</emphasis></entry>
45917 </row>
45918 </tbody>
45919 </tgroup>
45920 </informaltable>
45921 <para>
45922 <indexterm role="concept">
45923 <primary>mailstore format</primary>
45924 <secondary>specifying</secondary>
45925 </indexterm>
45926 If this option is set with the <option>directory</option> option, the delivery is into two
45927 new files in  <quote>mailstore</quote> format. The option is available only if
45928 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
45929 below for further details.
45930 </para>
45931 <para>
45932 <indexterm role="option">
45933 <primary><option>mailstore_prefix</option></primary>
45934 </indexterm>
45935 </para>
45936 <informaltable frame="all">
45937 <tgroup cols="4" colsep="0" rowsep="0">
45938 <colspec colwidth="8*" align="left"/>
45939 <colspec colwidth="6*" align="center"/>
45940 <colspec colwidth="6*" align="center"/>
45941 <colspec colwidth="6*" align="right"/>
45942 <tbody>
45943 <row>
45944 <entry><option>mailstore_prefix</option></entry>
45945 <entry>Use: <emphasis>appendfile</emphasis></entry>
45946 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45947 <entry>Default: <emphasis>unset</emphasis></entry>
45948 </row>
45949 </tbody>
45950 </tgroup>
45951 </informaltable>
45952 <para>
45953 This option applies only to deliveries in mailstore format, and is described in
45954 section <xref linkend="SECTopdir"/> below.
45955 </para>
45956 <para>
45957 <indexterm role="option">
45958 <primary><option>mailstore_suffix</option></primary>
45959 </indexterm>
45960 </para>
45961 <informaltable frame="all">
45962 <tgroup cols="4" colsep="0" rowsep="0">
45963 <colspec colwidth="8*" align="left"/>
45964 <colspec colwidth="6*" align="center"/>
45965 <colspec colwidth="6*" align="center"/>
45966 <colspec colwidth="6*" align="right"/>
45967 <tbody>
45968 <row>
45969 <entry><option>mailstore_suffix</option></entry>
45970 <entry>Use: <emphasis>appendfile</emphasis></entry>
45971 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45972 <entry>Default: <emphasis>unset</emphasis></entry>
45973 </row>
45974 </tbody>
45975 </tgroup>
45976 </informaltable>
45977 <para>
45978 This option applies only to deliveries in mailstore format, and is described in
45979 section <xref linkend="SECTopdir"/> below.
45980 </para>
45981 <para>
45982 <indexterm role="option">
45983 <primary><option>mbx_format</option></primary>
45984 </indexterm>
45985 </para>
45986 <informaltable frame="all">
45987 <tgroup cols="4" colsep="0" rowsep="0">
45988 <colspec colwidth="8*" align="left"/>
45989 <colspec colwidth="6*" align="center"/>
45990 <colspec colwidth="6*" align="center"/>
45991 <colspec colwidth="6*" align="right"/>
45992 <tbody>
45993 <row>
45994 <entry><option>mbx_format</option></entry>
45995 <entry>Use: <emphasis>appendfile</emphasis></entry>
45996 <entry>Type: <emphasis>boolean</emphasis></entry>
45997 <entry>Default: <emphasis>false</emphasis></entry>
45998 </row>
45999 </tbody>
46000 </tgroup>
46001 </informaltable>
46002 <para>
46003 <indexterm role="concept">
46004 <primary>locking files</primary>
46005 </indexterm>
46006 <indexterm role="concept">
46007 <primary>file</primary>
46008 <secondary>locking</secondary>
46009 </indexterm>
46010 <indexterm role="concept">
46011 <primary>file</primary>
46012 <secondary>MBX format</secondary>
46013 </indexterm>
46014 <indexterm role="concept">
46015 <primary>MBX format, specifying</primary>
46016 </indexterm>
46017 This option is available only if Exim has been compiled with SUPPORT_MBX
46018 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
46019 the message is appended to the mailbox file in MBX format instead of
46020 traditional Unix format. This format is supported by Pine4 and its associated
46021 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
46022 </para>
46023 <para>
46024 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
46025 automatically changed by the use of <option>mbx_format</option>. They should normally be set
46026 empty when using MBX format, so this option almost always appears in this
46027 combination:
46028 </para>
46029 <literallayout class="monospaced">
46030 mbx_format = true
46031 message_prefix =
46032 message_suffix =
46033 </literallayout>
46034 <para>
46035 If none of the locking options are mentioned in the configuration,
46036 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
46037 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
46038 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
46039 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
46040 should not be used if any program that does not use this form of locking is
46041 going to access the mailbox, nor should it be used if the mailbox file is NFS
46042 mounted, because it works only when the mailbox is accessed from a single host.
46043 </para>
46044 <para>
46045 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
46046 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
46047 (this means for the whole of a Pine or IMAP session), Exim will not be able to
46048 append messages to it.
46049 </para>
46050 <para>
46051 <indexterm role="option">
46052 <primary><option>message_prefix</option></primary>
46053 </indexterm>
46054 </para>
46055 <informaltable frame="all">
46056 <tgroup cols="4" colsep="0" rowsep="0">
46057 <colspec colwidth="8*" align="left"/>
46058 <colspec colwidth="6*" align="center"/>
46059 <colspec colwidth="6*" align="center"/>
46060 <colspec colwidth="6*" align="right"/>
46061 <tbody>
46062 <row>
46063 <entry><option>message_prefix</option></entry>
46064 <entry>Use: <emphasis>appendfile</emphasis></entry>
46065 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46066 <entry>Default: <emphasis>see below</emphasis></entry>
46067 </row>
46068 </tbody>
46069 </tgroup>
46070 </informaltable>
46071 <para>
46072 <indexterm role="concept">
46073 <primary><quote>From</quote> line</primary>
46074 </indexterm>
46075 The string specified here is expanded and output at the start of every message.
46076 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
46077 in which case it is:
46078 </para>
46079 <literallayout class="monospaced">
46080 message_prefix = "From ${if def:return_path{$return_path}\
46081   {MAILER-DAEMON}} $tod_bsdinbox\n"
46082 </literallayout>
46083 <para>
46084 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
46085 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
46086 </para>
46087 <para>
46088 <indexterm role="option">
46089 <primary><option>message_suffix</option></primary>
46090 </indexterm>
46091 </para>
46092 <informaltable frame="all">
46093 <tgroup cols="4" colsep="0" rowsep="0">
46094 <colspec colwidth="8*" align="left"/>
46095 <colspec colwidth="6*" align="center"/>
46096 <colspec colwidth="6*" align="center"/>
46097 <colspec colwidth="6*" align="right"/>
46098 <tbody>
46099 <row>
46100 <entry><option>message_suffix</option></entry>
46101 <entry>Use: <emphasis>appendfile</emphasis></entry>
46102 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46103 <entry>Default: <emphasis>see below</emphasis></entry>
46104 </row>
46105 </tbody>
46106 </tgroup>
46107 </informaltable>
46108 <para>
46109 The string specified here is expanded and output at the end of every message.
46110 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
46111 in which case it is a single newline character. The suffix can be suppressed by
46112 setting
46113 </para>
46114 <literallayout class="monospaced">
46115 message_suffix =
46116 </literallayout>
46117 <para>
46118 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
46119 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
46120 </para>
46121 <para>
46122 <indexterm role="option">
46123 <primary><option>mode</option></primary>
46124 </indexterm>
46125 </para>
46126 <informaltable frame="all">
46127 <tgroup cols="4" colsep="0" rowsep="0">
46128 <colspec colwidth="8*" align="left"/>
46129 <colspec colwidth="6*" align="center"/>
46130 <colspec colwidth="6*" align="center"/>
46131 <colspec colwidth="6*" align="right"/>
46132 <tbody>
46133 <row>
46134 <entry><option>mode</option></entry>
46135 <entry>Use: <emphasis>appendfile</emphasis></entry>
46136 <entry>Type: <emphasis>octal integer</emphasis></entry>
46137 <entry>Default: <emphasis>0600</emphasis></entry>
46138 </row>
46139 </tbody>
46140 </tgroup>
46141 </informaltable>
46142 <para>
46143 If the output file is created, it is given this mode. If it already exists and
46144 has wider permissions, they are reduced to this mode. If it has narrower
46145 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
46146 if the delivery is the result of a <option>save</option> command in a filter file specifying
46147 a particular mode, the mode of the output file is always forced to take that
46148 value, and this option is ignored.
46149 </para>
46150 <para>
46151 <indexterm role="option">
46152 <primary><option>mode_fail_narrower</option></primary>
46153 </indexterm>
46154 </para>
46155 <informaltable frame="all">
46156 <tgroup cols="4" colsep="0" rowsep="0">
46157 <colspec colwidth="8*" align="left"/>
46158 <colspec colwidth="6*" align="center"/>
46159 <colspec colwidth="6*" align="center"/>
46160 <colspec colwidth="6*" align="right"/>
46161 <tbody>
46162 <row>
46163 <entry><option>mode_fail_narrower</option></entry>
46164 <entry>Use: <emphasis>appendfile</emphasis></entry>
46165 <entry>Type: <emphasis>boolean</emphasis></entry>
46166 <entry>Default: <emphasis>true</emphasis></entry>
46167 </row>
46168 </tbody>
46169 </tgroup>
46170 </informaltable>
46171 <para>
46172 This option applies in the case when an existing mailbox file has a narrower
46173 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
46174 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
46175 continues with the delivery attempt, using the existing mode of the file.
46176 </para>
46177 <para>
46178 <indexterm role="option">
46179 <primary><option>notify_comsat</option></primary>
46180 </indexterm>
46181 </para>
46182 <informaltable frame="all">
46183 <tgroup cols="4" colsep="0" rowsep="0">
46184 <colspec colwidth="8*" align="left"/>
46185 <colspec colwidth="6*" align="center"/>
46186 <colspec colwidth="6*" align="center"/>
46187 <colspec colwidth="6*" align="right"/>
46188 <tbody>
46189 <row>
46190 <entry><option>notify_comsat</option></entry>
46191 <entry>Use: <emphasis>appendfile</emphasis></entry>
46192 <entry>Type: <emphasis>boolean</emphasis></entry>
46193 <entry>Default: <emphasis>false</emphasis></entry>
46194 </row>
46195 </tbody>
46196 </tgroup>
46197 </informaltable>
46198 <para>
46199 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
46200 successful delivery to a user mailbox. This is the daemon that notifies logged
46201 on users about incoming mail.
46202 </para>
46203 <para>
46204 <indexterm role="option">
46205 <primary><option>quota</option></primary>
46206 </indexterm>
46207 </para>
46208 <informaltable frame="all">
46209 <tgroup cols="4" colsep="0" rowsep="0">
46210 <colspec colwidth="8*" align="left"/>
46211 <colspec colwidth="6*" align="center"/>
46212 <colspec colwidth="6*" align="center"/>
46213 <colspec colwidth="6*" align="right"/>
46214 <tbody>
46215 <row>
46216 <entry><option>quota</option></entry>
46217 <entry>Use: <emphasis>appendfile</emphasis></entry>
46218 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46219 <entry>Default: <emphasis>unset</emphasis></entry>
46220 </row>
46221 </tbody>
46222 </tgroup>
46223 </informaltable>
46224 <para>
46225 <indexterm role="concept">
46226 <primary>quota</primary>
46227 <secondary>imposed by Exim</secondary>
46228 </indexterm>
46229 This option imposes a limit on the size of the file to which Exim is appending,
46230 or to the total space used in the directory tree when the <option>directory</option> option
46231 is set. In the latter case, computation of the space used is expensive, because
46232 all the files in the directory (and any sub-directories) have to be
46233 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
46234 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
46235 have no shell access to their mailboxes).
46236 </para>
46237 <para>
46238 As there is no interlock against two simultaneous deliveries into a
46239 multi-file mailbox, it is possible for the quota to be overrun in this case.
46240 For single-file mailboxes, of course, an interlock is a necessity.
46241 </para>
46242 <para>
46243 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
46244 may be a lot less than the actual amount of disk space allocated to the file.
46245 If the sizes of a number of files are being added up, the rounding effect can
46246 become quite noticeable, especially on systems that have large block sizes.
46247 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
46248 the obvious value which users understand most easily.
46249 </para>
46250 <para>
46251 The value of the option is expanded, and must then be a numerical value
46252 (decimal point allowed), optionally followed by one of the letters K, M, or G,
46253 for kilobytes, megabytes, or gigabytes, optionally followed by a slash
46254 and further option modifiers. If Exim is running on a system with
46255 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
46256 be handled.
46257 </para>
46258 <para>
46259 The option modifier <option>no_check</option> can be used to force delivery even if the over
46260 quota condition is met. The quota gets updated as usual.
46261 </para>
46262 <para>
46263 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
46264 </para>
46265 <para>
46266 The expansion happens while Exim is running as root, before it changes uid for
46267 the delivery. This means that files that are inaccessible to the end user can
46268 be used to hold quota values that are looked up in the expansion. When delivery
46269 fails because this quota is exceeded, the handling of the error is as for
46270 system quota failures.
46271 </para>
46272 <para>
46273 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
46274 mailbox to the specified maximum size, though the value is not accurate to the
46275 last byte, owing to separator lines and additional headers that may get added
46276 during message delivery. When a mailbox is nearly full, large messages may get
46277 refused even though small ones are accepted, because the size of the current
46278 message is added to the quota when the check is made. This behaviour can be
46279 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
46280 for exceeding the quota does not include the current message. Thus, deliveries
46281 continue until the quota has been exceeded; thereafter, no further messages are
46282 delivered. See also <option>quota_warn_threshold</option>.
46283 </para>
46284 <para>
46285 <indexterm role="option">
46286 <primary><option>quota_directory</option></primary>
46287 </indexterm>
46288 </para>
46289 <informaltable frame="all">
46290 <tgroup cols="4" colsep="0" rowsep="0">
46291 <colspec colwidth="8*" align="left"/>
46292 <colspec colwidth="6*" align="center"/>
46293 <colspec colwidth="6*" align="center"/>
46294 <colspec colwidth="6*" align="right"/>
46295 <tbody>
46296 <row>
46297 <entry><option>quota_directory</option></entry>
46298 <entry>Use: <emphasis>appendfile</emphasis></entry>
46299 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46300 <entry>Default: <emphasis>unset</emphasis></entry>
46301 </row>
46302 </tbody>
46303 </tgroup>
46304 </informaltable>
46305 <para>
46306 This option defines the directory to check for quota purposes when delivering
46307 into individual files. The default is the delivery directory, or, if a file
46308 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
46309 delivery directory.
46310 </para>
46311 <para>
46312 <indexterm role="option">
46313 <primary><option>quota_filecount</option></primary>
46314 </indexterm>
46315 </para>
46316 <informaltable frame="all">
46317 <tgroup cols="4" colsep="0" rowsep="0">
46318 <colspec colwidth="8*" align="left"/>
46319 <colspec colwidth="6*" align="center"/>
46320 <colspec colwidth="6*" align="center"/>
46321 <colspec colwidth="6*" align="right"/>
46322 <tbody>
46323 <row>
46324 <entry><option>quota_filecount</option></entry>
46325 <entry>Use: <emphasis>appendfile</emphasis></entry>
46326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46327 <entry>Default: <emphasis>0</emphasis></entry>
46328 </row>
46329 </tbody>
46330 </tgroup>
46331 </informaltable>
46332 <para>
46333 This option applies when the <option>directory</option> option is set. It limits the total
46334 number of files in the directory (compare the inode limit in system quotas). It
46335 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
46336 failure causes delivery to be deferred. A value of zero is interpreted as
46337 <quote>no quota</quote>.
46338 </para>
46339 <para>
46340 The option modifier <option>no_check</option> can be used to force delivery even if the over
46341 quota condition is met. The quota gets updated as usual.
46342 </para>
46343 <para>
46344 <indexterm role="option">
46345 <primary><option>quota_is_inclusive</option></primary>
46346 </indexterm>
46347 </para>
46348 <informaltable frame="all">
46349 <tgroup cols="4" colsep="0" rowsep="0">
46350 <colspec colwidth="8*" align="left"/>
46351 <colspec colwidth="6*" align="center"/>
46352 <colspec colwidth="6*" align="center"/>
46353 <colspec colwidth="6*" align="right"/>
46354 <tbody>
46355 <row>
46356 <entry><option>quota_is_inclusive</option></entry>
46357 <entry>Use: <emphasis>appendfile</emphasis></entry>
46358 <entry>Type: <emphasis>boolean</emphasis></entry>
46359 <entry>Default: <emphasis>true</emphasis></entry>
46360 </row>
46361 </tbody>
46362 </tgroup>
46363 </informaltable>
46364 <para>
46365 See <option>quota</option> above.
46366 </para>
46367 <para>
46368 <indexterm role="option">
46369 <primary><option>quota_size_regex</option></primary>
46370 </indexterm>
46371 </para>
46372 <informaltable frame="all">
46373 <tgroup cols="4" colsep="0" rowsep="0">
46374 <colspec colwidth="8*" align="left"/>
46375 <colspec colwidth="6*" align="center"/>
46376 <colspec colwidth="6*" align="center"/>
46377 <colspec colwidth="6*" align="right"/>
46378 <tbody>
46379 <row>
46380 <entry><option>quota_size_regex</option></entry>
46381 <entry>Use: <emphasis>appendfile</emphasis></entry>
46382 <entry>Type: <emphasis>string</emphasis></entry>
46383 <entry>Default: <emphasis>unset</emphasis></entry>
46384 </row>
46385 </tbody>
46386 </tgroup>
46387 </informaltable>
46388 <para>
46389 This option applies when one of the delivery modes that writes a separate file
46390 for each message is being used. When Exim wants to find the size of one of
46391 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
46392 If this is set to a regular expression that matches the filename, and it
46393 captures one string, that string is interpreted as a representation of the
46394 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
46395 </para>
46396 <para>
46397 This feature is useful only when users have no shell access to their mailboxes
46398 &ndash; otherwise they could defeat the quota simply by renaming the files. This
46399 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
46400 the file length to the filename. For example:
46401 </para>
46402 <literallayout class="monospaced">
46403 maildir_tag = ,S=$message_size
46404 quota_size_regex = ,S=(\d+)
46405 </literallayout>
46406 <para>
46407 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
46408 number of lines in the message.
46409 </para>
46410 <para>
46411 The regular expression should not assume that the length is at the end of the
46412 filename (even though <option>maildir_tag</option> puts it there) because maildir MUAs
46413 sometimes add other information onto the ends of message filenames.
46414 </para>
46415 <para>
46416 Section <xref linkend="SECID136"/> contains further information.
46417 </para>
46418 <para>
46419 This option should not be used when other message-handling software
46420 may duplicate messages by making hardlinks to the files.  When that is done Exim
46421 will count the message size once for each filename, in contrast with the actual
46422 disk usage.  When the option is not set, calculating total usage requires
46423 a system-call per file to get the size; the number of links is then available also
46424 as is used to adjust the effective size.
46425 </para>
46426 <para>
46427 <indexterm role="option">
46428 <primary><option>quota_warn_message</option></primary>
46429 </indexterm>
46430 </para>
46431 <informaltable frame="all">
46432 <tgroup cols="4" colsep="0" rowsep="0">
46433 <colspec colwidth="8*" align="left"/>
46434 <colspec colwidth="6*" align="center"/>
46435 <colspec colwidth="6*" align="center"/>
46436 <colspec colwidth="6*" align="right"/>
46437 <tbody>
46438 <row>
46439 <entry><option>quota_warn_message</option></entry>
46440 <entry>Use: <emphasis>appendfile</emphasis></entry>
46441 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46442 <entry>Default: <emphasis>see below</emphasis></entry>
46443 </row>
46444 </tbody>
46445 </tgroup>
46446 </informaltable>
46447 <para>
46448 See below for the use of this option. If it is not set when
46449 <option>quota_warn_threshold</option> is set, it defaults to
46450 </para>
46451 <literallayout class="monospaced">
46452 quota_warn_message = "\
46453   To: $local_part@$domain\n\
46454   Subject: Your mailbox\n\n\
46455   This message is automatically created \
46456   by mail delivery software.\n\n\
46457   The size of your mailbox has exceeded \
46458   a warning threshold that is\n\
46459   set by the system administrator.\n"
46460 </literallayout>
46461 <para>
46462 <indexterm role="option">
46463 <primary><option>quota_warn_threshold</option></primary>
46464 </indexterm>
46465 </para>
46466 <informaltable frame="all">
46467 <tgroup cols="4" colsep="0" rowsep="0">
46468 <colspec colwidth="8*" align="left"/>
46469 <colspec colwidth="6*" align="center"/>
46470 <colspec colwidth="6*" align="center"/>
46471 <colspec colwidth="6*" align="right"/>
46472 <tbody>
46473 <row>
46474 <entry><option>quota_warn_threshold</option></entry>
46475 <entry>Use: <emphasis>appendfile</emphasis></entry>
46476 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46477 <entry>Default: <emphasis>0</emphasis></entry>
46478 </row>
46479 </tbody>
46480 </tgroup>
46481 </informaltable>
46482 <para>
46483 <indexterm role="concept">
46484 <primary>quota</primary>
46485 <secondary>warning threshold</secondary>
46486 </indexterm>
46487 <indexterm role="concept">
46488 <primary>mailbox</primary>
46489 <secondary>size warning</secondary>
46490 </indexterm>
46491 <indexterm role="concept">
46492 <primary>size</primary>
46493 <secondary>of mailbox</secondary>
46494 </indexterm>
46495 This option is expanded in the same way as <option>quota</option> (see above). If the
46496 resulting value is greater than zero, and delivery of the message causes the
46497 size of the file or total space in the directory tree to cross the given
46498 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
46499 may be specified as a percentage of it by following the value with a percent
46500 sign. For example:
46501 </para>
46502 <literallayout class="monospaced">
46503 quota = 10M
46504 quota_warn_threshold = 75%
46505 </literallayout>
46506 <para>
46507 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
46508 percent sign is ignored.
46509 </para>
46510 <para>
46511 The warning message itself is specified by the <option>quota_warn_message</option> option,
46512 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
46513 warning message. These do not necessarily have to include the recipient(s) of
46514 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
46515 can include any other header lines that you want. If you do not include a
46516 <emphasis>From:</emphasis> line, the default is:
46517 </para>
46518 <literallayout class="monospaced">
46519 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
46520 </literallayout>
46521 <para>
46522 <indexterm role="option">
46523 <primary><option>errors_reply_to</option></primary>
46524 </indexterm>
46525 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
46526 option.
46527 </para>
46528 <para>
46529 The <option>quota</option> option does not have to be set in order to use this option; they
46530 are independent of one another except when the threshold is specified as a
46531 percentage.
46532 </para>
46533 <para>
46534 <indexterm role="option">
46535 <primary><option>use_bsmtp</option></primary>
46536 </indexterm>
46537 </para>
46538 <informaltable frame="all">
46539 <tgroup cols="4" colsep="0" rowsep="0">
46540 <colspec colwidth="8*" align="left"/>
46541 <colspec colwidth="6*" align="center"/>
46542 <colspec colwidth="6*" align="center"/>
46543 <colspec colwidth="6*" align="right"/>
46544 <tbody>
46545 <row>
46546 <entry><option>use_bsmtp</option></entry>
46547 <entry>Use: <emphasis>appendfile</emphasis></entry>
46548 <entry>Type: <emphasis>boolean</emphasis></entry>
46549 <entry>Default: <emphasis>false</emphasis></entry>
46550 </row>
46551 </tbody>
46552 </tgroup>
46553 </informaltable>
46554 <para>
46555 <indexterm role="concept">
46556 <primary>envelope from</primary>
46557 </indexterm>
46558 <indexterm role="concept">
46559 <primary>envelope sender</primary>
46560 </indexterm>
46561 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
46562 format, with the envelope sender and recipient(s) included as SMTP commands. If
46563 you want to include a leading HELO command with such messages, you can do
46564 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
46565 for details of batch SMTP.
46566 </para>
46567 <para>
46568 <indexterm role="option">
46569 <primary><option>use_crlf</option></primary>
46570 </indexterm>
46571 </para>
46572 <informaltable frame="all">
46573 <tgroup cols="4" colsep="0" rowsep="0">
46574 <colspec colwidth="8*" align="left"/>
46575 <colspec colwidth="6*" align="center"/>
46576 <colspec colwidth="6*" align="center"/>
46577 <colspec colwidth="6*" align="right"/>
46578 <tbody>
46579 <row>
46580 <entry><option>use_crlf</option></entry>
46581 <entry>Use: <emphasis>appendfile</emphasis></entry>
46582 <entry>Type: <emphasis>boolean</emphasis></entry>
46583 <entry>Default: <emphasis>false</emphasis></entry>
46584 </row>
46585 </tbody>
46586 </tgroup>
46587 </informaltable>
46588 <para>
46589 <indexterm role="concept">
46590 <primary>carriage return</primary>
46591 </indexterm>
46592 <indexterm role="concept">
46593 <primary>linefeed</primary>
46594 </indexterm>
46595 This option causes lines to be terminated with the two-character CRLF sequence
46596 (carriage return, linefeed) instead of just a linefeed character. In the case
46597 of batched SMTP, the byte sequence written to the file is then an exact image
46598 of what would be sent down a real SMTP connection.
46599 </para>
46600 <para>
46601 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
46602 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
46603 in Berkeley-style mailboxes) are written verbatim, so must contain their own
46604 carriage return characters if these are needed. In cases where these options
46605 have non-empty defaults, the values end with a single linefeed, so they must be
46606 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
46607 </para>
46608 <para>
46609 <indexterm role="option">
46610 <primary><option>use_fcntl_lock</option></primary>
46611 </indexterm>
46612 </para>
46613 <informaltable frame="all">
46614 <tgroup cols="4" colsep="0" rowsep="0">
46615 <colspec colwidth="8*" align="left"/>
46616 <colspec colwidth="6*" align="center"/>
46617 <colspec colwidth="6*" align="center"/>
46618 <colspec colwidth="6*" align="right"/>
46619 <tbody>
46620 <row>
46621 <entry><option>use_fcntl_lock</option></entry>
46622 <entry>Use: <emphasis>appendfile</emphasis></entry>
46623 <entry>Type: <emphasis>boolean</emphasis></entry>
46624 <entry>Default: <emphasis>see below</emphasis></entry>
46625 </row>
46626 </tbody>
46627 </tgroup>
46628 </informaltable>
46629 <para>
46630 This option controls the use of the <function>fcntl()</function> function to lock a file for
46631 exclusive use when a message is being appended. It is set by default unless
46632 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
46633 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
46634 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
46635 </para>
46636 <para>
46637 <indexterm role="option">
46638 <primary><option>use_flock_lock</option></primary>
46639 </indexterm>
46640 </para>
46641 <informaltable frame="all">
46642 <tgroup cols="4" colsep="0" rowsep="0">
46643 <colspec colwidth="8*" align="left"/>
46644 <colspec colwidth="6*" align="center"/>
46645 <colspec colwidth="6*" align="center"/>
46646 <colspec colwidth="6*" align="right"/>
46647 <tbody>
46648 <row>
46649 <entry><option>use_flock_lock</option></entry>
46650 <entry>Use: <emphasis>appendfile</emphasis></entry>
46651 <entry>Type: <emphasis>boolean</emphasis></entry>
46652 <entry>Default: <emphasis>false</emphasis></entry>
46653 </row>
46654 </tbody>
46655 </tgroup>
46656 </informaltable>
46657 <para>
46658 This option is provided to support the use of <function>flock()</function> for file locking, for
46659 the few situations where it is needed. Most modern operating systems support
46660 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
46661 each other. Exim uses <function>fcntl()</function> locking by default.
46662 </para>
46663 <para>
46664 This option is required only if you are using an operating system where
46665 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
46666 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
46667 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
46668 </para>
46669 <para>
46670 <indexterm role="concept">
46671 <primary>Solaris</primary>
46672 <secondary><function>flock()</function> support</secondary>
46673 </indexterm>
46674 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
46675 have it (and some, I think, provide a not quite right version built on top of
46676 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
46677 the ability to use it, and any attempt to do so will cause a configuration
46678 error.
46679 </para>
46680 <para>
46681 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
46682 is just being mapped onto <function>fcntl()</function> by the OS).
46683 </para>
46684 <para>
46685 <indexterm role="option">
46686 <primary><option>use_lockfile</option></primary>
46687 </indexterm>
46688 </para>
46689 <informaltable frame="all">
46690 <tgroup cols="4" colsep="0" rowsep="0">
46691 <colspec colwidth="8*" align="left"/>
46692 <colspec colwidth="6*" align="center"/>
46693 <colspec colwidth="6*" align="center"/>
46694 <colspec colwidth="6*" align="right"/>
46695 <tbody>
46696 <row>
46697 <entry><option>use_lockfile</option></entry>
46698 <entry>Use: <emphasis>appendfile</emphasis></entry>
46699 <entry>Type: <emphasis>boolean</emphasis></entry>
46700 <entry>Default: <emphasis>see below</emphasis></entry>
46701 </row>
46702 </tbody>
46703 </tgroup>
46704 </informaltable>
46705 <para>
46706 If this option is turned off, Exim does not attempt to create a lock file when
46707 appending to a mailbox file. In this situation, the only locking is by
46708 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
46709 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
46710 <function>fcntl()</function> rather than a lock file, and even then only when you are not
46711 delivering over NFS from more than one host.
46712 </para>
46713 <para>
46714 <indexterm role="concept">
46715 <primary>NFS</primary>
46716 <secondary>lock file</secondary>
46717 </indexterm>
46718 In order to append to an NFS file safely from more than one host, it is
46719 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
46720 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
46721 file corruption.
46722 </para>
46723 <para>
46724 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
46725 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
46726 except when <option>mbx_format</option> is set.
46727 </para>
46728 <para>
46729 <indexterm role="option">
46730 <primary><option>use_mbx_lock</option></primary>
46731 </indexterm>
46732 </para>
46733 <informaltable frame="all">
46734 <tgroup cols="4" colsep="0" rowsep="0">
46735 <colspec colwidth="8*" align="left"/>
46736 <colspec colwidth="6*" align="center"/>
46737 <colspec colwidth="6*" align="center"/>
46738 <colspec colwidth="6*" align="right"/>
46739 <tbody>
46740 <row>
46741 <entry><option>use_mbx_lock</option></entry>
46742 <entry>Use: <emphasis>appendfile</emphasis></entry>
46743 <entry>Type: <emphasis>boolean</emphasis></entry>
46744 <entry>Default: <emphasis>see below</emphasis></entry>
46745 </row>
46746 </tbody>
46747 </tgroup>
46748 </informaltable>
46749 <para>
46750 This option is available only if Exim has been compiled with SUPPORT_MBX
46751 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
46752 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
46753 of the locking options are mentioned in the configuration. The locking rules
46754 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
46755 the IMAP4 and POP daemons that come with it (see the discussion below). The
46756 rules allow for shared access to the mailbox. However, this kind of locking
46757 does not work when the mailbox is NFS mounted.
46758 </para>
46759 <para>
46760 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
46761 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
46762 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
46763 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
46764 </para>
46765 </section>
46766 <section id="SECTopappend">
46767 <title>Operational details for appending</title>
46768 <para>
46769 <indexterm role="concept">
46770 <primary>appending to a file</primary>
46771 </indexterm>
46772 <indexterm role="concept">
46773 <primary>file</primary>
46774 <secondary>appending</secondary>
46775 </indexterm>
46776 Before appending to a file, the following preparations are made:
46777 </para>
46778 <itemizedlist>
46779 <listitem>
46780 <para>
46781 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
46782 return is given.
46783 </para>
46784 </listitem>
46785 <listitem>
46786 <para>
46787 <indexterm role="concept">
46788 <primary>directory creation</primary>
46789 </indexterm>
46790 If any directories on the file&#x2019;s path are missing, Exim creates them if the
46791 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
46792 <option>directory_mode</option> option.
46793 </para>
46794 </listitem>
46795 <listitem>
46796 <para>
46797 If <option>file_format</option> is set, the format of an existing file is checked. If this
46798 indicates that a different transport should be used, control is passed to that
46799 transport.
46800 </para>
46801 </listitem>
46802 <listitem>
46803 <para>
46804 <indexterm role="concept">
46805 <primary>file</primary>
46806 <secondary>locking</secondary>
46807 </indexterm>
46808 <indexterm role="concept">
46809 <primary>locking files</primary>
46810 </indexterm>
46811 <indexterm role="concept">
46812 <primary>NFS</primary>
46813 <secondary>lock file</secondary>
46814 </indexterm>
46815 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
46816 reliably over NFS, as follows:
46817 </para>
46818 <orderedlist numeration="arabic">
46819 <listitem>
46820 <para>
46821 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
46822 current time, primary host name, and process id added, by opening for writing
46823 as a new file. If this fails with an access error, delivery is deferred.
46824 </para>
46825 </listitem>
46826 <listitem>
46827 <para>
46828 Close the hitching post file, and hard link it to the lock filename.
46829 </para>
46830 </listitem>
46831 <listitem>
46832 <para>
46833 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
46834 Unlink the hitching post name.
46835 </para>
46836 </listitem>
46837 <listitem>
46838 <para>
46839 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
46840 then unlink hitching post name. If the number of links is exactly two, creation
46841 of the lock file succeeded but something (for example, an NFS server crash and
46842 restart) caused this fact not to be communicated to the <function>link()</function> call.
46843 </para>
46844 </listitem>
46845 <listitem>
46846 <para>
46847 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
46848 up to <option>lock_retries</option> times. However, since any program that writes to a
46849 mailbox should complete its task very quickly, it is reasonable to time out old
46850 lock files that are normally the result of user agent and system crashes. If an
46851 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
46852 it before trying again.
46853 </para>
46854 </listitem>
46855 </orderedlist>
46856 </listitem>
46857 <listitem>
46858 <para>
46859 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
46860 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
46861 than non-existence, delivery is deferred.
46862 </para>
46863 </listitem>
46864 <listitem>
46865 <para>
46866 <indexterm role="concept">
46867 <primary>symbolic link</primary>
46868 <secondary>to mailbox</secondary>
46869 </indexterm>
46870 <indexterm role="concept">
46871 <primary>mailbox</primary>
46872 <secondary>symbolic link</secondary>
46873 </indexterm>
46874 If the file does exist and is a symbolic link, delivery is deferred, unless the
46875 <option>allow_symlink</option> option is set, in which case the ownership of the link is
46876 checked, and then <function>stat()</function> is called to find out about the real file, which
46877 is then subjected to the checks below. The check on the top-level link
46878 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
46879 directory, though allowing symbolic links in this case is definitely not a good
46880 idea. If there is a chain of symbolic links, the intermediate ones are not
46881 checked.
46882 </para>
46883 </listitem>
46884 <listitem>
46885 <para>
46886 If the file already exists but is not a regular file, or if the file&#x2019;s owner
46887 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
46888 different from the user and group under which the delivery is running,
46889 delivery is deferred.
46890 </para>
46891 </listitem>
46892 <listitem>
46893 <para>
46894 If the file&#x2019;s permissions are more generous than specified, they are reduced.
46895 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
46896 is set false, in which case the delivery is tried using the existing
46897 permissions.
46898 </para>
46899 </listitem>
46900 <listitem>
46901 <para>
46902 The file&#x2019;s inode number is saved, and the file is then opened for appending.
46903 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
46904 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
46905 </para>
46906 </listitem>
46907 <listitem>
46908 <para>
46909 If the file is opened successfully, check that the inode number hasn&#x2019;t
46910 changed, that it is still a regular file, and that the owner and permissions
46911 have not changed. If anything is wrong, defer delivery and freeze the message.
46912 </para>
46913 </listitem>
46914 <listitem>
46915 <para>
46916 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
46917 option is set. Otherwise, check that the file is being created in a permitted
46918 directory if the <option>create_file</option> option is set (deferring on failure), and then
46919 open for writing as a new file, with the O_EXCL and O_CREAT options,
46920 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
46921 set). In this case, which can happen if the link points to a non-existent file,
46922 the file is opened for writing using O_CREAT but not O_EXCL, because
46923 that prevents link following.
46924 </para>
46925 </listitem>
46926 <listitem>
46927 <para>
46928 <indexterm role="concept">
46929 <primary>loop</primary>
46930 <secondary>while file testing</secondary>
46931 </indexterm>
46932 If opening fails because the file exists, obey the tests given above for
46933 existing files. However, to avoid looping in a situation where the file is
46934 being continuously created and destroyed, the exists/not-exists loop is broken
46935 after 10 repetitions, and the message is then frozen.
46936 </para>
46937 </listitem>
46938 <listitem>
46939 <para>
46940 If opening fails with any other error, defer delivery.
46941 </para>
46942 </listitem>
46943 <listitem>
46944 <para>
46945 <indexterm role="concept">
46946 <primary>file</primary>
46947 <secondary>locking</secondary>
46948 </indexterm>
46949 <indexterm role="concept">
46950 <primary>locking files</primary>
46951 </indexterm>
46952 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
46953 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
46954 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
46955 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
46956 file, and an exclusive lock on the file whose name is
46957 </para>
46958 <literallayout class="monospaced">
46959 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
46960 </literallayout>
46961 <para>
46962 using the device and inode numbers of the open mailbox file, in accordance with
46963 the MBX locking rules. This file is created with a mode that is specified by
46964 the <option>lockfile_mode</option> option.
46965 </para>
46966 <para>
46967 If Exim fails to lock the file, there are two possible courses of action,
46968 depending on the value of the locking timeout. This is obtained from
46969 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
46970 </para>
46971 <para>
46972 If the timeout value is zero, the file is closed, Exim waits for
46973 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
46974 to lock it again. This happens up to <option>lock_retries</option> times, after which the
46975 delivery is deferred.
46976 </para>
46977 <para>
46978 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
46979 <function>flock()</function> are used (with the given timeout), so there has already been some
46980 waiting involved by the time locking fails. Nevertheless, Exim does not give up
46981 immediately. It retries up to
46982 </para>
46983 <literallayout class="monospaced">
46984 (lock_retries * lock_interval) / &lt;timeout&gt;
46985 </literallayout>
46986 <para>
46987 times (rounded up).
46988 </para>
46989 </listitem>
46990 </itemizedlist>
46991 <para>
46992 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
46993 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
46994 </para>
46995 </section>
46996 <section id="SECTopdir">
46997 <title>Operational details for delivery to a new file</title>
46998 <para>
46999 <indexterm role="concept">
47000 <primary>delivery</primary>
47001 <secondary>to single file</secondary>
47002 </indexterm>
47003 <indexterm role="concept">
47004 <primary><quote>From</quote> line</primary>
47005 </indexterm>
47006 When the <option>directory</option> option is set instead of <option>file</option>, each message is
47007 delivered into a newly-created file or set of files. When <command>appendfile</command> is
47008 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
47009 <option>directory</option> is normally set, because the path for delivery is supplied by the
47010 router. (See for example, the <command>address_file</command> transport in the default
47011 configuration.) In this case, delivery is to a new file if either the path name
47012 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
47013 </para>
47014 <para>
47015 No locking is required while writing the message to a new file, so the various
47016 locking options of the transport are ignored. The <quote>From</quote> line that by default
47017 separates messages in a single file is not normally needed, nor is the escaping
47018 of message lines that start with <quote>From</quote>, and there is no need to ensure a
47019 newline at the end of each message. Consequently, the default values for
47020 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
47021 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
47022 </para>
47023 <para>
47024 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
47025 the files in the delivery directory by default. However, you can specify a
47026 different directory by setting <option>quota_directory</option>. Also, for maildir
47027 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
47028 </para>
47029 <para>
47030 <indexterm role="concept">
47031 <primary>maildir format</primary>
47032 </indexterm>
47033 <indexterm role="concept">
47034 <primary>mailstore format</primary>
47035 </indexterm>
47036 There are three different ways in which delivery to individual files can be
47037 done, controlled by the settings of the <option>maildir_format</option> and
47038 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
47039 formats is not included in the binary unless SUPPORT_MAILDIR or
47040 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
47041 </para>
47042 <para>
47043 <indexterm role="concept">
47044 <primary>directory creation</primary>
47045 </indexterm>
47046 In all three cases an attempt is made to create the directory and any necessary
47047 sub-directories if they do not exist, provided that the <option>create_directory</option>
47048 option is set (the default). The location of a created directory can be
47049 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
47050 the <option>directory_mode</option> option. If creation fails, or if the
47051 <option>create_directory</option> option is not set when creation is required, delivery is
47052 deferred.
47053 </para>
47054 </section>
47055 <section id="SECTmaildirdelivery">
47056 <title>Maildir delivery</title>
47057 <para>
47058 <indexterm role="concept">
47059 <primary>maildir format</primary>
47060 <secondary>description of</secondary>
47061 </indexterm>
47062 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
47063 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
47064 directory that is defined by the <option>directory</option> option (the <quote>delivery
47065 directory</quote>). If the delivery is successful, the file is renamed into the
47066 <filename>new</filename> subdirectory.
47067 </para>
47068 <para>
47069 In the filename, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
47070 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
47071 Exim checks that the time-of-day clock has moved on by at least one microsecond
47072 before terminating the delivery process. This guarantees uniqueness for the
47073 filename. However, as a precaution, Exim calls <function>stat()</function> for the file before
47074 opening it. If any response other than ENOENT (does not exist) is given,
47075 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
47076 </para>
47077 <para>
47078 Before Exim carries out a maildir delivery, it ensures that subdirectories
47079 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
47080 do not exist, Exim tries to create them and any superior directories in their
47081 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
47082 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
47083 contains matches the delivery directory, Exim also ensures that a file called
47084 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
47085 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
47086 </para>
47087 <para>
47088 These features make it possible to use Exim to create all the necessary files
47089 and directories in a maildir mailbox, including subdirectories for maildir++
47090 folders. Consider this example:
47091 </para>
47092 <literallayout class="monospaced">
47093 maildir_format = true
47094 directory = /var/mail/$local_part_data\
47095            ${if eq{$local_part_suffix}{}{}\
47096            {/.${substr_1:$local_part_suffix}}}
47097 maildirfolder_create_regex = /\.[^/]+$
47098 </literallayout>
47099 <para>
47100 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
47101 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
47102 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
47103 not match this name, so Exim will not look for or create the file
47104 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
47105 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
47106 </para>
47107 <para>
47108 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
47109 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
47110 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
47111 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
47112 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
47113 </para>
47114 <para>
47115 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
47116 not inadvertently match the toplevel maildir directory, because a
47117 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
47118 </para>
47119 <para>
47120 <indexterm role="concept">
47121 <primary>quota</primary>
47122 <secondary>in maildir delivery</secondary>
47123 </indexterm>
47124 <indexterm role="concept">
47125 <primary>maildir++</primary>
47126 </indexterm>
47127 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
47128 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
47129 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
47130 Exim assumes the directory is a maildir++ folder directory, which is one level
47131 down from the user&#x2019;s top level mailbox directory. This causes it to start at
47132 the parent directory instead of the current directory when calculating the
47133 amount of space used.
47134 </para>
47135 <para>
47136 One problem with delivering into a multi-file mailbox is that it is
47137 computationally expensive to compute the size of the mailbox for quota
47138 checking. Various approaches have been taken to reduce the amount of work
47139 needed. The next two sections describe two of them. A third alternative is to
47140 use some external process for maintaining the size data, and use the expansion
47141 of the <option>mailbox_size</option> option as a way of importing it into Exim.
47142 </para>
47143 </section>
47144 <section id="SECID135">
47145 <title>Using tags to record message sizes</title>
47146 <para>
47147 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
47148 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
47149 tag is added to its name. However, if adding the tag takes the length of the
47150 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
47151 the tag is dropped and the maildir file is created with no tag.
47152 </para>
47153 <para>
47154 <indexterm role="variable">
47155 <primary><varname>$message_size</varname></primary>
47156 </indexterm>
47157 Tags can be used to encode the size of files in their names; see
47158 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
47159 happens after the message has been written. The value of the <varname>$message_size</varname>
47160 variable is set to the number of bytes actually written. If the expansion is
47161 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
47162 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
47163 Non-printing characters in the string are ignored; if the resulting string is
47164 empty, it is ignored. If it starts with an alphanumeric character, a leading
47165 colon is inserted; this default has not proven to be the path that popular
47166 maildir implementations have chosen (but changing it in Exim would break
47167 backwards compatibility).
47168 </para>
47169 <para>
47170 For one common implementation, you might set:
47171 </para>
47172 <literallayout class="monospaced">
47173 maildir_tag = ,S=${message_size}
47174 </literallayout>
47175 <para>
47176 but you should check the documentation of the other software to be sure.
47177 </para>
47178 <para>
47179 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
47180 as this allows Exim to extract the size from your tag, instead of having to
47181 <function>stat()</function> each message file.
47182 </para>
47183 </section>
47184 <section id="SECID136">
47185 <title>Using a maildirsize file</title>
47186 <para>
47187 <indexterm role="concept">
47188 <primary>quota</primary>
47189 <secondary>in maildir delivery</secondary>
47190 </indexterm>
47191 <indexterm role="concept">
47192 <primary>maildir format</primary>
47193 <secondary><filename>maildirsize</filename> file</secondary>
47194 </indexterm>
47195 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
47196 storing quota and message size information in a file called <filename>maildirsize</filename>
47197 within the toplevel maildir directory. If this file does not exist, Exim
47198 creates it, setting the quota from the <option>quota</option> option of the transport. If
47199 the maildir directory itself does not exist, it is created before any attempt
47200 to write a <filename>maildirsize</filename> file.
47201 </para>
47202 <para>
47203 The <filename>maildirsize</filename> file is used to hold information about the sizes of
47204 messages in the maildir, thus speeding up quota calculations. The quota value
47205 in the file is just a cache; if the quota is changed in the transport, the new
47206 value overrides the cached value when the next message is delivered. The cache
47207 is maintained for the benefit of other programs that access the maildir and
47208 need to know the quota.
47209 </para>
47210 <para>
47211 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
47212 file is maintained (with a zero quota setting), but no quota is imposed.
47213 </para>
47214 <para>
47215 A regular expression is available for controlling which directories in the
47216 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
47217 See the description of the <option>maildir_quota_directory_regex</option> option above for
47218 details.
47219 </para>
47220 </section>
47221 <section id="SECID137">
47222 <title>Mailstore delivery</title>
47223 <para>
47224 <indexterm role="concept">
47225 <primary>mailstore format</primary>
47226 <secondary>description of</secondary>
47227 </indexterm>
47228 If the <option>mailstore_format</option> option is true, each message is written as two
47229 files in the given directory. A unique base name is constructed from the
47230 message id and the current delivery process, and the files that are written use
47231 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
47232 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
47233 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
47234 </para>
47235 <para>
47236 During delivery, the envelope is first written to a file with the suffix
47237 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
47238 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
47239 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
47240 file before accessing either of them. An alternative approach is to wait for
47241 the absence of a <filename>.tmp</filename> file.
47242 </para>
47243 <para>
47244 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
47245 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
47246 the sender address on one line, then all the recipient addresses, one per line.
47247 There can be more than one recipient only if the <option>batch_max</option> option is set
47248 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
47249 appended to the file, followed by a newline if it does not end with one.
47250 </para>
47251 <para>
47252 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
47253 failure, it is ignored. Other expansion errors are treated as serious
47254 configuration errors, and delivery is deferred. The variable
47255 <varname>$mailstore_basename</varname> is available for use during these expansions.
47256 </para>
47257 </section>
47258 <section id="SECID138">
47259 <title>Non-special new file delivery</title>
47260 <para>
47261 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
47262 file is created directly in the named directory. For example, when delivering
47263 messages into files in batched SMTP format for later delivery to some host (see
47264 section <xref linkend="SECTbatchSMTP"/>), a setting such as
47265 </para>
47266 <literallayout class="monospaced">
47267 directory = /var/bsmtp/$host
47268 </literallayout>
47269 <para>
47270 might be used. A message is written to a file with a temporary name, which is
47271 then renamed when the delivery is complete. The final name is obtained by
47272 expanding the contents of the <option>directory_file</option> option.
47273 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
47274 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
47275 </para>
47276 </section>
47277 </chapter>
47278
47279 <chapter id="CHID8">
47280 <title>The autoreply transport</title>
47281 <para>
47282 <indexterm role="concept" id="IIDauttra1" class="startofrange">
47283 <primary>transports</primary>
47284 <secondary><command>autoreply</command></secondary>
47285 </indexterm>
47286 <indexterm role="concept" id="IIDauttra2" class="startofrange">
47287 <primary><command>autoreply</command> transport</primary>
47288 </indexterm>
47289 The <command>autoreply</command> transport is not a true transport in that it does not cause
47290 the message to be transmitted. Instead, it generates a new mail message as an
47291 automatic reply to the incoming message. <emphasis>References:</emphasis> and
47292 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
47293 to the rules in RFCs 2822 and 3834, respectively.
47294 </para>
47295 <para>
47296 If the router that passes the message to this transport does not have the
47297 <option>unseen</option> option set, the original message (for the current recipient) is not
47298 delivered anywhere. However, when the <option>unseen</option> option is set on the router
47299 that passes the message to this transport, routing of the address continues, so
47300 another router can set up a normal message delivery.
47301 </para>
47302 <para>
47303 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
47304 <quote>vacation</quote> message being the standard example. However, it can also be run
47305 directly from a router like any other transport. To reduce the possibility of
47306 message cascades, messages created by the <command>autoreply</command> transport always have
47307 empty envelope sender addresses, like bounce messages.
47308 </para>
47309 <para>
47310 The parameters of the message to be sent can be specified in the configuration
47311 by options described below. However, these are used only when the address
47312 passed to the transport does not contain its own reply information. When the
47313 transport is run as a consequence of a
47314 <option>mail</option>
47315 or <option>vacation</option> command in a filter file, the parameters of the message are
47316 supplied by the filter, and passed with the address. The transport&#x2019;s options
47317 that define the message are then ignored (so they are not usually set in this
47318 case). The message is specified entirely by the filter or by the transport; it
47319 is never built from a mixture of options. However, the <option>file_optional</option>,
47320 <option>mode</option>, and <option>return_message</option> options apply in all cases.
47321 </para>
47322 <para>
47323 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
47324 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
47325 gid of the user, and with appropriate current and home directories (see chapter
47326 <xref linkend="CHAPenvironment"/>).
47327 </para>
47328 <para>
47329 There is a subtle difference between routing a message to a <command>pipe</command> transport
47330 that generates some text to be returned to the sender, and routing it to an
47331 <command>autoreply</command> transport. This difference is noticeable only if more than one
47332 address from the same message is so handled. In the case of a pipe, the
47333 separate outputs from the different addresses are gathered up and returned to
47334 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
47335 message is generated for each address that is passed to it.
47336 </para>
47337 <para>
47338 Non-printing characters are not permitted in the header lines generated for the
47339 message that <command>autoreply</command> creates, with the exception of newlines that are
47340 immediately followed by white space. If any non-printing characters are found,
47341 the transport defers.
47342 Whether characters with the top bit set count as printing characters or not is
47343 controlled by the <option>print_topbitchars</option> global option.
47344 </para>
47345 <para>
47346 If any of the generic options for manipulating headers (for example,
47347 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
47348 of the original message that is included in the generated message when
47349 <option>return_message</option> is set. They do not apply to the generated message itself.
47350 </para>
47351 <para>
47352 <indexterm role="variable">
47353 <primary><varname>$sender_address</varname></primary>
47354 </indexterm>
47355 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
47356 the message, indicating that there were no recipients, it does not treat this
47357 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
47358 is empty (because the incoming message is a bounce message) do not cause
47359 problems. They are just discarded.
47360 </para>
47361 <section id="SECID139">
47362 <title>Private options for autoreply</title>
47363 <para>
47364 <indexterm role="concept">
47365 <primary>options</primary>
47366 <secondary><command>autoreply</command> transport</secondary>
47367 </indexterm>
47368 </para>
47369 <para>
47370 <indexterm role="option">
47371 <primary><option>bcc</option></primary>
47372 </indexterm>
47373 </para>
47374 <informaltable frame="all">
47375 <tgroup cols="4" colsep="0" rowsep="0">
47376 <colspec colwidth="8*" align="left"/>
47377 <colspec colwidth="6*" align="center"/>
47378 <colspec colwidth="6*" align="center"/>
47379 <colspec colwidth="6*" align="right"/>
47380 <tbody>
47381 <row>
47382 <entry><option>bcc</option></entry>
47383 <entry>Use: <emphasis>autoreply</emphasis></entry>
47384 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47385 <entry>Default: <emphasis>unset</emphasis></entry>
47386 </row>
47387 </tbody>
47388 </tgroup>
47389 </informaltable>
47390 <para>
47391 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
47392 message when the message is specified by the transport.
47393 </para>
47394 <para>
47395 <indexterm role="option">
47396 <primary><option>cc</option></primary>
47397 </indexterm>
47398 </para>
47399 <informaltable frame="all">
47400 <tgroup cols="4" colsep="0" rowsep="0">
47401 <colspec colwidth="8*" align="left"/>
47402 <colspec colwidth="6*" align="center"/>
47403 <colspec colwidth="6*" align="center"/>
47404 <colspec colwidth="6*" align="right"/>
47405 <tbody>
47406 <row>
47407 <entry><option>cc</option></entry>
47408 <entry>Use: <emphasis>autoreply</emphasis></entry>
47409 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47410 <entry>Default: <emphasis>unset</emphasis></entry>
47411 </row>
47412 </tbody>
47413 </tgroup>
47414 </informaltable>
47415 <para>
47416 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
47417 when the message is specified by the transport.
47418 </para>
47419 <para>
47420 <indexterm role="option">
47421 <primary><option>file</option></primary>
47422 </indexterm>
47423 </para>
47424 <informaltable frame="all">
47425 <tgroup cols="4" colsep="0" rowsep="0">
47426 <colspec colwidth="8*" align="left"/>
47427 <colspec colwidth="6*" align="center"/>
47428 <colspec colwidth="6*" align="center"/>
47429 <colspec colwidth="6*" align="right"/>
47430 <tbody>
47431 <row>
47432 <entry><option>file</option></entry>
47433 <entry>Use: <emphasis>autoreply</emphasis></entry>
47434 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47435 <entry>Default: <emphasis>unset</emphasis></entry>
47436 </row>
47437 </tbody>
47438 </tgroup>
47439 </informaltable>
47440 <para>
47441 The contents of the file are sent as the body of the message when the message
47442 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
47443 string comes first.
47444 </para>
47445 <para>
47446 <indexterm role="option">
47447 <primary><option>file_expand</option></primary>
47448 </indexterm>
47449 </para>
47450 <informaltable frame="all">
47451 <tgroup cols="4" colsep="0" rowsep="0">
47452 <colspec colwidth="8*" align="left"/>
47453 <colspec colwidth="6*" align="center"/>
47454 <colspec colwidth="6*" align="center"/>
47455 <colspec colwidth="6*" align="right"/>
47456 <tbody>
47457 <row>
47458 <entry><option>file_expand</option></entry>
47459 <entry>Use: <emphasis>autoreply</emphasis></entry>
47460 <entry>Type: <emphasis>boolean</emphasis></entry>
47461 <entry>Default: <emphasis>false</emphasis></entry>
47462 </row>
47463 </tbody>
47464 </tgroup>
47465 </informaltable>
47466 <para>
47467 If this is set, the contents of the file named by the <option>file</option> option are
47468 subjected to string expansion as they are added to the message.
47469 </para>
47470 <para>
47471 <indexterm role="option">
47472 <primary><option>file_optional</option></primary>
47473 </indexterm>
47474 </para>
47475 <informaltable frame="all">
47476 <tgroup cols="4" colsep="0" rowsep="0">
47477 <colspec colwidth="8*" align="left"/>
47478 <colspec colwidth="6*" align="center"/>
47479 <colspec colwidth="6*" align="center"/>
47480 <colspec colwidth="6*" align="right"/>
47481 <tbody>
47482 <row>
47483 <entry><option>file_optional</option></entry>
47484 <entry>Use: <emphasis>autoreply</emphasis></entry>
47485 <entry>Type: <emphasis>boolean</emphasis></entry>
47486 <entry>Default: <emphasis>false</emphasis></entry>
47487 </row>
47488 </tbody>
47489 </tgroup>
47490 </informaltable>
47491 <para>
47492 If this option is true, no error is generated if the file named by the <option>file</option>
47493 option or passed with the address does not exist or cannot be read.
47494 </para>
47495 <para>
47496 <indexterm role="option">
47497 <primary><option>from</option></primary>
47498 </indexterm>
47499 </para>
47500 <informaltable frame="all">
47501 <tgroup cols="4" colsep="0" rowsep="0">
47502 <colspec colwidth="8*" align="left"/>
47503 <colspec colwidth="6*" align="center"/>
47504 <colspec colwidth="6*" align="center"/>
47505 <colspec colwidth="6*" align="right"/>
47506 <tbody>
47507 <row>
47508 <entry><option>from</option></entry>
47509 <entry>Use: <emphasis>autoreply</emphasis></entry>
47510 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47511 <entry>Default: <emphasis>unset</emphasis></entry>
47512 </row>
47513 </tbody>
47514 </tgroup>
47515 </informaltable>
47516 <para>
47517 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
47518 specified by the transport.
47519 </para>
47520 <para>
47521 <indexterm role="option">
47522 <primary><option>headers</option></primary>
47523 </indexterm>
47524 </para>
47525 <informaltable frame="all">
47526 <tgroup cols="4" colsep="0" rowsep="0">
47527 <colspec colwidth="8*" align="left"/>
47528 <colspec colwidth="6*" align="center"/>
47529 <colspec colwidth="6*" align="center"/>
47530 <colspec colwidth="6*" align="right"/>
47531 <tbody>
47532 <row>
47533 <entry><option>headers</option></entry>
47534 <entry>Use: <emphasis>autoreply</emphasis></entry>
47535 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47536 <entry>Default: <emphasis>unset</emphasis></entry>
47537 </row>
47538 </tbody>
47539 </tgroup>
47540 </informaltable>
47541 <para>
47542 This specifies additional RFC 2822 headers that are to be added to the message
47543 when the message is specified by the transport. Several can be given by using
47544 <quote>\n</quote> to separate them. There is no check on the format.
47545 </para>
47546 <para>
47547 <indexterm role="option">
47548 <primary><option>log</option></primary>
47549 </indexterm>
47550 </para>
47551 <informaltable frame="all">
47552 <tgroup cols="4" colsep="0" rowsep="0">
47553 <colspec colwidth="8*" align="left"/>
47554 <colspec colwidth="6*" align="center"/>
47555 <colspec colwidth="6*" align="center"/>
47556 <colspec colwidth="6*" align="right"/>
47557 <tbody>
47558 <row>
47559 <entry><option>log</option></entry>
47560 <entry>Use: <emphasis>autoreply</emphasis></entry>
47561 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47562 <entry>Default: <emphasis>unset</emphasis></entry>
47563 </row>
47564 </tbody>
47565 </tgroup>
47566 </informaltable>
47567 <para>
47568 This option names a file in which a record of every message sent is logged when
47569 the message is specified by the transport.
47570 </para>
47571 <para>
47572 <indexterm role="option">
47573 <primary><option>mode</option></primary>
47574 </indexterm>
47575 </para>
47576 <informaltable frame="all">
47577 <tgroup cols="4" colsep="0" rowsep="0">
47578 <colspec colwidth="8*" align="left"/>
47579 <colspec colwidth="6*" align="center"/>
47580 <colspec colwidth="6*" align="center"/>
47581 <colspec colwidth="6*" align="right"/>
47582 <tbody>
47583 <row>
47584 <entry><option>mode</option></entry>
47585 <entry>Use: <emphasis>autoreply</emphasis></entry>
47586 <entry>Type: <emphasis>octal integer</emphasis></entry>
47587 <entry>Default: <emphasis>0600</emphasis></entry>
47588 </row>
47589 </tbody>
47590 </tgroup>
47591 </informaltable>
47592 <para>
47593 If either the log file or the <quote>once</quote> file has to be created, this mode is
47594 used.
47595 </para>
47596 <para>
47597 <indexterm role="option">
47598 <primary><option>never_mail</option></primary>
47599 </indexterm>
47600 </para>
47601 <informaltable frame="all">
47602 <tgroup cols="4" colsep="0" rowsep="0">
47603 <colspec colwidth="8*" align="left"/>
47604 <colspec colwidth="6*" align="center"/>
47605 <colspec colwidth="6*" align="center"/>
47606 <colspec colwidth="6*" align="right"/>
47607 <tbody>
47608 <row>
47609 <entry><option>never_mail</option></entry>
47610 <entry>Use: <emphasis>autoreply</emphasis></entry>
47611 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
47612 <entry>Default: <emphasis>unset</emphasis></entry>
47613 </row>
47614 </tbody>
47615 </tgroup>
47616 </informaltable>
47617 <para>
47618 If any run of the transport creates a message with a recipient that matches any
47619 item in the list, that recipient is quietly discarded. If all recipients are
47620 discarded, no message is created. This applies both when the recipients are
47621 generated by a filter and when they are specified in the transport.
47622 </para>
47623 <para>
47624 <indexterm role="option">
47625 <primary><option>once</option></primary>
47626 </indexterm>
47627 </para>
47628 <informaltable frame="all">
47629 <tgroup cols="4" colsep="0" rowsep="0">
47630 <colspec colwidth="8*" align="left"/>
47631 <colspec colwidth="6*" align="center"/>
47632 <colspec colwidth="6*" align="center"/>
47633 <colspec colwidth="6*" align="right"/>
47634 <tbody>
47635 <row>
47636 <entry><option>once</option></entry>
47637 <entry>Use: <emphasis>autoreply</emphasis></entry>
47638 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47639 <entry>Default: <emphasis>unset</emphasis></entry>
47640 </row>
47641 </tbody>
47642 </tgroup>
47643 </informaltable>
47644 <para>
47645 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
47646 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
47647 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
47648 </para>
47649 <para>
47650 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
47651 By default, if <option>once</option> is set to a non-empty filename, the message
47652 is not sent if a potential recipient is already listed in the database.
47653 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
47654 message is sent if that much time has elapsed since a message was last sent to
47655 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
47656 prevents a message from being sent a second time &ndash; in this case, zero means
47657 infinity.
47658 </para>
47659 <para>
47660 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
47661 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
47662 greater than zero, it changes the way Exim implements the <option>once</option> option.
47663 Instead of using a DBM file to record every recipient it sends to, it uses a
47664 regular file, whose size will never get larger than the given value.
47665 </para>
47666 <para>
47667 In the file, Exim keeps a linear list of recipient addresses and the times at
47668 which they were sent messages. If the file is full when a new address needs to
47669 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
47670 means that a given recipient may receive multiple messages, but at
47671 unpredictable intervals that depend on the rate of turnover of addresses in the
47672 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
47673 </para>
47674 <para>
47675 <indexterm role="option">
47676 <primary><option>once_file_size</option></primary>
47677 </indexterm>
47678 </para>
47679 <informaltable frame="all">
47680 <tgroup cols="4" colsep="0" rowsep="0">
47681 <colspec colwidth="8*" align="left"/>
47682 <colspec colwidth="6*" align="center"/>
47683 <colspec colwidth="6*" align="center"/>
47684 <colspec colwidth="6*" align="right"/>
47685 <tbody>
47686 <row>
47687 <entry><option>once_file_size</option></entry>
47688 <entry>Use: <emphasis>autoreply</emphasis></entry>
47689 <entry>Type: <emphasis>integer</emphasis></entry>
47690 <entry>Default: <emphasis>0</emphasis></entry>
47691 </row>
47692 </tbody>
47693 </tgroup>
47694 </informaltable>
47695 <para>
47696 See <option>once</option> above.
47697 </para>
47698 <para>
47699 <indexterm role="option">
47700 <primary><option>once_repeat</option></primary>
47701 </indexterm>
47702 </para>
47703 <informaltable frame="all">
47704 <tgroup cols="4" colsep="0" rowsep="0">
47705 <colspec colwidth="8*" align="left"/>
47706 <colspec colwidth="6*" align="center"/>
47707 <colspec colwidth="6*" align="center"/>
47708 <colspec colwidth="6*" align="right"/>
47709 <tbody>
47710 <row>
47711 <entry><option>once_repeat</option></entry>
47712 <entry>Use: <emphasis>autoreply</emphasis></entry>
47713 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
47714 <entry>Default: <emphasis>0s</emphasis></entry>
47715 </row>
47716 </tbody>
47717 </tgroup>
47718 </informaltable>
47719 <para>
47720 See <option>once</option> above.
47721 After expansion, the value of this option must be a valid time value.
47722 </para>
47723 <para>
47724 <indexterm role="option">
47725 <primary><option>reply_to</option></primary>
47726 </indexterm>
47727 </para>
47728 <informaltable frame="all">
47729 <tgroup cols="4" colsep="0" rowsep="0">
47730 <colspec colwidth="8*" align="left"/>
47731 <colspec colwidth="6*" align="center"/>
47732 <colspec colwidth="6*" align="center"/>
47733 <colspec colwidth="6*" align="right"/>
47734 <tbody>
47735 <row>
47736 <entry><option>reply_to</option></entry>
47737 <entry>Use: <emphasis>autoreply</emphasis></entry>
47738 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47739 <entry>Default: <emphasis>unset</emphasis></entry>
47740 </row>
47741 </tbody>
47742 </tgroup>
47743 </informaltable>
47744 <para>
47745 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
47746 specified by the transport.
47747 </para>
47748 <para>
47749 <indexterm role="option">
47750 <primary><option>return_message</option></primary>
47751 </indexterm>
47752 </para>
47753 <informaltable frame="all">
47754 <tgroup cols="4" colsep="0" rowsep="0">
47755 <colspec colwidth="8*" align="left"/>
47756 <colspec colwidth="6*" align="center"/>
47757 <colspec colwidth="6*" align="center"/>
47758 <colspec colwidth="6*" align="right"/>
47759 <tbody>
47760 <row>
47761 <entry><option>return_message</option></entry>
47762 <entry>Use: <emphasis>autoreply</emphasis></entry>
47763 <entry>Type: <emphasis>boolean</emphasis></entry>
47764 <entry>Default: <emphasis>false</emphasis></entry>
47765 </row>
47766 </tbody>
47767 </tgroup>
47768 </informaltable>
47769 <para>
47770 If this is set, a copy of the original message is returned with the new
47771 message, subject to the maximum size set in the <option>return_size_limit</option> global
47772 configuration option.
47773 </para>
47774 <para>
47775 <indexterm role="option">
47776 <primary><option>subject</option></primary>
47777 </indexterm>
47778 </para>
47779 <informaltable frame="all">
47780 <tgroup cols="4" colsep="0" rowsep="0">
47781 <colspec colwidth="8*" align="left"/>
47782 <colspec colwidth="6*" align="center"/>
47783 <colspec colwidth="6*" align="center"/>
47784 <colspec colwidth="6*" align="right"/>
47785 <tbody>
47786 <row>
47787 <entry><option>subject</option></entry>
47788 <entry>Use: <emphasis>autoreply</emphasis></entry>
47789 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47790 <entry>Default: <emphasis>unset</emphasis></entry>
47791 </row>
47792 </tbody>
47793 </tgroup>
47794 </informaltable>
47795 <para>
47796 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
47797 specified by the transport. It is tempting to quote the original subject in
47798 automatic responses. For example:
47799 </para>
47800 <literallayout class="monospaced">
47801 subject = Re: $h_subject:
47802 </literallayout>
47803 <para>
47804 There is a danger in doing this, however. It may allow a third party to
47805 subscribe your users to an opt-in mailing list, provided that the list accepts
47806 bounce messages as subscription confirmations. Well-managed lists require a
47807 non-bounce message to confirm a subscription, so the danger is relatively
47808 small.
47809 </para>
47810 <para>
47811 <indexterm role="option">
47812 <primary><option>text</option></primary>
47813 </indexterm>
47814 </para>
47815 <informaltable frame="all">
47816 <tgroup cols="4" colsep="0" rowsep="0">
47817 <colspec colwidth="8*" align="left"/>
47818 <colspec colwidth="6*" align="center"/>
47819 <colspec colwidth="6*" align="center"/>
47820 <colspec colwidth="6*" align="right"/>
47821 <tbody>
47822 <row>
47823 <entry><option>text</option></entry>
47824 <entry>Use: <emphasis>autoreply</emphasis></entry>
47825 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47826 <entry>Default: <emphasis>unset</emphasis></entry>
47827 </row>
47828 </tbody>
47829 </tgroup>
47830 </informaltable>
47831 <para>
47832 This specifies a single string to be used as the body of the message when the
47833 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
47834 the text comes first.
47835 </para>
47836 <para>
47837 <indexterm role="option">
47838 <primary><option>to</option></primary>
47839 </indexterm>
47840 </para>
47841 <informaltable frame="all">
47842 <tgroup cols="4" colsep="0" rowsep="0">
47843 <colspec colwidth="8*" align="left"/>
47844 <colspec colwidth="6*" align="center"/>
47845 <colspec colwidth="6*" align="center"/>
47846 <colspec colwidth="6*" align="right"/>
47847 <tbody>
47848 <row>
47849 <entry><option>to</option></entry>
47850 <entry>Use: <emphasis>autoreply</emphasis></entry>
47851 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47852 <entry>Default: <emphasis>unset</emphasis></entry>
47853 </row>
47854 </tbody>
47855 </tgroup>
47856 </informaltable>
47857 <para>
47858 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
47859 when the message is specified by the transport.
47860 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
47861 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
47862 </para>
47863 </section>
47864 </chapter>
47865
47866 <chapter id="CHAPLMTP">
47867 <title>The lmtp transport</title>
47868 <para>
47869 <indexterm role="concept">
47870 <primary>transports</primary>
47871 <secondary><command>lmtp</command></secondary>
47872 </indexterm>
47873 <indexterm role="concept">
47874 <primary><command>lmtp</command> transport</primary>
47875 </indexterm>
47876 <indexterm role="concept">
47877 <primary>LMTP</primary>
47878 <secondary>over a pipe</secondary>
47879 </indexterm>
47880 <indexterm role="concept">
47881 <primary>LMTP</primary>
47882 <secondary>over a socket</secondary>
47883 </indexterm>
47884 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
47885 specified command
47886 or by interacting with a Unix domain socket.
47887 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
47888 transports. Exim also has support for using LMTP over TCP/IP; this is
47889 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
47890 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
47891 has it commented out. You need to ensure that
47892 </para>
47893 <literallayout class="monospaced">
47894 TRANSPORT_LMTP=yes
47895 </literallayout>
47896 <para>
47897 <indexterm role="concept">
47898 <primary>options</primary>
47899 <secondary><command>lmtp</command> transport</secondary>
47900 </indexterm>
47901 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
47902 included in the Exim binary. The private options of the <command>lmtp</command> transport are
47903 as follows:
47904 </para>
47905 <para>
47906 <indexterm role="option">
47907 <primary><option>batch_id</option></primary>
47908 </indexterm>
47909 </para>
47910 <informaltable frame="all">
47911 <tgroup cols="4" colsep="0" rowsep="0">
47912 <colspec colwidth="8*" align="left"/>
47913 <colspec colwidth="6*" align="center"/>
47914 <colspec colwidth="6*" align="center"/>
47915 <colspec colwidth="6*" align="right"/>
47916 <tbody>
47917 <row>
47918 <entry><option>batch_id</option></entry>
47919 <entry>Use: <emphasis>lmtp</emphasis></entry>
47920 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47921 <entry>Default: <emphasis>unset</emphasis></entry>
47922 </row>
47923 </tbody>
47924 </tgroup>
47925 </informaltable>
47926 <para>
47927 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
47928 </para>
47929 <para>
47930 <indexterm role="option">
47931 <primary><option>batch_max</option></primary>
47932 </indexterm>
47933 </para>
47934 <informaltable frame="all">
47935 <tgroup cols="4" colsep="0" rowsep="0">
47936 <colspec colwidth="8*" align="left"/>
47937 <colspec colwidth="6*" align="center"/>
47938 <colspec colwidth="6*" align="center"/>
47939 <colspec colwidth="6*" align="right"/>
47940 <tbody>
47941 <row>
47942 <entry><option>batch_max</option></entry>
47943 <entry>Use: <emphasis>lmtp</emphasis></entry>
47944 <entry>Type: <emphasis>integer</emphasis></entry>
47945 <entry>Default: <emphasis>1</emphasis></entry>
47946 </row>
47947 </tbody>
47948 </tgroup>
47949 </informaltable>
47950 <para>
47951 This limits the number of addresses that can be handled in a single delivery.
47952 Most LMTP servers can handle several addresses at once, so it is normally a
47953 good idea to increase this value. See the description of local delivery
47954 batching in chapter <xref linkend="CHAPbatching"/>.
47955 </para>
47956 <para>
47957 <indexterm role="option">
47958 <primary><option>command</option></primary>
47959 </indexterm>
47960 </para>
47961 <informaltable frame="all">
47962 <tgroup cols="4" colsep="0" rowsep="0">
47963 <colspec colwidth="8*" align="left"/>
47964 <colspec colwidth="6*" align="center"/>
47965 <colspec colwidth="6*" align="center"/>
47966 <colspec colwidth="6*" align="right"/>
47967 <tbody>
47968 <row>
47969 <entry><option>command</option></entry>
47970 <entry>Use: <emphasis>lmtp</emphasis></entry>
47971 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47972 <entry>Default: <emphasis>unset</emphasis></entry>
47973 </row>
47974 </tbody>
47975 </tgroup>
47976 </informaltable>
47977 <para>
47978 This option must be set if <option>socket</option> is not set. The string is a command which
47979 is run in a separate process. It is split up into a command name and list of
47980 arguments, each of which is separately expanded (so expansion cannot change the
47981 number of arguments). The command is run directly, not via a shell. The message
47982 is passed to the new process using the standard input and output to operate the
47983 LMTP protocol.
47984 </para>
47985 <para>
47986 <indexterm role="option">
47987 <primary><option>ignore_quota</option></primary>
47988 </indexterm>
47989 </para>
47990 <informaltable frame="all">
47991 <tgroup cols="4" colsep="0" rowsep="0">
47992 <colspec colwidth="8*" align="left"/>
47993 <colspec colwidth="6*" align="center"/>
47994 <colspec colwidth="6*" align="center"/>
47995 <colspec colwidth="6*" align="right"/>
47996 <tbody>
47997 <row>
47998 <entry><option>ignore_quota</option></entry>
47999 <entry>Use: <emphasis>lmtp</emphasis></entry>
48000 <entry>Type: <emphasis>boolean</emphasis></entry>
48001 <entry>Default: <emphasis>false</emphasis></entry>
48002 </row>
48003 </tbody>
48004 </tgroup>
48005 </informaltable>
48006 <para>
48007 <indexterm role="concept">
48008 <primary>LMTP</primary>
48009 <secondary>ignoring quota errors</secondary>
48010 </indexterm>
48011 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
48012 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
48013 in its response to the LHLO command.
48014 </para>
48015 <para>
48016 <indexterm role="option">
48017 <primary><option>socket</option></primary>
48018 </indexterm>
48019 </para>
48020 <informaltable frame="all">
48021 <tgroup cols="4" colsep="0" rowsep="0">
48022 <colspec colwidth="8*" align="left"/>
48023 <colspec colwidth="6*" align="center"/>
48024 <colspec colwidth="6*" align="center"/>
48025 <colspec colwidth="6*" align="right"/>
48026 <tbody>
48027 <row>
48028 <entry><option>socket</option></entry>
48029 <entry>Use: <emphasis>lmtp</emphasis></entry>
48030 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48031 <entry>Default: <emphasis>unset</emphasis></entry>
48032 </row>
48033 </tbody>
48034 </tgroup>
48035 </informaltable>
48036 <para>
48037 This option must be set if <option>command</option> is not set. The result of expansion must
48038 be the name of a Unix domain socket. The transport connects to the socket and
48039 delivers the message to it using the LMTP protocol.
48040 </para>
48041 <para>
48042 <indexterm role="option">
48043 <primary><option>timeout</option></primary>
48044 </indexterm>
48045 </para>
48046 <informaltable frame="all">
48047 <tgroup cols="4" colsep="0" rowsep="0">
48048 <colspec colwidth="8*" align="left"/>
48049 <colspec colwidth="6*" align="center"/>
48050 <colspec colwidth="6*" align="center"/>
48051 <colspec colwidth="6*" align="right"/>
48052 <tbody>
48053 <row>
48054 <entry><option>timeout</option></entry>
48055 <entry>Use: <emphasis>lmtp</emphasis></entry>
48056 <entry>Type: <emphasis>time</emphasis></entry>
48057 <entry>Default: <emphasis>5m</emphasis></entry>
48058 </row>
48059 </tbody>
48060 </tgroup>
48061 </informaltable>
48062 <para>
48063 The transport is aborted if the created process or Unix domain socket does not
48064 respond to LMTP commands or message input within this timeout. Delivery
48065 is deferred, and will be tried again later. Here is an example of a typical
48066 LMTP transport:
48067 </para>
48068 <literallayout class="monospaced">
48069 lmtp:
48070   driver = lmtp
48071   command = /some/local/lmtp/delivery/program
48072   batch_max = 20
48073   user = exim
48074 </literallayout>
48075 <para>
48076 This delivers up to 20 addresses at a time, in a mixture of domains if
48077 necessary, running as the user <emphasis>exim</emphasis>.
48078 </para>
48079 </chapter>
48080
48081 <chapter id="CHAPpipetransport">
48082 <title>The pipe transport</title>
48083 <para>
48084 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
48085 <primary>transports</primary>
48086 <secondary><command>pipe</command></secondary>
48087 </indexterm>
48088 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
48089 <primary><command>pipe</command> transport</primary>
48090 </indexterm>
48091 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
48092 running in another process. One example is the use of <command>pipe</command> as a
48093 pseudo-remote transport for passing messages to some other delivery mechanism
48094 (such as UUCP). Another is the use by individual users to automatically process
48095 their incoming messages. The <command>pipe</command> transport can be used in one of the
48096 following ways:
48097 </para>
48098 <itemizedlist>
48099 <listitem>
48100 <para>
48101 <indexterm role="variable">
48102 <primary><varname>$local_part</varname></primary>
48103 </indexterm>
48104 A router routes one address to a transport in the normal way, and the
48105 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
48106 contains the local part of the address (as usual), and the command that is run
48107 is specified by the <option>command</option> option on the transport.
48108 </para>
48109 </listitem>
48110 <listitem>
48111 <para>
48112 <indexterm role="variable">
48113 <primary><varname>$pipe_addresses</varname></primary>
48114 </indexterm>
48115 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
48116 transport can handle more than one address in a single run. In this case, when
48117 more than one address is routed to the transport, <varname>$local_part</varname> is not set
48118 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
48119 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
48120 that are routed to the transport.
48121 </para>
48122 </listitem>
48123 <listitem>
48124 <para>
48125 <indexterm role="variable">
48126 <primary><varname>$address_pipe</varname></primary>
48127 </indexterm>
48128 A router redirects an address directly to a pipe command (for example, from an
48129 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
48130 pipe command, and the <option>command</option> option on the transport is ignored unless
48131 <option>force_command</option> is set. If only one address is being transported
48132 (<option>batch_max</option> is not greater than one, or only one address was redirected to
48133 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
48134 </para>
48135 </listitem>
48136 </itemizedlist>
48137 <para>
48138 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
48139 deliver messages over pipes using the LMTP interactive protocol. This is
48140 implemented by the <command>lmtp</command> transport.
48141 </para>
48142 <para>
48143 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
48144 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
48145 other cases, the uid and gid have to be specified explicitly, either on the
48146 transport or on the router that handles the address. Current and <quote>home</quote>
48147 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
48148 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
48149 for a discussion of local delivery batching.
48150 </para>
48151 <para>
48152 <indexterm role="concept">
48153 <primary>tainted data</primary>
48154 <secondary>in pipe command</secondary>
48155 </indexterm>
48156 <indexterm role="concept">
48157 <primary>pipe</primary>
48158 <secondary>tainted data</secondary>
48159 </indexterm>
48160 Tainted data may not be used for the command name.
48161 </para>
48162 <section id="SECID140">
48163 <title>Concurrent delivery</title>
48164 <para>
48165 If two messages arrive at almost the same time, and both are routed to a pipe
48166 delivery, the two pipe transports may be run concurrently. You must ensure that
48167 any pipe commands you set up are robust against this happening. If the commands
48168 write to a file, the <option>exim_lock</option> utility might be of use.
48169 Alternatively the <option>max_parallel</option> option could be used with a value
48170 of "1" to enforce serialization.
48171 </para>
48172 </section>
48173 <section id="SECID141">
48174 <title>Returned status and data</title>
48175 <para>
48176 <indexterm role="concept">
48177 <primary><command>pipe</command> transport</primary>
48178 <secondary>returned data</secondary>
48179 </indexterm>
48180 If the command exits with a non-zero return code, the delivery is deemed to
48181 have failed, unless either the <option>ignore_status</option> option is set (in which case
48182 the return code is treated as zero), or the return code is one of those listed
48183 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
48184 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
48185 logged, but are not included in the bounce message, which merely contains
48186 <quote>local delivery failed</quote>.
48187 </para>
48188 <para>
48189 If the command exits on a signal and the <option>freeze_signal</option> option is set then
48190 the message will be frozen in the queue. If that option is not set, a bounce
48191 will be sent as normal.
48192 </para>
48193 <para>
48194 If the return code is greater than 128 and the command being run is a shell
48195 script, it normally means that the script was terminated by a signal whose
48196 value is the return code minus 128. The <option>freeze_signal</option> option does not
48197 apply in this case.
48198 </para>
48199 <para>
48200 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
48201 return code is set to 127. This is the value that a shell returns if it is
48202 asked to run a non-existent command. The wording for the log line suggests that
48203 a non-existent command may be the problem.
48204 </para>
48205 <para>
48206 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
48207 set and the command produces any output on its standard output or standard
48208 error streams, the command is considered to have failed, even if it gave a zero
48209 return code or if <option>ignore_status</option> is set. The output from the command is
48210 included as part of the bounce message. The <option>return_fail_output</option> option is
48211 similar, except that output is returned only when the command exits with a
48212 failure return code, that is, a value other than zero or a code that matches
48213 <option>temp_errors</option>.
48214 </para>
48215 </section>
48216 <section id="SECThowcommandrun">
48217 <title>How the command is run</title>
48218 <para>
48219 <indexterm role="concept">
48220 <primary><command>pipe</command> transport</primary>
48221 <secondary>path for command</secondary>
48222 </indexterm>
48223 The command line is (by default) broken down into a command name and arguments
48224 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
48225 <option>restrict_to_path</option> options can be used to restrict the commands that may be
48226 run.
48227 </para>
48228 <para>
48229 <indexterm role="concept">
48230 <primary>quoting</primary>
48231 <secondary>in pipe command</secondary>
48232 </indexterm>
48233 Unquoted arguments are delimited by white space. If an argument appears in
48234 double quotes, backslash is interpreted as an escape character in the usual
48235 way. If an argument appears in single quotes, no escaping is done.
48236 </para>
48237 <para>
48238 String expansion is applied to the command line except when it comes from a
48239 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
48240 expansion is applied to each argument in turn rather than to the whole line.
48241 For this reason, any string expansion item that contains white space must be
48242 quoted so as to be contained within a single argument. A setting such as
48243 </para>
48244 <literallayout class="monospaced">
48245 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
48246 </literallayout>
48247 <para>
48248 will not work, because the expansion item gets split between several
48249 arguments. You have to write
48250 </para>
48251 <literallayout class="monospaced">
48252 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
48253 </literallayout>
48254 <para>
48255 to ensure that it is all in one argument. The expansion is done in this way,
48256 argument by argument, so that the number of arguments cannot be changed as a
48257 result of expansion, and quotes or backslashes in inserted variables do not
48258 interact with external quoting. However, this leads to problems if you want to
48259 generate multiple arguments (or the command name plus arguments) from a single
48260 expansion. In this situation, the simplest solution is to use a shell. For
48261 example:
48262 </para>
48263 <literallayout class="monospaced">
48264 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
48265 </literallayout>
48266 <para>
48267 <indexterm role="concept">
48268 <primary>transport</primary>
48269 <secondary>filter</secondary>
48270 </indexterm>
48271 <indexterm role="concept">
48272 <primary>filter</primary>
48273 <secondary>transport filter</secondary>
48274 </indexterm>
48275 <indexterm role="variable">
48276 <primary><varname>$pipe_addresses</varname></primary>
48277 </indexterm>
48278 Special handling takes place when an argument consists of precisely the text
48279 <literal>$pipe_addresses</literal> (no quotes).
48280 This is not a general expansion variable; the only
48281 place this string is recognized is when it appears as an argument for a pipe or
48282 transport filter command. It causes each address that is being handled to be
48283 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
48284 avoids any problems with spaces or shell metacharacters, and is of use when a
48285 <command>pipe</command> transport is handling groups of addresses in a batch.
48286 </para>
48287 <para>
48288 If <option>force_command</option> is enabled on the transport, special handling takes place
48289 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
48290 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
48291 argument is inserted in the argument list at that point
48292 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
48293 the only item in the argument; in fact, if it were then <option>force_command</option>
48294 should behave as a no-op.  Rather, it should be used to adjust the command
48295 run while preserving the argument vector separation.
48296 </para>
48297 <para>
48298 After splitting up into arguments and expansion, the resulting command is run
48299 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
48300 message that is being delivered is supplied on the standard input, and the
48301 standard output and standard error are both connected to a single pipe that is
48302 read by Exim. The <option>max_output</option> option controls how much output the command
48303 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
48304 control what is done with it.
48305 </para>
48306 <para>
48307 Not running the command under a shell (by default) lessens the security risks
48308 in cases when a command from a user&#x2019;s filter file is built out of data that was
48309 taken from an incoming message. If a shell is required, it can of course be
48310 explicitly specified as the command to be run. However, there are circumstances
48311 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
48312 under a shell and cannot easily be modified. To allow for these cases, there is
48313 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
48314 works. Instead of breaking up the command line as just described, it expands it
48315 as a single string and passes the result to <filename>/bin/sh</filename>. The
48316 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
48317 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
48318 </para>
48319 </section>
48320 <section id="SECTpipeenv">
48321 <title>Environment variables</title>
48322 <para>
48323 <indexterm role="concept">
48324 <primary><command>pipe</command> transport</primary>
48325 <secondary>environment for command</secondary>
48326 </indexterm>
48327 <indexterm role="concept">
48328 <primary>environment</primary>
48329 <secondary><command>pipe</command> transport</secondary>
48330 </indexterm>
48331 The environment variables listed below are set up when the command is invoked.
48332 This list is a compromise for maximum compatibility with other MTAs. Note that
48333 the <option>environment</option> option can be used to add additional variables to this
48334 environment. The environment for the <command>pipe</command> transport is not subject
48335 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
48336 <emphasis role="bold">Note</emphasis>: Using enviroment variables loses track of tainted data.
48337 Writers of <command>pipe</command> transport commands should be wary of data supplied
48338 by potential attackers.
48339 </para>
48340 <literallayout>
48341 <literal>DOMAIN            </literal>   the domain of the address
48342 <literal>HOME              </literal>   the home directory, if set
48343 <literal>HOST              </literal>   the host name when called from a router (see below)
48344 <literal>LOCAL_PART        </literal>   see below
48345 <literal>LOCAL_PART_PREFIX </literal>   see below
48346 <literal>LOCAL_PART_SUFFIX </literal>   see below
48347 <literal>LOGNAME           </literal>   see below
48348 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
48349 <literal>PATH              </literal>   as specified by the <option>path</option> option below
48350 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
48351 <literal>RECIPIENT         </literal>   the complete recipient address
48352 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
48353 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
48354 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
48355 <literal>USER              </literal>   see below
48356 </literallayout>
48357 <para>
48358 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
48359 router, LOCAL_PART is set to the local part of the address. When it is
48360 called as a result of a forward or alias expansion, LOCAL_PART is set to
48361 the local part of the address that was expanded. In both cases, any affixes are
48362 removed from the local part, and made available in LOCAL_PART_PREFIX and
48363 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
48364 same value as LOCAL_PART for compatibility with other MTAs.
48365 </para>
48366 <para>
48367 <indexterm role="concept">
48368 <primary>HOST</primary>
48369 </indexterm>
48370 HOST is set only when a <command>pipe</command> transport is called from a router that
48371 associates hosts with an address, typically when using <command>pipe</command> as a
48372 pseudo-remote transport. HOST is set to the first host name specified by
48373 the router.
48374 </para>
48375 <para>
48376 <indexterm role="concept">
48377 <primary>HOME</primary>
48378 </indexterm>
48379 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
48380 for the HOME environment variable. Otherwise, a home directory may be set
48381 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
48382 user&#x2019;s home directory if <option>check_local_user</option> is set.
48383 </para>
48384 </section>
48385 <section id="SECID142">
48386 <title>Private options for pipe</title>
48387 <para>
48388 <indexterm role="concept">
48389 <primary>options</primary>
48390 <secondary><command>pipe</command> transport</secondary>
48391 </indexterm>
48392 </para>
48393 <para>
48394 <indexterm role="option">
48395 <primary><option>allow_commands</option></primary>
48396 </indexterm>
48397 </para>
48398 <informaltable frame="all">
48399 <tgroup cols="4" colsep="0" rowsep="0">
48400 <colspec colwidth="8*" align="left"/>
48401 <colspec colwidth="6*" align="center"/>
48402 <colspec colwidth="6*" align="center"/>
48403 <colspec colwidth="6*" align="right"/>
48404 <tbody>
48405 <row>
48406 <entry><option>allow_commands</option></entry>
48407 <entry>Use: <emphasis>pipe</emphasis></entry>
48408 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
48409 <entry>Default: <emphasis>unset</emphasis></entry>
48410 </row>
48411 </tbody>
48412 </tgroup>
48413 </informaltable>
48414 <para>
48415 <indexterm role="concept">
48416 <primary><command>pipe</command> transport</primary>
48417 <secondary>permitted commands</secondary>
48418 </indexterm>
48419 The string is expanded, and is then interpreted as a colon-separated list of
48420 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
48421 permitted are those in the <option>allow_commands</option> list. They need not be absolute
48422 paths; the <option>path</option> option is still used for relative paths. If
48423 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
48424 in the <option>allow_commands</option> list, or a name without any slashes that is found on
48425 the path. In other words, if neither <option>allow_commands</option> nor
48426 <option>restrict_to_path</option> is set, there is no restriction on the command, but
48427 otherwise only commands that are permitted by one or the other are allowed. For
48428 example, if
48429 </para>
48430 <literallayout class="monospaced">
48431 allow_commands = /usr/bin/vacation
48432 </literallayout>
48433 <para>
48434 and <option>restrict_to_path</option> is not set, the only permitted command is
48435 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
48436 <option>use_shell</option> is set.
48437 </para>
48438 <para>
48439 <indexterm role="option">
48440 <primary><option>batch_id</option></primary>
48441 </indexterm>
48442 </para>
48443 <informaltable frame="all">
48444 <tgroup cols="4" colsep="0" rowsep="0">
48445 <colspec colwidth="8*" align="left"/>
48446 <colspec colwidth="6*" align="center"/>
48447 <colspec colwidth="6*" align="center"/>
48448 <colspec colwidth="6*" align="right"/>
48449 <tbody>
48450 <row>
48451 <entry><option>batch_id</option></entry>
48452 <entry>Use: <emphasis>pipe</emphasis></entry>
48453 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48454 <entry>Default: <emphasis>unset</emphasis></entry>
48455 </row>
48456 </tbody>
48457 </tgroup>
48458 </informaltable>
48459 <para>
48460 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
48461 </para>
48462 <para>
48463 <indexterm role="option">
48464 <primary><option>batch_max</option></primary>
48465 </indexterm>
48466 </para>
48467 <informaltable frame="all">
48468 <tgroup cols="4" colsep="0" rowsep="0">
48469 <colspec colwidth="8*" align="left"/>
48470 <colspec colwidth="6*" align="center"/>
48471 <colspec colwidth="6*" align="center"/>
48472 <colspec colwidth="6*" align="right"/>
48473 <tbody>
48474 <row>
48475 <entry><option>batch_max</option></entry>
48476 <entry>Use: <emphasis>pipe</emphasis></entry>
48477 <entry>Type: <emphasis>integer</emphasis></entry>
48478 <entry>Default: <emphasis>1</emphasis></entry>
48479 </row>
48480 </tbody>
48481 </tgroup>
48482 </informaltable>
48483 <para>
48484 This limits the number of addresses that can be handled in a single delivery.
48485 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
48486 </para>
48487 <para>
48488 <indexterm role="option">
48489 <primary><option>check_string</option></primary>
48490 </indexterm>
48491 </para>
48492 <informaltable frame="all">
48493 <tgroup cols="4" colsep="0" rowsep="0">
48494 <colspec colwidth="8*" align="left"/>
48495 <colspec colwidth="6*" align="center"/>
48496 <colspec colwidth="6*" align="center"/>
48497 <colspec colwidth="6*" align="right"/>
48498 <tbody>
48499 <row>
48500 <entry><option>check_string</option></entry>
48501 <entry>Use: <emphasis>pipe</emphasis></entry>
48502 <entry>Type: <emphasis>string</emphasis></entry>
48503 <entry>Default: <emphasis>unset</emphasis></entry>
48504 </row>
48505 </tbody>
48506 </tgroup>
48507 </informaltable>
48508 <para>
48509 As <command>pipe</command> writes the message, the start of each line is tested for matching
48510 <option>check_string</option>, and if it does, the initial matching characters are replaced
48511 by the contents of <option>escape_string</option>, provided both are set. The value of
48512 <option>check_string</option> is a literal string, not a regular expression, and the case of
48513 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
48514 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
48515 the SMTP escaping protocol. Any settings made in the configuration file are
48516 ignored.
48517 </para>
48518 <para>
48519 <indexterm role="option">
48520 <primary><option>command</option></primary>
48521 </indexterm>
48522 </para>
48523 <informaltable frame="all">
48524 <tgroup cols="4" colsep="0" rowsep="0">
48525 <colspec colwidth="8*" align="left"/>
48526 <colspec colwidth="6*" align="center"/>
48527 <colspec colwidth="6*" align="center"/>
48528 <colspec colwidth="6*" align="right"/>
48529 <tbody>
48530 <row>
48531 <entry><option>command</option></entry>
48532 <entry>Use: <emphasis>pipe</emphasis></entry>
48533 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48534 <entry>Default: <emphasis>unset</emphasis></entry>
48535 </row>
48536 </tbody>
48537 </tgroup>
48538 </informaltable>
48539 <para>
48540 This option need not be set when <command>pipe</command> is being used to deliver to pipes
48541 obtained directly from address redirections. In other cases, the option must be
48542 set, to provide a command to be run. It need not yield an absolute path (see
48543 the <option>path</option> option below). The command is split up into separate arguments by
48544 Exim, and each argument is separately expanded, as described in section
48545 <xref linkend="SECThowcommandrun"/> above.
48546 </para>
48547 <para>
48548 <indexterm role="concept">
48549 <primary>tainted data</primary>
48550 </indexterm>
48551 No part of the resulting command may be tainted.
48552 </para>
48553 <para>
48554 <indexterm role="option">
48555 <primary><option>environment</option></primary>
48556 </indexterm>
48557 </para>
48558 <informaltable frame="all">
48559 <tgroup cols="4" colsep="0" rowsep="0">
48560 <colspec colwidth="8*" align="left"/>
48561 <colspec colwidth="6*" align="center"/>
48562 <colspec colwidth="6*" align="center"/>
48563 <colspec colwidth="6*" align="right"/>
48564 <tbody>
48565 <row>
48566 <entry><option>environment</option></entry>
48567 <entry>Use: <emphasis>pipe</emphasis></entry>
48568 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48569 <entry>Default: <emphasis>unset</emphasis></entry>
48570 </row>
48571 </tbody>
48572 </tgroup>
48573 </informaltable>
48574 <para>
48575 <indexterm role="concept">
48576 <primary><command>pipe</command> transport</primary>
48577 <secondary>environment for command</secondary>
48578 </indexterm>
48579 <indexterm role="concept">
48580 <primary>environment</primary>
48581 <secondary><command>pipe</command> transport</secondary>
48582 </indexterm>
48583 This option is used to add additional variables to the environment in which the
48584 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
48585 a string which is expanded, and then interpreted as a colon-separated list of
48586 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
48587 </para>
48588 <para>
48589 <indexterm role="option">
48590 <primary><option>escape_string</option></primary>
48591 </indexterm>
48592 </para>
48593 <informaltable frame="all">
48594 <tgroup cols="4" colsep="0" rowsep="0">
48595 <colspec colwidth="8*" align="left"/>
48596 <colspec colwidth="6*" align="center"/>
48597 <colspec colwidth="6*" align="center"/>
48598 <colspec colwidth="6*" align="right"/>
48599 <tbody>
48600 <row>
48601 <entry><option>escape_string</option></entry>
48602 <entry>Use: <emphasis>pipe</emphasis></entry>
48603 <entry>Type: <emphasis>string</emphasis></entry>
48604 <entry>Default: <emphasis>unset</emphasis></entry>
48605 </row>
48606 </tbody>
48607 </tgroup>
48608 </informaltable>
48609 <para>
48610 See <option>check_string</option> above.
48611 </para>
48612 <para>
48613 <indexterm role="option">
48614 <primary><option>freeze_exec_fail</option></primary>
48615 </indexterm>
48616 </para>
48617 <informaltable frame="all">
48618 <tgroup cols="4" colsep="0" rowsep="0">
48619 <colspec colwidth="8*" align="left"/>
48620 <colspec colwidth="6*" align="center"/>
48621 <colspec colwidth="6*" align="center"/>
48622 <colspec colwidth="6*" align="right"/>
48623 <tbody>
48624 <row>
48625 <entry><option>freeze_exec_fail</option></entry>
48626 <entry>Use: <emphasis>pipe</emphasis></entry>
48627 <entry>Type: <emphasis>boolean</emphasis></entry>
48628 <entry>Default: <emphasis>false</emphasis></entry>
48629 </row>
48630 </tbody>
48631 </tgroup>
48632 </informaltable>
48633 <para>
48634 <indexterm role="concept">
48635 <primary>exec failure</primary>
48636 </indexterm>
48637 <indexterm role="concept">
48638 <primary>failure of exec</primary>
48639 </indexterm>
48640 <indexterm role="concept">
48641 <primary><command>pipe</command> transport</primary>
48642 <secondary>failure of exec</secondary>
48643 </indexterm>
48644 Failure to exec the command in a pipe transport is by default treated like
48645 any other failure while running the command. However, if <option>freeze_exec_fail</option>
48646 is set, failure to exec is treated specially, and causes the message to be
48647 frozen, whatever the setting of <option>ignore_status</option>.
48648 </para>
48649 <para>
48650 <indexterm role="option">
48651 <primary><option>freeze_signal</option></primary>
48652 </indexterm>
48653 </para>
48654 <informaltable frame="all">
48655 <tgroup cols="4" colsep="0" rowsep="0">
48656 <colspec colwidth="8*" align="left"/>
48657 <colspec colwidth="6*" align="center"/>
48658 <colspec colwidth="6*" align="center"/>
48659 <colspec colwidth="6*" align="right"/>
48660 <tbody>
48661 <row>
48662 <entry><option>freeze_signal</option></entry>
48663 <entry>Use: <emphasis>pipe</emphasis></entry>
48664 <entry>Type: <emphasis>boolean</emphasis></entry>
48665 <entry>Default: <emphasis>false</emphasis></entry>
48666 </row>
48667 </tbody>
48668 </tgroup>
48669 </informaltable>
48670 <para>
48671 <indexterm role="concept">
48672 <primary>signal exit</primary>
48673 </indexterm>
48674 <indexterm role="concept">
48675 <primary><command>pipe</command> transport</primary>
48676 <secondary>,</secondary>
48677 </indexterm>
48678 Normally if the process run by a command in a pipe transport exits on a signal,
48679 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
48680 frozen in Exim&#x2019;s queue instead.
48681 </para>
48682 <para>
48683 <indexterm role="option">
48684 <primary><option>force_command</option></primary>
48685 </indexterm>
48686 </para>
48687 <informaltable frame="all">
48688 <tgroup cols="4" colsep="0" rowsep="0">
48689 <colspec colwidth="8*" align="left"/>
48690 <colspec colwidth="6*" align="center"/>
48691 <colspec colwidth="6*" align="center"/>
48692 <colspec colwidth="6*" align="right"/>
48693 <tbody>
48694 <row>
48695 <entry><option>force_command</option></entry>
48696 <entry>Use: <emphasis>pipe</emphasis></entry>
48697 <entry>Type: <emphasis>boolean</emphasis></entry>
48698 <entry>Default: <emphasis>false</emphasis></entry>
48699 </row>
48700 </tbody>
48701 </tgroup>
48702 </informaltable>
48703 <para>
48704 <indexterm role="concept">
48705 <primary>force command</primary>
48706 </indexterm>
48707 <indexterm role="concept">
48708 <primary><command>pipe</command> transport</primary>
48709 <secondary>,</secondary>
48710 </indexterm>
48711 Normally when a router redirects an address directly to a pipe command
48712 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
48713 is set, the <option>command</option> option will used. This is especially
48714 useful for forcing a wrapper or additional argument to be added to the
48715 command. For example:
48716 </para>
48717 <literallayout class="monospaced">
48718 command = /usr/bin/remote_exec myhost -- $address_pipe
48719 force_command
48720 </literallayout>
48721 <para>
48722 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
48723 <option>force_command</option> is set, expanding out to the original argument vector as
48724 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
48725 </para>
48726 <para>
48727 <indexterm role="option">
48728 <primary><option>ignore_status</option></primary>
48729 </indexterm>
48730 </para>
48731 <informaltable frame="all">
48732 <tgroup cols="4" colsep="0" rowsep="0">
48733 <colspec colwidth="8*" align="left"/>
48734 <colspec colwidth="6*" align="center"/>
48735 <colspec colwidth="6*" align="center"/>
48736 <colspec colwidth="6*" align="right"/>
48737 <tbody>
48738 <row>
48739 <entry><option>ignore_status</option></entry>
48740 <entry>Use: <emphasis>pipe</emphasis></entry>
48741 <entry>Type: <emphasis>boolean</emphasis></entry>
48742 <entry>Default: <emphasis>false</emphasis></entry>
48743 </row>
48744 </tbody>
48745 </tgroup>
48746 </informaltable>
48747 <para>
48748 If this option is true, the status returned by the subprocess that is set up to
48749 run the command is ignored, and Exim behaves as if zero had been returned.
48750 Otherwise, a non-zero status or termination by signal causes an error return
48751 from the transport unless the status value is one of those listed in
48752 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
48753 </para>
48754 <para>
48755 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
48756 See the <option>timeout_defer</option> option for how timeouts are handled.
48757 </para>
48758 <para>
48759 <indexterm role="option">
48760 <primary><option>log_defer_output</option></primary>
48761 </indexterm>
48762 </para>
48763 <informaltable frame="all">
48764 <tgroup cols="4" colsep="0" rowsep="0">
48765 <colspec colwidth="8*" align="left"/>
48766 <colspec colwidth="6*" align="center"/>
48767 <colspec colwidth="6*" align="center"/>
48768 <colspec colwidth="6*" align="right"/>
48769 <tbody>
48770 <row>
48771 <entry><option>log_defer_output</option></entry>
48772 <entry>Use: <emphasis>pipe</emphasis></entry>
48773 <entry>Type: <emphasis>boolean</emphasis></entry>
48774 <entry>Default: <emphasis>false</emphasis></entry>
48775 </row>
48776 </tbody>
48777 </tgroup>
48778 </informaltable>
48779 <para>
48780 <indexterm role="concept">
48781 <primary><command>pipe</command> transport</primary>
48782 <secondary>logging output</secondary>
48783 </indexterm>
48784 If this option is set, and the status returned by the command is
48785 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
48786 and any output was produced on stdout or stderr, the first line of it is
48787 written to the main log.
48788 </para>
48789 <para>
48790 <indexterm role="option">
48791 <primary><option>log_fail_output</option></primary>
48792 </indexterm>
48793 </para>
48794 <informaltable frame="all">
48795 <tgroup cols="4" colsep="0" rowsep="0">
48796 <colspec colwidth="8*" align="left"/>
48797 <colspec colwidth="6*" align="center"/>
48798 <colspec colwidth="6*" align="center"/>
48799 <colspec colwidth="6*" align="right"/>
48800 <tbody>
48801 <row>
48802 <entry><option>log_fail_output</option></entry>
48803 <entry>Use: <emphasis>pipe</emphasis></entry>
48804 <entry>Type: <emphasis>boolean</emphasis></entry>
48805 <entry>Default: <emphasis>false</emphasis></entry>
48806 </row>
48807 </tbody>
48808 </tgroup>
48809 </informaltable>
48810 <para>
48811 If this option is set, and the command returns any output on stdout or
48812 stderr, and also ends with a return code that is neither zero nor one of
48813 the return codes listed in <option>temp_errors</option> (that is, the delivery
48814 failed), the first line of output is written to the main log. This
48815 option and <option>log_output</option> are mutually exclusive.  Only one of them may
48816 be set.
48817 </para>
48818 <para>
48819 <indexterm role="option">
48820 <primary><option>log_output</option></primary>
48821 </indexterm>
48822 </para>
48823 <informaltable frame="all">
48824 <tgroup cols="4" colsep="0" rowsep="0">
48825 <colspec colwidth="8*" align="left"/>
48826 <colspec colwidth="6*" align="center"/>
48827 <colspec colwidth="6*" align="center"/>
48828 <colspec colwidth="6*" align="right"/>
48829 <tbody>
48830 <row>
48831 <entry><option>log_output</option></entry>
48832 <entry>Use: <emphasis>pipe</emphasis></entry>
48833 <entry>Type: <emphasis>boolean</emphasis></entry>
48834 <entry>Default: <emphasis>false</emphasis></entry>
48835 </row>
48836 </tbody>
48837 </tgroup>
48838 </informaltable>
48839 <para>
48840 If this option is set and the command returns any output on stdout or
48841 stderr, the first line of output is written to the main log, whatever
48842 the return code. This option and <option>log_fail_output</option> are mutually
48843 exclusive. Only one of them may be set.
48844 </para>
48845 <para>
48846 <indexterm role="option">
48847 <primary><option>max_output</option></primary>
48848 </indexterm>
48849 </para>
48850 <informaltable frame="all">
48851 <tgroup cols="4" colsep="0" rowsep="0">
48852 <colspec colwidth="8*" align="left"/>
48853 <colspec colwidth="6*" align="center"/>
48854 <colspec colwidth="6*" align="center"/>
48855 <colspec colwidth="6*" align="right"/>
48856 <tbody>
48857 <row>
48858 <entry><option>max_output</option></entry>
48859 <entry>Use: <emphasis>pipe</emphasis></entry>
48860 <entry>Type: <emphasis>integer</emphasis></entry>
48861 <entry>Default: <emphasis>20K</emphasis></entry>
48862 </row>
48863 </tbody>
48864 </tgroup>
48865 </informaltable>
48866 <para>
48867 This specifies the maximum amount of output that the command may produce on its
48868 standard output and standard error file combined. If the limit is exceeded, the
48869 process running the command is killed. This is intended as a safety measure to
48870 catch runaway processes. The limit is applied independently of the settings of
48871 the options that control what is done with such output (for example,
48872 <option>return_output</option>). Because of buffering effects, the amount of output may
48873 exceed the limit by a small amount before Exim notices.
48874 </para>
48875 <para>
48876 <indexterm role="option">
48877 <primary><option>message_prefix</option></primary>
48878 </indexterm>
48879 </para>
48880 <informaltable frame="all">
48881 <tgroup cols="4" colsep="0" rowsep="0">
48882 <colspec colwidth="8*" align="left"/>
48883 <colspec colwidth="6*" align="center"/>
48884 <colspec colwidth="6*" align="center"/>
48885 <colspec colwidth="6*" align="right"/>
48886 <tbody>
48887 <row>
48888 <entry><option>message_prefix</option></entry>
48889 <entry>Use: <emphasis>pipe</emphasis></entry>
48890 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48891 <entry>Default: <emphasis>see below</emphasis></entry>
48892 </row>
48893 </tbody>
48894 </tgroup>
48895 </informaltable>
48896 <para>
48897 The string specified here is expanded and output at the start of every message.
48898 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
48899 </para>
48900 <literallayout class="monospaced">
48901 message_prefix = \
48902   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
48903   ${tod_bsdinbox}\n
48904 </literallayout>
48905 <para>
48906 <indexterm role="concept">
48907 <primary>Cyrus</primary>
48908 </indexterm>
48909 <indexterm role="concept">
48910 <primary><option>tmail</option></primary>
48911 </indexterm>
48912 <indexterm role="concept">
48913 <primary><quote>From</quote> line</primary>
48914 </indexterm>
48915 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
48916 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
48917 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
48918 setting
48919 </para>
48920 <literallayout class="monospaced">
48921 message_prefix =
48922 </literallayout>
48923 <para>
48924 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
48925 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
48926 </para>
48927 <para>
48928 <indexterm role="option">
48929 <primary><option>message_suffix</option></primary>
48930 </indexterm>
48931 </para>
48932 <informaltable frame="all">
48933 <tgroup cols="4" colsep="0" rowsep="0">
48934 <colspec colwidth="8*" align="left"/>
48935 <colspec colwidth="6*" align="center"/>
48936 <colspec colwidth="6*" align="center"/>
48937 <colspec colwidth="6*" align="right"/>
48938 <tbody>
48939 <row>
48940 <entry><option>message_suffix</option></entry>
48941 <entry>Use: <emphasis>pipe</emphasis></entry>
48942 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48943 <entry>Default: <emphasis>see below</emphasis></entry>
48944 </row>
48945 </tbody>
48946 </tgroup>
48947 </informaltable>
48948 <para>
48949 The string specified here is expanded and output at the end of every message.
48950 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
48951 The suffix can be suppressed by setting
48952 </para>
48953 <literallayout class="monospaced">
48954 message_suffix =
48955 </literallayout>
48956 <para>
48957 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
48958 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
48959 </para>
48960 <para>
48961 <indexterm role="option">
48962 <primary><option>path</option></primary>
48963 </indexterm>
48964 </para>
48965 <informaltable frame="all">
48966 <tgroup cols="4" colsep="0" rowsep="0">
48967 <colspec colwidth="8*" align="left"/>
48968 <colspec colwidth="6*" align="center"/>
48969 <colspec colwidth="6*" align="center"/>
48970 <colspec colwidth="6*" align="right"/>
48971 <tbody>
48972 <row>
48973 <entry><option>path</option></entry>
48974 <entry>Use: <emphasis>pipe</emphasis></entry>
48975 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48976 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
48977 </row>
48978 </tbody>
48979 </tgroup>
48980 </informaltable>
48981 <para>
48982 This option is expanded and
48983 specifies the string that is set up in the PATH environment
48984 variable of the subprocess.
48985 If the <option>command</option> option does not yield an absolute path name, the command is
48986 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
48987 apply to a command specified as a transport filter.
48988 </para>
48989 <para>
48990 <indexterm role="option">
48991 <primary><option>permit_coredump</option></primary>
48992 </indexterm>
48993 </para>
48994 <informaltable frame="all">
48995 <tgroup cols="4" colsep="0" rowsep="0">
48996 <colspec colwidth="8*" align="left"/>
48997 <colspec colwidth="6*" align="center"/>
48998 <colspec colwidth="6*" align="center"/>
48999 <colspec colwidth="6*" align="right"/>
49000 <tbody>
49001 <row>
49002 <entry><option>permit_coredump</option></entry>
49003 <entry>Use: <emphasis>pipe</emphasis></entry>
49004 <entry>Type: <emphasis>boolean</emphasis></entry>
49005 <entry>Default: <emphasis>false</emphasis></entry>
49006 </row>
49007 </tbody>
49008 </tgroup>
49009 </informaltable>
49010 <para>
49011 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
49012 a core-dump of a pipe command, enable this command.  This enables core-dumps
49013 during delivery and affects both the Exim binary and the pipe command run.
49014 It is recommended that this option remain off unless and until you have a need
49015 for it and that this only be enabled when needed, as the risk of excessive
49016 resource consumption can be quite high.  Note also that Exim is typically
49017 installed as a setuid binary and most operating systems will inhibit coredumps
49018 of these by default, so further OS-specific action may be required.
49019 </para>
49020 <para>
49021 <indexterm role="option">
49022 <primary><option>pipe_as_creator</option></primary>
49023 </indexterm>
49024 </para>
49025 <informaltable frame="all">
49026 <tgroup cols="4" colsep="0" rowsep="0">
49027 <colspec colwidth="8*" align="left"/>
49028 <colspec colwidth="6*" align="center"/>
49029 <colspec colwidth="6*" align="center"/>
49030 <colspec colwidth="6*" align="right"/>
49031 <tbody>
49032 <row>
49033 <entry><option>pipe_as_creator</option></entry>
49034 <entry>Use: <emphasis>pipe</emphasis></entry>
49035 <entry>Type: <emphasis>boolean</emphasis></entry>
49036 <entry>Default: <emphasis>false</emphasis></entry>
49037 </row>
49038 </tbody>
49039 </tgroup>
49040 </informaltable>
49041 <para>
49042 <indexterm role="concept">
49043 <primary>uid (user id)</primary>
49044 <secondary>local delivery</secondary>
49045 </indexterm>
49046 If the generic <option>user</option> option is not set and this option is true, the delivery
49047 process is run under the uid that was in force when Exim was originally called
49048 to accept the message. If the group id is not otherwise set (via the generic
49049 <option>group</option> option), the gid that was in force when Exim was originally called to
49050 accept the message is used.
49051 </para>
49052 <para>
49053 <indexterm role="option">
49054 <primary><option>restrict_to_path</option></primary>
49055 </indexterm>
49056 </para>
49057 <informaltable frame="all">
49058 <tgroup cols="4" colsep="0" rowsep="0">
49059 <colspec colwidth="8*" align="left"/>
49060 <colspec colwidth="6*" align="center"/>
49061 <colspec colwidth="6*" align="center"/>
49062 <colspec colwidth="6*" align="right"/>
49063 <tbody>
49064 <row>
49065 <entry><option>restrict_to_path</option></entry>
49066 <entry>Use: <emphasis>pipe</emphasis></entry>
49067 <entry>Type: <emphasis>boolean</emphasis></entry>
49068 <entry>Default: <emphasis>false</emphasis></entry>
49069 </row>
49070 </tbody>
49071 </tgroup>
49072 </informaltable>
49073 <para>
49074 When this option is set, any command name not listed in <option>allow_commands</option> must
49075 contain no slashes. The command is searched for only in the directories listed
49076 in the <option>path</option> option. This option is intended for use in the case when a pipe
49077 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
49078 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
49079 </para>
49080 <para>
49081 <indexterm role="option">
49082 <primary><option>return_fail_output</option></primary>
49083 </indexterm>
49084 </para>
49085 <informaltable frame="all">
49086 <tgroup cols="4" colsep="0" rowsep="0">
49087 <colspec colwidth="8*" align="left"/>
49088 <colspec colwidth="6*" align="center"/>
49089 <colspec colwidth="6*" align="center"/>
49090 <colspec colwidth="6*" align="right"/>
49091 <tbody>
49092 <row>
49093 <entry><option>return_fail_output</option></entry>
49094 <entry>Use: <emphasis>pipe</emphasis></entry>
49095 <entry>Type: <emphasis>boolean</emphasis></entry>
49096 <entry>Default: <emphasis>false</emphasis></entry>
49097 </row>
49098 </tbody>
49099 </tgroup>
49100 </informaltable>
49101 <para>
49102 If this option is true, and the command produced any output and ended with a
49103 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
49104 is, the delivery failed), the output is returned in the bounce message.
49105 However, if the message has a null sender (that is, it is itself a bounce
49106 message), output from the command is discarded. This option and
49107 <option>return_output</option> are mutually exclusive. Only one of them may be set.
49108 </para>
49109 <para>
49110 <indexterm role="option">
49111 <primary><option>return_output</option></primary>
49112 </indexterm>
49113 </para>
49114 <informaltable frame="all">
49115 <tgroup cols="4" colsep="0" rowsep="0">
49116 <colspec colwidth="8*" align="left"/>
49117 <colspec colwidth="6*" align="center"/>
49118 <colspec colwidth="6*" align="center"/>
49119 <colspec colwidth="6*" align="right"/>
49120 <tbody>
49121 <row>
49122 <entry><option>return_output</option></entry>
49123 <entry>Use: <emphasis>pipe</emphasis></entry>
49124 <entry>Type: <emphasis>boolean</emphasis></entry>
49125 <entry>Default: <emphasis>false</emphasis></entry>
49126 </row>
49127 </tbody>
49128 </tgroup>
49129 </informaltable>
49130 <para>
49131 If this option is true, and the command produced any output, the delivery is
49132 deemed to have failed whatever the return code from the command, and the output
49133 is returned in the bounce message. Otherwise, the output is just discarded.
49134 However, if the message has a null sender (that is, it is a bounce message),
49135 output from the command is always discarded, whatever the setting of this
49136 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
49137 of them may be set.
49138 </para>
49139 <para>
49140 <indexterm role="option">
49141 <primary><option>temp_errors</option></primary>
49142 </indexterm>
49143 </para>
49144 <informaltable frame="all">
49145 <tgroup cols="4" colsep="0" rowsep="0">
49146 <colspec colwidth="8*" align="left"/>
49147 <colspec colwidth="6*" align="center"/>
49148 <colspec colwidth="6*" align="center"/>
49149 <colspec colwidth="6*" align="right"/>
49150 <tbody>
49151 <row>
49152 <entry><option>temp_errors</option></entry>
49153 <entry>Use: <emphasis>pipe</emphasis></entry>
49154 <entry>Type: <emphasis>string list</emphasis></entry>
49155 <entry>Default: <emphasis>see below</emphasis></entry>
49156 </row>
49157 </tbody>
49158 </tgroup>
49159 </informaltable>
49160 <para>
49161 <indexterm role="concept">
49162 <primary><command>pipe</command> transport</primary>
49163 <secondary>temporary failure</secondary>
49164 </indexterm>
49165 This option contains either a colon-separated list of numbers, or a single
49166 asterisk. If <option>ignore_status</option> is false
49167 and <option>return_output</option> is not set,
49168 and the command exits with a non-zero return code, the failure is treated as
49169 temporary and the delivery is deferred if the return code matches one of the
49170 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
49171 codes are treated as permanent errors. The default setting contains the codes
49172 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
49173 compiled on a system that does not define these macros, it assumes values of 75
49174 and 73, respectively.
49175 </para>
49176 <para>
49177 <indexterm role="option">
49178 <primary><option>timeout</option></primary>
49179 </indexterm>
49180 </para>
49181 <informaltable frame="all">
49182 <tgroup cols="4" colsep="0" rowsep="0">
49183 <colspec colwidth="8*" align="left"/>
49184 <colspec colwidth="6*" align="center"/>
49185 <colspec colwidth="6*" align="center"/>
49186 <colspec colwidth="6*" align="right"/>
49187 <tbody>
49188 <row>
49189 <entry><option>timeout</option></entry>
49190 <entry>Use: <emphasis>pipe</emphasis></entry>
49191 <entry>Type: <emphasis>time</emphasis></entry>
49192 <entry>Default: <emphasis>1h</emphasis></entry>
49193 </row>
49194 </tbody>
49195 </tgroup>
49196 </informaltable>
49197 <para>
49198 If the command fails to complete within this time, it is killed. This normally
49199 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
49200 specifies no timeout. In order to ensure that any subprocesses created by the
49201 command are also killed, Exim makes the initial process a process group leader,
49202 and kills the whole process group on a timeout. However, this can be defeated
49203 if one of the processes starts a new process group.
49204 </para>
49205 <para>
49206 <indexterm role="option">
49207 <primary><option>timeout_defer</option></primary>
49208 </indexterm>
49209 </para>
49210 <informaltable frame="all">
49211 <tgroup cols="4" colsep="0" rowsep="0">
49212 <colspec colwidth="8*" align="left"/>
49213 <colspec colwidth="6*" align="center"/>
49214 <colspec colwidth="6*" align="center"/>
49215 <colspec colwidth="6*" align="right"/>
49216 <tbody>
49217 <row>
49218 <entry><option>timeout_defer</option></entry>
49219 <entry>Use: <emphasis>pipe</emphasis></entry>
49220 <entry>Type: <emphasis>boolean</emphasis></entry>
49221 <entry>Default: <emphasis>false</emphasis></entry>
49222 </row>
49223 </tbody>
49224 </tgroup>
49225 </informaltable>
49226 <para>
49227 A timeout in a <command>pipe</command> transport, either in the command that the transport
49228 runs, or in a transport filter that is associated with it, is by default
49229 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
49230 is set true, both kinds of timeout become temporary errors, causing the
49231 delivery to be deferred.
49232 </para>
49233 <para>
49234 <indexterm role="option">
49235 <primary><option>umask</option></primary>
49236 </indexterm>
49237 </para>
49238 <informaltable frame="all">
49239 <tgroup cols="4" colsep="0" rowsep="0">
49240 <colspec colwidth="8*" align="left"/>
49241 <colspec colwidth="6*" align="center"/>
49242 <colspec colwidth="6*" align="center"/>
49243 <colspec colwidth="6*" align="right"/>
49244 <tbody>
49245 <row>
49246 <entry><option>umask</option></entry>
49247 <entry>Use: <emphasis>pipe</emphasis></entry>
49248 <entry>Type: <emphasis>octal integer</emphasis></entry>
49249 <entry>Default: <emphasis>022</emphasis></entry>
49250 </row>
49251 </tbody>
49252 </tgroup>
49253 </informaltable>
49254 <para>
49255 This specifies the umask setting for the subprocess that runs the command.
49256 </para>
49257 <para>
49258 <indexterm role="option">
49259 <primary><option>use_bsmtp</option></primary>
49260 </indexterm>
49261 </para>
49262 <informaltable frame="all">
49263 <tgroup cols="4" colsep="0" rowsep="0">
49264 <colspec colwidth="8*" align="left"/>
49265 <colspec colwidth="6*" align="center"/>
49266 <colspec colwidth="6*" align="center"/>
49267 <colspec colwidth="6*" align="right"/>
49268 <tbody>
49269 <row>
49270 <entry><option>use_bsmtp</option></entry>
49271 <entry>Use: <emphasis>pipe</emphasis></entry>
49272 <entry>Type: <emphasis>boolean</emphasis></entry>
49273 <entry>Default: <emphasis>false</emphasis></entry>
49274 </row>
49275 </tbody>
49276 </tgroup>
49277 </informaltable>
49278 <para>
49279 <indexterm role="concept">
49280 <primary>envelope sender</primary>
49281 </indexterm>
49282 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
49283 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
49284 commands. If you want to include a leading HELO command with such messages,
49285 you can do so by setting the <option>message_prefix</option> option. See section
49286 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
49287 </para>
49288 <para>
49289 <indexterm role="option">
49290 <primary><option>use_classresources</option></primary>
49291 </indexterm>
49292 </para>
49293 <informaltable frame="all">
49294 <tgroup cols="4" colsep="0" rowsep="0">
49295 <colspec colwidth="8*" align="left"/>
49296 <colspec colwidth="6*" align="center"/>
49297 <colspec colwidth="6*" align="center"/>
49298 <colspec colwidth="6*" align="right"/>
49299 <tbody>
49300 <row>
49301 <entry><option>use_classresources</option></entry>
49302 <entry>Use: <emphasis>pipe</emphasis></entry>
49303 <entry>Type: <emphasis>boolean</emphasis></entry>
49304 <entry>Default: <emphasis>false</emphasis></entry>
49305 </row>
49306 </tbody>
49307 </tgroup>
49308 </informaltable>
49309 <para>
49310 <indexterm role="concept">
49311 <primary>class resources (BSD)</primary>
49312 </indexterm>
49313 This option is available only when Exim is running on FreeBSD, NetBSD, or
49314 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
49315 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
49316 limits for the uid under which the pipe is to run are obtained from the login
49317 class database.
49318 </para>
49319 <para>
49320 <indexterm role="option">
49321 <primary><option>use_crlf</option></primary>
49322 </indexterm>
49323 </para>
49324 <informaltable frame="all">
49325 <tgroup cols="4" colsep="0" rowsep="0">
49326 <colspec colwidth="8*" align="left"/>
49327 <colspec colwidth="6*" align="center"/>
49328 <colspec colwidth="6*" align="center"/>
49329 <colspec colwidth="6*" align="right"/>
49330 <tbody>
49331 <row>
49332 <entry><option>use_crlf</option></entry>
49333 <entry>Use: <emphasis>pipe</emphasis></entry>
49334 <entry>Type: <emphasis>boolean</emphasis></entry>
49335 <entry>Default: <emphasis>false</emphasis></entry>
49336 </row>
49337 </tbody>
49338 </tgroup>
49339 </informaltable>
49340 <para>
49341 <indexterm role="concept">
49342 <primary>carriage return</primary>
49343 </indexterm>
49344 <indexterm role="concept">
49345 <primary>linefeed</primary>
49346 </indexterm>
49347 This option causes lines to be terminated with the two-character CRLF sequence
49348 (carriage return, linefeed) instead of just a linefeed character. In the case
49349 of batched SMTP, the byte sequence written to the pipe is then an exact image
49350 of what would be sent down a real SMTP connection.
49351 </para>
49352 <para>
49353 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
49354 written verbatim, so must contain their own carriage return characters if these
49355 are needed. When <option>use_bsmtp</option> is not set, the default values for both
49356 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
49357 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
49358 </para>
49359 <para>
49360 <indexterm role="option">
49361 <primary><option>use_shell</option></primary>
49362 </indexterm>
49363 </para>
49364 <informaltable frame="all">
49365 <tgroup cols="4" colsep="0" rowsep="0">
49366 <colspec colwidth="8*" align="left"/>
49367 <colspec colwidth="6*" align="center"/>
49368 <colspec colwidth="6*" align="center"/>
49369 <colspec colwidth="6*" align="right"/>
49370 <tbody>
49371 <row>
49372 <entry><option>use_shell</option></entry>
49373 <entry>Use: <emphasis>pipe</emphasis></entry>
49374 <entry>Type: <emphasis>boolean</emphasis></entry>
49375 <entry>Default: <emphasis>false</emphasis></entry>
49376 </row>
49377 </tbody>
49378 </tgroup>
49379 </informaltable>
49380 <para>
49381 <indexterm role="variable">
49382 <primary><varname>$pipe_addresses</varname></primary>
49383 </indexterm>
49384 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
49385 instead of being run directly from the transport, as described in section
49386 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
49387 where the command is expected to be run under a shell and cannot easily be
49388 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
49389 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
49390 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
49391 its <option>-c</option> option.
49392 </para>
49393 </section>
49394 <section id="SECID143">
49395 <title>Using an external local delivery agent</title>
49396 <para>
49397 <indexterm role="concept">
49398 <primary>local delivery</primary>
49399 <secondary>using an external agent</secondary>
49400 </indexterm>
49401 <indexterm role="concept">
49402 <primary><emphasis>procmail</emphasis></primary>
49403 </indexterm>
49404 <indexterm role="concept">
49405 <primary>external local delivery</primary>
49406 </indexterm>
49407 <indexterm role="concept">
49408 <primary>delivery</primary>
49409 <secondary><emphasis>procmail</emphasis></secondary>
49410 </indexterm>
49411 <indexterm role="concept">
49412 <primary>delivery</primary>
49413 <secondary>by external agent</secondary>
49414 </indexterm>
49415 The <command>pipe</command> transport can be used to pass all messages that require local
49416 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
49417 this, care must be taken to ensure that the pipe is run under an appropriate
49418 uid and gid. In some configurations one wants this to be a uid that is trusted
49419 by the delivery agent to supply the correct sender of the message. It may be
49420 necessary to recompile or reconfigure the delivery agent so that it trusts an
49421 appropriate user. The following is an example transport and router
49422 configuration for <option>procmail</option>:
49423 </para>
49424 <literallayout class="monospaced">
49425 # transport
49426 procmail_pipe:
49427   driver = pipe
49428   command = /usr/local/bin/procmail -d $local_part_data
49429   return_path_add
49430   delivery_date_add
49431   envelope_to_add
49432   check_string = "From "
49433   escape_string = "&gt;From "
49434   umask = 077
49435   user = $local_part_data
49436   group = mail
49437
49438 # router
49439 procmail:
49440   driver = accept
49441   check_local_user
49442   transport = procmail_pipe
49443 </literallayout>
49444 <para>
49445 In this example, the pipe is run as the local user, but with the group set to
49446 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
49447 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
49448 user to supply a correct sender address. If you do not specify either a
49449 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
49450 home directory is the user&#x2019;s home directory by default.
49451 </para>
49452 <para>
49453 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
49454 </para>
49455 <literallayout class="monospaced">
49456 IFS=" "
49457 </literallayout>
49458 <para>
49459 as shown in some <option>procmail</option> documentation, because Exim does not by default
49460 use a shell to run pipe commands.
49461 </para>
49462 <para>
49463 <indexterm role="concept">
49464 <primary>Cyrus</primary>
49465 </indexterm>
49466 The next example shows a transport and a router for a system where local
49467 deliveries are handled by the Cyrus IMAP server.
49468 </para>
49469 <literallayout class="monospaced">
49470 # transport
49471 local_delivery_cyrus:
49472   driver = pipe
49473   command = /usr/cyrus/bin/deliver \
49474             -- $local_part_data
49475   user = cyrus
49476   group = mail
49477   return_output
49478   log_output
49479   message_prefix =
49480   message_suffix =
49481
49482 # router
49483 local_user_cyrus:
49484   driver = accept
49485   check_local_user
49486   transport = local_delivery_cyrus
49487 </literallayout>
49488 <para>
49489 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
49490 <option>return_output</option> to cause any text written by Cyrus to be returned to the
49491 sender.
49492 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
49493 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
49494 </para>
49495 </section>
49496 </chapter>
49497
49498 <chapter id="CHAPsmtptrans">
49499 <title>The smtp transport</title>
49500 <para>
49501 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
49502 <primary>transports</primary>
49503 <secondary><command>smtp</command></secondary>
49504 </indexterm>
49505 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
49506 <primary><command>smtp</command> transport</primary>
49507 </indexterm>
49508 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
49509 or LMTP protocol. The list of hosts to try can either be taken from the address
49510 that is being processed (having been set up by the router), or specified
49511 explicitly for the transport. Timeout and retry processing (see chapter
49512 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
49513 </para>
49514 <section id="SECID144">
49515 <title>Multiple messages on a single connection</title>
49516 <para>
49517 The sending of multiple messages over a single TCP/IP connection can arise in
49518 two ways:
49519 </para>
49520 <itemizedlist>
49521 <listitem>
49522 <para>
49523 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
49524 routed to the same host, more than one copy of the message has to be sent to
49525 that host. In this situation, multiple copies may be sent in a single run of
49526 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
49527 does when it has too many addresses to send in one message also depends on the
49528 value of the global <option>remote_max_parallel</option> option. Details are given in
49529 section <xref linkend="SECToutSMTPTCP"/>.)
49530 </para>
49531 </listitem>
49532 <listitem>
49533 <para>
49534 <indexterm role="concept">
49535 <primary>hints database</primary>
49536 <secondary>remembering routing</secondary>
49537 </indexterm>
49538 When a message has been successfully delivered over a TCP/IP connection, Exim
49539 looks in its hints database to see if there are any other messages awaiting a
49540 connection to the same host. If there are, a new delivery process is started
49541 for one of them, and the current TCP/IP connection is passed on to it. The new
49542 process may in turn send multiple copies and possibly create yet another
49543 process.
49544 </para>
49545 </listitem>
49546 </itemizedlist>
49547 <para>
49548 For each copy sent over the same TCP/IP connection, a sequence counter is
49549 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
49550 no further messages are sent over that connection.
49551 </para>
49552 </section>
49553 <section id="SECID145">
49554 <title>Use of the $host and $host_address variables</title>
49555 <para>
49556 <indexterm role="variable">
49557 <primary><varname>$host</varname></primary>
49558 </indexterm>
49559 <indexterm role="variable">
49560 <primary><varname>$host_address</varname></primary>
49561 </indexterm>
49562 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
49563 <varname>$host_address</varname> are the name and IP address of the first host on the host list
49564 passed by the router. However, when the transport is about to connect to a
49565 specific host, and while it is connected to that host, <varname>$host</varname> and
49566 <varname>$host_address</varname> are set to the values for that host. These are the values
49567 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
49568 <option>serialize_hosts</option>, and the various TLS options are expanded.
49569 </para>
49570 </section>
49571 <section id="usecippeer">
49572 <title>Use of $tls_cipher and $tls_peerdn</title>
49573 <para>
49574 <indexterm role="variable">
49575 <primary><varname>$tls_bits</varname></primary>
49576 </indexterm>
49577 <indexterm role="variable">
49578 <primary><varname>$tls_cipher</varname></primary>
49579 </indexterm>
49580 <indexterm role="variable">
49581 <primary><varname>$tls_peerdn</varname></primary>
49582 </indexterm>
49583 <indexterm role="variable">
49584 <primary><varname>$tls_sni</varname></primary>
49585 </indexterm>
49586 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
49587 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
49588 are the values that were set when the message was received.
49589 These are the values that are used for options that are expanded before any
49590 SMTP connections are made. Just before each connection is made, these four
49591 variables are emptied. If TLS is subsequently started, they are set to the
49592 appropriate values for the outgoing connection, and these are the values that
49593 are in force when any authenticators are run and when the
49594 <option>authenticated_sender</option> option is expanded.
49595 </para>
49596 <para>
49597 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
49598 and will be removed in a future release.
49599 </para>
49600 </section>
49601 <section id="SECID146">
49602 <title>Private options for smtp</title>
49603 <para>
49604 <indexterm role="concept">
49605 <primary>options</primary>
49606 <secondary><command>smtp</command> transport</secondary>
49607 </indexterm>
49608 The private options of the <command>smtp</command> transport are as follows:
49609 </para>
49610 <para>
49611 <indexterm role="option">
49612 <primary><option>address_retry_include_sender</option></primary>
49613 </indexterm>
49614 </para>
49615 <informaltable frame="all">
49616 <tgroup cols="4" colsep="0" rowsep="0">
49617 <colspec colwidth="8*" align="left"/>
49618 <colspec colwidth="6*" align="center"/>
49619 <colspec colwidth="6*" align="center"/>
49620 <colspec colwidth="6*" align="right"/>
49621 <tbody>
49622 <row>
49623 <entry><option>address_retry_include_sender</option></entry>
49624 <entry>Use: <emphasis>smtp</emphasis></entry>
49625 <entry>Type: <emphasis>boolean</emphasis></entry>
49626 <entry>Default: <emphasis>true</emphasis></entry>
49627 </row>
49628 </tbody>
49629 </tgroup>
49630 </informaltable>
49631 <para>
49632 <indexterm role="concept">
49633 <primary>4<emphasis>xx</emphasis> responses</primary>
49634 <secondary>retrying after</secondary>
49635 </indexterm>
49636 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
49637 is the combination of sender and recipient that is delayed in subsequent queue
49638 runs until the retry time is reached. You can delay the recipient without
49639 reference to the sender (which is what earlier versions of Exim did), by
49640 setting <option>address_retry_include_sender</option> false. However, this can lead to
49641 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
49642 </para>
49643 <para>
49644 <indexterm role="option">
49645 <primary><option>allow_localhost</option></primary>
49646 </indexterm>
49647 </para>
49648 <informaltable frame="all">
49649 <tgroup cols="4" colsep="0" rowsep="0">
49650 <colspec colwidth="8*" align="left"/>
49651 <colspec colwidth="6*" align="center"/>
49652 <colspec colwidth="6*" align="center"/>
49653 <colspec colwidth="6*" align="right"/>
49654 <tbody>
49655 <row>
49656 <entry><option>allow_localhost</option></entry>
49657 <entry>Use: <emphasis>smtp</emphasis></entry>
49658 <entry>Type: <emphasis>boolean</emphasis></entry>
49659 <entry>Default: <emphasis>false</emphasis></entry>
49660 </row>
49661 </tbody>
49662 </tgroup>
49663 </informaltable>
49664 <para>
49665 <indexterm role="concept">
49666 <primary>local host</primary>
49667 <secondary>sending to</secondary>
49668 </indexterm>
49669 <indexterm role="concept">
49670 <primary>fallback</primary>
49671 <secondary>hosts specified on transport</secondary>
49672 </indexterm>
49673 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
49674 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
49675 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
49676 the delivery anyway. This should be used only in special cases when the
49677 configuration ensures that no looping will result (for example, a differently
49678 configured Exim is listening on the port to which the message is sent).
49679 </para>
49680 <para>
49681 <indexterm role="option">
49682 <primary><option>authenticated_sender</option></primary>
49683 </indexterm>
49684 </para>
49685 <informaltable frame="all">
49686 <tgroup cols="4" colsep="0" rowsep="0">
49687 <colspec colwidth="8*" align="left"/>
49688 <colspec colwidth="6*" align="center"/>
49689 <colspec colwidth="6*" align="center"/>
49690 <colspec colwidth="6*" align="right"/>
49691 <tbody>
49692 <row>
49693 <entry><option>authenticated_sender</option></entry>
49694 <entry>Use: <emphasis>smtp</emphasis></entry>
49695 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49696 <entry>Default: <emphasis>unset</emphasis></entry>
49697 </row>
49698 </tbody>
49699 </tgroup>
49700 </informaltable>
49701 <para>
49702 <indexterm role="concept">
49703 <primary>Cyrus</primary>
49704 </indexterm>
49705 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
49706 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
49707 overriding any existing authenticated sender value. If the string expansion is
49708 forced to fail, the option is ignored. Other expansion failures cause delivery
49709 to be deferred. If the result of expansion is an empty string, that is also
49710 ignored.
49711 </para>
49712 <para>
49713 The expansion happens after the outgoing connection has been made and TLS
49714 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
49715 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
49716 particular connection.
49717 </para>
49718 <para>
49719 If the SMTP session is not authenticated, the expansion of
49720 <option>authenticated_sender</option> still happens (and can cause the delivery to be
49721 deferred if it fails), but no AUTH= item is added to MAIL commands
49722 unless <option>authenticated_sender_force</option> is true.
49723 </para>
49724 <para>
49725 This option allows you to use the <command>smtp</command> transport in LMTP mode to
49726 deliver mail to Cyrus IMAP and provide the proper local part as the
49727 <quote>authenticated sender</quote>, via a setting such as:
49728 </para>
49729 <literallayout class="monospaced">
49730 authenticated_sender = $local_part
49731 </literallayout>
49732 <para>
49733 This removes the need for IMAP subfolders to be assigned special ACLs to
49734 allow direct delivery to those subfolders.
49735 </para>
49736 <para>
49737 Because of expected uses such as that just described for Cyrus (when no
49738 domain is involved), there is no checking on the syntax of the provided
49739 value.
49740 </para>
49741 <para>
49742 <indexterm role="option">
49743 <primary><option>authenticated_sender_force</option></primary>
49744 </indexterm>
49745 </para>
49746 <informaltable frame="all">
49747 <tgroup cols="4" colsep="0" rowsep="0">
49748 <colspec colwidth="8*" align="left"/>
49749 <colspec colwidth="6*" align="center"/>
49750 <colspec colwidth="6*" align="center"/>
49751 <colspec colwidth="6*" align="right"/>
49752 <tbody>
49753 <row>
49754 <entry><option>authenticated_sender_force</option></entry>
49755 <entry>Use: <emphasis>smtp</emphasis></entry>
49756 <entry>Type: <emphasis>boolean</emphasis></entry>
49757 <entry>Default: <emphasis>false</emphasis></entry>
49758 </row>
49759 </tbody>
49760 </tgroup>
49761 </informaltable>
49762 <para>
49763 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
49764 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
49765 authenticated as a client.
49766 </para>
49767 <para>
49768 <indexterm role="option">
49769 <primary><option>command_timeout</option></primary>
49770 </indexterm>
49771 </para>
49772 <informaltable frame="all">
49773 <tgroup cols="4" colsep="0" rowsep="0">
49774 <colspec colwidth="8*" align="left"/>
49775 <colspec colwidth="6*" align="center"/>
49776 <colspec colwidth="6*" align="center"/>
49777 <colspec colwidth="6*" align="right"/>
49778 <tbody>
49779 <row>
49780 <entry><option>command_timeout</option></entry>
49781 <entry>Use: <emphasis>smtp</emphasis></entry>
49782 <entry>Type: <emphasis>time</emphasis></entry>
49783 <entry>Default: <emphasis>5m</emphasis></entry>
49784 </row>
49785 </tbody>
49786 </tgroup>
49787 </informaltable>
49788 <para>
49789 <indexterm role="concept">
49790 <primary>timeout</primary>
49791 <secondary>smtp transport command</secondary>
49792 </indexterm>
49793 This sets a timeout for receiving a response to an SMTP command that has been
49794 sent out. It is also used when waiting for the initial banner line from the
49795 remote host. Its value must not be zero.
49796 </para>
49797 <para>
49798 <indexterm role="option">
49799 <primary><option>connect_timeout</option></primary>
49800 </indexterm>
49801 </para>
49802 <informaltable frame="all">
49803 <tgroup cols="4" colsep="0" rowsep="0">
49804 <colspec colwidth="8*" align="left"/>
49805 <colspec colwidth="6*" align="center"/>
49806 <colspec colwidth="6*" align="center"/>
49807 <colspec colwidth="6*" align="right"/>
49808 <tbody>
49809 <row>
49810 <entry><option>connect_timeout</option></entry>
49811 <entry>Use: <emphasis>smtp</emphasis></entry>
49812 <entry>Type: <emphasis>time</emphasis></entry>
49813 <entry>Default: <emphasis>5m</emphasis></entry>
49814 </row>
49815 </tbody>
49816 </tgroup>
49817 </informaltable>
49818 <para>
49819 <indexterm role="concept">
49820 <primary>timeout</primary>
49821 <secondary>smtp transport connect</secondary>
49822 </indexterm>
49823 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
49824 to a remote host. A setting of zero allows the system timeout (typically
49825 several minutes) to act. To have any effect, the value of this option must be
49826 less than the system timeout. However, it has been observed that on some
49827 systems there is no system timeout, which is why the default value for this
49828 option is 5 minutes, a value recommended by RFC 1123.
49829 </para>
49830 <para>
49831 <indexterm role="option">
49832 <primary><option>connection_max_messages</option></primary>
49833 </indexterm>
49834 </para>
49835 <informaltable frame="all">
49836 <tgroup cols="4" colsep="0" rowsep="0">
49837 <colspec colwidth="8*" align="left"/>
49838 <colspec colwidth="6*" align="center"/>
49839 <colspec colwidth="6*" align="center"/>
49840 <colspec colwidth="6*" align="right"/>
49841 <tbody>
49842 <row>
49843 <entry><option>connection_max_messages</option></entry>
49844 <entry>Use: <emphasis>smtp</emphasis></entry>
49845 <entry>Type: <emphasis>integer</emphasis></entry>
49846 <entry>Default: <emphasis>500</emphasis></entry>
49847 </row>
49848 </tbody>
49849 </tgroup>
49850 </informaltable>
49851 <para>
49852 <indexterm role="concept">
49853 <primary>SMTP</primary>
49854 <secondary>passed connection</secondary>
49855 </indexterm>
49856 <indexterm role="concept">
49857 <primary>SMTP</primary>
49858 <secondary>multiple deliveries</secondary>
49859 </indexterm>
49860 <indexterm role="concept">
49861 <primary>multiple SMTP deliveries</primary>
49862 </indexterm>
49863 This controls the maximum number of separate message deliveries that are sent
49864 over a single TCP/IP connection. If the value is zero, there is no limit.
49865 For testing purposes, this value can be overridden by the <option>-oB</option> command line
49866 option.
49867 </para>
49868 <para>
49869 <indexterm role="option">
49870 <primary><option>dane_require_tls_ciphers</option></primary>
49871 </indexterm>
49872 </para>
49873 <informaltable frame="all">
49874 <tgroup cols="4" colsep="0" rowsep="0">
49875 <colspec colwidth="8*" align="left"/>
49876 <colspec colwidth="6*" align="center"/>
49877 <colspec colwidth="6*" align="center"/>
49878 <colspec colwidth="6*" align="right"/>
49879 <tbody>
49880 <row>
49881 <entry><option>dane_require_tls_ciphers</option></entry>
49882 <entry>Use: <emphasis>smtp</emphasis></entry>
49883 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49884 <entry>Default: <emphasis>unset</emphasis></entry>
49885 </row>
49886 </tbody>
49887 </tgroup>
49888 </informaltable>
49889 <para>
49890 <indexterm role="concept">
49891 <primary>TLS</primary>
49892 <secondary>requiring specific ciphers for DANE</secondary>
49893 </indexterm>
49894 <indexterm role="concept">
49895 <primary>cipher</primary>
49896 <secondary>requiring specific</secondary>
49897 </indexterm>
49898 <indexterm role="concept">
49899 <primary>DANE</primary>
49900 <secondary>TLS ciphers</secondary>
49901 </indexterm>
49902 This option may be used to override <option>tls_require_ciphers</option> for connections
49903 where DANE has been determined to be in effect.
49904 If not set, then <option>tls_require_ciphers</option> will be used.
49905 Normal SMTP delivery is not able to make strong demands of TLS cipher
49906 configuration, because delivery will fall back to plaintext.  Once DANE has
49907 been determined to be in effect, there is no plaintext fallback and making the
49908 TLS cipherlist configuration stronger will increase security, rather than
49909 counter-intuitively decreasing it.
49910 If the option expands to be empty or is forced to fail, then it will
49911 be treated as unset and <option>tls_require_ciphers</option> will be used instead.
49912 </para>
49913 <para>
49914 <indexterm role="option">
49915 <primary><option>data_timeout</option></primary>
49916 </indexterm>
49917 </para>
49918 <informaltable frame="all">
49919 <tgroup cols="4" colsep="0" rowsep="0">
49920 <colspec colwidth="8*" align="left"/>
49921 <colspec colwidth="6*" align="center"/>
49922 <colspec colwidth="6*" align="center"/>
49923 <colspec colwidth="6*" align="right"/>
49924 <tbody>
49925 <row>
49926 <entry><option>data_timeout</option></entry>
49927 <entry>Use: <emphasis>smtp</emphasis></entry>
49928 <entry>Type: <emphasis>time</emphasis></entry>
49929 <entry>Default: <emphasis>5m</emphasis></entry>
49930 </row>
49931 </tbody>
49932 </tgroup>
49933 </informaltable>
49934 <para>
49935 <indexterm role="concept">
49936 <primary>timeout</primary>
49937 <secondary>for transmitted SMTP data blocks</secondary>
49938 </indexterm>
49939 This sets a timeout for the transmission of each block in the data portion of
49940 the message. As a result, the overall timeout for a message depends on the size
49941 of the message. Its value must not be zero. See also <option>final_timeout</option>.
49942 </para>
49943 <para>
49944 <indexterm role="option">
49945 <primary><option>dkim_canon</option></primary>
49946 </indexterm>
49947 </para>
49948 <informaltable frame="all">
49949 <tgroup cols="4" colsep="0" rowsep="0">
49950 <colspec colwidth="8*" align="left"/>
49951 <colspec colwidth="6*" align="center"/>
49952 <colspec colwidth="6*" align="center"/>
49953 <colspec colwidth="6*" align="right"/>
49954 <tbody>
49955 <row>
49956 <entry><option>dkim_canon</option></entry>
49957 <entry>Use: <emphasis>smtp</emphasis></entry>
49958 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49959 <entry>Default: <emphasis>unset</emphasis></entry>
49960 </row>
49961 </tbody>
49962 </tgroup>
49963 </informaltable>
49964 <para>
49965 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49966 <indexterm role="option">
49967 <primary><option>dkim_domain</option></primary>
49968 </indexterm>
49969 </para>
49970 <informaltable frame="all">
49971 <tgroup cols="4" colsep="0" rowsep="0">
49972 <colspec colwidth="8*" align="left"/>
49973 <colspec colwidth="6*" align="center"/>
49974 <colspec colwidth="6*" align="center"/>
49975 <colspec colwidth="6*" align="right"/>
49976 <tbody>
49977 <row>
49978 <entry><option>dkim_domain</option></entry>
49979 <entry>Use: <emphasis>smtp</emphasis></entry>
49980 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
49981 <entry>Default: <emphasis>unset</emphasis></entry>
49982 </row>
49983 </tbody>
49984 </tgroup>
49985 </informaltable>
49986 <para>
49987 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49988 <indexterm role="option">
49989 <primary><option>dkim_hash</option></primary>
49990 </indexterm>
49991 </para>
49992 <informaltable frame="all">
49993 <tgroup cols="4" colsep="0" rowsep="0">
49994 <colspec colwidth="8*" align="left"/>
49995 <colspec colwidth="6*" align="center"/>
49996 <colspec colwidth="6*" align="center"/>
49997 <colspec colwidth="6*" align="right"/>
49998 <tbody>
49999 <row>
50000 <entry><option>dkim_hash</option></entry>
50001 <entry>Use: <emphasis>smtp</emphasis></entry>
50002 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50003 <entry>Default: <emphasis>sha256</emphasis></entry>
50004 </row>
50005 </tbody>
50006 </tgroup>
50007 </informaltable>
50008 <para>
50009 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
50010 <indexterm role="option">
50011 <primary><option>dkim_identity</option></primary>
50012 </indexterm>
50013 </para>
50014 <informaltable frame="all">
50015 <tgroup cols="4" colsep="0" rowsep="0">
50016 <colspec colwidth="8*" align="left"/>
50017 <colspec colwidth="6*" align="center"/>
50018 <colspec colwidth="6*" align="center"/>
50019 <colspec colwidth="6*" align="right"/>
50020 <tbody>
50021 <row>
50022 <entry><option>dkim_identity</option></entry>
50023 <entry>Use: <emphasis>smtp</emphasis></entry>
50024 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50025 <entry>Default: <emphasis>unset</emphasis></entry>
50026 </row>
50027 </tbody>
50028 </tgroup>
50029 </informaltable>
50030 <para>
50031 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
50032 <indexterm role="option">
50033 <primary><option>dkim_private_key</option></primary>
50034 </indexterm>
50035 </para>
50036 <informaltable frame="all">
50037 <tgroup cols="4" colsep="0" rowsep="0">
50038 <colspec colwidth="8*" align="left"/>
50039 <colspec colwidth="6*" align="center"/>
50040 <colspec colwidth="6*" align="center"/>
50041 <colspec colwidth="6*" align="right"/>
50042 <tbody>
50043 <row>
50044 <entry><option>dkim_private_key</option></entry>
50045 <entry>Use: <emphasis>smtp</emphasis></entry>
50046 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50047 <entry>Default: <emphasis>unset</emphasis></entry>
50048 </row>
50049 </tbody>
50050 </tgroup>
50051 </informaltable>
50052 <para>
50053 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
50054 <indexterm role="option">
50055 <primary><option>dkim_selector</option></primary>
50056 </indexterm>
50057 </para>
50058 <informaltable frame="all">
50059 <tgroup cols="4" colsep="0" rowsep="0">
50060 <colspec colwidth="8*" align="left"/>
50061 <colspec colwidth="6*" align="center"/>
50062 <colspec colwidth="6*" align="center"/>
50063 <colspec colwidth="6*" align="right"/>
50064 <tbody>
50065 <row>
50066 <entry><option>dkim_selector</option></entry>
50067 <entry>Use: <emphasis>smtp</emphasis></entry>
50068 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50069 <entry>Default: <emphasis>unset</emphasis></entry>
50070 </row>
50071 </tbody>
50072 </tgroup>
50073 </informaltable>
50074 <para>
50075 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
50076 <indexterm role="option">
50077 <primary><option>dkim_strict</option></primary>
50078 </indexterm>
50079 </para>
50080 <informaltable frame="all">
50081 <tgroup cols="4" colsep="0" rowsep="0">
50082 <colspec colwidth="8*" align="left"/>
50083 <colspec colwidth="6*" align="center"/>
50084 <colspec colwidth="6*" align="center"/>
50085 <colspec colwidth="6*" align="right"/>
50086 <tbody>
50087 <row>
50088 <entry><option>dkim_strict</option></entry>
50089 <entry>Use: <emphasis>smtp</emphasis></entry>
50090 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50091 <entry>Default: <emphasis>unset</emphasis></entry>
50092 </row>
50093 </tbody>
50094 </tgroup>
50095 </informaltable>
50096 <para>
50097 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
50098 <indexterm role="option">
50099 <primary><option>dkim_sign_headers</option></primary>
50100 </indexterm>
50101 </para>
50102 <informaltable frame="all">
50103 <tgroup cols="4" colsep="0" rowsep="0">
50104 <colspec colwidth="8*" align="left"/>
50105 <colspec colwidth="6*" align="center"/>
50106 <colspec colwidth="6*" align="center"/>
50107 <colspec colwidth="6*" align="right"/>
50108 <tbody>
50109 <row>
50110 <entry><option>dkim_sign_headers</option></entry>
50111 <entry>Use: <emphasis>smtp</emphasis></entry>
50112 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50113 <entry>Default: <emphasis>per RFC</emphasis></entry>
50114 </row>
50115 </tbody>
50116 </tgroup>
50117 </informaltable>
50118 <para>
50119 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
50120 <indexterm role="option">
50121 <primary><option>dkim_timestamps</option></primary>
50122 </indexterm>
50123 </para>
50124 <informaltable frame="all">
50125 <tgroup cols="4" colsep="0" rowsep="0">
50126 <colspec colwidth="8*" align="left"/>
50127 <colspec colwidth="6*" align="center"/>
50128 <colspec colwidth="6*" align="center"/>
50129 <colspec colwidth="6*" align="right"/>
50130 <tbody>
50131 <row>
50132 <entry><option>dkim_timestamps</option></entry>
50133 <entry>Use: <emphasis>smtp</emphasis></entry>
50134 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50135 <entry>Default: <emphasis>unset</emphasis></entry>
50136 </row>
50137 </tbody>
50138 </tgroup>
50139 </informaltable>
50140 <para>
50141 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
50142 </para>
50143 <para>
50144 <indexterm role="option">
50145 <primary><option>delay_after_cutoff</option></primary>
50146 </indexterm>
50147 </para>
50148 <informaltable frame="all">
50149 <tgroup cols="4" colsep="0" rowsep="0">
50150 <colspec colwidth="8*" align="left"/>
50151 <colspec colwidth="6*" align="center"/>
50152 <colspec colwidth="6*" align="center"/>
50153 <colspec colwidth="6*" align="right"/>
50154 <tbody>
50155 <row>
50156 <entry><option>delay_after_cutoff</option></entry>
50157 <entry>Use: <emphasis>smtp</emphasis></entry>
50158 <entry>Type: <emphasis>boolean</emphasis></entry>
50159 <entry>Default: <emphasis>true</emphasis></entry>
50160 </row>
50161 </tbody>
50162 </tgroup>
50163 </informaltable>
50164 <para>
50165 <indexterm role="concept">
50166 <primary>final cutoff</primary>
50167 <secondary>retries, controlling</secondary>
50168 </indexterm>
50169 <indexterm role="concept">
50170 <primary>retry</primary>
50171 <secondary>final cutoff</secondary>
50172 </indexterm>
50173 This option controls what happens when all remote IP addresses for a given
50174 domain have been inaccessible for so long that they have passed their retry
50175 cutoff times.
50176 </para>
50177 <para>
50178 In the default state, if the next retry time has not been reached for any of
50179 them, the address is bounced without trying any deliveries. In other words,
50180 Exim delays retrying an IP address after the final cutoff time until a new
50181 retry time is reached, and can therefore bounce an address without ever trying
50182 a delivery, when machines have been down for a long time. Some people are
50183 unhappy at this prospect, so...
50184 </para>
50185 <para>
50186 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
50187 addresses are past their final cutoff time, Exim tries to deliver to those
50188 IP addresses that have not been tried since the message arrived. If there are
50189 none, of if they all fail, the address is bounced. In other words, it does not
50190 delay when a new message arrives, but immediately tries those expired IP
50191 addresses that haven&#x2019;t been tried since the message arrived. If there is a
50192 continuous stream of messages for the dead hosts, unsetting
50193 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
50194 to them.
50195 </para>
50196 <para>
50197 <indexterm role="option">
50198 <primary><option>dns_qualify_single</option></primary>
50199 </indexterm>
50200 </para>
50201 <informaltable frame="all">
50202 <tgroup cols="4" colsep="0" rowsep="0">
50203 <colspec colwidth="8*" align="left"/>
50204 <colspec colwidth="6*" align="center"/>
50205 <colspec colwidth="6*" align="center"/>
50206 <colspec colwidth="6*" align="right"/>
50207 <tbody>
50208 <row>
50209 <entry><option>dns_qualify_single</option></entry>
50210 <entry>Use: <emphasis>smtp</emphasis></entry>
50211 <entry>Type: <emphasis>boolean</emphasis></entry>
50212 <entry>Default: <emphasis>true</emphasis></entry>
50213 </row>
50214 </tbody>
50215 </tgroup>
50216 </informaltable>
50217 <para>
50218 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
50219 and the <option>gethostbyname</option> option is false,
50220 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
50221 in chapter <xref linkend="CHAPdnslookup"/> for more details.
50222 </para>
50223 <para>
50224 <indexterm role="option">
50225 <primary><option>dns_search_parents</option></primary>
50226 </indexterm>
50227 </para>
50228 <informaltable frame="all">
50229 <tgroup cols="4" colsep="0" rowsep="0">
50230 <colspec colwidth="8*" align="left"/>
50231 <colspec colwidth="6*" align="center"/>
50232 <colspec colwidth="6*" align="center"/>
50233 <colspec colwidth="6*" align="right"/>
50234 <tbody>
50235 <row>
50236 <entry><option>dns_search_parents</option></entry>
50237 <entry>Use: <emphasis>smtp</emphasis></entry>
50238 <entry>Type: <emphasis>boolean</emphasis></entry>
50239 <entry>Default: <emphasis>false</emphasis></entry>
50240 </row>
50241 </tbody>
50242 </tgroup>
50243 </informaltable>
50244 <para>
50245 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
50246 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
50247 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
50248 details.
50249 </para>
50250 <para>
50251 <indexterm role="option">
50252 <primary><option>dnssec_request_domains</option></primary>
50253 </indexterm>
50254 </para>
50255 <informaltable frame="all">
50256 <tgroup cols="4" colsep="0" rowsep="0">
50257 <colspec colwidth="8*" align="left"/>
50258 <colspec colwidth="6*" align="center"/>
50259 <colspec colwidth="6*" align="center"/>
50260 <colspec colwidth="6*" align="right"/>
50261 <tbody>
50262 <row>
50263 <entry><option>dnssec_request_domains</option></entry>
50264 <entry>Use: <emphasis>smtp</emphasis></entry>
50265 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
50266 <entry>Default: <emphasis>*</emphasis></entry>
50267 </row>
50268 </tbody>
50269 </tgroup>
50270 </informaltable>
50271 <para>
50272 <indexterm role="concept">
50273 <primary>MX record</primary>
50274 <secondary>security</secondary>
50275 </indexterm>
50276 <indexterm role="concept">
50277 <primary>DNSSEC</primary>
50278 <secondary>MX lookup</secondary>
50279 </indexterm>
50280 <indexterm role="concept">
50281 <primary>security</primary>
50282 <secondary>MX lookup</secondary>
50283 </indexterm>
50284 <indexterm role="concept">
50285 <primary>DNS</primary>
50286 <secondary>DNSSEC</secondary>
50287 </indexterm>
50288 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
50289 the DNSSEC request bit set. Setting this transport option is only useful if the
50290 transport overrides or sets the host names. See the <option>dnssec_request_domains</option>
50291 router option.
50292 </para>
50293 <para>
50294 <indexterm role="option">
50295 <primary><option>dnssec_require_domains</option></primary>
50296 </indexterm>
50297 </para>
50298 <informaltable frame="all">
50299 <tgroup cols="4" colsep="0" rowsep="0">
50300 <colspec colwidth="8*" align="left"/>
50301 <colspec colwidth="6*" align="center"/>
50302 <colspec colwidth="6*" align="center"/>
50303 <colspec colwidth="6*" align="right"/>
50304 <tbody>
50305 <row>
50306 <entry><option>dnssec_require_domains</option></entry>
50307 <entry>Use: <emphasis>smtp</emphasis></entry>
50308 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
50309 <entry>Default: <emphasis>unset</emphasis></entry>
50310 </row>
50311 </tbody>
50312 </tgroup>
50313 </informaltable>
50314 <para>
50315 <indexterm role="concept">
50316 <primary>MX record</primary>
50317 <secondary>security</secondary>
50318 </indexterm>
50319 <indexterm role="concept">
50320 <primary>DNSSEC</primary>
50321 <secondary>MX lookup</secondary>
50322 </indexterm>
50323 <indexterm role="concept">
50324 <primary>security</primary>
50325 <secondary>MX lookup</secondary>
50326 </indexterm>
50327 <indexterm role="concept">
50328 <primary>DNS</primary>
50329 <secondary>DNSSEC</secondary>
50330 </indexterm>
50331 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
50332 the DNSSEC request bit set.  Setting this transport option is only
50333 useful if the transport overrides or sets the host names. See the
50334 <option>dnssec_require_domains</option> router option.
50335 </para>
50336 <para>
50337 <indexterm role="option">
50338 <primary><option>dscp</option></primary>
50339 </indexterm>
50340 </para>
50341 <informaltable frame="all">
50342 <tgroup cols="4" colsep="0" rowsep="0">
50343 <colspec colwidth="8*" align="left"/>
50344 <colspec colwidth="6*" align="center"/>
50345 <colspec colwidth="6*" align="center"/>
50346 <colspec colwidth="6*" align="right"/>
50347 <tbody>
50348 <row>
50349 <entry><option>dscp</option></entry>
50350 <entry>Use: <emphasis>smtp</emphasis></entry>
50351 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50352 <entry>Default: <emphasis>unset</emphasis></entry>
50353 </row>
50354 </tbody>
50355 </tgroup>
50356 </informaltable>
50357 <para>
50358 <indexterm role="concept">
50359 <primary>DCSP</primary>
50360 <secondary>outbound</secondary>
50361 </indexterm>
50362 This option causes the DSCP value associated with a socket to be set to one
50363 of a number of fixed strings or to numeric value.
50364 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
50365 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
50366 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
50367 </para>
50368 <para>
50369 The outbound packets from Exim will be marked with this value in the header
50370 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
50371 that these values will have any effect, not be stripped by networking
50372 equipment, or do much of anything without cooperation with your Network
50373 Engineer and those of all network operators between the source and destination.
50374 </para>
50375 <para>
50376 <indexterm role="option">
50377 <primary><option>fallback_hosts</option></primary>
50378 </indexterm>
50379 </para>
50380 <informaltable frame="all">
50381 <tgroup cols="4" colsep="0" rowsep="0">
50382 <colspec colwidth="8*" align="left"/>
50383 <colspec colwidth="6*" align="center"/>
50384 <colspec colwidth="6*" align="center"/>
50385 <colspec colwidth="6*" align="right"/>
50386 <tbody>
50387 <row>
50388 <entry><option>fallback_hosts</option></entry>
50389 <entry>Use: <emphasis>smtp</emphasis></entry>
50390 <entry>Type: <emphasis>string list</emphasis></entry>
50391 <entry>Default: <emphasis>unset</emphasis></entry>
50392 </row>
50393 </tbody>
50394 </tgroup>
50395 </informaltable>
50396 <para>
50397 <indexterm role="concept">
50398 <primary>fallback</primary>
50399 <secondary>hosts specified on transport</secondary>
50400 </indexterm>
50401 String expansion is not applied to this option. The argument must be a
50402 colon-separated list of host names or IP addresses, optionally also including
50403 port numbers, though the separator can be changed, as described in section
50404 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
50405 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
50406 in section <xref linkend="SECTformatonehostitem"/>.
50407 </para>
50408 <para>
50409 Fallback hosts can also be specified on routers, which associate them with the
50410 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
50411 <option>fallback_hosts</option> specified on the transport is used only if the address does
50412 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
50413 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
50414 However, <option>hosts_randomize</option> does apply to fallback host lists.
50415 </para>
50416 <para>
50417 If Exim is unable to deliver to any of the hosts for a particular address, and
50418 the errors are not permanent rejections, the address is put on a separate
50419 transport queue with its host list replaced by the fallback hosts, unless the
50420 address was routed via MX records and the current host was in the original MX
50421 list. In that situation, the fallback host list is not used.
50422 </para>
50423 <para>
50424 Once normal deliveries are complete, the fallback queue is delivered by
50425 re-running the same transports with the new host lists. If several failing
50426 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
50427 copy of the message is sent.
50428 </para>
50429 <para>
50430 The resolution of the host names on the fallback list is controlled by the
50431 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
50432 both to cases when the host list comes with the address and when it is taken
50433 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
50434 fails</quote> facility.
50435 </para>
50436 <para>
50437 <indexterm role="option">
50438 <primary><option>final_timeout</option></primary>
50439 </indexterm>
50440 </para>
50441 <informaltable frame="all">
50442 <tgroup cols="4" colsep="0" rowsep="0">
50443 <colspec colwidth="8*" align="left"/>
50444 <colspec colwidth="6*" align="center"/>
50445 <colspec colwidth="6*" align="center"/>
50446 <colspec colwidth="6*" align="right"/>
50447 <tbody>
50448 <row>
50449 <entry><option>final_timeout</option></entry>
50450 <entry>Use: <emphasis>smtp</emphasis></entry>
50451 <entry>Type: <emphasis>time</emphasis></entry>
50452 <entry>Default: <emphasis>10m</emphasis></entry>
50453 </row>
50454 </tbody>
50455 </tgroup>
50456 </informaltable>
50457 <para>
50458 <indexterm role="concept">
50459 <primary>timeout</primary>
50460 <secondary>for transmitted SMTP data accept</secondary>
50461 </indexterm>
50462 This is the timeout that applies while waiting for the response to the final
50463 line containing just <quote>.</quote> that terminates a message. Its value must not be
50464 zero.
50465 </para>
50466 <para>
50467 <indexterm role="option">
50468 <primary><option>gethostbyname</option></primary>
50469 </indexterm>
50470 </para>
50471 <informaltable frame="all">
50472 <tgroup cols="4" colsep="0" rowsep="0">
50473 <colspec colwidth="8*" align="left"/>
50474 <colspec colwidth="6*" align="center"/>
50475 <colspec colwidth="6*" align="center"/>
50476 <colspec colwidth="6*" align="right"/>
50477 <tbody>
50478 <row>
50479 <entry><option>gethostbyname</option></entry>
50480 <entry>Use: <emphasis>smtp</emphasis></entry>
50481 <entry>Type: <emphasis>boolean</emphasis></entry>
50482 <entry>Default: <emphasis>false</emphasis></entry>
50483 </row>
50484 </tbody>
50485 </tgroup>
50486 </informaltable>
50487 <para>
50488 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
50489 being used, names are looked up using <function>gethostbyname()</function>
50490 (or <function>getipnodebyname()</function> when available)
50491 instead of using the DNS. Of course, that function may in fact use the DNS, but
50492 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
50493 </para>
50494 <para>
50495 <indexterm role="option">
50496 <primary><option>gnutls_compat_mode</option></primary>
50497 </indexterm>
50498 </para>
50499 <informaltable frame="all">
50500 <tgroup cols="4" colsep="0" rowsep="0">
50501 <colspec colwidth="8*" align="left"/>
50502 <colspec colwidth="6*" align="center"/>
50503 <colspec colwidth="6*" align="center"/>
50504 <colspec colwidth="6*" align="right"/>
50505 <tbody>
50506 <row>
50507 <entry><option>gnutls_compat_mode</option></entry>
50508 <entry>Use: <emphasis>smtp</emphasis></entry>
50509 <entry>Type: <emphasis>boolean</emphasis></entry>
50510 <entry>Default: <emphasis>unset</emphasis></entry>
50511 </row>
50512 </tbody>
50513 </tgroup>
50514 </informaltable>
50515 <para>
50516 This option controls whether GnuTLS is used in compatibility mode in an Exim
50517 server. This reduces security slightly, but improves interworking with older
50518 implementations of TLS.
50519 </para>
50520 <para>
50521 <indexterm role="option">
50522 <primary><option>helo_data</option></primary>
50523 </indexterm>
50524 </para>
50525 <informaltable frame="all">
50526 <tgroup cols="4" colsep="0" rowsep="0">
50527 <colspec colwidth="8*" align="left"/>
50528 <colspec colwidth="6*" align="center"/>
50529 <colspec colwidth="6*" align="center"/>
50530 <colspec colwidth="6*" align="right"/>
50531 <tbody>
50532 <row>
50533 <entry><option>helo_data</option></entry>
50534 <entry>Use: <emphasis>smtp</emphasis></entry>
50535 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50536 <entry>Default: <emphasis>see below</emphasis></entry>
50537 </row>
50538 </tbody>
50539 </tgroup>
50540 </informaltable>
50541 <para>
50542 <indexterm role="concept">
50543 <primary>HELO</primary>
50544 <secondary>argument, setting</secondary>
50545 </indexterm>
50546 <indexterm role="concept">
50547 <primary>EHLO</primary>
50548 <secondary>argument, setting</secondary>
50549 </indexterm>
50550 <indexterm role="concept">
50551 <primary>LHLO argument setting</primary>
50552 </indexterm>
50553 The value of this option is expanded after a connection to a another host has
50554 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
50555 command that starts the outgoing SMTP or LMTP session. The default value of the
50556 option is:
50557 </para>
50558 <literallayout class="monospaced">
50559 $primary_hostname
50560 </literallayout>
50561 <para>
50562 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
50563 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
50564 <varname>$sending_port</varname> are set to the local IP address and port number that are being
50565 used. These variables can be used to generate different values for different
50566 servers or different local IP addresses. For example, if you want the string
50567 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
50568 interface address, you could use this:
50569 </para>
50570 <literallayout class="monospaced">
50571 helo_data = ${lookup dnsdb{ptr=$sending_ip_address} \
50572   {${listextract{1}{&lt;\n $value}}} \
50573   {$primary_hostname}}
50574 </literallayout>
50575 <para>
50576 The use of <option>helo_data</option> applies both to sending messages and when doing
50577 callouts.
50578 </para>
50579 <para>
50580 <indexterm role="option">
50581 <primary><option>host_name_extract</option></primary>
50582 </indexterm>
50583 </para>
50584 <informaltable frame="all">
50585 <tgroup cols="4" colsep="0" rowsep="0">
50586 <colspec colwidth="8*" align="left"/>
50587 <colspec colwidth="6*" align="center"/>
50588 <colspec colwidth="6*" align="center"/>
50589 <colspec colwidth="6*" align="right"/>
50590 <tbody>
50591 <row>
50592 <entry><option>host_name_extract</option></entry>
50593 <entry>Use: <emphasis>smtp</emphasis></entry>
50594 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
50595 <entry>Default: <emphasis>see below</emphasis></entry>
50596 </row>
50597 </tbody>
50598 </tgroup>
50599 </informaltable>
50600 <para>
50601 <indexterm role="concept">
50602 <primary>load balancer</primary>
50603 <secondary>hosts behind</secondary>
50604 </indexterm>
50605 <indexterm role="concept">
50606 <primary>TLS</primary>
50607 <secondary>resumption</secondary>
50608 </indexterm>
50609 Some mail-accepting sites
50610 (notably Microsoft)
50611 operate many servers behind a network load-balancer.  When this is done,
50612 with separated TLS session caches, TLS session resuption becomes problematic.
50613 It will only succeed when the same server happens to be selected by the
50614 load-balancer, matching the session stored in the client&#x2019;s cache.
50615 </para>
50616 <para>
50617 Exim can pull out a server name, if there is one, from the response to the
50618 client&#x2019;s SMTP EHLO command.
50619 The default value of this option:
50620 </para>
50621 <literallayout class="monospaced">
50622     ${if and { {match {$host} {.outlook.com\$}} \
50623                {match {$item} {\N^250-([\w.]+)\s\N}} \
50624              } {$1}}
50625 </literallayout>
50626 <para>
50627 suffices for one known case.
50628 During the expansion of this option the <varname>$item</varname> variable will have the
50629 server&#x2019;s EHLO response.
50630 The result of the option expansion is included in the key used to store and
50631 retrieve the TLS session, for session resumption.
50632 </para>
50633 <para>
50634 Operators of high-load sites may wish to evaluate their logs for indications
50635 of other destination sites operating load-balancers, and develop a suitable
50636 expression for this option.
50637 The smtp:ehlo event and the <varname>$tls_out_resumption</varname> variable
50638 will be useful for such work.
50639 </para>
50640 <para>
50641 <indexterm role="option">
50642 <primary><option>hosts</option></primary>
50643 </indexterm>
50644 </para>
50645 <informaltable frame="all">
50646 <tgroup cols="4" colsep="0" rowsep="0">
50647 <colspec colwidth="8*" align="left"/>
50648 <colspec colwidth="6*" align="center"/>
50649 <colspec colwidth="6*" align="center"/>
50650 <colspec colwidth="6*" align="right"/>
50651 <tbody>
50652 <row>
50653 <entry><option>hosts</option></entry>
50654 <entry>Use: <emphasis>smtp</emphasis></entry>
50655 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
50656 <entry>Default: <emphasis>unset</emphasis></entry>
50657 </row>
50658 </tbody>
50659 </tgroup>
50660 </informaltable>
50661 <para>
50662 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
50663 finds the hosts by looking up the address domain in the DNS, or by
50664 <command>manualroute</command>, which has lists of hosts in its configuration. However,
50665 email addresses can be passed to the <command>smtp</command> transport by any router, and not
50666 all of them can provide an associated list of hosts.
50667 </para>
50668 <para>
50669 The <option>hosts</option> option specifies a list of hosts to be used if the address being
50670 processed does not have any hosts associated with it. The hosts specified by
50671 <option>hosts</option> are also used, whether or not the address has its own hosts, if
50672 <option>hosts_override</option> is set.
50673 </para>
50674 <para>
50675 The string is first expanded, before being interpreted as a colon-separated
50676 list of host names or IP addresses, possibly including port numbers. The
50677 separator may be changed to something other than colon, as described in section
50678 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
50679 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
50680 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
50681 of the <command>manualroute</command> router is not available here.
50682 </para>
50683 <para>
50684 If the expansion fails, delivery is deferred. Unless the failure was caused by
50685 the inability to complete a lookup, the error is logged to the panic log as
50686 well as the main log. Host names are looked up either by searching directly for
50687 address records in the DNS or by calling <function>gethostbyname()</function> (or
50688 <function>getipnodebyname()</function> when available), depending on the setting of the
50689 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
50690 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
50691 address are used.
50692 </para>
50693 <para>
50694 During delivery, the hosts are tried in order, subject to their retry status,
50695 unless <option>hosts_randomize</option> is set.
50696 </para>
50697 <para>
50698 <indexterm role="option">
50699 <primary><option>hosts_avoid_esmtp</option></primary>
50700 </indexterm>
50701 </para>
50702 <informaltable frame="all">
50703 <tgroup cols="4" colsep="0" rowsep="0">
50704 <colspec colwidth="8*" align="left"/>
50705 <colspec colwidth="6*" align="center"/>
50706 <colspec colwidth="6*" align="center"/>
50707 <colspec colwidth="6*" align="right"/>
50708 <tbody>
50709 <row>
50710 <entry><option>hosts_avoid_esmtp</option></entry>
50711 <entry>Use: <emphasis>smtp</emphasis></entry>
50712 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50713 <entry>Default: <emphasis>unset</emphasis></entry>
50714 </row>
50715 </tbody>
50716 </tgroup>
50717 </informaltable>
50718 <para>
50719 <indexterm role="concept">
50720 <primary>ESMTP, avoiding use of</primary>
50721 </indexterm>
50722 <indexterm role="concept">
50723 <primary>HELO</primary>
50724 <secondary>forcing use of</secondary>
50725 </indexterm>
50726 <indexterm role="concept">
50727 <primary>EHLO</primary>
50728 <secondary>avoiding use of</secondary>
50729 </indexterm>
50730 <indexterm role="concept">
50731 <primary>PIPELINING</primary>
50732 <secondary>avoiding the use of</secondary>
50733 </indexterm>
50734 This option is for use with broken hosts that announce ESMTP facilities (for
50735 example, PIPELINING) and then fail to implement them properly. When a host
50736 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
50737 start of the SMTP session. This means that it cannot use any of the ESMTP
50738 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
50739 </para>
50740 <para>
50741 <indexterm role="option">
50742 <primary><option>hosts_avoid_pipelining</option></primary>
50743 </indexterm>
50744 </para>
50745 <informaltable frame="all">
50746 <tgroup cols="4" colsep="0" rowsep="0">
50747 <colspec colwidth="8*" align="left"/>
50748 <colspec colwidth="6*" align="center"/>
50749 <colspec colwidth="6*" align="center"/>
50750 <colspec colwidth="6*" align="right"/>
50751 <tbody>
50752 <row>
50753 <entry><option>hosts_avoid_pipelining</option></entry>
50754 <entry>Use: <emphasis>smtp</emphasis></entry>
50755 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50756 <entry>Default: <emphasis>unset</emphasis></entry>
50757 </row>
50758 </tbody>
50759 </tgroup>
50760 </informaltable>
50761 <para>
50762 <indexterm role="concept">
50763 <primary>PIPELINING</primary>
50764 <secondary>avoiding the use of</secondary>
50765 </indexterm>
50766 <indexterm role="concept">
50767 <primary>ESMTP extensions</primary>
50768 <secondary>PIPELINING</secondary>
50769 </indexterm>
50770 Exim will not use the ESMTP PIPELINING extension when delivering to any host
50771 that matches this list, even if the server host advertises PIPELINING support.
50772 </para>
50773 <para>
50774 <indexterm role="option">
50775 <primary><option>hosts_pipe_connect</option></primary>
50776 </indexterm>
50777 </para>
50778 <informaltable frame="all">
50779 <tgroup cols="4" colsep="0" rowsep="0">
50780 <colspec colwidth="8*" align="left"/>
50781 <colspec colwidth="6*" align="center"/>
50782 <colspec colwidth="6*" align="center"/>
50783 <colspec colwidth="6*" align="right"/>
50784 <tbody>
50785 <row>
50786 <entry><option>hosts_pipe_connect</option></entry>
50787 <entry>Use: <emphasis>smtp</emphasis></entry>
50788 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50789 <entry>Default: <emphasis>unset</emphasis></entry>
50790 </row>
50791 </tbody>
50792 </tgroup>
50793 </informaltable>
50794 <para>
50795 <indexterm role="concept">
50796 <primary>pipelining</primary>
50797 <secondary>early connection</secondary>
50798 </indexterm>
50799 <indexterm role="concept">
50800 <primary>pipelining</primary>
50801 <secondary>PIPECONNECT</secondary>
50802 </indexterm>
50803 If Exim is built with the SUPPORT_PIPE_CONNECT build option
50804 this option controls which to hosts the facility watched for
50805 and recorded, and used for subsequent connections.
50806 </para>
50807 <para>
50808 The retry hints database is used for the record,
50809 and records are subject to the <option>retry_data_expire</option> option.
50810 When used, the pipelining saves on roundtrip times.
50811 It also turns SMTP into a client-first protocol
50812 so combines well with TCP Fast Open.
50813 </para>
50814 <para>
50815 See also the <option>pipelining_connect_advertise_hosts</option> main option.
50816 </para>
50817 <para>
50818 Note:
50819 When the facility is used, if the transport <option>interface</option> option is unset
50820 the <option>helo_data</option> option
50821 will be expanded before the <varname>$sending_ip_address</varname> variable
50822 is filled in.
50823 A check is made for the use of that variable, without the
50824 presence of a <quote>def:</quote> test on it, but suitably complex coding
50825 can avoid the check and produce unexpected results.
50826 You have been warned.
50827 </para>
50828 <para>
50829 <indexterm role="option">
50830 <primary><option>hosts_avoid_tls</option></primary>
50831 </indexterm>
50832 </para>
50833 <informaltable frame="all">
50834 <tgroup cols="4" colsep="0" rowsep="0">
50835 <colspec colwidth="8*" align="left"/>
50836 <colspec colwidth="6*" align="center"/>
50837 <colspec colwidth="6*" align="center"/>
50838 <colspec colwidth="6*" align="right"/>
50839 <tbody>
50840 <row>
50841 <entry><option>hosts_avoid_tls</option></entry>
50842 <entry>Use: <emphasis>smtp</emphasis></entry>
50843 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50844 <entry>Default: <emphasis>unset</emphasis></entry>
50845 </row>
50846 </tbody>
50847 </tgroup>
50848 </informaltable>
50849 <para>
50850 <indexterm role="concept">
50851 <primary>TLS</primary>
50852 <secondary>avoiding for certain hosts</secondary>
50853 </indexterm>
50854 Exim will not try to start a TLS session when delivering to any host that
50855 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
50856 </para>
50857 <para>
50858 <indexterm role="option">
50859 <primary><option>hosts_verify_avoid_tls</option></primary>
50860 </indexterm>
50861 </para>
50862 <informaltable frame="all">
50863 <tgroup cols="4" colsep="0" rowsep="0">
50864 <colspec colwidth="8*" align="left"/>
50865 <colspec colwidth="6*" align="center"/>
50866 <colspec colwidth="6*" align="center"/>
50867 <colspec colwidth="6*" align="right"/>
50868 <tbody>
50869 <row>
50870 <entry><option>hosts_verify_avoid_tls</option></entry>
50871 <entry>Use: <emphasis>smtp</emphasis></entry>
50872 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50873 <entry>Default: <emphasis>unset</emphasis></entry>
50874 </row>
50875 </tbody>
50876 </tgroup>
50877 </informaltable>
50878 <para>
50879 <indexterm role="concept">
50880 <primary>TLS</primary>
50881 <secondary>avoiding for certain hosts</secondary>
50882 </indexterm>
50883 Exim will not try to start a TLS session for a verify callout,
50884 or when delivering in cutthrough mode,
50885 to any host that matches this list.
50886 </para>
50887 <para>
50888 <indexterm role="option">
50889 <primary><option>hosts_max_try</option></primary>
50890 </indexterm>
50891 </para>
50892 <informaltable frame="all">
50893 <tgroup cols="4" colsep="0" rowsep="0">
50894 <colspec colwidth="8*" align="left"/>
50895 <colspec colwidth="6*" align="center"/>
50896 <colspec colwidth="6*" align="center"/>
50897 <colspec colwidth="6*" align="right"/>
50898 <tbody>
50899 <row>
50900 <entry><option>hosts_max_try</option></entry>
50901 <entry>Use: <emphasis>smtp</emphasis></entry>
50902 <entry>Type: <emphasis>integer</emphasis></entry>
50903 <entry>Default: <emphasis>5</emphasis></entry>
50904 </row>
50905 </tbody>
50906 </tgroup>
50907 </informaltable>
50908 <para>
50909 <indexterm role="concept">
50910 <primary>host</primary>
50911 <secondary>maximum number to try</secondary>
50912 </indexterm>
50913 <indexterm role="concept">
50914 <primary>limit</primary>
50915 <secondary>number of hosts tried</secondary>
50916 </indexterm>
50917 <indexterm role="concept">
50918 <primary>limit</primary>
50919 <secondary>number of MX tried</secondary>
50920 </indexterm>
50921 <indexterm role="concept">
50922 <primary>MX record</primary>
50923 <secondary>maximum tried</secondary>
50924 </indexterm>
50925 This option limits the number of IP addresses that are tried for any one
50926 delivery in cases where there are temporary delivery errors. Section
50927 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
50928 </para>
50929 <para>
50930 <indexterm role="option">
50931 <primary><option>hosts_max_try_hardlimit</option></primary>
50932 </indexterm>
50933 </para>
50934 <informaltable frame="all">
50935 <tgroup cols="4" colsep="0" rowsep="0">
50936 <colspec colwidth="8*" align="left"/>
50937 <colspec colwidth="6*" align="center"/>
50938 <colspec colwidth="6*" align="center"/>
50939 <colspec colwidth="6*" align="right"/>
50940 <tbody>
50941 <row>
50942 <entry><option>hosts_max_try_hardlimit</option></entry>
50943 <entry>Use: <emphasis>smtp</emphasis></entry>
50944 <entry>Type: <emphasis>integer</emphasis></entry>
50945 <entry>Default: <emphasis>50</emphasis></entry>
50946 </row>
50947 </tbody>
50948 </tgroup>
50949 </informaltable>
50950 <para>
50951 This is an additional check on the maximum number of IP addresses that Exim
50952 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
50953 why it exists.
50954 </para>
50955 <para>
50956 <indexterm role="option">
50957 <primary><option>hosts_nopass_tls</option></primary>
50958 </indexterm>
50959 </para>
50960 <informaltable frame="all">
50961 <tgroup cols="4" colsep="0" rowsep="0">
50962 <colspec colwidth="8*" align="left"/>
50963 <colspec colwidth="6*" align="center"/>
50964 <colspec colwidth="6*" align="center"/>
50965 <colspec colwidth="6*" align="right"/>
50966 <tbody>
50967 <row>
50968 <entry><option>hosts_nopass_tls</option></entry>
50969 <entry>Use: <emphasis>smtp</emphasis></entry>
50970 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50971 <entry>Default: <emphasis>unset</emphasis></entry>
50972 </row>
50973 </tbody>
50974 </tgroup>
50975 </informaltable>
50976 <para>
50977 <indexterm role="concept">
50978 <primary>TLS</primary>
50979 <secondary>passing connection</secondary>
50980 </indexterm>
50981 <indexterm role="concept">
50982 <primary>multiple SMTP deliveries</primary>
50983 </indexterm>
50984 <indexterm role="concept">
50985 <primary>TLS</primary>
50986 <secondary>multiple message deliveries</secondary>
50987 </indexterm>
50988 For any host that matches this list, a connection on which a TLS session has
50989 been started will not be passed to a new delivery process for sending another
50990 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
50991 explanation of when this might be needed.
50992 </para>
50993 <para>
50994 <indexterm role="option">
50995 <primary><option>hosts_noproxy_tls</option></primary>
50996 </indexterm>
50997 </para>
50998 <informaltable frame="all">
50999 <tgroup cols="4" colsep="0" rowsep="0">
51000 <colspec colwidth="8*" align="left"/>
51001 <colspec colwidth="6*" align="center"/>
51002 <colspec colwidth="6*" align="center"/>
51003 <colspec colwidth="6*" align="right"/>
51004 <tbody>
51005 <row>
51006 <entry><option>hosts_noproxy_tls</option></entry>
51007 <entry>Use: <emphasis>smtp</emphasis></entry>
51008 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51009 <entry>Default: <emphasis>unset</emphasis></entry>
51010 </row>
51011 </tbody>
51012 </tgroup>
51013 </informaltable>
51014 <para>
51015 <indexterm role="concept">
51016 <primary>TLS</primary>
51017 <secondary>passing connection</secondary>
51018 </indexterm>
51019 <indexterm role="concept">
51020 <primary>multiple SMTP deliveries</primary>
51021 </indexterm>
51022 <indexterm role="concept">
51023 <primary>TLS</primary>
51024 <secondary>multiple message deliveries</secondary>
51025 </indexterm>
51026 For any host that matches this list, a TLS session which has
51027 been started will not be passed to a new delivery process for sending another
51028 message on the same session.
51029 </para>
51030 <para>
51031 The traditional implementation closes down TLS and re-starts it in the new
51032 process, on the same open TCP connection, for each successive message
51033 sent.  If permitted by this option a pipe to to the new process is set up
51034 instead, and the original process maintains the TLS connection and proxies
51035 the SMTP connection from and to the new process and any subsequents.
51036 The new process has no access to TLS information, so cannot include it in
51037 logging.
51038 </para>
51039 <para>
51040 <indexterm role="option">
51041 <primary><option>hosts_override</option></primary>
51042 </indexterm>
51043 </para>
51044 <informaltable frame="all">
51045 <tgroup cols="4" colsep="0" rowsep="0">
51046 <colspec colwidth="8*" align="left"/>
51047 <colspec colwidth="6*" align="center"/>
51048 <colspec colwidth="6*" align="center"/>
51049 <colspec colwidth="6*" align="right"/>
51050 <tbody>
51051 <row>
51052 <entry><option>hosts_override</option></entry>
51053 <entry>Use: <emphasis>smtp</emphasis></entry>
51054 <entry>Type: <emphasis>boolean</emphasis></entry>
51055 <entry>Default: <emphasis>false</emphasis></entry>
51056 </row>
51057 </tbody>
51058 </tgroup>
51059 </informaltable>
51060 <para>
51061 If this option is set and the <option>hosts</option> option is also set, any hosts that are
51062 attached to the address are ignored, and instead the hosts specified by the
51063 <option>hosts</option> option are always used. This option does not apply to
51064 <option>fallback_hosts</option>.
51065 </para>
51066 <para>
51067 <indexterm role="option">
51068 <primary><option>hosts_randomize</option></primary>
51069 </indexterm>
51070 </para>
51071 <informaltable frame="all">
51072 <tgroup cols="4" colsep="0" rowsep="0">
51073 <colspec colwidth="8*" align="left"/>
51074 <colspec colwidth="6*" align="center"/>
51075 <colspec colwidth="6*" align="center"/>
51076 <colspec colwidth="6*" align="right"/>
51077 <tbody>
51078 <row>
51079 <entry><option>hosts_randomize</option></entry>
51080 <entry>Use: <emphasis>smtp</emphasis></entry>
51081 <entry>Type: <emphasis>boolean</emphasis></entry>
51082 <entry>Default: <emphasis>false</emphasis></entry>
51083 </row>
51084 </tbody>
51085 </tgroup>
51086 </informaltable>
51087 <para>
51088 <indexterm role="concept">
51089 <primary>randomized host list</primary>
51090 </indexterm>
51091 <indexterm role="concept">
51092 <primary>host</primary>
51093 <secondary>list of; randomized</secondary>
51094 </indexterm>
51095 <indexterm role="concept">
51096 <primary>fallback</primary>
51097 <secondary>randomized hosts</secondary>
51098 </indexterm>
51099 If this option is set, and either the list of hosts is taken from the
51100 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
51101 were not obtained from MX records (this includes fallback hosts from the
51102 router), and were not randomized by the router, the order of trying the hosts
51103 is randomized each time the transport runs. Randomizing the order of a host
51104 list can be used to do crude load sharing.
51105 </para>
51106 <para>
51107 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
51108 order is separately randomized. This makes it possible to set up MX-like
51109 behaviour. The boundaries between groups are indicated by an item that is just
51110 <literal>+</literal> in the host list. For example:
51111 </para>
51112 <literallayout class="monospaced">
51113 hosts = host1:host2:host3:+:host4:host5
51114 </literallayout>
51115 <para>
51116 The order of the first three hosts and the order of the last two hosts is
51117 randomized for each use, but the first three always end up before the last two.
51118 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
51119 </para>
51120 <para>
51121 <indexterm role="option">
51122 <primary><option>hosts_require_auth</option></primary>
51123 </indexterm>
51124 </para>
51125 <informaltable frame="all">
51126 <tgroup cols="4" colsep="0" rowsep="0">
51127 <colspec colwidth="8*" align="left"/>
51128 <colspec colwidth="6*" align="center"/>
51129 <colspec colwidth="6*" align="center"/>
51130 <colspec colwidth="6*" align="right"/>
51131 <tbody>
51132 <row>
51133 <entry><option>hosts_require_auth</option></entry>
51134 <entry>Use: <emphasis>smtp</emphasis></entry>
51135 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51136 <entry>Default: <emphasis>unset</emphasis></entry>
51137 </row>
51138 </tbody>
51139 </tgroup>
51140 </informaltable>
51141 <para>
51142 <indexterm role="concept">
51143 <primary>authentication</primary>
51144 <secondary>required by client</secondary>
51145 </indexterm>
51146 This option provides a list of servers for which authentication must succeed
51147 before Exim will try to transfer a message. If authentication fails for
51148 servers which are not in this list, Exim tries to send unauthenticated. If
51149 authentication fails for one of these servers, delivery is deferred. This
51150 temporary error is detectable in the retry rules, so it can be turned into a
51151 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
51152 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
51153 </para>
51154 <para>
51155 <indexterm role="option">
51156 <primary><option>hosts_request_ocsp</option></primary>
51157 </indexterm>
51158 </para>
51159 <informaltable frame="all">
51160 <tgroup cols="4" colsep="0" rowsep="0">
51161 <colspec colwidth="8*" align="left"/>
51162 <colspec colwidth="6*" align="center"/>
51163 <colspec colwidth="6*" align="center"/>
51164 <colspec colwidth="6*" align="right"/>
51165 <tbody>
51166 <row>
51167 <entry><option>hosts_request_ocsp</option></entry>
51168 <entry>Use: <emphasis>smtp</emphasis></entry>
51169 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51170 <entry>Default: <emphasis>see below</emphasis></entry>
51171 </row>
51172 </tbody>
51173 </tgroup>
51174 </informaltable>
51175 <para>
51176 <indexterm role="concept">
51177 <primary>TLS</primary>
51178 <secondary>requiring for certain servers</secondary>
51179 </indexterm>
51180 Exim will request a Certificate Status on a
51181 TLS session for any host that matches this list.
51182 <option>tls_verify_certificates</option> should also be set for the transport.
51183 </para>
51184 <para revisionflag="changed">
51185 The default is <quote>**</quote> if DANE is not in use for the connection,
51186 or if DANE-TA us used.
51187 It is empty if DANE-EE is used.
51188 </para>
51189 <para>
51190 <indexterm role="option">
51191 <primary><option>hosts_require_alpn</option></primary>
51192 </indexterm>
51193 </para>
51194 <informaltable frame="all">
51195 <tgroup cols="4" colsep="0" rowsep="0">
51196 <colspec colwidth="8*" align="left"/>
51197 <colspec colwidth="6*" align="center"/>
51198 <colspec colwidth="6*" align="center"/>
51199 <colspec colwidth="6*" align="right"/>
51200 <tbody>
51201 <row>
51202 <entry><option>hosts_require_alpn</option></entry>
51203 <entry>Use: <emphasis>smtp</emphasis></entry>
51204 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51205 <entry>Default: <emphasis>unset</emphasis></entry>
51206 </row>
51207 </tbody>
51208 </tgroup>
51209 </informaltable>
51210 <para>
51211 <indexterm role="concept">
51212 <primary>ALPN</primary>
51213 <secondary>require negotiation in client</secondary>
51214 </indexterm>
51215 <indexterm role="concept">
51216 <primary>TLS</primary>
51217 <secondary>ALPN</secondary>
51218 </indexterm>
51219 <indexterm role="concept">
51220 <primary>TLS</primary>
51221 <secondary>Application Layer Protocol Names</secondary>
51222 </indexterm>
51223 If the TLS library supports ALPN
51224 then a successful negotiation of ALPN will be required for any host
51225 matching the list, for TLS to be used.
51226 See also the <option>tls_alpn</option> option.
51227 </para>
51228 <para>
51229 <emphasis role="bold">Note</emphasis>: prevention of fallback to in-clear connection is not
51230 managed by this option; see <option>hosts_require_tls</option>.
51231 </para>
51232 <para>
51233 <indexterm role="option">
51234 <primary><option>hosts_require_dane</option></primary>
51235 </indexterm>
51236 </para>
51237 <informaltable frame="all">
51238 <tgroup cols="4" colsep="0" rowsep="0">
51239 <colspec colwidth="8*" align="left"/>
51240 <colspec colwidth="6*" align="center"/>
51241 <colspec colwidth="6*" align="center"/>
51242 <colspec colwidth="6*" align="right"/>
51243 <tbody>
51244 <row>
51245 <entry><option>hosts_require_dane</option></entry>
51246 <entry>Use: <emphasis>smtp</emphasis></entry>
51247 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51248 <entry>Default: <emphasis>unset</emphasis></entry>
51249 </row>
51250 </tbody>
51251 </tgroup>
51252 </informaltable>
51253 <para>
51254 <indexterm role="concept">
51255 <primary>DANE</primary>
51256 <secondary>transport options</secondary>
51257 </indexterm>
51258 <indexterm role="concept">
51259 <primary>DANE</primary>
51260 <secondary>requiring for certain servers</secondary>
51261 </indexterm>
51262 If built with DANE support, Exim  will require that a DNSSEC-validated
51263 TLSA record is present for any host matching the list,
51264 and that a DANE-verified TLS connection is made.
51265 There will be no fallback to in-clear communication.
51266 See the <option>dnssec_request_domains</option> router and transport options.
51267 See section <xref linkend="SECDANE"/>.
51268 </para>
51269 <para>
51270 <indexterm role="option">
51271 <primary><option>hosts_require_ocsp</option></primary>
51272 </indexterm>
51273 </para>
51274 <informaltable frame="all">
51275 <tgroup cols="4" colsep="0" rowsep="0">
51276 <colspec colwidth="8*" align="left"/>
51277 <colspec colwidth="6*" align="center"/>
51278 <colspec colwidth="6*" align="center"/>
51279 <colspec colwidth="6*" align="right"/>
51280 <tbody>
51281 <row>
51282 <entry><option>hosts_require_ocsp</option></entry>
51283 <entry>Use: <emphasis>smtp</emphasis></entry>
51284 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51285 <entry>Default: <emphasis>unset</emphasis></entry>
51286 </row>
51287 </tbody>
51288 </tgroup>
51289 </informaltable>
51290 <para>
51291 <indexterm role="concept">
51292 <primary>TLS</primary>
51293 <secondary>requiring for certain servers</secondary>
51294 </indexterm>
51295 Exim will request, and check for a valid Certificate Status being given, on a
51296 TLS session for any host that matches this list.
51297 <option>tls_verify_certificates</option> should also be set for the transport.
51298 </para>
51299 <para>
51300 <indexterm role="option">
51301 <primary><option>hosts_require_tls</option></primary>
51302 </indexterm>
51303 </para>
51304 <informaltable frame="all">
51305 <tgroup cols="4" colsep="0" rowsep="0">
51306 <colspec colwidth="8*" align="left"/>
51307 <colspec colwidth="6*" align="center"/>
51308 <colspec colwidth="6*" align="center"/>
51309 <colspec colwidth="6*" align="right"/>
51310 <tbody>
51311 <row>
51312 <entry><option>hosts_require_tls</option></entry>
51313 <entry>Use: <emphasis>smtp</emphasis></entry>
51314 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51315 <entry>Default: <emphasis>unset</emphasis></entry>
51316 </row>
51317 </tbody>
51318 </tgroup>
51319 </informaltable>
51320 <para>
51321 <indexterm role="concept">
51322 <primary>TLS</primary>
51323 <secondary>requiring for certain servers</secondary>
51324 </indexterm>
51325 Exim will insist on using a TLS session when delivering to any host that
51326 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
51327 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
51328 incoming messages, use an appropriate ACL.
51329 </para>
51330 <para>
51331 <indexterm role="option">
51332 <primary><option>hosts_try_auth</option></primary>
51333 </indexterm>
51334 </para>
51335 <informaltable frame="all">
51336 <tgroup cols="4" colsep="0" rowsep="0">
51337 <colspec colwidth="8*" align="left"/>
51338 <colspec colwidth="6*" align="center"/>
51339 <colspec colwidth="6*" align="center"/>
51340 <colspec colwidth="6*" align="right"/>
51341 <tbody>
51342 <row>
51343 <entry><option>hosts_try_auth</option></entry>
51344 <entry>Use: <emphasis>smtp</emphasis></entry>
51345 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51346 <entry>Default: <emphasis>unset</emphasis></entry>
51347 </row>
51348 </tbody>
51349 </tgroup>
51350 </informaltable>
51351 <para>
51352 <indexterm role="concept">
51353 <primary>authentication</primary>
51354 <secondary>optional in client</secondary>
51355 </indexterm>
51356 This option provides a list of servers to which, provided they announce
51357 authentication support, Exim will attempt to authenticate as a client when it
51358 connects. If authentication fails
51359 and <option>hosts_require_auth</option> permits,
51360 Exim will try to transfer the message unauthenticated.
51361 See also chapter <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
51362 </para>
51363 <para>
51364 <indexterm role="option">
51365 <primary><option>hosts_try_chunking</option></primary>
51366 </indexterm>
51367 </para>
51368 <informaltable frame="all">
51369 <tgroup cols="4" colsep="0" rowsep="0">
51370 <colspec colwidth="8*" align="left"/>
51371 <colspec colwidth="6*" align="center"/>
51372 <colspec colwidth="6*" align="center"/>
51373 <colspec colwidth="6*" align="right"/>
51374 <tbody>
51375 <row>
51376 <entry><option>hosts_try_chunking</option></entry>
51377 <entry>Use: <emphasis>smtp</emphasis></entry>
51378 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51379 <entry>Default: <emphasis>*</emphasis></entry>
51380 </row>
51381 </tbody>
51382 </tgroup>
51383 </informaltable>
51384 <para>
51385 <indexterm role="concept">
51386 <primary>CHUNKING</primary>
51387 <secondary>enabling, in client</secondary>
51388 </indexterm>
51389 <indexterm role="concept">
51390 <primary>BDAT</primary>
51391 <secondary>SMTP command</secondary>
51392 </indexterm>
51393 <indexterm role="concept">
51394 <primary>RFC 3030</primary>
51395 <secondary>CHUNKING</secondary>
51396 </indexterm>
51397 This option provides a list of servers to which, provided they announce
51398 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
51399 Unless DKIM signing is being done,
51400 BDAT will not be used in conjunction with a transport filter.
51401 </para>
51402 <para>
51403 <indexterm role="option">
51404 <primary><option>hosts_try_dane</option></primary>
51405 </indexterm>
51406 </para>
51407 <informaltable frame="all">
51408 <tgroup cols="4" colsep="0" rowsep="0">
51409 <colspec colwidth="8*" align="left"/>
51410 <colspec colwidth="6*" align="center"/>
51411 <colspec colwidth="6*" align="center"/>
51412 <colspec colwidth="6*" align="right"/>
51413 <tbody>
51414 <row>
51415 <entry><option>hosts_try_dane</option></entry>
51416 <entry>Use: <emphasis>smtp</emphasis></entry>
51417 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51418 <entry>Default: <emphasis>*</emphasis></entry>
51419 </row>
51420 </tbody>
51421 </tgroup>
51422 </informaltable>
51423 <para>
51424 <indexterm role="concept">
51425 <primary>DANE</primary>
51426 <secondary>transport options</secondary>
51427 </indexterm>
51428 <indexterm role="concept">
51429 <primary>DANE</primary>
51430 <secondary>attempting for certain servers</secondary>
51431 </indexterm>
51432 If built with DANE support, Exim  will look up a
51433 TLSA record for any host matching the list,
51434 If one is found and that lookup was DNSSEC-validated,
51435 then Exim requires that a DANE-verified TLS connection is made for that host;
51436 there will be no fallback to in-clear communication.
51437 See the <option>dnssec_request_domains</option> router and transport options.
51438 See section <xref linkend="SECDANE"/>.
51439 </para>
51440 <para>
51441 <indexterm role="option">
51442 <primary><option>hosts_try_fastopen</option></primary>
51443 </indexterm>
51444 </para>
51445 <informaltable frame="all">
51446 <tgroup cols="4" colsep="0" rowsep="0">
51447 <colspec colwidth="8*" align="left"/>
51448 <colspec colwidth="6*" align="center"/>
51449 <colspec colwidth="6*" align="center"/>
51450 <colspec colwidth="6*" align="right"/>
51451 <tbody>
51452 <row>
51453 <entry><option>hosts_try_fastopen</option></entry>
51454 <entry>Use: <emphasis>smtp</emphasis></entry>
51455 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51456 <entry>Default: <emphasis>*</emphasis></entry>
51457 </row>
51458 </tbody>
51459 </tgroup>
51460 </informaltable>
51461 <para>
51462 <indexterm role="concept">
51463 <primary>fast open, TCP</primary>
51464 <secondary>enabling, in client</secondary>
51465 </indexterm>
51466 <indexterm role="concept">
51467 <primary>TCP Fast Open</primary>
51468 <secondary>enabling, in client</secondary>
51469 </indexterm>
51470 <indexterm role="concept">
51471 <primary>RFC 7413</primary>
51472 <secondary>TCP Fast Open</secondary>
51473 </indexterm>
51474 This option provides a list of servers to which, provided
51475 the facility is supported by this system, Exim will attempt to
51476 perform a TCP Fast Open.
51477 No data is sent on the SYN segment but, if the remote server also
51478 supports the facility, it can send its SMTP banner immediately after
51479 the SYN,ACK segment.  This can save up to one round-trip time.
51480 </para>
51481 <para>
51482 The facility is only active for previously-contacted servers,
51483 as the initiator must present a cookie in the SYN segment.
51484 </para>
51485 <para>
51486 On (at least some) current Linux distributions the facility must be enabled
51487 in the kernel by the sysadmin before the support is usable.
51488 There is no option for control of the server side; if the system supports
51489 it it is always enabled.  Note that lengthy operations in the connect ACL,
51490 such as DNSBL lookups, will still delay the emission of the SMTP banner.
51491 </para>
51492 <para>
51493 <indexterm role="option">
51494 <primary><option>hosts_try_prdr</option></primary>
51495 </indexterm>
51496 </para>
51497 <informaltable frame="all">
51498 <tgroup cols="4" colsep="0" rowsep="0">
51499 <colspec colwidth="8*" align="left"/>
51500 <colspec colwidth="6*" align="center"/>
51501 <colspec colwidth="6*" align="center"/>
51502 <colspec colwidth="6*" align="right"/>
51503 <tbody>
51504 <row>
51505 <entry><option>hosts_try_prdr</option></entry>
51506 <entry>Use: <emphasis>smtp</emphasis></entry>
51507 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51508 <entry>Default: <emphasis>*</emphasis></entry>
51509 </row>
51510 </tbody>
51511 </tgroup>
51512 </informaltable>
51513 <para>
51514 <indexterm role="concept">
51515 <primary>PRDR</primary>
51516 <secondary>enabling, optional in client</secondary>
51517 </indexterm>
51518 <indexterm role="concept">
51519 <primary>ESMTP extensions</primary>
51520 <secondary>PRDR</secondary>
51521 </indexterm>
51522 This option provides a list of servers to which, provided they announce
51523 PRDR support, Exim will attempt to negotiate PRDR
51524 for multi-recipient messages.
51525 The option can usually be left as default.
51526 </para>
51527 <para>
51528 <indexterm role="option">
51529 <primary><option>interface</option></primary>
51530 </indexterm>
51531 </para>
51532 <informaltable frame="all">
51533 <tgroup cols="4" colsep="0" rowsep="0">
51534 <colspec colwidth="8*" align="left"/>
51535 <colspec colwidth="6*" align="center"/>
51536 <colspec colwidth="6*" align="center"/>
51537 <colspec colwidth="6*" align="right"/>
51538 <tbody>
51539 <row>
51540 <entry><option>interface</option></entry>
51541 <entry>Use: <emphasis>smtp</emphasis></entry>
51542 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
51543 <entry>Default: <emphasis>unset</emphasis></entry>
51544 </row>
51545 </tbody>
51546 </tgroup>
51547 </informaltable>
51548 <para>
51549 <indexterm role="concept">
51550 <primary>bind IP address</primary>
51551 </indexterm>
51552 <indexterm role="concept">
51553 <primary>IP address</primary>
51554 <secondary>binding</secondary>
51555 </indexterm>
51556 <indexterm role="variable">
51557 <primary><varname>$host</varname></primary>
51558 </indexterm>
51559 <indexterm role="variable">
51560 <primary><varname>$host_address</varname></primary>
51561 </indexterm>
51562 This option specifies which interface to bind to when making an outgoing SMTP
51563 call. The value is an IP address, not an interface name such as
51564 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
51565 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
51566 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
51567 outgoing interface address. There is no variable that contains an outgoing
51568 interface address because, unless it is set by this option, its value is
51569 unknown.
51570 </para>
51571 <para>
51572 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
51573 <varname>$host_address</varname> refer to the host to which a connection is about to be made
51574 during the expansion of the string. Forced expansion failure, or an empty
51575 string result causes the option to be ignored. Otherwise, after expansion, the
51576 string must be a list of IP addresses, colon-separated by default, but the
51577 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
51578 For example:
51579 </para>
51580 <literallayout class="monospaced">
51581 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
51582 </literallayout>
51583 <para>
51584 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
51585 connection. If none of them are the correct type, the option is ignored. If
51586 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
51587 interface to use if the host has more than one.
51588 </para>
51589 <para>
51590 <indexterm role="option">
51591 <primary><option>keepalive</option></primary>
51592 </indexterm>
51593 </para>
51594 <informaltable frame="all">
51595 <tgroup cols="4" colsep="0" rowsep="0">
51596 <colspec colwidth="8*" align="left"/>
51597 <colspec colwidth="6*" align="center"/>
51598 <colspec colwidth="6*" align="center"/>
51599 <colspec colwidth="6*" align="right"/>
51600 <tbody>
51601 <row>
51602 <entry><option>keepalive</option></entry>
51603 <entry>Use: <emphasis>smtp</emphasis></entry>
51604 <entry>Type: <emphasis>boolean</emphasis></entry>
51605 <entry>Default: <emphasis>true</emphasis></entry>
51606 </row>
51607 </tbody>
51608 </tgroup>
51609 </informaltable>
51610 <para>
51611 <indexterm role="concept">
51612 <primary>keepalive</primary>
51613 <secondary>on outgoing connection</secondary>
51614 </indexterm>
51615 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
51616 connections. When set, it causes the kernel to probe idle connections
51617 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
51618 of the connection should send a acknowledgment if the connection is still okay
51619 or a reset if the connection has been aborted. The reason for doing this is
51620 that it has the beneficial effect of freeing up certain types of connection
51621 that can get stuck when the remote host is disconnected without tidying up the
51622 TCP/IP call properly. The keepalive mechanism takes several hours to detect
51623 unreachable hosts.
51624 </para>
51625 <para>
51626 <indexterm role="option">
51627 <primary><option>lmtp_ignore_quota</option></primary>
51628 </indexterm>
51629 </para>
51630 <informaltable frame="all">
51631 <tgroup cols="4" colsep="0" rowsep="0">
51632 <colspec colwidth="8*" align="left"/>
51633 <colspec colwidth="6*" align="center"/>
51634 <colspec colwidth="6*" align="center"/>
51635 <colspec colwidth="6*" align="right"/>
51636 <tbody>
51637 <row>
51638 <entry><option>lmtp_ignore_quota</option></entry>
51639 <entry>Use: <emphasis>smtp</emphasis></entry>
51640 <entry>Type: <emphasis>boolean</emphasis></entry>
51641 <entry>Default: <emphasis>false</emphasis></entry>
51642 </row>
51643 </tbody>
51644 </tgroup>
51645 </informaltable>
51646 <para>
51647 <indexterm role="concept">
51648 <primary>LMTP</primary>
51649 <secondary>ignoring quota errors</secondary>
51650 </indexterm>
51651 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
51652 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
51653 has advertised support for IGNOREQUOTA in its response to the LHLO command.
51654 </para>
51655 <para>
51656 <indexterm role="option">
51657 <primary><option>max_rcpt</option></primary>
51658 </indexterm>
51659 </para>
51660 <informaltable frame="all">
51661 <tgroup cols="4" colsep="0" rowsep="0">
51662 <colspec colwidth="8*" align="left"/>
51663 <colspec colwidth="6*" align="center"/>
51664 <colspec colwidth="6*" align="center"/>
51665 <colspec colwidth="6*" align="right"/>
51666 <tbody>
51667 <row>
51668 <entry><option>max_rcpt</option></entry>
51669 <entry>Use: <emphasis>smtp</emphasis></entry>
51670 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
51671 <entry>Default: <emphasis>100</emphasis></entry>
51672 </row>
51673 </tbody>
51674 </tgroup>
51675 </informaltable>
51676 <para>
51677 <indexterm role="concept">
51678 <primary>RCPT</primary>
51679 <secondary>maximum number of outgoing</secondary>
51680 </indexterm>
51681 This option,
51682 </para>
51683 <para revisionflag="changed">
51684 after expansion,
51685 </para>
51686 <para>
51687 limits the number of RCPT commands that are sent in a single
51688 SMTP message transaction.
51689 A value setting of zero disables the limit.
51690 </para>
51691 <para revisionflag="changed">
51692 If a constant is given,
51693 </para>
51694 <para>
51695 each set of addresses is treated independently, and
51696 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
51697 permits this.
51698 </para>
51699 <para>
51700 <indexterm role="option">
51701 <primary><option>message_linelength_limit</option></primary>
51702 </indexterm>
51703 </para>
51704 <informaltable frame="all">
51705 <tgroup cols="4" colsep="0" rowsep="0">
51706 <colspec colwidth="8*" align="left"/>
51707 <colspec colwidth="6*" align="center"/>
51708 <colspec colwidth="6*" align="center"/>
51709 <colspec colwidth="6*" align="right"/>
51710 <tbody>
51711 <row>
51712 <entry><option>message_linelength_limit</option></entry>
51713 <entry>Use: <emphasis>smtp</emphasis></entry>
51714 <entry>Type: <emphasis>integer</emphasis></entry>
51715 <entry>Default: <emphasis>998</emphasis></entry>
51716 </row>
51717 </tbody>
51718 </tgroup>
51719 </informaltable>
51720 <para>
51721 <indexterm role="concept">
51722 <primary>line length</primary>
51723 <secondary>limit</secondary>
51724 </indexterm>
51725 This option sets the maximum line length, in bytes, that the transport
51726 will send.  Any messages with lines exceeding the given value
51727 will fail and a failure-DSN ("bounce") message will if possible be returned
51728 to the sender.
51729 The default value is that defined by the SMTP standards.
51730 </para>
51731 <para>
51732 It is generally wise to also check in the data ACL so that messages
51733 received via SMTP can be refused without producing a bounce.
51734 </para>
51735 <para>
51736 <indexterm role="option">
51737 <primary><option>multi_domain</option></primary>
51738 </indexterm>
51739 </para>
51740 <informaltable frame="all">
51741 <tgroup cols="4" colsep="0" rowsep="0">
51742 <colspec colwidth="8*" align="left"/>
51743 <colspec colwidth="6*" align="center"/>
51744 <colspec colwidth="6*" align="center"/>
51745 <colspec colwidth="6*" align="right"/>
51746 <tbody>
51747 <row>
51748 <entry><option>multi_domain</option></entry>
51749 <entry>Use: <emphasis>smtp</emphasis></entry>
51750 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
51751 <entry>Default: <emphasis>true</emphasis></entry>
51752 </row>
51753 </tbody>
51754 </tgroup>
51755 </informaltable>
51756 <para>
51757 <indexterm role="variable">
51758 <primary><varname>$domain</varname></primary>
51759 </indexterm>
51760 When this option is set, the <command>smtp</command> transport can handle a number of
51761 addresses containing a mixture of different domains provided they all resolve
51762 to the same list of hosts. Turning the option off restricts the transport to
51763 handling only one domain at a time. This is useful if you want to use
51764 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
51765 is a single domain involved in a remote delivery.
51766 </para>
51767 <para>
51768 It is expanded per-address and can depend on any of
51769 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
51770 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
51771 </para>
51772 <para>
51773 If the connection is DANE-enabled then this option is ignored;
51774 only messages having the domain used for the DANE TLSA lookup are
51775 sent on the connection.
51776 </para>
51777 <para>
51778 <indexterm role="option">
51779 <primary><option>port</option></primary>
51780 </indexterm>
51781 </para>
51782 <informaltable frame="all">
51783 <tgroup cols="4" colsep="0" rowsep="0">
51784 <colspec colwidth="8*" align="left"/>
51785 <colspec colwidth="6*" align="center"/>
51786 <colspec colwidth="6*" align="center"/>
51787 <colspec colwidth="6*" align="right"/>
51788 <tbody>
51789 <row>
51790 <entry><option>port</option></entry>
51791 <entry>Use: <emphasis>smtp</emphasis></entry>
51792 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51793 <entry>Default: <emphasis>see below</emphasis></entry>
51794 </row>
51795 </tbody>
51796 </tgroup>
51797 </informaltable>
51798 <para>
51799 <indexterm role="concept">
51800 <primary>port</primary>
51801 <secondary>sending TCP/IP</secondary>
51802 </indexterm>
51803 <indexterm role="concept">
51804 <primary>TCP/IP</primary>
51805 <secondary>setting outgoing port</secondary>
51806 </indexterm>
51807 This option specifies the TCP/IP port on the server to which Exim connects.
51808 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
51809 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
51810 The name was changed to minimize confusion with the outgoing port. There is no
51811 variable that contains an outgoing port.
51812 </para>
51813 <para>
51814 If the value of this option begins with a digit it is taken as a port number;
51815 otherwise it is looked up using <function>getservbyname()</function>. The default value is
51816 normally <quote>smtp</quote>,
51817 but if <option>protocol</option> is set to <quote>lmtp</quote> the default is <quote>lmtp</quote>
51818 and if <option>protocol</option> is set to <quote>smtps</quote> the default is <quote>smtps</quote>.
51819 If the expansion fails, or if a port number cannot be found, delivery
51820 is deferred.
51821 </para>
51822 <para>
51823 Note that at least one Linux distribution has been seen failing
51824 to put <quote>smtps</quote> in its <quote>/etc/services</quote> file, resulting is such deferrals.
51825 </para>
51826 <para>
51827 <indexterm role="option">
51828 <primary><option>protocol</option></primary>
51829 </indexterm>
51830 </para>
51831 <informaltable frame="all">
51832 <tgroup cols="4" colsep="0" rowsep="0">
51833 <colspec colwidth="8*" align="left"/>
51834 <colspec colwidth="6*" align="center"/>
51835 <colspec colwidth="6*" align="center"/>
51836 <colspec colwidth="6*" align="right"/>
51837 <tbody>
51838 <row>
51839 <entry><option>protocol</option></entry>
51840 <entry>Use: <emphasis>smtp</emphasis></entry>
51841 <entry>Type: <emphasis>string</emphasis></entry>
51842 <entry>Default: <emphasis>smtp</emphasis></entry>
51843 </row>
51844 </tbody>
51845 </tgroup>
51846 </informaltable>
51847 <para>
51848 <indexterm role="concept">
51849 <primary>LMTP</primary>
51850 <secondary>over TCP/IP</secondary>
51851 </indexterm>
51852 <indexterm role="concept">
51853 <primary>ssmtp protocol</primary>
51854 <secondary>outbound</secondary>
51855 </indexterm>
51856 <indexterm role="concept">
51857 <primary>TLS</primary>
51858 <secondary>SSL-on-connect outbound</secondary>
51859 </indexterm>
51860 <indexterm role="variable">
51861 <primary><varname>$port</varname></primary>
51862 </indexterm>
51863 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
51864 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
51865 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
51866 deliveries into closed message stores. Exim also has support for running LMTP
51867 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
51868 </para>
51869 <para>
51870 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
51871 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
51872 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
51873 The Internet standards bodies used to strongly discourage use of this mode,
51874 but as of RFC 8314 it is preferred over STARTTLS for message submission
51875 (as distinct from MTA-MTA communication).
51876 </para>
51877 <para>
51878 <indexterm role="option">
51879 <primary><option>retry_include_ip_address</option></primary>
51880 </indexterm>
51881 </para>
51882 <informaltable frame="all">
51883 <tgroup cols="4" colsep="0" rowsep="0">
51884 <colspec colwidth="8*" align="left"/>
51885 <colspec colwidth="6*" align="center"/>
51886 <colspec colwidth="6*" align="center"/>
51887 <colspec colwidth="6*" align="right"/>
51888 <tbody>
51889 <row>
51890 <entry><option>retry_include_ip_address</option></entry>
51891 <entry>Use: <emphasis>smtp</emphasis></entry>
51892 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
51893 <entry>Default: <emphasis>true</emphasis></entry>
51894 </row>
51895 </tbody>
51896 </tgroup>
51897 </informaltable>
51898 <para>
51899 Exim normally includes both the host name and the IP address in the key it
51900 constructs for indexing retry data after a temporary delivery failure. This
51901 means that when one of several IP addresses for a host is failing, it gets
51902 tried periodically (controlled by the retry rules), but use of the other IP
51903 addresses is not affected.
51904 </para>
51905 <para>
51906 However, in some dialup environments hosts are assigned a different IP address
51907 each time they connect. In this situation the use of the IP address as part of
51908 the retry key leads to undesirable behaviour. Setting this option false causes
51909 Exim to use only the host name.
51910 Since it is expanded it can be made to depend on the host or domain.
51911 </para>
51912 <para>
51913 <indexterm role="option">
51914 <primary><option>serialize_hosts</option></primary>
51915 </indexterm>
51916 </para>
51917 <informaltable frame="all">
51918 <tgroup cols="4" colsep="0" rowsep="0">
51919 <colspec colwidth="8*" align="left"/>
51920 <colspec colwidth="6*" align="center"/>
51921 <colspec colwidth="6*" align="center"/>
51922 <colspec colwidth="6*" align="right"/>
51923 <tbody>
51924 <row>
51925 <entry><option>serialize_hosts</option></entry>
51926 <entry>Use: <emphasis>smtp</emphasis></entry>
51927 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51928 <entry>Default: <emphasis>unset</emphasis></entry>
51929 </row>
51930 </tbody>
51931 </tgroup>
51932 </informaltable>
51933 <para>
51934 <indexterm role="concept">
51935 <primary>serializing connections</primary>
51936 </indexterm>
51937 <indexterm role="concept">
51938 <primary>host</primary>
51939 <secondary>serializing connections</secondary>
51940 </indexterm>
51941 Because Exim operates in a distributed manner, if several messages for the same
51942 host arrive at around the same time, more than one simultaneous connection to
51943 the remote host can occur. This is not usually a problem except when there is a
51944 slow link between the hosts. In that situation it may be helpful to restrict
51945 Exim to one connection at a time. This can be done by setting
51946 <option>serialize_hosts</option> to match the relevant hosts.
51947 </para>
51948 <para>
51949 <indexterm role="concept">
51950 <primary>hints database</primary>
51951 <secondary>serializing deliveries to a host</secondary>
51952 </indexterm>
51953 Exim implements serialization by means of a hints database in which a record is
51954 written whenever a process connects to one of the restricted hosts. The record
51955 is deleted when the connection is completed. Obviously there is scope for
51956 records to get left lying around if there is a system or program crash. To
51957 guard against this, Exim ignores any records that are more than six hours old.
51958 </para>
51959 <para>
51960 If you set up this kind of serialization, you should also arrange to delete the
51961 relevant hints database whenever your system reboots. The names of the files
51962 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
51963 may be one or two files, depending on the type of DBM in use. The same files
51964 are used for ETRN serialization.
51965 </para>
51966 <para>
51967 See also the <option>max_parallel</option> generic transport option.
51968 </para>
51969 <para>
51970 <indexterm role="option">
51971 <primary><option>size_addition</option></primary>
51972 </indexterm>
51973 </para>
51974 <informaltable frame="all">
51975 <tgroup cols="4" colsep="0" rowsep="0">
51976 <colspec colwidth="8*" align="left"/>
51977 <colspec colwidth="6*" align="center"/>
51978 <colspec colwidth="6*" align="center"/>
51979 <colspec colwidth="6*" align="right"/>
51980 <tbody>
51981 <row>
51982 <entry><option>size_addition</option></entry>
51983 <entry>Use: <emphasis>smtp</emphasis></entry>
51984 <entry>Type: <emphasis>integer</emphasis></entry>
51985 <entry>Default: <emphasis>1024</emphasis></entry>
51986 </row>
51987 </tbody>
51988 </tgroup>
51989 </informaltable>
51990 <para>
51991 <indexterm role="concept">
51992 <primary>SIZE</primary>
51993 <secondary>ESMTP extension</secondary>
51994 </indexterm>
51995 <indexterm role="concept">
51996 <primary>message</primary>
51997 <secondary>size issue for transport filter</secondary>
51998 </indexterm>
51999 <indexterm role="concept">
52000 <primary>size</primary>
52001 <secondary>of message</secondary>
52002 </indexterm>
52003 <indexterm role="concept">
52004 <primary>transport</primary>
52005 <secondary>filter</secondary>
52006 </indexterm>
52007 <indexterm role="concept">
52008 <primary>filter</primary>
52009 <secondary>transport filter</secondary>
52010 </indexterm>
52011 If a remote SMTP server indicates that it supports the SIZE option of the
52012 MAIL command, Exim uses this to pass over the message size at the start of
52013 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
52014 sends, to allow for headers and other text that may be added during delivery by
52015 configuration options or in a transport filter. It may be necessary to increase
52016 this if a lot of text is added to messages.
52017 </para>
52018 <para>
52019 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
52020 the use of the SIZE option altogether.
52021 </para>
52022 <para>
52023 <indexterm role="option">
52024 <primary><option>socks_proxy</option></primary>
52025 </indexterm>
52026 </para>
52027 <informaltable frame="all">
52028 <tgroup cols="4" colsep="0" rowsep="0">
52029 <colspec colwidth="8*" align="left"/>
52030 <colspec colwidth="6*" align="center"/>
52031 <colspec colwidth="6*" align="center"/>
52032 <colspec colwidth="6*" align="right"/>
52033 <tbody>
52034 <row>
52035 <entry><option>socks_proxy</option></entry>
52036 <entry>Use: <emphasis>smtp</emphasis></entry>
52037 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52038 <entry>Default: <emphasis>unset</emphasis></entry>
52039 </row>
52040 </tbody>
52041 </tgroup>
52042 </informaltable>
52043 <para>
52044 <indexterm role="concept">
52045 <primary>proxy</primary>
52046 <secondary>SOCKS</secondary>
52047 </indexterm>
52048 This option enables use of SOCKS proxies for connections made by the
52049 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
52050 </para>
52051 <para>
52052 <indexterm role="option">
52053 <primary><option>tls_alpn</option></primary>
52054 </indexterm>
52055 </para>
52056 <informaltable frame="all">
52057 <tgroup cols="4" colsep="0" rowsep="0">
52058 <colspec colwidth="8*" align="left"/>
52059 <colspec colwidth="6*" align="center"/>
52060 <colspec colwidth="6*" align="center"/>
52061 <colspec colwidth="6*" align="right"/>
52062 <tbody>
52063 <row>
52064 <entry><option>tls_alpn</option></entry>
52065 <entry>Use: <emphasis>smtp</emphasis></entry>
52066 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52067 <entry>Default: <emphasis>unset</emphasis></entry>
52068 </row>
52069 </tbody>
52070 </tgroup>
52071 </informaltable>
52072 <para>
52073 <indexterm role="concept">
52074 <primary>TLS</primary>
52075 <secondary>Application Layer Protocol Names</secondary>
52076 </indexterm>
52077 <indexterm role="concept">
52078 <primary>TLS</primary>
52079 <secondary>ALPN</secondary>
52080 </indexterm>
52081 <indexterm role="concept">
52082 <primary>ALPN</primary>
52083 <secondary>set name in client</secondary>
52084 </indexterm>
52085 If this option is set
52086 and the TLS library supports ALPN,
52087 the value given is used.
52088 </para>
52089 <para>
52090 As of writing no value has been standardised for email use.
52091 The authors suggest using <quote>smtp</quote>.
52092 </para>
52093 <para>
52094 <indexterm role="option">
52095 <primary><option>tls_certificate</option></primary>
52096 </indexterm>
52097 </para>
52098 <informaltable frame="all">
52099 <tgroup cols="4" colsep="0" rowsep="0">
52100 <colspec colwidth="8*" align="left"/>
52101 <colspec colwidth="6*" align="center"/>
52102 <colspec colwidth="6*" align="center"/>
52103 <colspec colwidth="6*" align="right"/>
52104 <tbody>
52105 <row>
52106 <entry><option>tls_certificate</option></entry>
52107 <entry>Use: <emphasis>smtp</emphasis></entry>
52108 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52109 <entry>Default: <emphasis>unset</emphasis></entry>
52110 </row>
52111 </tbody>
52112 </tgroup>
52113 </informaltable>
52114 <para>
52115 <indexterm role="concept">
52116 <primary>TLS</primary>
52117 <secondary>client certificate, location of</secondary>
52118 </indexterm>
52119 <indexterm role="concept">
52120 <primary>certificate</primary>
52121 <secondary>client, location of</secondary>
52122 </indexterm>
52123 <indexterm role="variable">
52124 <primary><varname>$host</varname></primary>
52125 </indexterm>
52126 <indexterm role="variable">
52127 <primary><varname>$host_address</varname></primary>
52128 </indexterm>
52129 The value of this option must be the absolute path to a file which contains the
52130 client&#x2019;s certificate, for possible use when sending a message over an encrypted
52131 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
52132 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
52133 details of TLS.
52134 </para>
52135 <para>
52136 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
52137 certificate when sending messages as a client. The global option of the same
52138 name specifies the certificate for Exim as a server; it is not automatically
52139 assumed that the same certificate should be used when Exim is operating as a
52140 client.
52141 </para>
52142 <para>
52143 <indexterm role="option">
52144 <primary><option>tls_crl</option></primary>
52145 </indexterm>
52146 </para>
52147 <informaltable frame="all">
52148 <tgroup cols="4" colsep="0" rowsep="0">
52149 <colspec colwidth="8*" align="left"/>
52150 <colspec colwidth="6*" align="center"/>
52151 <colspec colwidth="6*" align="center"/>
52152 <colspec colwidth="6*" align="right"/>
52153 <tbody>
52154 <row>
52155 <entry><option>tls_crl</option></entry>
52156 <entry>Use: <emphasis>smtp</emphasis></entry>
52157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52158 <entry>Default: <emphasis>unset</emphasis></entry>
52159 </row>
52160 </tbody>
52161 </tgroup>
52162 </informaltable>
52163 <para>
52164 <indexterm role="concept">
52165 <primary>TLS</primary>
52166 <secondary>client certificate revocation list</secondary>
52167 </indexterm>
52168 <indexterm role="concept">
52169 <primary>certificate</primary>
52170 <secondary>revocation list for client</secondary>
52171 </indexterm>
52172 This option specifies a certificate revocation list. The expanded value must
52173 be the name of a file that contains a CRL in PEM format.
52174 </para>
52175 <para>
52176 <indexterm role="option">
52177 <primary><option>tls_dh_min_bits</option></primary>
52178 </indexterm>
52179 </para>
52180 <informaltable frame="all">
52181 <tgroup cols="4" colsep="0" rowsep="0">
52182 <colspec colwidth="8*" align="left"/>
52183 <colspec colwidth="6*" align="center"/>
52184 <colspec colwidth="6*" align="center"/>
52185 <colspec colwidth="6*" align="right"/>
52186 <tbody>
52187 <row>
52188 <entry><option>tls_dh_min_bits</option></entry>
52189 <entry>Use: <emphasis>smtp</emphasis></entry>
52190 <entry>Type: <emphasis>integer</emphasis></entry>
52191 <entry>Default: <emphasis>1024</emphasis></entry>
52192 </row>
52193 </tbody>
52194 </tgroup>
52195 </informaltable>
52196 <para>
52197 <indexterm role="concept">
52198 <primary>TLS</primary>
52199 <secondary>Diffie-Hellman minimum acceptable size</secondary>
52200 </indexterm>
52201 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
52202 key agreement is negotiated, the server will provide a large prime number
52203 for use.  This option establishes the minimum acceptable size of that number.
52204 If the parameter offered by the server is too small, then the TLS handshake
52205 will fail.
52206 </para>
52207 <para>
52208 Only supported when using GnuTLS.
52209 </para>
52210 <para>
52211 <indexterm role="option">
52212 <primary><option>tls_privatekey</option></primary>
52213 </indexterm>
52214 </para>
52215 <informaltable frame="all">
52216 <tgroup cols="4" colsep="0" rowsep="0">
52217 <colspec colwidth="8*" align="left"/>
52218 <colspec colwidth="6*" align="center"/>
52219 <colspec colwidth="6*" align="center"/>
52220 <colspec colwidth="6*" align="right"/>
52221 <tbody>
52222 <row>
52223 <entry><option>tls_privatekey</option></entry>
52224 <entry>Use: <emphasis>smtp</emphasis></entry>
52225 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52226 <entry>Default: <emphasis>unset</emphasis></entry>
52227 </row>
52228 </tbody>
52229 </tgroup>
52230 </informaltable>
52231 <para>
52232 <indexterm role="concept">
52233 <primary>TLS</primary>
52234 <secondary>client private key, location of</secondary>
52235 </indexterm>
52236 <indexterm role="variable">
52237 <primary><varname>$host</varname></primary>
52238 </indexterm>
52239 <indexterm role="variable">
52240 <primary><varname>$host_address</varname></primary>
52241 </indexterm>
52242 The value of this option must be the absolute path to a file which contains the
52243 client&#x2019;s private key. This is used when sending a message over an encrypted
52244 connection using a client certificate. The values of <varname>$host</varname> and
52245 <varname>$host_address</varname> are set to the name and address of the server during the
52246 expansion. If this option is unset, or the expansion is forced to fail, or the
52247 result is an empty string, the private key is assumed to be in the same file as
52248 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
52249 </para>
52250 <para>
52251 <indexterm role="option">
52252 <primary><option>tls_require_ciphers</option></primary>
52253 </indexterm>
52254 </para>
52255 <informaltable frame="all">
52256 <tgroup cols="4" colsep="0" rowsep="0">
52257 <colspec colwidth="8*" align="left"/>
52258 <colspec colwidth="6*" align="center"/>
52259 <colspec colwidth="6*" align="center"/>
52260 <colspec colwidth="6*" align="right"/>
52261 <tbody>
52262 <row>
52263 <entry><option>tls_require_ciphers</option></entry>
52264 <entry>Use: <emphasis>smtp</emphasis></entry>
52265 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52266 <entry>Default: <emphasis>unset</emphasis></entry>
52267 </row>
52268 </tbody>
52269 </tgroup>
52270 </informaltable>
52271 <para>
52272 <indexterm role="concept">
52273 <primary>TLS</primary>
52274 <secondary>requiring specific ciphers</secondary>
52275 </indexterm>
52276 <indexterm role="concept">
52277 <primary>cipher</primary>
52278 <secondary>requiring specific</secondary>
52279 </indexterm>
52280 <indexterm role="variable">
52281 <primary><varname>$host</varname></primary>
52282 </indexterm>
52283 <indexterm role="variable">
52284 <primary><varname>$host_address</varname></primary>
52285 </indexterm>
52286 The value of this option must be a list of permitted cipher suites, for use
52287 when setting up an outgoing encrypted connection. (There is a global option of
52288 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
52289 <varname>$host_address</varname> are set to the name and address of the server during the
52290 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
52291 is used in different ways by OpenSSL and GnuTLS (see sections
52292 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
52293 ciphers is a preference order.
52294 </para>
52295 <para>
52296 <indexterm role="option">
52297 <primary><option>tls_resumption_hosts</option></primary>
52298 </indexterm>
52299 </para>
52300 <informaltable frame="all">
52301 <tgroup cols="4" colsep="0" rowsep="0">
52302 <colspec colwidth="8*" align="left"/>
52303 <colspec colwidth="6*" align="center"/>
52304 <colspec colwidth="6*" align="center"/>
52305 <colspec colwidth="6*" align="right"/>
52306 <tbody>
52307 <row>
52308 <entry><option>tls_resumption_hosts</option></entry>
52309 <entry>Use: <emphasis>smtp</emphasis></entry>
52310 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52311 <entry>Default: <emphasis>unset</emphasis></entry>
52312 </row>
52313 </tbody>
52314 </tgroup>
52315 </informaltable>
52316 <para>
52317 <indexterm role="concept">
52318 <primary>TLS</primary>
52319 <secondary>resumption</secondary>
52320 </indexterm>
52321 This option controls which connections to use the TLS resumption feature.
52322 See <xref linkend="SECTresumption"/> for details.
52323 </para>
52324 <para>
52325 <indexterm role="option">
52326 <primary><option>tls_sni</option></primary>
52327 </indexterm>
52328 </para>
52329 <informaltable frame="all">
52330 <tgroup cols="4" colsep="0" rowsep="0">
52331 <colspec colwidth="8*" align="left"/>
52332 <colspec colwidth="6*" align="center"/>
52333 <colspec colwidth="6*" align="center"/>
52334 <colspec colwidth="6*" align="right"/>
52335 <tbody>
52336 <row>
52337 <entry><option>tls_sni</option></entry>
52338 <entry>Use: <emphasis>smtp</emphasis></entry>
52339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52340 <entry>Default: <emphasis>unset</emphasis></entry>
52341 </row>
52342 </tbody>
52343 </tgroup>
52344 </informaltable>
52345 <para>
52346 <indexterm role="concept">
52347 <primary>TLS</primary>
52348 <secondary>Server Name Indication</secondary>
52349 </indexterm>
52350 <indexterm role="concept">
52351 <primary>TLS</primary>
52352 <secondary>SNI</secondary>
52353 </indexterm>
52354 <indexterm role="concept">
52355 <primary>SNI</primary>
52356 <secondary>setting in client</secondary>
52357 </indexterm>
52358 <indexterm role="variable">
52359 <primary><varname>$tls_sni</varname></primary>
52360 </indexterm>
52361 If this option is set
52362 and the connection is not DANE-validated
52363 then it sets the $tls_out_sni variable and causes any
52364 TLS session to pass this value as the Server Name Indication extension to
52365 the remote side, which can be used by the remote side to select an appropriate
52366 certificate and private key for the session.
52367 </para>
52368 <para>
52369 See <xref linkend="SECTtlssni"/> for more information.
52370 </para>
52371 <para>
52372 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
52373 TLS extensions.
52374 </para>
52375 <para>
52376 <indexterm role="option">
52377 <primary><option>tls_tempfail_tryclear</option></primary>
52378 </indexterm>
52379 </para>
52380 <informaltable frame="all">
52381 <tgroup cols="4" colsep="0" rowsep="0">
52382 <colspec colwidth="8*" align="left"/>
52383 <colspec colwidth="6*" align="center"/>
52384 <colspec colwidth="6*" align="center"/>
52385 <colspec colwidth="6*" align="right"/>
52386 <tbody>
52387 <row>
52388 <entry><option>tls_tempfail_tryclear</option></entry>
52389 <entry>Use: <emphasis>smtp</emphasis></entry>
52390 <entry>Type: <emphasis>boolean</emphasis></entry>
52391 <entry>Default: <emphasis>true</emphasis></entry>
52392 </row>
52393 </tbody>
52394 </tgroup>
52395 </informaltable>
52396 <para>
52397 <indexterm role="concept">
52398 <primary>4<emphasis>xx</emphasis> responses</primary>
52399 <secondary>to STARTTLS</secondary>
52400 </indexterm>
52401 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
52402 setting up a TLS session, this option determines whether or not Exim should try
52403 to deliver the message unencrypted. If it is set false, delivery to the
52404 current host is deferred; if there are other hosts, they are tried. If this
52405 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
52406 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
52407 TLS negotiation fails, Exim closes the current connection (because it is in an
52408 unknown state), opens a new one to the same host, and then tries the delivery
52409 in clear.
52410 </para>
52411 <para>
52412 <indexterm role="option">
52413 <primary><option>tls_try_verify_hosts</option></primary>
52414 </indexterm>
52415 </para>
52416 <informaltable frame="all">
52417 <tgroup cols="4" colsep="0" rowsep="0">
52418 <colspec colwidth="8*" align="left"/>
52419 <colspec colwidth="6*" align="center"/>
52420 <colspec colwidth="6*" align="center"/>
52421 <colspec colwidth="6*" align="right"/>
52422 <tbody>
52423 <row>
52424 <entry><option>tls_try_verify_hosts</option></entry>
52425 <entry>Use: <emphasis>smtp</emphasis></entry>
52426 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52427 <entry>Default: <emphasis>*</emphasis></entry>
52428 </row>
52429 </tbody>
52430 </tgroup>
52431 </informaltable>
52432 <para>
52433 <indexterm role="concept">
52434 <primary>TLS</primary>
52435 <secondary>server certificate verification</secondary>
52436 </indexterm>
52437 <indexterm role="concept">
52438 <primary>certificate</primary>
52439 <secondary>verification of server</secondary>
52440 </indexterm>
52441 This option gives a list of hosts for which, on encrypted connections,
52442 certificate verification will be tried but need not succeed.
52443 The <option>tls_verify_certificates</option> option must also be set.
52444 Note that unless the host is in this list
52445 TLS connections will be denied to hosts using self-signed certificates
52446 when <option>tls_verify_certificates</option> is matched.
52447 The <varname>$tls_out_certificate_verified</varname> variable is set when
52448 certificate verification succeeds.
52449 </para>
52450 <para>
52451 <indexterm role="option">
52452 <primary><option>tls_verify_cert_hostnames</option></primary>
52453 </indexterm>
52454 </para>
52455 <informaltable frame="all">
52456 <tgroup cols="4" colsep="0" rowsep="0">
52457 <colspec colwidth="8*" align="left"/>
52458 <colspec colwidth="6*" align="center"/>
52459 <colspec colwidth="6*" align="center"/>
52460 <colspec colwidth="6*" align="right"/>
52461 <tbody>
52462 <row>
52463 <entry><option>tls_verify_cert_hostnames</option></entry>
52464 <entry>Use: <emphasis>smtp</emphasis></entry>
52465 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52466 <entry>Default: <emphasis>*</emphasis></entry>
52467 </row>
52468 </tbody>
52469 </tgroup>
52470 </informaltable>
52471 <para>
52472 <indexterm role="concept">
52473 <primary>TLS</primary>
52474 <secondary>server certificate hostname verification</secondary>
52475 </indexterm>
52476 <indexterm role="concept">
52477 <primary>certificate</primary>
52478 <secondary>verification of server</secondary>
52479 </indexterm>
52480 This option give a list of hosts for which,
52481 while verifying the server certificate,
52482 checks will be included on the host name
52483 (note that this will generally be the result of a DNS MX lookup)
52484 versus the Subject-Alternate-Name (or, if none, Subject-Name) fields.
52485 Wildcard names are permitted,
52486 limited to being the initial component of a 3-or-more component FQDN.
52487 </para>
52488 <para>
52489 There is no equivalent checking on client certificates.
52490 </para>
52491 <para>
52492 <indexterm role="option">
52493 <primary><option>tls_verify_certificates</option></primary>
52494 </indexterm>
52495 </para>
52496 <informaltable frame="all">
52497 <tgroup cols="4" colsep="0" rowsep="0">
52498 <colspec colwidth="8*" align="left"/>
52499 <colspec colwidth="6*" align="center"/>
52500 <colspec colwidth="6*" align="center"/>
52501 <colspec colwidth="6*" align="right"/>
52502 <tbody>
52503 <row>
52504 <entry><option>tls_verify_certificates</option></entry>
52505 <entry>Use: <emphasis>smtp</emphasis></entry>
52506 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52507 <entry>Default: <emphasis>system</emphasis></entry>
52508 </row>
52509 </tbody>
52510 </tgroup>
52511 </informaltable>
52512 <para>
52513 <indexterm role="concept">
52514 <primary>TLS</primary>
52515 <secondary>server certificate verification</secondary>
52516 </indexterm>
52517 <indexterm role="concept">
52518 <primary>certificate</primary>
52519 <secondary>verification of server</secondary>
52520 </indexterm>
52521 <indexterm role="variable">
52522 <primary><varname>$host</varname></primary>
52523 </indexterm>
52524 <indexterm role="variable">
52525 <primary><varname>$host_address</varname></primary>
52526 </indexterm>
52527 The value of this option must be either the
52528 word "system"
52529 or the absolute path to
52530 a file or directory containing permitted certificates for servers,
52531 for use when setting up an encrypted connection.
52532 </para>
52533 <para>
52534 The "system" value for the option will use a location compiled into the SSL library.
52535 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
52536 is taken as empty and an explicit location
52537 must be specified.
52538 </para>
52539 <para>
52540 The use of a directory for the option value is not available for GnuTLS versions
52541 preceding 3.3.6 and a single file must be used.
52542 </para>
52543 <para>
52544 With OpenSSL the certificates specified
52545 explicitly
52546 either by file or directory
52547 are added to those given by the system default location.
52548 </para>
52549 <para>
52550 The values of <varname>$host</varname> and
52551 <varname>$host_address</varname> are set to the name and address of the server during the
52552 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
52553 </para>
52554 <para>
52555 For back-compatibility,
52556 if neither tls_verify_hosts nor tls_try_verify_hosts are set
52557 (a single-colon empty list counts as being set)
52558 and certificate verification fails the TLS connection is closed.
52559 </para>
52560 <para>
52561 <indexterm role="option">
52562 <primary><option>tls_verify_hosts</option></primary>
52563 </indexterm>
52564 </para>
52565 <informaltable frame="all">
52566 <tgroup cols="4" colsep="0" rowsep="0">
52567 <colspec colwidth="8*" align="left"/>
52568 <colspec colwidth="6*" align="center"/>
52569 <colspec colwidth="6*" align="center"/>
52570 <colspec colwidth="6*" align="right"/>
52571 <tbody>
52572 <row>
52573 <entry><option>tls_verify_hosts</option></entry>
52574 <entry>Use: <emphasis>smtp</emphasis></entry>
52575 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52576 <entry>Default: <emphasis>unset</emphasis></entry>
52577 </row>
52578 </tbody>
52579 </tgroup>
52580 </informaltable>
52581 <para>
52582 <indexterm role="concept">
52583 <primary>TLS</primary>
52584 <secondary>server certificate verification</secondary>
52585 </indexterm>
52586 <indexterm role="concept">
52587 <primary>certificate</primary>
52588 <secondary>verification of server</secondary>
52589 </indexterm>
52590 This option gives a list of hosts for which, on encrypted connections,
52591 certificate verification must succeed.
52592 The <option>tls_verify_certificates</option> option must also be set.
52593 If both this option and <option>tls_try_verify_hosts</option> are unset
52594 operation is as if this option selected all hosts.
52595 <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
52596 that connections use TLS.
52597 Fallback to in-clear communication will be done unless restricted by
52598 the <option>hosts_require_tls</option> option.
52599 </para>
52600 <para>
52601 <indexterm role="option">
52602 <primary><option>utf8_downconvert</option></primary>
52603 </indexterm>
52604 </para>
52605 <informaltable frame="all">
52606 <tgroup cols="4" colsep="0" rowsep="0">
52607 <colspec colwidth="8*" align="left"/>
52608 <colspec colwidth="6*" align="center"/>
52609 <colspec colwidth="6*" align="center"/>
52610 <colspec colwidth="6*" align="right"/>
52611 <tbody>
52612 <row>
52613 <entry><option>utf8_downconvert</option></entry>
52614 <entry>Use: <emphasis>smtp</emphasis></entry>
52615 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
52616 <entry>Default: <emphasis>-1</emphasis></entry>
52617 </row>
52618 </tbody>
52619 </tgroup>
52620 </informaltable>
52621 <para>
52622 <indexterm role="concept">
52623 <primary>utf8</primary>
52624 <secondary>address downconversion</secondary>
52625 </indexterm>
52626 <indexterm role="concept">
52627 <primary>i18n</primary>
52628 <secondary>utf8 address downconversion</secondary>
52629 </indexterm>
52630 If built with internationalization support,
52631 this option controls conversion of UTF-8 in message envelope addresses
52632 to a-label form.
52633 If, after expansion, the value is 1, 0, or -1 then this value overrides
52634 any value previously set for the message.  Otherwise, any previously
52635 set value is used.  To permit use of a previous value,
52636 set this option to an empty string.
52637 For details on the values see section <xref linkend="SECTi18nMTA"/>.
52638 </para>
52639 </section>
52640 <section id="SECTvalhosmax">
52641 <title>How the limits for the number of hosts to try are used</title>
52642 <para>
52643 <indexterm role="concept">
52644 <primary>host</primary>
52645 <secondary>maximum number to try</secondary>
52646 </indexterm>
52647 <indexterm role="concept">
52648 <primary>limit</primary>
52649 <secondary>hosts; maximum number tried</secondary>
52650 </indexterm>
52651 There are two options that are concerned with the number of hosts that are
52652 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
52653 <option>hosts_max_try_hardlimit</option>.
52654 </para>
52655 <para>
52656 The <option>hosts_max_try</option> option limits the number of hosts that are tried
52657 for a single delivery. However, despite the term <quote>host</quote> in its name, the
52658 option actually applies to each IP address independently. In other words, a
52659 multihomed host is treated as several independent hosts, just as it is for
52660 retrying.
52661 </para>
52662 <para>
52663 Many of the larger ISPs have multiple MX records which often point to
52664 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
52665 created as a result of routing one of these domains.
52666 </para>
52667 <para>
52668 Trying every single IP address on such a long list does not seem sensible; if
52669 several at the top of the list fail, it is reasonable to assume there is some
52670 problem that is likely to affect all of them. Roughly speaking, the value of
52671 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
52672 delivery. However, the logic cannot be quite that simple.
52673 </para>
52674 <para>
52675 Firstly, IP addresses that are skipped because their retry times have not
52676 arrived do not count, and in addition, addresses that are past their retry
52677 limits are also not counted, even when they are tried. This means that when
52678 some IP addresses are past their retry limits, more than the value of
52679 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
52680 that all IP addresses are considered before timing out an email address (but
52681 see below for an exception).
52682 </para>
52683 <para>
52684 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
52685 list to see if there is a subsequent host with a different (higher valued) MX.
52686 If there is, that host is considered next, and the current IP address is used
52687 but not counted. This behaviour helps in the case of a domain with a retry rule
52688 that hardly ever delays any hosts, as is now explained:
52689 </para>
52690 <para>
52691 Consider the case of a long list of hosts with one MX value, and a few with a
52692 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
52693 hosts at the top of the list are tried at first. With the default retry rule,
52694 which specifies increasing retry times, the higher MX hosts are eventually
52695 tried when those at the top of the list are skipped because they have not
52696 reached their retry times.
52697 </para>
52698 <para>
52699 However, it is common practice to put a fixed short retry time on domains for
52700 large ISPs, on the grounds that their servers are rarely down for very long.
52701 Unfortunately, these are exactly the domains that tend to resolve to long lists
52702 of hosts. The short retry time means that the lowest MX hosts are tried every
52703 time. The attempts may be in a different order because of random sorting, but
52704 without the special MX check, the higher MX hosts would never be tried until
52705 all the lower MX hosts had timed out (which might be several days), because
52706 there are always some lower MX hosts that have reached their retry times. With
52707 the special check, Exim considers at least one IP address from each MX value at
52708 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
52709 reached.
52710 </para>
52711 <para>
52712 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
52713 particular, Exim normally eventually tries all the IP addresses before timing
52714 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
52715 reasonable thing to do. Recently, however, some lunatic DNS configurations have
52716 been set up with hundreds of IP addresses for some domains. It can
52717 take a very long time indeed for an address to time out in these cases.
52718 </para>
52719 <para>
52720 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
52721 Exim never tries more than this number of IP addresses; if it hits this limit
52722 and they are all timed out, the email address is bounced, even though not all
52723 possible IP addresses have been tried.
52724 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
52725 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
52726 </para>
52727 </section>
52728 </chapter>
52729
52730 <chapter id="CHAPrewrite">
52731 <title>Address rewriting</title>
52732 <para>
52733 <indexterm role="concept" id="IIDaddrew" class="startofrange">
52734 <primary>rewriting</primary>
52735 <secondary>addresses</secondary>
52736 </indexterm>
52737 There are some circumstances in which Exim automatically rewrites domains in
52738 addresses. The two most common are when an address is given without a domain
52739 (referred to as an <quote>unqualified address</quote>) or when an address contains an
52740 abbreviated domain that is expanded by DNS lookup.
52741 </para>
52742 <para>
52743 Unqualified envelope addresses are accepted only for locally submitted
52744 messages, or for messages that are received from hosts matching
52745 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
52746 appropriate. Unqualified addresses in header lines are qualified if they are in
52747 locally submitted messages, or messages from hosts that are permitted to send
52748 unqualified envelope addresses. Otherwise, unqualified addresses in header
52749 lines are neither qualified nor rewritten.
52750 </para>
52751 <para>
52752 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
52753 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
52754 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
52755 do this. The new RFCs do not contain this suggestion.
52756 </para>
52757 <section id="SECID147">
52758 <title>Explicitly configured address rewriting</title>
52759 <para>
52760 This chapter describes the rewriting rules that can be used in the
52761 main rewrite section of the configuration file, and also in the generic
52762 <option>headers_rewrite</option> option that can be set on any transport.
52763 </para>
52764 <para>
52765 Some people believe that configured address rewriting is a Mortal Sin.
52766 Others believe that life is not possible without it. Exim provides the
52767 facility; you do not have to use it.
52768 </para>
52769 <para>
52770 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
52771 configuration file are applied to addresses in incoming messages, both envelope
52772 addresses and addresses in header lines. Each rule specifies the types of
52773 address to which it applies.
52774 </para>
52775 <para>
52776 Whether or not addresses in header lines are rewritten depends on the origin of
52777 the headers and the type of rewriting. Global rewriting, that is, rewriting
52778 rules from the rewrite section of the configuration file, is applied only to
52779 those headers that were received with the message. Header lines that are added
52780 by ACLs or by a system filter or by individual routers or transports (which
52781 are specific to individual recipient addresses) are not rewritten by the global
52782 rules.
52783 </para>
52784 <para>
52785 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
52786 applies all headers except those added by routers and transports. That is, as
52787 well as the headers that were received with the message, it also applies to
52788 headers that were added by an ACL or a system filter.
52789 </para>
52790 <para>
52791 In general, rewriting addresses from your own system or domain has some
52792 legitimacy. Rewriting other addresses should be done only with great care and
52793 in special circumstances. The author of Exim believes that rewriting should be
52794 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
52795 Although it can sometimes be used as a routing tool, this is very strongly
52796 discouraged.
52797 </para>
52798 <para>
52799 There are two commonly encountered circumstances where rewriting is used, as
52800 illustrated by these examples:
52801 </para>
52802 <itemizedlist>
52803 <listitem>
52804 <para>
52805 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
52806 exchange mail with each other behind a firewall, but there is only a single
52807 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
52808 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
52809 </para>
52810 </listitem>
52811 <listitem>
52812 <para>
52813 A host rewrites the local parts of its own users so that, for example,
52814 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
52815 </para>
52816 </listitem>
52817 </itemizedlist>
52818 </section>
52819 <section id="SECID148">
52820 <title>When does rewriting happen?</title>
52821 <para>
52822 <indexterm role="concept">
52823 <primary>rewriting</primary>
52824 <secondary>timing of</secondary>
52825 </indexterm>
52826 <indexterm role="concept">
52827 <primary>access control lists (ACLs)</primary>
52828 <secondary>rewriting addresses in</secondary>
52829 </indexterm>
52830 Configured address rewriting can take place at several different stages of a
52831 message&#x2019;s processing.
52832 </para>
52833 <para>
52834 <indexterm role="variable">
52835 <primary><varname>$sender_address</varname></primary>
52836 </indexterm>
52837 At the start of an ACL for MAIL, the sender address may have been rewritten
52838 by a special SMTP-time rewrite rule (see section <xref linkend="SSECTrewriteS"/>), but no
52839 ordinary rewrite rules have yet been applied. If, however, the sender address
52840 is verified in the ACL, it is rewritten before verification, and remains
52841 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
52842 rewritten address. This also applies if sender verification happens in a
52843 RCPT ACL. Otherwise, when the sender address is not verified, it is
52844 rewritten as soon as a message&#x2019;s header lines have been received.
52845 </para>
52846 <para>
52847 <indexterm role="variable">
52848 <primary><varname>$domain</varname></primary>
52849 </indexterm>
52850 <indexterm role="variable">
52851 <primary><varname>$local_part</varname></primary>
52852 </indexterm>
52853 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
52854 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
52855 rewrite rules have yet been applied to it. However, the behaviour is different
52856 from the sender address when a recipient is verified. The address is rewritten
52857 for the verification, but the rewriting is not remembered at this stage. The
52858 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
52859 as they were before (that is, they contain the unrewritten &ndash; except for
52860 SMTP-time rewriting &ndash; address).
52861 </para>
52862 <para>
52863 As soon as a message&#x2019;s header lines have been received, all the envelope
52864 recipient addresses are permanently rewritten, and rewriting is also applied to
52865 the addresses in the header lines (if configured). This happens before adding
52866 any header lines that were specified in MAIL or RCPT ACLs, and
52867 <indexterm role="concept">
52868 <primary><function>local_scan()</function> function</primary>
52869 <secondary>address rewriting; timing of</secondary>
52870 </indexterm>
52871 before the DATA ACL and <function>local_scan()</function> functions are run.
52872 </para>
52873 <para>
52874 When an address is being routed, either for delivery or for verification,
52875 rewriting is applied immediately to child addresses that are generated by
52876 redirection, unless <option>no_rewrite</option> is set on the router.
52877 </para>
52878 <para>
52879 <indexterm role="concept">
52880 <primary>envelope from</primary>
52881 </indexterm>
52882 <indexterm role="concept">
52883 <primary>envelope sender</primary>
52884 <secondary>rewriting at transport time</secondary>
52885 </indexterm>
52886 <indexterm role="concept">
52887 <primary>rewriting</primary>
52888 <secondary>at transport time</secondary>
52889 </indexterm>
52890 <indexterm role="concept">
52891 <primary>header lines</primary>
52892 <secondary>rewriting at transport time</secondary>
52893 </indexterm>
52894 At transport time, additional rewriting of addresses in header lines can be
52895 specified by setting the generic <option>headers_rewrite</option> option on a transport.
52896 This option contains rules that are identical in form to those in the rewrite
52897 section of the configuration file. They are applied to the original message
52898 header lines and any that were added by ACLs or a system filter. They are not
52899 applied to header lines that are added by routers or the transport.
52900 </para>
52901 <para>
52902 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
52903 transport option. However, it is not possible to rewrite envelope recipients at
52904 transport time.
52905 </para>
52906 </section>
52907 <section id="SECID149">
52908 <title>Testing the rewriting rules that apply on input</title>
52909 <para>
52910 <indexterm role="concept">
52911 <primary>rewriting</primary>
52912 <secondary>testing</secondary>
52913 </indexterm>
52914 <indexterm role="concept">
52915 <primary>testing</primary>
52916 <secondary>rewriting</secondary>
52917 </indexterm>
52918 Exim&#x2019;s input rewriting configuration appears in a part of the runtime
52919 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
52920 <option>-brw</option> command line option. This takes an address (which can be a full RFC
52921 2822 address) as its argument. The output is a list of how the address would be
52922 transformed by the rewriting rules for each of the different places it might
52923 appear in an incoming message, that is, for each different header and for the
52924 envelope sender and recipient fields. For example,
52925 </para>
52926 <literallayout class="monospaced">
52927 exim -brw ph10@exim.workshop.example
52928 </literallayout>
52929 <para>
52930 might produce the output
52931 </para>
52932 <literallayout class="monospaced">
52933 sender: Philip.Hazel@exim.workshop.example
52934 from: Philip.Hazel@exim.workshop.example
52935 to: ph10@exim.workshop.example
52936 cc: ph10@exim.workshop.example
52937 bcc: ph10@exim.workshop.example
52938 reply-to: Philip.Hazel@exim.workshop.example
52939 env-from: Philip.Hazel@exim.workshop.example
52940 env-to: ph10@exim.workshop.example
52941 </literallayout>
52942 <para>
52943 which shows that rewriting has been set up for that address when used in any of
52944 the source fields, but not when it appears as a recipient address. At the
52945 present time, there is no equivalent way of testing rewriting rules that are
52946 set for a particular transport.
52947 </para>
52948 </section>
52949 <section id="SECID150">
52950 <title>Rewriting rules</title>
52951 <para>
52952 <indexterm role="concept">
52953 <primary>rewriting</primary>
52954 <secondary>rules</secondary>
52955 </indexterm>
52956 The rewrite section of the configuration file consists of lines of rewriting
52957 rules in the form
52958 </para>
52959 <literallayout>
52960 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
52961 </literallayout>
52962 <para>
52963 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
52964 transport option are given as a colon-separated list. Each item in the list
52965 takes the same form as a line in the main rewriting configuration (except that
52966 any colons must be doubled, of course).
52967 </para>
52968 <para>
52969 The formats of source patterns and replacement strings are described below.
52970 Each is terminated by white space, unless enclosed in double quotes, in which
52971 case normal quoting conventions apply inside the quotes. The flags are single
52972 characters which may appear in any order. Spaces and tabs between them are
52973 ignored.
52974 </para>
52975 <para>
52976 For each address that could potentially be rewritten, the rules are scanned in
52977 order, and replacements for the address from earlier rules can themselves be
52978 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
52979 </para>
52980 <para>
52981 The order in which addresses are rewritten is undefined, may change between
52982 releases, and must not be relied on, with one exception: when a message is
52983 received, the envelope sender is always rewritten first, before any header
52984 lines are rewritten. For example, the replacement string for a rewrite of an
52985 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
52986 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
52987 that the envelope sender has already been rewritten.
52988 </para>
52989 <para>
52990 <indexterm role="variable">
52991 <primary><varname>$domain</varname></primary>
52992 </indexterm>
52993 <indexterm role="variable">
52994 <primary><varname>$local_part</varname></primary>
52995 </indexterm>
52996 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
52997 string to refer to the address that is being rewritten. Note that lookup-driven
52998 rewriting can be done by a rule of the form
52999 </para>
53000 <literallayout class="monospaced">
53001 *@*   ${lookup ...
53002 </literallayout>
53003 <para>
53004 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
53005 refer to the address that is being rewritten.
53006 </para>
53007 </section>
53008 <section id="SECID151">
53009 <title>Rewriting patterns</title>
53010 <para>
53011 <indexterm role="concept">
53012 <primary>rewriting</primary>
53013 <secondary>patterns</secondary>
53014 </indexterm>
53015 <indexterm role="concept">
53016 <primary>address list</primary>
53017 <secondary>in a rewriting pattern</secondary>
53018 </indexterm>
53019 The source pattern in a rewriting rule is any item which may appear in an
53020 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
53021 single-item address list, which means that it is expanded before being tested
53022 against the address. As always, if you use a regular expression as a pattern,
53023 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
53024 facility to suppress string expansion within the regular expression.
53025 </para>
53026 <para>
53027 Domains in patterns should be given in lower case. Local parts in patterns are
53028 case-sensitive. If you want to do case-insensitive matching of local parts, you
53029 can use a regular expression that starts with <literal>^(?i)</literal>.
53030 </para>
53031 <para>
53032 <indexterm role="concept">
53033 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53034 <secondary>in rewriting rules</secondary>
53035 </indexterm>
53036 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
53037 depending on the type of match which occurred. These can be used in the
53038 replacement string to insert portions of the incoming address. <varname>$0</varname> always
53039 refers to the complete incoming address. When a regular expression is used, the
53040 numerical variables are set from its capturing subexpressions. For other types
53041 of pattern they are set as follows:
53042 </para>
53043 <itemizedlist>
53044 <listitem>
53045 <para>
53046 If a local part or domain starts with an asterisk, the numerical variables
53047 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
53048 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
53049 pattern
53050 </para>
53051 <literallayout class="monospaced">
53052 *queen@*.fict.example
53053 </literallayout>
53054 <para>
53055 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
53056 </para>
53057 <literallayout class="monospaced">
53058 $0 = hearts-queen@wonderland.fict.example
53059 $1 = hearts-
53060 $2 = wonderland
53061 </literallayout>
53062 <para>
53063 Note that if the local part does not start with an asterisk, but the domain
53064 does, it is <varname>$1</varname> that contains the wild part of the domain.
53065 </para>
53066 </listitem>
53067 <listitem>
53068 <para>
53069 If the domain part of the pattern is a partial lookup, the wild and fixed parts
53070 of the domain are placed in the next available numerical variables. Suppose,
53071 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
53072 rewriting rule of the form
53073 </para>
53074 <literallayout>
53075 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
53076 </literallayout>
53077 <para>
53078 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
53079 </para>
53080 <literallayout class="monospaced">
53081 $1 = foo
53082 $2 = bar
53083 $3 = baz.example
53084 </literallayout>
53085 <para>
53086 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
53087 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
53088 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
53089 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
53090 whole domain. For non-partial domain lookups, no numerical variables are set.
53091 </para>
53092 </listitem>
53093 </itemizedlist>
53094 </section>
53095 <section id="SECID152">
53096 <title>Rewriting replacements</title>
53097 <para>
53098 <indexterm role="concept">
53099 <primary>rewriting</primary>
53100 <secondary>replacements</secondary>
53101 </indexterm>
53102 If the replacement string for a rule is a single asterisk, addresses that
53103 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
53104 rewriting rules are scanned. For example,
53105 </para>
53106 <literallayout class="monospaced">
53107 hatta@lookingglass.fict.example  *  f
53108 </literallayout>
53109 <para>
53110 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
53111 <emphasis>From:</emphasis> headers.
53112 </para>
53113 <para>
53114 <indexterm role="variable">
53115 <primary><varname>$domain</varname></primary>
53116 </indexterm>
53117 <indexterm role="variable">
53118 <primary><varname>$local_part</varname></primary>
53119 </indexterm>
53120 If the replacement string is not a single asterisk, it is expanded, and must
53121 yield a fully qualified address. Within the expansion, the variables
53122 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
53123 Any letters they contain retain their original case &ndash; they are not lower
53124 cased. The numerical variables are set up according to the type of pattern that
53125 matched the address, as described above. If the expansion is forced to fail by
53126 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
53127 current rule is abandoned, but subsequent rules may take effect. Any other
53128 expansion failure causes the entire rewriting operation to be abandoned, and an
53129 entry written to the panic log.
53130 </para>
53131 <section id="SSECID153">
53132 <title>Rewriting flags</title>
53133 <para>
53134 There are three different kinds of flag that may appear on rewriting rules:
53135 </para>
53136 <itemizedlist>
53137 <listitem>
53138 <para>
53139 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
53140 c, f, h, r, s, t.
53141 </para>
53142 </listitem>
53143 <listitem>
53144 <para>
53145 A flag that specifies rewriting at SMTP time: S.
53146 </para>
53147 </listitem>
53148 <listitem>
53149 <para>
53150 Flags that control the rewriting process: Q, q, R, w.
53151 </para>
53152 </listitem>
53153 </itemizedlist>
53154 <para>
53155 For rules that are part of the <option>headers_rewrite</option> generic transport option,
53156 E, F, T, and S are not permitted.
53157 </para>
53158 </section>
53159 <section id="SSECID154">
53160 <title>Flags specifying which headers and envelope addresses to rewrite</title>
53161 <para>
53162 <indexterm role="concept">
53163 <primary>rewriting</primary>
53164 <secondary>flags</secondary>
53165 </indexterm>
53166 If none of the following flag letters, nor the <quote>S</quote> flag (see section
53167 <xref linkend="SSECTrewriteS"/>) are present, a main rewriting rule applies to all headers
53168 and to both the sender and recipient fields of the envelope, whereas a
53169 transport-time rewriting rule just applies to all headers. Otherwise, the
53170 rewriting rule is skipped unless the relevant addresses are being processed.
53171 </para>
53172 <literallayout>
53173 <literal>E</literal>       rewrite all envelope fields
53174 <literal>F</literal>       rewrite the envelope From field
53175 <literal>T</literal>       rewrite the envelope To field
53176 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
53177 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
53178 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
53179 <literal>h</literal>       rewrite all headers
53180 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
53181 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
53182 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
53183 </literallayout>
53184 <para>
53185 "All headers" means all of the headers listed above that can be selected
53186 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
53187 other headers such as <emphasis>Subject:</emphasis> etc.
53188 </para>
53189 <para>
53190 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
53191 restrict this to special known cases in your own domains.
53192 </para>
53193 </section>
53194 <section id="SSECTrewriteS">
53195 <title>The SMTP-time rewriting flag</title>
53196 <para>
53197 <indexterm role="concept">
53198 <primary>SMTP</primary>
53199 <secondary>rewriting malformed addresses</secondary>
53200 </indexterm>
53201 <indexterm role="concept">
53202 <primary>RCPT</primary>
53203 <secondary>rewriting argument of</secondary>
53204 </indexterm>
53205 <indexterm role="concept">
53206 <primary>MAIL</primary>
53207 <secondary>rewriting argument of</secondary>
53208 </indexterm>
53209 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
53210 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
53211 before any other processing; even before syntax checking. The pattern is
53212 required to be a regular expression, and it is matched against the whole of the
53213 data for the command, including any surrounding angle brackets.
53214 </para>
53215 <para>
53216 <indexterm role="variable">
53217 <primary><varname>$domain</varname></primary>
53218 </indexterm>
53219 <indexterm role="variable">
53220 <primary><varname>$local_part</varname></primary>
53221 </indexterm>
53222 This form of rewrite rule allows for the handling of addresses that are not
53223 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
53224 input). Because the input is not required to be a syntactically valid address,
53225 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
53226 expansion of the replacement string. The result of rewriting replaces the
53227 original address in the MAIL or RCPT command.
53228 </para>
53229 </section>
53230 <section id="SSECID155">
53231 <title>Flags controlling the rewriting process</title>
53232 <para>
53233 There are four flags which control the way the rewriting process works. These
53234 take effect only when a rule is invoked, that is, when the address is of the
53235 correct type (matches the flags) and matches the pattern:
53236 </para>
53237 <itemizedlist>
53238 <listitem>
53239 <para>
53240 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
53241 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
53242 absence of <quote>Q</quote> the rewritten address must always include a domain.
53243 </para>
53244 </listitem>
53245 <listitem>
53246 <para>
53247 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
53248 even if no rewriting actually takes place because of a <quote>fail</quote> in the
53249 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
53250 (does not match the flags) or does not match the pattern.
53251 </para>
53252 </listitem>
53253 <listitem>
53254 <para>
53255 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
53256 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
53257 rewriting once it fails to match (after at least one successful rewrite).
53258 </para>
53259 </listitem>
53260 <listitem>
53261 <para>
53262 <indexterm role="concept">
53263 <primary>rewriting</primary>
53264 <secondary>whole addresses</secondary>
53265 </indexterm>
53266 When an address in a header is rewritten, the rewriting normally applies only
53267 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
53268 left unchanged. For example, rewriting might change
53269 </para>
53270 <literallayout class="monospaced">
53271 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
53272 </literallayout>
53273 <para>
53274 into
53275 </para>
53276 <literallayout class="monospaced">
53277 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
53278 </literallayout>
53279 <para>
53280 <indexterm role="concept">
53281 <primary>RFC 2047</primary>
53282 </indexterm>
53283 Sometimes there is a need to replace the whole address item, and this can be
53284 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
53285 causes an address in a header line to be rewritten, the entire address is
53286 replaced, not just the working part. The replacement must be a complete RFC
53287 2822 address, including the angle brackets if necessary. If text outside angle
53288 brackets contains a character whose value is greater than 126 or less than 32
53289 (except for tab), the text is encoded according to RFC 2047. The character set
53290 is taken from <option>headers_charset</option>, which gets its default at build time.
53291 </para>
53292 <para>
53293 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
53294 rewritten, all but the working part of the replacement address is discarded.
53295 </para>
53296 </listitem>
53297 </itemizedlist>
53298 </section>
53299 </section>
53300 <section id="SECID156">
53301 <title>Rewriting examples</title>
53302 <para>
53303 Here is an example of the two common rewriting paradigms:
53304 </para>
53305 <literallayout class="monospaced">
53306 *@*.hitch.fict.example  $1@hitch.fict.example
53307 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
53308                      {$value}fail}@hitch.fict.example bctfrF
53309 </literallayout>
53310 <para>
53311 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
53312 the string expansion to fail if the lookup does not succeed. In this context it
53313 has the effect of leaving the original address unchanged, but Exim goes on to
53314 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
53315 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
53316 explicitly, which would cause the rewritten address to be the same as before,
53317 at the cost of a small bit of processing. Not supplying either of these is an
53318 error, since the rewritten address would then contain no local part.
53319 </para>
53320 <para>
53321 The first example above replaces the domain with a superior, more general
53322 domain. This may not be desirable for certain local parts. If the rule
53323 </para>
53324 <literallayout class="monospaced">
53325 root@*.hitch.fict.example  *
53326 </literallayout>
53327 <para>
53328 were inserted before the first rule, rewriting would be suppressed for the
53329 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
53330 </para>
53331 <para>
53332 Rewriting can be made conditional on a number of tests, by making use of
53333 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
53334 messages that originate outside the local host:
53335 </para>
53336 <literallayout class="monospaced">
53337 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
53338                          {$1@hitch.fict.example}fail}"
53339 </literallayout>
53340 <para>
53341 The replacement string is quoted in this example because it contains white
53342 space.
53343 </para>
53344 <para>
53345 <indexterm role="concept">
53346 <primary>rewriting</primary>
53347 <secondary>bang paths</secondary>
53348 </indexterm>
53349 <indexterm role="concept">
53350 <primary>bang paths</primary>
53351 <secondary>rewriting</secondary>
53352 </indexterm>
53353 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
53354 an address it treats it as an unqualified local part which it qualifies with
53355 the local qualification domain (if the source of the message is local or if the
53356 remote host is permitted to send unqualified addresses). Rewriting can
53357 sometimes be used to handle simple bang paths with a fixed number of
53358 components. For example, the rule
53359 </para>
53360 <literallayout class="monospaced">
53361 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
53362 </literallayout>
53363 <para>
53364 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
53365 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
53366 a global rewriting rule for envelope addresses. It can provide a backdoor
53367 method for using your system as a relay, because the incoming addresses appear
53368 to be local. If the bang path addresses are received via SMTP, it is safer to
53369 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
53370 can be done on the rewritten addresses.
53371 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
53372 </para>
53373 </section>
53374 </chapter>
53375
53376 <chapter id="CHAPretry">
53377 <title>Retry configuration</title>
53378 <para>
53379 <indexterm role="concept" id="IIDretconf1" class="startofrange">
53380 <primary>retry</primary>
53381 <secondary>configuration, description of</secondary>
53382 </indexterm>
53383 <indexterm role="concept" id="IIDregconf2" class="startofrange">
53384 <primary>configuration file</primary>
53385 <secondary>retry section</secondary>
53386 </indexterm>
53387 The <quote>retry</quote> section of the runtime configuration file contains a list of
53388 retry rules that control how often Exim tries to deliver messages that cannot
53389 be delivered at the first attempt. If there are no retry rules (the section is
53390 empty or not present), there are no retries. In this situation, temporary
53391 errors are treated as permanent. The default configuration contains a single,
53392 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
53393 line option can be used to test which retry rule will be used for a given
53394 address, domain and error.
53395 </para>
53396 <para>
53397 The most common cause of retries is temporary failure to deliver to a remote
53398 host because the host is down, or inaccessible because of a network problem.
53399 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
53400 address) basis, not on a per-message basis. Thus, if one message has recently
53401 been delayed, delivery of a new message to the same host is not immediately
53402 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
53403 log selector is set, the message
53404 <indexterm role="concept">
53405 <primary>retry</primary>
53406 <secondary>time not reached</secondary>
53407 </indexterm>
53408 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
53409 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
53410 the handling of errors during remote deliveries.
53411 </para>
53412 <para>
53413 Retry processing applies to routing as well as to delivering, except as covered
53414 in the next paragraph. The retry rules do not distinguish between these
53415 actions. It is not possible, for example, to specify different behaviour for
53416 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
53417 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
53418 added complication, so did not implement it. However, although they share the
53419 same retry rule, the actual retry times for routing and transporting a given
53420 domain are maintained independently.
53421 </para>
53422 <para>
53423 When a delivery is not part of a queue run (typically an immediate delivery on
53424 receipt of a message), the routers are always run, and local deliveries are
53425 always attempted, even if retry times are set for them. This makes for better
53426 behaviour if one particular message is causing problems (for example, causing
53427 quota overflow, or provoking an error in a filter file). If such a delivery
53428 suffers a temporary failure, the retry data is updated as normal, and
53429 subsequent delivery attempts from queue runs occur only when the retry time for
53430 the local address is reached.
53431 </para>
53432 <section id="SECID157">
53433 <title>Changing retry rules</title>
53434 <para>
53435 If you change the retry rules in your configuration, you should consider
53436 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
53437 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
53438 always safe; that is why they are called <quote>hints</quote>.
53439 </para>
53440 <para>
53441 The hints retry data contains suggested retry times based on the previous
53442 rules. In the case of a long-running problem with a remote host, it might
53443 record the fact that the host has timed out. If your new rules increase the
53444 timeout time for such a host, you should definitely remove the old retry data
53445 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
53446 messages that it should now be retaining.
53447 </para>
53448 </section>
53449 <section id="SECID158">
53450 <title>Format of retry rules</title>
53451 <para>
53452 <indexterm role="concept">
53453 <primary>retry</primary>
53454 <secondary>rules</secondary>
53455 </indexterm>
53456 Each retry rule occupies one line and consists of three or four parts,
53457 separated by white space: a pattern, an error name, an optional list of sender
53458 addresses, and a list of retry parameters. The pattern and sender lists must be
53459 enclosed in double quotes if they contain white space. The rules are searched
53460 in order until one is found where the pattern, error name, and sender list (if
53461 present) match the failing host or address, the error that occurred, and the
53462 message&#x2019;s sender, respectively.
53463 </para>
53464 <para>
53465 The pattern is any single item that may appear in an address list (see section
53466 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
53467 which means that it is expanded before being tested against the address that
53468 has been delayed. A negated address list item is permitted. Address
53469 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
53470 which makes it possible for many retry rules to start with just a domain. For
53471 example,
53472 </para>
53473 <literallayout class="monospaced">
53474 lookingglass.fict.example        *  F,24h,30m;
53475 </literallayout>
53476 <para>
53477 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
53478 whereas
53479 </para>
53480 <literallayout class="monospaced">
53481 alice@lookingglass.fict.example  *  F,24h,30m;
53482 </literallayout>
53483 <para>
53484 applies only to temporary failures involving the local part <option>alice</option>.
53485 In practice, almost all rules start with a domain name pattern without a local
53486 part.
53487 </para>
53488 <para>
53489 <indexterm role="concept">
53490 <primary>regular expressions</primary>
53491 <secondary>in retry rules</secondary>
53492 </indexterm>
53493 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
53494 must match a complete address, not just a domain, because that is how regular
53495 expressions work in address lists.
53496 </para>
53497 <literallayout>
53498 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
53499 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
53500 </literallayout>
53501 </section>
53502 <section id="SECID159">
53503 <title>Choosing which retry rule to use for address errors</title>
53504 <para>
53505 When Exim is looking for a retry rule after a routing attempt has failed (for
53506 example, after a DNS timeout), each line in the retry configuration is tested
53507 against the complete address only if <option>retry_use_local_part</option> is set for the
53508 router. Otherwise, only the domain is used, except when matching against a
53509 regular expression, when the local part of the address is replaced with <quote>*</quote>.
53510 A domain on its own can match a domain pattern, or a pattern that starts with
53511 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
53512 <option>check_local_user</option> is true, and false for other routers.
53513 </para>
53514 <para>
53515 Similarly, when Exim is looking for a retry rule after a local delivery has
53516 failed (for example, after a mailbox full error), each line in the retry
53517 configuration is tested against the complete address only if
53518 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
53519 local transports).
53520 </para>
53521 <para>
53522 <indexterm role="concept">
53523 <primary>4<emphasis>xx</emphasis> responses</primary>
53524 <secondary>retry rules for</secondary>
53525 </indexterm>
53526 However, when Exim is looking for a retry rule after a remote delivery attempt
53527 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
53528 whole address is always used as the key when searching the retry rules. The
53529 rule that is found is used to create a retry time for the combination of the
53530 failing address and the message&#x2019;s sender. It is the combination of sender and
53531 recipient that is delayed in subsequent queue runs until its retry time is
53532 reached. You can delay the recipient without regard to the sender by setting
53533 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
53534 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
53535 commands.
53536 </para>
53537 </section>
53538 <section id="SECID160">
53539 <title>Choosing which retry rule to use for host and message errors</title>
53540 <para>
53541 For a temporary error that is not related to an individual address (for
53542 example, a connection timeout), each line in the retry configuration is checked
53543 twice. First, the name of the remote host is used as a domain name (preceded by
53544 <quote>*@</quote> when matching a regular expression). If this does not match the line,
53545 the domain from the email address is tried in a similar fashion. For example,
53546 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
53547 </para>
53548 <literallayout class="monospaced">
53549 a.b.c.example  MX  5  x.y.z.example
53550                MX  6  p.q.r.example
53551                MX  7  m.n.o.example
53552 </literallayout>
53553 <para>
53554 and the retry rules are
53555 </para>
53556 <literallayout class="monospaced">
53557 p.q.r.example    *      F,24h,30m;
53558 a.b.c.example    *      F,4d,45m;
53559 </literallayout>
53560 <para>
53561 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
53562 first rule matches neither the host nor the domain, so Exim looks at the second
53563 rule. This does not match the host, but it does match the domain, so it is used
53564 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
53565 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
53566 first retry rule is used, because it matches the host.
53567 </para>
53568 <para>
53569 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
53570 first rule to determine retry times, but for all the other hosts for the domain
53571 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
53572 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
53573 </para>
53574 <para>
53575 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
53576 However, if a message is routed directly to an IP address without the use of a
53577 host name, for example, if a <command>manualroute</command> router contains a setting such as:
53578 </para>
53579 <literallayout class="monospaced">
53580 route_list = *.a.example  192.168.34.23
53581 </literallayout>
53582 <para>
53583 then the <quote>host name</quote> that is used when searching for a retry rule is the
53584 textual form of the IP address.
53585 </para>
53586 </section>
53587 <section id="SECID161">
53588 <title>Retry rules for specific errors</title>
53589 <para>
53590 <indexterm role="concept">
53591 <primary>retry</primary>
53592 <secondary>specific errors; specifying</secondary>
53593 </indexterm>
53594 The second field in a retry rule is the name of a particular error, or an
53595 asterisk, which matches any error. The errors that can be tested for are:
53596 </para>
53597 <variablelist>
53598 <varlistentry>
53599 <term><option>auth_failed</option></term>
53600 <listitem>
53601 <para>
53602 Authentication failed when trying to send to a host in the
53603 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
53604 </para>
53605 </listitem></varlistentry>
53606 <varlistentry>
53607 <term><option>data_4xx</option></term>
53608 <listitem>
53609 <para>
53610 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
53611 after the command, or after sending the message&#x2019;s data.
53612 </para>
53613 </listitem></varlistentry>
53614 <varlistentry>
53615 <term><option>mail_4xx</option></term>
53616 <listitem>
53617 <para>
53618 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
53619 </para>
53620 </listitem></varlistentry>
53621 <varlistentry>
53622 <term><option>rcpt_4xx</option></term>
53623 <listitem>
53624 <para>
53625 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
53626 </para>
53627 </listitem></varlistentry>
53628 </variablelist>
53629 <para>
53630 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
53631 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
53632 recognize 452 errors given to RCPT commands for addresses in a certain domain,
53633 and have retries every ten minutes with a one-hour timeout, you could set up a
53634 retry rule of this form:
53635 </para>
53636 <literallayout class="monospaced">
53637 the.domain.name  rcpt_452   F,1h,10m
53638 </literallayout>
53639 <para>
53640 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
53641 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
53642 </para>
53643 <variablelist>
53644 <varlistentry>
53645 <term><option>lost_connection</option></term>
53646 <listitem>
53647 <para>
53648 A server unexpectedly closed the SMTP connection. There may, of course,
53649 legitimate reasons for this (host died, network died), but if it repeats a lot
53650 for the same host, it indicates something odd.
53651 </para>
53652 </listitem></varlistentry>
53653 <varlistentry>
53654 <term><option>lookup</option></term>
53655 <listitem>
53656 <para>
53657 A DNS lookup for a host failed.
53658 Note that a <option>dnslookup</option> router will need to have matched
53659 its <option>fail_defer_domains</option> option for this retry type to be usable.
53660 Also note that a <option>manualroute</option> router will probably need
53661 its <option>host_find_failed</option> option set to <option>defer</option>.
53662 </para>
53663 </listitem></varlistentry>
53664 <varlistentry>
53665 <term><option>refused_MX</option></term>
53666 <listitem>
53667 <para>
53668 A connection to a host obtained from an MX record was refused.
53669 </para>
53670 </listitem></varlistentry>
53671 <varlistentry>
53672 <term><option>refused_A</option></term>
53673 <listitem>
53674 <para>
53675 A connection to a host not obtained from an MX record was refused.
53676 </para>
53677 </listitem></varlistentry>
53678 <varlistentry>
53679 <term><option>refused</option></term>
53680 <listitem>
53681 <para>
53682 A connection was refused.
53683 </para>
53684 </listitem></varlistentry>
53685 <varlistentry>
53686 <term><option>timeout_connect_MX</option></term>
53687 <listitem>
53688 <para>
53689 A connection attempt to a host obtained from an MX record timed out.
53690 </para>
53691 </listitem></varlistentry>
53692 <varlistentry>
53693 <term><option>timeout_connect_A</option></term>
53694 <listitem>
53695 <para>
53696 A connection attempt to a host not obtained from an MX record timed out.
53697 </para>
53698 </listitem></varlistentry>
53699 <varlistentry>
53700 <term><option>timeout_connect</option></term>
53701 <listitem>
53702 <para>
53703 A connection attempt timed out.
53704 </para>
53705 </listitem></varlistentry>
53706 <varlistentry>
53707 <term><option>timeout_MX</option></term>
53708 <listitem>
53709 <para>
53710 There was a timeout while connecting or during an SMTP session with a host
53711 obtained from an MX record.
53712 </para>
53713 </listitem></varlistentry>
53714 <varlistentry>
53715 <term><option>timeout_A</option></term>
53716 <listitem>
53717 <para>
53718 There was a timeout while connecting or during an SMTP session with a host not
53719 obtained from an MX record.
53720 </para>
53721 </listitem></varlistentry>
53722 <varlistentry>
53723 <term><option>timeout</option></term>
53724 <listitem>
53725 <para>
53726 There was a timeout while connecting or during an SMTP session.
53727 </para>
53728 </listitem></varlistentry>
53729 <varlistentry>
53730 <term><option>tls_required</option></term>
53731 <listitem>
53732 <para>
53733 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
53734 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
53735 to STARTTLS, or there was a problem setting up the TLS connection.
53736 </para>
53737 </listitem></varlistentry>
53738 <varlistentry>
53739 <term><option>quota</option></term>
53740 <listitem>
53741 <para>
53742 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
53743 transport.
53744 </para>
53745 </listitem></varlistentry>
53746 <varlistentry>
53747 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
53748 <listitem>
53749 <para>
53750 <indexterm role="concept">
53751 <primary>quota</primary>
53752 <secondary>error testing in retry rule</secondary>
53753 </indexterm>
53754 <indexterm role="concept">
53755 <primary>retry</primary>
53756 <secondary>quota error testing</secondary>
53757 </indexterm>
53758 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
53759 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
53760 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
53761 for four days.
53762 </para>
53763 </listitem></varlistentry>
53764 </variablelist>
53765 <para>
53766 <indexterm role="concept">
53767 <primary>mailbox</primary>
53768 <secondary>time of last read</secondary>
53769 </indexterm>
53770 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
53771 timeouts when the mailbox is full and is not being read by its owner. Ideally,
53772 it should be based on the last time that the user accessed the mailbox.
53773 However, it is not always possible to determine this. Exim uses the following
53774 heuristic rules:
53775 </para>
53776 <itemizedlist>
53777 <listitem>
53778 <para>
53779 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
53780 used. As no new messages are being delivered (because the mailbox is over
53781 quota), Exim does not access the file, so this is the time of last user access.
53782 </para>
53783 </listitem>
53784 <listitem>
53785 <para>
53786 <indexterm role="concept">
53787 <primary>maildir format</primary>
53788 <secondary>time of last read</secondary>
53789 </indexterm>
53790 For a maildir delivery, the time of last modification of the <filename>new</filename>
53791 subdirectory is used. As the mailbox is over quota, no new files are created in
53792 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
53793 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
53794 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
53795 time that is used is therefore the last time that the user read a new message.
53796 </para>
53797 </listitem>
53798 <listitem>
53799 <para>
53800 For other kinds of multi-file mailbox, the time of last access cannot be
53801 obtained, so a retry rule that uses this type of error field is never matched.
53802 </para>
53803 </listitem>
53804 </itemizedlist>
53805 <para>
53806 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
53807 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
53808 when a local delivery is deferred because a partition is full (the ENOSPC
53809 error).
53810 </para>
53811 </section>
53812 <section id="SECID162">
53813 <title>Retry rules for specified senders</title>
53814 <para>
53815 <indexterm role="concept">
53816 <primary>retry</primary>
53817 <secondary>rules; sender-specific</secondary>
53818 </indexterm>
53819 You can specify retry rules that apply only when the failing message has a
53820 specific sender. In particular, this can be used to define retry rules that
53821 apply only to bounce messages. The third item in a retry rule can be of this
53822 form:
53823 </para>
53824 <literallayout>
53825 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
53826 </literallayout>
53827 <para>
53828 The retry timings themselves are then the fourth item. For example:
53829 </para>
53830 <literallayout class="monospaced">
53831 *   rcpt_4xx   senders=:   F,1h,30m
53832 </literallayout>
53833 <para>
53834 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
53835 host. If the address list contains white space, it must be enclosed in quotes.
53836 For example:
53837 </para>
53838 <literallayout class="monospaced">
53839 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
53840 </literallayout>
53841 <para>
53842 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
53843 (which do not depend on the recipient). The reason is that the sender is used
53844 only to match the retry rule. Once the rule has been found for a host error,
53845 its contents are used to set a retry time for the host, and this will apply to
53846 all messages, not just those with specific senders.
53847 </para>
53848 <para>
53849 When testing retry rules using <option>-brt</option>, you can supply a sender using the
53850 <option>-f</option> command line option, like this:
53851 </para>
53852 <literallayout class="monospaced">
53853 exim -f "" -brt user@dom.ain
53854 </literallayout>
53855 <para>
53856 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
53857 list is never matched.
53858 </para>
53859 </section>
53860 <section id="SECID163">
53861 <title>Retry parameters</title>
53862 <para>
53863 <indexterm role="concept">
53864 <primary>retry</primary>
53865 <secondary>parameters in rules</secondary>
53866 </indexterm>
53867 The third (or fourth, if a senders list is present) field in a retry rule is a
53868 sequence of retry parameter sets, separated by semicolons. Each set consists of
53869 </para>
53870 <literallayout>
53871 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
53872 </literallayout>
53873 <para>
53874 The letter identifies the algorithm for computing a new retry time; the cutoff
53875 time is the time beyond which this algorithm no longer applies, and the
53876 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
53877 time that the first failure for the domain (combined with the local part if
53878 relevant) was detected, not from the time the message was received.
53879 </para>
53880 <para>
53881 <indexterm role="concept">
53882 <primary>retry</primary>
53883 <secondary>algorithms</secondary>
53884 </indexterm>
53885 <indexterm role="concept">
53886 <primary>retry</primary>
53887 <secondary>fixed intervals</secondary>
53888 </indexterm>
53889 <indexterm role="concept">
53890 <primary>retry</primary>
53891 <secondary>increasing intervals</secondary>
53892 </indexterm>
53893 <indexterm role="concept">
53894 <primary>retry</primary>
53895 <secondary>random intervals</secondary>
53896 </indexterm>
53897 The available algorithms are:
53898 </para>
53899 <itemizedlist>
53900 <listitem>
53901 <para>
53902 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
53903 the interval.
53904 </para>
53905 </listitem>
53906 <listitem>
53907 <para>
53908 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
53909 specifies a starting value for the interval, and the second a multiplier, which
53910 is used to increase the size of the interval at each retry.
53911 </para>
53912 </listitem>
53913 <listitem>
53914 <para>
53915 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
53916 retry, the previous interval is multiplied by the factor in order to get a
53917 maximum for the next interval. The minimum interval is the first argument of
53918 the parameter, and an actual interval is chosen randomly between them. Such a
53919 rule has been found to be helpful in cluster configurations when all the
53920 members of the cluster restart at once, and may therefore synchronize their
53921 queue processing times.
53922 </para>
53923 </listitem>
53924 </itemizedlist>
53925 <para>
53926 When computing the next retry time, the algorithm definitions are scanned in
53927 order until one whose cutoff time has not yet passed is reached. This is then
53928 used to compute a new retry time that is later than the current time. In the
53929 case of fixed interval retries, this simply means adding the interval to the
53930 current time. For geometrically increasing intervals, retry intervals are
53931 computed from the rule&#x2019;s parameters until one that is greater than the previous
53932 interval is found. The main configuration variable
53933 <indexterm role="concept">
53934 <primary>limit</primary>
53935 <secondary>retry interval</secondary>
53936 </indexterm>
53937 <indexterm role="concept">
53938 <primary>retry</primary>
53939 <secondary>interval, maximum</secondary>
53940 </indexterm>
53941 <indexterm role="option">
53942 <primary><option>retry_interval_max</option></primary>
53943 </indexterm>
53944 <option>retry_interval_max</option> limits the maximum interval between retries. It
53945 cannot be set greater than <literal>24h</literal>, which is its default value.
53946 </para>
53947 <para>
53948 A single remote domain may have a number of hosts associated with it, and each
53949 host may have more than one IP address. Retry algorithms are selected on the
53950 basis of the domain name, but are applied to each IP address independently. If,
53951 for example, a host has two IP addresses and one is unusable, Exim will
53952 generate retry times for it and will not try to use it until its next retry
53953 time comes. Thus the good IP address is likely to be tried first most of the
53954 time.
53955 </para>
53956 <para>
53957 <indexterm role="concept">
53958 <primary>hints database</primary>
53959 <secondary>use for retrying</secondary>
53960 </indexterm>
53961 Retry times are hints rather than promises. Exim does not make any attempt to
53962 run deliveries exactly at the computed times. Instead, a queue runner process
53963 starts delivery processes for delayed messages periodically, and these attempt
53964 new deliveries only for those addresses that have passed their next retry time.
53965 If a new message arrives for a deferred address, an immediate delivery attempt
53966 occurs only if the address has passed its retry time. In the absence of new
53967 messages, the minimum time between retries is the interval between queue runner
53968 processes. There is not much point in setting retry times of five minutes if
53969 your queue runners happen only once an hour, unless there are a significant
53970 number of incoming messages (which might be the case on a system that is
53971 sending everything to a smart host, for example).
53972 </para>
53973 <para>
53974 The data in the retry hints database can be inspected by using the
53975 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
53976 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
53977 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
53978 are for the hosts associated with a particular mail domain, and also for local
53979 deliveries that have been deferred.
53980 </para>
53981 </section>
53982 <section id="SECID164">
53983 <title>Retry rule examples</title>
53984 <para>
53985 Here are some example retry rules:
53986 </para>
53987 <literallayout class="monospaced">
53988 alice@wonderland.fict.example quota_5d  F,7d,3h
53989 wonderland.fict.example       quota_5d
53990 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
53991 lookingglass.fict.example     *         F,24h,30m;
53992 *                 refused_A   F,2h,20m;
53993 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
53994 </literallayout>
53995 <para>
53996 The first rule sets up special handling for mail to
53997 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
53998 mailbox has not been read for at least 5 days. Retries continue every three
53999 hours for 7 days. The second rule handles over-quota errors for all other local
54000 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
54001 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
54002 fail are bounced immediately if the mailbox has not been read for at least 5
54003 days.
54004 </para>
54005 <para>
54006 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
54007 happen every 15 minutes for an hour, then with geometrically increasing
54008 intervals until two days have passed since a delivery first failed. After the
54009 first hour there is a delay of one hour, then two hours, then four hours, and
54010 so on (this is a rather extreme example).
54011 </para>
54012 <para>
54013 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
54014 They happen every 30 minutes for 24 hours only. The remaining two rules handle
54015 all other domains, with special action for connection refusal from hosts that
54016 were not obtained from an MX record.
54017 </para>
54018 <para>
54019 The final rule in a retry configuration should always have asterisks in the
54020 first two fields so as to provide a general catch-all for any addresses that do
54021 not have their own special handling. This example tries every 15 minutes for 2
54022 hours, then with intervals starting at one hour and increasing by a factor of
54023 1.5 up to 16 hours, then every 8 hours up to 5 days.
54024 </para>
54025 </section>
54026 <section id="SECID165">
54027 <title>Timeout of retry data</title>
54028 <para>
54029 <indexterm role="concept">
54030 <primary>timeout</primary>
54031 <secondary>of retry data</secondary>
54032 </indexterm>
54033 <indexterm role="option">
54034 <primary><option>retry_data_expire</option></primary>
54035 </indexterm>
54036 <indexterm role="concept">
54037 <primary>hints database</primary>
54038 <secondary>data expiry</secondary>
54039 </indexterm>
54040 <indexterm role="concept">
54041 <primary>retry</primary>
54042 <secondary>timeout of data</secondary>
54043 </indexterm>
54044 Exim timestamps the data that it writes to its retry hints database. When it
54045 consults the data during a delivery it ignores any that is older than the value
54046 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
54047 been tried for 7 days, Exim will try to deliver to it immediately a message
54048 arrives, and if that fails, it will calculate a retry time as if it were
54049 failing for the first time.
54050 </para>
54051 <para>
54052 This improves the behaviour for messages routed to rarely-used hosts such as MX
54053 backups. If such a host was down at one time, and happens to be down again when
54054 Exim tries a month later, using the old retry data would imply that it had been
54055 down all the time, which is not a justified assumption.
54056 </para>
54057 <para>
54058 If a host really is permanently dead, this behaviour causes a burst of retries
54059 every now and again, but only if messages routed to it are rare. If there is a
54060 message at least once every 7 days the retry data never expires.
54061 </para>
54062 </section>
54063 <section id="SECID166">
54064 <title>Long-term failures</title>
54065 <para>
54066 <indexterm role="concept">
54067 <primary>delivery failure, long-term</primary>
54068 </indexterm>
54069 <indexterm role="concept">
54070 <primary>retry</primary>
54071 <secondary>after long-term failure</secondary>
54072 </indexterm>
54073 Special processing happens when an email address has been failing for so long
54074 that the cutoff time for the last algorithm is reached. For example, using the
54075 default retry rule:
54076 </para>
54077 <literallayout class="monospaced">
54078 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
54079 </literallayout>
54080 <para>
54081 the cutoff time is four days. Reaching the retry cutoff is independent of how
54082 long any specific message has been failing; it is the length of continuous
54083 failure for the recipient address that counts.
54084 </para>
54085 <para>
54086 When the cutoff time is reached for a local delivery, or for all the IP
54087 addresses associated with a remote delivery, a subsequent delivery failure
54088 causes Exim to give up on the address, and a bounce message is generated.
54089 In order to cater for new messages that use the failing address, a next retry
54090 time is still computed from the final algorithm, and is used as follows:
54091 </para>
54092 <para>
54093 For local deliveries, one delivery attempt is always made for any subsequent
54094 messages. If this delivery fails, the address fails immediately. The
54095 post-cutoff retry time is not used.
54096 </para>
54097 <para>
54098 <indexterm role="concept">
54099 <primary>final cutoff</primary>
54100 <secondary>retries, controlling</secondary>
54101 </indexterm>
54102 <indexterm role="concept">
54103 <primary>retry</primary>
54104 <secondary>final cutoff</secondary>
54105 </indexterm>
54106 If the delivery is remote, there are two possibilities, controlled by the
54107 <indexterm role="option">
54108 <primary><option>delay_after_cutoff</option></primary>
54109 </indexterm>
54110 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
54111 default. Until the post-cutoff retry time for one of the IP addresses,
54112 as set by the <option>retry_data_expire</option> option, is
54113 reached, the failing email address is bounced immediately, without a delivery
54114 attempt taking place. After that time, one new delivery attempt is made to
54115 those IP addresses that are past their retry times, and if that still fails,
54116 the address is bounced and new retry times are computed.
54117 </para>
54118 <para>
54119 In other words, when all the hosts for a given email address have been failing
54120 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
54121 times is reached. Then it tries once, and bounces if that attempt fails. This
54122 behaviour ensures that few resources are wasted in repeatedly trying to deliver
54123 to a broken destination, but if the host does recover, Exim will eventually
54124 notice.
54125 </para>
54126 <para>
54127 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
54128 addresses are past their final cutoff time, Exim tries to deliver to those IP
54129 addresses that have not been tried since the message arrived. If there are
54130 no suitable IP addresses, or if they all fail, the address is bounced. In other
54131 words, it does not delay when a new message arrives, but tries the expired
54132 addresses immediately, unless they have been tried since the message arrived.
54133 If there is a continuous stream of messages for the failing domains, setting
54134 <option>delay_after_cutoff</option> false means that there will be many more attempts to
54135 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
54136 true.
54137 </para>
54138 </section>
54139 <section id="SECID167">
54140 <title>Deliveries that work intermittently</title>
54141 <para>
54142 <indexterm role="concept">
54143 <primary>retry</primary>
54144 <secondary>intermittently working deliveries</secondary>
54145 </indexterm>
54146 Some additional logic is needed to cope with cases where a host is
54147 intermittently available, or when a message has some attribute that prevents
54148 its delivery when others to the same address get through. In this situation,
54149 because some messages are successfully delivered, the <quote>retry clock</quote> for the
54150 host or address keeps getting reset by the successful deliveries, and so
54151 failing messages remain in the queue for ever because the cutoff time is never
54152 reached.
54153 </para>
54154 <para>
54155 Two exceptional actions are applied to prevent this happening. The first
54156 applies to errors that are related to a message rather than a remote host.
54157 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
54158 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
54159 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
54160 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
54161 is used when scanning the retry rules to decide when to try next and when to
54162 time out the address.
54163 </para>
54164 <para>
54165 The exceptional second action applies in all cases. If a message has been on
54166 the queue for longer than the cutoff time of any applicable retry rule for a
54167 given address, a delivery is attempted for that address, even if it is not yet
54168 time, and if this delivery fails, the address is timed out. A new retry time is
54169 not computed in this case, so that other messages for the same address are
54170 considered immediately.
54171 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
54172 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
54173 </para>
54174 </section>
54175 </chapter>
54176
54177 <chapter id="CHAPSMTPAUTH">
54178 <title>SMTP authentication</title>
54179 <para>
54180 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
54181 <primary>SMTP</primary>
54182 <secondary>authentication configuration</secondary>
54183 </indexterm>
54184 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
54185 <primary>authentication</primary>
54186 </indexterm>
54187 The <quote>authenticators</quote> section of Exim&#x2019;s runtime configuration is concerned
54188 with SMTP authentication. This facility is an extension to the SMTP protocol,
54189 described in RFC 2554, which allows a client SMTP host to authenticate itself
54190 to a server. This is a common way for a server to recognize clients that are
54191 permitted to use it as a relay. SMTP authentication is not of relevance to the
54192 transfer of mail between servers that have no managerial connection with each
54193 other.
54194 </para>
54195 <para>
54196 The name of an authenticator is limited to be 64 ASCII characters long;
54197 prior to Exim 4.95 names would be silently truncated at this length, but now
54198 it is enforced.
54199 </para>
54200 <para>
54201 <indexterm role="concept">
54202 <primary>AUTH</primary>
54203 <secondary>description of</secondary>
54204 </indexterm>
54205 <indexterm role="concept">
54206 <primary>ESMTP extensions</primary>
54207 <secondary>AUTH</secondary>
54208 </indexterm>
54209 Very briefly, the way SMTP authentication works is as follows:
54210 </para>
54211 <orderedlist numeration="arabic">
54212 <listitem>
54213 <para>
54214 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
54215 the client&#x2019;s EHLO command.
54216 </para>
54217 </listitem>
54218 <listitem>
54219 <para>
54220 The client issues an AUTH command, naming a specific mechanism. The command
54221 may, optionally, contain some authentication data.
54222 </para>
54223 </listitem>
54224 <listitem>
54225 <para>
54226 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
54227 appropriate responses. In simple authentication mechanisms, the challenges are
54228 just prompts for user names and passwords. The server does not have to issue
54229 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
54230 with the AUTH command.
54231 </para>
54232 </listitem>
54233 <listitem>
54234 <para>
54235 The server either accepts or denies authentication.
54236 </para>
54237 </listitem>
54238 <listitem>
54239 <para>
54240 If authentication succeeds, the client may optionally make use of the AUTH
54241 option on the MAIL command to pass an authenticated sender in subsequent
54242 mail transactions. Authentication lasts for the remainder of the SMTP
54243 connection.
54244 </para>
54245 </listitem>
54246 <listitem>
54247 <para>
54248 If authentication fails, the client may give up, or it may try a different
54249 authentication mechanism, or it may try transferring mail over the
54250 unauthenticated connection.
54251 </para>
54252 </listitem>
54253 </orderedlist>
54254 <para>
54255 If you are setting up a client, and want to know which authentication
54256 mechanisms the server supports, you can use Telnet to connect to port 25 (the
54257 SMTP port) on the server, and issue an EHLO command. The response to this
54258 includes the list of supported mechanisms. For example:
54259 </para>
54260 <literallayout>
54261 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
54262 <literal>Trying 192.168.34.25...</literal>
54263 <literal>Connected to server.example.</literal>
54264 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
54265 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
54266 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
54267 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
54268 <literal>250-SIZE 52428800</literal>
54269 <literal>250-PIPELINING</literal>
54270 <literal>250-AUTH PLAIN</literal>
54271 <literal>250 HELP</literal>
54272 </literallayout>
54273 <para>
54274 The second-last line of this example output shows that the server supports
54275 authentication using the PLAIN mechanism. In Exim, the different authentication
54276 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
54277 routers and transports, which authenticators are included in the binary is
54278 controlled by build-time definitions. The following are currently available,
54279 included by setting
54280 </para>
54281 <literallayout class="monospaced">
54282 AUTH_CRAM_MD5=yes
54283 AUTH_CYRUS_SASL=yes
54284 AUTH_DOVECOT=yes
54285 AUTH_EXTERNAL=yes
54286 AUTH_GSASL=yes
54287 AUTH_HEIMDAL_GSSAPI=yes
54288 AUTH_PLAINTEXT=yes
54289 AUTH_SPA=yes
54290 AUTH_TLS=yes
54291 </literallayout>
54292 <para>
54293 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
54294 authentication mechanism (RFC 2195), and the second provides an interface to
54295 the Cyrus SASL authentication library.
54296 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
54297 work via a socket interface.
54298 The fourth provides for negotiation of authentication done via non-SMTP means,
54299 as defined by RFC 4422 Appendix A.
54300 The fifth provides an interface to the GNU SASL authentication library, which
54301 provides mechanisms but typically not data sources.
54302 The sixth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
54303 supporting setting a server keytab.
54304 The seventh can be configured to support
54305 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
54306 not formally documented, but used by several MUAs.
54307 The eighth authenticator
54308 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
54309 The last is an Exim authenticator but not an SMTP one;
54310 instead it can use information from a TLS negotiation.
54311 </para>
54312 <para>
54313 The authenticators are configured using the same syntax as other drivers (see
54314 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
54315 authentication section need be present in the configuration file. Each
54316 authenticator can in principle have both server and client functions. When Exim
54317 is receiving SMTP mail, it is acting as a server; when it is sending out
54318 messages over SMTP, it is acting as a client. Authenticator configuration
54319 options are provided for use in both these circumstances.
54320 </para>
54321 <para>
54322 To make it clear which options apply to which situation, the prefixes
54323 <option>server_</option> and <option>client_</option> are used on option names that are specific to
54324 either the server or the client function, respectively. Server and client
54325 functions are disabled if none of their options are set. If an authenticator is
54326 to be used for both server and client functions, a single definition, using
54327 both sets of options, is required. For example:
54328 </para>
54329 <literallayout class="monospaced">
54330 cram:
54331   driver = cram_md5
54332   public_name = CRAM-MD5
54333   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
54334   client_name = ph10
54335   client_secret = secret2
54336 </literallayout>
54337 <para>
54338 The <option>server_</option> option is used when Exim is acting as a server, and the
54339 <option>client_</option> options when it is acting as a client.
54340 </para>
54341 <para>
54342 Descriptions of the individual authenticators are given in subsequent chapters.
54343 The remainder of this chapter covers the generic options for the
54344 authenticators, followed by general discussion of the way authentication works
54345 in Exim.
54346 </para>
54347 <para>
54348 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
54349 per-mechanism basis.  Please read carefully to determine which variables hold
54350 account labels such as usercodes and which hold passwords or other
54351 authenticating data.
54352 </para>
54353 <para>
54354 Note that some mechanisms support two different identifiers for accounts: the
54355 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
54356 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
54357 Conceptually, authentication data such as passwords are tied to the identifier
54358 used to authenticate; servers may have rules to permit one user to act as a
54359 second user, so that after login the session is treated as though that second
54360 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
54361 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
54362 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
54363 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
54364 choose to honour.
54365 </para>
54366 <para>
54367 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
54368 to a client to help it select an account and credentials to use.  In some
54369 mechanisms, the client and server provably agree on the realm, but clients
54370 typically can not treat the realm as secure data to be blindly trusted.
54371 </para>
54372 <section id="SECID168">
54373 <title>Generic options for authenticators</title>
54374 <para>
54375 <indexterm role="concept">
54376 <primary>authentication</primary>
54377 <secondary>generic options</secondary>
54378 </indexterm>
54379 <indexterm role="concept">
54380 <primary>options</primary>
54381 <secondary>generic; for authenticators</secondary>
54382 </indexterm>
54383 </para>
54384 <para>
54385 <indexterm role="option">
54386 <primary><option>client_condition</option></primary>
54387 </indexterm>
54388 </para>
54389 <informaltable frame="all">
54390 <tgroup cols="4" colsep="0" rowsep="0">
54391 <colspec colwidth="8*" align="left"/>
54392 <colspec colwidth="6*" align="center"/>
54393 <colspec colwidth="6*" align="center"/>
54394 <colspec colwidth="6*" align="right"/>
54395 <tbody>
54396 <row>
54397 <entry><option>client_condition</option></entry>
54398 <entry>Use: <emphasis>authenticators</emphasis></entry>
54399 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54400 <entry>Default: <emphasis>unset</emphasis></entry>
54401 </row>
54402 </tbody>
54403 </tgroup>
54404 </informaltable>
54405 <para>
54406 When Exim is authenticating as a client, it skips any authenticator whose
54407 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
54408 used, for example, to skip plain text authenticators when the connection is not
54409 encrypted by a setting such as:
54410 </para>
54411 <literallayout class="monospaced">
54412 client_condition = ${if !eq{$tls_out_cipher}{}}
54413 </literallayout>
54414 <para>
54415 <indexterm role="option">
54416 <primary><option>client_set_id</option></primary>
54417 </indexterm>
54418 </para>
54419 <informaltable frame="all">
54420 <tgroup cols="4" colsep="0" rowsep="0">
54421 <colspec colwidth="8*" align="left"/>
54422 <colspec colwidth="6*" align="center"/>
54423 <colspec colwidth="6*" align="center"/>
54424 <colspec colwidth="6*" align="right"/>
54425 <tbody>
54426 <row>
54427 <entry><option>client_set_id</option></entry>
54428 <entry>Use: <emphasis>authenticators</emphasis></entry>
54429 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54430 <entry>Default: <emphasis>unset</emphasis></entry>
54431 </row>
54432 </tbody>
54433 </tgroup>
54434 </informaltable>
54435 <para>
54436 When client authentication succeeds, this condition is expanded; the
54437 result is used in the log lines for outbound messages.
54438 Typically it will be the user name used for authentication.
54439 </para>
54440 <para>
54441 <indexterm role="option">
54442 <primary><option>driver</option></primary>
54443 </indexterm>
54444 </para>
54445 <informaltable frame="all">
54446 <tgroup cols="4" colsep="0" rowsep="0">
54447 <colspec colwidth="8*" align="left"/>
54448 <colspec colwidth="6*" align="center"/>
54449 <colspec colwidth="6*" align="center"/>
54450 <colspec colwidth="6*" align="right"/>
54451 <tbody>
54452 <row>
54453 <entry><option>driver</option></entry>
54454 <entry>Use: <emphasis>authenticators</emphasis></entry>
54455 <entry>Type: <emphasis>string</emphasis></entry>
54456 <entry>Default: <emphasis>unset</emphasis></entry>
54457 </row>
54458 </tbody>
54459 </tgroup>
54460 </informaltable>
54461 <para>
54462 This option must always be set. It specifies which of the available
54463 authenticators is to be used.
54464 </para>
54465 <para>
54466 <indexterm role="option">
54467 <primary><option>public_name</option></primary>
54468 </indexterm>
54469 </para>
54470 <informaltable frame="all">
54471 <tgroup cols="4" colsep="0" rowsep="0">
54472 <colspec colwidth="8*" align="left"/>
54473 <colspec colwidth="6*" align="center"/>
54474 <colspec colwidth="6*" align="center"/>
54475 <colspec colwidth="6*" align="right"/>
54476 <tbody>
54477 <row>
54478 <entry><option>public_name</option></entry>
54479 <entry>Use: <emphasis>authenticators</emphasis></entry>
54480 <entry>Type: <emphasis>string</emphasis></entry>
54481 <entry>Default: <emphasis>unset</emphasis></entry>
54482 </row>
54483 </tbody>
54484 </tgroup>
54485 </informaltable>
54486 <para>
54487 This option specifies the name of the authentication mechanism that the driver
54488 implements, and by which it is known to the outside world. These names should
54489 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
54490 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
54491 defaults to the driver&#x2019;s instance name.
54492 </para>
54493 <para>
54494 <indexterm role="option">
54495 <primary><option>server_advertise_condition</option></primary>
54496 </indexterm>
54497 </para>
54498 <informaltable frame="all">
54499 <tgroup cols="4" colsep="0" rowsep="0">
54500 <colspec colwidth="8*" align="left"/>
54501 <colspec colwidth="6*" align="center"/>
54502 <colspec colwidth="6*" align="center"/>
54503 <colspec colwidth="6*" align="right"/>
54504 <tbody>
54505 <row>
54506 <entry><option>server_advertise_condition</option></entry>
54507 <entry>Use: <emphasis>authenticators</emphasis></entry>
54508 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54509 <entry>Default: <emphasis>unset</emphasis></entry>
54510 </row>
54511 </tbody>
54512 </tgroup>
54513 </informaltable>
54514 <para>
54515 When a server is about to advertise an authentication mechanism, the condition
54516 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
54517 mechanism is not advertised.
54518 If the expansion fails, the mechanism is not advertised. If the failure was not
54519 forced, and was not caused by a lookup defer, the incident is logged.
54520 See section <xref linkend="SECTauthexiser"/> below for further discussion.
54521 </para>
54522 <para>
54523 <indexterm role="option">
54524 <primary><option>server_condition</option></primary>
54525 </indexterm>
54526 </para>
54527 <informaltable frame="all">
54528 <tgroup cols="4" colsep="0" rowsep="0">
54529 <colspec colwidth="8*" align="left"/>
54530 <colspec colwidth="6*" align="center"/>
54531 <colspec colwidth="6*" align="center"/>
54532 <colspec colwidth="6*" align="right"/>
54533 <tbody>
54534 <row>
54535 <entry><option>server_condition</option></entry>
54536 <entry>Use: <emphasis>authenticators</emphasis></entry>
54537 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54538 <entry>Default: <emphasis>unset</emphasis></entry>
54539 </row>
54540 </tbody>
54541 </tgroup>
54542 </informaltable>
54543 <para>
54544 This option must be set for a <option>plaintext</option> server authenticator, where it
54545 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
54546 for details.
54547 </para>
54548 <para>
54549 For the <command>gsasl</command> authenticator, this option is required for various
54550 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
54551 </para>
54552 <para>
54553 For the other authenticators, <option>server_condition</option> can be used as an additional
54554 authentication or authorization mechanism that is applied after the other
54555 authenticator conditions succeed. If it is set, it is expanded when the
54556 authenticator would otherwise return a success code. If the expansion is forced
54557 to fail, authentication fails. Any other expansion failure causes a temporary
54558 error code to be returned. If the result of a successful expansion is an empty
54559 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
54560 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
54561 other result, a temporary error code is returned, with the expanded string as
54562 the error text.
54563 </para>
54564 <para>
54565 <indexterm role="option">
54566 <primary><option>server_debug_print</option></primary>
54567 </indexterm>
54568 </para>
54569 <informaltable frame="all">
54570 <tgroup cols="4" colsep="0" rowsep="0">
54571 <colspec colwidth="8*" align="left"/>
54572 <colspec colwidth="6*" align="center"/>
54573 <colspec colwidth="6*" align="center"/>
54574 <colspec colwidth="6*" align="right"/>
54575 <tbody>
54576 <row>
54577 <entry><option>server_debug_print</option></entry>
54578 <entry>Use: <emphasis>authenticators</emphasis></entry>
54579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54580 <entry>Default: <emphasis>unset</emphasis></entry>
54581 </row>
54582 </tbody>
54583 </tgroup>
54584 </informaltable>
54585 <para>
54586 If this option is set and authentication debugging is enabled (see the <option>-d</option>
54587 command line option), the string is expanded and included in the debugging
54588 output when the authenticator is run as a server. This can help with checking
54589 out the values of variables.
54590 If expansion of the string fails, the error message is written to the debugging
54591 output, and Exim carries on processing.
54592 </para>
54593 <para>
54594 <indexterm role="option">
54595 <primary><option>server_set_id</option></primary>
54596 </indexterm>
54597 </para>
54598 <informaltable frame="all">
54599 <tgroup cols="4" colsep="0" rowsep="0">
54600 <colspec colwidth="8*" align="left"/>
54601 <colspec colwidth="6*" align="center"/>
54602 <colspec colwidth="6*" align="center"/>
54603 <colspec colwidth="6*" align="right"/>
54604 <tbody>
54605 <row>
54606 <entry><option>server_set_id</option></entry>
54607 <entry>Use: <emphasis>authenticators</emphasis></entry>
54608 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54609 <entry>Default: <emphasis>unset</emphasis></entry>
54610 </row>
54611 </tbody>
54612 </tgroup>
54613 </informaltable>
54614 <para>
54615 <indexterm role="variable">
54616 <primary><varname>$authenticated_id</varname></primary>
54617 </indexterm>
54618 <indexterm role="variable">
54619 <primary><varname>$authenticated_fail_id</varname></primary>
54620 </indexterm>
54621 When an Exim server successfully authenticates a client, this string is
54622 expanded using data from the authentication, and preserved for any incoming
54623 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
54624 lines for incoming messages. For example, a user/password authenticator
54625 configuration might preserve the user name that was used to authenticate, and
54626 refer to it subsequently during delivery of the message.
54627 On a failing authentication the expansion result is instead saved in
54628 the <varname>$authenticated_fail_id</varname> variable.
54629 If expansion fails, the option is ignored.
54630 </para>
54631 <para>
54632 <indexterm role="option">
54633 <primary><option>server_mail_auth_condition</option></primary>
54634 </indexterm>
54635 </para>
54636 <informaltable frame="all">
54637 <tgroup cols="4" colsep="0" rowsep="0">
54638 <colspec colwidth="8*" align="left"/>
54639 <colspec colwidth="6*" align="center"/>
54640 <colspec colwidth="6*" align="center"/>
54641 <colspec colwidth="6*" align="right"/>
54642 <tbody>
54643 <row>
54644 <entry><option>server_mail_auth_condition</option></entry>
54645 <entry>Use: <emphasis>authenticators</emphasis></entry>
54646 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54647 <entry>Default: <emphasis>unset</emphasis></entry>
54648 </row>
54649 </tbody>
54650 </tgroup>
54651 </informaltable>
54652 <para>
54653 This option allows a server to discard authenticated sender addresses supplied
54654 as part of MAIL commands in SMTP connections that are authenticated by the
54655 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
54656 as part of the authentication process; instead its (unexpanded) value is
54657 remembered for later use.
54658 How it is used is described in the following section.
54659 </para>
54660 </section>
54661 <section id="SECTauthparamail">
54662 <title>The AUTH parameter on MAIL commands</title>
54663 <para>
54664 <indexterm role="concept">
54665 <primary>authentication</primary>
54666 <secondary>sender; authenticated</secondary>
54667 </indexterm>
54668 <indexterm role="concept">
54669 <primary>AUTH</primary>
54670 <secondary>on MAIL command</secondary>
54671 </indexterm>
54672 When a client supplied an AUTH= item on a MAIL command, Exim applies
54673 the following checks before accepting it as the authenticated sender of the
54674 message:
54675 </para>
54676 <itemizedlist>
54677 <listitem>
54678 <para>
54679 If the connection is not using extended SMTP (that is, HELO was used rather
54680 than EHLO), the use of AUTH= is a syntax error.
54681 </para>
54682 </listitem>
54683 <listitem>
54684 <para>
54685 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
54686 </para>
54687 </listitem>
54688 <listitem>
54689 <para>
54690 <indexterm role="variable">
54691 <primary><varname>$authenticated_sender</varname></primary>
54692 </indexterm>
54693 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
54694 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
54695 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
54696 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
54697 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
54698 given for the MAIL command.
54699 </para>
54700 </listitem>
54701 <listitem>
54702 <para>
54703 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
54704 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
54705 authenticated.
54706 </para>
54707 </listitem>
54708 <listitem>
54709 <para>
54710 If the AUTH= value was accepted by either of the two previous rules, and
54711 the client has authenticated, and the authenticator has a setting for the
54712 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
54713 valued that was saved from the authenticator is expanded. If the expansion
54714 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
54715 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
54716 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
54717 message.
54718 </para>
54719 </listitem>
54720 </itemizedlist>
54721 <para>
54722 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
54723 hosts to which Exim authenticates as a client. Do not confuse this value with
54724 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
54725 process, and which is not usually a complete email address.
54726 </para>
54727 <para>
54728 <indexterm role="variable">
54729 <primary><varname>$sender_address</varname></primary>
54730 </indexterm>
54731 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
54732 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
54733 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
54734 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
54735 ACL is run.
54736 </para>
54737 </section>
54738 <section id="SECTauthexiser">
54739 <title>Authentication on an Exim server</title>
54740 <para>
54741 <indexterm role="concept">
54742 <primary>authentication</primary>
54743 <secondary>on an Exim server</secondary>
54744 </indexterm>
54745 When Exim receives an EHLO command, it advertises the public names of those
54746 authenticators that are configured as servers, subject to the following
54747 conditions:
54748 </para>
54749 <itemizedlist>
54750 <listitem>
54751 <para>
54752 The client host must match <option>auth_advertise_hosts</option> (default *).
54753 </para>
54754 </listitem>
54755 <listitem>
54756 <para>
54757 If the <option>server_advertise_condition</option> option is set, its expansion must not
54758 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
54759 </para>
54760 </listitem>
54761 </itemizedlist>
54762 <para>
54763 The order in which the authenticators are defined controls the order in which
54764 the mechanisms are advertised.
54765 </para>
54766 <para>
54767 Some mail clients (for example, some versions of Netscape) require the user to
54768 provide a name and password for authentication whenever AUTH is advertised,
54769 even though authentication may not in fact be needed (for example, Exim may be
54770 set up to allow unconditional relaying from the client by an IP address check).
54771 You can make such clients more friendly by not advertising AUTH to them.
54772 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
54773 that runs for RCPT) to relay without authentication, you should set
54774 </para>
54775 <literallayout class="monospaced">
54776 auth_advertise_hosts = ! 10.9.8.0/24
54777 </literallayout>
54778 <para>
54779 so that no authentication mechanisms are advertised to them.
54780 </para>
54781 <para>
54782 The <option>server_advertise_condition</option> controls the advertisement of individual
54783 authentication mechanisms. For example, it can be used to restrict the
54784 advertisement of a particular mechanism to encrypted connections, by a setting
54785 such as:
54786 </para>
54787 <literallayout class="monospaced">
54788 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
54789 </literallayout>
54790 <para>
54791 <indexterm role="variable">
54792 <primary><varname>$tls_in_cipher</varname></primary>
54793 </indexterm>
54794 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
54795 yields <quote>yes</quote>, which allows the advertisement to happen.
54796 </para>
54797 <para>
54798 When an Exim server receives an AUTH command from a client, it rejects it
54799 immediately if AUTH was not advertised in response to an earlier EHLO
54800 command. This is the case if
54801 </para>
54802 <itemizedlist>
54803 <listitem>
54804 <para>
54805 The client host does not match <option>auth_advertise_hosts</option>; or
54806 </para>
54807 </listitem>
54808 <listitem>
54809 <para>
54810 No authenticators are configured with server options; or
54811 </para>
54812 </listitem>
54813 <listitem>
54814 <para>
54815 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
54816 server authenticators.
54817 </para>
54818 </listitem>
54819 </itemizedlist>
54820 <para>
54821 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
54822 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
54823 AUTH is accepted from any client host.
54824 </para>
54825 <para>
54826 If AUTH is not rejected by the ACL, Exim searches its configuration for a
54827 server authentication mechanism that was advertised in response to EHLO and
54828 that matches the one named in the AUTH command. If it finds one, it runs
54829 the appropriate authentication protocol, and authentication either succeeds or
54830 fails. If there is no matching advertised mechanism, the AUTH command is
54831 rejected with a 504 error.
54832 </para>
54833 <para>
54834 <indexterm role="variable">
54835 <primary><varname>$received_protocol</varname></primary>
54836 </indexterm>
54837 <indexterm role="variable">
54838 <primary><varname>$sender_host_authenticated</varname></primary>
54839 </indexterm>
54840 When a message is received from an authenticated host, the value of
54841 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
54842 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
54843 public name) of the authenticator driver that successfully authenticated the
54844 client from which the message was received. This variable is empty if there was
54845 no successful authentication.
54846 </para>
54847 <para>
54848 <indexterm role="concept">
54849 <primary>authentication</primary>
54850 <secondary>expansion item</secondary>
54851 </indexterm>
54852 Successful authentication sets up information used by the
54853 <option>authresults</option> expansion item.
54854 </para>
54855 <para revisionflag="changed">
54856 <indexterm role="concept">
54857 <primary>authentication</primary>
54858 <secondary>failure event, server</secondary>
54859 </indexterm>
54860 If an authenticator is run and does not succeed,
54861 an event (see <xref linkend="CHAPevents"/>) of type "auth:fail" is raised.
54862 While the event is being processed the variables
54863 <varname>$sender_host_authenticated</varname> (with the authenticator name)
54864 and <varname>$authenticated_fail_id</varname> (as set by the authenticator <option>server_set_id</option> option)
54865 will be valid.
54866 If the event is serviced and a string is returned then the string will be logged
54867 instead of the default log line.
54868 See &lt;&lt;CHAPevents&gt;&gt; for details on events.
54869 </para>
54870 </section>
54871 <section id="SECID169">
54872 <title>Testing server authentication</title>
54873 <para>
54874 <indexterm role="concept">
54875 <primary>authentication</primary>
54876 <secondary>testing a server</secondary>
54877 </indexterm>
54878 <indexterm role="concept">
54879 <primary>AUTH</primary>
54880 <secondary>testing a server</secondary>
54881 </indexterm>
54882 <indexterm role="concept">
54883 <primary>base64 encoding</primary>
54884 <secondary>creating authentication test data</secondary>
54885 </indexterm>
54886 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
54887 configurations. The data for the AUTH command has to be sent using base64
54888 encoding. A quick way to produce such data for testing is the following Perl
54889 script:
54890 </para>
54891 <literallayout class="monospaced">
54892 use MIME::Base64;
54893 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
54894 </literallayout>
54895 <para>
54896 <indexterm role="concept">
54897 <primary>binary zero</primary>
54898 <secondary>in authentication data</secondary>
54899 </indexterm>
54900 This interprets its argument as a Perl string, and then encodes it. The
54901 interpretation as a Perl string allows binary zeros, which are required for
54902 some kinds of authentication, to be included in the data. For example, a
54903 command line to run this script on such data might be
54904 </para>
54905 <literallayout class="monospaced">
54906 encode '\0user\0password'
54907 </literallayout>
54908 <para>
54909 Note the use of single quotes to prevent the shell interpreting the
54910 backslashes, so that they can be interpreted by Perl to specify characters
54911 whose code value is zero.
54912 </para>
54913 <para>
54914 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
54915 digit, you must use three zeros instead of one after the leading backslash. If
54916 you do not, the octal digit that starts your string will be incorrectly
54917 interpreted as part of the code for the first character.
54918 </para>
54919 <para>
54920 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
54921 specially, you must use a Perl escape to prevent them being misinterpreted. For
54922 example, a command such as
54923 </para>
54924 <literallayout class="monospaced">
54925 encode '\0user@domain.com\0pas$$word'
54926 </literallayout>
54927 <para>
54928 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
54929 </para>
54930 <para>
54931 If you have the <option>mimencode</option> command installed, another way to produce
54932 base64-encoded strings is to run the command
54933 </para>
54934 <literallayout class="monospaced">
54935 echo -e -n `\0user\0password' | mimencode
54936 </literallayout>
54937 <para>
54938 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
54939 in the argument, and the <option>-n</option> option specifies no newline at the end of its
54940 output. However, not all versions of <option>echo</option> recognize these options, so you
54941 should check your version before relying on this suggestion.
54942 </para>
54943 </section>
54944 <section id="SECID170">
54945 <title>Authentication by an Exim client</title>
54946 <para>
54947 <indexterm role="concept">
54948 <primary>authentication</primary>
54949 <secondary>on an Exim client</secondary>
54950 </indexterm>
54951 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
54952 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
54953 announces support for authentication, and the host matches an entry in either
54954 of these options, Exim (as a client) tries to authenticate as follows:
54955 </para>
54956 <itemizedlist>
54957 <listitem>
54958 <para>
54959 For each authenticator that is configured as a client, in the order in which
54960 they are defined in the configuration, it searches the authentication
54961 mechanisms announced by the server for one whose name matches the public name
54962 of the authenticator.
54963 </para>
54964 </listitem>
54965 <listitem>
54966 <para>
54967 <indexterm role="variable">
54968 <primary><varname>$host</varname></primary>
54969 </indexterm>
54970 <indexterm role="variable">
54971 <primary><varname>$host_address</varname></primary>
54972 </indexterm>
54973 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
54974 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
54975 that the client might do. They are set to the server&#x2019;s name and IP address. If
54976 any expansion is forced to fail, the authentication attempt is abandoned, and
54977 Exim moves on to the next authenticator. Otherwise an expansion failure causes
54978 delivery to be deferred.
54979 </para>
54980 </listitem>
54981 <listitem>
54982 <para>
54983 If the result of the authentication attempt is a temporary error or a timeout,
54984 Exim abandons trying to send the message to the host for the moment. It will
54985 try again later. If there are any backup hosts available, they are tried in the
54986 usual way.
54987 </para>
54988 </listitem>
54989 <listitem>
54990 <para revisionflag="changed">
54991 <indexterm role="concept">
54992 <primary>authentication</primary>
54993 <secondary>failure event, client</secondary>
54994 </indexterm>
54995 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code),
54996 an event (see <xref linkend="CHAPevents"/>) of type "auth:fail" is raised.
54997 While the event is being processed the variable
54998 <varname>$sender_host_authenticated</varname> (with the authenticator name)
54999 will be valid.
55000 If the event is serviced and a string is returned then the string will be logged.
55001 See &lt;&lt;CHAPevents&gt;&gt; for details on events.
55002 </para>
55003 </listitem>
55004 <listitem>
55005 <para>
55006 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
55007 carries on searching the list of authenticators and tries another one if
55008 possible. If all authentication attempts give permanent errors, or if there are
55009 no attempts because no mechanisms match (or option expansions force failure),
55010 what happens depends on whether the host matches <option>hosts_require_auth</option> or
55011 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
55012 delivery is deferred. The error can be detected in the retry rules, and thereby
55013 turned into a permanent error if you wish. In the second case, Exim tries to
55014 deliver the message unauthenticated.
55015 </para>
55016 </listitem>
55017 </itemizedlist>
55018 <para>
55019 Note that the hostlist test for whether to do authentication can be
55020 confused if name-IP lookups change between the time the peer is decided
55021 upon and the time that the transport runs.  For example, with a manualroute
55022 router given a host name, and with DNS "round-robin" used by that name: if
55023 the local resolver cache times out between the router and the transport
55024 running, the transport may get an IP for the name for its authentication
55025 check which does not match the connection peer IP.
55026 No authentication will then be done, despite the names being identical.
55027 </para>
55028 <para>
55029 For such cases use a separate transport which always authenticates.
55030 </para>
55031 <para>
55032 <indexterm role="concept">
55033 <primary>AUTH</primary>
55034 <secondary>on MAIL command</secondary>
55035 </indexterm>
55036 When Exim has authenticated itself to a remote server, it adds the AUTH
55037 parameter to the MAIL commands it sends, if it has an authenticated sender for
55038 the message. If the message came from a remote host, the authenticated sender
55039 is the one that was receiving on an incoming MAIL command, provided that the
55040 incoming connection was authenticated and the <option>server_mail_auth</option> condition
55041 allowed the authenticated sender to be retained. If a local process calls Exim
55042 to send a message, the sender address that is built from the login name and
55043 <option>qualify_domain</option> is treated as authenticated. However, if the
55044 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
55045 the authenticated sender that was received with the message.
55046 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
55047 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
55048 </para>
55049 </section>
55050 </chapter>
55051
55052 <chapter id="CHAPplaintext">
55053 <title>The plaintext authenticator</title>
55054 <para>
55055 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
55056 <primary><command>plaintext</command> authenticator</primary>
55057 </indexterm>
55058 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
55059 <primary>authenticators</primary>
55060 <secondary><command>plaintext</command></secondary>
55061 </indexterm>
55062 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
55063 LOGIN authentication mechanisms, both of which transfer authentication data as
55064 plain (unencrypted) text (though base64 encoded). The use of plain text is a
55065 security risk; you are strongly advised to insist on the use of SMTP encryption
55066 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
55067 use unencrypted plain text, you should not use the same passwords for SMTP
55068 connections as you do for login accounts.
55069 </para>
55070 <section id="SECTplain_TLS">
55071 <title>Avoiding cleartext use</title>
55072 <para>
55073 The following generic option settings will disable <command>plaintext</command> authenticators when
55074 TLS is not being used:
55075 </para>
55076 <literallayout class="monospaced">
55077   server_advertise_condition = ${if def:tls_in_cipher }
55078   client_condition =           ${if def:tls_out_cipher}
55079 </literallayout>
55080 <para>
55081 <emphasis role="bold">Note</emphasis>: a plaintext SMTP AUTH done inside TLS is not vulnerable to casual snooping,
55082 but is still vulnerable to a Man In The Middle attack unless certificates
55083 (including their names) have been properly verified.
55084 </para>
55085 </section>
55086 <section id="SECID171">
55087 <title>Plaintext server options</title>
55088 <para>
55089 <indexterm role="concept">
55090 <primary>options</primary>
55091 <secondary><command>plaintext</command> authenticator (server)</secondary>
55092 </indexterm>
55093 When configured as a server, <command>plaintext</command> uses the following options:
55094 </para>
55095 <para>
55096 <indexterm role="option">
55097 <primary><option>server_condition</option></primary>
55098 </indexterm>
55099 </para>
55100 <informaltable frame="all">
55101 <tgroup cols="4" colsep="0" rowsep="0">
55102 <colspec colwidth="8*" align="left"/>
55103 <colspec colwidth="6*" align="center"/>
55104 <colspec colwidth="6*" align="center"/>
55105 <colspec colwidth="6*" align="right"/>
55106 <tbody>
55107 <row>
55108 <entry><option>server_condition</option></entry>
55109 <entry>Use: <emphasis>authenticators</emphasis></entry>
55110 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55111 <entry>Default: <emphasis>unset</emphasis></entry>
55112 </row>
55113 </tbody>
55114 </tgroup>
55115 </informaltable>
55116 <para>
55117 This is actually a global authentication option, but it must be set in order to
55118 configure the <command>plaintext</command> driver as a server. Its use is described below.
55119 </para>
55120 <para>
55121 <indexterm role="option">
55122 <primary><option>server_prompts</option></primary>
55123 </indexterm>
55124 </para>
55125 <informaltable frame="all">
55126 <tgroup cols="4" colsep="0" rowsep="0">
55127 <colspec colwidth="8*" align="left"/>
55128 <colspec colwidth="6*" align="center"/>
55129 <colspec colwidth="6*" align="center"/>
55130 <colspec colwidth="6*" align="right"/>
55131 <tbody>
55132 <row>
55133 <entry><option>server_prompts</option></entry>
55134 <entry>Use: <emphasis>plaintext</emphasis></entry>
55135 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
55136 <entry>Default: <emphasis>unset</emphasis></entry>
55137 </row>
55138 </tbody>
55139 </tgroup>
55140 </informaltable>
55141 <para>
55142 The contents of this option, after expansion, must be a colon-separated list of
55143 prompt strings. If expansion fails, a temporary authentication rejection is
55144 given.
55145 </para>
55146 </section>
55147 <section id="SECTplainserver">
55148 <title>Using plaintext in a server</title>
55149 <para>
55150 <indexterm role="concept">
55151 <primary>AUTH</primary>
55152 <secondary>in <command>plaintext</command> authenticator</secondary>
55153 </indexterm>
55154 <indexterm role="concept">
55155 <primary>binary zero</primary>
55156 <secondary>in <command>plaintext</command> authenticator</secondary>
55157 </indexterm>
55158 <indexterm role="concept">
55159 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55160 <secondary>in <command>plaintext</command> authenticator</secondary>
55161 </indexterm>
55162 <indexterm role="variable">
55163 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
55164 </indexterm>
55165 <indexterm role="concept">
55166 <primary>base64 encoding</primary>
55167 <secondary>in <command>plaintext</command> authenticator</secondary>
55168 </indexterm>
55169 </para>
55170 <para>
55171 When running as a server, <command>plaintext</command> performs the authentication test by
55172 expanding a string. The data sent by the client with the AUTH command, or in
55173 response to subsequent prompts, is base64 encoded, and so may contain any byte
55174 values when decoded. If any data is supplied with the command, it is treated as
55175 a list of strings, separated by NULs (binary zeros), the first three of which
55176 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
55177 (neither LOGIN nor PLAIN uses more than three strings).
55178 </para>
55179 <para>
55180 For compatibility with previous releases of Exim, the values are also placed in
55181 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
55182 variables for this purpose is now deprecated, as it can lead to confusion in
55183 string expansions that also use them for other things.
55184 </para>
55185 <para>
55186 If there are more strings in <option>server_prompts</option> than the number of strings
55187 supplied with the AUTH command, the remaining prompts are used to obtain more
55188 data. Each response from the client may be a list of NUL-separated strings.
55189 </para>
55190 <para>
55191 <indexterm role="variable">
55192 <primary><varname>$authenticated_id</varname></primary>
55193 </indexterm>
55194 Once a sufficient number of data strings have been received,
55195 <option>server_condition</option> is expanded. If the expansion is forced to fail,
55196 authentication fails. Any other expansion failure causes a temporary error code
55197 to be returned. If the result of a successful expansion is an empty string,
55198 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
55199 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
55200 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
55201 For any other result, a temporary error code is returned, with the expanded
55202 string as the error text.
55203 </para>
55204 <para>
55205 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
55206 password, be sure to make the authentication fail if the user is unknown.
55207 There are good and bad examples at the end of the next section.
55208 </para>
55209 </section>
55210 <section id="SECID172">
55211 <title>The PLAIN authentication mechanism</title>
55212 <para>
55213 <indexterm role="concept">
55214 <primary>PLAIN authentication mechanism</primary>
55215 </indexterm>
55216 <indexterm role="concept">
55217 <primary>authentication</primary>
55218 <secondary>PLAIN</secondary>
55219 </indexterm>
55220 <indexterm role="concept">
55221 <primary>binary zero</primary>
55222 <secondary>in <command>plaintext</command> authenticator</secondary>
55223 </indexterm>
55224 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
55225 sent as one item of data (that is, one combined string containing two NUL
55226 separators). The data is sent either as part of the AUTH command, or
55227 subsequently in response to an empty prompt from the server.
55228 </para>
55229 <para>
55230 The second and third strings are a user name and a corresponding password.
55231 Using a single fixed user name and password as an example, this could be
55232 configured as follows:
55233 </para>
55234 <literallayout class="monospaced">
55235 fixed_plain:
55236   driver = plaintext
55237   public_name = PLAIN
55238   server_prompts = :
55239   server_condition = \
55240     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
55241   server_set_id = $auth2
55242 </literallayout>
55243 <para>
55244 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
55245 are exactly what we want here, so they need not be specified. Obviously, if the
55246 password contains expansion-significant characters such as dollar, backslash,
55247 or closing brace, they have to be escaped.
55248 </para>
55249 <para>
55250 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
55251 the end of a string list are ignored). If all the data comes as part of the
55252 AUTH command, as is commonly the case, the prompt is not used. This
55253 authenticator is advertised in the response to EHLO as
55254 </para>
55255 <literallayout class="monospaced">
55256 250-AUTH PLAIN
55257 </literallayout>
55258 <para>
55259 and a client host can authenticate itself by sending the command
55260 </para>
55261 <literallayout class="monospaced">
55262 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
55263 </literallayout>
55264 <para>
55265 As this contains three strings (more than the number of prompts), no further
55266 data is required from the client. Alternatively, the client may just send
55267 </para>
55268 <literallayout class="monospaced">
55269 AUTH PLAIN
55270 </literallayout>
55271 <para>
55272 to initiate authentication, in which case the server replies with an empty
55273 prompt. The client must respond with the combined data string.
55274 </para>
55275 <para>
55276 The data string is base64 encoded, as required by the RFC. This example,
55277 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;
55278 represents a zero byte. This is split up into three strings, the first of which
55279 is empty. The <option>server_condition</option> option in the authenticator checks that the
55280 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
55281 </para>
55282 <para>
55283 Having just one fixed user name and password, as in this example, is not very
55284 realistic, though for a small organization with only a handful of
55285 authenticating clients it could make sense.
55286 </para>
55287 <para>
55288 A more sophisticated instance of this authenticator could use the user name in
55289 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
55290 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
55291 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
55292 This is an incorrect example:
55293 </para>
55294 <literallayout class="monospaced">
55295 server_condition = \
55296   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
55297 </literallayout>
55298 <para>
55299 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
55300 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
55301 incorrect? It works fine for existing users, but consider what happens if a
55302 non-existent user name is given. The lookup fails, but as no success/failure
55303 strings are given for the lookup, it yields an empty string. Thus, to defeat
55304 the authentication, all a client has to do is to supply a non-existent user
55305 name and an empty password. The correct way of writing this test is:
55306 </para>
55307 <literallayout class="monospaced">
55308 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
55309   {${if eq{$value}{$auth3}}} {false}}
55310 </literallayout>
55311 <para>
55312 In this case, if the lookup succeeds, the result is checked; if the lookup
55313 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
55314 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
55315 always fails if its second argument is empty. However, the second way of
55316 writing the test makes the logic clearer.
55317 </para>
55318 </section>
55319 <section id="SECID173">
55320 <title>The LOGIN authentication mechanism</title>
55321 <para>
55322 <indexterm role="concept">
55323 <primary>LOGIN authentication mechanism</primary>
55324 </indexterm>
55325 <indexterm role="concept">
55326 <primary>authentication</primary>
55327 <secondary>LOGIN</secondary>
55328 </indexterm>
55329 The LOGIN authentication mechanism is not documented in any RFC, but is in use
55330 in a number of programs. No data is sent with the AUTH command. Instead, a
55331 user name and password are supplied separately, in response to prompts. The
55332 plaintext authenticator can be configured to support this as in this example:
55333 </para>
55334 <literallayout class="monospaced">
55335 fixed_login:
55336   driver = plaintext
55337   public_name = LOGIN
55338   server_prompts = User Name : Password
55339   server_condition = \
55340     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
55341   server_set_id = $auth1
55342 </literallayout>
55343 <para>
55344 Because of the way plaintext operates, this authenticator accepts data supplied
55345 with the AUTH command (in contravention of the specification of LOGIN), but
55346 if the client does not supply it (as is the case for LOGIN clients), the prompt
55347 strings are used to obtain two data items.
55348 </para>
55349 <para>
55350 Some clients are very particular about the precise text of the prompts. For
55351 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
55352 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
55353 strings. It uses the <option>ldapauth</option> expansion condition to check the user
55354 name and password by binding to an LDAP server:
55355 </para>
55356 <literallayout class="monospaced">
55357 login:
55358   driver = plaintext
55359   public_name = LOGIN
55360   server_prompts = Username:: : Password::
55361   server_condition = ${if and{{ \
55362     !eq{}{$auth1} }{ \
55363     ldapauth{\
55364       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
55365       pass=${quote:$auth2} \
55366       ldap://ldap.example.org/} }} }
55367   server_set_id = uid=$auth1,ou=people,o=example.org
55368 </literallayout>
55369 <para>
55370 We have to check that the username is not empty before using it, because LDAP
55371 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
55372 operator to correctly quote the DN for authentication. However, the basic
55373 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
55374 correct one to use for the password, because quoting is needed only to make
55375 the password conform to the Exim syntax. At the LDAP level, the password is an
55376 uninterpreted string.
55377 </para>
55378 </section>
55379 <section id="SECID174">
55380 <title>Support for different kinds of authentication</title>
55381 <para>
55382 A number of string expansion features are provided for the purpose of
55383 interfacing to different ways of user authentication. These include checking
55384 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
55385 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
55386 <xref linkend="SECTexpcond"/>.
55387 </para>
55388 </section>
55389 <section id="SECID175">
55390 <title>Using plaintext in a client</title>
55391 <para>
55392 <indexterm role="concept">
55393 <primary>options</primary>
55394 <secondary><command>plaintext</command> authenticator (client)</secondary>
55395 </indexterm>
55396 The <command>plaintext</command> authenticator has two client options:
55397 </para>
55398 <para>
55399 <indexterm role="option">
55400 <primary><option>client_ignore_invalid_base64</option></primary>
55401 </indexterm>
55402 </para>
55403 <informaltable frame="all">
55404 <tgroup cols="4" colsep="0" rowsep="0">
55405 <colspec colwidth="8*" align="left"/>
55406 <colspec colwidth="6*" align="center"/>
55407 <colspec colwidth="6*" align="center"/>
55408 <colspec colwidth="6*" align="right"/>
55409 <tbody>
55410 <row>
55411 <entry><option>client_ignore_invalid_base64</option></entry>
55412 <entry>Use: <emphasis>plaintext</emphasis></entry>
55413 <entry>Type: <emphasis>boolean</emphasis></entry>
55414 <entry>Default: <emphasis>false</emphasis></entry>
55415 </row>
55416 </tbody>
55417 </tgroup>
55418 </informaltable>
55419 <para>
55420 If the client receives a server prompt that is not a valid base64 string,
55421 authentication is abandoned by default. However, if this option is set true,
55422 the error in the challenge is ignored and the client sends the response as
55423 usual.
55424 </para>
55425 <para>
55426 <indexterm role="option">
55427 <primary><option>client_send</option></primary>
55428 </indexterm>
55429 </para>
55430 <informaltable frame="all">
55431 <tgroup cols="4" colsep="0" rowsep="0">
55432 <colspec colwidth="8*" align="left"/>
55433 <colspec colwidth="6*" align="center"/>
55434 <colspec colwidth="6*" align="center"/>
55435 <colspec colwidth="6*" align="right"/>
55436 <tbody>
55437 <row>
55438 <entry><option>client_send</option></entry>
55439 <entry>Use: <emphasis>plaintext</emphasis></entry>
55440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55441 <entry>Default: <emphasis>unset</emphasis></entry>
55442 </row>
55443 </tbody>
55444 </tgroup>
55445 </informaltable>
55446 <para>
55447 The string is a colon-separated list of authentication data strings. Each
55448 string is independently expanded before being sent to the server. The first
55449 string is sent with the AUTH command; any more strings are sent in response
55450 to prompts from the server. Before each string is expanded, the value of the
55451 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
55452 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
55453 way. Thus, the prompt that is received in response to sending the first string
55454 (with the AUTH command) can be used in the expansion of the second string, and
55455 so on. If an invalid base64 string is received when
55456 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
55457 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
55458 </para>
55459 <para>
55460 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
55461 splitting takes priority and happens first.
55462 </para>
55463 <para>
55464 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
55465 the data, further processing is applied to each string before it is sent. If
55466 there are any single circumflex characters in the string, they are converted to
55467 NULs. Should an actual circumflex be required as data, it must be doubled in
55468 the string.
55469 </para>
55470 <para>
55471 This is an example of a client configuration that implements the PLAIN
55472 authentication mechanism with a fixed user name and password:
55473 </para>
55474 <literallayout class="monospaced">
55475 fixed_plain:
55476   driver = plaintext
55477   public_name = PLAIN
55478   client_send = ^username^mysecret
55479 </literallayout>
55480 <para>
55481 The lack of colons means that the entire text is sent with the AUTH
55482 command, with the circumflex characters converted to NULs.
55483 Note that due to the ambiguity of parsing three consectutive circumflex characters
55484 there is no way to provide a password having a leading circumflex.
55485 </para>
55486 <para>
55487 A similar example
55488 that uses the LOGIN mechanism is:
55489 </para>
55490 <literallayout class="monospaced">
55491 fixed_login:
55492   driver = plaintext
55493   public_name = LOGIN
55494   client_send = : username : mysecret
55495 </literallayout>
55496 <para>
55497 The initial colon means that the first string is empty, so no data is sent with
55498 the AUTH command itself. The remaining strings are sent in response to
55499 prompts.
55500 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
55501 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
55502 </para>
55503 </section>
55504 </chapter>
55505
55506 <chapter id="CHID9">
55507 <title>The cram_md5 authenticator</title>
55508 <para>
55509 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
55510 <primary><command>cram_md5</command> authenticator</primary>
55511 </indexterm>
55512 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
55513 <primary>authenticators</primary>
55514 <secondary><command>cram_md5</command></secondary>
55515 </indexterm>
55516 <indexterm role="concept">
55517 <primary>CRAM-MD5 authentication mechanism</primary>
55518 </indexterm>
55519 <indexterm role="concept">
55520 <primary>authentication</primary>
55521 <secondary>CRAM-MD5</secondary>
55522 </indexterm>
55523 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
55524 sends a challenge string to the client, and the response consists of a user
55525 name and the CRAM-MD5 digest of the challenge string combined with a secret
55526 string (password) which is known to both server and client. Thus, the secret
55527 is not sent over the network as plain text, which makes this authenticator more
55528 secure than <command>plaintext</command>. However, the downside is that the secret has to be
55529 available in plain text at either end.
55530 </para>
55531 <section id="SECID176">
55532 <title>Using cram_md5 as a server</title>
55533 <para>
55534 <indexterm role="concept">
55535 <primary>options</primary>
55536 <secondary><command>cram_md5</command> authenticator (server)</secondary>
55537 </indexterm>
55538 This authenticator has one server option, which must be set to configure the
55539 authenticator as a server:
55540 </para>
55541 <para>
55542 <indexterm role="option">
55543 <primary><option>server_secret</option></primary>
55544 </indexterm>
55545 </para>
55546 <informaltable frame="all">
55547 <tgroup cols="4" colsep="0" rowsep="0">
55548 <colspec colwidth="8*" align="left"/>
55549 <colspec colwidth="6*" align="center"/>
55550 <colspec colwidth="6*" align="center"/>
55551 <colspec colwidth="6*" align="right"/>
55552 <tbody>
55553 <row>
55554 <entry><option>server_secret</option></entry>
55555 <entry>Use: <emphasis>cram_md5</emphasis></entry>
55556 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55557 <entry>Default: <emphasis>unset</emphasis></entry>
55558 </row>
55559 </tbody>
55560 </tgroup>
55561 </informaltable>
55562 <para>
55563 <indexterm role="concept">
55564 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55565 <secondary>in <command>cram_md5</command> authenticator</secondary>
55566 </indexterm>
55567 When the server receives the client&#x2019;s response, the user name is placed in
55568 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
55569 obtain the password for that user. The server then computes the CRAM-MD5 digest
55570 that the client should have sent, and checks that it received the correct
55571 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
55572 fails. If the expansion fails for some other reason, a temporary error code is
55573 returned to the client.
55574 </para>
55575 <para>
55576 For compatibility with previous releases of Exim, the user name is also placed
55577 in <varname>$1</varname>. However, the use of this variables for this purpose is now
55578 deprecated, as it can lead to confusion in string expansions that also use
55579 numeric variables for other things.
55580 </para>
55581 <para>
55582 For example, the following authenticator checks that the user name given by the
55583 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
55584 user name, authentication fails.
55585 </para>
55586 <literallayout class="monospaced">
55587 fixed_cram:
55588   driver = cram_md5
55589   public_name = CRAM-MD5
55590   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
55591   server_set_id = $auth1
55592 </literallayout>
55593 <para>
55594 <indexterm role="variable">
55595 <primary><varname>$authenticated_id</varname></primary>
55596 </indexterm>
55597 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
55598 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
55599 secret string in a file, using the user name as the key. For example:
55600 </para>
55601 <literallayout class="monospaced">
55602 lookup_cram:
55603   driver = cram_md5
55604   public_name = CRAM-MD5
55605   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
55606                   {$value}fail}
55607   server_set_id = $auth1
55608 </literallayout>
55609 <para>
55610 Note that this expansion explicitly forces failure if the lookup fails
55611 because <varname>$auth1</varname> contains an unknown user name.
55612 </para>
55613 <para>
55614 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
55615 using the relevant libraries, you need to know the realm to specify in the
55616 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
55617 realm, with:
55618 </para>
55619 <literallayout class="monospaced">
55620 cyrusless_crammd5:
55621   driver = cram_md5
55622   public_name = CRAM-MD5
55623   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
55624                   dbmjz{/etc/sasldb2}{$value}fail}
55625   server_set_id = $auth1
55626 </literallayout>
55627 </section>
55628 <section id="SECID177">
55629 <title>Using cram_md5 as a client</title>
55630 <para>
55631 <indexterm role="concept">
55632 <primary>options</primary>
55633 <secondary><command>cram_md5</command> authenticator (client)</secondary>
55634 </indexterm>
55635 When used as a client, the <command>cram_md5</command> authenticator has two options:
55636 </para>
55637 <para>
55638 <indexterm role="option">
55639 <primary><option>client_name</option></primary>
55640 </indexterm>
55641 </para>
55642 <informaltable frame="all">
55643 <tgroup cols="4" colsep="0" rowsep="0">
55644 <colspec colwidth="8*" align="left"/>
55645 <colspec colwidth="6*" align="center"/>
55646 <colspec colwidth="6*" align="center"/>
55647 <colspec colwidth="6*" align="right"/>
55648 <tbody>
55649 <row>
55650 <entry><option>client_name</option></entry>
55651 <entry>Use: <emphasis>cram_md5</emphasis></entry>
55652 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55653 <entry>Default: <emphasis>the primary host name</emphasis></entry>
55654 </row>
55655 </tbody>
55656 </tgroup>
55657 </informaltable>
55658 <para>
55659 This string is expanded, and the result used as the user name data when
55660 computing the response to the server&#x2019;s challenge.
55661 </para>
55662 <para>
55663 <indexterm role="option">
55664 <primary><option>client_secret</option></primary>
55665 </indexterm>
55666 </para>
55667 <informaltable frame="all">
55668 <tgroup cols="4" colsep="0" rowsep="0">
55669 <colspec colwidth="8*" align="left"/>
55670 <colspec colwidth="6*" align="center"/>
55671 <colspec colwidth="6*" align="center"/>
55672 <colspec colwidth="6*" align="right"/>
55673 <tbody>
55674 <row>
55675 <entry><option>client_secret</option></entry>
55676 <entry>Use: <emphasis>cram_md5</emphasis></entry>
55677 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55678 <entry>Default: <emphasis>unset</emphasis></entry>
55679 </row>
55680 </tbody>
55681 </tgroup>
55682 </informaltable>
55683 <para>
55684 This option must be set for the authenticator to work as a client. Its value is
55685 expanded and the result used as the secret string when computing the response.
55686 </para>
55687 <para>
55688 <indexterm role="variable">
55689 <primary><varname>$host</varname></primary>
55690 </indexterm>
55691 <indexterm role="variable">
55692 <primary><varname>$host_address</varname></primary>
55693 </indexterm>
55694 Different user names and secrets can be used for different servers by referring
55695 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
55696 expansion string is treated as an indication that this authenticator is not
55697 prepared to handle this case. Exim moves on to the next configured client
55698 authenticator. Any other expansion failure causes Exim to give up trying to
55699 send the message to the current server.
55700 </para>
55701 <para>
55702 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
55703 strings, is:
55704 </para>
55705 <literallayout class="monospaced">
55706 fixed_cram:
55707   driver = cram_md5
55708   public_name = CRAM-MD5
55709   client_name = ph10
55710   client_secret = secret
55711 </literallayout>
55712 <para>
55713 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
55714 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
55715 </para>
55716 </section>
55717 </chapter>
55718
55719 <chapter id="CHID10">
55720 <title>The cyrus_sasl authenticator</title>
55721 <para>
55722 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
55723 <primary><command>cyrus_sasl</command> authenticator</primary>
55724 </indexterm>
55725 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
55726 <primary>authenticators</primary>
55727 <secondary><command>cyrus_sasl</command></secondary>
55728 </indexterm>
55729 <indexterm role="concept">
55730 <primary>Cyrus</primary>
55731 <secondary>SASL library</secondary>
55732 </indexterm>
55733 <indexterm role="concept">
55734 <primary>Kerberos</primary>
55735 </indexterm>
55736 The code for this authenticator was provided by Matthew Byng-Maddick while
55737 at A L Digital Ltd.
55738 </para>
55739 <para>
55740 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
55741 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
55742 Layer</quote>). This library supports a number of authentication mechanisms,
55743 including PLAIN and LOGIN, but also several others that Exim does not support
55744 directly. In particular, there is support for Kerberos authentication.
55745 </para>
55746 <para>
55747 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
55748 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
55749 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
55750 name of the driver to determine which mechanism to support.
55751 </para>
55752 <para>
55753 Where access to some kind of secret file is required, for example, in GSSAPI
55754 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
55755 user, and that the Cyrus SASL library has no way of escalating privileges
55756 by default. You may also find you need to set environment variables,
55757 depending on the driver you are using.
55758 </para>
55759 <para>
55760 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
55761 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
55762 Kerberos, note that because of limitations in the GSSAPI interface,
55763 changing the server keytab might need to be communicated down to the Kerberos
55764 layer independently. The mechanism for doing so is dependent upon the Kerberos
55765 implementation.
55766 </para>
55767 <para>
55768 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
55769 may be set to point to an alternative keytab file. Exim will pass this
55770 variable through from its own inherited environment when started as root or the
55771 Exim user. The keytab file needs to be readable by the Exim user.
55772 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
55773 environment variable.  In practice, for those releases, the Cyrus authenticator
55774 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
55775 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
55776 </para>
55777 <section id="SECID178">
55778 <title>Using cyrus_sasl as a server</title>
55779 <para>
55780 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
55781 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
55782 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
55783 use of this variable for this purpose is now deprecated, as it can lead to
55784 confusion in string expansions that also use numeric variables for other
55785 things.
55786 </para>
55787 <para>
55788 <indexterm role="option">
55789 <primary><option>server_hostname</option></primary>
55790 </indexterm>
55791 </para>
55792 <informaltable frame="all">
55793 <tgroup cols="4" colsep="0" rowsep="0">
55794 <colspec colwidth="8*" align="left"/>
55795 <colspec colwidth="6*" align="center"/>
55796 <colspec colwidth="6*" align="center"/>
55797 <colspec colwidth="6*" align="right"/>
55798 <tbody>
55799 <row>
55800 <entry><option>server_hostname</option></entry>
55801 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55802 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55803 <entry>Default: <emphasis>see below</emphasis></entry>
55804 </row>
55805 </tbody>
55806 </tgroup>
55807 </informaltable>
55808 <para>
55809 This option selects the hostname that is used when communicating with the
55810 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
55811 SASL plug-in what it does with this data.
55812 </para>
55813 <para>
55814 <indexterm role="option">
55815 <primary><option>server_mech</option></primary>
55816 </indexterm>
55817 </para>
55818 <informaltable frame="all">
55819 <tgroup cols="4" colsep="0" rowsep="0">
55820 <colspec colwidth="8*" align="left"/>
55821 <colspec colwidth="6*" align="center"/>
55822 <colspec colwidth="6*" align="center"/>
55823 <colspec colwidth="6*" align="right"/>
55824 <tbody>
55825 <row>
55826 <entry><option>server_mech</option></entry>
55827 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55828 <entry>Type: <emphasis>string</emphasis></entry>
55829 <entry>Default: <emphasis>see below</emphasis></entry>
55830 </row>
55831 </tbody>
55832 </tgroup>
55833 </informaltable>
55834 <para>
55835 This option selects the authentication mechanism this driver should use. The
55836 default is the value of the generic <option>public_name</option> option. This option allows
55837 you to use a different underlying mechanism from the advertised name. For
55838 example:
55839 </para>
55840 <literallayout class="monospaced">
55841 sasl:
55842   driver = cyrus_sasl
55843   public_name = X-ANYTHING
55844   server_mech = CRAM-MD5
55845   server_set_id = $auth1
55846 </literallayout>
55847 <para>
55848 <indexterm role="option">
55849 <primary><option>server_realm</option></primary>
55850 </indexterm>
55851 </para>
55852 <informaltable frame="all">
55853 <tgroup cols="4" colsep="0" rowsep="0">
55854 <colspec colwidth="8*" align="left"/>
55855 <colspec colwidth="6*" align="center"/>
55856 <colspec colwidth="6*" align="center"/>
55857 <colspec colwidth="6*" align="right"/>
55858 <tbody>
55859 <row>
55860 <entry><option>server_realm</option></entry>
55861 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55862 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55863 <entry>Default: <emphasis>unset</emphasis></entry>
55864 </row>
55865 </tbody>
55866 </tgroup>
55867 </informaltable>
55868 <para>
55869 This specifies the SASL realm that the server claims to be in.
55870 </para>
55871 <para>
55872 <indexterm role="option">
55873 <primary><option>server_service</option></primary>
55874 </indexterm>
55875 </para>
55876 <informaltable frame="all">
55877 <tgroup cols="4" colsep="0" rowsep="0">
55878 <colspec colwidth="8*" align="left"/>
55879 <colspec colwidth="6*" align="center"/>
55880 <colspec colwidth="6*" align="center"/>
55881 <colspec colwidth="6*" align="right"/>
55882 <tbody>
55883 <row>
55884 <entry><option>server_service</option></entry>
55885 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55886 <entry>Type: <emphasis>string</emphasis></entry>
55887 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
55888 </row>
55889 </tbody>
55890 </tgroup>
55891 </informaltable>
55892 <para>
55893 This is the SASL service that the server claims to implement.
55894 </para>
55895 <para>
55896 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
55897 private options. All you need to do is to specify an appropriate mechanism as
55898 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
55899 PLAIN, you could have two authenticators as follows:
55900 </para>
55901 <literallayout class="monospaced">
55902 sasl_cram_md5:
55903   driver = cyrus_sasl
55904   public_name = CRAM-MD5
55905   server_set_id = $auth1
55906
55907 sasl_plain:
55908   driver = cyrus_sasl
55909   public_name = PLAIN
55910   server_set_id = $auth2
55911 </literallayout>
55912 <para>
55913 Cyrus SASL does implement the LOGIN authentication method, even though it is
55914 not a standard method. It is disabled by default in the source distribution,
55915 but it is present in many binary distributions.
55916 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
55917 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
55918 </para>
55919 </section>
55920 </chapter>
55921
55922 <chapter id="CHAPdovecot">
55923 <title>The dovecot authenticator</title>
55924 <para>
55925 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
55926 <primary><command>dovecot</command> authenticator</primary>
55927 </indexterm>
55928 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
55929 <primary>authenticators</primary>
55930 <secondary><command>dovecot</command></secondary>
55931 </indexterm>
55932 This authenticator is an interface to the authentication facility of the
55933 Dovecot 2 POP/IMAP server, which can support a number of authentication methods.
55934 Note that Dovecot must be configured to use auth-client not auth-userdb.
55935 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
55936 to use the same mechanisms for SMTP authentication. This is a server
55937 authenticator only. There is only one non-generic option:
55938 </para>
55939 <para>
55940 <indexterm role="option">
55941 <primary><option>server_socket</option></primary>
55942 </indexterm>
55943 </para>
55944 <informaltable frame="all">
55945 <tgroup cols="4" colsep="0" rowsep="0">
55946 <colspec colwidth="8*" align="left"/>
55947 <colspec colwidth="6*" align="center"/>
55948 <colspec colwidth="6*" align="center"/>
55949 <colspec colwidth="6*" align="right"/>
55950 <tbody>
55951 <row>
55952 <entry><option>server_socket</option></entry>
55953 <entry>Use: <emphasis>dovecot</emphasis></entry>
55954 <entry>Type: <emphasis>string</emphasis></entry>
55955 <entry>Default: <emphasis>unset</emphasis></entry>
55956 </row>
55957 </tbody>
55958 </tgroup>
55959 </informaltable>
55960 <para>
55961 This option must specify the UNIX socket that is the interface to Dovecot
55962 authentication. The <option>public_name</option> option must specify an authentication
55963 mechanism that Dovecot is configured to support. You can have several
55964 authenticators for different mechanisms. For example:
55965 </para>
55966 <literallayout class="monospaced">
55967 dovecot_plain:
55968   driver = dovecot
55969   public_name = PLAIN
55970   server_advertise_condition = ${if def:tls_in_cipher}
55971   server_socket = /var/run/dovecot/auth-client
55972   server_set_id = $auth1
55973
55974 dovecot_ntlm:
55975   driver = dovecot
55976   public_name = NTLM
55977   server_socket = /var/run/dovecot/auth-client
55978   server_set_id = $auth1
55979 </literallayout>
55980 <para revisionflag="changed">
55981 <emphasis role="bold">Note</emphasis>: plaintext authentication methods such as PLAIN and LOGIN
55982 should not be advertised on cleartext SMTP connections.
55983 See the discussion in section <xref linkend="SECTplain_TLS"/>.
55984 </para>
55985 <para>
55986 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
55987 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
55988 option is passed in the Dovecot authentication command. If, for a TLS
55989 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
55990 option is passed. When authentication succeeds, the identity of the user
55991 who authenticated is placed in <varname>$auth1</varname>.
55992 </para>
55993 <para>
55994 The Dovecot configuration to match the above will look
55995 something like:
55996 </para>
55997 <literallayout class="monospaced">
55998 conf.d/10-master.conf :-
55999
56000 service auth {
56001 ...
56002 #SASL
56003   unix_listener auth-client {
56004     mode = 0660
56005     user = mail
56006   }
56007 ...
56008 }
56009
56010 conf.d/10-auth.conf :-
56011
56012 auth_mechanisms = plain login ntlm
56013 </literallayout>
56014 <para>
56015 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
56016 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
56017 </para>
56018 </chapter>
56019
56020 <chapter id="CHAPgsasl">
56021 <title>The gsasl authenticator</title>
56022 <para>
56023 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
56024 <primary><command>gsasl</command> authenticator</primary>
56025 </indexterm>
56026 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
56027 <primary>authenticators</primary>
56028 <secondary><command>gsasl</command></secondary>
56029 </indexterm>
56030 <indexterm role="concept">
56031 <primary>authentication</primary>
56032 <secondary>GNU SASL</secondary>
56033 </indexterm>
56034 <indexterm role="concept">
56035 <primary>authentication</primary>
56036 <secondary>SASL</secondary>
56037 </indexterm>
56038 <indexterm role="concept">
56039 <primary>authentication</primary>
56040 <secondary>EXTERNAL</secondary>
56041 </indexterm>
56042 <indexterm role="concept">
56043 <primary>authentication</primary>
56044 <secondary>ANONYMOUS</secondary>
56045 </indexterm>
56046 <indexterm role="concept">
56047 <primary>authentication</primary>
56048 <secondary>PLAIN</secondary>
56049 </indexterm>
56050 <indexterm role="concept">
56051 <primary>authentication</primary>
56052 <secondary>LOGIN</secondary>
56053 </indexterm>
56054 <indexterm role="concept">
56055 <primary>authentication</primary>
56056 <secondary>DIGEST-MD5</secondary>
56057 </indexterm>
56058 <indexterm role="concept">
56059 <primary>authentication</primary>
56060 <secondary>CRAM-MD5</secondary>
56061 </indexterm>
56062 <indexterm role="concept">
56063 <primary>authentication</primary>
56064 <secondary>SCRAM family</secondary>
56065 </indexterm>
56066 The <command>gsasl</command> authenticator provides integration for the GNU SASL
56067 library and the mechanisms it provides.  This is new as of the 4.80 release
56068 and there are a few areas where the library does not let Exim smoothly
56069 scale to handle future authentication mechanisms, so no guarantee can be
56070 made that any particular new authentication mechanism will be supported
56071 without code changes in Exim.
56072 </para>
56073 <para>
56074 The library is expected to add support in an upcoming
56075 realease for the SCRAM-SHA-256 method.
56076 The macro _HAVE_AUTH_GSASL_SCRAM_SHA_256 will be defined
56077 when this happens.
56078 </para>
56079 <para>
56080 To see the list of mechanisms supported by the library run Exim with "auth" debug
56081 enabled and look for a line containing "GNU SASL supports".
56082 Note however that some may not have been tested from Exim.
56083 </para>
56084 <para>
56085 <indexterm role="option">
56086 <primary><option>client_authz</option></primary>
56087 </indexterm>
56088 </para>
56089 <informaltable frame="all">
56090 <tgroup cols="4" colsep="0" rowsep="0">
56091 <colspec colwidth="8*" align="left"/>
56092 <colspec colwidth="6*" align="center"/>
56093 <colspec colwidth="6*" align="center"/>
56094 <colspec colwidth="6*" align="right"/>
56095 <tbody>
56096 <row>
56097 <entry><option>client_authz</option></entry>
56098 <entry>Use: <emphasis>gsasl</emphasis></entry>
56099 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56100 <entry>Default: <emphasis>unset</emphasis></entry>
56101 </row>
56102 </tbody>
56103 </tgroup>
56104 </informaltable>
56105 <para>
56106 This option can be used to supply an <emphasis>authorization id</emphasis>
56107 which is different to the <emphasis>authentication_id</emphasis> provided
56108 by <option>client_username</option> option.
56109 If unset or (after expansion) empty it is not used,
56110 which is the common case.
56111 </para>
56112 <para>
56113 <indexterm role="option">
56114 <primary><option>client_channelbinding</option></primary>
56115 </indexterm>
56116 </para>
56117 <informaltable frame="all">
56118 <tgroup cols="4" colsep="0" rowsep="0">
56119 <colspec colwidth="8*" align="left"/>
56120 <colspec colwidth="6*" align="center"/>
56121 <colspec colwidth="6*" align="center"/>
56122 <colspec colwidth="6*" align="right"/>
56123 <tbody>
56124 <row>
56125 <entry><option>client_channelbinding</option></entry>
56126 <entry>Use: <emphasis>gsasl</emphasis></entry>
56127 <entry>Type: <emphasis>boolean</emphasis></entry>
56128 <entry>Default: <emphasis>false</emphasis></entry>
56129 </row>
56130 </tbody>
56131 </tgroup>
56132 </informaltable>
56133 <para>
56134 See <option>server_channelbinding</option> below.
56135 </para>
56136 <para>
56137 <indexterm role="option">
56138 <primary><option>client_password</option></primary>
56139 </indexterm>
56140 </para>
56141 <informaltable frame="all">
56142 <tgroup cols="4" colsep="0" rowsep="0">
56143 <colspec colwidth="8*" align="left"/>
56144 <colspec colwidth="6*" align="center"/>
56145 <colspec colwidth="6*" align="center"/>
56146 <colspec colwidth="6*" align="right"/>
56147 <tbody>
56148 <row>
56149 <entry><option>client_password</option></entry>
56150 <entry>Use: <emphasis>gsasl</emphasis></entry>
56151 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56152 <entry>Default: <emphasis>unset</emphasis></entry>
56153 </row>
56154 </tbody>
56155 </tgroup>
56156 </informaltable>
56157 <para>
56158 This option is exapanded before use, and should result in
56159 the password to be used, in clear.
56160 </para>
56161 <para>
56162 <indexterm role="option">
56163 <primary><option>client_username</option></primary>
56164 </indexterm>
56165 </para>
56166 <informaltable frame="all">
56167 <tgroup cols="4" colsep="0" rowsep="0">
56168 <colspec colwidth="8*" align="left"/>
56169 <colspec colwidth="6*" align="center"/>
56170 <colspec colwidth="6*" align="center"/>
56171 <colspec colwidth="6*" align="right"/>
56172 <tbody>
56173 <row>
56174 <entry><option>client_username</option></entry>
56175 <entry>Use: <emphasis>gsasl</emphasis></entry>
56176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56177 <entry>Default: <emphasis>unset</emphasis></entry>
56178 </row>
56179 </tbody>
56180 </tgroup>
56181 </informaltable>
56182 <para>
56183 This option is exapanded before use, and should result in
56184 the account name to be used.
56185 </para>
56186 <para>
56187 <indexterm role="option">
56188 <primary><option>client_spassword</option></primary>
56189 </indexterm>
56190 </para>
56191 <informaltable frame="all">
56192 <tgroup cols="4" colsep="0" rowsep="0">
56193 <colspec colwidth="8*" align="left"/>
56194 <colspec colwidth="6*" align="center"/>
56195 <colspec colwidth="6*" align="center"/>
56196 <colspec colwidth="6*" align="right"/>
56197 <tbody>
56198 <row>
56199 <entry><option>client_spassword</option></entry>
56200 <entry>Use: <emphasis>gsasl</emphasis></entry>
56201 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56202 <entry>Default: <emphasis>unset</emphasis></entry>
56203 </row>
56204 </tbody>
56205 </tgroup>
56206 </informaltable>
56207 <para>
56208 This option is only supported for library versions 1.9.1 and greater.
56209 The macro _HAVE_AUTH_GSASL_SCRAM_S_KEY will be defined when this is so.
56210 </para>
56211 <para>
56212 If a SCRAM mechanism is being used and this option is set
56213 and correctly sized
56214 it is used in preference to <option>client_password</option>.
56215 The value after expansion should be
56216 a 40 (for SHA-1) or 64 (for SHA-256) character string
56217 with the PBKDF2-prepared password, hex-encoded.
56218 </para>
56219 <para>
56220 Note that this value will depend on the salt and iteration-count
56221 supplied by the server.
56222 The option is expanded before use.
56223 During the expansion <varname>$auth1</varname> is set with the client username,
56224 <varname>$auth2</varname> with the iteration count, and
56225 <varname>$auth3</varname> with the salt.
56226 </para>
56227 <para>
56228 The intent of this option
56229 is to support clients that can cache thes salted password
56230 to save on recalculation costs.
56231 The cache lookup should return an unusable value
56232 (eg. an empty string)
56233 if the salt or iteration count has changed
56234 </para>
56235 <para>
56236 If the authentication succeeds then the above variables are set,
56237 <indexterm role="variable">
56238 <primary><varname>$auth4</varname></primary>
56239 </indexterm>
56240 plus the calculated salted password value value in <varname>$auth4</varname>,
56241 during the expansion of the <option>client_set_id</option> option.
56242 A side-effect of this expansion can be used to prime the cache.
56243 </para>
56244 <para>
56245 <indexterm role="option">
56246 <primary><option>server_channelbinding</option></primary>
56247 </indexterm>
56248 </para>
56249 <informaltable frame="all">
56250 <tgroup cols="4" colsep="0" rowsep="0">
56251 <colspec colwidth="8*" align="left"/>
56252 <colspec colwidth="6*" align="center"/>
56253 <colspec colwidth="6*" align="center"/>
56254 <colspec colwidth="6*" align="right"/>
56255 <tbody>
56256 <row>
56257 <entry><option>server_channelbinding</option></entry>
56258 <entry>Use: <emphasis>gsasl</emphasis></entry>
56259 <entry>Type: <emphasis>boolean</emphasis></entry>
56260 <entry>Default: <emphasis>false</emphasis></entry>
56261 </row>
56262 </tbody>
56263 </tgroup>
56264 </informaltable>
56265 <para>
56266 Some authentication mechanisms are able to use external context at both ends
56267 of the session to bind the authentication to that context, and fail the
56268 authentication process if that context differs.  Specifically, some TLS
56269 ciphersuites can provide identifying information about the cryptographic
56270 context.
56271 </para>
56272 <para>
56273 This should have meant that certificate identity and verification becomes a
56274 non-issue, as a man-in-the-middle attack will cause the correct client and
56275 server to see different identifiers and authentication will fail.
56276 </para>
56277 <para>
56278 This is
56279 only usable by mechanisms which support "channel binding"; at time of
56280 writing, that&#x2019;s the SCRAM family.
56281 When using this feature the "-PLUS" variants of the method names need to be used.
56282 </para>
56283 <para>
56284 This defaults off to ensure smooth upgrade across Exim releases, in case
56285 this option causes some clients to start failing.  Some future release
56286 of Exim might have switched the default to be true.
56287 </para>
56288 <para>
56289 This option was deprecated in previous releases due to doubts over
56290 the "Triple Handshake" vulnerability.
56291 Exim takes suitable precausions (requiring Extended Master Secret if TLS
56292 Session Resumption was used) for safety.
56293 </para>
56294 <para>
56295 <indexterm role="option">
56296 <primary><option>server_hostname</option></primary>
56297 </indexterm>
56298 </para>
56299 <informaltable frame="all">
56300 <tgroup cols="4" colsep="0" rowsep="0">
56301 <colspec colwidth="8*" align="left"/>
56302 <colspec colwidth="6*" align="center"/>
56303 <colspec colwidth="6*" align="center"/>
56304 <colspec colwidth="6*" align="right"/>
56305 <tbody>
56306 <row>
56307 <entry><option>server_hostname</option></entry>
56308 <entry>Use: <emphasis>gsasl</emphasis></entry>
56309 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56310 <entry>Default: <emphasis>see below</emphasis></entry>
56311 </row>
56312 </tbody>
56313 </tgroup>
56314 </informaltable>
56315 <para>
56316 This option selects the hostname that is used when communicating with the
56317 library. The default value is <literal>$primary_hostname</literal>.
56318 Some mechanisms will use this data.
56319 </para>
56320 <para>
56321 <indexterm role="option">
56322 <primary><option>server_mech</option></primary>
56323 </indexterm>
56324 </para>
56325 <informaltable frame="all">
56326 <tgroup cols="4" colsep="0" rowsep="0">
56327 <colspec colwidth="8*" align="left"/>
56328 <colspec colwidth="6*" align="center"/>
56329 <colspec colwidth="6*" align="center"/>
56330 <colspec colwidth="6*" align="right"/>
56331 <tbody>
56332 <row>
56333 <entry><option>server_mech</option></entry>
56334 <entry>Use: <emphasis>gsasl</emphasis></entry>
56335 <entry>Type: <emphasis>string</emphasis></entry>
56336 <entry>Default: <emphasis>see below</emphasis></entry>
56337 </row>
56338 </tbody>
56339 </tgroup>
56340 </informaltable>
56341 <para>
56342 This option selects the authentication mechanism this driver should use. The
56343 default is the value of the generic <option>public_name</option> option. This option allows
56344 you to use a different underlying mechanism from the advertised name. For
56345 example:
56346 </para>
56347 <literallayout class="monospaced">
56348 sasl:
56349   driver = gsasl
56350   public_name = X-ANYTHING
56351   server_mech = CRAM-MD5
56352   server_set_id = $auth1
56353 </literallayout>
56354 <para>
56355 <indexterm role="option">
56356 <primary><option>server_password</option></primary>
56357 </indexterm>
56358 </para>
56359 <informaltable frame="all">
56360 <tgroup cols="4" colsep="0" rowsep="0">
56361 <colspec colwidth="8*" align="left"/>
56362 <colspec colwidth="6*" align="center"/>
56363 <colspec colwidth="6*" align="center"/>
56364 <colspec colwidth="6*" align="right"/>
56365 <tbody>
56366 <row>
56367 <entry><option>server_password</option></entry>
56368 <entry>Use: <emphasis>gsasl</emphasis></entry>
56369 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56370 <entry>Default: <emphasis>unset</emphasis></entry>
56371 </row>
56372 </tbody>
56373 </tgroup>
56374 </informaltable>
56375 <para>
56376 Various mechanisms need access to the cleartext password on the server, so
56377 that proof-of-possession can be demonstrated on the wire, without sending
56378 the password itself.
56379 </para>
56380 <para>
56381 The data available for lookup varies per mechanism.
56382 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
56383 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
56384 if available, else the empty string.
56385 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
56386 else the empty string.
56387 </para>
56388 <para>
56389 A forced failure will cause authentication to defer.
56390 </para>
56391 <para>
56392 If using this option, it may make sense to set the <option>server_condition</option>
56393 option to be simply "true".
56394 </para>
56395 <para>
56396 <indexterm role="option">
56397 <primary><option>server_realm</option></primary>
56398 </indexterm>
56399 </para>
56400 <informaltable frame="all">
56401 <tgroup cols="4" colsep="0" rowsep="0">
56402 <colspec colwidth="8*" align="left"/>
56403 <colspec colwidth="6*" align="center"/>
56404 <colspec colwidth="6*" align="center"/>
56405 <colspec colwidth="6*" align="right"/>
56406 <tbody>
56407 <row>
56408 <entry><option>server_realm</option></entry>
56409 <entry>Use: <emphasis>gsasl</emphasis></entry>
56410 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56411 <entry>Default: <emphasis>unset</emphasis></entry>
56412 </row>
56413 </tbody>
56414 </tgroup>
56415 </informaltable>
56416 <para>
56417 This specifies the SASL realm that the server claims to be in.
56418 Some mechanisms will use this data.
56419 </para>
56420 <para>
56421 <indexterm role="option">
56422 <primary><option>server_scram_iter</option></primary>
56423 </indexterm>
56424 </para>
56425 <informaltable frame="all">
56426 <tgroup cols="4" colsep="0" rowsep="0">
56427 <colspec colwidth="8*" align="left"/>
56428 <colspec colwidth="6*" align="center"/>
56429 <colspec colwidth="6*" align="center"/>
56430 <colspec colwidth="6*" align="right"/>
56431 <tbody>
56432 <row>
56433 <entry><option>server_scram_iter</option></entry>
56434 <entry>Use: <emphasis>gsasl</emphasis></entry>
56435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56436 <entry>Default: <emphasis>4096</emphasis></entry>
56437 </row>
56438 </tbody>
56439 </tgroup>
56440 </informaltable>
56441 <para>
56442 This option provides data for the SCRAM family of mechanisms.
56443 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
56444 when this option is expanded.
56445 </para>
56446 <para>
56447 The result of expansion should be a decimal number,
56448 and represents both a lower-bound on the security, and
56449 a compute cost factor imposed on the client
56450 (if it does not cache results, or the server changes
56451 either the iteration count or the salt).
56452 A minimum value of 4096 is required by the standards
56453 for all current SCRAM mechanism variants.
56454 </para>
56455 <para>
56456 <indexterm role="option">
56457 <primary><option>server_scram_salt</option></primary>
56458 </indexterm>
56459 </para>
56460 <informaltable frame="all">
56461 <tgroup cols="4" colsep="0" rowsep="0">
56462 <colspec colwidth="8*" align="left"/>
56463 <colspec colwidth="6*" align="center"/>
56464 <colspec colwidth="6*" align="center"/>
56465 <colspec colwidth="6*" align="right"/>
56466 <tbody>
56467 <row>
56468 <entry><option>server_scram_salt</option></entry>
56469 <entry>Use: <emphasis>gsasl</emphasis></entry>
56470 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56471 <entry>Default: <emphasis>unset</emphasis></entry>
56472 </row>
56473 </tbody>
56474 </tgroup>
56475 </informaltable>
56476 <para>
56477 This option provides data for the SCRAM family of mechanisms.
56478 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
56479 when this option is expanded.
56480 The value should be a base64-encoded string,
56481 of random data typically 4-to-16 bytes long.
56482 If unset or empty after expansion the library will provides a value for the
56483 protocol conversation.
56484 </para>
56485 <para>
56486 <indexterm role="option">
56487 <primary><option>server_key</option></primary>
56488 </indexterm>
56489 </para>
56490 <informaltable frame="all">
56491 <tgroup cols="4" colsep="0" rowsep="0">
56492 <colspec colwidth="8*" align="left"/>
56493 <colspec colwidth="6*" align="center"/>
56494 <colspec colwidth="6*" align="center"/>
56495 <colspec colwidth="6*" align="right"/>
56496 <tbody>
56497 <row>
56498 <entry><option>server_key</option></entry>
56499 <entry>Use: <emphasis>gsasl</emphasis></entry>
56500 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56501 <entry>Default: <emphasis>unset</emphasis></entry>
56502 </row>
56503 </tbody>
56504 </tgroup>
56505 </informaltable>
56506 <para>
56507 <indexterm role="option">
56508 <primary><option>server_skey</option></primary>
56509 </indexterm>
56510 </para>
56511 <informaltable frame="all">
56512 <tgroup cols="4" colsep="0" rowsep="0">
56513 <colspec colwidth="8*" align="left"/>
56514 <colspec colwidth="6*" align="center"/>
56515 <colspec colwidth="6*" align="center"/>
56516 <colspec colwidth="6*" align="right"/>
56517 <tbody>
56518 <row>
56519 <entry><option>server_skey</option></entry>
56520 <entry>Use: <emphasis>gsasl</emphasis></entry>
56521 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56522 <entry>Default: <emphasis>unset</emphasis></entry>
56523 </row>
56524 </tbody>
56525 </tgroup>
56526 </informaltable>
56527 <para>
56528 These options can be used for the SCRAM family of mechanisms
56529 to provide stored information related to a password,
56530 the storage of which is preferable to plaintext.
56531 </para>
56532 <para>
56533 <option>server_key</option> is the value defined in the SCRAM standards as ServerKey;
56534 <option>server_skey</option> is StoredKey.
56535 </para>
56536 <para>
56537 They are only available for version 1.9.0 (or later) of the gsasl library.
56538 When this is so, the macros
56539 _OPT_AUTHENTICATOR_GSASL_SERVER_KEY
56540 and _HAVE_AUTH_GSASL_SCRAM_S_KEY
56541 will be defined.
56542 </para>
56543 <para>
56544 The <varname>$authN</varname> variables are available when these options are expanded.
56545 </para>
56546 <para>
56547 If set, the results of expansion should for each
56548 should be a 28 (for SHA-1) or 44 (for SHA-256) character string
56549 of base64-coded data, and will be used in preference to the
56550 <option>server_password</option> option.
56551 If unset or not of the right length, <option>server_password</option> will be used.
56552 </para>
56553 <para>
56554 The libgsasl library release includes a utility <emphasis>gsasl</emphasis> which can be used
56555 to generate these values.
56556 </para>
56557 <para>
56558 <indexterm role="option">
56559 <primary><option>server_service</option></primary>
56560 </indexterm>
56561 </para>
56562 <informaltable frame="all">
56563 <tgroup cols="4" colsep="0" rowsep="0">
56564 <colspec colwidth="8*" align="left"/>
56565 <colspec colwidth="6*" align="center"/>
56566 <colspec colwidth="6*" align="center"/>
56567 <colspec colwidth="6*" align="right"/>
56568 <tbody>
56569 <row>
56570 <entry><option>server_service</option></entry>
56571 <entry>Use: <emphasis>gsasl</emphasis></entry>
56572 <entry>Type: <emphasis>string</emphasis></entry>
56573 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
56574 </row>
56575 </tbody>
56576 </tgroup>
56577 </informaltable>
56578 <para>
56579 This is the SASL service that the server claims to implement.
56580 Some mechanisms will use this data.
56581 </para>
56582 <section id="SECTgsaslauthvar">
56583 <title><command>gsasl</command> auth variables</title>
56584 <para>
56585 <indexterm role="variable">
56586 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
56587 </indexterm>
56588 These may be set when evaluating specific options, as detailed above.
56589 They will also be set when evaluating <option>server_condition</option>.
56590 </para>
56591 <para>
56592 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
56593 meanings for these variables:
56594 </para>
56595 <itemizedlist>
56596 <listitem>
56597 <para>
56598 <indexterm role="variable">
56599 <primary><varname>$auth1</varname></primary>
56600 </indexterm>
56601 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
56602 </para>
56603 </listitem>
56604 <listitem>
56605 <para>
56606 <indexterm role="variable">
56607 <primary><varname>$auth2</varname></primary>
56608 </indexterm>
56609 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
56610 </para>
56611 </listitem>
56612 <listitem>
56613 <para>
56614 <indexterm role="variable">
56615 <primary><varname>$auth3</varname></primary>
56616 </indexterm>
56617 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
56618 </para>
56619 </listitem>
56620 </itemizedlist>
56621 <para>
56622 On a per-mechanism basis:
56623 </para>
56624 <itemizedlist>
56625 <listitem>
56626 <para>
56627 <indexterm role="concept">
56628 <primary>authentication</primary>
56629 <secondary>EXTERNAL</secondary>
56630 </indexterm>
56631 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
56632 the <option>server_condition</option> option must be present.
56633 </para>
56634 </listitem>
56635 <listitem>
56636 <para>
56637 <indexterm role="concept">
56638 <primary>authentication</primary>
56639 <secondary>ANONYMOUS</secondary>
56640 </indexterm>
56641 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
56642 the <option>server_condition</option> option must be present.
56643 </para>
56644 </listitem>
56645 <listitem>
56646 <para>
56647 <indexterm role="concept">
56648 <primary>authentication</primary>
56649 <secondary>GSSAPI</secondary>
56650 </indexterm>
56651 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
56652 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
56653 the <option>server_condition</option> option must be present.
56654 </para>
56655 </listitem>
56656 </itemizedlist>
56657 <para>
56658 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
56659 identifier; this is analogous to FTP anonymous authentication passing an
56660 email address, or software-identifier@, as the "password".
56661 </para>
56662 <para>
56663 An example showing the password having the realm specified in the callback
56664 and demonstrating a Cyrus SASL to GSASL migration approach is:
56665 </para>
56666 <literallayout class="monospaced">
56667 gsasl_cyrusless_crammd5:
56668   driver = gsasl
56669   public_name = CRAM-MD5
56670   server_realm = imap.example.org
56671   server_password = ${lookup{$auth1:$auth3:userPassword}\
56672                     dbmjz{/etc/sasldb2}{$value}fail}
56673   server_set_id = ${quote:$auth1}
56674   server_condition = yes
56675 </literallayout>
56676 </section>
56677 </chapter>
56678
56679 <chapter id="CHAPheimdalgss">
56680 <title>The heimdal_gssapi authenticator</title>
56681 <para>
56682 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
56683 <primary><command>heimdal_gssapi</command> authenticator</primary>
56684 </indexterm>
56685 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
56686 <primary>authenticators</primary>
56687 <secondary><command>heimdal_gssapi</command></secondary>
56688 </indexterm>
56689 <indexterm role="concept">
56690 <primary>authentication</primary>
56691 <secondary>GSSAPI</secondary>
56692 </indexterm>
56693 <indexterm role="concept">
56694 <primary>authentication</primary>
56695 <secondary>Kerberos</secondary>
56696 </indexterm>
56697 The <command>heimdal_gssapi</command> authenticator provides server integration for the
56698 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
56699 reliably.
56700 </para>
56701 <para>
56702 <indexterm role="option">
56703 <primary><option>server_hostname</option></primary>
56704 </indexterm>
56705 </para>
56706 <informaltable frame="all">
56707 <tgroup cols="4" colsep="0" rowsep="0">
56708 <colspec colwidth="8*" align="left"/>
56709 <colspec colwidth="6*" align="center"/>
56710 <colspec colwidth="6*" align="center"/>
56711 <colspec colwidth="6*" align="right"/>
56712 <tbody>
56713 <row>
56714 <entry><option>server_hostname</option></entry>
56715 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
56716 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56717 <entry>Default: <emphasis>see below</emphasis></entry>
56718 </row>
56719 </tbody>
56720 </tgroup>
56721 </informaltable>
56722 <para>
56723 This option selects the hostname that is used, with <option>server_service</option>,
56724 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
56725 identifier.  The default value is <literal>$primary_hostname</literal>.
56726 </para>
56727 <para>
56728 <indexterm role="option">
56729 <primary><option>server_keytab</option></primary>
56730 </indexterm>
56731 </para>
56732 <informaltable frame="all">
56733 <tgroup cols="4" colsep="0" rowsep="0">
56734 <colspec colwidth="8*" align="left"/>
56735 <colspec colwidth="6*" align="center"/>
56736 <colspec colwidth="6*" align="center"/>
56737 <colspec colwidth="6*" align="right"/>
56738 <tbody>
56739 <row>
56740 <entry><option>server_keytab</option></entry>
56741 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
56742 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56743 <entry>Default: <emphasis>unset</emphasis></entry>
56744 </row>
56745 </tbody>
56746 </tgroup>
56747 </informaltable>
56748 <para>
56749 If set, then Heimdal will not use the system default keytab (typically
56750 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
56751 The value should be a pathname, with no <quote>file:</quote> prefix.
56752 </para>
56753 <para>
56754 <indexterm role="option">
56755 <primary><option>server_service</option></primary>
56756 </indexterm>
56757 </para>
56758 <informaltable frame="all">
56759 <tgroup cols="4" colsep="0" rowsep="0">
56760 <colspec colwidth="8*" align="left"/>
56761 <colspec colwidth="6*" align="center"/>
56762 <colspec colwidth="6*" align="center"/>
56763 <colspec colwidth="6*" align="right"/>
56764 <tbody>
56765 <row>
56766 <entry><option>server_service</option></entry>
56767 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
56768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56769 <entry>Default: <emphasis>smtp</emphasis></entry>
56770 </row>
56771 </tbody>
56772 </tgroup>
56773 </informaltable>
56774 <para>
56775 This option specifies the service identifier used, in conjunction with
56776 <option>server_hostname</option>, for building the identifier for finding credentials
56777 from the keytab.
56778 </para>
56779 <section id="SECTheimdalgssauthvar">
56780 <title><command>heimdal_gssapi</command> auth variables</title>
56781 <para>
56782 Beware that these variables will typically include a realm, thus will appear
56783 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
56784 not verified, so a malicious client can set it to anything.
56785 </para>
56786 <para>
56787 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
56788 Distribution Center.  Note that these are not quite email addresses.
56789 Each identifier is for a role, and so the left-hand-side may include a
56790 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
56791 </para>
56792 <para>
56793 <indexterm role="variable">
56794 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
56795 </indexterm>
56796 </para>
56797 <itemizedlist>
56798 <listitem>
56799 <para>
56800 <indexterm role="variable">
56801 <primary><varname>$auth1</varname></primary>
56802 </indexterm>
56803 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
56804 </para>
56805 </listitem>
56806 <listitem>
56807 <para>
56808 <indexterm role="variable">
56809 <primary><varname>$auth2</varname></primary>
56810 </indexterm>
56811 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
56812 authentication.  If that was empty, this will also be set to the
56813 GSS Display Name.
56814 </para>
56815 </listitem>
56816 </itemizedlist>
56817 </section>
56818 </chapter>
56819
56820 <chapter id="CHAPspa">
56821 <title>The spa authenticator</title>
56822 <para>
56823 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
56824 <primary><command>spa</command> authenticator</primary>
56825 </indexterm>
56826 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
56827 <primary>authenticators</primary>
56828 <secondary><command>spa</command></secondary>
56829 </indexterm>
56830 <indexterm role="concept">
56831 <primary>authentication</primary>
56832 <secondary>Microsoft Secure Password</secondary>
56833 </indexterm>
56834 <indexterm role="concept">
56835 <primary>authentication</primary>
56836 <secondary>NTLM</secondary>
56837 </indexterm>
56838 <indexterm role="concept">
56839 <primary>Microsoft Secure Password Authentication</primary>
56840 </indexterm>
56841 <indexterm role="concept">
56842 <primary>NTLM authentication</primary>
56843 </indexterm>
56844 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
56845 Password Authentication</emphasis> mechanism,
56846 which is also sometimes known as NTLM (NT LanMan). The code for client side of
56847 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
56848 taken from the Samba project (<emphasis role="bold"><ulink url="https://www.samba.org/">https://www.samba.org/</ulink></emphasis>). The code for the
56849 server side was subsequently contributed by Tom Kistner. The mechanism works as
56850 follows:
56851 </para>
56852 <itemizedlist>
56853 <listitem>
56854 <para>
56855 After the AUTH command has been accepted, the client sends an SPA
56856 authentication request based on the user name and optional domain.
56857 </para>
56858 </listitem>
56859 <listitem>
56860 <para>
56861 The server sends back a challenge.
56862 </para>
56863 </listitem>
56864 <listitem>
56865 <para>
56866 The client builds a challenge response which makes use of the user&#x2019;s password
56867 and sends it to the server, which then accepts or rejects it.
56868 </para>
56869 </listitem>
56870 </itemizedlist>
56871 <para>
56872 Encryption is used to protect the password in transit.
56873 </para>
56874 <section id="SECID179">
56875 <title>Using spa as a server</title>
56876 <para>
56877 <indexterm role="concept">
56878 <primary>options</primary>
56879 <secondary><command>spa</command> authenticator (server)</secondary>
56880 </indexterm>
56881 The <command>spa</command> authenticator has just one server option:
56882 </para>
56883 <para>
56884 <indexterm role="option">
56885 <primary><option>server_password</option></primary>
56886 </indexterm>
56887 </para>
56888 <informaltable frame="all">
56889 <tgroup cols="4" colsep="0" rowsep="0">
56890 <colspec colwidth="8*" align="left"/>
56891 <colspec colwidth="6*" align="center"/>
56892 <colspec colwidth="6*" align="center"/>
56893 <colspec colwidth="6*" align="right"/>
56894 <tbody>
56895 <row>
56896 <entry><option>server_password</option></entry>
56897 <entry>Use: <emphasis>spa</emphasis></entry>
56898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56899 <entry>Default: <emphasis>unset</emphasis></entry>
56900 </row>
56901 </tbody>
56902 </tgroup>
56903 </informaltable>
56904 <para>
56905 <indexterm role="concept">
56906 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
56907 <secondary>in <command>spa</command> authenticator</secondary>
56908 </indexterm>
56909 This option is expanded, and the result must be the cleartext password for the
56910 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
56911 compatibility with previous releases of Exim, the user name is also placed in
56912 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
56913 it can lead to confusion in string expansions that also use numeric variables
56914 for other things. For example:
56915 </para>
56916 <literallayout class="monospaced">
56917 spa:
56918   driver = spa
56919   public_name = NTLM
56920   server_password = \
56921     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
56922 </literallayout>
56923 <para>
56924 If the expansion is forced to fail, authentication fails. Any other expansion
56925 failure causes a temporary error code to be returned.
56926 </para>
56927 </section>
56928 <section id="SECID180">
56929 <title>Using spa as a client</title>
56930 <para>
56931 <indexterm role="concept">
56932 <primary>options</primary>
56933 <secondary><command>spa</command> authenticator (client)</secondary>
56934 </indexterm>
56935 The <command>spa</command> authenticator has the following client options:
56936 </para>
56937 <para>
56938 <indexterm role="option">
56939 <primary><option>client_domain</option></primary>
56940 </indexterm>
56941 </para>
56942 <informaltable frame="all">
56943 <tgroup cols="4" colsep="0" rowsep="0">
56944 <colspec colwidth="8*" align="left"/>
56945 <colspec colwidth="6*" align="center"/>
56946 <colspec colwidth="6*" align="center"/>
56947 <colspec colwidth="6*" align="right"/>
56948 <tbody>
56949 <row>
56950 <entry><option>client_domain</option></entry>
56951 <entry>Use: <emphasis>spa</emphasis></entry>
56952 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56953 <entry>Default: <emphasis>unset</emphasis></entry>
56954 </row>
56955 </tbody>
56956 </tgroup>
56957 </informaltable>
56958 <para>
56959 This option specifies an optional domain for the authentication.
56960 </para>
56961 <para>
56962 <indexterm role="option">
56963 <primary><option>client_password</option></primary>
56964 </indexterm>
56965 </para>
56966 <informaltable frame="all">
56967 <tgroup cols="4" colsep="0" rowsep="0">
56968 <colspec colwidth="8*" align="left"/>
56969 <colspec colwidth="6*" align="center"/>
56970 <colspec colwidth="6*" align="center"/>
56971 <colspec colwidth="6*" align="right"/>
56972 <tbody>
56973 <row>
56974 <entry><option>client_password</option></entry>
56975 <entry>Use: <emphasis>spa</emphasis></entry>
56976 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56977 <entry>Default: <emphasis>unset</emphasis></entry>
56978 </row>
56979 </tbody>
56980 </tgroup>
56981 </informaltable>
56982 <para>
56983 This option specifies the user&#x2019;s password, and must be set.
56984 </para>
56985 <para>
56986 <indexterm role="option">
56987 <primary><option>client_username</option></primary>
56988 </indexterm>
56989 </para>
56990 <informaltable frame="all">
56991 <tgroup cols="4" colsep="0" rowsep="0">
56992 <colspec colwidth="8*" align="left"/>
56993 <colspec colwidth="6*" align="center"/>
56994 <colspec colwidth="6*" align="center"/>
56995 <colspec colwidth="6*" align="right"/>
56996 <tbody>
56997 <row>
56998 <entry><option>client_username</option></entry>
56999 <entry>Use: <emphasis>spa</emphasis></entry>
57000 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57001 <entry>Default: <emphasis>unset</emphasis></entry>
57002 </row>
57003 </tbody>
57004 </tgroup>
57005 </informaltable>
57006 <para>
57007 This option specifies the user name, and must be set. Here is an example of a
57008 configuration of this authenticator for use with the mail servers at
57009 <emphasis>msn.com</emphasis>:
57010 </para>
57011 <literallayout class="monospaced">
57012 msn:
57013   driver = spa
57014   public_name = MSN
57015   client_username = msn/msn_username
57016   client_password = msn_plaintext_password
57017   client_domain = DOMAIN_OR_UNSET
57018 </literallayout>
57019 <para>
57020 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
57021 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
57022 </para>
57023 </section>
57024 </chapter>
57025
57026 <chapter id="CHAPexternauth">
57027 <title>The external authenticator</title>
57028 <para>
57029 <indexterm role="concept" id="IIDexternauth1" class="startofrange">
57030 <primary><command>external</command> authenticator</primary>
57031 </indexterm>
57032 <indexterm role="concept" id="IIDexternauth2" class="startofrange">
57033 <primary>authenticators</primary>
57034 <secondary><command>external</command></secondary>
57035 </indexterm>
57036 <indexterm role="concept">
57037 <primary>authentication</primary>
57038 <secondary>Client Certificate</secondary>
57039 </indexterm>
57040 <indexterm role="concept">
57041 <primary>authentication</primary>
57042 <secondary>X509</secondary>
57043 </indexterm>
57044 <indexterm role="concept">
57045 <primary>Certificate-based authentication</primary>
57046 </indexterm>
57047 The <command>external</command> authenticator provides support for
57048 authentication based on non-SMTP information.
57049 The specification is in RFC 4422 Appendix A
57050 (<emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc4422">https://tools.ietf.org/html/rfc4422</ulink></emphasis>).
57051 It is only a transport and negotiation mechanism;
57052 the process of authentication is entirely controlled
57053 by the server configuration.
57054 </para>
57055 <para>
57056 The client presents an identity in-clear.
57057 It is probably wise for a server to only advertise,
57058 and for clients to only attempt,
57059 this authentication method on a secure (eg. under TLS) connection.
57060 </para>
57061 <para>
57062 One possible use, compatible with the
57063 K-9 Mail Android client (<emphasis role="bold"><ulink url="https://k9mail.github.io/">https://k9mail.github.io/</ulink></emphasis>),
57064 is for using X509 client certificates.
57065 </para>
57066 <para>
57067 It thus overlaps in function with the TLS authenticator
57068 (see <xref linkend="CHAPtlsauth"/>)
57069 but is a full SMTP SASL authenticator
57070 rather than being implicit for TLS-connection carried
57071 client certificates only.
57072 </para>
57073 <para>
57074 The examples and discussion in this chapter assume that
57075 client-certificate authentication is being done.
57076 </para>
57077 <para>
57078 The client must present a certificate,
57079 for which it must have been requested via the
57080 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
57081 (see <xref linkend="CHAPTLS"/>).
57082 For authentication to be effective the certificate should be
57083 verifiable against a trust-anchor certificate known to the server.
57084 </para>
57085 <section id="SECTexternsoptions">
57086 <title>External options</title>
57087 <para>
57088 <indexterm role="concept">
57089 <primary>options</primary>
57090 <secondary><command>external</command> authenticator (server)</secondary>
57091 </indexterm>
57092 The <command>external</command> authenticator has two server options:
57093 </para>
57094 <para>
57095 <indexterm role="option">
57096 <primary><option>server_param2</option></primary>
57097 </indexterm>
57098 </para>
57099 <informaltable frame="all">
57100 <tgroup cols="4" colsep="0" rowsep="0">
57101 <colspec colwidth="8*" align="left"/>
57102 <colspec colwidth="6*" align="center"/>
57103 <colspec colwidth="6*" align="center"/>
57104 <colspec colwidth="6*" align="right"/>
57105 <tbody>
57106 <row>
57107 <entry><option>server_param2</option></entry>
57108 <entry>Use: <emphasis>external</emphasis></entry>
57109 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57110 <entry>Default: <emphasis>unset</emphasis></entry>
57111 </row>
57112 </tbody>
57113 </tgroup>
57114 </informaltable>
57115 <para>
57116 <indexterm role="option">
57117 <primary><option>server_param3</option></primary>
57118 </indexterm>
57119 </para>
57120 <informaltable frame="all">
57121 <tgroup cols="4" colsep="0" rowsep="0">
57122 <colspec colwidth="8*" align="left"/>
57123 <colspec colwidth="6*" align="center"/>
57124 <colspec colwidth="6*" align="center"/>
57125 <colspec colwidth="6*" align="right"/>
57126 <tbody>
57127 <row>
57128 <entry><option>server_param3</option></entry>
57129 <entry>Use: <emphasis>external</emphasis></entry>
57130 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57131 <entry>Default: <emphasis>unset</emphasis></entry>
57132 </row>
57133 </tbody>
57134 </tgroup>
57135 </informaltable>
57136 <para>
57137 <indexterm role="concept">
57138 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
57139 <secondary>in <command>external</command> authenticator</secondary>
57140 </indexterm>
57141 These options are expanded before the <option>server_condition</option> option
57142 and the result are placed in <varname>$auth2</varname> and <varname>$auth3</varname> resectively.
57143 If the expansion is forced to fail, authentication fails. Any other expansion
57144 failure causes a temporary error code to be returned.
57145 </para>
57146 <para>
57147 They can be used to clarify the coding of a complex <option>server_condition</option>.
57148 </para>
57149 </section>
57150 <section id="SECTexternserver">
57151 <title>Using external in a server</title>
57152 <para>
57153 <indexterm role="concept">
57154 <primary>AUTH</primary>
57155 <secondary>in <command>external</command> authenticator</secondary>
57156 </indexterm>
57157 <indexterm role="concept">
57158 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
57159 <secondary>in <command>external</command> authenticator</secondary>
57160 </indexterm>
57161 <indexterm role="variable">
57162 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
57163 </indexterm>
57164 <indexterm role="concept">
57165 <primary>base64 encoding</primary>
57166 <secondary>in <command>external</command> authenticator</secondary>
57167 </indexterm>
57168 </para>
57169 <para>
57170 When running as a server, <command>external</command> performs the authentication test by
57171 expanding a string. The data sent by the client with the AUTH command, or in
57172 response to subsequent prompts, is base64 encoded, and so may contain any byte
57173 values when decoded. The decoded value is treated as
57174 an identity for authentication and
57175 placed in the expansion variable <varname>$auth1</varname>.
57176 </para>
57177 <para>
57178 For compatibility with previous releases of Exim, the value is also placed in
57179 the expansion variable <varname>$1</varname>. However, the use of this
57180 variable for this purpose is now deprecated, as it can lead to confusion in
57181 string expansions that also use them for other things.
57182 </para>
57183 <para>
57184 <indexterm role="variable">
57185 <primary><varname>$authenticated_id</varname></primary>
57186 </indexterm>
57187 Once an identity has been received,
57188 <option>server_condition</option> is expanded. If the expansion is forced to fail,
57189 authentication fails. Any other expansion failure causes a temporary error code
57190 to be returned. If the result of a successful expansion is an empty string,
57191 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
57192 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
57193 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
57194 For any other result, a temporary error code is returned, with the expanded
57195 string as the error text.
57196 </para>
57197 <para>
57198 Example:
57199 </para>
57200 <literallayout class="monospaced">
57201 ext_ccert_san_mail:
57202   driver =            external
57203   public_name =       EXTERNAL
57204
57205   server_advertise_condition = $tls_in_certificate_verified
57206   server_param2 =     ${certextract {subj_altname,mail,&gt;:} \
57207                                     {$tls_in_peercert}}
57208   server_condition =  ${if forany {$auth2} \
57209                             {eq {$item}{$auth1}}}
57210   server_set_id =     $auth1
57211 </literallayout>
57212 <para>
57213 This accepts a client certificate that is verifiable against any
57214 of your configured trust-anchors
57215 (which usually means the full set of public CAs)
57216 and which has a mail-SAN matching the claimed identity sent by the client.
57217 </para>
57218 <para>
57219 <emphasis role="bold">Note</emphasis>: up to TLS1.2, the client cert is on the wire in-clear, including the SAN.
57220 The account name is therefore guessable by an opponent.
57221 TLS 1.3 protects both server and client certificates, and is not vulnerable
57222 in this way.
57223 </para>
57224 </section>
57225 <section id="SECTexternclient">
57226 <title>Using external in a client</title>
57227 <para>
57228 <indexterm role="concept">
57229 <primary>options</primary>
57230 <secondary><command>external</command> authenticator (client)</secondary>
57231 </indexterm>
57232 The <command>external</command> authenticator has one client option:
57233 </para>
57234 <para>
57235 <indexterm role="option">
57236 <primary><option>client_send</option></primary>
57237 </indexterm>
57238 </para>
57239 <informaltable frame="all">
57240 <tgroup cols="4" colsep="0" rowsep="0">
57241 <colspec colwidth="8*" align="left"/>
57242 <colspec colwidth="6*" align="center"/>
57243 <colspec colwidth="6*" align="center"/>
57244 <colspec colwidth="6*" align="right"/>
57245 <tbody>
57246 <row>
57247 <entry><option>client_send</option></entry>
57248 <entry>Use: <emphasis>external</emphasis></entry>
57249 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57250 <entry>Default: <emphasis>unset</emphasis></entry>
57251 </row>
57252 </tbody>
57253 </tgroup>
57254 </informaltable>
57255 <para>
57256 This option is expanded and sent with the AUTH command as the
57257 identity being asserted.
57258 </para>
57259 <para>
57260 Example:
57261 </para>
57262 <literallayout class="monospaced">
57263 ext_ccert:
57264   driver =      external
57265   public_name = EXTERNAL
57266
57267   client_condition = ${if !eq{$tls_out_cipher}{}}
57268   client_send = myaccount@smarthost.example.net
57269 </literallayout>
57270 <para>
57271 <indexterm role="concept" startref="IIDexternauth1" class="endofrange"/>
57272 <indexterm role="concept" startref="IIDexternauth2" class="endofrange"/>
57273 </para>
57274 </section>
57275 </chapter>
57276
57277 <chapter id="CHAPtlsauth">
57278 <title>The tls authenticator</title>
57279 <para>
57280 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
57281 <primary><command>tls</command> authenticator</primary>
57282 </indexterm>
57283 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
57284 <primary>authenticators</primary>
57285 <secondary><command>tls</command></secondary>
57286 </indexterm>
57287 <indexterm role="concept">
57288 <primary>authentication</primary>
57289 <secondary>Client Certificate</secondary>
57290 </indexterm>
57291 <indexterm role="concept">
57292 <primary>authentication</primary>
57293 <secondary>X509</secondary>
57294 </indexterm>
57295 <indexterm role="concept">
57296 <primary>Certificate-based authentication</primary>
57297 </indexterm>
57298 The <command>tls</command> authenticator provides server support for
57299 authentication based on client certificates.
57300 </para>
57301 <para>
57302 It is not an SMTP authentication mechanism and is not
57303 advertised by the server as part of the SMTP EHLO response.
57304 It is an Exim authenticator in the sense that it affects
57305 the protocol element of the log line, can be tested for
57306 by the <option>authenticated</option> ACL condition, and can set
57307 the <varname>$authenticated_id</varname> variable.
57308 </para>
57309 <para>
57310 The client must present a verifiable certificate,
57311 for which it must have been requested via the
57312 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
57313 (see <xref linkend="CHAPTLS"/>).
57314 </para>
57315 <para>
57316 If an authenticator of this type is configured it is
57317 run immediately after a TLS connection being negotiated
57318 (due to either STARTTLS or TLS-on-connect)
57319 and can authenticate the connection.
57320 If it does, SMTP authentication is not subsequently offered.
57321 </para>
57322 <para>
57323 A maximum of one authenticator of this type may be present.
57324 </para>
57325 <para>
57326 <indexterm role="concept">
57327 <primary>options</primary>
57328 <secondary><command>tls</command> authenticator (server)</secondary>
57329 </indexterm>
57330 The <command>tls</command> authenticator has three server options:
57331 </para>
57332 <para>
57333 <indexterm role="option">
57334 <primary><option>server_param1</option></primary>
57335 </indexterm>
57336 </para>
57337 <informaltable frame="all">
57338 <tgroup cols="4" colsep="0" rowsep="0">
57339 <colspec colwidth="8*" align="left"/>
57340 <colspec colwidth="6*" align="center"/>
57341 <colspec colwidth="6*" align="center"/>
57342 <colspec colwidth="6*" align="right"/>
57343 <tbody>
57344 <row>
57345 <entry><option>server_param1</option></entry>
57346 <entry>Use: <emphasis>tls</emphasis></entry>
57347 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57348 <entry>Default: <emphasis>unset</emphasis></entry>
57349 </row>
57350 </tbody>
57351 </tgroup>
57352 </informaltable>
57353 <para>
57354 <indexterm role="concept">
57355 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
57356 <secondary>in <command>tls</command> authenticator</secondary>
57357 </indexterm>
57358 This option is expanded after the TLS negotiation and
57359 the result is placed in <varname>$auth1</varname>.
57360 If the expansion is forced to fail, authentication fails. Any other expansion
57361 failure causes a temporary error code to be returned.
57362 </para>
57363 <para>
57364 <indexterm role="option">
57365 <primary><option>server_param2</option></primary>
57366 </indexterm>
57367 </para>
57368 <informaltable frame="all">
57369 <tgroup cols="4" colsep="0" rowsep="0">
57370 <colspec colwidth="8*" align="left"/>
57371 <colspec colwidth="6*" align="center"/>
57372 <colspec colwidth="6*" align="center"/>
57373 <colspec colwidth="6*" align="right"/>
57374 <tbody>
57375 <row>
57376 <entry><option>server_param2</option></entry>
57377 <entry>Use: <emphasis>tls</emphasis></entry>
57378 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57379 <entry>Default: <emphasis>unset</emphasis></entry>
57380 </row>
57381 </tbody>
57382 </tgroup>
57383 </informaltable>
57384 <para>
57385 <indexterm role="option">
57386 <primary><option>server_param3</option></primary>
57387 </indexterm>
57388 </para>
57389 <informaltable frame="all">
57390 <tgroup cols="4" colsep="0" rowsep="0">
57391 <colspec colwidth="8*" align="left"/>
57392 <colspec colwidth="6*" align="center"/>
57393 <colspec colwidth="6*" align="center"/>
57394 <colspec colwidth="6*" align="right"/>
57395 <tbody>
57396 <row>
57397 <entry><option>server_param3</option></entry>
57398 <entry>Use: <emphasis>tls</emphasis></entry>
57399 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57400 <entry>Default: <emphasis>unset</emphasis></entry>
57401 </row>
57402 </tbody>
57403 </tgroup>
57404 </informaltable>
57405 <para>
57406 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
57407 </para>
57408 <para>
57409 <option>server_param1</option> may also be spelled <option>server_param</option>.
57410 </para>
57411 <para>
57412 Example:
57413 </para>
57414 <literallayout class="monospaced">
57415 tls:
57416   driver = tls
57417   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
57418                                     {$tls_in_peercert}}
57419   server_condition =  ${if and { {eq{$tls_in_certificate_verified}{1}} \
57420                                  {forany {$auth1} \
57421                             {!= {0} \
57422                                 {${lookup ldap{ldap:///\
57423                          mailname=${quote_ldap_dn:${lc:$item}},\
57424                          ou=users,LDAP_DC?mailid} {$value}{0} \
57425                        }    }  } }}}
57426   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
57427 </literallayout>
57428 <para>
57429 This accepts a client certificate that is verifiable against any
57430 of your configured trust-anchors
57431 (which usually means the full set of public CAs)
57432 and which has a SAN with a good account name.
57433 </para>
57434 <para>
57435 Note that, up to TLS1.2, the client cert is on the wire in-clear, including the SAN,
57436 The account name is therefore guessable by an opponent.
57437 TLS 1.3 protects both server and client certificates, and is not vulnerable
57438 in this way.
57439 Likewise, a traditional plaintext SMTP AUTH done inside TLS is not.
57440 </para>
57441 <para>
57442 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
57443 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
57444 </para>
57445 <para>
57446 Note that because authentication is traditionally an SMTP operation,
57447 the <option>authenticated</option> ACL condition cannot be used in
57448 a connect- or helo-ACL.
57449 </para>
57450 </chapter>
57451
57452 <chapter id="CHAPTLS">
57453 <title>Encrypted SMTP connections using TLS/SSL</title>
57454 <titleabbrev>Encrypted SMTP connections</titleabbrev>
57455 <para>
57456 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
57457 <primary>encryption</primary>
57458 <secondary>on SMTP connection</secondary>
57459 </indexterm>
57460 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
57461 <primary>SMTP</primary>
57462 <secondary>encryption</secondary>
57463 </indexterm>
57464 <indexterm role="concept">
57465 <primary>TLS</primary>
57466 <secondary>on SMTP connection</secondary>
57467 </indexterm>
57468 <indexterm role="concept">
57469 <primary>OpenSSL</primary>
57470 </indexterm>
57471 <indexterm role="concept">
57472 <primary>GnuTLS</primary>
57473 </indexterm>
57474 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
57475 Sockets Layer), is implemented by making use of the OpenSSL library or the
57476 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
57477 cryptographic code in the Exim distribution itself for implementing TLS. In
57478 order to use this feature you must install OpenSSL or GnuTLS, and then build a
57479 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
57480 You also need to understand the basic concepts of encryption at a managerial
57481 level, and in particular, the way that public keys, private keys, and
57482 certificates are used.
57483 </para>
57484 <para>
57485 RFC 3207 defines how SMTP connections can make use of encryption. Once a
57486 connection is established, the client issues a STARTTLS command. If the
57487 server accepts this, the client and the server negotiate an encryption
57488 mechanism. If the negotiation succeeds, the data that subsequently passes
57489 between them is encrypted.
57490 </para>
57491 <para>
57492 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
57493 and if so, what cipher suite is in use, whether the client supplied a
57494 certificate, and whether or not that certificate was verified. This makes it
57495 possible for an Exim server to deny or accept certain commands based on the
57496 encryption state.
57497 </para>
57498 <para>
57499 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
57500 disrupt TLS connections. You need to turn off SMTP scanning for these products
57501 in order to get TLS to work.
57502 </para>
57503 <section id="SECID284">
57504 <title>Support for the <quote>submissions</quote> (aka <quote>ssmtp</quote> and <quote>smtps</quote>) protocol</title>
57505 <para>
57506 <indexterm role="concept">
57507 <primary>submissions protocol</primary>
57508 </indexterm>
57509 <indexterm role="concept">
57510 <primary>ssmtp protocol</primary>
57511 </indexterm>
57512 <indexterm role="concept">
57513 <primary>smtps protocol</primary>
57514 </indexterm>
57515 <indexterm role="concept">
57516 <primary>SMTP</primary>
57517 <secondary>submissions protocol</secondary>
57518 </indexterm>
57519 <indexterm role="concept">
57520 <primary>SMTP</primary>
57521 <secondary>ssmtp protocol</secondary>
57522 </indexterm>
57523 <indexterm role="concept">
57524 <primary>SMTP</primary>
57525 <secondary>smtps protocol</secondary>
57526 </indexterm>
57527 The history of port numbers for TLS in SMTP is a little messy and has been
57528 contentious.  As of RFC 8314, the common practice of using the historically
57529 allocated port 465 for "email submission but with TLS immediately upon connect
57530 instead of using STARTTLS" is officially blessed by the IETF, and recommended
57531 by them in preference to STARTTLS.
57532 </para>
57533 <para>
57534 The name originally assigned to the port was <quote>ssmtp</quote> or <quote>smtps</quote>, but as
57535 clarity emerged over the dual roles of SMTP, for MX delivery and Email
57536 Submission, nomenclature has shifted.  The modern name is now <quote>submissions</quote>.
57537 </para>
57538 <para>
57539 This approach was, for a while, officially abandoned when encrypted SMTP was
57540 standardized, but many clients kept using it, even as the TCP port number was
57541 reassigned for other use.
57542 Thus you may encounter guidance claiming that you shouldn&#x2019;t enable use of
57543 this port.
57544 In practice, a number of mail-clients have only ever supported submissions,
57545 not submission with STARTTLS upgrade.
57546 Ideally, offer both submission (587) and submissions (465) service.
57547 </para>
57548 <para>
57549 Exim supports TLS-on-connect by means of the <option>tls_on_connect_ports</option>
57550 global option. Its value must be a list of port numbers;
57551 the most common use is expected to be:
57552 </para>
57553 <literallayout class="monospaced">
57554 tls_on_connect_ports = 465
57555 </literallayout>
57556 <para>
57557 The port numbers specified by this option apply to all SMTP connections, both
57558 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
57559 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
57560 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
57561 an extra port &ndash; rather, it specifies different behaviour on a port that is
57562 defined elsewhere.
57563 </para>
57564 <para>
57565 There is also a <option>-tls-on-connect</option> command line option. This overrides
57566 <option>tls_on_connect_ports</option>; it forces the TLS-only behaviour for all ports.
57567 </para>
57568 </section>
57569 <section id="SECTopenvsgnu">
57570 <title>OpenSSL vs GnuTLS</title>
57571 <para>
57572 <indexterm role="concept">
57573 <primary>TLS</primary>
57574 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
57575 </indexterm>
57576 TLS is supported in Exim using either the OpenSSL or GnuTLS library.
57577 To build Exim to use OpenSSL you need to set
57578 </para>
57579 <literallayout class="monospaced">
57580 USE_OPENSSL=yes
57581 </literallayout>
57582 <para>
57583 in Local/Makefile.
57584 </para>
57585 <para>
57586 To build Exim to use GnuTLS, you need to set
57587 </para>
57588 <literallayout class="monospaced">
57589 USE_GNUTLS=yes
57590 </literallayout>
57591 <para>
57592 in Local/Makefile.
57593 </para>
57594 <para>
57595 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
57596 include files and libraries for GnuTLS can be found.
57597 </para>
57598 <para>
57599 There are some differences in usage when using GnuTLS instead of OpenSSL:
57600 </para>
57601 <itemizedlist>
57602 <listitem>
57603 <para>
57604 The <option>tls_verify_certificates</option> option
57605 cannot be the path of a directory
57606 for GnuTLS versions before 3.3.6
57607 (for later versions, or OpenSSL, it can be either).
57608 </para>
57609 </listitem>
57610 <listitem>
57611 <para>
57612 The default value for <option>tls_dhparam</option> differs for historical reasons.
57613 </para>
57614 </listitem>
57615 <listitem>
57616 <para>
57617 <indexterm role="variable">
57618 <primary><varname>$tls_in_peerdn</varname></primary>
57619 </indexterm>
57620 <indexterm role="variable">
57621 <primary><varname>$tls_out_peerdn</varname></primary>
57622 </indexterm>
57623 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
57624 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
57625 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
57626 </para>
57627 </listitem>
57628 <listitem>
57629 <para>
57630 OpenSSL identifies cipher suites using hyphens as separators, for example:
57631 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
57632 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
57633 in a cipher list. To make life simpler, Exim changes underscores to hyphens
57634 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
57635 to handle its own older variants) when processing lists of cipher suites in the
57636 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
57637 option).
57638 </para>
57639 </listitem>
57640 <listitem>
57641 <para>
57642 The <option>tls_require_ciphers</option> options operate differently, as described in the
57643 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
57644 </para>
57645 </listitem>
57646 <listitem>
57647 <para>
57648 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
57649 When using OpenSSL, this option is ignored.
57650 (If an API is found to let OpenSSL be configured in this way,
57651 let the Exim Maintainers know and we&#x2019;ll likely use it).
57652 </para>
57653 </listitem>
57654 <listitem>
57655 <para>
57656 With GnuTLS, if an explicit list is used for the <option>tls_privatekey</option> main option,
57657 it must be ordered to match the <option>tls_certificate</option> list.
57658 </para>
57659 </listitem>
57660 <listitem>
57661 <para>
57662 Some other recently added features may only be available in one or the other.
57663 This should be documented with the feature.  If the documentation does not
57664 explicitly state that the feature is infeasible in the other TLS
57665 implementation, then patches are welcome.
57666 </para>
57667 </listitem>
57668 <listitem>
57669 <para>
57670 The output from "exim -bV" will show which (if any) support was included
57671 in the build.
57672 Also, the macro "_HAVE_OPENSSL" or "_HAVE_GNUTLS" will be defined.
57673 </para>
57674 </listitem>
57675 </itemizedlist>
57676 </section>
57677 <section id="SECTgnutlsparam">
57678 <title>GnuTLS parameter computation</title>
57679 <para>
57680 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
57681 an explicit path; if the latter, then the text about generation still applies,
57682 but not the chosen filename.
57683 By default, as of Exim 4.80 a hard-coded D-H prime is used.
57684 See the documentation of <option>tls_dhparam</option> for more information.
57685 </para>
57686 <para>
57687 GnuTLS uses D-H parameters that may take a substantial amount of time
57688 to compute. It is unreasonable to re-compute them for every TLS session.
57689 Therefore, Exim keeps this data in a file in its spool directory, called
57690 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
57691 of bits requested.
57692 The file is owned by the Exim user and is readable only by
57693 its owner. Every Exim process that start up GnuTLS reads the D-H
57694 parameters from this file. If the file does not exist, the first Exim process
57695 that needs it computes the data and writes it to a temporary file which is
57696 renamed once it is complete. It does not matter if several Exim processes do
57697 this simultaneously (apart from wasting a few resources). Once a file is in
57698 place, new Exim processes immediately start using it.
57699 </para>
57700 <para>
57701 For maximum security, the parameters that are stored in this file should be
57702 recalculated periodically, the frequency depending on your paranoia level.
57703 If you are avoiding using the fixed D-H primes published in RFCs, then you
57704 are concerned about some advanced attacks and will wish to do this; if you do
57705 not regenerate then you might as well stick to the standard primes.
57706 </para>
57707 <para>
57708 Arranging this is easy in principle; just delete the file when you want new
57709 values to be computed. However, there may be a problem. The calculation of new
57710 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
57711 If the system is not very active, <filename>/dev/random</filename> may delay returning data
57712 until enough randomness (entropy) is available. This may cause Exim to hang for
57713 a substantial amount of time, causing timeouts on incoming connections.
57714 </para>
57715 <para>
57716 The solution is to generate the parameters externally to Exim. They are stored
57717 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
57718 generated externally using the <command>certtool</command> command that is part of GnuTLS.
57719 </para>
57720 <para>
57721 To replace the parameters with new ones, instead of deleting the file
57722 and letting Exim re-create it, you can generate new parameters using
57723 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
57724 renaming. The relevant commands are something like this:
57725 </para>
57726 <literallayout class="monospaced">
57727 # ls
57728 [ look for file; assume gnutls-params-2236 is the most recent ]
57729 # rm -f new-params
57730 # touch new-params
57731 # chown exim:exim new-params
57732 # chmod 0600 new-params
57733 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
57734 # openssl dhparam -noout -text -in new-params | head
57735 [ check the first line, make sure it's not more than 2236;
57736   if it is, then go back to the start ("rm") and repeat
57737   until the size generated is at most the size requested ]
57738 # chmod 0400 new-params
57739 # mv new-params gnutls-params-2236
57740 </literallayout>
57741 <para>
57742 If Exim never has to generate the parameters itself, the possibility of
57743 stalling is removed.
57744 </para>
57745 <para>
57746 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
57747 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
57748 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
57749 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
57750 and Exim does so.  This attempt to remove Exim from TLS policy decisions
57751 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
57752 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
57753 which applies to all D-H usage, client or server.  If the value returned by
57754 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
57755 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
57756 limit, which is still much higher than Exim historically used.
57757 </para>
57758 <para>
57759 The filename and bits used will change as the GnuTLS maintainers change the
57760 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
57761 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
57762 2432 bits, while NSS is limited to 2236 bits.
57763 </para>
57764 <para>
57765 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
57766 increase the chance of the generated prime actually being within acceptable
57767 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
57768 procedure above.  There is no sane procedure available to Exim to double-check
57769 the size of the generated prime, so it might still be too large.
57770 </para>
57771 </section>
57772 <section id="SECTreqciphssl">
57773 <title>Requiring specific ciphers in OpenSSL</title>
57774 <para>
57775 <indexterm role="concept">
57776 <primary>TLS</primary>
57777 <secondary>requiring specific ciphers (OpenSSL)</secondary>
57778 </indexterm>
57779 <indexterm role="option">
57780 <primary><option>tls_require_ciphers</option></primary>
57781 <secondary>OpenSSL</secondary>
57782 </indexterm>
57783 There is a function in the OpenSSL library that can be passed a list of cipher
57784 suites before the cipher negotiation takes place. This specifies which ciphers
57785 are acceptable for TLS versions prior to 1.3.
57786 The list is colon separated and may contain names like
57787 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
57788 directly to this function call.
57789 Many systems will install the OpenSSL manual-pages, so you may have
57790 <emphasis>ciphers(1)</emphasis> available to you.
57791 The following quotation from the OpenSSL
57792 documentation specifies what forms of item are allowed in the cipher string:
57793 </para>
57794 <itemizedlist>
57795 <listitem>
57796 <para>
57797 It can consist of a single cipher suite such as RC4-SHA.
57798 </para>
57799 </listitem>
57800 <listitem>
57801 <para>
57802 It can represent a list of cipher suites containing a certain algorithm,
57803 or cipher suites of a certain type. For example SHA1 represents all
57804 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
57805 SSL v3 algorithms.
57806 </para>
57807 </listitem>
57808 <listitem>
57809 <para>
57810 Lists of cipher suites can be combined in a single cipher string using
57811 the + character. This is used as a logical and operation. For example
57812 SHA1+DES represents all cipher suites containing the SHA1 and the DES
57813 algorithms.
57814 </para>
57815 </listitem>
57816 </itemizedlist>
57817 <para>
57818 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
57819 <literal>-</literal> or <literal>+</literal>.
57820 </para>
57821 <itemizedlist>
57822 <listitem>
57823 <para>
57824 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
57825 ciphers deleted can never reappear in the list even if they are explicitly
57826 stated.
57827 </para>
57828 </listitem>
57829 <listitem>
57830 <para>
57831 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
57832 of the ciphers can be added again by later options.
57833 </para>
57834 </listitem>
57835 <listitem>
57836 <para>
57837 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
57838 option does not add any new ciphers; it just moves matching existing ones.
57839 </para>
57840 </listitem>
57841 </itemizedlist>
57842 <para>
57843 If none of these characters is present, the string is interpreted as
57844 a list of ciphers to be appended to the current preference list. If the list
57845 includes any ciphers already present they will be ignored: that is, they will
57846 not be moved to the end of the list.
57847 </para>
57848 <para>
57849 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
57850 string:
57851 </para>
57852 <literallayout class="monospaced">
57853 # note single-quotes to get ! past any shell history expansion
57854 $ openssl ciphers 'HIGH:!MD5:!SHA1'
57855 </literallayout>
57856 <para>
57857 This example will let the library defaults be permitted on the MX port, where
57858 there&#x2019;s probably no identity verification anyway, but ups the ante on the
57859 submission ports where the administrator might have some influence on the
57860 choice of clients used:
57861 </para>
57862 <literallayout class="monospaced">
57863 # OpenSSL variant; see man ciphers(1)
57864 tls_require_ciphers = ${if =={$received_port}{25}\
57865                            {DEFAULT}\
57866                            {HIGH:!MD5:!SHA1}}
57867 </literallayout>
57868 <para>
57869 This example will prefer ECDSA-authenticated ciphers over RSA ones:
57870 </para>
57871 <literallayout class="monospaced">
57872 tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT
57873 </literallayout>
57874 <para>
57875 For TLS version 1.3 the control available is less fine-grained
57876 and Exim does not provide access to it at present.
57877 The value of the <option>tls_require_ciphers</option> option is ignored when
57878 TLS version 1.3 is negotiated.
57879 </para>
57880 <para>
57881 As of writing the library default cipher suite list for TLSv1.3 is
57882 </para>
57883 <literallayout class="monospaced">
57884 TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
57885 </literallayout>
57886 </section>
57887 <section id="SECTreqciphgnu">
57888 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
57889 <para>
57890 <indexterm role="concept">
57891 <primary>GnuTLS</primary>
57892 <secondary>specifying parameters for</secondary>
57893 </indexterm>
57894 <indexterm role="concept">
57895 <primary>TLS</primary>
57896 <secondary>specifying ciphers (GnuTLS)</secondary>
57897 </indexterm>
57898 <indexterm role="concept">
57899 <primary>TLS</primary>
57900 <secondary>specifying key exchange methods (GnuTLS)</secondary>
57901 </indexterm>
57902 <indexterm role="concept">
57903 <primary>TLS</primary>
57904 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
57905 </indexterm>
57906 <indexterm role="concept">
57907 <primary>TLS</primary>
57908 <secondary>specifying protocols (GnuTLS)</secondary>
57909 </indexterm>
57910 <indexterm role="concept">
57911 <primary>TLS</primary>
57912 <secondary>specifying priority string (GnuTLS)</secondary>
57913 </indexterm>
57914 <indexterm role="option">
57915 <primary><option>tls_require_ciphers</option></primary>
57916 <secondary>GnuTLS</secondary>
57917 </indexterm>
57918 The GnuTLS library allows the caller to provide a "priority string", documented
57919 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
57920 ciphersuite specification in OpenSSL.
57921 </para>
57922 <para>
57923 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
57924 and controls both protocols and ciphers.
57925 </para>
57926 <para>
57927 The <option>tls_require_ciphers</option> option is available both as an global option,
57928 controlling how Exim behaves as a server, and also as an option of the
57929 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
57930 the value is string expanded.  The resulting string is not an Exim list and
57931 the string is given to the GnuTLS library, so that Exim does not need to be
57932 aware of future feature enhancements of GnuTLS.
57933 </para>
57934 <para>
57935 Documentation of the strings accepted may be found in the GnuTLS manual, under
57936 "Priority strings".  This is online as
57937 <emphasis role="bold"><ulink url="https://www.gnutls.org/manual/html_node/Priority-Strings.html">https://www.gnutls.org/manual/html_node/Priority-Strings.html</ulink></emphasis>,
57938 but beware that this relates to GnuTLS 3, which may be newer than the version
57939 installed on your system.  If you are using GnuTLS 3,
57940 then the example code
57941 <emphasis role="bold"><ulink url="https://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string">https://www.gnutls.org/manual/gnutls.html#Listing-the-ciphersuites-in-a-priority-string</ulink></emphasis>
57942 on that site can be used to test a given string.
57943 </para>
57944 <para>
57945 For example:
57946 </para>
57947 <literallayout class="monospaced">
57948 # Disable older versions of protocols
57949 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
57950 </literallayout>
57951 <para>
57952 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
57953 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
57954 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
57955 </para>
57956 <para>
57957 This example will let the library defaults be permitted on the MX port, where
57958 there&#x2019;s probably no identity verification anyway, and lowers security further
57959 by increasing compatibility; but this ups the ante on the submission ports
57960 where the administrator might have some influence on the choice of clients
57961 used:
57962 </para>
57963 <literallayout class="monospaced">
57964 # GnuTLS variant
57965 tls_require_ciphers = ${if =={$received_port}{25}\
57966                            {NORMAL:%COMPAT}\
57967                            {SECURE128}}
57968 </literallayout>
57969 </section>
57970 <section id="SECID182">
57971 <title>Configuring an Exim server to use TLS</title>
57972 <para>
57973 <indexterm role="concept">
57974 <primary>TLS</primary>
57975 <secondary>configuring an Exim server</secondary>
57976 </indexterm>
57977 <indexterm role="concept">
57978 <primary>ESMTP extensions</primary>
57979 <secondary>STARTTLS</secondary>
57980 </indexterm>
57981 When Exim has been built with TLS support, it advertises the availability of
57982 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
57983 but not to any others. The default value of this option is *, which means
57984 that STARTTLS is always advertised.  Set it to blank to never advertise;
57985 this is reasonable for systems that want to use TLS only as a client.
57986 </para>
57987 <para>
57988 If STARTTLS is to be used you
57989 need to set some other options in order to make TLS available.
57990 </para>
57991 <para>
57992 If a client issues a STARTTLS command and there is some configuration
57993 problem in the server, the command is rejected with a 454 error. If the client
57994 persists in trying to issue SMTP commands, all except QUIT are rejected
57995 with the error
57996 </para>
57997 <literallayout class="monospaced">
57998 554 Security failure
57999 </literallayout>
58000 <para>
58001 If a STARTTLS command is issued within an existing TLS session, it is
58002 rejected with a 554 error code.
58003 </para>
58004 <para>
58005 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
58006 must be set to match some hosts. The default is * which matches all hosts.
58007 </para>
58008 <para>
58009 If this is all you do, TLS encryption will be enabled but not authentication -
58010 meaning that the peer has no assurance it is actually you he is talking to.
58011 You gain protection from a passive sniffer listening on the wire but not
58012 from someone able to intercept the communication.
58013 </para>
58014 <para>
58015 Further protection requires some further configuration at the server end.
58016 </para>
58017 <para>
58018 To make TLS work you need to set, in the server,
58019 </para>
58020 <literallayout class="monospaced">
58021 tls_certificate = /some/file/name
58022 tls_privatekey = /some/file/name
58023 </literallayout>
58024 <para>
58025 These options are, in fact, expanded strings, so you can make them depend on
58026 the identity of the client that is connected if you wish. The first file
58027 contains the server&#x2019;s X509 certificate, and the second contains the private key
58028 that goes with it. These files need to be
58029 PEM format and readable by the Exim user, and must
58030 always be given as full path names.
58031 The key must not be password-protected.
58032 They can be the same file if both the
58033 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
58034 set, or if its expansion is forced to fail or results in an empty string, this
58035 is assumed to be the case. The certificate file may also contain intermediate
58036 certificates that need to be sent to the client to enable it to authenticate
58037 the server&#x2019;s certificate.
58038 </para>
58039 <para>
58040 For dual-stack (eg. RSA and ECDSA) configurations, these options can be
58041 colon-separated lists of file paths.  Ciphers using given authentication
58042 algorithms require the presence of a suitable certificate to supply the
58043 public-key.  The server selects among the certificates to present to the
58044 client depending on the selected cipher, hence the priority ordering for
58045 ciphers will affect which certificate is used.
58046 </para>
58047 <para>
58048 If you do not understand about certificates and keys, please try to find a
58049 source of this background information, which is not Exim-specific. (There are a
58050 few comments below in section <xref linkend="SECTcerandall"/>.)
58051 </para>
58052 <para>
58053 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
58054 they apply only in the case of a server. If you need to use a certificate in an
58055 Exim client, you must set the options of the same names in an <command>smtp</command>
58056 transport.
58057 </para>
58058 <para>
58059 With just these options, an Exim server will be able to use TLS. It does not
58060 require the client to have a certificate (but see below for how to insist on
58061 this). There is one other option that may be needed in other situations. If
58062 </para>
58063 <literallayout class="monospaced">
58064 tls_dhparam = /some/file/name
58065 </literallayout>
58066 <para>
58067 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
58068 with the parameters contained in the file.
58069 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
58070 available:
58071 </para>
58072 <literallayout class="monospaced">
58073 tls_dhparam = none
58074 </literallayout>
58075 <para>
58076 This may also be set to a string identifying a standard prime to be used for
58077 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
58078 used is <literal>ike23</literal>.  There are a few standard primes available, see the
58079 documentation for <option>tls_dhparam</option> for the complete list.
58080 </para>
58081 <para>
58082 See the command
58083 </para>
58084 <literallayout class="monospaced">
58085 openssl dhparam
58086 </literallayout>
58087 <para>
58088 for a way of generating file data.
58089 </para>
58090 <para>
58091 The strings supplied for these three options are expanded every time a client
58092 host connects. It is therefore possible to use different certificates and keys
58093 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
58094 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
58095 forced to fail, Exim behaves as if the option is not set.
58096 </para>
58097 <para>
58098 <indexterm role="concept">
58099 <primary>cipher</primary>
58100 <secondary>logging</secondary>
58101 </indexterm>
58102 <indexterm role="concept">
58103 <primary>log</primary>
58104 <secondary>TLS cipher</secondary>
58105 </indexterm>
58106 <indexterm role="variable">
58107 <primary><varname>$tls_in_cipher</varname></primary>
58108 </indexterm>
58109 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
58110 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
58111 incoming message (by default &ndash; you can, of course, change this), and it is
58112 also included in the log line that records a message&#x2019;s arrival, keyed by
58113 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
58114 condition can be used to test for specific cipher suites in ACLs.
58115 </para>
58116 <para>
58117 Once TLS has been established, the ACLs that run for subsequent SMTP commands
58118 can check the name of the cipher suite and vary their actions accordingly. The
58119 cipher suite names vary, depending on which TLS library is being used. For
58120 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
58121 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
58122 documentation for more details.
58123 </para>
58124 <para>
58125 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
58126 (again depending on the <option>tls_cipher</option> log selector).
58127 </para>
58128 <section>
58129 <title>Requesting and verifying client certificates</title>
58130 <para>
58131 <indexterm role="concept">
58132 <primary>certificate</primary>
58133 <secondary>verification of client</secondary>
58134 </indexterm>
58135 <indexterm role="concept">
58136 <primary>TLS</primary>
58137 <secondary>client certificate verification</secondary>
58138 </indexterm>
58139 If you want an Exim server to request a certificate when negotiating a TLS
58140 session with a client, you must set either <option>tls_verify_hosts</option> or
58141 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
58142 apply to all TLS connections. For any host that matches one of these options,
58143 Exim requests a certificate as part of the setup of the TLS session. The
58144 contents of the certificate are verified by comparing it with a list of
58145 expected trust-anchors or certificates.
58146 These may be the system default set (depending on library version),
58147 an explicit file or,
58148 depending on library version, a directory, identified by
58149 <option>tls_verify_certificates</option>.
58150 </para>
58151 <para>
58152 A file can contain multiple certificates, concatenated end to end. If a
58153 directory is used
58154 (OpenSSL only),
58155 each certificate must be in a separate file, with a name (or a symbolic link)
58156 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
58157 certificate. You can compute the relevant hash by running the command
58158 </para>
58159 <literallayout class="monospaced">
58160 openssl x509 -hash -noout -in /cert/file
58161 </literallayout>
58162 <para>
58163 where <filename>/cert/file</filename> contains a single certificate.
58164 </para>
58165 <para>
58166 There is no checking of names of the client against the certificate
58167 Subject Name or Subject Alternate Names.
58168 </para>
58169 <para>
58170 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
58171 what happens if the client does not supply a certificate, or if the certificate
58172 does not match any of the certificates in the collection named by
58173 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
58174 attempt to set up a TLS session is aborted, and the incoming connection is
58175 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
58176 session continues. ACLs that run for subsequent SMTP commands can detect the
58177 fact that no certificate was verified, and vary their actions accordingly. For
58178 example, you can insist on a certificate before accepting a message for
58179 relaying, but not when the message is destined for local delivery.
58180 </para>
58181 <para>
58182 <indexterm role="variable">
58183 <primary><varname>$tls_in_peerdn</varname></primary>
58184 </indexterm>
58185 When a client supplies a certificate (whether it verifies or not), the value of
58186 the Distinguished Name of the certificate is made available in the variable
58187 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
58188 </para>
58189 <para>
58190 <indexterm role="concept">
58191 <primary>log</primary>
58192 <secondary>distinguished name</secondary>
58193 </indexterm>
58194 Because it is often a long text string, it is not included in the log line or
58195 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
58196 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
58197 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
58198 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
58199 </para>
58200 </section>
58201 <section id="SSECTserverTLScache">
58202 <title>Caching of static server configuration items</title>
58203 <para>
58204 <indexterm role="concept">
58205 <primary>certificate</primary>
58206 <secondary>caching</secondary>
58207 </indexterm>
58208 <indexterm role="concept">
58209 <primary>privatekey</primary>
58210 <secondary>caching</secondary>
58211 </indexterm>
58212 <indexterm role="concept">
58213 <primary>crl</primary>
58214 <secondary>caching</secondary>
58215 </indexterm>
58216 <indexterm role="concept">
58217 <primary>ocsp</primary>
58218 <secondary>caching</secondary>
58219 </indexterm>
58220 <indexterm role="concept">
58221 <primary>ciphers</primary>
58222 <secondary>caching</secondary>
58223 </indexterm>
58224 <indexterm role="concept">
58225 <primary>CA bundle</primary>
58226 <secondary>caching</secondary>
58227 </indexterm>
58228 <indexterm role="concept">
58229 <primary>certificate authorities</primary>
58230 <secondary>caching</secondary>
58231 </indexterm>
58232 <indexterm role="concept">
58233 <primary>tls_certificate</primary>
58234 <secondary>caching</secondary>
58235 </indexterm>
58236 <indexterm role="concept">
58237 <primary>tls_privatekey</primary>
58238 <secondary>caching</secondary>
58239 </indexterm>
58240 <indexterm role="concept">
58241 <primary>tls_crl</primary>
58242 <secondary>caching</secondary>
58243 </indexterm>
58244 <indexterm role="concept">
58245 <primary>tls_ocsp_file</primary>
58246 <secondary>caching</secondary>
58247 </indexterm>
58248 <indexterm role="concept">
58249 <primary>tls_require_ciphers</primary>
58250 <secondary>caching</secondary>
58251 </indexterm>
58252 <indexterm role="concept">
58253 <primary>tls_verify_certificate</primary>
58254 <secondary>caching</secondary>
58255 </indexterm>
58256 <indexterm role="concept">
58257 <primary>caching</primary>
58258 <secondary>certificate</secondary>
58259 </indexterm>
58260 <indexterm role="concept">
58261 <primary>caching</primary>
58262 <secondary>privatekey</secondary>
58263 </indexterm>
58264 <indexterm role="concept">
58265 <primary>caching</primary>
58266 <secondary>crl</secondary>
58267 </indexterm>
58268 <indexterm role="concept">
58269 <primary>caching</primary>
58270 <secondary>ocsp</secondary>
58271 </indexterm>
58272 <indexterm role="concept">
58273 <primary>caching</primary>
58274 <secondary>ciphers</secondary>
58275 </indexterm>
58276 <indexterm role="concept">
58277 <primary>caching</primary>
58278 <secondary>certificate authorities</secondary>
58279 </indexterm>
58280 If any of the main configuration options <option>tls_certificate</option>, <option>tls_privatekey</option>,
58281 <option>tls_crl</option> and <option>tls_ocsp_file</option> have values with no
58282 expandable elements,
58283 then the associated information is loaded at daemon startup.
58284 It is made available
58285 to child processes forked for handling received SMTP connections.
58286 </para>
58287 <para>
58288 This caching is currently only supported under Linux and FreeBSD.
58289 </para>
58290 <para>
58291 If caching is not possible, for example if an item has to be dependent
58292 on the peer host so contains a <varname>$sender_host_name</varname> expansion, the load
58293 of the associated information is done at the startup of the TLS connection.
58294 </para>
58295 <para>
58296 The cache is invalidated and reloaded after any changes to the directories
58297 containing files specified by these options.
58298 </para>
58299 <para>
58300 The information specified by the main option <option>tls_verify_certificates</option>
58301 is similarly cached so long as it specifies files explicitly
58302 or (under GnuTLS) is the string <quote>system,cache</quote>.
58303 The latter case is not automatically invalidated;
58304 it is the operator&#x2019;s responsibility to arrange for a daemon restart
58305 any time the system certificate authority bundle is updated.
58306 A HUP signal is sufficient for this.
58307 The value <quote>system</quote> results in no caching under GnuTLS.
58308 </para>
58309 <para>
58310 The macro _HAVE_TLS_CA_CACHE will be defined if the suffix for "system"
58311 is acceptable in configurations for the Exim executable.
58312 </para>
58313 <para>
58314 Caching of the system Certificate Authorities bundle can
58315 save significant time and processing on every TLS connection
58316 accepted by Exim.
58317 </para>
58318 </section>
58319 </section>
58320 <section id="SECTclientTLS">
58321 <title>Configuring an Exim client to use TLS</title>
58322 <para>
58323 <indexterm role="concept">
58324 <primary>cipher</primary>
58325 <secondary>logging</secondary>
58326 </indexterm>
58327 <indexterm role="concept">
58328 <primary>log</primary>
58329 <secondary>TLS cipher</secondary>
58330 </indexterm>
58331 <indexterm role="concept">
58332 <primary>log</primary>
58333 <secondary>distinguished name</secondary>
58334 </indexterm>
58335 <indexterm role="concept">
58336 <primary>TLS</primary>
58337 <secondary>configuring an Exim client</secondary>
58338 </indexterm>
58339 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
58340 deliveries as well as to incoming, the latter one causing logging of the
58341 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
58342 within the <command>smtp</command> transport.
58343 </para>
58344 <para>
58345 <indexterm role="concept">
58346 <primary>ESMTP extensions</primary>
58347 <secondary>STARTTLS</secondary>
58348 </indexterm>
58349 It is not necessary to set any options to have TLS work in the <command>smtp</command>
58350 transport. If Exim is built with TLS support, and TLS is advertised by a
58351 server, the <command>smtp</command> transport always tries to start a TLS session. However,
58352 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
58353 transport) to a list of server hosts for which TLS should not be used.
58354 </para>
58355 <para>
58356 If you do not want Exim to attempt to send messages unencrypted when an attempt
58357 to set up an encrypted connection fails in any way, you can set
58358 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
58359 those hosts, delivery is always deferred if an encrypted connection cannot be
58360 set up. If there are any other hosts for the address, they are tried in the
58361 usual way.
58362 </para>
58363 <para>
58364 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
58365 the message unencrypted. It always does this if the response to STARTTLS is
58366 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
58367 session after a success response code, what happens is controlled by the
58368 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
58369 delivery to this host is deferred, and other hosts (if available) are tried. If
58370 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
58371 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
58372 negotiation fails, Exim closes the current connection (because it is in an
58373 unknown state), opens a new one to the same host, and then tries the delivery
58374 unencrypted.
58375 </para>
58376 <para>
58377 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
58378 transport provide the client with a certificate, which is passed to the server
58379 if it requests it.
58380 This is an optional thing for TLS connections, although either end
58381 may insist on it.
58382 If the server is Exim, it will request a certificate only if
58383 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
58384 </para>
58385 <para>
58386 <emphasis role="bold">Note</emphasis>: Do not use a certificate which has the OCSP-must-staple extension,
58387 for client use (they are usable for server use).
58388 As the TLS protocol has no means for the client to staple before TLS 1.3 it will result
58389 in failed connections.
58390 </para>
58391 <para>
58392 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
58393 specifies a collection of expected server certificates.
58394 These may be
58395 the system default set (depending on library version),
58396 a file,
58397 or (depending on library version) a directory.
58398 The client verifies the server&#x2019;s certificate
58399 against this collection, taking into account any revoked certificates that are
58400 in the list defined by <option>tls_crl</option>.
58401 Failure to verify fails the TLS connection unless either of the
58402 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
58403 </para>
58404 <para>
58405 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
58406 certificate verification to the listed servers.  Verification either must
58407 or need not succeed respectively.
58408 </para>
58409 <para>
58410 The <option>tls_verify_cert_hostnames</option> option lists hosts for which additional
58411 name checks are made on the server certificate.
58412 The match against this list is, as per other Exim usage, the
58413 IP for the host.  That is most closely associated with the
58414 name on the DNS A (or AAAA) record for the host.
58415 However, the name that needs to be in the certificate
58416 is the one at the head of any CNAME chain leading to the A record.
58417 The option defaults to always checking.
58418 </para>
58419 <para>
58420 The <command>smtp</command> transport has two OCSP-related options:
58421 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
58422 is requested and required for the connection to proceed.  The default
58423 value is empty.
58424 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
58425 a Certificate Status is requested (but not necessarily verified).  The default
58426 value is "*" meaning that requests are made unless configured
58427 otherwise.
58428 </para>
58429 <para>
58430 The host(s) should also be in <option>hosts_require_tls</option>, and
58431 <option>tls_verify_certificates</option> configured for the transport,
58432 for OCSP to be relevant.
58433 </para>
58434 <para>
58435 If
58436 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
58437 list of permitted cipher suites. If either of these checks fails, delivery to
58438 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
58439 alternative hosts, if any.
58440 </para>
58441 <para>
58442  <emphasis role="bold">Note</emphasis>:
58443 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
58444 is operating as a client. Exim does not assume that a server certificate (set
58445 by the global options of the same name) should also be used when operating as a
58446 client.
58447 </para>
58448 <para>
58449 <indexterm role="variable">
58450 <primary><varname>$host</varname></primary>
58451 </indexterm>
58452 <indexterm role="variable">
58453 <primary><varname>$host_address</varname></primary>
58454 </indexterm>
58455 All the TLS options in the <command>smtp</command> transport are expanded before use, with
58456 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
58457 which the client is connected. Forced failure of an expansion causes Exim to
58458 behave as if the relevant option were unset.
58459 </para>
58460 <para>
58461 <indexterm role="variable">
58462 <primary><varname>$tls_out_bits</varname></primary>
58463 </indexterm>
58464 <indexterm role="variable">
58465 <primary><varname>$tls_out_cipher</varname></primary>
58466 </indexterm>
58467 <indexterm role="variable">
58468 <primary><varname>$tls_out_peerdn</varname></primary>
58469 </indexterm>
58470 <indexterm role="variable">
58471 <primary><varname>$tls_out_sni</varname></primary>
58472 </indexterm>
58473 Before an SMTP connection is established, the
58474 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
58475 variables are emptied. (Until the first connection, they contain the values
58476 that were set when the message was received.) If STARTTLS is subsequently
58477 successfully obeyed, these variables are set to the relevant values for the
58478 outgoing connection.
58479 </para>
58480 <section id="SECTclientTLScache">
58481 <title>Caching of static client configuration items</title>
58482 <para>
58483 <indexterm role="concept">
58484 <primary>certificate</primary>
58485 <secondary>caching</secondary>
58486 </indexterm>
58487 <indexterm role="concept">
58488 <primary>privatekey</primary>
58489 <secondary>caching</secondary>
58490 </indexterm>
58491 <indexterm role="concept">
58492 <primary>crl</primary>
58493 <secondary>caching</secondary>
58494 </indexterm>
58495 <indexterm role="concept">
58496 <primary>ciphers</primary>
58497 <secondary>caching</secondary>
58498 </indexterm>
58499 <indexterm role="concept">
58500 <primary>CA bundle</primary>
58501 <secondary>caching</secondary>
58502 </indexterm>
58503 <indexterm role="concept">
58504 <primary>certificate authorities</primary>
58505 <secondary>caching</secondary>
58506 </indexterm>
58507 <indexterm role="concept">
58508 <primary>tls_certificate</primary>
58509 <secondary>caching</secondary>
58510 </indexterm>
58511 <indexterm role="concept">
58512 <primary>tls_privatekey</primary>
58513 <secondary>caching</secondary>
58514 </indexterm>
58515 <indexterm role="concept">
58516 <primary>tls_crl</primary>
58517 <secondary>caching</secondary>
58518 </indexterm>
58519 <indexterm role="concept">
58520 <primary>tls_require_ciphers</primary>
58521 <secondary>caching</secondary>
58522 </indexterm>
58523 <indexterm role="concept">
58524 <primary>tls_verify_certificate</primary>
58525 <secondary>caching</secondary>
58526 </indexterm>
58527 <indexterm role="concept">
58528 <primary>caching</primary>
58529 <secondary>certificate</secondary>
58530 </indexterm>
58531 <indexterm role="concept">
58532 <primary>caching</primary>
58533 <secondary>privatekey</secondary>
58534 </indexterm>
58535 <indexterm role="concept">
58536 <primary>caching</primary>
58537 <secondary>crl</secondary>
58538 </indexterm>
58539 <indexterm role="concept">
58540 <primary>caching</primary>
58541 <secondary>ciphers</secondary>
58542 </indexterm>
58543 <indexterm role="concept">
58544 <primary>caching</primary>
58545 <secondary>certificate authorities</secondary>
58546 </indexterm>
58547 If any of the transport configuration options <option>tls_certificate</option>, <option>tls_privatekey</option>
58548 and <option>tls_crl</option> have values with no
58549 expandable elements,
58550 then the associated information is loaded per smtp transport
58551 at daemon startup, at the start of a queue run, or on a
58552 command-line specified message delivery.
58553 It is made available
58554 to child processes forked for handling making SMTP connections.
58555 </para>
58556 <para>
58557 This caching is currently only supported under Linux.
58558 </para>
58559 <para>
58560 If caching is not possible, the load
58561 of the associated information is done at the startup of the TLS connection.
58562 </para>
58563 <para>
58564 The cache is invalidated in the daemon
58565 and reloaded after any changes to the directories
58566 containing files specified by these options.
58567 </para>
58568 <para>
58569 The information specified by the main option <option>tls_verify_certificates</option>
58570 is similarly cached so long as it specifies files explicitly
58571 or (under GnuTLS) is the string <quote>system,cache</quote>.
58572 The latter case is not automatically invaludated;
58573 it is the operator&#x2019;s responsibility to arrange for a daemon restart
58574 any time the system certificate authority bundle is updated.
58575 A HUP signal is sufficient for this.
58576 The value <quote>system</quote> results in no caching under GnuTLS.
58577 </para>
58578 <para>
58579 The macro _HAVE_TLS_CA_CACHE will be defined if the suffix for "system"
58580 is acceptable in configurations for the Exim executable.
58581 </para>
58582 <para>
58583 Caching of the system Certificate Authorities bundle can
58584 save significant time and processing on every TLS connection
58585 initiated by Exim.
58586 </para>
58587 </section>
58588 </section>
58589 <section id="SECTtlssni">
58590 <title>Use of TLS Server Name Indication</title>
58591 <para>
58592 <indexterm role="concept">
58593 <primary>TLS</primary>
58594 <secondary>Server Name Indication</secondary>
58595 </indexterm>
58596 <indexterm role="concept">
58597 <primary>TLS</primary>
58598 <secondary>SNI</secondary>
58599 </indexterm>
58600 <indexterm role="concept">
58601 <primary>SNI</primary>
58602 </indexterm>
58603 <indexterm role="variable">
58604 <primary><varname>$tls_in_sni</varname></primary>
58605 </indexterm>
58606 <indexterm role="option">
58607 <primary><option>tls_in_sni</option></primary>
58608 </indexterm>
58609 With TLS1.0 or above, there is an extension mechanism by which extra
58610 information can be included at various points in the protocol.  One of these
58611 extensions, documented in RFC 6066 (and before that RFC 4366) is
58612 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
58613 client in the initial handshake, so that the server can examine the servername
58614 within and possibly choose to use different certificates and keys (and more)
58615 for this session.
58616 </para>
58617 <para>
58618 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
58619 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
58620 address.
58621 </para>
58622 <para>
58623 With SMTP to MX, there are the same problems here as in choosing the identity
58624 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
58625 provide the identity which you then cryptographically verify.  So this will
58626 be of limited use in that environment.
58627 </para>
58628 <para>
58629 With SMTP to Submission, there is a well-defined hostname which clients are
58630 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
58631 choose to include this information in the TLS negotiation.  If this becomes
58632 wide-spread, then hosters can choose to present different certificates to
58633 different clients.  Or even negotiate different cipher suites.
58634 </para>
58635 <para>
58636 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
58637 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
58638 nothing more to it.  Choosing a sensible value not derived insecurely is the
58639 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
58640 for the lifetime of the client connection (including during authentication).
58641 </para>
58642 <para>
58643 If DANE validated the connection attempt then the value of the <option>tls_sni</option> option
58644 is forced to the name of the destination host, after any MX- or CNAME-following.
58645 </para>
58646 <para>
58647 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
58648 received from a client.
58649 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
58650 </para>
58651 <para>
58652 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
58653 option (prior to expansion) then the following options will be re-expanded
58654 during TLS session handshake, to permit alternative values to be chosen:
58655 </para>
58656 <itemizedlist>
58657 <listitem>
58658 <para>
58659 <option>tls_certificate</option>
58660 </para>
58661 </listitem>
58662 <listitem>
58663 <para>
58664 <option>tls_crl</option>
58665 </para>
58666 </listitem>
58667 <listitem>
58668 <para>
58669 <option>tls_privatekey</option>
58670 </para>
58671 </listitem>
58672 <listitem>
58673 <para>
58674 <option>tls_verify_certificates</option>
58675 </para>
58676 </listitem>
58677 <listitem>
58678 <para>
58679 <option>tls_ocsp_file</option>
58680 </para>
58681 </listitem>
58682 </itemizedlist>
58683 <para>
58684 Great care should be taken to deal with matters of case, various injection
58685 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
58686 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
58687 arbitrary unverified data provided prior to authentication.
58688 Further, the initial certificate is loaded before SNI has arrived, so
58689 an expansion for <option>tls_certificate</option> must have a default which is used
58690 when <varname>$tls_in_sni</varname> is empty.
58691 </para>
58692 <para>
58693 The Exim developers are proceeding cautiously and so far no other TLS options
58694 are re-expanded.
58695 </para>
58696 <para>
58697 When Exim is built against OpenSSL, OpenSSL must have been built with support
58698 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
58699 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
58700 see <literal>-servername</literal> in the output, then OpenSSL has support.
58701 </para>
58702 <para>
58703 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
58704 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
58705 built, then you have SNI support).
58706 </para>
58707 <section>
58708 <title>ALPN</title>
58709 <para>
58710 <indexterm role="concept">
58711 <primary>TLS</primary>
58712 <secondary>ALPN</secondary>
58713 </indexterm>
58714 <indexterm role="concept">
58715 <primary>ALPN</primary>
58716 <secondary>general information</secondary>
58717 </indexterm>
58718 <indexterm role="concept">
58719 <primary>TLS</primary>
58720 <secondary>Application Layer Protocol Names</secondary>
58721 </indexterm>
58722 There is a TLS feature related to SNI
58723 called Application Layer Protocol Name (ALPN).
58724 This is intended to declare, or select, what protocol layer will be using a TLS
58725 connection.
58726 The client for the connection proposes a set of protocol names, and
58727 the server responds with a selected one.
58728 It is not, as of 2021, commonly used for SMTP connections.
58729 However, to guard against misdirected or malicious use of web clients
58730 (which often do use ALPN) against MTA ports, Exim by default check that
58731 there is no incompatible ALPN specified by a client for a TLS connection.
58732 If there is, the connection is rejected.
58733 </para>
58734 <para>
58735 As a client Exim does not supply ALPN by default.
58736 The behaviour of both client and server can be configured using the options
58737 <option>tls_alpn</option> and <option>hosts_require_alpn</option>.
58738 There are no variables providing observability.
58739 Some feature-specific logging may appear on denied connections, but this
58740 depends on the behaviour of the peer
58741 (not all peers can send a feature-specific TLS Alert).
58742 </para>
58743 <para>
58744 This feature is available when Exim is built with
58745 OpenSSL 1.1.0 or later or GnuTLS 3.2.0 or later;
58746 the macro _HAVE_TLS_ALPN will be defined when this is so.
58747 </para>
58748 </section>
58749 </section>
58750 <section id="SECTmulmessam">
58751 <title>Multiple messages on the same encrypted TCP/IP connection</title>
58752 <para>
58753 <indexterm role="concept">
58754 <primary>multiple SMTP deliveries with TLS</primary>
58755 </indexterm>
58756 <indexterm role="concept">
58757 <primary>TLS</primary>
58758 <secondary>multiple message deliveries</secondary>
58759 </indexterm>
58760 Exim sends multiple messages down the same TCP/IP connection by starting up
58761 an entirely new delivery process for each message, passing the socket from
58762 one process to the next. This implementation does not fit well with the use
58763 of TLS, because there is quite a lot of state information associated with a TLS
58764 connection, not just a socket identification. Passing all the state information
58765 to a new process is not feasible. Consequently, for sending using TLS Exim
58766 starts an additional proxy process for handling the encryption, piping the
58767 unencrypted data stream from and to the delivery processes.
58768 </para>
58769 <para>
58770 An older mode of operation can be enabled on a per-host basis by the
58771 <option>hosts_noproxy_tls</option> option on the <command>smtp</command> transport.  If the host matches
58772 this list the proxy process described above is not used; instead Exim
58773 shuts down an existing TLS session being run by the delivery process
58774 before passing the socket to a new process. The new process may then
58775 try to start a new TLS session, and if successful, may try to re-authenticate
58776 if AUTH is in use, before sending the next message.
58777 </para>
58778 <para>
58779 The RFC is not clear as to whether or not an SMTP session continues in clear
58780 after TLS has been shut down, or whether TLS may be restarted again later, as
58781 just described. However, if the server is Exim, this shutdown and
58782 reinitialization works. It is not known which (if any) other servers operate
58783 successfully if the client closes a TLS session and continues with unencrypted
58784 SMTP, but there are certainly some that do not work. For such servers, Exim
58785 should not pass the socket to another process, because the failure of the
58786 subsequent attempt to use it would cause Exim to record a temporary host error,
58787 and delay other deliveries to that host.
58788 </para>
58789 <para>
58790 To test for this case, Exim sends an EHLO command to the server after
58791 closing down the TLS session. If this fails in any way, the connection is
58792 closed instead of being passed to a new delivery process, but no retry
58793 information is recorded.
58794 </para>
58795 <para>
58796 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
58797 <command>smtp</command> transport to match those hosts for which Exim should not pass
58798 connections to new processes if TLS has been used.
58799 </para>
58800 </section>
58801 <section id="SECTcerandall">
58802 <title>Certificates and all that</title>
58803 <para>
58804 <indexterm role="concept">
58805 <primary>certificate</primary>
58806 <secondary>references to discussion</secondary>
58807 </indexterm>
58808 In order to understand fully how TLS works, you need to know about
58809 certificates, certificate signing, and certificate authorities.
58810 This is a large topic and an introductory guide is unsuitable for the Exim
58811 reference manual, so instead we provide pointers to existing documentation.
58812 </para>
58813 <para>
58814 The Apache web-server was for a long time the canonical guide, so their
58815 documentation is a good place to start; their SSL module&#x2019;s Introduction
58816 document is currently at
58817 </para>
58818 <literallayout>
58819 <emphasis role="bold"><ulink url="https://httpd.apache.org/docs/current/ssl/ssl_intro.html">https://httpd.apache.org/docs/current/ssl/ssl_intro.html</ulink></emphasis>
58820 </literallayout>
58821 <para>
58822 and their FAQ is at
58823 </para>
58824 <literallayout>
58825 <emphasis role="bold"><ulink url="https://httpd.apache.org/docs/current/ssl/ssl_faq.html">https://httpd.apache.org/docs/current/ssl/ssl_faq.html</ulink></emphasis>
58826 </literallayout>
58827 <para>
58828 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
58829 0-201-61598-3) in 2001, contains both introductory and more in-depth
58830 descriptions.
58831 More recently Ivan Ristić&#x2019;s book <emphasis>Bulletproof SSL and TLS</emphasis>,
58832 published by Feisty Duck (ISBN 978-1907117046) in 2013 is good.
58833 Ivan is the author of the popular TLS testing tools at
58834 <emphasis role="bold"><ulink url="https://www.ssllabs.com/">https://www.ssllabs.com/</ulink></emphasis>.
58835 </para>
58836 <section id="SECID186">
58837 <title>Certificate chains</title>
58838 <para>
58839 A file named by <option>tls_certificate</option> may contain more than one
58840 certificate. This is useful in the case where the certificate that is being
58841 sent is validated by an intermediate certificate which the other end does
58842 not have. Multiple certificates must be in the correct order in the file.
58843 First the host&#x2019;s certificate itself, then the first intermediate
58844 certificate to validate the issuer of the host certificate, then the next
58845 intermediate certificate to validate the issuer of the first intermediate
58846 certificate, and so on, until finally (optionally) the root certificate.
58847 The root certificate must already be trusted by the recipient for
58848 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
58849 root certificate along with the rest makes it available for the user to
58850 install if the receiving end is a client MUA that can interact with a user.
58851 </para>
58852 <para>
58853 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
58854 even if your libraries allow loading them for use in Exim when acting as a
58855 server, increasingly clients will not accept such certificates.  The error
58856 diagnostics in such a case can be frustratingly vague.
58857 </para>
58858 </section>
58859 <section id="SECID187">
58860 <title>Self-signed certificates</title>
58861 <para>
58862 <indexterm role="concept">
58863 <primary>certificate</primary>
58864 <secondary>self-signed</secondary>
58865 </indexterm>
58866 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
58867 with OpenSSL, like this:
58868 </para>
58869 <literallayout class="monospaced">
58870 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
58871             -days 9999 -nodes
58872 </literallayout>
58873 <para>
58874 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
58875 delimited and so can be identified independently. The <option>-days</option> option
58876 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
58877 important: if you do not set it, the key is encrypted with a passphrase
58878 that you are prompted for, and any use that is made of the key causes more
58879 prompting for the passphrase. This is not helpful if you are going to use
58880 this certificate and key in an MTA, where prompting is not possible.
58881 </para>
58882 <para>
58883 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
58884 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
58885 the above command might produce a date in the past.  Think carefully about
58886 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
58887 of the certificate or reconsider your platform deployment.  (At time of
58888 writing, reducing the duration is the most likely choice, but the inexorable
58889 progression of time takes us steadily towards an era where this will not
58890 be a sensible resolution).
58891 </para>
58892 <para>
58893 A self-signed certificate made in this way is sufficient for testing, and
58894 may be adequate for all your requirements if you are mainly interested in
58895 encrypting transfers, and not in secure identification.
58896 </para>
58897 <para>
58898 However, many clients require that the certificate presented by the server be a
58899 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
58900 certificate. In this situation, the self-signed certificate described above
58901 must be installed on the client host as a trusted root <emphasis>certification
58902 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
58903 signed with that self-signed certificate.
58904 </para>
58905 <para>
58906 For information on creating self-signed CA certificates and using them to sign
58907 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
58908 Open-source PKI book, available online at
58909 <emphasis role="bold"><ulink url="https://sourceforge.net/projects/ospkibook/">https://sourceforge.net/projects/ospkibook/</ulink></emphasis>.
58910 </para>
58911 </section>
58912 <section>
58913 <title>Revoked certificates</title>
58914 <para>
58915 <indexterm role="concept">
58916 <primary>TLS</primary>
58917 <secondary>revoked certificates</secondary>
58918 </indexterm>
58919 <indexterm role="concept">
58920 <primary>revocation list</primary>
58921 </indexterm>
58922 <indexterm role="concept">
58923 <primary>certificate</primary>
58924 <secondary>revocation list</secondary>
58925 </indexterm>
58926 <indexterm role="concept">
58927 <primary>OCSP</primary>
58928 <secondary>stapling</secondary>
58929 </indexterm>
58930 There are three ways for a certificate to be made unusable
58931 before its expiry.
58932 </para>
58933 <itemizedlist>
58934 <listitem>
58935 <para>
58936 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
58937 certificates are revoked. If you have such a list, you can pass it to an Exim
58938 server using the global option called <option>tls_crl</option> and to an Exim client using
58939 an identically named option for the <command>smtp</command> transport. In each case, the value
58940 of the option is expanded and must then be the name of a file that contains a
58941 CRL in PEM format.
58942 The downside is that clients have to periodically re-download a potentially huge
58943 file from every certificate authority they know of.
58944 </para>
58945 </listitem>
58946 <listitem>
58947 <para>
58948 The way with most moving parts at query time is Online Certificate
58949 Status Protocol (OCSP), where the client verifies the certificate
58950 against an OCSP server run by the CA.  This lets the CA track all
58951 usage of the certs.  It requires running software with access to the
58952 private key of the CA, to sign the responses to the OCSP queries.  OCSP
58953 is based on HTTP and can be proxied accordingly.
58954 </para>
58955 <para>
58956 The only widespread OCSP server implementation (known to this writer)
58957 comes as part of OpenSSL and aborts on an invalid request, such as
58958 connecting to the port and then disconnecting.  This requires
58959 re-entering the passphrase each time some random client does this.
58960 </para>
58961 </listitem>
58962 <listitem>
58963 <para>
58964 The third way is OCSP Stapling; in this, the server using a certificate
58965 issued by the CA periodically requests an OCSP proof of validity from
58966 the OCSP server, then serves it up inline as part of the TLS
58967 negotiation.   This approach adds no extra round trips, does not let the
58968 CA track users, scales well with number of certs issued by the CA and is
58969 resilient to temporary OCSP server failures, as long as the server
58970 starts retrying to fetch an OCSP proof some time before its current
58971 proof expires.  The downside is that it requires server support.
58972 </para>
58973 <para>
58974 Unless Exim is built with the support disabled,
58975 or with GnuTLS earlier than version 3.3.16 / 3.4.8
58976 support for OCSP stapling is included.
58977 </para>
58978 <para>
58979 There is a global option called <option>tls_ocsp_file</option>.
58980 The file specified therein is expected to be in DER format, and contain
58981 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
58982 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
58983 contains <literal>tls_in_sni</literal>, as per other TLS options.
58984 </para>
58985 <para>
58986 Exim does not at this time implement any support for fetching a new OCSP
58987 proof.  The burden is on the administrator to handle this, outside of
58988 Exim.  The file specified should be replaced atomically, so that the
58989 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
58990 on each connection, so a new file will be handled transparently on the
58991 next connection.
58992 </para>
58993 <para>
58994 When built with OpenSSL Exim will check for a valid next update timestamp
58995 in the OCSP proof; if not present, or if the proof has expired, it will be
58996 ignored.
58997 </para>
58998 <para>
58999 For the client to be able to verify the stapled OCSP the server must
59000 also supply, in its stapled information, any intermediate
59001 certificates for the chain leading to the OCSP proof from the signer
59002 of the server certificate.  There may be zero or one such. These
59003 intermediate certificates should be added to the server OCSP stapling
59004 file named by <option>tls_ocsp_file</option>.
59005 </para>
59006 <para>
59007 Note that the proof only covers the terminal server certificate,
59008 not any of the chain from CA to it.
59009 </para>
59010 <para>
59011 There is no current way to staple a proof for a client certificate.
59012 </para>
59013 <literallayout class="monospaced">
59014   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
59015   OCSP server is supplied.  The server URL may be included in the
59016   server certificate, if the CA is helpful.
59017
59018   One failure mode seen was the OCSP Signer cert expiring before the end
59019   of validity of the OCSP proof. The checking done by Exim/OpenSSL
59020   noted this as invalid overall, but the re-fetch script did not.
59021 </literallayout>
59022 </listitem>
59023 </itemizedlist>
59024 <para>
59025 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
59026 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
59027 </para>
59028 </section>
59029 </section>
59030 <section id="SECTresumption">
59031 <title>TLS Resumption</title>
59032 <para>
59033 <indexterm role="concept">
59034 <primary>TLS</primary>
59035 <secondary>resumption</secondary>
59036 </indexterm>
59037 TLS Session Resumption for TLS 1.2 and TLS 1.3 connections can be used (defined
59038 in RFC 5077 for 1.2).  The support for this requires GnuTLS 3.6.3 or OpenSSL 1.1.1
59039 (or later).
59040 </para>
59041 <para>
59042 Session resumption (this is the "stateless" variant) involves the server sending
59043 a "session ticket" to the client on one connection, which can be stored by the
59044 client and used for a later session.  The ticket contains sufficient state for
59045 the server to reconstruct the TLS session, avoiding some expensive crypto
59046 calculation and (on TLS1.2) one full packet roundtrip time.
59047 </para>
59048 <itemizedlist>
59049 <listitem>
59050 <para>
59051 Operational cost/benefit:
59052 </para>
59053 <para>
59054  The extra data being transmitted costs a minor amount, and the client has
59055  extra costs in storing and retrieving the data.
59056 </para>
59057 <para>
59058  In the Exim/Gnutls implementation the extra cost on an initial connection
59059  which is TLS1.2 over a loopback path is about 6ms on 2017-laptop class hardware.
59060  The saved cost on a subsequent connection is about 4ms; three or more
59061  connections become a net win.  On longer network paths, two or more
59062  connections will have an average lower startup time thanks to the one
59063  saved packet roundtrip.  TLS1.3 will save the crypto cpu costs but not any
59064  packet roundtrips.
59065 </para>
59066 <para>
59067 <indexterm role="concept">
59068 <primary>hints database</primary>
59069 <secondary>tls</secondary>
59070 </indexterm>
59071  Since a new hints DB is used on the TLS client,
59072  the hints DB maintenance should be updated to additionally handle "tls".
59073 </para>
59074 </listitem>
59075 <listitem>
59076 <para>
59077 Security aspects:
59078 </para>
59079 <para>
59080  The session ticket is encrypted, but is obviously an additional security
59081  vulnarability surface.  An attacker able to decrypt it would have access
59082  all connections using the resumed session.
59083  The session ticket encryption key is not committed to storage by the server
59084  and is rotated regularly (OpenSSL: 1hr, and one previous key is used for
59085  overlap; GnuTLS 6hr but does not specify any overlap).
59086  Tickets have limited lifetime (2hr, and new ones issued after 1hr under
59087  OpenSSL.  GnuTLS 2hr, appears to not do overlap).
59088 </para>
59089 <para>
59090  There is a question-mark over the security of the Diffie-Helman parameters
59091  used for session negotiation.
59092 </para>
59093 </listitem>
59094 <listitem>
59095 <para>
59096 Observability:
59097 </para>
59098 <para>
59099  The <option>log_selector</option> "tls_resumption" appends an asterisk to the tls_cipher "X="
59100  element.
59101 </para>
59102 <para>
59103  The variables <varname>$tls_in_resumption</varname> and <varname>$tls_out_resumption</varname>
59104  have bits 0-4 indicating respectively
59105  support built, client requested ticket, client offered session,
59106  server issued ticket, resume used.  A suitable decode list is provided
59107  in the builtin macro _RESUME_DECODE for in <option>listextract</option> expansions.
59108 </para>
59109 </listitem>
59110 <listitem>
59111 <para>
59112 Control:
59113 </para>
59114 <para>
59115 The <option>tls_resumption_hosts</option> main option specifies a hostlist for which
59116 exim, operating as a server, will offer resumption to clients.
59117 Current best practice is to not offer the feature to MUA connection.
59118 Commonly this can be done like this:
59119 </para>
59120 <literallayout class="monospaced">
59121 tls_resumption_hosts = ${if inlist {$received_port}{587:465} {:}{*}}
59122 </literallayout>
59123 <para>
59124 If the peer host matches the list after expansion then resumption
59125 is offered and/or accepted.
59126 </para>
59127 <para>
59128 The <option>tls_resumption_hosts</option> smtp transport option performs the
59129 equivalent function for operation as a client.
59130 If the peer host matches the list after expansion then resumption
59131 is attempted (if a stored session is available) or the information
59132 stored (if supplied by the peer).
59133 </para>
59134 </listitem>
59135 <listitem>
59136 <para>
59137 Issues:
59138 </para>
59139 <para>
59140  In a resumed session:
59141 </para>
59142 <itemizedlist>
59143 <listitem>
59144 <para>
59145   The variables <varname>$tls_{in,out}_cipher</varname> will have values different
59146  to the original (under GnuTLS).
59147 </para>
59148 </listitem>
59149 <listitem>
59150 <para>
59151   The variables <varname>$tls_{in,out}_ocsp</varname> will be "not requested" or "no response",
59152  and the <option>hosts_require_ocsp</option> smtp trasnport option will fail.
59153 </para>
59154 </listitem>
59155 </itemizedlist>
59156 </listitem>
59157 </itemizedlist>
59158 </section>
59159 <section id="SECDANE">
59160 <title>DANE</title>
59161 <para>
59162 <indexterm role="concept">
59163 <primary>DANE</primary>
59164 </indexterm>
59165 DNS-based Authentication of Named Entities, as applied to SMTP over TLS, provides assurance to a client that
59166 it is actually talking to the server it wants to rather than some attacker operating a Man In The Middle (MITM)
59167 operation.  The latter can terminate the TLS connection you make, and make another one to the server (so both
59168 you and the server still think you have an encrypted connection) and, if one of the "well known" set of
59169 Certificate Authorities has been suborned - something which *has* been seen already (2014), a verifiable
59170 certificate (if you&#x2019;re using normal root CAs, eg. the Mozilla set, as your trust anchors).
59171 </para>
59172 <para>
59173 What DANE does is replace the CAs with the DNS as the trust anchor.  The assurance is limited to a) the possibility
59174 that the DNS has been suborned, b) mistakes made by the admins of the target server.   The attack surface presented
59175 by (a) is thought to be smaller than that of the set of root CAs.
59176 </para>
59177 <para>
59178 It also allows the server to declare (implicitly) that connections to it should use TLS.  An MITM could simply
59179 fail to pass on a server&#x2019;s STARTTLS.
59180 </para>
59181 <para>
59182 DANE scales better than having to maintain (and communicate via side-channel) copies of server certificates
59183 for every possible target server.  It also scales (slightly) better than having to maintain on an SMTP
59184 client a copy of the standard CAs bundle.  It also means not having to pay a CA for certificates.
59185 </para>
59186 <para>
59187 DANE requires a server operator to do three things:
59188 </para>
59189 <orderedlist numeration="arabic">
59190 <listitem>
59191 <para>
59192 Run DNSSEC.  This provides assurance to clients
59193 that DNS lookups they do for the server have not been tampered with.  The domain MX record applying
59194 to this server, its A record, its TLSA record and any associated CNAME records must all be covered by
59195 DNSSEC.
59196 </para>
59197 </listitem>
59198 <listitem>
59199 <para>
59200 Add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
59201 </para>
59202 </listitem>
59203 <listitem>
59204 <para>
59205 Offer a server certificate, or certificate chain, in TLS connections which is anchored by one of the TLSA records.
59206 </para>
59207 </listitem>
59208 </orderedlist>
59209 <para>
59210 There are no changes to Exim specific to server-side operation of DANE.
59211 Support for client-side operation of DANE can be included at compile time by defining SUPPORT_DANE=yes
59212 in <filename>Local/Makefile</filename>.
59213 If it has been included, the macro "_HAVE_DANE" will be defined.
59214 </para>
59215 <section>
59216 <title>DNS records</title>
59217 <para>
59218 A TLSA record consist of 4 fields, the "Certificate Usage", the
59219 "Selector", the "Matching type", and the "Certificate Association Data".
59220 For a detailed description of the TLSA record see
59221 <emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc7671#page-5">RFC 7671</ulink></emphasis>.
59222 </para>
59223 <para>
59224 The TLSA record for the server may have "Certificate Usage" (1st) field of DANE-TA(2) or DANE-EE(3).
59225 These are the "Trust Anchor" and "End Entity" variants.
59226 The latter specifies the End Entity directly, i.e. the certificate involved is that of the server
59227 (and if only DANE-EE is used then it should be the sole one transmitted during the TLS handshake);
59228 this is appropriate for a single system, using a self-signed certificate.
59229 DANE-TA usage is effectively declaring a specific CA to be used; this might be a private CA or a public,
59230 well-known one.
59231 A private CA at simplest is just a self-signed certificate (with certain
59232 attributes) which is used to sign server certificates, but running one securely
59233 does require careful arrangement.
59234 With DANE-TA, as implemented in Exim and commonly in other MTAs,
59235 the server TLS handshake must transmit the entire certificate chain from CA to server-certificate.
59236 DANE-TA is commonly used for several services and/or servers, each having a TLSA query-domain CNAME record,
59237 all of which point to a single TLSA record.
59238 DANE-TA and DANE-EE can both be used together.
59239 </para>
59240 <para>
59241 Our recommendation is to use DANE with a certificate from a public CA,
59242 because this enables a variety of strategies for remote clients to verify
59243 your certificate.
59244 You can then publish information both via DANE and another technology,
59245 "MTA-STS", described below.
59246 </para>
59247 <para>
59248 When you use DANE-TA to publish trust anchor information, you ask entities
59249 outside your administrative control to trust the Certificate Authority for
59250 connections to you.
59251 If using a private CA then you should expect others to still apply the
59252 technical criteria they&#x2019;d use for a public CA to your certificates.
59253 In particular, you should probably try to follow current best practices for CA
59254 operation around hash algorithms and key sizes.
59255 Do not expect other organizations to lower their security expectations just
59256 because a particular profile might be reasonable for your own internal use.
59257 </para>
59258 <para>
59259 When this text was last updated, this in practice means to avoid use of SHA-1
59260 and MD5; if using RSA to use key sizes of at least 2048 bits (and no larger
59261 than 4096, for interoperability); to use keyUsage fields correctly; to use
59262 random serial numbers.
59263 The list of requirements is subject to change as best practices evolve.
59264 If you&#x2019;re not already using a private CA, or it doesn&#x2019;t meet these
59265 requirements, then we encourage you to avoid all these issues and use a public
59266 CA such as <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis> instead.
59267 </para>
59268 <para>
59269 The TLSA record should have a "Selector" (2nd) field of SPKI(1) and
59270 a "Matching Type" (3rd) field of SHA2-512(2).
59271 </para>
59272 <para>
59273 For the "Certificate Authority Data" (4th) field, commands like
59274 </para>
59275 <literallayout class="monospaced">
59276   openssl x509 -pubkey -noout &lt;certificate.pem \
59277   | openssl rsa -outform der -pubin 2&gt;/dev/null \
59278   | openssl sha512 \
59279   | awk '{print $2}'
59280 </literallayout>
59281 <para>
59282 are workable to create a hash of the certificate&#x2019;s public key.
59283 </para>
59284 <para>
59285 An example TLSA record for DANE-EE(3), SPKI(1), and SHA-512 (2) looks like
59286 </para>
59287 <literallayout class="monospaced">
59288   _25._tcp.mail.example.com. TLSA 3 1 2 8BA8A336E...
59289 </literallayout>
59290 <para>
59291 At the time of writing, <emphasis role="bold"><ulink url="https://www.huque.com/bin/gen_tlsa">https://www.huque.com/bin/gen_tlsa</ulink></emphasis>
59292 is useful for quickly generating TLSA records.
59293 </para>
59294 <para>
59295 For use with the DANE-TA model, server certificates must have a correct name (SubjectName or SubjectAltName).
59296 </para>
59297 <para>
59298 The Certificate issued by the CA published in the DANE-TA model should be
59299 issued using a strong hash algorithm.
59300 Exim, and importantly various other MTAs sending to you, will not
59301 re-enable hash algorithms which have been disabled by default in TLS
59302 libraries.
59303 This means no MD5 and no SHA-1.  SHA2-256 is the minimum for reliable
59304 interoperability (and probably the maximum too, in 2018).
59305 </para>
59306 </section>
59307 <section>
59308 <title>Interaction with OCSP</title>
59309 <para>
59310 The use of OCSP-stapling should be considered, allowing for fast revocation of certificates (which would otherwise
59311 be limited by the DNS TTL on the TLSA records).  However, this is likely to only be usable with DANE-TA.  NOTE: the
59312 default of requesting OCSP for all hosts is modified iff DANE is in use, to:
59313 </para>
59314 <literallayout class="monospaced">
59315   hosts_request_ocsp = ${if or { {= {0}{$tls_out_tlsa_usage}} \
59316                                  {= {4}{$tls_out_tlsa_usage}} } \
59317                          {*}{}}
59318 </literallayout>
59319 <para>
59320 The (new) variable <varname>$tls_out_tlsa_usage</varname> is a bitfield with numbered bits set for TLSA record usage codes.
59321 The zero above means DANE was not in use, the four means that only DANE-TA usage TLSA records were
59322 found. If the definition of <option>hosts_request_ocsp</option> includes the
59323 string "tls_out_tlsa_usage", they are re-expanded in time to
59324 control the OCSP request.
59325 </para>
59326 <para>
59327 This modification of hosts_request_ocsp is only done if it has the default value of "*".  Admins who change it, and
59328 those who use <option>hosts_require_ocsp</option>, should consider the interaction with DANE in their OCSP settings.
59329 </para>
59330 </section>
59331 <section>
59332 <title>Client configuration</title>
59333 <para>
59334 For client-side DANE there are three new smtp transport options, <option>hosts_try_dane</option>, <option>hosts_require_dane</option>
59335 and <option>dane_require_tls_ciphers</option>.
59336 The <quote>require</quote> variant will result in failure if the target host is not
59337 DNSSEC-secured. To get DNSSEC-secured hostname resolution, use
59338 the <option>dnssec_request_domains</option> router or transport option.
59339 </para>
59340 <para>
59341 DANE will only be usable if the target host has DNSSEC-secured MX, A and TLSA records.
59342 </para>
59343 <para>
59344 A TLSA lookup will be done if either of the above options match and the host-lookup succeeded using DNSSEC.
59345 If a TLSA lookup is done and succeeds, a DANE-verified TLS connection
59346 will be required for the host.  If it does not, the host will not
59347 be used; there is no fallback to non-DANE or non-TLS.
59348 </para>
59349 <para>
59350 If DANE is requested and usable, then the TLS cipher list configuration
59351 prefers to use the option <option>dane_require_tls_ciphers</option> and falls
59352 back to <option>tls_require_ciphers</option> only if that is unset.
59353 This lets you configure "decent crypto" for DANE and "better than nothing
59354 crypto" as the default.  Note though that while GnuTLS lets the string control
59355 which versions of TLS/SSL will be negotiated, OpenSSL does not and you&#x2019;re
59356 limited to ciphersuite constraints.
59357 </para>
59358 <para>
59359 If DANE is requested and useable (see above) the following transport options are ignored:
59360 </para>
59361 <literallayout class="monospaced">
59362   hosts_require_tls
59363   tls_verify_hosts
59364   tls_try_verify_hosts
59365   tls_verify_certificates
59366   tls_crl
59367   tls_verify_cert_hostnames
59368   tls_sni
59369 </literallayout>
59370 <para>
59371 If DANE is not usable, whether requested or not, and CA-anchored
59372 verification evaluation is wanted, the above variables should be set appropriately.
59373 </para>
59374 <para>
59375 The router and transport option <option>dnssec_request_domains</option> must not be
59376 set to <quote>never</quote>, and <option>dnssec_require_domains</option> is ignored.
59377 </para>
59378 </section>
59379 <section>
59380 <title>Observability</title>
59381 <para>
59382 If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane".
59383 </para>
59384 <para>
59385 There is a new variable <varname>$tls_out_dane</varname> which will have "yes" if
59386 verification succeeded using DANE and "no" otherwise (only useful
59387 in combination with events; see <xref linkend="CHAPevents"/>),
59388 and a new variable <varname>$tls_out_tlsa_usage</varname> (detailed above).
59389 </para>
59390 <para>
59391 <indexterm role="concept">
59392 <primary>DANE</primary>
59393 <secondary>reporting</secondary>
59394 </indexterm>
59395 An event (see <xref linkend="CHAPevents"/>) of type "dane:fail" will be raised on failures
59396 to achieve DANE-verified connection, if one was either requested and offered, or
59397 required.  This is intended to support TLS-reporting as defined in
59398 <emphasis role="bold"><ulink url="https://tools.ietf.org/html/draft-ietf-uta-smtp-tlsrpt-17">https://tools.ietf.org/html/draft-ietf-uta-smtp-tlsrpt-17</ulink></emphasis>.
59399 The <varname>$event_data</varname> will be one of the Result Types defined in
59400 Section 4.3 of that document.
59401 </para>
59402 </section>
59403 <section>
59404 <title>General</title>
59405 <para>
59406 Under GnuTLS, DANE is only supported from version 3.0.0 onwards.
59407 </para>
59408 <para>
59409 DANE is specified in published RFCs and decouples certificate authority trust
59410 selection from a "race to the bottom" of "you must trust everything for mail
59411 to get through".
59412 There is an alternative technology called MTA-STS, which
59413 instead publishes MX trust anchor information on an HTTPS website.  At the
59414 time this text was last updated, MTA-STS was still a draft, not yet an RFC.
59415 Exim has no support for MTA-STS as a client, but Exim mail server operators
59416 can choose to publish information describing their TLS configuration using
59417 MTA-STS to let those clients who do use that protocol derive trust
59418 information.
59419 </para>
59420 <para>
59421 The MTA-STS design requires a certificate from a public Certificate Authority
59422 which is recognized by clients sending to you.
59423 That selection of which CAs are trusted by others is outside your control.
59424 </para>
59425 <para>
59426 The most interoperable course of action is probably to use
59427 <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis>, with automated certificate
59428 renewal; to publish the anchor information in DNSSEC-secured DNS via TLSA
59429 records for DANE clients (such as Exim and Postfix) and to publish anchor
59430 information for MTA-STS as well.  This is what is done for the <emphasis>exim.org</emphasis>
59431 domain itself (with caveats around occasionally broken MTA-STS because of
59432 incompatible specification changes prior to reaching RFC status).
59433 </para>
59434 </section>
59435 </section>
59436 </chapter>
59437
59438 <chapter id="CHAPACL">
59439 <title>Access control lists</title>
59440 <para>
59441 <indexterm role="concept" id="IIDacl" class="startofrange">
59442 <primary>access control lists (ACLs)</primary>
59443 <secondary>description</secondary>
59444 </indexterm>
59445 <indexterm role="concept">
59446 <primary>control of incoming mail</primary>
59447 </indexterm>
59448 <indexterm role="concept">
59449 <primary>message</primary>
59450 <secondary>controlling incoming</secondary>
59451 </indexterm>
59452 <indexterm role="concept">
59453 <primary>policy control</primary>
59454 <secondary>access control lists</secondary>
59455 </indexterm>
59456 Access Control Lists (ACLs) are defined in a separate section of the runtime
59457 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
59458 name, terminated by a colon. Here is a complete ACL section that contains just
59459 one very small ACL:
59460 </para>
59461 <literallayout class="monospaced">
59462 begin acl
59463 small_acl:
59464   accept   hosts = one.host.only
59465 </literallayout>
59466 <para>
59467 You can have as many lists as you like in the ACL section, and the order in
59468 which they appear does not matter. The lists are self-terminating.
59469 </para>
59470 <para>
59471 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
59472 certain SMTP commands. This applies both to incoming TCP/IP connections, and
59473 when a local process submits a message using SMTP by specifying the <option>-bs</option>
59474 option. The most common use is for controlling which recipients are accepted
59475 in incoming messages. In addition, you can define an ACL that is used to check
59476 local non-SMTP messages. The default configuration file contains an example of
59477 a realistic ACL for checking RCPT commands. This is discussed in chapter
59478 <xref linkend="CHAPdefconfil"/>.
59479 </para>
59480 <section id="SECID188">
59481 <title>Testing ACLs</title>
59482 <para>
59483 The <option>-bh</option> command line option provides a way of testing your ACL
59484 configuration locally by running a fake SMTP session with which you interact.
59485 </para>
59486 </section>
59487 <section id="SECID189">
59488 <title>Specifying when ACLs are used</title>
59489 <para>
59490 <indexterm role="concept">
59491 <primary>access control lists (ACLs)</primary>
59492 <secondary>options for specifying</secondary>
59493 </indexterm>
59494 In order to cause an ACL to be used, you have to name it in one of the relevant
59495 options in the main part of the configuration. These options are:
59496 <indexterm role="concept">
59497 <primary>AUTH</primary>
59498 <secondary>ACL for</secondary>
59499 </indexterm>
59500 <indexterm role="concept">
59501 <primary>DATA</primary>
59502 <secondary>ACLs for</secondary>
59503 </indexterm>
59504 <indexterm role="concept">
59505 <primary>ETRN</primary>
59506 <secondary>ACL for</secondary>
59507 </indexterm>
59508 <indexterm role="concept">
59509 <primary>EXPN</primary>
59510 <secondary>ACL for</secondary>
59511 </indexterm>
59512 <indexterm role="concept">
59513 <primary>HELO</primary>
59514 <secondary>ACL for</secondary>
59515 </indexterm>
59516 <indexterm role="concept">
59517 <primary>EHLO</primary>
59518 <secondary>ACL for</secondary>
59519 </indexterm>
59520 <indexterm role="concept">
59521 <primary>DKIM</primary>
59522 <secondary>ACL for</secondary>
59523 </indexterm>
59524 <indexterm role="concept">
59525 <primary>MAIL</primary>
59526 <secondary>ACL for</secondary>
59527 </indexterm>
59528 <indexterm role="concept">
59529 <primary>QUIT, ACL for</primary>
59530 </indexterm>
59531 <indexterm role="concept">
59532 <primary>RCPT</primary>
59533 <secondary>ACL for</secondary>
59534 </indexterm>
59535 <indexterm role="concept">
59536 <primary>STARTTLS, ACL for</primary>
59537 </indexterm>
59538 <indexterm role="concept">
59539 <primary>VRFY</primary>
59540 <secondary>ACL for</secondary>
59541 </indexterm>
59542 <indexterm role="concept">
59543 <primary>SMTP</primary>
59544 <secondary>connection, ACL for</secondary>
59545 </indexterm>
59546 <indexterm role="concept">
59547 <primary>non-SMTP messages</primary>
59548 <secondary>ACLs for</secondary>
59549 </indexterm>
59550 <indexterm role="concept">
59551 <primary>MIME content scanning</primary>
59552 <secondary>ACL for</secondary>
59553 </indexterm>
59554 <indexterm role="concept">
59555 <primary>PRDR</primary>
59556 <secondary>ACL for</secondary>
59557 </indexterm>
59558 </para>
59559 <informaltable frame="none">
59560 <tgroup cols="2" colsep="0" rowsep="0">
59561 <colspec colwidth="140pt" align="left"/>
59562 <colspec colwidth="254pt" align="left"/>
59563 <tbody>
59564 <row>
59565 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
59566 <entry>ACL for non-SMTP messages</entry>
59567 </row>
59568 <row>
59569 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
59570 <entry>ACL for non-SMTP MIME parts</entry>
59571 </row>
59572 <row>
59573 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
59574 <entry>ACL at start of non-SMTP message</entry>
59575 </row>
59576 <row>
59577 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
59578 <entry>ACL for AUTH</entry>
59579 </row>
59580 <row>
59581 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
59582 <entry>ACL for start of SMTP connection</entry>
59583 </row>
59584 <row>
59585 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
59586 <entry>ACL after DATA is complete</entry>
59587 </row>
59588 <row>
59589 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
59590 <entry>ACL for each recipient, after DATA is complete</entry>
59591 </row>
59592 <row>
59593 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
59594 <entry>ACL for each DKIM signer</entry>
59595 </row>
59596 <row>
59597 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
59598 <entry>ACL for ETRN</entry>
59599 </row>
59600 <row>
59601 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
59602 <entry>ACL for EXPN</entry>
59603 </row>
59604 <row>
59605 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
59606 <entry>ACL for HELO or EHLO</entry>
59607 </row>
59608 <row>
59609 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
59610 <entry>ACL for MAIL</entry>
59611 </row>
59612 <row>
59613 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
59614 <entry>ACL for the AUTH parameter of MAIL</entry>
59615 </row>
59616 <row>
59617 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
59618 <entry>ACL for content-scanning MIME parts</entry>
59619 </row>
59620 <row>
59621 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
59622 <entry>ACL for non-QUIT terminations</entry>
59623 </row>
59624 <row>
59625 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
59626 <entry>ACL at start of DATA command</entry>
59627 </row>
59628 <row>
59629 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
59630 <entry>ACL for QUIT</entry>
59631 </row>
59632 <row>
59633 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
59634 <entry>ACL for RCPT</entry>
59635 </row>
59636 <row>
59637 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
59638 <entry>ACL for STARTTLS</entry>
59639 </row>
59640 <row>
59641 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
59642 <entry>ACL for VRFY</entry>
59643 </row>
59644 </tbody>
59645 </tgroup>
59646 </informaltable>
59647 <para>
59648 For example, if you set
59649 </para>
59650 <literallayout class="monospaced">
59651 acl_smtp_rcpt = small_acl
59652 </literallayout>
59653 <para>
59654 the little ACL defined above is used whenever Exim receives a RCPT command
59655 in an SMTP dialogue. The majority of policy tests on incoming messages can be
59656 done when RCPT commands arrive. A rejection of RCPT should cause the
59657 sending MTA to give up on the recipient address contained in the RCPT
59658 command, whereas rejection at other times may cause the client MTA to keep on
59659 trying to deliver the message. It is therefore recommended that you do as much
59660 testing as possible at RCPT time.
59661 </para>
59662 <section id="SECID190">
59663 <title>The non-SMTP ACLs</title>
59664 <para>
59665 <indexterm role="concept">
59666 <primary>non-SMTP messages</primary>
59667 <secondary>ACLs for</secondary>
59668 </indexterm>
59669 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
59670 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
59671 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
59672 the state of the SMTP connection such as encryption and authentication) are not
59673 relevant and are forbidden in these ACLs. However, the sender and recipients
59674 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
59675 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
59676 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
59677 in any of these ACLs.
59678 </para>
59679 <para>
59680 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
59681 non-SMTP message, before any of the message has been read. (This is the
59682 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
59683 batched SMTP input, it runs after the DATA command has been reached. The
59684 result of this ACL is ignored; it cannot be used to reject a message. If you
59685 really need to, you could set a value in an ACL variable here and reject based
59686 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
59687 controls, and in particular, it can be used to set
59688 </para>
59689 <literallayout class="monospaced">
59690 control = suppress_local_fixups
59691 </literallayout>
59692 <para>
59693 This cannot be used in the other non-SMTP ACLs because by the time they are
59694 run, it is too late.
59695 </para>
59696 <para>
59697 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
59698 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
59699 </para>
59700 <para>
59701 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
59702 kind of rejection is treated as permanent, because there is no way of sending a
59703 temporary error for these kinds of message.
59704 </para>
59705 </section>
59706 <section id="SECID191">
59707 <title>The SMTP connect ACL</title>
59708 <para>
59709 <indexterm role="concept">
59710 <primary>SMTP</primary>
59711 <secondary>connection, ACL for</secondary>
59712 </indexterm>
59713 <indexterm role="option">
59714 <primary><option>smtp_banner</option></primary>
59715 </indexterm>
59716 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
59717 session, after the test specified by <option>host_reject_connection</option> (which is now
59718 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
59719 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
59720 the message override the banner message that is otherwise specified by the
59721 <option>smtp_banner</option> option.
59722 </para>
59723 <para revisionflag="changed">
59724 For tls-on-connect connections, the ACL is run before the TLS connection
59725 is accepted; if the ACL does not accept then the TCP connection is dropped without
59726 any TLS startup attempt and without any SMTP response being transmitted.
59727 </para>
59728 </section>
59729 <section id="SECID192">
59730 <title>The EHLO/HELO ACL</title>
59731 <para>
59732 <indexterm role="concept">
59733 <primary>EHLO</primary>
59734 <secondary>ACL for</secondary>
59735 </indexterm>
59736 <indexterm role="concept">
59737 <primary>HELO</primary>
59738 <secondary>ACL for</secondary>
59739 </indexterm>
59740 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
59741 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
59742 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
59743 Note that a client may issue more than one EHLO or HELO command in an SMTP
59744 session, and indeed is required to issue a new EHLO or HELO after successfully
59745 setting up encryption following a STARTTLS command.
59746 </para>
59747 <para>
59748 Note also that a deny neither forces the client to go away nor means that
59749 mail will be refused on the connection.  Consider checking for
59750 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
59751 </para>
59752 <para>
59753 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
59754 modifier, the message may not contain more than one line (it will be truncated
59755 at the first newline and a panic logged if it does). Such a message cannot
59756 affect the EHLO options that are listed on the second and subsequent lines of
59757 an EHLO response.
59758 </para>
59759 </section>
59760 <section id="SECID193">
59761 <title>The DATA ACLs</title>
59762 <para>
59763 <indexterm role="concept">
59764 <primary>DATA</primary>
59765 <secondary>ACLs for</secondary>
59766 </indexterm>
59767 Two ACLs are associated with the DATA command, because it is two-stage
59768 command, with two responses being sent to the client.
59769 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
59770 is obeyed. This gives you control after all the RCPT commands, but before
59771 the message itself is received. It offers the opportunity to give a negative
59772 response to the DATA command before the data is transmitted. Header lines
59773 added by MAIL or RCPT ACLs are not visible at this time, but any that
59774 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
59775 </para>
59776 <para>
59777 You cannot test the contents of the message, for example, to verify addresses
59778 in the headers, at RCPT time or when the DATA command is received. Such
59779 tests have to appear in the ACL that is run after the message itself has been
59780 received, before the final response to the DATA command is sent. This is
59781 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
59782 associated with the DATA command.
59783 </para>
59784 <para>
59785 <indexterm role="concept">
59786 <primary>CHUNKING</primary>
59787 <secondary>BDAT command</secondary>
59788 </indexterm>
59789 <indexterm role="concept">
59790 <primary>BDAT</primary>
59791 <secondary>SMTP command</secondary>
59792 </indexterm>
59793 <indexterm role="concept">
59794 <primary>RFC 3030</primary>
59795 <secondary>CHUNKING</secondary>
59796 </indexterm>
59797 If CHUNKING was advertised and a BDAT command sequence is received,
59798 the <option>acl_smtp_predata</option> ACL is not run.
59799 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
59800 the data specified is received.
59801 </para>
59802 <para>
59803 For both of these ACLs, it is not possible to reject individual recipients. An
59804 error response rejects the entire message. Unfortunately, it is known that some
59805 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
59806 before or after the data) correctly &ndash; they keep the message on their queues
59807 and try again later, but that is their problem, though it does waste some of
59808 your resources.
59809 </para>
59810 <para>
59811 The <option>acl_smtp_data</option> ACL is run after
59812 the <option>acl_smtp_data_prdr</option>,
59813 the <option>acl_smtp_dkim</option>
59814 and the <option>acl_smtp_mime</option> ACLs.
59815 </para>
59816 </section>
59817 <section id="SECTDKIMACL">
59818 <title>The SMTP DKIM ACL</title>
59819 <para>
59820 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
59821 enabled (which is the default).
59822 </para>
59823 <para>
59824 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
59825 received, and is executed for each DKIM signature found in a message.  If not
59826 otherwise specified, the default action is to accept.
59827 </para>
59828 <para>
59829 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
59830 </para>
59831 <para>
59832 For details on the operation of DKIM, see section <xref linkend="SECDKIM"/>.
59833 </para>
59834 </section>
59835 <section id="SECID194">
59836 <title>The SMTP MIME ACL</title>
59837 <para>
59838 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
59839 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
59840 </para>
59841 <para>
59842 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
59843 </para>
59844 </section>
59845 <section id="SECTPRDRACL">
59846 <title>The SMTP PRDR ACL</title>
59847 <para>
59848 <indexterm role="concept">
59849 <primary>PRDR</primary>
59850 <secondary>ACL for</secondary>
59851 </indexterm>
59852 <indexterm role="option">
59853 <primary><option>prdr_enable</option></primary>
59854 </indexterm>
59855 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
59856 with PRDR support enabled (which is the default).
59857 It becomes active only when the PRDR feature is negotiated between
59858 client and server for a message, and more than one recipient
59859 has been accepted.
59860 </para>
59861 <para>
59862 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
59863 has been received, and is executed once for each recipient of the message
59864 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
59865 The test may accept, defer or deny for individual recipients.
59866 The <option>acl_smtp_data</option> will still be called after this ACL and
59867 can reject the message overall, even if this ACL has accepted it
59868 for some or all recipients.
59869 </para>
59870 <para>
59871 PRDR may be used to support per-user content filtering.  Without it
59872 one must defer any recipient after the first that has a different
59873 content-filter configuration.  With PRDR, the RCPT-time check
59874 <indexterm role="concept">
59875 <primary>PRDR</primary>
59876 <secondary>variable for</secondary>
59877 </indexterm>
59878 for this can be disabled when the variable <varname>$prdr_requested</varname>
59879 is <quote>yes</quote>.
59880 Any required difference in behaviour of the main DATA-time
59881 ACL should however depend on the PRDR-time ACL having run, as Exim
59882 will avoid doing so in some situations (e.g. single-recipient mails).
59883 </para>
59884 <para>
59885 See also the <option>prdr_enable</option> global option
59886 and the <option>hosts_try_prdr</option> smtp transport option.
59887 </para>
59888 <para>
59889 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
59890 If the ACL is not defined, processing completes as if
59891 the feature was not requested by the client.
59892 </para>
59893 </section>
59894 <section id="SECTQUITACL">
59895 <title>The QUIT ACL</title>
59896 <para>
59897 <indexterm role="concept">
59898 <primary>QUIT, ACL for</primary>
59899 </indexterm>
59900 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
59901 does not affect the response code to QUIT, which is always 221. Thus, the ACL
59902 does not in fact control any access.
59903 For this reason, it may only accept
59904 or warn as its final result.
59905 </para>
59906 <para>
59907 This ACL can be used for tasks such as custom logging at the end of an SMTP
59908 session. For example, you can use ACL variables in other ACLs to count
59909 messages, recipients, etc., and log the totals at QUIT time using one or
59910 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
59911 </para>
59912 <para>
59913 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
59914 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
59915 </para>
59916 <para>
59917 You do not need to have a final <option>accept</option>, but if you do, you can use a
59918 <option>message</option> modifier to specify custom text that is sent as part of the 221
59919 response to QUIT.
59920 </para>
59921 <para>
59922 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
59923 failure (for example, failure to open a log file, or when Exim is bombing out
59924 because it has detected an unrecoverable error), all SMTP commands from the
59925 client are given temporary error responses until QUIT is received or the
59926 connection is closed. In these special cases, the QUIT ACL does not run.
59927 </para>
59928 </section>
59929 <section id="SECTNOTQUITACL">
59930 <title>The not-QUIT ACL</title>
59931 <para>
59932 <indexterm role="variable">
59933 <primary><varname>$acl_smtp_notquit</varname></primary>
59934 </indexterm>
59935 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
59936 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
59937 trouble, such as being unable to write to its log files, this ACL is not run,
59938 because it might try to do things (such as write to log files) that make the
59939 situation even worse.
59940 </para>
59941 <para>
59942 Like the QUIT ACL, this ACL is provided to make it possible to do customized
59943 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
59944 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
59945 and <option>warn</option>.
59946 </para>
59947 <para>
59948 <indexterm role="variable">
59949 <primary><varname>$smtp_notquit_reason</varname></primary>
59950 </indexterm>
59951 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
59952 to a string that indicates the reason for the termination of the SMTP
59953 connection. The possible values are:
59954 </para>
59955 <informaltable frame="none">
59956 <tgroup cols="2" colsep="0" rowsep="0">
59957 <colspec colwidth="196pt" align="left"/>
59958 <colspec colwidth="254pt" align="left"/>
59959 <tbody>
59960 <row>
59961 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
59962 <entry>Another ACL issued a <option>drop</option> command</entry>
59963 </row>
59964 <row>
59965 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
59966 <entry>Too many unknown or non-mail commands</entry>
59967 </row>
59968 <row>
59969 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
59970 <entry>Timeout while reading SMTP commands</entry>
59971 </row>
59972 <row>
59973 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
59974 <entry>The SMTP connection has been lost</entry>
59975 </row>
59976 <row>
59977 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
59978 <entry>Timeout while reading message data</entry>
59979 </row>
59980 <row>
59981 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
59982 <entry>The <function>local_scan()</function> function crashed</entry>
59983 </row>
59984 <row>
59985 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
59986 <entry>The <function>local_scan()</function> function timed out</entry>
59987 </row>
59988 <row>
59989 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
59990 <entry>SIGTERM or SIGINT</entry>
59991 </row>
59992 <row>
59993 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
59994 <entry>SMTP synchronization error</entry>
59995 </row>
59996 <row>
59997 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
59998 <entry>TLS failed to start</entry>
59999 </row>
60000 </tbody>
60001 </tgroup>
60002 </informaltable>
60003 <para>
60004 In most cases when an SMTP connection is closed without having received QUIT,
60005 Exim sends an SMTP response message before actually closing the connection.
60006 With the exception of the <literal>acl-drop</literal> case, the default message can be
60007 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
60008 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
60009 used.
60010 </para>
60011 </section>
60012 </section>
60013 <section id="SECID195">
60014 <title>Finding an ACL to use</title>
60015 <para>
60016 <indexterm role="concept">
60017 <primary>access control lists (ACLs)</primary>
60018 <secondary>finding which to use</secondary>
60019 </indexterm>
60020 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
60021 you can use different ACLs in different circumstances. For example,
60022 </para>
60023 <literallayout class="monospaced">
60024 acl_smtp_rcpt = ${if ={25}{$interface_port} \
60025                      {acl_check_rcpt} {acl_check_rcpt_submit} }
60026 </literallayout>
60027 <para>
60028 In the default configuration file there are some example settings for
60029 providing an RFC 4409 message <quote>submission</quote> service on port 587 and
60030 an RFC 8314 <quote>submissions</quote> service on port 465. You can use a string
60031 expansion like this to choose an ACL for MUAs on these ports which is
60032 more appropriate for this purpose than the default ACL on port 25.
60033 </para>
60034 <para>
60035 The expanded string does not have to be the name of an ACL in the
60036 configuration file; there are other possibilities. Having expanded the
60037 string, Exim searches for an ACL as follows:
60038 </para>
60039 <itemizedlist>
60040 <listitem>
60041 <para>
60042 If the string begins with a slash, Exim uses it as a filename, and reads its
60043 contents as an ACL. The lines are processed in the same way as lines in the
60044 Exim configuration file. In particular, continuation lines are supported, blank
60045 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
60046 If the file does not exist or cannot be read, an error occurs (typically
60047 causing a temporary failure of whatever caused the ACL to be run). For example:
60048 </para>
60049 <literallayout class="monospaced">
60050 acl_smtp_data = /etc/acls/\
60051   ${lookup{$sender_host_address}lsearch\
60052   {/etc/acllist}{$value}{default}}
60053 </literallayout>
60054 <para>
60055 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
60056 back to a default if the lookup fails. If an ACL is successfully read from a
60057 file, it is retained in memory for the duration of the Exim process, so that it
60058 can be re-used without having to re-read the file.
60059 </para>
60060 </listitem>
60061 <listitem>
60062 <para>
60063 If the string does not start with a slash, and does not contain any spaces,
60064 Exim searches the ACL section of the configuration for an ACL whose name
60065 matches the string.
60066 </para>
60067 </listitem>
60068 <listitem>
60069 <para>
60070 If no named ACL is found, or if the string contains spaces, Exim parses
60071 the string as an inline ACL. This can save typing in cases where you just
60072 want to have something like
60073 </para>
60074 <literallayout class="monospaced">
60075 acl_smtp_vrfy = accept
60076 </literallayout>
60077 <para>
60078 in order to allow free use of the VRFY command. Such a string may contain
60079 newlines; it is processed in the same way as an ACL that is read from a file.
60080 </para>
60081 </listitem>
60082 </itemizedlist>
60083 </section>
60084 <section id="SECID196">
60085 <title>ACL return codes</title>
60086 <para>
60087 <indexterm role="concept">
60088 <primary>access control lists (ACLs)</primary>
60089 <secondary>return codes</secondary>
60090 </indexterm>
60091 Except for the QUIT ACL, which does not affect the SMTP return code (see
60092 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
60093 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
60094 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
60095 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
60096 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
60097 This also causes a 4<emphasis>xx</emphasis> return code.
60098 </para>
60099 <para>
60100 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
60101 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
60102 submitters of non-SMTP messages.
60103 </para>
60104 <para>
60105 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
60106 has the effect of <quote>accept</quote>, but causes either the entire message or an
60107 individual recipient address to be discarded. In other words, it is a
60108 blackholing facility. Use it with care.
60109 </para>
60110 <para>
60111 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
60112 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
60113 RCPT ACL is to discard just the one recipient address. If there are no
60114 recipients left when the message&#x2019;s data is received, the DATA ACL is not
60115 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
60116 remaining recipients. The <quote>discard</quote> return is not permitted for the
60117 <option>acl_smtp_predata</option> ACL.
60118 </para>
60119 <para>
60120 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
60121 is done on the address and the result determines the SMTP response.
60122 </para>
60123 <para>
60124 <indexterm role="concept">
60125 <primary><function>local_scan()</function> function</primary>
60126 <secondary>when all recipients discarded</secondary>
60127 </indexterm>
60128 The <function>local_scan()</function> function is always run, even if there are no remaining
60129 recipients; it may create new recipients.
60130 </para>
60131 </section>
60132 <section id="SECID197">
60133 <title>Unset ACL options</title>
60134 <para>
60135 <indexterm role="concept">
60136 <primary>access control lists (ACLs)</primary>
60137 <secondary>unset options</secondary>
60138 </indexterm>
60139 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
60140 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
60141 not defined at all. For any defined ACL, the default action when control
60142 reaches the end of the ACL statements is <quote>deny</quote>.
60143 </para>
60144 <para>
60145 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
60146 these two are ACLs that are used only for their side effects. They cannot be
60147 used to accept or reject anything.
60148 </para>
60149 <para>
60150 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
60151 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
60152 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
60153 when the ACL is not defined is <quote>accept</quote>.
60154 </para>
60155 <para>
60156 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
60157 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
60158 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
60159 messages over an SMTP connection. For an example, see the ACL in the default
60160 configuration file.
60161 </para>
60162 </section>
60163 <section id="SECID198">
60164 <title>Data for message ACLs</title>
60165 <para>
60166 <indexterm role="concept">
60167 <primary>access control lists (ACLs)</primary>
60168 <secondary>data for message ACL</secondary>
60169 </indexterm>
60170 <indexterm role="variable">
60171 <primary><varname>$domain</varname></primary>
60172 </indexterm>
60173 <indexterm role="variable">
60174 <primary><varname>$local_part</varname></primary>
60175 </indexterm>
60176 <indexterm role="variable">
60177 <primary><varname>$sender_address</varname></primary>
60178 </indexterm>
60179 <indexterm role="variable">
60180 <primary><varname>$sender_host_address</varname></primary>
60181 </indexterm>
60182 <indexterm role="variable">
60183 <primary><varname>$smtp_command</varname></primary>
60184 </indexterm>
60185 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
60186 that contain information about the host and the message&#x2019;s sender (for example,
60187 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
60188 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
60189 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
60190 is available in <varname>$smtp_command</varname>.
60191 </para>
60192 <para>
60193 When an ACL for the AUTH parameter of MAIL is running, the variables that
60194 contain information about the host are set, but <varname>$sender_address</varname> is not yet
60195 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
60196 how it is used.
60197 </para>
60198 <para>
60199 <indexterm role="variable">
60200 <primary><varname>$message_size</varname></primary>
60201 </indexterm>
60202 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
60203 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
60204 that parameter is not given. The value is updated to the true message size by
60205 the time the final DATA ACL is run (after the message data has been
60206 received).
60207 </para>
60208 <para>
60209 <indexterm role="variable">
60210 <primary><varname>$rcpt_count</varname></primary>
60211 </indexterm>
60212 <indexterm role="variable">
60213 <primary><varname>$recipients_count</varname></primary>
60214 </indexterm>
60215 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
60216 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
60217 accepted, so while an ACL for RCPT is being processed, it contains the number
60218 of previously accepted recipients. At DATA time (for both the DATA ACLs),
60219 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
60220 <varname>$recipients_count</varname> contains the total number of accepted recipients.
60221 </para>
60222 </section>
60223 <section id="SECTdatfornon">
60224 <title>Data for non-message ACLs</title>
60225 <para>
60226 <indexterm role="concept">
60227 <primary>access control lists (ACLs)</primary>
60228 <secondary>data for non-message ACL</secondary>
60229 </indexterm>
60230 <indexterm role="variable">
60231 <primary><varname>$smtp_command_argument</varname></primary>
60232 </indexterm>
60233 <indexterm role="variable">
60234 <primary><varname>$smtp_command</varname></primary>
60235 </indexterm>
60236 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
60237 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
60238 and the entire SMTP command is available in <varname>$smtp_command</varname>.
60239 These variables can be tested using a <option>condition</option> condition. For example,
60240 here is an ACL for use with AUTH, which insists that either the session is
60241 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
60242 does not permit authentication methods that use cleartext passwords on
60243 unencrypted connections.
60244 </para>
60245 <literallayout class="monospaced">
60246 acl_check_auth:
60247   accept encrypted = *
60248   accept condition = ${if eq{${uc:$smtp_command_argument}}\
60249                      {CRAM-MD5}}
60250   deny   message   = TLS encryption or CRAM-MD5 required
60251 </literallayout>
60252 <para>
60253 (Another way of applying this restriction is to arrange for the authenticators
60254 that use cleartext passwords not to be advertised when the connection is not
60255 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
60256 option to do this.)
60257 </para>
60258 </section>
60259 <section id="SECID199">
60260 <title>Format of an ACL</title>
60261 <para>
60262 <indexterm role="concept">
60263 <primary>access control lists (ACLs)</primary>
60264 <secondary>format of</secondary>
60265 </indexterm>
60266 <indexterm role="concept">
60267 <primary>access control lists (ACLs)</primary>
60268 <secondary>verbs, definition of</secondary>
60269 </indexterm>
60270 An individual ACL consists of a number of statements. Each statement starts
60271 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
60272 Modifiers can change the way the verb operates, define error and log messages,
60273 set variables, insert delays, and vary the processing of accepted messages.
60274 </para>
60275 <para>
60276 If all the conditions are met, the verb is obeyed. The same condition may be
60277 used (with different arguments) more than once in the same statement. This
60278 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
60279 example:
60280 </para>
60281 <literallayout class="monospaced">
60282 deny  dnslists = list1.example
60283       dnslists = list2.example
60284 </literallayout>
60285 <para>
60286 If there are no conditions, the verb is always obeyed. Exim stops evaluating
60287 the conditions and modifiers when it reaches a condition that fails. What
60288 happens then depends on the verb (and in one case, on a special modifier). Not
60289 all the conditions make sense at every testing point. For example, you cannot
60290 test a sender address in the ACL that is run for a VRFY command.
60291 </para>
60292 </section>
60293 <section id="SECID200">
60294 <title>ACL verbs</title>
60295 <para>
60296 The ACL verbs are as follows:
60297 </para>
60298 <itemizedlist>
60299 <listitem>
60300 <para>
60301 <indexterm role="concept">
60302 <primary><option>accept</option> ACL verb</primary>
60303 </indexterm>
60304 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
60305 of the conditions are not met, what happens depends on whether <option>endpass</option>
60306 appears among the conditions (for syntax see below). If the failing condition
60307 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
60308 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
60309 check a RCPT command:
60310 </para>
60311 <literallayout class="monospaced">
60312 accept domains = +local_domains
60313        endpass
60314        verify = recipient
60315 </literallayout>
60316 <para>
60317 If the recipient domain does not match the <option>domains</option> condition, control
60318 passes to the next statement. If it does match, the recipient is verified, and
60319 the command is accepted if verification succeeds. However, if verification
60320 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
60321 <option>endpass</option>.
60322 </para>
60323 <para>
60324 The <option>endpass</option> feature has turned out to be confusing to many people, so its
60325 use is not recommended nowadays. It is always possible to rewrite an ACL so
60326 that <option>endpass</option> is not needed, and it is no longer used in the default
60327 configuration.
60328 </para>
60329 <para>
60330 <indexterm role="concept">
60331 <primary><option>message</option> ACL modifier</primary>
60332 <secondary>with <option>accept</option></secondary>
60333 </indexterm>
60334 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
60335 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
60336 (when an <option>accept</option> verb either accepts or passes control to the next
60337 statement), <option>message</option> can be used to vary the message that is sent when an
60338 SMTP command is accepted. For example, in a RCPT ACL you could have:
60339 </para>
60340 <literallayout>
60341 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
60342 <literal>        message = OK, I will allow you through today</literal>
60343 </literallayout>
60344 <para>
60345 You can specify an SMTP response code, optionally followed by an <quote>extended
60346 response code</quote> at the start of the message, but the first digit must be the
60347 same as would be sent by default, which is 2 for an <option>accept</option> verb.
60348 </para>
60349 <para>
60350 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
60351 an error message that is used when access is denied. This behaviour is retained
60352 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
60353 of <option>endpass</option>.
60354 </para>
60355 </listitem>
60356 <listitem>
60357 <para>
60358 <indexterm role="concept">
60359 <primary><option>defer</option> ACL verb</primary>
60360 </indexterm>
60361 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
60362 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
60363 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
60364 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
60365 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
60366 be used in any ACL, and even for a recipient it might be a simpler approach.
60367 </para>
60368 </listitem>
60369 <listitem>
60370 <para>
60371 <indexterm role="concept">
60372 <primary><option>deny</option> ACL verb</primary>
60373 </indexterm>
60374 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
60375 the conditions are not met, control is passed to the next ACL statement. For
60376 example,
60377 </para>
60378 <literallayout class="monospaced">
60379 deny dnslists = blackholes.mail-abuse.org
60380 </literallayout>
60381 <para>
60382 rejects commands from hosts that are on a DNS black list.
60383 </para>
60384 </listitem>
60385 <listitem>
60386 <para>
60387 <indexterm role="concept">
60388 <primary><option>discard</option> ACL verb</primary>
60389 </indexterm>
60390 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
60391 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
60392 that are concerned with receiving messages. When all the conditions are true,
60393 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
60394 recipients to be discarded. If it is used in an ACL for RCPT, just the one
60395 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
60396 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
60397 do not appear in the log line when the <option>received_recipients</option> log selector is set.
60398 </para>
60399 <para>
60400 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
60401 its contents are added to the line that is automatically written to the log.
60402 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
60403 </para>
60404 </listitem>
60405 <listitem>
60406 <para>
60407 <indexterm role="concept">
60408 <primary><option>drop</option> ACL verb</primary>
60409 </indexterm>
60410 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
60411 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
60412 </para>
60413 <literallayout class="monospaced">
60414 drop   condition = ${if &gt; {$rcpt_count}{20}}
60415        message   = I don't take more than 20 RCPTs
60416 </literallayout>
60417 <para>
60418 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
60419 The connection is always dropped after sending a 550 response.
60420 </para>
60421 </listitem>
60422 <listitem>
60423 <para>
60424 <indexterm role="concept">
60425 <primary><option>require</option> ACL verb</primary>
60426 </indexterm>
60427 <option>require</option>: If all the conditions are met, control is passed to the next ACL
60428 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
60429 example, when checking a RCPT command,
60430 </para>
60431 <literallayout class="monospaced">
60432 require message = Sender did not verify
60433         verify  = sender
60434 </literallayout>
60435 <para>
60436 passes control to subsequent statements only if the message&#x2019;s sender can be
60437 verified. Otherwise, it rejects the command. Note the positioning of the
60438 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
60439 discussed in section <xref linkend="SECTcondmodproc"/>.
60440 </para>
60441 </listitem>
60442 <listitem>
60443 <para>
60444 <indexterm role="concept">
60445 <primary><option>warn</option> ACL verb</primary>
60446 </indexterm>
60447 <option>warn</option>: If all the conditions are true, a line specified by the
60448 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
60449 to the next ACL statement. If any condition is false, the log line is not
60450 written. If an identical log line is requested several times in the same
60451 message, only one copy is actually written to the log. If you want to force
60452 duplicates to be written, use the <option>logwrite</option> modifier instead.
60453 </para>
60454 <para>
60455 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
60456 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
60457 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
60458 first failing condition. There is more about adding header lines in section
60459 <xref linkend="SECTaddheadacl"/>.
60460 </para>
60461 <para>
60462 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
60463 some sort of defer), the log line specified by <option>log_message</option> is not written.
60464 This does not include the case of a forced failure from a lookup, which
60465 is considered to be a successful completion. After a defer, no further
60466 conditions or modifiers in the <option>warn</option> statement are processed. The incident
60467 is logged, and the ACL continues to be processed, from the next statement
60468 onwards.
60469 </para>
60470 <para>
60471 <indexterm role="variable">
60472 <primary><varname>$acl_verify_message</varname></primary>
60473 </indexterm>
60474 When one of the <option>warn</option> conditions is an address verification that fails, the
60475 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
60476 want this logged, you must set it up explicitly. For example:
60477 </para>
60478 <literallayout class="monospaced">
60479 warn   !verify = sender
60480        log_message = sender verify failed: $acl_verify_message
60481 </literallayout>
60482 </listitem>
60483 </itemizedlist>
60484 <para>
60485 At the end of each ACL there is an implicit unconditional <option>deny</option>.
60486 </para>
60487 <para>
60488 As you can see from the examples above, the conditions and modifiers are
60489 written one to a line, with the first one on the same line as the verb, and
60490 subsequent ones on following lines. If you have a very long condition, you can
60491 continue it onto several physical lines by the usual backslash continuation
60492 mechanism. It is conventional to align the conditions vertically.
60493 </para>
60494 </section>
60495 <section id="SECTaclvariables">
60496 <title>ACL variables</title>
60497 <para>
60498 <indexterm role="concept">
60499 <primary>access control lists (ACLs)</primary>
60500 <secondary>variables</secondary>
60501 </indexterm>
60502 There are some special variables that can be set during ACL processing. They
60503 can be used to pass information between different ACLs, different invocations
60504 of the same ACL in the same SMTP connection, and between ACLs and the routers,
60505 transports, and filters that are used to deliver a message. The names of these
60506 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
60507 an underscore, but the remainder of the name can be any sequence of
60508 alphanumeric characters and underscores that you choose. There is no limit on
60509 the number of ACL variables. The two sets act as follows:
60510 </para>
60511 <itemizedlist>
60512 <listitem>
60513 <para>
60514 The values of those variables whose names begin with <varname>$acl_c</varname> persist
60515 throughout an SMTP connection. They are never reset. Thus, a value that is set
60516 while receiving one message is still available when receiving the next message
60517 on the same SMTP connection.
60518 </para>
60519 </listitem>
60520 <listitem>
60521 <para>
60522 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
60523 while a message is being received. They are reset afterwards. They are also
60524 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
60525 </para>
60526 </listitem>
60527 </itemizedlist>
60528 <para>
60529 When a message is accepted, the current values of all the ACL variables are
60530 preserved with the message and are subsequently made available at delivery
60531 time. The ACL variables are set by a modifier called <option>set</option>. For example:
60532 </para>
60533 <literallayout class="monospaced">
60534 accept hosts = whatever
60535        set acl_m4 = some value
60536 accept authenticated = *
60537        set acl_c_auth = yes
60538 </literallayout>
60539 <para>
60540 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
60541 be set. If you want to set a variable without taking any action, you can use a
60542 <option>warn</option> verb without any other modifiers or conditions.
60543 </para>
60544 <para>
60545 <indexterm role="option">
60546 <primary><option>strict_acl_vars</option></primary>
60547 </indexterm>
60548 What happens if a syntactically valid but undefined ACL variable is
60549 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
60550 false (the default), an empty string is substituted; if it is true, an
60551 error is generated.
60552 </para>
60553 <para>
60554 Versions of Exim before 4.64 have a limited set of numbered variables, but
60555 their names are compatible, so there is no problem with upgrading.
60556 </para>
60557 </section>
60558 <section id="SECTcondmodproc">
60559 <title>Condition and modifier processing</title>
60560 <para>
60561 <indexterm role="concept">
60562 <primary>access control lists (ACLs)</primary>
60563 <secondary>conditions; processing</secondary>
60564 </indexterm>
60565 <indexterm role="concept">
60566 <primary>access control lists (ACLs)</primary>
60567 <secondary>modifiers; processing</secondary>
60568 </indexterm>
60569 An exclamation mark preceding a condition negates its result. For example:
60570 </para>
60571 <literallayout class="monospaced">
60572 deny   domains = *.dom.example
60573       !verify  = recipient
60574 </literallayout>
60575 <para>
60576 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
60577 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
60578 negation can be used on the right-hand side of a condition. For example, these
60579 two statements are equivalent:
60580 </para>
60581 <literallayout class="monospaced">
60582 deny  hosts = !192.168.3.4
60583 deny !hosts =  192.168.3.4
60584 </literallayout>
60585 <para>
60586 However, for many conditions (<option>verify</option> being a good example), only left-hand
60587 side negation of the whole condition is possible.
60588 </para>
60589 <para>
60590 The arguments of conditions and modifiers are expanded. A forced failure
60591 of an expansion causes a condition to be ignored, that is, it behaves as if the
60592 condition is true. Consider these two statements:
60593 </para>
60594 <literallayout class="monospaced">
60595 accept  senders = ${lookup{$host_name}lsearch\
60596                   {/some/file}{$value}fail}
60597 accept  senders = ${lookup{$host_name}lsearch\
60598                   {/some/file}{$value}{}}
60599 </literallayout>
60600 <para>
60601 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
60602 the returned list is searched, but if the lookup fails the behaviour is
60603 different in the two cases. The <option>fail</option> in the first statement causes the
60604 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
60605 therefore succeeds. The second statement, however, generates an empty list when
60606 the lookup fails. No sender can match an empty list, so the condition fails,
60607 and therefore the <option>accept</option> also fails.
60608 </para>
60609 <para>
60610 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
60611 specify actions that are taken as the conditions for a statement are checked;
60612 others specify text for messages that are used when access is denied or a
60613 warning is generated. The <option>control</option> modifier affects the way an incoming
60614 message is handled.
60615 </para>
60616 <para>
60617 The positioning of the modifiers in an ACL statement is important, because the
60618 processing of a verb ceases as soon as its outcome is known. Only those
60619 modifiers that have already been encountered will take effect. For example,
60620 consider this use of the <option>message</option> modifier:
60621 </para>
60622 <literallayout class="monospaced">
60623 require message = Can't verify sender
60624         verify  = sender
60625         message = Can't verify recipient
60626         verify  = recipient
60627         message = This message cannot be used
60628 </literallayout>
60629 <para>
60630 If sender verification fails, Exim knows that the result of the statement is
60631 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
60632 so its text is used as the error message. If sender verification succeeds, but
60633 recipient verification fails, the second message is used. If recipient
60634 verification succeeds, the third message becomes <quote>current</quote>, but is never used
60635 because there are no more conditions to cause failure.
60636 </para>
60637 <para>
60638 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
60639 modifier that is used, because all the conditions must be true for rejection to
60640 happen. Specifying more than one <option>message</option> modifier does not make sense, and
60641 the message can even be specified after all the conditions. For example:
60642 </para>
60643 <literallayout class="monospaced">
60644 deny   hosts = ...
60645       !senders = *@my.domain.example
60646        message = Invalid sender from client host
60647 </literallayout>
60648 <para>
60649 The <quote>deny</quote> result does not happen until the end of the statement is reached,
60650 by which time Exim has set up the message.
60651 </para>
60652 </section>
60653 <section id="SECTACLmodi">
60654 <title>ACL modifiers</title>
60655 <para>
60656 <indexterm role="concept">
60657 <primary>access control lists (ACLs)</primary>
60658 <secondary>modifiers; list of</secondary>
60659 </indexterm>
60660 The ACL modifiers are as follows:
60661 </para>
60662 <variablelist>
60663 <varlistentry>
60664 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60665 <listitem>
60666 <para>
60667 This modifier specifies one or more header lines that are to be added to an
60668 incoming message, assuming, of course, that the message is ultimately
60669 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
60670 </para>
60671 </listitem></varlistentry>
60672 <varlistentry>
60673 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60674 <listitem>
60675 <para>
60676 <indexterm role="concept">
60677 <primary><option>continue</option> ACL modifier</primary>
60678 </indexterm>
60679 <indexterm role="concept">
60680 <primary>database</primary>
60681 <secondary>updating in ACL</secondary>
60682 </indexterm>
60683 This modifier does nothing of itself, and processing of the ACL always
60684 continues with the next condition or modifier. The value of <option>continue</option> is in
60685 the side effects of expanding its argument. Typically this could be used to
60686 update a database. It is really just a syntactic tidiness, to avoid having to
60687 write rather ugly lines like this:
60688 </para>
60689 <literallayout>
60690 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
60691 </literallayout>
60692 <para>
60693 Instead, all you need is
60694 </para>
60695 <literallayout>
60696 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
60697 </literallayout>
60698 </listitem></varlistentry>
60699 <varlistentry>
60700 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60701 <listitem>
60702 <para>
60703 <indexterm role="concept">
60704 <primary><option>control</option> ACL modifier</primary>
60705 </indexterm>
60706 This modifier affects the subsequent processing of the SMTP connection or of an
60707 incoming message that is accepted. The effect of the first type of control
60708 lasts for the duration of the connection, whereas the effect of the second type
60709 lasts only until the current message has been received. The message-specific
60710 controls always apply to the whole message, not to individual recipients,
60711 even if the <option>control</option> modifier appears in a RCPT ACL.
60712 </para>
60713 <para>
60714 As there are now quite a few controls that can be applied, they are described
60715 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
60716 in several different ways. For example:
60717 </para>
60718 <itemizedlist>
60719 <listitem>
60720 <para>
60721 It can be at the end of an <option>accept</option> statement:
60722 </para>
60723 <literallayout class="monospaced">
60724     accept  ...some conditions
60725             control = queue
60726 </literallayout>
60727 <para>
60728 In this case, the control is applied when this statement yields <quote>accept</quote>, in
60729 other words, when the conditions are all true.
60730 </para>
60731 </listitem>
60732 <listitem>
60733 <para>
60734 It can be in the middle of an <option>accept</option> statement:
60735 </para>
60736 <literallayout class="monospaced">
60737     accept  ...some conditions...
60738             control = queue
60739             ...some more conditions...
60740 </literallayout>
60741 <para>
60742 If the first set of conditions are true, the control is applied, even if the
60743 statement does not accept because one of the second set of conditions is false.
60744 In this case, some subsequent statement must yield <quote>accept</quote> for the control
60745 to be relevant.
60746 </para>
60747 </listitem>
60748 <listitem>
60749 <para>
60750 It can be used with <option>warn</option> to apply the control, leaving the
60751 decision about accepting or denying to a subsequent verb. For
60752 example:
60753 </para>
60754 <literallayout class="monospaced">
60755     warn    ...some conditions...
60756             control = freeze
60757     accept  ...
60758 </literallayout>
60759 <para>
60760 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
60761 <option>logwrite</option>, so it does not add anything to the message and does not write a
60762 log entry.
60763 </para>
60764 </listitem>
60765 <listitem>
60766 <para>
60767 If you want to apply a control unconditionally, you can use it with a
60768 <option>require</option> verb. For example:
60769 </para>
60770 <literallayout class="monospaced">
60771     require  control = no_multiline_responses
60772 </literallayout>
60773 </listitem>
60774 </itemizedlist>
60775 </listitem></varlistentry>
60776 <varlistentry>
60777 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
60778 <listitem>
60779 <para>
60780 <indexterm role="concept">
60781 <primary><option>delay</option> ACL modifier</primary>
60782 </indexterm>
60783 <indexterm role="option">
60784 <primary><option>-bh</option></primary>
60785 </indexterm>
60786 This modifier may appear in any ACL except notquit. It causes Exim to wait for
60787 the time interval before proceeding. However, when testing Exim using the
60788 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
60789 output instead). The time is given in the usual Exim notation, and the delay
60790 happens as soon as the modifier is processed. In an SMTP session, pending
60791 output is flushed before the delay is imposed.
60792 </para>
60793 <para>
60794 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
60795 example:
60796 </para>
60797 <literallayout class="monospaced">
60798 deny    ...some conditions...
60799         delay = 30s
60800 </literallayout>
60801 <para>
60802 The delay happens if all the conditions are true, before the statement returns
60803 <quote>deny</quote>. Compare this with:
60804 </para>
60805 <literallayout class="monospaced">
60806 deny    delay = 30s
60807         ...some conditions...
60808 </literallayout>
60809 <para>
60810 which waits for 30s before processing the conditions. The <option>delay</option> modifier
60811 can also be used with <option>warn</option> and together with <option>control</option>:
60812 </para>
60813 <literallayout class="monospaced">
60814 warn    ...some conditions...
60815         delay = 2m
60816         control = freeze
60817 accept  ...
60818 </literallayout>
60819 <para>
60820 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
60821 responses to several commands are no longer buffered and sent in one packet (as
60822 they would normally be) because all output is flushed before imposing the
60823 delay. This optimization is disabled so that a number of small delays do not
60824 appear to the client as one large aggregated delay that might provoke an
60825 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
60826 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
60827 </para>
60828 </listitem></varlistentry>
60829 <varlistentry>
60830 <term><emphasis role="bold">endpass</emphasis></term>
60831 <listitem>
60832 <para>
60833 <indexterm role="concept">
60834 <primary><option>endpass</option> ACL modifier</primary>
60835 </indexterm>
60836 This modifier, which has no argument, is recognized only in <option>accept</option> and
60837 <option>discard</option> statements. It marks the boundary between the conditions whose
60838 failure causes control to pass to the next statement, and the conditions whose
60839 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
60840 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
60841 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
60842 </para>
60843 </listitem></varlistentry>
60844 <varlistentry>
60845 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60846 <listitem>
60847 <para>
60848 <indexterm role="concept">
60849 <primary><option>log_message</option> ACL modifier</primary>
60850 </indexterm>
60851 This modifier sets up a message that is used as part of the log message if the
60852 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
60853 </para>
60854 <literallayout class="monospaced">
60855 require log_message = wrong cipher suite $tls_in_cipher
60856         encrypted   = DES-CBC3-SHA
60857 </literallayout>
60858 <para>
60859 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
60860 example:
60861 </para>
60862 <literallayout>
60863 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
60864 <literal>        log_message = Discarded $local_part@$domain because...</literal>
60865 </literallayout>
60866 <para>
60867 When access is denied, <option>log_message</option> adds to any underlying error message
60868 that may exist because of a condition failure. For example, while verifying a
60869 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
60870 message.
60871 </para>
60872 <para>
60873 The message may be defined before the conditions to which it applies, because
60874 the string expansion does not happen until Exim decides that access is to be
60875 denied. This means that any variables that are set by the condition are
60876 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
60877 variables are set after a DNS black list lookup succeeds. If the expansion of
60878 <option>log_message</option> fails, or if the result is an empty string, the modifier is
60879 ignored.
60880 </para>
60881 <para>
60882 <indexterm role="variable">
60883 <primary><varname>$acl_verify_message</varname></primary>
60884 </indexterm>
60885 If you want to use a <option>warn</option> statement to log the result of an address
60886 verification, you can use <varname>$acl_verify_message</varname> to include the verification
60887 error message.
60888 </para>
60889 <para>
60890 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
60891 the start of the logged message. If the same warning log message is requested
60892 more than once while receiving  a single email message, only one copy is
60893 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
60894 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
60895 is logged for a successful <option>warn</option> statement.
60896 </para>
60897 <para>
60898 If <option>log_message</option> is not present and there is no underlying error message (for
60899 example, from the failure of address verification), but <option>message</option> is present,
60900 the <option>message</option> text is used for logging rejections. However, if any text for
60901 logging contains newlines, only the first line is logged. In the absence of
60902 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
60903 logging rejections.
60904 </para>
60905 </listitem></varlistentry>
60906 <varlistentry>
60907 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
60908 <listitem>
60909 <para>
60910 <indexterm role="concept">
60911 <primary><option>log_reject_target</option> ACL modifier</primary>
60912 </indexterm>
60913 <indexterm role="concept">
60914 <primary>logging in ACL</primary>
60915 <secondary>specifying which log</secondary>
60916 </indexterm>
60917 This modifier makes it possible to specify which logs are used for messages
60918 about ACL rejections. Its argument is a colon-separated list of words that can
60919 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
60920 may be empty, in which case a rejection is not logged at all. For example, this
60921 ACL fragment writes no logging information when access is denied:
60922 </para>
60923 <literallayout>
60924 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
60925 <literal>     log_reject_target =</literal>
60926 </literallayout>
60927 <para>
60928 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
60929 permanent and temporary rejections. Its effect lasts for the rest of the
60930 current ACL.
60931 </para>
60932 </listitem></varlistentry>
60933 <varlistentry>
60934 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60935 <listitem>
60936 <para>
60937 <indexterm role="concept">
60938 <primary><option>logwrite</option> ACL modifier</primary>
60939 </indexterm>
60940 <indexterm role="concept">
60941 <primary>logging in ACL</primary>
60942 <secondary>immediate</secondary>
60943 </indexterm>
60944 This modifier writes a message to a log file as soon as it is encountered when
60945 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
60946 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
60947 access.) The <option>logwrite</option> modifier can be used to log special incidents in
60948 ACLs. For example:
60949 </para>
60950 <literallayout>
60951 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
60952 <literal>       control  = freeze</literal>
60953 <literal>       logwrite = froze message because ...</literal>
60954 </literallayout>
60955 <para>
60956 By default, the message is written to the main log. However, it may begin
60957 with a colon, followed by a comma-separated list of log names, and then
60958 another colon, to specify exactly which logs are to be written. For
60959 example:
60960 </para>
60961 <literallayout class="monospaced">
60962 logwrite = :main,reject: text for main and reject logs
60963 logwrite = :panic: text for panic log only
60964 </literallayout>
60965 </listitem></varlistentry>
60966 <varlistentry>
60967 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60968 <listitem>
60969 <para>
60970 <indexterm role="concept">
60971 <primary><option>message</option> ACL modifier</primary>
60972 </indexterm>
60973 This modifier sets up a text string that is expanded and used as a response
60974 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
60975 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
60976 there is some complication if <option>endpass</option> is involved; see the description of
60977 <option>accept</option> for details.)
60978 </para>
60979 <para>
60980 The expansion of the message happens at the time Exim decides that the ACL is
60981 to end, not at the time it processes <option>message</option>. If the expansion fails, or
60982 generates an empty string, the modifier is ignored. Here is an example where
60983 <option>message</option> must be specified first, because the ACL ends with a rejection if
60984 the <option>hosts</option> condition fails:
60985 </para>
60986 <literallayout class="monospaced">
60987 require  message = Host not recognized
60988          hosts = 10.0.0.0/8
60989 </literallayout>
60990 <para>
60991 (Once a condition has failed, no further conditions or modifiers are
60992 processed.)
60993 </para>
60994 <para>
60995 <indexterm role="concept">
60996 <primary>SMTP</primary>
60997 <secondary>error codes</secondary>
60998 </indexterm>
60999 <indexterm role="option">
61000 <primary><option>smtp_banner</option></primary>
61001 </indexterm>
61002 For ACLs that are triggered by SMTP commands, the message is returned as part
61003 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
61004 is meaningful only for SMTP, as no message is returned when a non-SMTP message
61005 is accepted. In the case of the connect ACL, accepting with a message modifier
61006 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
61007 accept message may not contain more than one line (otherwise it will be
61008 truncated at the first newline and a panic logged), and it cannot affect the
61009 EHLO options.
61010 </para>
61011 <para>
61012 When SMTP is involved, the message may begin with an overriding response code,
61013 consisting of three digits optionally followed by an <quote>extended response code</quote>
61014 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
61015 </para>
61016 <literallayout class="monospaced">
61017 deny  message = 599 1.2.3 Host not welcome
61018       hosts = 192.168.34.0/24
61019 </literallayout>
61020 <para>
61021 The first digit of the supplied response code must be the same as would be sent
61022 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
61023 access, but for the predata ACL, note that the default success code is 354, not
61024 2<emphasis>xx</emphasis>.
61025 </para>
61026 <para>
61027 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
61028 the message modifier cannot override the 221 response code.
61029 </para>
61030 <para>
61031 The text in a <option>message</option> modifier is literal; any quotes are taken as
61032 literals, but because the string is expanded, backslash escapes are processed
61033 anyway.
61034 If the message contains newlines, this gives rise to a multi-line SMTP
61035 response.
61036 A long message line will also be split into multi-line SMTP responses,
61037 on word boundaries if possible.
61038 </para>
61039 <para>
61040 <indexterm role="variable">
61041 <primary><varname>$acl_verify_message</varname></primary>
61042 </indexterm>
61043 While the text is being expanded, the <varname>$acl_verify_message</varname> variable
61044 contains any message previously set.
61045 Afterwards, <varname>$acl_verify_message</varname> is cleared.
61046 </para>
61047 <para>
61048 If <option>message</option> is used on a statement that verifies an address, the message
61049 specified overrides any message that is generated by the verification process.
61050 However, the original message is available in the variable
61051 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
61052 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
61053 routers to be passed back as part of the SMTP response, you should either not
61054 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
61055 </para>
61056 <para>
61057 For compatibility with previous releases of Exim, a <option>message</option> modifier that
61058 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
61059 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
61060 all the conditions are true, wherever it appears in an ACL command, whereas
61061 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
61062 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
61063 effect.
61064 </para>
61065 </listitem></varlistentry>
61066 <varlistentry>
61067 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61068 <listitem>
61069 <para>
61070 <indexterm role="concept">
61071 <primary><option>queue</option> ACL modifier</primary>
61072 </indexterm>
61073 <indexterm role="concept">
61074 <primary>named queues</primary>
61075 <secondary>selecting in ACL</secondary>
61076 </indexterm>
61077 This modifier specifies the use of a named queue for spool files
61078 for the message.
61079 It can only be used before the message is received (i.e. not in
61080 the DATA ACL).
61081 This could be used, for example, for known high-volume burst sources
61082 of traffic, or for quarantine of messages.
61083 Separate queue-runner processes will be needed for named queues.
61084 If the text after expansion is empty, the default queue is used.
61085 </para>
61086 </listitem></varlistentry>
61087 <varlistentry>
61088 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
61089 <listitem>
61090 <para>
61091 This modifier specifies one or more header names in a colon-separated list
61092  that are to be removed from an incoming message, assuming, of course, that
61093 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
61094 </para>
61095 </listitem></varlistentry>
61096 <varlistentry>
61097 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
61098 <listitem>
61099 <para>
61100 <indexterm role="concept">
61101 <primary><option>set</option> ACL modifier</primary>
61102 </indexterm>
61103 This modifier puts a value into one of the ACL variables (see section
61104 <xref linkend="SECTaclvariables"/>).
61105 </para>
61106 </listitem></varlistentry>
61107 <varlistentry>
61108 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
61109 <listitem>
61110 <para>
61111 <indexterm role="concept">
61112 <primary>UDP communications</primary>
61113 </indexterm>
61114 This modifier sends a UDP packet, for purposes such as statistics
61115 collection or behaviour monitoring. The parameters are expanded, and
61116 the result of the expansion must be a colon-separated list consisting
61117 of a destination server, port number, and the packet contents. The
61118 server can be specified as a host name or IPv4 or IPv6 address. The
61119 separator can be changed with the usual angle bracket syntax. For
61120 example, you might want to collect information on which hosts connect
61121 when:
61122 </para>
61123 <literallayout class="monospaced">
61124 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
61125              $tod_zulu $sender_host_address
61126 </literallayout>
61127 </listitem></varlistentry>
61128 </variablelist>
61129 </section>
61130 <section id="SECTcontrols">
61131 <title>Use of the control modifier</title>
61132 <para>
61133 <indexterm role="concept">
61134 <primary><option>control</option> ACL modifier</primary>
61135 </indexterm>
61136 The <option>control</option> modifier supports the following settings:
61137 </para>
61138 <variablelist>
61139 <varlistentry>
61140 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
61141 <listitem>
61142 <para>
61143 This modifier allows a client host to use the SMTP AUTH command even when it
61144 has not been advertised in response to EHLO. Furthermore, because there are
61145 apparently some really broken clients that do this, Exim will accept AUTH after
61146 HELO (rather than EHLO) when this control is set. It should be used only if you
61147 really need it, and you should limit its use to those broken clients that do
61148 not work without it. For example:
61149 </para>
61150 <literallayout class="monospaced">
61151 warn hosts   = 192.168.34.25
61152      control = allow_auth_unadvertised
61153 </literallayout>
61154 <para>
61155 Normally, when an Exim server receives an AUTH command, it checks the name of
61156 the authentication mechanism that is given in the command to ensure that it
61157 matches an advertised mechanism. When this control is set, the check that a
61158 mechanism has been advertised is bypassed. Any configured mechanism can be used
61159 by the client. This control is permitted only in the connection and HELO ACLs.
61160 </para>
61161 </listitem></varlistentry>
61162 <varlistentry>
61163 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
61164 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
61165 <listitem>
61166 <para>
61167 <indexterm role="concept">
61168 <primary>access control lists (ACLs)</primary>
61169 <secondary>case of local part in</secondary>
61170 </indexterm>
61171 <indexterm role="concept">
61172 <primary>case of local parts</primary>
61173 </indexterm>
61174 <indexterm role="variable">
61175 <primary><varname>$local_part</varname></primary>
61176 </indexterm>
61177 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
61178 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
61179 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
61180 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
61181 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
61182 is encountered.
61183 </para>
61184 <para>
61185 These controls affect only the current recipient. Moreover, they apply only to
61186 local part handling that takes place directly in the ACL (for example, as a key
61187 in lookups). If a test to verify the recipient is obeyed, the case-related
61188 handling of the local part during the verification is controlled by the router
61189 configuration (see the <option>caseful_local_part</option> generic router option).
61190 </para>
61191 <para>
61192 This facility could be used, for example, to add a spam score to local parts
61193 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
61194 spam score:
61195 </para>
61196 <literallayout class="monospaced">
61197 warn  control = caseful_local_part
61198       set acl_m4 = ${eval:\
61199                      $acl_m4 + \
61200                      ${if match{$local_part}{[A-Z]}{1}{0}}\
61201                     }
61202       control = caselower_local_part
61203 </literallayout>
61204 <para>
61205 Notice that we put back the lower cased version afterwards, assuming that
61206 is what is wanted for subsequent tests.
61207 </para>
61208 </listitem></varlistentry>
61209 <varlistentry>
61210 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
61211 <listitem>
61212 <para>
61213 <indexterm role="concept">
61214 <primary>access control lists (ACLs)</primary>
61215 <secondary>cutthrough routing</secondary>
61216 </indexterm>
61217 <indexterm role="concept">
61218 <primary>cutthrough</primary>
61219 <secondary>requesting</secondary>
61220 </indexterm>
61221 This option requests delivery be attempted while the item is being received.
61222 </para>
61223 <para>
61224 The option is usable in the RCPT ACL.
61225 If enabled for a message received via smtp and routed to an smtp transport,
61226 and only one transport, interface, destination host and port combination
61227 is used for all recipients of the message,
61228 then the delivery connection is made while the receiving connection is open
61229 and data is copied from one to the other.
61230 </para>
61231 <para>
61232 An attempt to set this option for any recipient but the first
61233 for a mail will be quietly ignored.
61234 If a recipient-verify callout
61235 (with use_sender)
61236 connection is subsequently
61237 requested in the same ACL it is held open and used for
61238 any subsequent recipients and the data,
61239 otherwise one is made after the initial RCPT ACL completes.
61240 </para>
61241 <para>
61242 Note that routers are used in verify mode,
61243 and cannot depend on content of received headers.
61244 Note also that headers cannot be
61245 modified by any of the post-data ACLs (DATA, MIME and DKIM).
61246 Headers may be modified by routers (subject to the above) and transports.
61247 The <emphasis>Received-By:</emphasis> header is generated as soon as the body reception starts,
61248 rather than the traditional time after the full message is received;
61249 this will affect the timestamp.
61250 </para>
61251 <para>
61252 All the usual ACLs are called; if one results in the message being
61253 rejected, all effort spent in delivery (including the costs on
61254 the ultimate destination) will be wasted.
61255 Note that in the case of data-time ACLs this includes the entire
61256 message body.
61257 </para>
61258 <para>
61259 Cutthrough delivery is not supported via transport-filters or when DKIM signing
61260 of outgoing messages is done, because it sends data to the ultimate destination
61261 before the entire message has been received from the source.
61262 It is not supported for messages received with the SMTP PRDR
61263 or CHUNKING
61264 options in use.
61265 </para>
61266 <para>
61267 Should the ultimate destination system positively accept or reject the mail,
61268 a corresponding indication is given to the source system and nothing is queued.
61269 If the item is successfully delivered in cutthrough mode
61270 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
61271 before the acceptance "&lt;=" line.
61272 </para>
61273 <para>
61274 If there is a temporary error the item is queued for later delivery in the
61275 usual fashion.
61276 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
61277 to the control; the default value is <quote>spool</quote> and the alternate value
61278 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
61279 and does not queue the message.
61280 Note that this is independent of any recipient verify conditions in the ACL.
61281 </para>
61282 <para>
61283 Delivery in this mode avoids the generation of a bounce mail to a
61284 (possibly faked)
61285 sender when the destination system is doing content-scan based rejection.
61286 </para>
61287 </listitem></varlistentry>
61288 <varlistentry>
61289 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
61290 <listitem>
61291 <para>
61292 <indexterm role="concept">
61293 <primary>access control lists (ACLs)</primary>
61294 <secondary>enabling debug logging</secondary>
61295 </indexterm>
61296 <indexterm role="concept">
61297 <primary>debugging</primary>
61298 <secondary>enabling from an ACL</secondary>
61299 </indexterm>
61300 This control turns on debug logging, almost as though Exim had been invoked
61301 with <literal>-d</literal>, with the output going to a new logfile in the usual logs directory,
61302 by default called <emphasis>debuglog</emphasis>.
61303 </para>
61304 <para>
61305 Logging set up by the control will be maintained across spool residency.
61306 </para>
61307 <para>
61308 Options are a slash-separated list.
61309 If an option takes an argument, the option name and argument are separated by
61310 an equals character.
61311 Several options are supported:
61312 </para>
61313 <literallayout>
61314 tag=&lt;<emphasis>suffix</emphasis>&gt;         The filename can be adjusted with thise option.
61315                      The argument, which may access any variables already defined,
61316                      is appended to the default name.
61317
61318 opts=&lt;<emphasis>debug&nbsp;options</emphasis>&gt; The argument specififes what is to be logged,
61319                      using the same values as the <literal>-d</literal> command-line option.
61320
61321 stop                 Logging started with this control may be
61322                      stopped by using this option.
61323
61324 kill                 Logging started with this control may be
61325                      stopped by using this option.
61326                      Additionally the debug file will be removed,
61327                      providing one means for speculative debug tracing.
61328
61329 pretrigger=&lt;<emphasis>size</emphasis>&gt;    This option specifies a memory buffuer to be used
61330                      for pre-trigger debug capture.
61331                      Debug lines are recorded in the buffer until
61332                      and if) a trigger occurs; at which time they are
61333                      dumped to the debug file.  Newer lines displace the
61334                      oldest if the buffer is full.  After a trigger,
61335                      immediate writes to file are done as normal.
61336
61337 trigger=&lt;<emphasis>reason</emphasis>&gt;     This option selects cause for the pretrigger buffer
61338                      see above) to be copied to file.  A reason of <emphasis role="bold">now</emphasis>
61339                      take effect immediately; one of <emphasis role="bold">paniclog</emphasis> triggers
61340                      on a write to the panic log.
61341 </literallayout>
61342 <para>
61343 Some examples (which depend on variables that don&#x2019;t exist in all
61344 contexts):
61345 </para>
61346 <literallayout class="monospaced">
61347       control = debug
61348       control = debug/tag=.$sender_host_address
61349       control = debug/opts=+expand+acl
61350       control = debug/tag=.$message_exim_id/opts=+expand
61351       control = debug/kill
61352       control = debug/opts=+all/pretrigger=1024/trigger=paniclog
61353       control = debug/trigger=now
61354 </literallayout>
61355 </listitem></varlistentry>
61356 <varlistentry>
61357 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
61358 <listitem>
61359 <para>
61360 <indexterm role="concept">
61361 <primary>disable DKIM verify</primary>
61362 </indexterm>
61363 <indexterm role="concept">
61364 <primary>DKIM</primary>
61365 <secondary>disable verify</secondary>
61366 </indexterm>
61367 This control turns off DKIM verification processing entirely.  For details on
61368 the operation and configuration of DKIM, see section <xref linkend="SECDKIM"/>.
61369 </para>
61370 </listitem></varlistentry>
61371 <varlistentry>
61372 <term><emphasis role="bold">control&nbsp;=&nbsp;dmarc_disable_verify</emphasis></term>
61373 <listitem>
61374 <para>
61375 <indexterm role="concept">
61376 <primary>disable DMARC verify</primary>
61377 </indexterm>
61378 <indexterm role="concept">
61379 <primary>DMARC</primary>
61380 <secondary>disable verify</secondary>
61381 </indexterm>
61382 This control turns off DMARC verification processing entirely.  For details on
61383 the operation and configuration of DMARC, see section <xref linkend="SECDMARC"/>.
61384 </para>
61385 </listitem></varlistentry>
61386 <varlistentry>
61387 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
61388 <listitem>
61389 <para>
61390 <indexterm role="concept">
61391 <primary>access control lists (ACLs)</primary>
61392 <secondary>setting DSCP value</secondary>
61393 </indexterm>
61394 <indexterm role="concept">
61395 <primary>DSCP</primary>
61396 <secondary>inbound</secondary>
61397 </indexterm>
61398 This option causes the DSCP value associated with the socket for the inbound
61399 connection to be adjusted to a given value, given as one of a number of fixed
61400 strings or to numeric value.
61401 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
61402 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
61403 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
61404 </para>
61405 <para>
61406 The outbound packets from Exim will be marked with this value in the header
61407 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
61408 that these values will have any effect, not be stripped by networking
61409 equipment, or do much of anything without cooperation with your Network
61410 Engineer and those of all network operators between the source and destination.
61411 </para>
61412 </listitem></varlistentry>
61413 <varlistentry>
61414 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
61415 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
61416 <listitem>
61417 <para>
61418 <indexterm role="concept">
61419 <primary>SMTP</primary>
61420 <secondary>synchronization checking</secondary>
61421 </indexterm>
61422 <indexterm role="concept">
61423 <primary>synchronization checking in SMTP</primary>
61424 </indexterm>
61425 These controls make it possible to be selective about when SMTP synchronization
61426 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
61427 state of the switch (it is true by default). See the description of this option
61428 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
61429 </para>
61430 <para>
61431 The effect of these two controls lasts for the remainder of the SMTP
61432 connection. They can appear in any ACL except the one for the non-SMTP
61433 messages. The most straightforward place to put them is in the ACL defined by
61434 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
61435 before the first synchronization check. The expected use is to turn off the
61436 synchronization checks for badly-behaved hosts that you nevertheless need to
61437 work with.
61438 </para>
61439 </listitem></varlistentry>
61440 <varlistentry>
61441 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
61442 <listitem>
61443 <para>
61444 <indexterm role="concept">
61445 <primary>fake defer</primary>
61446 </indexterm>
61447 <indexterm role="concept">
61448 <primary>defer, fake</primary>
61449 </indexterm>
61450 <indexterm role="concept">
61451 <primary>fakedefer</primary>
61452 </indexterm>
61453 This control works in exactly the same way as <option>fakereject</option> (described below)
61454 except that it causes an SMTP 450 response after the message data instead of a
61455 550 response. You must take care when using <option>fakedefer</option> because it causes the
61456 messages to be duplicated when the sender retries. Therefore, you should not
61457 use <option>fakedefer</option> if the message is to be delivered normally.
61458 </para>
61459 </listitem></varlistentry>
61460 <varlistentry>
61461 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
61462 <listitem>
61463 <para>
61464 <indexterm role="concept">
61465 <primary>fake rejection</primary>
61466 </indexterm>
61467 <indexterm role="concept">
61468 <primary>rejection, fake</primary>
61469 </indexterm>
61470 <indexterm role="concept">
61471 <primary>fakereject</primary>
61472 </indexterm>
61473 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
61474 words, only when an SMTP message is being received. If Exim accepts the
61475 message, instead the final 250 response, a 550 rejection message is sent.
61476 However, Exim proceeds to deliver the message as normal. The control applies
61477 only to the current message, not to any subsequent ones that may be received in
61478 the same SMTP connection.
61479 </para>
61480 <para>
61481 The text for the 550 response is taken from the <option>control</option> modifier. If no
61482 message is supplied, the following is used:
61483 </para>
61484 <literallayout class="monospaced">
61485 550-Your message has been rejected but is being
61486 550-kept for evaluation.
61487 550-If it was a legitimate message, it may still be
61488 550 delivered to the target recipient(s).
61489 </literallayout>
61490 <para>
61491 This facility should be used with extreme caution.
61492 </para>
61493 </listitem></varlistentry>
61494 <varlistentry>
61495 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
61496 <listitem>
61497 <para>
61498 <indexterm role="concept">
61499 <primary>frozen messages</primary>
61500 <secondary>forcing in ACL</secondary>
61501 </indexterm>
61502 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
61503 other words, only when a message is being received. If the message is accepted,
61504 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
61505 current message, not to any subsequent ones that may be received in the same
61506 SMTP connection.
61507 </para>
61508 <para>
61509 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
61510 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
61511 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
61512 are obeyed for the current message have the <literal>/no_tell</literal> option.
61513 </para>
61514 </listitem></varlistentry>
61515 <varlistentry>
61516 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
61517 <listitem>
61518 <para>
61519 <indexterm role="concept">
61520 <primary>SMTP</primary>
61521 <secondary>output flushing, disabling for delay</secondary>
61522 </indexterm>
61523 Exim normally flushes SMTP output before implementing a delay in an ACL, to
61524 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
61525 use. This control, as long as it is encountered before the <option>delay</option> modifier,
61526 disables such output flushing.
61527 </para>
61528 </listitem></varlistentry>
61529 <varlistentry>
61530 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
61531 <listitem>
61532 <para>
61533 <indexterm role="concept">
61534 <primary>SMTP</primary>
61535 <secondary>output flushing, disabling for callout</secondary>
61536 </indexterm>
61537 Exim normally flushes SMTP output before performing a callout in an ACL, to
61538 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
61539 use. This control, as long as it is encountered before the <option>verify</option> condition
61540 that causes the callout, disables such output flushing.
61541 </para>
61542 </listitem></varlistentry>
61543 <varlistentry>
61544 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
61545 <listitem>
61546 <para>
61547 This control is available when Exim is compiled with the content scanning
61548 extension. Content scanning may require a copy of the current message, or parts
61549 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
61550 or spam scanner. Normally, such copies are deleted when they are no longer
61551 needed. If this control is set, the copies are not deleted. The control applies
61552 only to the current message, not to any subsequent ones that may be received in
61553 the same SMTP connection. It is provided for debugging purposes and is unlikely
61554 to be useful in production.
61555 </para>
61556 </listitem></varlistentry>
61557 <varlistentry>
61558 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
61559 <listitem>
61560 <para>
61561 <indexterm role="concept">
61562 <primary>multiline responses, suppressing</primary>
61563 </indexterm>
61564 This control is permitted for any ACL except the one for non-SMTP messages.
61565 It seems that there are broken clients in use that cannot handle multiline
61566 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
61567 </para>
61568 <para>
61569 If this control is set, multiline SMTP responses from ACL rejections are
61570 suppressed. One way of doing this would have been to put out these responses as
61571 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
61572 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
61573 responses might get close to that. So this facility, which is after all only a
61574 sop to broken clients, is implemented by doing two very easy things:
61575 </para>
61576 <itemizedlist>
61577 <listitem>
61578 <para>
61579 Extra information that is normally output as part of a rejection caused by
61580 sender verification failure is omitted. Only the final line (typically <quote>sender
61581 verification failed</quote>) is sent.
61582 </para>
61583 </listitem>
61584 <listitem>
61585 <para>
61586 If a <option>message</option> modifier supplies a multiline response, only the first
61587 line is output.
61588 </para>
61589 </listitem>
61590 </itemizedlist>
61591 <para>
61592 The setting of the switch can, of course, be made conditional on the
61593 calling host. Its effect lasts until the end of the SMTP connection.
61594 </para>
61595 </listitem></varlistentry>
61596 <varlistentry>
61597 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
61598 <listitem>
61599 <para>
61600 <indexterm role="concept">
61601 <primary>PIPELINING</primary>
61602 <secondary>suppressing advertising</secondary>
61603 </indexterm>
61604 <indexterm role="concept">
61605 <primary>ESMTP extensions</primary>
61606 <secondary>PIPELINING</secondary>
61607 </indexterm>
61608 This control turns off the advertising of the PIPELINING extension to SMTP in
61609 the current session. To be useful, it must be obeyed before Exim sends its
61610 response to an EHLO command. Therefore, it should normally appear in an ACL
61611 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
61612 <option>pipelining_advertise_hosts</option>.
61613 </para>
61614 </listitem></varlistentry>
61615 <varlistentry>
61616 <term><emphasis role="bold">control&nbsp;=&nbsp;queue/</emphasis>&lt;<emphasis>options</emphasis>&gt;*</term>
61617 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
61618 <listitem>
61619 <para>
61620 <indexterm role="option">
61621 <primary><option>queue</option></primary>
61622 </indexterm>
61623 <indexterm role="option">
61624 <primary><option>queue_only</option></primary>
61625 </indexterm>
61626 <indexterm role="concept">
61627 <primary>queueing incoming messages</primary>
61628 </indexterm>
61629 <indexterm role="concept">
61630 <primary>queueing</primary>
61631 <secondary>forcing in ACL</secondary>
61632 </indexterm>
61633 <indexterm role="concept">
61634 <primary>first pass routing</primary>
61635 </indexterm>
61636 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
61637 other words, only when a message is being received. If the message is accepted,
61638 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
61639 runner.
61640 If used with no options set,
61641 no immediate delivery process is started. In other words, it has the
61642 effect as the <option>queue_only</option> global option or <emphasis>-odq</emphasis> command-line option.
61643 </para>
61644 <para>
61645 If the <emphasis>first_pass_route</emphasis> option is given then
61646 the behaviour is like the command-line <emphasis>-oqds</emphasis> option;
61647 a delivery process is started which stops short of making
61648 any SMTP delivery.  The benefit is that the hints database will be updated for
61649 the message being waiting for a specific host, and a later queue run will be
61650 able to send all such messages on a single connection.
61651 </para>
61652 <para>
61653 The control only applies to the current message, not to any subsequent ones that
61654  may be received in the same SMTP connection.
61655 </para>
61656 </listitem></varlistentry>
61657 <varlistentry>
61658 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
61659 <listitem>
61660 <para>
61661 <indexterm role="concept">
61662 <primary>message</primary>
61663 <secondary>submission</secondary>
61664 </indexterm>
61665 <indexterm role="concept">
61666 <primary>submission mode</primary>
61667 </indexterm>
61668 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
61669 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
61670 the current message is a submission from a local MUA. In this case, Exim
61671 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
61672 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
61673 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
61674 late (the message has already been created).
61675 </para>
61676 <para>
61677 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
61678 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
61679 submission mode; the available options for this control are described there.
61680 The control applies only to the current message, not to any subsequent ones
61681 that may be received in the same SMTP connection.
61682 </para>
61683 </listitem></varlistentry>
61684 <varlistentry>
61685 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
61686 <listitem>
61687 <para>
61688 <indexterm role="concept">
61689 <primary>submission fixups, suppressing</primary>
61690 </indexterm>
61691 This control applies to locally submitted (non TCP/IP) messages, and is the
61692 complement of <literal>control = submission</literal>. It disables the fixups that are
61693 normally applied to locally-submitted messages. Specifically:
61694 </para>
61695 <itemizedlist>
61696 <listitem>
61697 <para>
61698 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
61699 dynamic version of <option>local_sender_retain</option>).
61700 </para>
61701 </listitem>
61702 <listitem>
61703 <para>
61704 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
61705 </para>
61706 </listitem>
61707 <listitem>
61708 <para>
61709 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
61710 </para>
61711 </listitem>
61712 </itemizedlist>
61713 <para>
61714 This control may be useful when a remotely-originated message is accepted,
61715 passed to some scanning program, and then re-submitted for delivery. It can be
61716 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
61717 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
61718 data is read.
61719 </para>
61720 <para>
61721 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
61722 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
61723 </para>
61724 </listitem></varlistentry>
61725 <varlistentry>
61726 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
61727 <listitem>
61728 <para>
61729 This control enables conversion of UTF-8 in message envelope addresses
61730 to a-label form.
61731 For details see section <xref linkend="SECTi18nMTA"/>.
61732 </para>
61733 </listitem></varlistentry>
61734 </variablelist>
61735 </section>
61736 <section id="SECTsummesfix">
61737 <title>Summary of message fixup control</title>
61738 <para>
61739 All four possibilities for message fixups can be specified:
61740 </para>
61741 <itemizedlist>
61742 <listitem>
61743 <para>
61744 Locally submitted, fixups applied: the default.
61745 </para>
61746 </listitem>
61747 <listitem>
61748 <para>
61749 Locally submitted, no fixups applied: use
61750 <literal>control = suppress_local_fixups</literal>.
61751 </para>
61752 </listitem>
61753 <listitem>
61754 <para>
61755 Remotely submitted, no fixups applied: the default.
61756 </para>
61757 </listitem>
61758 <listitem>
61759 <para>
61760 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
61761 </para>
61762 </listitem>
61763 </itemizedlist>
61764 </section>
61765 <section id="SECTaddheadacl">
61766 <title>Adding header lines in ACLs</title>
61767 <para>
61768 <indexterm role="concept">
61769 <primary>header lines</primary>
61770 <secondary>adding in an ACL</secondary>
61771 </indexterm>
61772 <indexterm role="concept">
61773 <primary>header lines</primary>
61774 <secondary>position of added lines</secondary>
61775 </indexterm>
61776 <indexterm role="concept">
61777 <primary><option>add_header</option> ACL modifier</primary>
61778 </indexterm>
61779 The <option>add_header</option> modifier can be used to add one or more extra header lines
61780 to an incoming message, as in this example:
61781 </para>
61782 <literallayout class="monospaced">
61783 warn dnslists = sbl.spamhaus.org : \
61784                 dialup.mail-abuse.org
61785      add_header = X-blacklisted-at: $dnslist_domain
61786 </literallayout>
61787 <para>
61788 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
61789 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
61790 receiving a message). The message must ultimately be accepted for
61791 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
61792 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
61793 RCPT ACL).
61794 </para>
61795 <para>
61796 Headers will not be added to the message if the modifier is used in
61797 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
61798 </para>
61799 <para>
61800 Leading and trailing newlines are removed from
61801 the data for the <option>add_header</option> modifier; if it then
61802 contains one or more newlines that
61803 are not followed by a space or a tab, it is assumed to contain multiple header
61804 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
61805 front of any line that is not a valid header line.
61806 </para>
61807 <para>
61808 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
61809 They are added to the message before processing the DATA and MIME ACLs.
61810 However, if an identical header line is requested more than once, only one copy
61811 is actually added to the message. Further header lines may be accumulated
61812 during the DATA and MIME ACLs, after which they are added to the message, again
61813 with duplicates suppressed. Thus, it is possible to add two identical header
61814 lines to an SMTP message, but only if one is added before DATA and one after.
61815 In the case of non-SMTP messages, new headers are accumulated during the
61816 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
61817 message is rejected after DATA or by the non-SMTP ACL, all added header lines
61818 are included in the entry that is written to the reject log.
61819 </para>
61820 <para>
61821 <indexterm role="concept">
61822 <primary>header lines</primary>
61823 <secondary>added; visibility of</secondary>
61824 </indexterm>
61825 Header lines are not visible in string expansions
61826 of message headers
61827 until they are added to the
61828 message. It follows that header lines defined in the MAIL, RCPT, and predata
61829 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
61830 header lines that are added by the DATA or MIME ACLs are not visible in those
61831 ACLs. Because of this restriction, you cannot use header lines as a way of
61832 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
61833 this, you can use ACL variables, as described in section
61834 <xref linkend="SECTaclvariables"/>.
61835 </para>
61836 <para>
61837 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
61838 </para>
61839 <para>
61840 The <option>add_header</option> modifier acts immediately as it is encountered during the
61841 processing of an ACL. Notice the difference between these two cases:
61842 </para>
61843 <literallayout>
61844 <literal>accept add_header = ADDED: some text</literal>
61845 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
61846
61847 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
61848 <literal>       add_header = ADDED: some text</literal>
61849 </literallayout>
61850 <para>
61851 In the first case, the header line is always added, whether or not the
61852 condition is true. In the second case, the header line is added only if the
61853 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
61854 ACL statement. All those that are encountered before a condition fails are
61855 honoured.
61856 </para>
61857 <para>
61858 <indexterm role="concept">
61859 <primary><option>warn</option> ACL verb</primary>
61860 </indexterm>
61861 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
61862 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
61863 effect only if all the conditions are true, even if it appears before some of
61864 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
61865 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
61866 are present on a <option>warn</option> verb, both are processed according to their
61867 specifications.
61868 </para>
61869 <para>
61870 By default, new header lines are added to a message at the end of the existing
61871 header lines. However, you can specify that any particular header line should
61872 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
61873 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
61874 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
61875 </para>
61876 <para>
61877 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
61878 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
61879 header line, respectively. (Header text cannot start with a colon, as there has
61880 to be a header name first.) For example:
61881 </para>
61882 <literallayout class="monospaced">
61883 warn add_header = \
61884        :after_received:X-My-Header: something or other...
61885 </literallayout>
61886 <para>
61887 If more than one header line is supplied in a single <option>add_header</option> modifier,
61888 each one is treated independently and can therefore be placed differently. If
61889 you add more than one line at the start, or after the Received: block, they end
61890 up in reverse order.
61891 </para>
61892 <para>
61893 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
61894 added in an ACL. It does NOT work for header lines that are added in a
61895 system filter or in a router or transport.
61896 </para>
61897 </section>
61898 <section id="SECTremoveheadacl">
61899 <title>Removing header lines in ACLs</title>
61900 <para>
61901 <indexterm role="concept">
61902 <primary>header lines</primary>
61903 <secondary>removing in an ACL</secondary>
61904 </indexterm>
61905 <indexterm role="concept">
61906 <primary>header lines</primary>
61907 <secondary>position of removed lines</secondary>
61908 </indexterm>
61909 <indexterm role="concept">
61910 <primary><option>remove_header</option> ACL modifier</primary>
61911 </indexterm>
61912 The <option>remove_header</option> modifier can be used to remove one or more header lines
61913 from an incoming message, as in this example:
61914 </para>
61915 <literallayout class="monospaced">
61916 warn   message        = Remove internal headers
61917        remove_header  = x-route-mail1 : x-route-mail2
61918 </literallayout>
61919 <para>
61920 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
61921 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
61922 receiving a message). The message must ultimately be accepted for
61923 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
61924 with any ACL verb, including <option>deny</option>, though this is really not useful for
61925 any verb that doesn&#x2019;t result in a delivered message.
61926 </para>
61927 <para>
61928 Headers will not be removed from the message if the modifier is used in
61929 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
61930 </para>
61931 <para>
61932 More than one header can be removed at the same time by using a colon separated
61933 list of header specifiers.
61934 </para>
61935 <para revisionflag="changed">
61936 If a specifier does not start with a circumflex (^)
61937 then it is treated as a header name.
61938 The header name matching is case insensitive.
61939 If it does, then it is treated as a (front-anchored)
61940 regular expression applied to the whole header.
61941 </para>
61942 <para revisionflag="changed">
61943 <emphasis role="bold">Note</emphasis>: The colon terminating a header name will need to be doubled
61944 if used in an RE, and there can legitimately be whitepace before it.
61945 </para>
61946 <para revisionflag="changed">
61947 Example:
61948 </para>
61949 <literallayout class="monospaced" revisionflag="changed">
61950 remove_header = \N^(?i)Authentication-Results\s*::\s*example.org;\N
61951 </literallayout>
61952 <para>
61953 List expansion is not performed, so you cannot use hostlists to
61954 create a list of headers, however both connection and message variable expansion
61955 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
61956 </para>
61957 <literallayout class="monospaced">
61958 warn   hosts           = +internal_hosts
61959        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
61960 warn   message         = Remove internal headers
61961        remove_header   = $acl_c_ihdrs
61962 </literallayout>
61963 <para>
61964 Header specifiers for removal are accumulated during the MAIL, RCPT, and predata ACLs.
61965 Matching header lines are removed from the message before processing the DATA and MIME ACLs.
61966 If multiple header lines match, all are removed.
61967 There is no harm in attempting to remove the same header twice nor in removing
61968 a non-existent header. Further header specifiers for removal may be accumulated
61969 during the DATA and MIME ACLs, after which matching headers are removed
61970 if present. In the case of non-SMTP messages, remove specifiers are
61971 accumulated during the non-SMTP ACLs, and are acted on after
61972 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
61973 ACL, there really is no effect because there is no logging of what headers
61974 would have been removed.
61975 </para>
61976 <para>
61977 <indexterm role="concept">
61978 <primary>header lines</primary>
61979 <secondary>removed; visibility of</secondary>
61980 </indexterm>
61981 Header lines are not visible in string expansions until the DATA phase when it
61982 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
61983 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
61984 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
61985 this restriction, you cannot use header lines as a way of controlling data
61986 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
61987 you should instead use ACL variables, as described in section
61988 <xref linkend="SECTaclvariables"/>.
61989 </para>
61990 <para>
61991 The <option>remove_header</option> modifier acts immediately as it is encountered during the
61992 processing of an ACL. Notice the difference between these two cases:
61993 </para>
61994 <literallayout>
61995 <literal>accept remove_header = X-Internal</literal>
61996 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
61997
61998 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
61999 <literal>       remove_header = X-Internal</literal>
62000 </literallayout>
62001 <para>
62002 In the first case, the header line is always removed, whether or not the
62003 condition is true. In the second case, the header line is removed only if the
62004 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
62005 same ACL statement. All those that are encountered before a condition fails
62006 are honoured.
62007 </para>
62008 <para>
62009 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
62010 present during ACL processing. It does NOT remove header lines that are added
62011 in a system filter or in a router or transport.
62012 </para>
62013 </section>
62014 <section id="SECTaclconditions">
62015 <title>ACL conditions</title>
62016 <para>
62017 <indexterm role="concept">
62018 <primary>access control lists (ACLs)</primary>
62019 <secondary>conditions; list of</secondary>
62020 </indexterm>
62021 Some of the conditions listed in this section are available only when Exim is
62022 compiled with the content-scanning extension. They are included here briefly
62023 for completeness. More detailed descriptions can be found in the discussion on
62024 content scanning in chapter <xref linkend="CHAPexiscan"/>.
62025 </para>
62026 <para>
62027 Not all conditions are relevant in all circumstances. For example, testing
62028 senders and recipients does not make sense in an ACL that is being run as the
62029 result of the arrival of an ETRN command, and checks on message headers can be
62030 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
62031 can use the same condition (with different parameters) more than once in the
62032 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
62033 The conditions are as follows:
62034 </para>
62035 <variablelist>
62036 <varlistentry>
62037 <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>
62038 <listitem>
62039 <para>
62040 <indexterm role="concept">
62041 <primary>access control lists (ACLs)</primary>
62042 <secondary>nested</secondary>
62043 </indexterm>
62044 <indexterm role="concept">
62045 <primary>access control lists (ACLs)</primary>
62046 <secondary>indirect</secondary>
62047 </indexterm>
62048 <indexterm role="concept">
62049 <primary>access control lists (ACLs)</primary>
62050 <secondary>arguments</secondary>
62051 </indexterm>
62052 <indexterm role="concept">
62053 <primary><option>acl</option> ACL condition</primary>
62054 </indexterm>
62055 The possible values of the argument are the same as for the
62056 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
62057 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
62058 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
62059 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
62060 condition false. This means that further processing of the <option>warn</option> verb
62061 ceases, but processing of the ACL continues.
62062 </para>
62063 <para>
62064 If the argument is a named ACL, up to nine space-separated optional values
62065 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
62066 and $acl_narg is set to the count of values.
62067 Previous values of these variables are restored after the call returns.
62068 The name and values are expanded separately.
62069 Note that spaces in complex expansions which are used as arguments
62070 will act as argument separators.
62071 </para>
62072 <para>
62073 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
62074 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
62075 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
62076 conditions are tested.
62077 </para>
62078 <para>
62079 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
62080 loops. This condition allows you to use different ACLs in different
62081 circumstances. For example, different ACLs can be used to handle RCPT commands
62082 for different local users or different local domains.
62083 </para>
62084 </listitem></varlistentry>
62085 <varlistentry>
62086 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
62087 <listitem>
62088 <para>
62089 <indexterm role="concept">
62090 <primary><option>authenticated</option> ACL condition</primary>
62091 </indexterm>
62092 <indexterm role="concept">
62093 <primary>authentication</primary>
62094 <secondary>ACL checking</secondary>
62095 </indexterm>
62096 <indexterm role="concept">
62097 <primary>access control lists (ACLs)</primary>
62098 <secondary>testing for authentication</secondary>
62099 </indexterm>
62100 If the SMTP connection is not authenticated, the condition is false. Otherwise,
62101 the name of the authenticator is tested against the list. To test for
62102 authentication by any authenticator, you can set
62103 </para>
62104 <literallayout class="monospaced">
62105 authenticated = *
62106 </literallayout>
62107 </listitem></varlistentry>
62108 <varlistentry>
62109 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
62110 <listitem>
62111 <para>
62112 <indexterm role="concept">
62113 <primary><option>condition</option> ACL condition</primary>
62114 </indexterm>
62115 <indexterm role="concept">
62116 <primary>customizing</primary>
62117 <secondary>ACL condition</secondary>
62118 </indexterm>
62119 <indexterm role="concept">
62120 <primary>access control lists (ACLs)</primary>
62121 <secondary>customized test</secondary>
62122 </indexterm>
62123 <indexterm role="concept">
62124 <primary>access control lists (ACLs)</primary>
62125 <secondary>testing, customized</secondary>
62126 </indexterm>
62127 This feature allows you to make up custom conditions. If the result of
62128 expanding the string is an empty string, the number zero, or one of the strings
62129 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
62130 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
62131 any other value, some error is assumed to have occurred, and the ACL returns
62132 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
62133 ignored. The effect is to treat it as true, whether it is positive or
62134 negative.
62135 </para>
62136 </listitem></varlistentry>
62137 <varlistentry>
62138 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
62139 <listitem>
62140 <para>
62141 <indexterm role="concept">
62142 <primary><option>decode</option> ACL condition</primary>
62143 </indexterm>
62144 This condition is available only when Exim is compiled with the
62145 content-scanning extension, and it is allowed only in the ACL defined by
62146 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
62147 If all goes well, the condition is true. It is false only if there are
62148 problems such as a syntax error or a memory shortage. For more details, see
62149 chapter <xref linkend="CHAPexiscan"/>.
62150 </para>
62151 </listitem></varlistentry>
62152 <varlistentry>
62153 <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>
62154 <listitem>
62155 <para>
62156 <indexterm role="concept">
62157 <primary><option>dnslists</option> ACL condition</primary>
62158 </indexterm>
62159 <indexterm role="concept">
62160 <primary>DNS list</primary>
62161 <secondary>in ACL</secondary>
62162 </indexterm>
62163 <indexterm role="concept">
62164 <primary>black list (DNS)</primary>
62165 </indexterm>
62166 <indexterm role="concept">
62167 <primary>access control lists (ACLs)</primary>
62168 <secondary>testing a DNS list</secondary>
62169 </indexterm>
62170 This condition checks for entries in DNS black lists. These are also known as
62171 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
62172 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
62173 different variants of this condition to describe briefly here. See sections
62174 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
62175 </para>
62176 </listitem></varlistentry>
62177 <varlistentry>
62178 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
62179 <listitem>
62180 <para>
62181 <indexterm role="concept">
62182 <primary><option>domains</option> ACL condition</primary>
62183 </indexterm>
62184 <indexterm role="concept">
62185 <primary>domain</primary>
62186 <secondary>ACL checking</secondary>
62187 </indexterm>
62188 <indexterm role="concept">
62189 <primary>access control lists (ACLs)</primary>
62190 <secondary>testing a recipient domain</secondary>
62191 </indexterm>
62192 <indexterm role="variable">
62193 <primary><varname>$domain_data</varname></primary>
62194 </indexterm>
62195 This condition is relevant only in a RCPT ACL. It checks that the domain
62196 of the recipient address is in the domain list. If percent-hack processing is
62197 enabled, it is done before this test is done. If the check succeeds with a
62198 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
62199 <option>domains</option> test.
62200 </para>
62201 <para>
62202 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
62203 use <option>domains</option> in a DATA ACL.
62204 </para>
62205 </listitem></varlistentry>
62206 <varlistentry>
62207 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
62208 <listitem>
62209 <para>
62210 <indexterm role="concept">
62211 <primary><option>encrypted</option> ACL condition</primary>
62212 </indexterm>
62213 <indexterm role="concept">
62214 <primary>encryption</primary>
62215 <secondary>checking in an ACL</secondary>
62216 </indexterm>
62217 <indexterm role="concept">
62218 <primary>access control lists (ACLs)</primary>
62219 <secondary>testing for encryption</secondary>
62220 </indexterm>
62221 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
62222 name of the cipher suite in use is tested against the list. To test for
62223 encryption without testing for any specific cipher suite(s), set
62224 </para>
62225 <literallayout class="monospaced">
62226 encrypted = *
62227 </literallayout>
62228 </listitem></varlistentry>
62229 <varlistentry>
62230 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
62231 <listitem>
62232 <para>
62233 <indexterm role="concept">
62234 <primary><option>hosts</option> ACL condition</primary>
62235 </indexterm>
62236 <indexterm role="concept">
62237 <primary>host</primary>
62238 <secondary>ACL checking</secondary>
62239 </indexterm>
62240 <indexterm role="concept">
62241 <primary>access control lists (ACLs)</primary>
62242 <secondary>testing the client host</secondary>
62243 </indexterm>
62244 This condition tests that the calling host matches the host list. If you have
62245 name lookups or wildcarded host names and IP addresses in the same host list,
62246 you should normally put the IP addresses first. For example, you could have:
62247 </para>
62248 <literallayout class="monospaced">
62249 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
62250 </literallayout>
62251 <para>
62252 The lookup in this example uses the host name for its key. This is implied by
62253 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
62254 and it wouldn&#x2019;t matter which way round you had these two items.)
62255 </para>
62256 <para>
62257 The reason for the problem with host names lies in the left-to-right way that
62258 Exim processes lists. It can test IP addresses without doing any DNS lookups,
62259 but when it reaches an item that requires a host name, it fails if it cannot
62260 find a host name to compare with the pattern. If the above list is given in the
62261 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
62262 found, even if its IP address is 10.9.8.7.
62263 </para>
62264 <para>
62265 If you really do want to do the name check first, and still recognize the IP
62266 address even if the name lookup fails, you can rewrite the ACL like this:
62267 </para>
62268 <literallayout class="monospaced">
62269 accept hosts = dbm;/etc/friendly/hosts
62270 accept hosts = 10.9.8.7
62271 </literallayout>
62272 <para>
62273 The default action on failing to find the host name is to assume that the host
62274 is not in the list, so the first <option>accept</option> statement fails. The second
62275 statement can then check the IP address.
62276 </para>
62277 <para>
62278 <indexterm role="variable">
62279 <primary><varname>$host_data</varname></primary>
62280 </indexterm>
62281 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
62282 of the lookup is made available in the <varname>$host_data</varname> variable. This
62283 allows you, for example, to set up a statement like this:
62284 </para>
62285 <literallayout class="monospaced">
62286 deny  hosts = net-lsearch;/some/file
62287       message = $host_data
62288 </literallayout>
62289 <para>
62290 which gives a custom error message for each denied host.
62291 </para>
62292 </listitem></varlistentry>
62293 <varlistentry>
62294 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
62295 <listitem>
62296 <para>
62297 <indexterm role="concept">
62298 <primary><option>local_parts</option> ACL condition</primary>
62299 </indexterm>
62300 <indexterm role="concept">
62301 <primary>local part</primary>
62302 <secondary>ACL checking</secondary>
62303 </indexterm>
62304 <indexterm role="concept">
62305 <primary>access control lists (ACLs)</primary>
62306 <secondary>testing a local part</secondary>
62307 </indexterm>
62308 <indexterm role="variable">
62309 <primary><varname>$local_part_data</varname></primary>
62310 </indexterm>
62311 This condition is relevant only in a RCPT ACL. It checks that the local
62312 part of the recipient address is in the list. If percent-hack processing is
62313 enabled, it is done before this test. If the check succeeds with a lookup, the
62314 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
62315 the next <option>local_parts</option> test.
62316 </para>
62317 </listitem></varlistentry>
62318 <varlistentry>
62319 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
62320 <listitem>
62321 <para>
62322 <indexterm role="concept">
62323 <primary><option>malware</option> ACL condition</primary>
62324 </indexterm>
62325 <indexterm role="concept">
62326 <primary>access control lists (ACLs)</primary>
62327 <secondary>virus scanning</secondary>
62328 </indexterm>
62329 <indexterm role="concept">
62330 <primary>access control lists (ACLs)</primary>
62331 <secondary>scanning for viruses</secondary>
62332 </indexterm>
62333 This condition is available only when Exim is compiled with the
62334 content-scanning extension
62335 and only after a DATA command.
62336 It causes the incoming message to be scanned for
62337 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
62338 </para>
62339 </listitem></varlistentry>
62340 <varlistentry>
62341 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
62342 <listitem>
62343 <para>
62344 <indexterm role="concept">
62345 <primary><option>mime_regex</option> ACL condition</primary>
62346 </indexterm>
62347 <indexterm role="concept">
62348 <primary>access control lists (ACLs)</primary>
62349 <secondary>testing by regex matching</secondary>
62350 </indexterm>
62351 This condition is available only when Exim is compiled with the
62352 content-scanning extension, and it is allowed only in the ACL defined by
62353 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
62354 with any of the regular expressions. For details, see chapter
62355 <xref linkend="CHAPexiscan"/>.
62356 </para>
62357 </listitem></varlistentry>
62358 <varlistentry>
62359 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
62360 <listitem>
62361 <para>
62362 <indexterm role="concept">
62363 <primary>rate limiting</primary>
62364 </indexterm>
62365 This condition can be used to limit the rate at which a user or host submits
62366 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
62367 </para>
62368 </listitem></varlistentry>
62369 <varlistentry>
62370 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
62371 <listitem>
62372 <para>
62373 <indexterm role="concept">
62374 <primary><option>recipients</option> ACL condition</primary>
62375 </indexterm>
62376 <indexterm role="concept">
62377 <primary>recipient</primary>
62378 <secondary>ACL checking</secondary>
62379 </indexterm>
62380 <indexterm role="concept">
62381 <primary>access control lists (ACLs)</primary>
62382 <secondary>testing a recipient</secondary>
62383 </indexterm>
62384 This condition is relevant only in a RCPT ACL. It checks the entire
62385 recipient address against a list of recipients.
62386 </para>
62387 </listitem></varlistentry>
62388 <varlistentry>
62389 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
62390 <listitem>
62391 <para>
62392 <indexterm role="concept">
62393 <primary><option>regex</option> ACL condition</primary>
62394 </indexterm>
62395 <indexterm role="concept">
62396 <primary>access control lists (ACLs)</primary>
62397 <secondary>testing by regex matching</secondary>
62398 </indexterm>
62399 This condition is available only when Exim is compiled with the
62400 content-scanning extension, and is available only in the DATA, MIME, and
62401 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
62402 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
62403 </para>
62404 </listitem></varlistentry>
62405 <varlistentry>
62406 <term><emphasis role="bold">seen&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
62407 <listitem>
62408 <para>
62409 <indexterm role="concept">
62410 <primary><option>seen</option> ACL condition</primary>
62411 </indexterm>
62412 This condition can be used to test if a situation has been previously met,
62413 for example for greylisting.
62414 Details are given in section <xref linkend="SECTseen"/>.
62415 </para>
62416 </listitem></varlistentry>
62417 <varlistentry>
62418 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
62419 <listitem>
62420 <para>
62421 <indexterm role="concept">
62422 <primary><option>sender_domains</option> ACL condition</primary>
62423 </indexterm>
62424 <indexterm role="concept">
62425 <primary>sender</primary>
62426 <secondary>ACL checking</secondary>
62427 </indexterm>
62428 <indexterm role="concept">
62429 <primary>access control lists (ACLs)</primary>
62430 <secondary>testing a sender domain</secondary>
62431 </indexterm>
62432 <indexterm role="variable">
62433 <primary><varname>$domain</varname></primary>
62434 </indexterm>
62435 <indexterm role="variable">
62436 <primary><varname>$sender_address_domain</varname></primary>
62437 </indexterm>
62438 This condition tests the domain of the sender of the message against the given
62439 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
62440 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
62441 of this condition. This is an exception to the general rule for testing domain
62442 lists. It is done this way so that, if this condition is used in an ACL for a
62443 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
62444 influence the sender checking.
62445 </para>
62446 <para>
62447 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
62448 relaying, because sender addresses are easily, and commonly, forged.
62449 </para>
62450 </listitem></varlistentry>
62451 <varlistentry>
62452 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
62453 <listitem>
62454 <para>
62455 <indexterm role="concept">
62456 <primary><option>senders</option> ACL condition</primary>
62457 </indexterm>
62458 <indexterm role="concept">
62459 <primary>sender</primary>
62460 <secondary>ACL checking</secondary>
62461 </indexterm>
62462 <indexterm role="concept">
62463 <primary>access control lists (ACLs)</primary>
62464 <secondary>testing a sender</secondary>
62465 </indexterm>
62466 This condition tests the sender of the message against the given list. To test
62467 for a bounce message, which has an empty sender, set
62468 </para>
62469 <literallayout class="monospaced">
62470 senders = :
62471 </literallayout>
62472 <para>
62473 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
62474 relaying, because sender addresses are easily, and commonly, forged.
62475 </para>
62476 </listitem></varlistentry>
62477 <varlistentry>
62478 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
62479 <listitem>
62480 <para>
62481 <indexterm role="concept">
62482 <primary><option>spam</option> ACL condition</primary>
62483 </indexterm>
62484 <indexterm role="concept">
62485 <primary>access control lists (ACLs)</primary>
62486 <secondary>scanning for spam</secondary>
62487 </indexterm>
62488 This condition is available only when Exim is compiled with the
62489 content-scanning extension. It causes the incoming message to be scanned by
62490 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
62491 </para>
62492 </listitem></varlistentry>
62493 <varlistentry>
62494 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
62495 <listitem>
62496 <para>
62497 <indexterm role="concept">
62498 <primary><option>verify</option> ACL condition</primary>
62499 </indexterm>
62500 <indexterm role="concept">
62501 <primary>TLS</primary>
62502 <secondary>client certificate verification</secondary>
62503 </indexterm>
62504 <indexterm role="concept">
62505 <primary>certificate</primary>
62506 <secondary>verification of client</secondary>
62507 </indexterm>
62508 <indexterm role="concept">
62509 <primary>access control lists (ACLs)</primary>
62510 <secondary>certificate verification</secondary>
62511 </indexterm>
62512 <indexterm role="concept">
62513 <primary>access control lists (ACLs)</primary>
62514 <secondary>testing a TLS certificate</secondary>
62515 </indexterm>
62516 This condition is true in an SMTP session if the session is encrypted, and a
62517 certificate was received from the client, and the certificate was verified. The
62518 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
62519 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
62520 </para>
62521 </listitem></varlistentry>
62522 <varlistentry>
62523 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
62524 <listitem>
62525 <para>
62526 <indexterm role="concept">
62527 <primary>CSA verification</primary>
62528 </indexterm>
62529 This condition checks whether the sending host (the client) is authorized to
62530 send email. Details of how this works are given in section
62531 <xref linkend="SECTverifyCSA"/>.
62532 </para>
62533 </listitem></varlistentry>
62534 <varlistentry>
62535 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
62536 <listitem>
62537 <para>
62538 <indexterm role="concept">
62539 <primary><option>verify</option> ACL condition</primary>
62540 </indexterm>
62541 <indexterm role="concept">
62542 <primary>access control lists (ACLs)</primary>
62543 <secondary>verifying header names only ASCII</secondary>
62544 </indexterm>
62545 <indexterm role="concept">
62546 <primary>header lines</primary>
62547 <secondary>verifying header names only ASCII</secondary>
62548 </indexterm>
62549 <indexterm role="concept">
62550 <primary>verifying</primary>
62551 <secondary>header names only ASCII</secondary>
62552 </indexterm>
62553 This condition is relevant only in an ACL that is run after a message has been
62554 received.
62555 This usually means an ACL specified by <option>acl_smtp_data</option> or <option>acl_not_smtp</option>.
62556 It checks all header names (not the content) to make sure
62557 there are no non-ASCII characters, also excluding control characters.  The
62558 allowable characters are decimal ASCII values 33 through 126.
62559 </para>
62560 <para>
62561 Exim itself will handle headers with non-ASCII characters, but it can cause
62562 problems for downstream applications, so this option will allow their
62563 detection and rejection in the DATA ACL&#x2019;s.
62564 </para>
62565 </listitem></varlistentry>
62566 <varlistentry>
62567 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62568 <listitem>
62569 <para>
62570 <indexterm role="concept">
62571 <primary><option>verify</option> ACL condition</primary>
62572 </indexterm>
62573 <indexterm role="concept">
62574 <primary>access control lists (ACLs)</primary>
62575 <secondary>verifying sender in the header</secondary>
62576 </indexterm>
62577 <indexterm role="concept">
62578 <primary>header lines</primary>
62579 <secondary>verifying the sender in</secondary>
62580 </indexterm>
62581 <indexterm role="concept">
62582 <primary>sender</primary>
62583 <secondary>verifying in header</secondary>
62584 </indexterm>
62585 <indexterm role="concept">
62586 <primary>verifying</primary>
62587 <secondary>sender in header</secondary>
62588 </indexterm>
62589 This condition is relevant only in an ACL that is run after a message has been
62590 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
62591 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
62592 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
62593 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
62594 However, an address that appears in one of these headers need not be an address
62595 that accepts bounce messages; only sender addresses in envelopes are required
62596 to accept bounces. Therefore, if you use the callout option on this check, you
62597 might want to arrange for a non-empty address in the MAIL command.
62598 </para>
62599 <para>
62600 Details of address verification and the options are given later, starting at
62601 section <xref linkend="SECTaddressverification"/> (callouts are described in section
62602 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
62603 condition to restrict it to bounce messages only:
62604 </para>
62605 <literallayout class="monospaced">
62606 deny    senders = :
62607        !verify  = header_sender
62608         message = A valid sender header is required for bounces
62609 </literallayout>
62610 </listitem></varlistentry>
62611 <varlistentry>
62612 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
62613 <listitem>
62614 <para>
62615 <indexterm role="concept">
62616 <primary><option>verify</option> ACL condition</primary>
62617 </indexterm>
62618 <indexterm role="concept">
62619 <primary>access control lists (ACLs)</primary>
62620 <secondary>verifying header syntax</secondary>
62621 </indexterm>
62622 <indexterm role="concept">
62623 <primary>header lines</primary>
62624 <secondary>verifying syntax</secondary>
62625 </indexterm>
62626 <indexterm role="concept">
62627 <primary>verifying</primary>
62628 <secondary>header syntax</secondary>
62629 </indexterm>
62630 This condition is relevant only in an ACL that is run after a message has been
62631 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
62632 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
62633 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
62634 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
62635 Unqualified addresses (local parts without domains) are
62636 permitted only in locally generated messages and from hosts that match
62637 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
62638 appropriate.
62639 </para>
62640 <para>
62641 Note that this condition is a syntax check only. However, a common spamming
62642 ploy used to be to send syntactically invalid headers such as
62643 </para>
62644 <literallayout class="monospaced">
62645 To: @
62646 </literallayout>
62647 <para>
62648 and this condition can be used to reject such messages, though they are not as
62649 common as they used to be.
62650 </para>
62651 </listitem></varlistentry>
62652 <varlistentry>
62653 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
62654 <listitem>
62655 <para>
62656 <indexterm role="concept">
62657 <primary><option>verify</option> ACL condition</primary>
62658 </indexterm>
62659 <indexterm role="concept">
62660 <primary>access control lists (ACLs)</primary>
62661 <secondary>verifying HELO/EHLO</secondary>
62662 </indexterm>
62663 <indexterm role="concept">
62664 <primary>HELO</primary>
62665 <secondary>verifying</secondary>
62666 </indexterm>
62667 <indexterm role="concept">
62668 <primary>EHLO</primary>
62669 <secondary>verifying</secondary>
62670 </indexterm>
62671 <indexterm role="concept">
62672 <primary>verifying</primary>
62673 <secondary>EHLO</secondary>
62674 </indexterm>
62675 <indexterm role="concept">
62676 <primary>verifying</primary>
62677 <secondary>HELO</secondary>
62678 </indexterm>
62679 This condition is true if a HELO or EHLO command has been received from the
62680 client host, and its contents have been verified. If there has been no previous
62681 attempt to verify the HELO/EHLO contents, it is carried out when this
62682 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
62683 <option>helo_try_verify_hosts</option> options for details of how to request verification
62684 independently of this condition, and for detail of the verification.
62685 </para>
62686 <para>
62687 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
62688 option), this condition is always true.
62689 </para>
62690 </listitem></varlistentry>
62691 <varlistentry>
62692 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62693 <listitem>
62694 <para>
62695 <indexterm role="concept">
62696 <primary>verifying</primary>
62697 <secondary>not blind</secondary>
62698 </indexterm>
62699 <indexterm role="concept">
62700 <primary>bcc recipients, verifying none</primary>
62701 </indexterm>
62702 This condition checks that there are no blind (bcc) recipients in the message.
62703 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
62704 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
62705 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
62706 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
62707 used only in a DATA or non-SMTP ACL.
62708 </para>
62709 <para>
62710 There is one possible option, <literal>case_insensitive</literal>.  If this is present then
62711 local parts are checked case-insensitively.
62712 </para>
62713 <para>
62714 There are, of course, many legitimate messages that make use of blind (bcc)
62715 recipients. This check should not be used on its own for blocking messages.
62716 </para>
62717 </listitem></varlistentry>
62718 <varlistentry>
62719 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62720 <listitem>
62721 <para>
62722 <indexterm role="concept">
62723 <primary><option>verify</option> ACL condition</primary>
62724 </indexterm>
62725 <indexterm role="concept">
62726 <primary>access control lists (ACLs)</primary>
62727 <secondary>verifying recipient</secondary>
62728 </indexterm>
62729 <indexterm role="concept">
62730 <primary>recipient</primary>
62731 <secondary>verifying</secondary>
62732 </indexterm>
62733 <indexterm role="concept">
62734 <primary>verifying</primary>
62735 <secondary>recipient</secondary>
62736 </indexterm>
62737 <indexterm role="variable">
62738 <primary><varname>$address_data</varname></primary>
62739 </indexterm>
62740 This condition is relevant only after a RCPT command. It verifies the current
62741 recipient. Details of address verification are given later, starting at section
62742 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
62743 of <varname>$address_data</varname> is the last value that was set while routing the address.
62744 This applies even if the verification fails. When an address that is being
62745 verified is redirected to a single address, verification continues with the new
62746 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
62747 value for the child address.
62748 </para>
62749 </listitem></varlistentry>
62750 <varlistentry>
62751 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62752 <listitem>
62753 <para>
62754 <indexterm role="concept">
62755 <primary><option>verify</option> ACL condition</primary>
62756 </indexterm>
62757 <indexterm role="concept">
62758 <primary>access control lists (ACLs)</primary>
62759 <secondary>verifying host reverse lookup</secondary>
62760 </indexterm>
62761 <indexterm role="concept">
62762 <primary>host</primary>
62763 <secondary>verifying reverse lookup</secondary>
62764 </indexterm>
62765 This condition ensures that a verified host name has been looked up from the IP
62766 address of the client host. (This may have happened already if the host name
62767 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
62768 Verification ensures that the host name obtained from a reverse DNS lookup, or
62769 one of its aliases, does, when it is itself looked up in the DNS, yield the
62770 original IP address.
62771 </para>
62772 <para>
62773 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
62774 DNS operation returns a temporary error, the verify condition succeeds.
62775 </para>
62776 <para>
62777 If this condition is used for a locally generated message (that is, when there
62778 is no client host involved), it always succeeds.
62779 </para>
62780 </listitem></varlistentry>
62781 <varlistentry>
62782 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62783 <listitem>
62784 <para>
62785 <indexterm role="concept">
62786 <primary><option>verify</option> ACL condition</primary>
62787 </indexterm>
62788 <indexterm role="concept">
62789 <primary>access control lists (ACLs)</primary>
62790 <secondary>verifying sender</secondary>
62791 </indexterm>
62792 <indexterm role="concept">
62793 <primary>sender</primary>
62794 <secondary>verifying</secondary>
62795 </indexterm>
62796 <indexterm role="concept">
62797 <primary>verifying</primary>
62798 <secondary>sender</secondary>
62799 </indexterm>
62800 This condition is relevant only after a MAIL or RCPT command, or after a
62801 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
62802 the message&#x2019;s sender is empty (that is, this is a bounce message), the
62803 condition is true. Otherwise, the sender address is verified.
62804 </para>
62805 <para>
62806 <indexterm role="variable">
62807 <primary><varname>$address_data</varname></primary>
62808 </indexterm>
62809 <indexterm role="variable">
62810 <primary><varname>$sender_address_data</varname></primary>
62811 </indexterm>
62812 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
62813 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
62814 value can be used in subsequent conditions and modifiers in the same ACL
62815 statement. It does not persist after the end of the current statement. If you
62816 want to preserve the value for longer, you can save it in an ACL variable.
62817 </para>
62818 <para>
62819 Details of verification are given later, starting at section
62820 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
62821 to avoid doing it more than once per message.
62822 </para>
62823 </listitem></varlistentry>
62824 <varlistentry>
62825 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62826 <listitem>
62827 <para>
62828 <indexterm role="concept">
62829 <primary><option>verify</option> ACL condition</primary>
62830 </indexterm>
62831 This is a variation of the previous option, in which a modified address is
62832 verified as a sender.
62833 </para>
62834 <para>
62835 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
62836 (eg. is generated from the received message)
62837 they must be protected from the options parsing by doubling:
62838 </para>
62839 <literallayout class="monospaced">
62840 verify = sender=${listquote{/}{${address:$h_sender:}}}
62841 </literallayout>
62842 </listitem></varlistentry>
62843 </variablelist>
62844 </section>
62845 <section id="SECTmorednslists">
62846 <title>Using DNS lists</title>
62847 <para>
62848 <indexterm role="concept">
62849 <primary>DNS list</primary>
62850 <secondary>in ACL</secondary>
62851 </indexterm>
62852 <indexterm role="concept">
62853 <primary>black list (DNS)</primary>
62854 </indexterm>
62855 <indexterm role="concept">
62856 <primary>access control lists (ACLs)</primary>
62857 <secondary>testing a DNS list</secondary>
62858 </indexterm>
62859 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
62860 is on at least one of a number of DNS lists by looking up the inverted IP
62861 address in one or more DNS domains. (Note that DNS list domains are not mail
62862 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
62863 special options instead.) For example, if the calling host&#x2019;s IP
62864 address is 192.168.62.43, and the ACL statement is
62865 </para>
62866 <literallayout class="monospaced">
62867 deny dnslists = blackholes.mail-abuse.org : \
62868                 dialups.mail-abuse.org
62869 </literallayout>
62870 <para>
62871 the following records are looked up:
62872 </para>
62873 <literallayout class="monospaced">
62874 43.62.168.192.blackholes.mail-abuse.org
62875 43.62.168.192.dialups.mail-abuse.org
62876 </literallayout>
62877 <para>
62878 As soon as Exim finds an existing DNS record, processing of the list stops.
62879 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
62880 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
62881 use two separate conditions:
62882 </para>
62883 <literallayout class="monospaced">
62884 deny dnslists = blackholes.mail-abuse.org
62885      dnslists = dialups.mail-abuse.org
62886 </literallayout>
62887 <para>
62888 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
62889 behaves as if the host does not match the list item, that is, as if the DNS
62890 record does not exist. If there are further items in the DNS list, they are
62891 processed.
62892 </para>
62893 <para>
62894 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
62895 (which is the most common usage), because it prevents a DNS failure from
62896 blocking mail. However, you can change this behaviour by putting one of the
62897 following special items in the list:
62898 </para>
62899 <informaltable frame="none">
62900 <tgroup cols="2" colsep="0" rowsep="0">
62901 <colspec colwidth="25*" align="left"/>
62902 <colspec colwidth="75*" align="left"/>
62903 <tbody>
62904 <row>
62905 <entry>&nbsp;&nbsp;&nbsp;&nbsp;+include_unknown</entry>
62906 <entry>behave as if the item is on the list</entry>
62907 </row>
62908 <row>
62909 <entry>&nbsp;&nbsp;&nbsp;&nbsp;+exclude_unknown</entry>
62910 <entry>behave as if the item is not on the list (default)</entry>
62911 </row>
62912 <row>
62913 <entry>&nbsp;&nbsp;&nbsp;&nbsp;+defer_unknown  </entry>
62914 <entry>give a temporary error</entry>
62915 </row>
62916 </tbody>
62917 </tgroup>
62918 </informaltable>
62919 <para>
62920 <indexterm role="concept">
62921 <primary><literal>+include_unknown</literal></primary>
62922 </indexterm>
62923 <indexterm role="concept">
62924 <primary><literal>+exclude_unknown</literal></primary>
62925 </indexterm>
62926 <indexterm role="concept">
62927 <primary><literal>+defer_unknown</literal></primary>
62928 </indexterm>
62929 Each of these applies to any subsequent items on the list. For example:
62930 </para>
62931 <literallayout class="monospaced">
62932 deny dnslists = +defer_unknown : foo.bar.example
62933 </literallayout>
62934 <para>
62935 Testing the list of domains stops as soon as a match is found. If you want to
62936 warn for one list and block for another, you can use two different statements:
62937 </para>
62938 <literallayout class="monospaced">
62939 deny  dnslists = blackholes.mail-abuse.org
62940 warn  dnslists = dialups.mail-abuse.org
62941       message  = X-Warn: sending host is on dialups list
62942 </literallayout>
62943 <para>
62944 <indexterm role="concept">
62945 <primary>caching</primary>
62946 <secondary>of dns lookup</secondary>
62947 </indexterm>
62948 <indexterm role="concept">
62949 <primary>DNS</primary>
62950 <secondary>TTL</secondary>
62951 </indexterm>
62952 DNS list lookups are cached by Exim for the duration of the SMTP session
62953 (but limited by the DNS return TTL value),
62954 so a lookup based on the IP address is done at most once for any incoming
62955 connection (assuming long-enough TTL).
62956 Exim does not share information between multiple incoming
62957 connections (but your local name server cache should be active).
62958 </para>
62959 <para>
62960 There are a number of DNS lists to choose from, some commercial, some free,
62961 or free for small deployments.  An overview can be found at
62962 <emphasis role="bold"><ulink url="https://en.wikipedia.org/wiki/Comparison_of_DNS_blacklists">https://en.wikipedia.org/wiki/Comparison_of_DNS_blacklists</ulink></emphasis>.
62963 </para>
62964 <section id="SECID201">
62965 <title>Specifying the IP address for a DNS list lookup</title>
62966 <para>
62967 <indexterm role="concept">
62968 <primary>DNS list</primary>
62969 <secondary>keyed by explicit IP address</secondary>
62970 </indexterm>
62971 By default, the IP address that is used in a DNS list lookup is the IP address
62972 of the calling host. However, you can specify another IP address by listing it
62973 after the domain name, introduced by a slash. For example:
62974 </para>
62975 <literallayout class="monospaced">
62976 deny dnslists = black.list.tld/192.168.1.2
62977 </literallayout>
62978 <para>
62979 This feature is not very helpful with explicit IP addresses; it is intended for
62980 use with IP addresses that are looked up, for example, the IP addresses of the
62981 MX hosts or nameservers of an email sender address. For an example, see section
62982 <xref linkend="SECTmulkeyfor"/> below.
62983 </para>
62984 </section>
62985 <section id="SECID202">
62986 <title>DNS lists keyed on domain names</title>
62987 <para>
62988 <indexterm role="concept">
62989 <primary>DNS list</primary>
62990 <secondary>keyed by domain name</secondary>
62991 </indexterm>
62992 There are some lists that are keyed on domain names rather than inverted IP
62993 addresses (see, e.g., the <emphasis>domain based zones</emphasis> link at
62994 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
62995 with these lists. You can change the name that is looked up in a DNS list by
62996 listing it after the domain name, introduced by a slash. For example,
62997 </para>
62998 <literallayout class="monospaced">
62999 deny  dnslists = dsn.rfc-ignorant.org/$sender_address_domain
63000       message  = Sender's domain is listed at $dnslist_domain
63001 </literallayout>
63002 <para>
63003 This particular example is useful only in ACLs that are obeyed after the
63004 RCPT or DATA commands, when a sender address is available. If (for
63005 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
63006 up by this example is
63007 </para>
63008 <literallayout class="monospaced">
63009 tld.example.dsn.rfc-ignorant.org
63010 </literallayout>
63011 <para>
63012 A single <option>dnslists</option> condition can contain entries for both names and IP
63013 addresses. For example:
63014 </para>
63015 <literallayout class="monospaced">
63016 deny dnslists = sbl.spamhaus.org : \
63017                 dsn.rfc-ignorant.org/$sender_address_domain
63018 </literallayout>
63019 <para>
63020 The first item checks the sending host&#x2019;s IP address; the second checks a domain
63021 name. The whole condition is true if either of the DNS lookups succeeds.
63022 </para>
63023 </section>
63024 <section id="SECTmulkeyfor">
63025 <title>Multiple explicit keys for a DNS list</title>
63026 <para>
63027 <indexterm role="concept">
63028 <primary>DNS list</primary>
63029 <secondary>multiple keys for</secondary>
63030 </indexterm>
63031 The syntax described above for looking up explicitly-defined values (either
63032 names or IP addresses) in a DNS blacklist is a simplification. After the domain
63033 name for the DNS list, what follows the slash can in fact be a list of items.
63034 As with all lists in Exim, the default separator is a colon. However, because
63035 this is a sublist within the list of DNS blacklist domains, it is necessary
63036 either to double the separators like this:
63037 </para>
63038 <literallayout class="monospaced">
63039 dnslists = black.list.tld/name.1::name.2
63040 </literallayout>
63041 <para>
63042 or to change the separator character, like this:
63043 </para>
63044 <literallayout class="monospaced">
63045 dnslists = black.list.tld/&lt;;name.1;name.2
63046 </literallayout>
63047 <para>
63048 If an item in the list is an IP address, it is inverted before the DNS
63049 blacklist domain is appended. If it is not an IP address, no inversion
63050 occurs. Consider this condition:
63051 </para>
63052 <literallayout class="monospaced">
63053 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
63054 </literallayout>
63055 <para>
63056 The DNS lookups that occur are:
63057 </para>
63058 <literallayout class="monospaced">
63059 2.1.168.192.black.list.tld
63060 a.domain.black.list.tld
63061 </literallayout>
63062 <para>
63063 Once a DNS record has been found (that matches a specific IP return
63064 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
63065 are done. If there is a temporary DNS error, the rest of the sublist of domains
63066 or IP addresses is tried. A temporary error for the whole dnslists item occurs
63067 only if no other DNS lookup in this sublist succeeds. In other words, a
63068 successful lookup for any of the items in the sublist overrides a temporary
63069 error for a previous item.
63070 </para>
63071 <para>
63072 The ability to supply a list of items after the slash is in some sense just a
63073 syntactic convenience. These two examples have the same effect:
63074 </para>
63075 <literallayout class="monospaced">
63076 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
63077 dnslists = black.list.tld/a.domain::b.domain
63078 </literallayout>
63079 <para>
63080 However, when the data for the list is obtained from a lookup, the second form
63081 is usually much more convenient. Consider this example:
63082 </para>
63083 <literallayout class="monospaced">
63084 deny dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
63085                                    ${lookup dnsdb {&gt;|mxh=\
63086                                    $sender_address_domain} }} }
63087      message  = The mail servers for the domain \
63088                 $sender_address_domain \
63089                 are listed at $dnslist_domain ($dnslist_value); \
63090                 see $dnslist_text.
63091 </literallayout>
63092 <para>
63093 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
63094 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
63095 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
63096 of expanding the condition might be something like this:
63097 </para>
63098 <literallayout class="monospaced">
63099 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
63100 </literallayout>
63101 <para>
63102 Thus, this example checks whether or not the IP addresses of the sender
63103 domain&#x2019;s mail servers are on the Spamhaus black list.
63104 </para>
63105 <para>
63106 The key that was used for a successful DNS list lookup is put into the variable
63107 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
63108 </para>
63109 </section>
63110 <section id="SECID203">
63111 <title>Data returned by DNS lists</title>
63112 <para>
63113 <indexterm role="concept">
63114 <primary>DNS list</primary>
63115 <secondary>data returned from</secondary>
63116 </indexterm>
63117 DNS lists are constructed using address records in the DNS. The original RBL
63118 just used the address 127.0.0.1 on the right hand side of each record, but the
63119 RBL+ list and some other lists use a number of values with different meanings.
63120 The values used on the RBL+ list are:
63121 </para>
63122 <informaltable frame="none">
63123 <tgroup cols="2" colsep="0" rowsep="0">
63124 <colspec colwidth="20*" align="left"/>
63125 <colspec colwidth="80*" align="left"/>
63126 <tbody>
63127 <row>
63128 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.1</entry>
63129 <entry>RBL</entry>
63130 </row>
63131 <row>
63132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.2</entry>
63133 <entry>DUL</entry>
63134 </row>
63135 <row>
63136 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.3</entry>
63137 <entry>DUL and RBL</entry>
63138 </row>
63139 <row>
63140 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.4</entry>
63141 <entry>RSS</entry>
63142 </row>
63143 <row>
63144 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.5</entry>
63145 <entry>RSS and RBL</entry>
63146 </row>
63147 <row>
63148 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.6</entry>
63149 <entry>RSS and DUL</entry>
63150 </row>
63151 <row>
63152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.7</entry>
63153 <entry>RSS and DUL and RBL</entry>
63154 </row>
63155 </tbody>
63156 </tgroup>
63157 </informaltable>
63158 <para>
63159 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
63160 different values. Some DNS lists may return more than one address record;
63161 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
63162 </para>
63163 <para>
63164 Values returned by a properly running DBSBL should be in the 127.0.0.0/8
63165 range. If a DNSBL operator loses control of the domain, lookups on it
63166 may start returning other addresses.  Because of this, Exim now ignores
63167 returned values outside the 127/8 region.
63168 </para>
63169 </section>
63170 <section id="SECID204">
63171 <title>Variables set from DNS lists</title>
63172 <para>
63173 <indexterm role="concept">
63174 <primary>expansion</primary>
63175 <secondary>variables, set from DNS list</secondary>
63176 </indexterm>
63177 <indexterm role="concept">
63178 <primary>DNS list</primary>
63179 <secondary>variables set from</secondary>
63180 </indexterm>
63181 <indexterm role="variable">
63182 <primary><varname>$dnslist_domain</varname></primary>
63183 </indexterm>
63184 <indexterm role="variable">
63185 <primary><varname>$dnslist_matched</varname></primary>
63186 </indexterm>
63187 <indexterm role="variable">
63188 <primary><varname>$dnslist_text</varname></primary>
63189 </indexterm>
63190 <indexterm role="variable">
63191 <primary><varname>$dnslist_value</varname></primary>
63192 </indexterm>
63193 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
63194 the name of the overall domain that matched (for example,
63195 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
63196 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
63197 the DNS record. When the key is an IP address, it is not reversed in
63198 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
63199 cases, for example:
63200 </para>
63201 <literallayout class="monospaced">
63202 deny dnslists = spamhaus.example
63203 </literallayout>
63204 <para>
63205 the key is also available in another variable (in this case,
63206 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
63207 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
63208 might generate a dnslists lookup like this:
63209 </para>
63210 <literallayout class="monospaced">
63211 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
63212 </literallayout>
63213 <para>
63214 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
63215 <literal>192.168.6.7</literal> (for example).
63216 </para>
63217 <para>
63218 If more than one address record is returned by the DNS lookup, all the IP
63219 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
63220 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
63221 record. For lists such as RBL+ the TXT record for a merged entry is often not
63222 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
63223 information.
63224 </para>
63225 <para>
63226 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
63227 &ndash; even if these appear before the condition in the ACL, they are not
63228 expanded until after it has failed. For example:
63229 </para>
63230 <literallayout class="monospaced">
63231 deny    hosts = !+local_networks
63232         message = $sender_host_address is listed \
63233                   at $dnslist_domain
63234         dnslists = rbl-plus.mail-abuse.example
63235 </literallayout>
63236 </section>
63237 <section id="SECTaddmatcon">
63238 <title>Additional matching conditions for DNS lists</title>
63239 <para>
63240 <indexterm role="concept">
63241 <primary>DNS list</primary>
63242 <secondary>matching specific returned data</secondary>
63243 </indexterm>
63244 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
63245 in order to restrict its action to DNS records with a matching right hand side.
63246 For example,
63247 </para>
63248 <literallayout class="monospaced">
63249 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
63250 </literallayout>
63251 <para>
63252 rejects only those hosts that yield 127.0.0.2. Without this additional data,
63253 any address record is considered to be a match. For the moment, we assume
63254 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
63255 describes how multiple records are handled.
63256 </para>
63257 <para>
63258 More than one IP address may be given for checking, using a comma as a
63259 separator. These are alternatives &ndash; if any one of them matches, the
63260 <option>dnslists</option> condition is true. For example:
63261 </para>
63262 <literallayout class="monospaced">
63263 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
63264 </literallayout>
63265 <para>
63266 If you want to specify a constraining address list and also specify names or IP
63267 addresses to be looked up, the constraining address list must be specified
63268 first. For example:
63269 </para>
63270 <literallayout class="monospaced">
63271 deny dnslists = dsn.rfc-ignorant.org\
63272                 =127.0.0.2/$sender_address_domain
63273 </literallayout>
63274 <para>
63275 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
63276 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
63277 In other words, the listed addresses are used as bit masks. The comparison is
63278 true if all the bits in the mask are present in the address that is being
63279 tested. For example:
63280 </para>
63281 <literallayout class="monospaced">
63282 dnslists = a.b.c&amp;0.0.0.3
63283 </literallayout>
63284 <para>
63285 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
63286 want to test whether one bit or another bit is present (as opposed to both
63287 being present), you must use multiple values. For example:
63288 </para>
63289 <literallayout class="monospaced">
63290 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
63291 </literallayout>
63292 <para>
63293 matches if the final component of the address is an odd number or two times
63294 an odd number.
63295 </para>
63296 </section>
63297 <section id="SECID205">
63298 <title>Negated DNS matching conditions</title>
63299 <para>
63300 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
63301 condition. Whereas
63302 </para>
63303 <literallayout class="monospaced">
63304 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
63305 </literallayout>
63306 <para>
63307 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
63308 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
63309 </para>
63310 <literallayout class="monospaced">
63311 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
63312 </literallayout>
63313 <para>
63314 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
63315 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
63316 words, the result of the test is inverted if an exclamation mark appears before
63317 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
63318 </para>
63319 <para>
63320 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
63321 host, or address list (which is why the syntax is different).
63322 </para>
63323 <para>
63324 If you are using just one list, the negation syntax does not gain you much. The
63325 previous example is precisely equivalent to
63326 </para>
63327 <literallayout class="monospaced">
63328 deny  dnslists = a.b.c
63329      !dnslists = a.b.c=127.0.0.2,127.0.0.3
63330 </literallayout>
63331 <para>
63332 However, if you are using multiple lists, the negation syntax is clearer.
63333 Consider this example:
63334 </para>
63335 <literallayout class="monospaced">
63336 deny  dnslists = sbl.spamhaus.org : \
63337                  list.dsbl.org : \
63338                  dnsbl.njabl.org!=127.0.0.3 : \
63339                  relays.ordb.org
63340 </literallayout>
63341 <para>
63342 Using only positive lists, this would have to be:
63343 </para>
63344 <literallayout class="monospaced">
63345 deny  dnslists = sbl.spamhaus.org : \
63346                  list.dsbl.org
63347 deny  dnslists = dnsbl.njabl.org
63348      !dnslists = dnsbl.njabl.org=127.0.0.3
63349 deny  dnslists = relays.ordb.org
63350 </literallayout>
63351 <para>
63352 which is less clear, and harder to maintain.
63353 </para>
63354 <para>
63355 Negation can also be used with a bitwise-and restriction.
63356 The dnslists condition with only be trus if a result is returned
63357 by the lookup which, anded with the restriction, is all zeroes.
63358 For example:
63359 </para>
63360 <literallayout class="monospaced">
63361 deny dnslists = zen.spamhaus.org!&amp;0.255.255.0
63362 </literallayout>
63363 </section>
63364 <section id="SECThanmuldnsrec">
63365 <title>Handling multiple DNS records from a DNS list</title>
63366 <para>
63367 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
63368 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
63369 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
63370 the match to specific results from the DNS lookup, there are two ways in which
63371 the checking can be handled. For example, consider the condition:
63372 </para>
63373 <literallayout class="monospaced">
63374 dnslists = a.b.c=127.0.0.1
63375 </literallayout>
63376 <para>
63377 What happens if the DNS lookup for the incoming IP address yields both
63378 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
63379 condition true because at least one given value was found, or is it false
63380 because at least one of the found values was not listed? And how does this
63381 affect negated conditions? Both possibilities are provided for with the help of
63382 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
63383 </para>
63384 <itemizedlist>
63385 <listitem>
63386 <para>
63387 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
63388 IP addresses matches one of the listed addresses. For the example above, the
63389 condition is true because 127.0.0.1 matches.
63390 </para>
63391 </listitem>
63392 <listitem>
63393 <para>
63394 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
63395 looked up IP addresses matches one of the listed addresses. If the condition is
63396 changed to:
63397 </para>
63398 <literallayout class="monospaced">
63399 dnslists = a.b.c==127.0.0.1
63400 </literallayout>
63401 <para>
63402 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
63403 false because 127.0.0.2 is not listed. You would need to have:
63404 </para>
63405 <literallayout class="monospaced">
63406 dnslists = a.b.c==127.0.0.1,127.0.0.2
63407 </literallayout>
63408 <para>
63409 for the condition to be true.
63410 </para>
63411 </listitem>
63412 </itemizedlist>
63413 <para>
63414 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
63415 the precise opposite of the behaviour above. Thus:
63416 </para>
63417 <itemizedlist>
63418 <listitem>
63419 <para>
63420 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
63421 addresses matches one of the listed addresses. Consider:
63422 </para>
63423 <literallayout class="monospaced">
63424 dnslists = a.b.c!&amp;0.0.0.1
63425 </literallayout>
63426 <para>
63427 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
63428 false because 127.0.0.1 matches.
63429 </para>
63430 </listitem>
63431 <listitem>
63432 <para>
63433 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
63434 looked up IP address that does not match. Consider:
63435 </para>
63436 <literallayout class="monospaced">
63437 dnslists = a.b.c!=&amp;0.0.0.1
63438 </literallayout>
63439 <para>
63440 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
63441 true, because 127.0.0.2 does not match. You would need to have:
63442 </para>
63443 <literallayout class="monospaced">
63444 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
63445 </literallayout>
63446 <para>
63447 for the condition to be false.
63448 </para>
63449 </listitem>
63450 </itemizedlist>
63451 <para>
63452 When the DNS lookup yields only a single IP address, there is no difference
63453 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
63454 </para>
63455 </section>
63456 <section id="SECTmordetinf">
63457 <title>Detailed information from merged DNS lists</title>
63458 <para>
63459 <indexterm role="concept">
63460 <primary>DNS list</primary>
63461 <secondary>information from merged</secondary>
63462 </indexterm>
63463 When the facility for restricting the matching IP values in a DNS list is used,
63464 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
63465 the true reason for rejection. This happens when lists are merged and the IP
63466 address in the A record is used to distinguish them; unfortunately there is
63467 only one TXT record. One way round this is not to use merged lists, but that
63468 can be inefficient because it requires multiple DNS lookups where one would do
63469 in the vast majority of cases when the host of interest is not on any of the
63470 lists.
63471 </para>
63472 <para>
63473 A less inefficient way of solving this problem is available. If
63474 two domain names, comma-separated, are given, the second is used first to
63475 do an initial check, making use of any IP value restrictions that are set.
63476 If there is a match, the first domain is used, without any IP value
63477 restrictions, to get the TXT record. As a byproduct of this, there is also
63478 a check that the IP being tested is indeed on the first list. The first
63479 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
63480 </para>
63481 <literallayout class="monospaced">
63482 deny   dnslists = \
63483          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
63484          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
63485        message  = \
63486          rejected because $sender_host_address is blacklisted \
63487          at $dnslist_domain\n$dnslist_text
63488 </literallayout>
63489 <para>
63490 For the first blacklist item, this starts by doing a lookup in
63491 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
63492 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
63493 value, and as long as something is found, it looks for the corresponding TXT
63494 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
63495 The second blacklist item is processed similarly.
63496 </para>
63497 <para>
63498 If you are interested in more than one merged list, the same list must be
63499 given several times, but because the results of the DNS lookups are cached,
63500 the DNS calls themselves are not repeated. For example:
63501 </para>
63502 <literallayout class="monospaced">
63503 deny dnslists = \
63504          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
63505          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
63506          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
63507          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
63508 </literallayout>
63509 <para>
63510 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
63511 values matches (or if no record is found), this is the only lookup that is
63512 done. Only if there is a match is one of the more specific lists consulted.
63513 </para>
63514 </section>
63515 <section id="SECTmorednslistslast">
63516 <title>DNS lists and IPv6</title>
63517 <para>
63518 <indexterm role="concept">
63519 <primary>IPv6</primary>
63520 <secondary>DNS black lists</secondary>
63521 </indexterm>
63522 <indexterm role="concept">
63523 <primary>DNS list</primary>
63524 <secondary>IPv6 usage</secondary>
63525 </indexterm>
63526 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
63527 nibble by nibble. For example, if the calling host&#x2019;s IP address is
63528 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
63529 </para>
63530 <literallayout class="monospaced">
63531 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
63532   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
63533 </literallayout>
63534 <para>
63535 (split over two lines here to fit on the page). Unfortunately, some of the DNS
63536 lists contain wildcard records, intended for IPv4, that interact badly with
63537 IPv6. For example, the DNS entry
63538 </para>
63539 <literallayout class="monospaced">
63540 *.3.some.list.example.    A    127.0.0.1
63541 </literallayout>
63542 <para>
63543 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
63544 Unfortunately, it also matches the entire 3::/4 IPv6 network.
63545 </para>
63546 <para>
63547 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
63548 <option>condition</option> condition, as in this example:
63549 </para>
63550 <literallayout class="monospaced">
63551 deny   condition = ${if isip4{$sender_host_address}}
63552        dnslists  = some.list.example
63553 </literallayout>
63554 <para>
63555 If an explicit key is being used for a DNS lookup and it may be an IPv6
63556 address you should specify alternate list separators for both the outer
63557 (DNS list name) list and inner (lookup keys) list:
63558 </para>
63559 <literallayout class="monospaced">
63560        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
63561 </literallayout>
63562 </section>
63563 </section>
63564 <section id="SECTseen">
63565 <title>Previously seen user and hosts</title>
63566 <para>
63567 <indexterm role="concept">
63568 <primary><option>seen</option> ACL condition</primary>
63569 </indexterm>
63570 <indexterm role="concept">
63571 <primary>greylisting</primary>
63572 </indexterm>
63573 The <option>seen</option> ACL condition can be used to test whether a
63574 situation has been previously met.
63575 It uses a hints database to record a timestamp against a key.
63576 The syntax of the condition is:
63577 </para>
63578 <literallayout>
63579 <literal>seen =</literal> &lt;<emphasis>optional flag</emphasis>&gt;&lt;<emphasis>time interval</emphasis>&gt; <literal>/</literal> &lt;<emphasis>options</emphasis>&gt;
63580 </literallayout>
63581 <para>
63582 For example,
63583 </para>
63584 <literallayout class="monospaced">
63585 defer   seen = -5m / key=${sender_host_address}_$local_part@$domain
63586 </literallayout>
63587 <para>
63588 in a RCPT ACL will implement simple greylisting.
63589 </para>
63590 <para>
63591 The parameters for the condition are
63592 a possible minus sign,
63593 then an interval,
63594 then, slash-separated, a list of options.
63595 The interval is taken as an offset before the current time,
63596 and used for the test.
63597 If the interval is preceded by a minus sign then the condition returns
63598 whether a record is found which is before the test time.
63599 Otherwise, the condition returns whether one is found which is since the
63600 test time.
63601 </para>
63602 <para>
63603 Options are read in order with later ones overriding earlier ones.
63604 </para>
63605 <para>
63606 The default key is <varname>$sender_host_address</varname>.
63607 An explicit key can be set using a <option>key=value</option> option.
63608 </para>
63609 <para>
63610 If a <option>readonly</option> option is given then
63611 no record create or update is done.
63612 If a <option>write</option> option is given then
63613 a record create or update is always done.
63614 An update is done if the test is for <quote>since</quote>.
63615 If none of those hold and there was no existing record,
63616 a record is created.
63617 </para>
63618 <para>
63619 Creates and updates are marked with the current time.
63620 </para>
63621 <para>
63622 Finally, a <quote>before</quote> test which succeeds, and for which the record
63623 is old enough, will be refreshed with a timestamp of the test time.
63624 This can prevent tidying of the database from removing the entry.
63625 The interval for this is, by default, 10 days.
63626 An explicit interval can be set using a
63627 <option>refresh=value</option> option.
63628 </para>
63629 <para>
63630 Note that <quote>seen</quote> should be added to the list of hints databases
63631 for maintenance if this ACL condition is used.
63632 </para>
63633 </section>
63634 <section id="SECTratelimiting">
63635 <title>Rate limiting incoming messages</title>
63636 <para>
63637 <indexterm role="concept">
63638 <primary>rate limiting</primary>
63639 <secondary>client sending</secondary>
63640 </indexterm>
63641 <indexterm role="concept">
63642 <primary>limiting client sending rates</primary>
63643 </indexterm>
63644 <indexterm role="option">
63645 <primary><option>smtp_ratelimit_*</option></primary>
63646 </indexterm>
63647 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
63648 which clients can send email. This is more powerful than the
63649 <option>smtp_ratelimit_*</option> options, because those options control the rate of
63650 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
63651 works across all connections (concurrent and sequential) from the same client
63652 host. The syntax of the <option>ratelimit</option> condition is:
63653 </para>
63654 <literallayout>
63655 <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;
63656 </literallayout>
63657 <para>
63658 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
63659 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
63660 </para>
63661 <para>
63662 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
63663 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
63664 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
63665 of <emphasis>p</emphasis>.
63666 </para>
63667 <para>
63668 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
63669 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
63670 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
63671 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
63672 send in each time interval. It also specifies the number of messages permitted
63673 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
63674 constant, you can allow a client to send more messages in a burst without
63675 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
63676 both small, messages must be sent at an even rate.
63677 </para>
63678 <para>
63679 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
63680 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
63681 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
63682 instructions when it is run with no arguments.
63683 </para>
63684 <para>
63685 The key is used to look up the data for calculating the client&#x2019;s average
63686 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
63687 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
63688 which means Exim computes the sending rate of each client host IP address.
63689 By changing the key you can change how Exim identifies clients for the purpose
63690 of ratelimiting. For example, to limit the sending rate of each authenticated
63691 user, independent of the computer they are sending from, set the key to
63692 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
63693 example, <varname>$authenticated_id</varname> is only meaningful if the client has
63694 authenticated (which you can check with the <option>authenticated</option> ACL condition).
63695 </para>
63696 <para>
63697 The lookup key does not have to identify clients: If you want to limit the
63698 rate at which a recipient receives messages, you can use the key
63699 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
63700 ACL.
63701 </para>
63702 <para>
63703 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
63704 specifies what Exim measures the rate of, for example, messages or recipients
63705 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
63706 <option>count=</option> options. You can also control when Exim updates the recorded rate
63707 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
63708 separated by a slash, like the other parameters. They may appear in any order.
63709 </para>
63710 <para>
63711 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
63712 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
63713 stored, so you can alter the configured maximum rate and Exim will still
63714 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
63715 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
63716 behaviour. The lookup key is not affected by changes to the update mode and
63717 the <option>count=</option> option.
63718 </para>
63719 <section id="ratoptmea">
63720 <title>Ratelimit options for what is being measured</title>
63721 <para>
63722 <indexterm role="concept">
63723 <primary>rate limiting</primary>
63724 <secondary>per_* options</secondary>
63725 </indexterm>
63726 </para>
63727 <variablelist>
63728 <varlistentry>
63729 <term>per_conn</term>
63730 <listitem>
63731 <para>
63732 <indexterm role="concept">
63733 <primary>rate limiting</primary>
63734 <secondary>per_conn</secondary>
63735 </indexterm>
63736 This option limits the client&#x2019;s connection rate. It is not
63737 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
63738 <option>acl_not_smtp_start</option> ACLs.
63739 </para>
63740 </listitem></varlistentry>
63741 <varlistentry>
63742 <term>per_mail</term>
63743 <listitem>
63744 <para>
63745 <indexterm role="concept">
63746 <primary>rate limiting</primary>
63747 <secondary>per_conn</secondary>
63748 </indexterm>
63749 This option limits the client&#x2019;s rate of sending messages. This is
63750 the default if none of the <option>per_*</option> options is specified. It can be used in
63751 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
63752 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
63753 </para>
63754 </listitem></varlistentry>
63755 <varlistentry>
63756 <term>per_byte</term>
63757 <listitem>
63758 <para>
63759 <indexterm role="concept">
63760 <primary>rate limiting</primary>
63761 <secondary>per_conn</secondary>
63762 </indexterm>
63763 This option limits the sender&#x2019;s email bandwidth. It can be used in
63764 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
63765 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
63766 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
63767 in its MAIL command, which may be inaccurate or completely missing. You can
63768 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
63769 in kilobytes, megabytes, or gigabytes, respectively.
63770 </para>
63771 </listitem></varlistentry>
63772 <varlistentry>
63773 <term>per_rcpt</term>
63774 <listitem>
63775 <para>
63776 <indexterm role="concept">
63777 <primary>rate limiting</primary>
63778 <secondary>per_rcpt</secondary>
63779 </indexterm>
63780 This option causes Exim to limit the rate at which recipients are
63781 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
63782 <option>acl_smtp_mime</option>, or <option>acl_smtp_data</option> ACLs. In
63783 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
63784 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
63785 in either case the rate limiting engine will see a message with many
63786 recipients as a large high-speed burst.
63787 </para>
63788 </listitem></varlistentry>
63789 <varlistentry>
63790 <term>per_addr</term>
63791 <listitem>
63792 <para>
63793 <indexterm role="concept">
63794 <primary>rate limiting</primary>
63795 <secondary>per_addr</secondary>
63796 </indexterm>
63797 This option is like the <option>per_rcpt</option> option, except it counts the
63798 number of different recipients that the client has sent messages to in the
63799 last time period. That is, if the client repeatedly sends messages to the same
63800 recipient, its measured rate is not increased. This option can only be used in
63801 <option>acl_smtp_rcpt</option>.
63802 </para>
63803 </listitem></varlistentry>
63804 <varlistentry>
63805 <term>per_cmd</term>
63806 <listitem>
63807 <para>
63808 <indexterm role="concept">
63809 <primary>rate limiting</primary>
63810 <secondary>per_cmd</secondary>
63811 </indexterm>
63812 This option causes Exim to recompute the rate every time the
63813 condition is processed. This can be used to limit the rate of any SMTP
63814 command. If it is used in multiple ACLs it can limit the aggregate rate of
63815 multiple different commands.
63816 </para>
63817 </listitem></varlistentry>
63818 <varlistentry>
63819 <term>count</term>
63820 <listitem>
63821 <para>
63822 <indexterm role="concept">
63823 <primary>rate limiting</primary>
63824 <secondary>count</secondary>
63825 </indexterm>
63826 This option can be used to alter how much Exim adds to the client&#x2019;s
63827 measured rate.
63828 A value is required, after an equals sign.
63829 For example, the <option>per_byte</option> option is equivalent to
63830 <literal>per_mail/count=$message_size</literal>.
63831 If there is no <option>count=</option> option, Exim
63832 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
63833 other than <option>acl_smtp_rcpt</option>).
63834 The count does not have to be an integer.
63835 </para>
63836 </listitem></varlistentry>
63837 <varlistentry>
63838 <term>unique</term>
63839 <listitem>
63840 <para>
63841 <indexterm role="concept">
63842 <primary>rate limiting</primary>
63843 <secondary>unique</secondary>
63844 </indexterm>
63845 This option is described in section <xref linkend="ratoptuniq"/> below.
63846 </para>
63847 </listitem></varlistentry>
63848 </variablelist>
63849 </section>
63850 <section id="ratoptupd">
63851 <title>Ratelimit update modes</title>
63852 <para>
63853 <indexterm role="concept">
63854 <primary>rate limiting</primary>
63855 <secondary>reading data without updating</secondary>
63856 </indexterm>
63857 You can specify one of three options with the <option>ratelimit</option> condition to
63858 control when its database is updated. This section describes the <option>readonly</option>
63859 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
63860 </para>
63861 <para>
63862 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
63863 previously-computed rate to check against the limit.
63864 </para>
63865 <para>
63866 For example, you can test the client&#x2019;s sending rate and deny it access (when
63867 it is too fast) in the connect ACL. If the client passes this check then it
63868 can go on to send a message, in which case its recorded rate will be updated
63869 in the MAIL ACL. Subsequent connections from the same client will check this
63870 new rate.
63871 </para>
63872 <literallayout class="monospaced">
63873 acl_check_connect:
63874  deny ratelimit = 100 / 5m / readonly
63875       log_message = RATE CHECK: $sender_rate/$sender_rate_period \
63876                   (max $sender_rate_limit)
63877 # ...
63878 acl_check_mail:
63879  warn ratelimit = 100 / 5m / strict
63880       log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
63881                   (max $sender_rate_limit)
63882 </literallayout>
63883 <para>
63884 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
63885 processing a message then it may increase the client&#x2019;s measured rate more than
63886 it should. For example, this will happen if you check the <option>per_rcpt</option> option
63887 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
63888 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
63889 multiple update problems by using the <option>readonly</option> option on later ratelimit
63890 checks.
63891 </para>
63892 <para>
63893 The <option>per_*</option> options described above do not make sense in some ACLs. If you
63894 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
63895 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
63896 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
63897 next section) so you must specify the <option>readonly</option> option explicitly.
63898 </para>
63899 </section>
63900 <section id="ratoptfast">
63901 <title>Ratelimit options for handling fast clients</title>
63902 <para>
63903 <indexterm role="concept">
63904 <primary>rate limiting</primary>
63905 <secondary>strict and leaky modes</secondary>
63906 </indexterm>
63907 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
63908 engine can react in two possible ways, depending on the presence of the
63909 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
63910 counter-measures (such as rejecting the message) that may be specified by the
63911 rest of the ACL.
63912 </para>
63913 <para>
63914 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
63915 updated if it is above the limit. The effect of this is that Exim measures the
63916 client&#x2019;s average rate of successfully sent email,
63917 up to the given limit.
63918 This is appropriate if the countermeasure when the condition is true
63919 consists of refusing the message, and
63920 is generally the better choice if you have clients that retry automatically.
63921 If the action when true is anything more complex then this option is
63922 likely not what is wanted.
63923 </para>
63924 <para>
63925 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
63926 updated. The effect of this is that Exim measures the client&#x2019;s average rate
63927 of attempts to send email, which can be much higher than the maximum it is
63928 actually allowed. If the client is over the limit it may be subjected to
63929 counter-measures by the ACL. It must slow down and allow sufficient time to
63930 pass that its computed rate falls below the maximum before it can send email
63931 again. The time (the number of smoothing periods) it must wait and not
63932 attempt to send mail can be calculated with this formula:
63933 </para>
63934 <literallayout class="monospaced">
63935         ln(peakrate/maxrate)
63936 </literallayout>
63937 </section>
63938 <section id="ratoptuniq">
63939 <title>Limiting the rate of different events</title>
63940 <para>
63941 <indexterm role="concept">
63942 <primary>rate limiting</primary>
63943 <secondary>counting unique events</secondary>
63944 </indexterm>
63945 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
63946 rate of different events. For example, the <option>per_addr</option> option uses this
63947 mechanism to count the number of different recipients that the client has
63948 sent messages to in the last time period; it is equivalent to
63949 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
63950 measure the rate that a client uses different sender addresses with the
63951 options <literal>per_mail/unique=$sender_address</literal>.
63952 </para>
63953 <para>
63954 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
63955 has seen for that key. The whole set is thrown away when it is older than the
63956 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
63957 per period. In the <option>leaky</option> update mode, an event that causes the client to
63958 go over the limit is not added to the set, in the same way that the client&#x2019;s
63959 recorded rate is not updated in the same situation.
63960 </para>
63961 <para>
63962 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
63963 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
63964 rate.
63965 </para>
63966 <para>
63967 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
63968 other <option>ratelimit</option> options in order to store the event set. The number of
63969 unique values is potentially as large as the rate limit, so the extra space
63970 required increases with larger limits.
63971 </para>
63972 <para>
63973 The uniqueification is not perfect: there is a small probability that Exim
63974 will think a new event has happened before. If the sender&#x2019;s rate is less than
63975 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
63976 the measured rate can go above the limit, in which case Exim may under-count
63977 events by a significant margin. Fortunately, if the rate is high enough (2.7
63978 times the limit) that the false positive rate goes above 9%, then Exim will
63979 throw away the over-full event set before the measured rate falls below the
63980 limit. Therefore the only harm should be that exceptionally high sending rates
63981 are logged incorrectly; any countermeasures you configure will be as effective
63982 as intended.
63983 </para>
63984 </section>
63985 <section id="useratlim">
63986 <title>Using rate limiting</title>
63987 <para>
63988 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
63989 when the rate limit is exceeded. This might be anything from logging a warning
63990 (for example, while measuring existing sending rates in order to define
63991 policy), through time delays to slow down fast senders, up to rejecting the
63992 message. For example:
63993 </para>
63994 <literallayout class="monospaced">
63995 # Log all senders' rates
63996 warn ratelimit = 0 / 1h / strict
63997      log_message = Sender rate $sender_rate / $sender_rate_period
63998
63999 # Slow down fast senders; note the need to truncate $sender_rate
64000 # at the decimal point.
64001 warn ratelimit = 100 / 1h / per_rcpt / strict
64002      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
64003                    $sender_rate_limit }s
64004
64005 # Keep authenticated users under control
64006 deny authenticated = *
64007      ratelimit = 100 / 1d / strict / $authenticated_id
64008
64009 # System-wide rate limit
64010 defer ratelimit = 10 / 1s / $primary_hostname
64011       message = Sorry, too busy. Try again later.
64012
64013 # Restrict incoming rate from each host, with a default
64014 # set using a macro and special cases looked up in a table.
64015 defer ratelimit = ${lookup {$sender_host_address} \
64016                    cdb {DB/ratelimits.cdb} \
64017                    {$value} {RATELIMIT} }
64018       message = Sender rate exceeds $sender_rate_limit \
64019                messages per $sender_rate_period
64020 </literallayout>
64021 <para>
64022 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
64023 especially with the <option>per_rcpt</option> option, you may suffer from a performance
64024 bottleneck caused by locking on the ratelimit hints database. Apart from
64025 making your ACLs less complicated, you can reduce the problem by using a
64026 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
64027 this means that Exim will lose its hints data after a reboot (including retry
64028 hints, the callout cache, and ratelimit data).
64029 </para>
64030 </section>
64031 </section>
64032 <section id="SECTaddressverification">
64033 <title>Address verification</title>
64034 <para>
64035 <indexterm role="concept">
64036 <primary>verifying address</primary>
64037 <secondary>options for</secondary>
64038 </indexterm>
64039 <indexterm role="concept">
64040 <primary>policy control</primary>
64041 <secondary>address verification</secondary>
64042 </indexterm>
64043 Several of the <option>verify</option> conditions described in section
64044 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
64045 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
64046 The verification conditions can be followed by options that modify the
64047 verification process. The options are separated from the keyword and from each
64048 other by slashes, and some of them contain parameters. For example:
64049 </para>
64050 <literallayout class="monospaced">
64051 verify = sender/callout
64052 verify = recipient/defer_ok/callout=10s,defer_ok
64053 </literallayout>
64054 <para>
64055 The first stage of address verification, which always happens, is to run the
64056 address through the routers, in <quote>verify mode</quote>. Routers can detect the
64057 difference between verification and routing for delivery, and their actions can
64058 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
64059 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
64060 The available options are as follows:
64061 </para>
64062 <itemizedlist>
64063 <listitem>
64064 <para>
64065 If the <option>callout</option> option is specified, successful routing to one or more
64066 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
64067 check. Callouts and their sub-options are discussed in the next section.
64068 </para>
64069 </listitem>
64070 <listitem>
64071 <para>
64072 If there is a defer error while doing verification routing, the ACL
64073 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
64074 options, the condition is forced to be true instead. Note that this is a main
64075 verification option as well as a suboption for callouts.
64076 </para>
64077 </listitem>
64078 <listitem>
64079 <para>
64080 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
64081 discusses the reporting of sender address verification failures.
64082 </para>
64083 </listitem>
64084 <listitem>
64085 <para>
64086 The <option>success_on_redirect</option> option causes verification always to succeed
64087 immediately after a successful redirection. By default, if a redirection
64088 generates just one address, that address is also verified. See further
64089 discussion in section <xref linkend="SECTredirwhilveri"/>.
64090 </para>
64091 </listitem>
64092 <listitem>
64093 <para>
64094 If the <option>quota</option> option is specified for recipient verify,
64095 successful routing to an appendfile transport is followed by a call into
64096 the transport to evaluate the quota status for the recipient.
64097 No actual delivery is done, but verification will succeed if the quota
64098 is sufficient for the message (if the sender gave a message size) or
64099 not already exceeded (otherwise).
64100 </para>
64101 </listitem>
64102 </itemizedlist>
64103 <para>
64104 <indexterm role="concept">
64105 <primary>verifying address</primary>
64106 <secondary>differentiating failures</secondary>
64107 </indexterm>
64108 <indexterm role="variable">
64109 <primary><varname>$recipient_verify_failure</varname></primary>
64110 </indexterm>
64111 <indexterm role="variable">
64112 <primary><varname>$sender_verify_failure</varname></primary>
64113 </indexterm>
64114 <indexterm role="variable">
64115 <primary><varname>$acl_verify_message</varname></primary>
64116 </indexterm>
64117 After an address verification failure, <varname>$acl_verify_message</varname> contains the
64118 error message that is associated with the failure. It can be preserved by
64119 coding like this:
64120 </para>
64121 <literallayout class="monospaced">
64122 warn  !verify = sender
64123        set acl_m0 = $acl_verify_message
64124 </literallayout>
64125 <para>
64126 If you are writing your own custom rejection message or log message when
64127 denying access, you can use this variable to include information about the
64128 verification failure.
64129 This variable is cleared at the end of processing the ACL verb.
64130 </para>
64131 <para>
64132 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
64133 appropriate) contains one of the following words:
64134 </para>
64135 <itemizedlist>
64136 <listitem>
64137 <para>
64138 <option>qualify</option>: The address was unqualified (no domain), and the message
64139 was neither local nor came from an exempted host.
64140 </para>
64141 </listitem>
64142 <listitem>
64143 <para>
64144 <option>route</option>: Routing failed.
64145 </para>
64146 </listitem>
64147 <listitem>
64148 <para>
64149 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
64150 occurred at or before the MAIL command (that is, on initial
64151 connection, HELO, or MAIL).
64152 </para>
64153 </listitem>
64154 <listitem>
64155 <para>
64156 <option>recipient</option>: The RCPT command in a callout was rejected.
64157 </para>
64158 </listitem>
64159 <listitem>
64160 <para>
64161 <option>postmaster</option>: The postmaster check in a callout was rejected.
64162 </para>
64163 </listitem>
64164 <listitem>
64165 <para>
64166 <option>quota</option>: The quota check for a local recipient did non pass.
64167 </para>
64168 </listitem>
64169 </itemizedlist>
64170 <para>
64171 The main use of these variables is expected to be to distinguish between
64172 rejections of MAIL and rejections of RCPT in callouts.
64173 </para>
64174 <para>
64175 The above variables may also be set after a <emphasis role="bold">successful</emphasis>
64176 address verification to:
64177 </para>
64178 <itemizedlist>
64179 <listitem>
64180 <para>
64181 <option>random</option>: A random local-part callout succeeded
64182 </para>
64183 </listitem>
64184 </itemizedlist>
64185 </section>
64186 <section id="SECTcallver">
64187 <title>Callout verification</title>
64188 <para>
64189 <indexterm role="concept">
64190 <primary>verifying address</primary>
64191 <secondary>by callout</secondary>
64192 </indexterm>
64193 <indexterm role="concept">
64194 <primary>callout</primary>
64195 <secondary>verification</secondary>
64196 </indexterm>
64197 <indexterm role="concept">
64198 <primary>SMTP</primary>
64199 <secondary>callout verification</secondary>
64200 </indexterm>
64201 For non-local addresses, routing verifies the domain, but is unable to do any
64202 checking of the local part. There are situations where some means of verifying
64203 the local part is desirable. One way this can be done is to make an SMTP
64204 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
64205 a subsequent host for a recipient address, to see if the host accepts the
64206 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
64207 sender address, the callback is not to the client host that is trying to
64208 deliver the message, but to one of the hosts that accepts incoming mail for the
64209 sender&#x2019;s domain.
64210 </para>
64211 <para>
64212 Exim does not do callouts by default. If you want them to happen, you must
64213 request them by setting appropriate options on the <option>verify</option> condition, as
64214 described below. This facility should be used with care, because it can add a
64215 lot of resource usage to the cost of verifying an address. However, Exim does
64216 cache the results of callouts, which helps to reduce the cost. Details of
64217 caching are in section <xref linkend="SECTcallvercache"/>.
64218 </para>
64219 <para>
64220 Recipient callouts are usually used only between hosts that are controlled by
64221 the same administration. For example, a corporate gateway host could use
64222 callouts to check for valid recipients on an internal mailserver. A successful
64223 callout does not guarantee that a real delivery to the address would succeed;
64224 on the other hand, a failing callout does guarantee that a delivery would fail.
64225 </para>
64226 <para>
64227 If the <option>callout</option> option is present on a condition that verifies an address, a
64228 second stage of verification occurs if the address is successfully routed to
64229 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
64230 <command>manualroute</command> router, where the router specifies the hosts. However, if a
64231 router that does not set up hosts routes to an <command>smtp</command> transport with a
64232 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
64233 <option>hosts_override</option> set, its hosts are always used, whether or not the router
64234 supplies a host list.
64235 Callouts are only supported on <command>smtp</command> transports.
64236 </para>
64237 <para>
64238 The port that is used is taken from the transport, if it is specified and is a
64239 remote transport. (For routers that do verification only, no transport need be
64240 specified.) Otherwise, the default SMTP port is used. If a remote transport
64241 specifies an outgoing interface, this is used; otherwise the interface is not
64242 specified. Likewise, the text that is used for the HELO command is taken from
64243 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
64244 <varname>$smtp_active_hostname</varname> is used.
64245 </para>
64246 <para>
64247 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
64248 test whether a bounce message could be delivered to the sender address. The
64249 following SMTP commands are sent:
64250 </para>
64251 <literallayout>
64252 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
64253 <literal>MAIL FROM:&lt;&gt;</literal>
64254 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
64255 <literal>QUIT</literal>
64256 </literallayout>
64257 <para>
64258 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
64259 set to <quote>lmtp</quote>.
64260 </para>
64261 <para>
64262 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
64263 settings.
64264 </para>
64265 <para>
64266 A recipient callout check is similar. By default, it also uses an empty address
64267 for the sender. This default is chosen because most hosts do not make use of
64268 the sender address when verifying a recipient. Using the same address means
64269 that a single cache entry can be used for each recipient. Some sites, however,
64270 do make use of the sender address when verifying. These are catered for by the
64271 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
64272 </para>
64273 <para>
64274 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
64275 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
64276 Exim tries the next host, if any. If there is a problem with all the remote
64277 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
64278 <option>callout</option> option is given, in which case the condition is forced to succeed.
64279 </para>
64280 <para>
64281 <indexterm role="concept">
64282 <primary>SMTP</primary>
64283 <secondary>output flushing, disabling for callout</secondary>
64284 </indexterm>
64285 A callout may take a little time. For this reason, Exim normally flushes SMTP
64286 output before performing a callout in an ACL, to avoid unexpected timeouts in
64287 clients when the SMTP PIPELINING extension is in use. The flushing can be
64288 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
64289 </para>
64290 <para>
64291 <indexterm role="concept">
64292 <primary>tainted data</primary>
64293 <secondary>de-tainting</secondary>
64294 </indexterm>
64295 <indexterm role="concept">
64296 <primary>de-tainting</primary>
64297 <secondary>using recipient verify</secondary>
64298 </indexterm>
64299 A recipient callout which gets a 2<emphasis>xx</emphasis> code
64300 will assign untainted values to the
64301 <varname>$domain_data</varname> and <varname>$local_part_data</varname> variables,
64302 corresponding to the domain and local parts of the recipient address.
64303 </para>
64304 <section id="CALLaddparcall">
64305 <title>Additional parameters for callouts</title>
64306 <para>
64307 <indexterm role="concept">
64308 <primary>callout</primary>
64309 <secondary>additional parameters for</secondary>
64310 </indexterm>
64311 The <option>callout</option> option can be followed by an equals sign and a number of
64312 optional parameters, separated by commas. For example:
64313 </para>
64314 <literallayout class="monospaced">
64315 verify = recipient/callout=10s,defer_ok
64316 </literallayout>
64317 <para>
64318 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
64319 separate verify options, is retained for backwards compatibility, but is now
64320 deprecated. The additional parameters for <option>callout</option> are as follows:
64321 </para>
64322 <variablelist>
64323 <varlistentry>
64324 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
64325 <listitem>
64326 <para>
64327 <indexterm role="concept">
64328 <primary>callout</primary>
64329 <secondary>timeout, specifying</secondary>
64330 </indexterm>
64331 This specifies the timeout that applies for the callout attempt to each host.
64332 For example:
64333 </para>
64334 <literallayout class="monospaced">
64335 verify = sender/callout=5s
64336 </literallayout>
64337 <para>
64338 The default is 30 seconds. The timeout is used for each response from the
64339 remote host. It is also used for the initial connection, unless overridden by
64340 the <option>connect</option> parameter.
64341 </para>
64342 </listitem></varlistentry>
64343 <varlistentry>
64344 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
64345 <listitem>
64346 <para>
64347 <indexterm role="concept">
64348 <primary>callout</primary>
64349 <secondary>connection timeout, specifying</secondary>
64350 </indexterm>
64351 This parameter makes it possible to set a different (usually smaller) timeout
64352 for making the SMTP connection. For example:
64353 </para>
64354 <literallayout class="monospaced">
64355 verify = sender/callout=5s,connect=1s
64356 </literallayout>
64357 <para>
64358 If not specified, this timeout defaults to the general timeout value.
64359 </para>
64360 </listitem></varlistentry>
64361 <varlistentry>
64362 <term><emphasis role="bold">defer_ok</emphasis></term>
64363 <listitem>
64364 <para>
64365 <indexterm role="concept">
64366 <primary>callout</primary>
64367 <secondary>defer, action on</secondary>
64368 </indexterm>
64369 When this parameter is present, failure to contact any host, or any other kind
64370 of temporary error, is treated as success by the ACL. However, the cache is not
64371 updated in this circumstance.
64372 </para>
64373 </listitem></varlistentry>
64374 <varlistentry>
64375 <term><emphasis role="bold">fullpostmaster</emphasis></term>
64376 <listitem>
64377 <para>
64378 <indexterm role="concept">
64379 <primary>callout</primary>
64380 <secondary>full postmaster check</secondary>
64381 </indexterm>
64382 This operates like the <option>postmaster</option> option (see below), but if the check for
64383 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
64384 accordance with the specification in RFC 2821. The RFC states that the
64385 unqualified address <emphasis>postmaster</emphasis> should be accepted.
64386 </para>
64387 </listitem></varlistentry>
64388 <varlistentry>
64389 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
64390 <listitem>
64391 <para>
64392 <indexterm role="concept">
64393 <primary>callout</primary>
64394 <secondary>sender when verifying header</secondary>
64395 </indexterm>
64396 When verifying addresses in header lines using the <option>header_sender</option>
64397 verification option, Exim behaves by default as if the addresses are envelope
64398 sender addresses from a message. Callout verification therefore tests to see
64399 whether a bounce message could be delivered, by using an empty address in the
64400 MAIL command. However, it is arguable that these addresses might never be used
64401 as envelope senders, and could therefore justifiably reject bounce messages
64402 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
64403 address to use in the MAIL command. For example:
64404 </para>
64405 <literallayout class="monospaced">
64406 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
64407 </literallayout>
64408 <para>
64409 This parameter is available only for the <option>header_sender</option> verification option.
64410 </para>
64411 </listitem></varlistentry>
64412 <varlistentry>
64413 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
64414 <listitem>
64415 <para>
64416 <indexterm role="concept">
64417 <primary>callout</primary>
64418 <secondary>overall timeout, specifying</secondary>
64419 </indexterm>
64420 This parameter sets an overall timeout for performing a callout verification.
64421 For example:
64422 </para>
64423 <literallayout class="monospaced">
64424 verify = sender/callout=5s,maxwait=30s
64425 </literallayout>
64426 <para>
64427 This timeout defaults to four times the callout timeout for individual SMTP
64428 commands. The overall timeout applies when there is more than one host that can
64429 be tried. The timeout is checked before trying the next host. This prevents
64430 very long delays if there are a large number of hosts and all are timing out
64431 (for example, when network connections are timing out).
64432 </para>
64433 </listitem></varlistentry>
64434 <varlistentry>
64435 <term><emphasis role="bold">no_cache</emphasis></term>
64436 <listitem>
64437 <para>
64438 <indexterm role="concept">
64439 <primary>callout</primary>
64440 <secondary>cache, suppressing</secondary>
64441 </indexterm>
64442 <indexterm role="concept">
64443 <primary>caching callout, suppressing</primary>
64444 </indexterm>
64445 When this parameter is given, the callout cache is neither read nor updated.
64446 </para>
64447 </listitem></varlistentry>
64448 <varlistentry>
64449 <term><emphasis role="bold">postmaster</emphasis></term>
64450 <listitem>
64451 <para>
64452 <indexterm role="concept">
64453 <primary>callout</primary>
64454 <secondary>postmaster; checking</secondary>
64455 </indexterm>
64456 When this parameter is set, a successful callout check is followed by a similar
64457 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
64458 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
64459 the postmaster check is recorded in a cache record; if it is a failure, this is
64460 used to fail subsequent callouts for the domain without a connection being
64461 made, until the cache record expires.
64462 </para>
64463 </listitem></varlistentry>
64464 <varlistentry>
64465 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
64466 <listitem>
64467 <para>
64468 The postmaster check uses an empty sender in the MAIL command by default.
64469 You can use this parameter to do a postmaster check using a different address.
64470 For example:
64471 </para>
64472 <literallayout class="monospaced">
64473 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
64474 </literallayout>
64475 <para>
64476 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
64477 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
64478 </para>
64479 <literallayout class="monospaced">
64480 require  verify = sender/callout=postmaster_mailfrom=
64481 </literallayout>
64482 <para>
64483 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
64484 account of the sender address. It is assumed that either the empty address or
64485 a fixed non-empty address will be used. All that Exim remembers is that the
64486 postmaster check for the domain succeeded or failed.
64487 </para>
64488 </listitem></varlistentry>
64489 <varlistentry>
64490 <term><emphasis role="bold">random</emphasis></term>
64491 <listitem>
64492 <para>
64493 <indexterm role="concept">
64494 <primary>callout</primary>
64495 <secondary><quote>random</quote> check</secondary>
64496 </indexterm>
64497 When this parameter is set, before doing the normal callout check, Exim does a
64498 check for a <quote>random</quote> local part at the same domain. The local part is not
64499 really random &ndash; it is defined by the expansion of the option
64500 <option>callout_random_local_part</option>, which defaults to
64501 </para>
64502 <literallayout class="monospaced">
64503 $primary_hostname-$tod_epoch-testing
64504 </literallayout>
64505 <para>
64506 The idea here is to try to determine whether the remote host accepts all local
64507 parts without checking. If it does, there is no point in doing callouts for
64508 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
64509 a cache record, and used to force the current and subsequent callout checks to
64510 succeed without a connection being made, until the cache record expires.
64511 </para>
64512 </listitem></varlistentry>
64513 <varlistentry>
64514 <term><emphasis role="bold">use_postmaster</emphasis></term>
64515 <listitem>
64516 <para>
64517 <indexterm role="concept">
64518 <primary>callout</primary>
64519 <secondary>sender for recipient check</secondary>
64520 </indexterm>
64521 This parameter applies to recipient callouts only. For example:
64522 </para>
64523 <literallayout class="monospaced">
64524 deny  !verify = recipient/callout=use_postmaster
64525 </literallayout>
64526 <para>
64527 <indexterm role="variable">
64528 <primary><varname>$qualify_domain</varname></primary>
64529 </indexterm>
64530 It causes a non-empty postmaster address to be used in the MAIL command when
64531 performing the callout for the recipient, and also for a <quote>random</quote> check if
64532 that is configured. The local part of the address is <literal>postmaster</literal> and the
64533 domain is the contents of <varname>$qualify_domain</varname>.
64534 </para>
64535 </listitem></varlistentry>
64536 <varlistentry>
64537 <term><emphasis role="bold">use_sender</emphasis></term>
64538 <listitem>
64539 <para>
64540 This option applies to recipient callouts only. For example:
64541 </para>
64542 <literallayout class="monospaced">
64543 require  verify = recipient/callout=use_sender
64544 </literallayout>
64545 <para>
64546 It causes the message&#x2019;s actual sender address to be used in the MAIL
64547 command when performing the callout, instead of an empty address. There is no
64548 need to use this option unless you know that the called hosts make use of the
64549 sender when checking recipients. If used indiscriminately, it reduces the
64550 usefulness of callout caching.
64551 </para>
64552 </listitem></varlistentry>
64553 <varlistentry>
64554 <term><emphasis role="bold">hold</emphasis></term>
64555 <listitem>
64556 <para>
64557 This option applies to recipient callouts only. For example:
64558 </para>
64559 <literallayout class="monospaced">
64560 require  verify = recipient/callout=use_sender,hold
64561 </literallayout>
64562 <para>
64563 It causes the connection to be held open and used for any further recipients
64564 and for eventual delivery (should that be done quickly).
64565 Doing this saves on TCP and SMTP startup costs, and TLS costs also
64566 when that is used for the connections.
64567 The advantage is only gained if there are no callout cache hits
64568 (which could be enforced by the no_cache option),
64569 if the use_sender option is used,
64570 if neither the random nor the use_postmaster option is used,
64571 and if no other callouts intervene.
64572 </para>
64573 </listitem></varlistentry>
64574 </variablelist>
64575 <para>
64576 If you use any of the parameters that set a non-empty sender for the MAIL
64577 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
64578 <option>use_sender</option>), you should think about possible loops. Recipient checking is
64579 usually done between two hosts that are under the same management, and the host
64580 that receives the callouts is not normally configured to do callouts itself.
64581 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
64582 these circumstances.
64583 </para>
64584 <para>
64585 However, if you use a non-empty sender address for a callout to an arbitrary
64586 host, there is the likelihood that the remote host will itself initiate a
64587 callout check back to your host. As it is checking what appears to be a message
64588 sender, it is likely to use an empty address in MAIL, thus avoiding a
64589 callout loop. However, to be on the safe side it would be best to set up your
64590 own ACLs so that they do not do sender verification checks when the recipient
64591 is the address you use for header sender or postmaster callout checking.
64592 </para>
64593 <para>
64594 Another issue to think about when using non-empty senders for callouts is
64595 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
64596 by the sender/recipient combination; thus, for any given recipient, many more
64597 actual callouts are performed than when an empty sender or postmaster is used.
64598 </para>
64599 </section>
64600 <section id="SECTcallvercache">
64601 <title>Callout caching</title>
64602 <para>
64603 <indexterm role="concept">
64604 <primary>hints database</primary>
64605 <secondary>callout cache</secondary>
64606 </indexterm>
64607 <indexterm role="concept">
64608 <primary>callout</primary>
64609 <secondary>cache, description of</secondary>
64610 </indexterm>
64611 <indexterm role="concept">
64612 <primary>caching</primary>
64613 <secondary>callout</secondary>
64614 </indexterm>
64615 Exim caches the results of callouts in order to reduce the amount of resources
64616 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
64617 option. A hints database called <quote>callout</quote> is used for the cache. Two
64618 different record types are used: one records the result of a callout check for
64619 a specific address, and the other records information that applies to the
64620 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
64621 </para>
64622 <para>
64623 When an original callout fails, a detailed SMTP error message is given about
64624 the failure. However, for subsequent failures that use the cache data, this message
64625 is not available.
64626 </para>
64627 <para>
64628 The expiry times for negative and positive address cache records are
64629 independent, and can be set by the global options <option>callout_negative_expire</option>
64630 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
64631 </para>
64632 <para>
64633 If a host gives a negative response to an SMTP connection, or rejects any
64634 commands up to and including
64635 </para>
64636 <literallayout class="monospaced">
64637 MAIL FROM:&lt;&gt;
64638 </literallayout>
64639 <para>
64640 (but not including the MAIL command with a non-empty address),
64641 any callout attempt is bound to fail. Exim remembers such failures in a
64642 domain cache record, which it uses to fail callouts for the domain without
64643 making new connections, until the domain record times out. There are two
64644 separate expiry times for domain cache records:
64645 <option>callout_domain_negative_expire</option> (default 3h) and
64646 <option>callout_domain_positive_expire</option> (default 7d).
64647 </para>
64648 <para>
64649 Domain records expire when the negative expiry time is reached if callouts
64650 cannot be made for the domain, or if the postmaster check failed.
64651 Otherwise, they expire when the positive expiry time is reached. This
64652 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
64653 will eventually be noticed.
64654 </para>
64655 <para>
64656 The callout caching mechanism is based on the domain of the address that is
64657 being tested. If the domain routes to several hosts, it is assumed that their
64658 behaviour will be the same.
64659 </para>
64660 </section>
64661 </section>
64662 <section id="SECTquotacache">
64663 <title>Quota caching</title>
64664 <para>
64665 <indexterm role="concept">
64666 <primary>hints database</primary>
64667 <secondary>quota cache</secondary>
64668 </indexterm>
64669 <indexterm role="concept">
64670 <primary>quota</primary>
64671 <secondary>cache, description of</secondary>
64672 </indexterm>
64673 <indexterm role="concept">
64674 <primary>caching</primary>
64675 <secondary>quota</secondary>
64676 </indexterm>
64677 Exim caches the results of quota verification
64678 in order to reduce the amount of resources used.
64679 The <quote>callout</quote> hints database is used.
64680 </para>
64681 <para>
64682 The default cache periods are five minutes for a positive (good) result
64683 and one hour for a negative result.
64684 To change the periods the <option>quota</option> option can be followed by an equals sign
64685 and a number of optional paramemters, separated by commas.
64686 For example:
64687 </para>
64688 <literallayout class="monospaced">
64689 verify = recipient/quota=cachepos=1h,cacheneg=1d
64690 </literallayout>
64691 <para>
64692 Possible parameters are:
64693 </para>
64694 <variablelist>
64695 <varlistentry>
64696 <term><emphasis role="bold">cachepos&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
64697 <listitem>
64698 <para>
64699 <indexterm role="concept">
64700 <primary>quota cache</primary>
64701 <secondary>positive entry expiry, specifying</secondary>
64702 </indexterm>
64703 Set the lifetime for a positive cache entry.
64704 A value of zero seconds is legitimate.
64705 </para>
64706 </listitem></varlistentry>
64707 <varlistentry>
64708 <term><emphasis role="bold">cacheneg&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
64709 <listitem>
64710 <para>
64711 <indexterm role="concept">
64712 <primary>quota cache</primary>
64713 <secondary>negative entry expiry, specifying</secondary>
64714 </indexterm>
64715 As above, for a negative entry.
64716 </para>
64717 </listitem></varlistentry>
64718 <varlistentry>
64719 <term><emphasis role="bold">no_cache</emphasis></term>
64720 <listitem>
64721 <para>
64722 Set both positive and negative lifetimes to zero.
64723 </para>
64724 </listitem></varlistentry>
64725 </variablelist>
64726 </section>
64727 <section id="SECTsenaddver">
64728 <title>Sender address verification reporting</title>
64729 <para>
64730 <indexterm role="concept">
64731 <primary>verifying</primary>
64732 <secondary>suppressing error details</secondary>
64733 </indexterm>
64734 See section <xref linkend="SECTaddressverification"/> for a general discussion of
64735 verification. When sender verification fails in an ACL, the details of the
64736 failure are given as additional output lines before the 550 response to the
64737 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
64738 you might see:
64739 </para>
64740 <literallayout class="monospaced">
64741 MAIL FROM:&lt;xyz@abc.example&gt;
64742 250 OK
64743 RCPT TO:&lt;pqr@def.example&gt;
64744 550-Verification failed for &lt;xyz@abc.example&gt;
64745 550-Called:   192.168.34.43
64746 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
64747 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
64748 550 Sender verification failed
64749 </literallayout>
64750 <para>
64751 If more than one RCPT command fails in the same way, the details are given
64752 only for the first of them. However, some administrators do not want to send
64753 out this much information. You can suppress the details by adding
64754 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
64755 example:
64756 </para>
64757 <literallayout class="monospaced">
64758 verify = sender/no_details
64759 </literallayout>
64760 </section>
64761 <section id="SECTredirwhilveri">
64762 <title>Redirection while verifying</title>
64763 <para>
64764 <indexterm role="concept">
64765 <primary>verifying</primary>
64766 <secondary>redirection while</secondary>
64767 </indexterm>
64768 <indexterm role="concept">
64769 <primary>address redirection</primary>
64770 <secondary>while verifying</secondary>
64771 </indexterm>
64772 A dilemma arises when a local address is redirected by aliasing or forwarding
64773 during verification: should the generated addresses themselves be verified,
64774 or should the successful expansion of the original address be enough to verify
64775 it? By default, Exim takes the following pragmatic approach:
64776 </para>
64777 <itemizedlist>
64778 <listitem>
64779 <para>
64780 When an incoming address is redirected to just one child address, verification
64781 continues with the child address, and if that fails to verify, the original
64782 verification also fails.
64783 </para>
64784 </listitem>
64785 <listitem>
64786 <para>
64787 When an incoming address is redirected to more than one child address,
64788 verification does not continue. A success result is returned.
64789 </para>
64790 </listitem>
64791 </itemizedlist>
64792 <para>
64793 This seems the most reasonable behaviour for the common use of aliasing as a
64794 way of redirecting different local parts to the same mailbox. It means, for
64795 example, that a pair of alias entries of the form
64796 </para>
64797 <literallayout class="monospaced">
64798 A.Wol:   aw123
64799 aw123:   :fail: Gone away, no forwarding address
64800 </literallayout>
64801 <para>
64802 work as expected, with both local parts causing verification failure. When a
64803 redirection generates more than one address, the behaviour is more like a
64804 mailing list, where the existence of the alias itself is sufficient for
64805 verification to succeed.
64806 </para>
64807 <para>
64808 It is possible, however, to change the default behaviour so that all successful
64809 redirections count as successful verifications, however many new addresses are
64810 generated. This is specified by the <option>success_on_redirect</option> verification
64811 option. For example:
64812 </para>
64813 <literallayout class="monospaced">
64814 require verify = recipient/success_on_redirect/callout=10s
64815 </literallayout>
64816 <para>
64817 In this example, verification succeeds if a router generates a new address, and
64818 the callout does not occur, because no address was routed to a remote host.
64819 </para>
64820 <para>
64821 When verification is being tested via the <option>-bv</option> option, the treatment of
64822 redirections is as just described, unless the <option>-v</option> or any debugging option is
64823 also specified. In that case, full verification is done for every generated
64824 address and a report is output for each of them.
64825 </para>
64826 </section>
64827 <section id="SECTverifyCSA">
64828 <title>Client SMTP authorization (CSA)</title>
64829 <para>
64830 <indexterm role="concept">
64831 <primary>CSA</primary>
64832 <secondary>verifying</secondary>
64833 </indexterm>
64834 Client SMTP Authorization is a system that allows a site to advertise
64835 which machines are and are not permitted to send email. This is done by placing
64836 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
64837 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
64838 Authorization checks in Exim are performed by the ACL condition:
64839 </para>
64840 <literallayout class="monospaced">
64841 verify = csa
64842 </literallayout>
64843 <para>
64844 This fails if the client is not authorized. If there is a DNS problem, or if no
64845 valid CSA SRV record is found, or if the client is authorized, the condition
64846 succeeds. These three cases can be distinguished using the expansion variable
64847 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
64848 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
64849 be likely to cause problems for legitimate email.
64850 </para>
64851 <para>
64852 The error messages produced by the CSA code include slightly more
64853 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
64854 looking up the CSA SRV record, or problems looking up the CSA target
64855 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
64856 </para>
64857 <itemizedlist>
64858 <listitem>
64859 <para>
64860 The client&#x2019;s host name is explicitly not authorized.
64861 </para>
64862 </listitem>
64863 <listitem>
64864 <para>
64865 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
64866 </para>
64867 </listitem>
64868 <listitem>
64869 <para>
64870 The client&#x2019;s host name is authorized but it has no valid target IP addresses
64871 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
64872 </para>
64873 </listitem>
64874 <listitem>
64875 <para>
64876 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
64877 that all subdomains must be explicitly authorized.
64878 </para>
64879 </listitem>
64880 </itemizedlist>
64881 <para>
64882 The <option>csa</option> verification condition can take an argument which is the domain to
64883 use for the DNS query. The default is:
64884 </para>
64885 <literallayout class="monospaced">
64886 verify = csa/$sender_helo_name
64887 </literallayout>
64888 <para>
64889 This implementation includes an extension to CSA. If the query domain
64890 is an address literal such as [192.0.2.95], or if it is a bare IP
64891 address, Exim searches for CSA SRV records in the reverse DNS as if
64892 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
64893 meaningful to say:
64894 </para>
64895 <literallayout class="monospaced">
64896 verify = csa/$sender_host_address
64897 </literallayout>
64898 <para>
64899 In fact, this is the check that Exim performs if the client does not say HELO.
64900 This extension can be turned off by setting the main configuration option
64901 <option>dns_csa_use_reverse</option> to be false.
64902 </para>
64903 <para>
64904 If a CSA SRV record is not found for the domain itself, a search
64905 is performed through its parent domains for a record which might be
64906 making assertions about subdomains. The maximum depth of this search is limited
64907 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
64908 default. Exim does not look for CSA SRV records in a top level domain, so the
64909 default settings handle HELO domains as long as seven
64910 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
64911 of legitimate HELO domains.
64912 </para>
64913 <para>
64914 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
64915 direct SRV lookups, this is not sufficient because of the extra parent domain
64916 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
64917 addresses into lookups in the reverse DNS space. The result of a successful
64918 lookup such as:
64919 </para>
64920 <literallayout class="monospaced">
64921 ${lookup dnsdb {csa=$sender_helo_name}}
64922 </literallayout>
64923 <para>
64924 has two space-separated fields: an authorization code and a target host name.
64925 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
64926 authorization required but absent, or <quote>?</quote> for unknown.
64927 </para>
64928 </section>
64929 <section id="SECTverifyPRVS">
64930 <title>Bounce address tag validation</title>
64931 <para>
64932 <indexterm role="concept">
64933 <primary>BATV, verifying</primary>
64934 </indexterm>
64935 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
64936 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
64937 Genuine incoming bounce messages should therefore always be addressed to
64938 recipients that have a valid tag. This scheme is a way of detecting unwanted
64939 bounce messages caused by sender address forgeries (often called <quote>collateral
64940 spam</quote>), because the recipients of such messages do not include valid tags.
64941 </para>
64942 <para>
64943 There are two expansion items to help with the implementation of the BATV
64944 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
64945 the original envelope sender address by using a simple key to add a hash of the
64946 address and some time-based randomizing information. The <option>prvs</option> expansion
64947 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
64948 The syntax of these expansion items is described in section
64949 <xref linkend="SECTexpansionitems"/>.
64950 The validity period on signed addresses is seven days.
64951 </para>
64952 <para>
64953 As an example, suppose the secret per-address keys are stored in an MySQL
64954 database. A query to look up the key for an address could be defined as a macro
64955 like this:
64956 </para>
64957 <literallayout class="monospaced">
64958 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
64959                 WHERE sender='${quote_mysql:$prvscheck_address}'\
64960                 }{$value}}
64961 </literallayout>
64962 <para>
64963 Suppose also that the senders who make use of BATV are defined by an address
64964 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
64965 use this:
64966 </para>
64967 <literallayout class="monospaced">
64968 # Bounces: drop unsigned addresses for BATV senders
64969 deny senders = :
64970      recipients = +batv_senders
64971      message = This address does not send an unsigned reverse path
64972
64973 # Bounces: In case of prvs-signed address, check signature.
64974 deny senders = :
64975      condition  = ${prvscheck {$local_part@$domain}\
64976                   {PRVSCHECK_SQL}{1}}
64977      !condition = $prvscheck_result
64978      message = Invalid reverse path signature.
64979 </literallayout>
64980 <para>
64981 The first statement rejects recipients for bounce messages that are addressed
64982 to plain BATV sender addresses, because it is known that BATV senders do not
64983 send out messages with plain sender addresses. The second statement rejects
64984 recipients that are prvs-signed, but with invalid signatures (either because
64985 the key is wrong, or the signature has timed out).
64986 </para>
64987 <para>
64988 A non-prvs-signed address is not rejected by the second statement, because the
64989 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
64990 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
64991 the first argument is a syntactically valid prvs-signed address, the yield is
64992 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
64993 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
64994 of the checks (empty for failure, <quote>1</quote> for success).
64995 </para>
64996 <para>
64997 There is one more issue you must consider when implementing prvs-signing:
64998 you have to ensure that the routers accept prvs-signed addresses and
64999 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
65000 router to remove the signature with a configuration along these lines:
65001 </para>
65002 <literallayout class="monospaced">
65003 batv_redirect:
65004   driver = redirect
65005   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
65006 </literallayout>
65007 <para>
65008 This works because, if the third argument of <option>prvscheck</option> is empty, the result
65009 of the expansion of a prvs-signed address is the decoded value of the original
65010 address. This router should probably be the first of your routers that handles
65011 local addresses.
65012 </para>
65013 <para>
65014 To create BATV-signed addresses in the first place, a transport of this form
65015 can be used:
65016 </para>
65017 <literallayout class="monospaced">
65018 external_smtp_batv:
65019   driver = smtp
65020   return_path = ${prvs {$return_path} \
65021                        {${lookup mysql{SELECT \
65022                        secret FROM batv_prvs WHERE \
65023                        sender='${quote_mysql:$sender_address}'} \
65024                        {$value}fail}}}
65025 </literallayout>
65026 <para>
65027 If no key can be found for the existing return path, no signing takes place.
65028 </para>
65029 </section>
65030 <section id="SECTrelaycontrol">
65031 <title>Using an ACL to control relaying</title>
65032 <para>
65033 <indexterm role="concept">
65034 <primary>access control lists (ACLs)</primary>
65035 <secondary>relay control</secondary>
65036 </indexterm>
65037 <indexterm role="concept">
65038 <primary>relaying</primary>
65039 <secondary>control by ACL</secondary>
65040 </indexterm>
65041 <indexterm role="concept">
65042 <primary>policy control</primary>
65043 <secondary>relay control</secondary>
65044 </indexterm>
65045 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
65046 delivers it directly to another host as a result of a remote address contained
65047 within it. Redirecting a local address via an alias or forward file and then
65048 passing the message on to another host is not relaying,
65049 <indexterm role="concept">
65050 <primary><quote>percent hack</quote></primary>
65051 </indexterm>
65052 but a redirection as a result of the <quote>percent hack</quote> is.
65053 </para>
65054 <para>
65055 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
65056 A host which is acting as a gateway or an MX backup is concerned with incoming
65057 relaying from arbitrary hosts to a specific set of domains. On the other hand,
65058 a host which is acting as a smart host for a number of clients is concerned
65059 with outgoing relaying from those clients to the Internet at large. Often the
65060 same host is fulfilling both functions,
65061 but in principle these two kinds of relaying are entirely independent. What is
65062 not wanted is the transmission of mail from arbitrary remote hosts through your
65063 system to arbitrary domains.
65064 </para>
65065 <para>
65066 You can implement relay control by means of suitable statements in the ACL that
65067 runs for each RCPT command. For convenience, it is often easiest to use
65068 Exim&#x2019;s named list facility to define the domains and hosts involved. For
65069 example, suppose you want to do the following:
65070 </para>
65071 <itemizedlist>
65072 <listitem>
65073 <para>
65074 Deliver a number of domains to mailboxes on the local host (or process them
65075 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
65076 <emphasis>my.dom2.example</emphasis>.
65077 </para>
65078 </listitem>
65079 <listitem>
65080 <para>
65081 Relay mail for a number of other domains for which you are the secondary MX.
65082 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
65083 </para>
65084 </listitem>
65085 <listitem>
65086 <para>
65087 Relay mail from the hosts on your local LAN, to whatever domains are involved.
65088 Suppose your LAN is 192.168.45.0/24.
65089 </para>
65090 </listitem>
65091 </itemizedlist>
65092 <para>
65093 In the main part of the configuration, you put the following definitions:
65094 </para>
65095 <literallayout class="monospaced">
65096 domainlist local_domains    = my.dom1.example : my.dom2.example
65097 domainlist relay_to_domains = friend1.example : friend2.example
65098 hostlist   relay_from_hosts = 192.168.45.0/24
65099 </literallayout>
65100 <para>
65101 Now you can use these definitions in the ACL that is run for every RCPT
65102 command:
65103 </para>
65104 <literallayout class="monospaced">
65105 acl_check_rcpt:
65106   accept domains = +local_domains : +relay_to_domains
65107   accept hosts   = +relay_from_hosts
65108 </literallayout>
65109 <para>
65110 The first statement accepts any RCPT command that contains an address in
65111 the local or relay domains. For any other domain, control passes to the second
65112 statement, which accepts the command only if it comes from one of the relay
65113 hosts. In practice, you will probably want to make your ACL more sophisticated
65114 than this, for example, by including sender and recipient verification. The
65115 default configuration includes a more comprehensive example, which is described
65116 in chapter <xref linkend="CHAPdefconfil"/>.
65117 </para>
65118 </section>
65119 <section id="SECTcheralcon">
65120 <title>Checking a relay configuration</title>
65121 <para>
65122 <indexterm role="concept">
65123 <primary>relaying</primary>
65124 <secondary>checking control of</secondary>
65125 </indexterm>
65126 You can check the relay characteristics of your configuration in the same way
65127 that you can test any ACL behaviour for an incoming SMTP connection, by using
65128 the <option>-bh</option> option to run a fake SMTP session with which you interact.
65129 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
65130 </para>
65131 </section>
65132 </chapter>
65133
65134 <chapter id="CHAPexiscan">
65135 <title>Content scanning at ACL time</title>
65136 <para>
65137 <indexterm role="concept" id="IIDcosca" class="startofrange">
65138 <primary>content scanning</primary>
65139 <secondary>at ACL time</secondary>
65140 </indexterm>
65141 The extension of Exim to include content scanning at ACL time, formerly known
65142 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
65143 was integrated into the main source for Exim release 4.50, and Tom continues to
65144 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
65145 specification.
65146 </para>
65147 <para>
65148 It is also possible to scan the content of messages at other times. The
65149 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
65150 scanning after all the ACLs have run. A transport filter can be used to scan
65151 messages at delivery time (see the <option>transport_filter</option> option, described in
65152 chapter <xref linkend="CHAPtransportgeneric"/>).
65153 </para>
65154 <para>
65155 If you want to include the ACL-time content-scanning features when you compile
65156 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
65157 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
65158 </para>
65159 <itemizedlist>
65160 <listitem>
65161 <para>
65162 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
65163 for all MIME parts for SMTP and non-SMTP messages, respectively.
65164 </para>
65165 </listitem>
65166 <listitem>
65167 <para>
65168 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
65169 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
65170 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
65171 </para>
65172 </listitem>
65173 <listitem>
65174 <para>
65175 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
65176 of messages, or parts of messages, for debugging purposes.
65177 </para>
65178 </listitem>
65179 <listitem>
65180 <para>
65181 Additional expansion variables that are set in the new ACL and by the new
65182 conditions.
65183 </para>
65184 </listitem>
65185 <listitem>
65186 <para>
65187 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
65188 </para>
65189 </listitem>
65190 </itemizedlist>
65191 <para>
65192 Content-scanning is continually evolving, and new features are still being
65193 added. While such features are still unstable and liable to incompatible
65194 changes, they are made available in Exim by setting options whose names begin
65195 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
65196 this manual. You can find out about them by reading the file called
65197 <filename>doc/experimental.txt</filename>.
65198 </para>
65199 <para>
65200 All the content-scanning facilities work on a MBOX copy of the message that is
65201 temporarily created in a file called:
65202 </para>
65203 <literallayout>
65204 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
65205 </literallayout>
65206 <para>
65207 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
65208 expect an MBOX-like structure inside that file. The file is created when the
65209 first content scanning facility is called. Subsequent calls to content
65210 scanning conditions open the same file again. The directory is recursively
65211 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
65212 </para>
65213 <literallayout class="monospaced">
65214 control = no_mbox_unspool
65215 </literallayout>
65216 <para>
65217 has been encountered. When the MIME ACL decodes files, they are put into the
65218 same directory by default.
65219 </para>
65220 <section id="SECTscanvirus">
65221 <title>Scanning for viruses</title>
65222 <para>
65223 <indexterm role="concept">
65224 <primary>virus scanning</primary>
65225 </indexterm>
65226 <indexterm role="concept">
65227 <primary>content scanning</primary>
65228 <secondary>for viruses</secondary>
65229 </indexterm>
65230 <indexterm role="concept">
65231 <primary>content scanning</primary>
65232 <secondary>the <option>malware</option> condition</secondary>
65233 </indexterm>
65234 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
65235 It supports a <quote>generic</quote> interface to scanners called via the shell, and
65236 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
65237 in memory and thus are much faster.
65238 </para>
65239 <para>
65240 Since message data needs to have arrived,
65241 the condition may be only called in ACL defined by
65242 <option>acl_smtp_data</option>,
65243 <option>acl_smtp_data_prdr</option>,
65244 <option>acl_smtp_mime</option> or
65245 <option>acl_smtp_dkim</option>
65246 </para>
65247 <para>
65248 A timeout of 2 minutes is applied to a scanner call (by default);
65249 if it expires then a defer action is taken.
65250 </para>
65251 <para>
65252 <indexterm role="option">
65253 <primary><option>av_scanner</option></primary>
65254 </indexterm>
65255 You can set the <option>av_scanner</option> option in the main part of the configuration
65256 to specify which scanner to use, together with any additional options that
65257 are needed. The basic syntax is as follows:
65258 </para>
65259 <literallayout>
65260 <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>
65261 </literallayout>
65262 <para>
65263 If you do not set <option>av_scanner</option>, it defaults to
65264 </para>
65265 <literallayout class="monospaced">
65266 av_scanner = sophie:/var/run/sophie
65267 </literallayout>
65268 <para>
65269 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
65270 before use.
65271 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
65272 The following scanner types are supported in this release,
65273 though individual ones can be included or not at build time:
65274 </para>
65275 <variablelist>
65276 <varlistentry>
65277 <term><option>avast</option></term>
65278 <listitem>
65279 <para>
65280 <indexterm role="concept">
65281 <primary>virus scanners</primary>
65282 <secondary>avast</secondary>
65283 </indexterm>
65284 This is the scanner daemon of Avast. It has been tested with Avast Core
65285 Security (currently at version 2.2.0).
65286 You can get a trial version at <emphasis role="bold"><ulink url="https://www.avast.com">https://www.avast.com</ulink></emphasis> or for Linux
65287 at <emphasis role="bold"><ulink url="https://www.avast.com/linux-server-antivirus">https://www.avast.com/linux-server-antivirus</ulink></emphasis>.
65288 This scanner type takes one option,
65289 which can be either a full path to a UNIX socket,
65290 or host and port specifiers separated by white space.
65291 The host may be a name or an IP address; the port is either a
65292 single number or a pair of numbers with a dash between.
65293 A list of options may follow. These options are interpreted on the
65294 Exim&#x2019;s side of the malware scanner, or are given on separate lines to
65295 the daemon as options before the main scan command.
65296 </para>
65297 <para>
65298 <indexterm role="concept">
65299 <primary><literal>pass_unscanned</literal></primary>
65300 <secondary>avast</secondary>
65301 </indexterm>
65302 If <literal>pass_unscanned</literal>
65303 is set, any files the Avast scanner can&#x2019;t scan (e.g.
65304 decompression bombs, or invalid archives) are considered clean. Use with
65305 care.
65306 </para>
65307 <para>
65308 For example:
65309 </para>
65310 <literallayout class="monospaced">
65311 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
65312 av_scanner = avast:/var/run/avast/scan.sock:pass_unscanned:FLAGS -fullfiles:SENSITIVITY -pup
65313 av_scanner = avast:192.168.2.22 5036
65314 </literallayout>
65315 <para>
65316 If you omit the argument, the default path
65317 <filename>/var/run/avast/scan.sock</filename>
65318 is used.
65319 If you use a remote host,
65320 you need to make Exim&#x2019;s spool directory available to it,
65321 as the scanner is passed a file path, not file contents.
65322 For information about available commands and their options you may use
65323 </para>
65324 <literallayout class="monospaced">
65325 $ socat UNIX:/var/run/avast/scan.sock STDIO:
65326     FLAGS
65327     SENSITIVITY
65328     PACK
65329 </literallayout>
65330 <para>
65331 If the scanner returns a temporary failure (e.g. license issues, or
65332 permission problems), the message is deferred and a paniclog entry is
65333 written.  The usual <literal>defer_ok</literal> option is available.
65334 </para>
65335 </listitem></varlistentry>
65336 <varlistentry>
65337 <term><option>aveserver</option></term>
65338 <listitem>
65339 <para>
65340 <indexterm role="concept">
65341 <primary>virus scanners</primary>
65342 <secondary>Kaspersky</secondary>
65343 </indexterm>
65344 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
65345 at <emphasis role="bold"><ulink url="https://www.kaspersky.com/">https://www.kaspersky.com/</ulink></emphasis>. This scanner type takes one option,
65346 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
65347 example:
65348 </para>
65349 <literallayout class="monospaced">
65350 av_scanner = aveserver:/var/run/aveserver
65351 </literallayout>
65352 </listitem></varlistentry>
65353 <varlistentry>
65354 <term><option>clamd</option></term>
65355 <listitem>
65356 <para>
65357 <indexterm role="concept">
65358 <primary>virus scanners</primary>
65359 <secondary>clamd</secondary>
65360 </indexterm>
65361 This daemon-type scanner is GPL and free. You can get it at
65362 <emphasis role="bold"><ulink url="https://www.clamav.net/">https://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
65363 unpack MIME containers, so it used to be recommended to unpack MIME attachments
65364 in the MIME ACL. This is no longer believed to be necessary.
65365 </para>
65366 <para>
65367 The options are a list of server specifiers, which may be
65368 a UNIX socket specification,
65369 a TCP socket specification,
65370 or a (global) option.
65371 </para>
65372 <para>
65373 A socket specification consists of a space-separated list.
65374 For a Unix socket the first element is a full path for the socket,
65375 for a TCP socket the first element is the IP address
65376 and the second a port number,
65377 Any further elements are per-server (non-global) options.
65378 These per-server options are supported:
65379 </para>
65380 <literallayout class="monospaced">
65381 retry=&lt;timespec&gt;  Retry on connect fail
65382 </literallayout>
65383 <para>
65384 The <literal>retry</literal> option specifies a time after which a single retry for
65385 a failed connect is made.  The default is to not retry.
65386 </para>
65387 <para>
65388 If a Unix socket file is specified, only one server is supported.
65389 </para>
65390 <para>
65391 Examples:
65392 </para>
65393 <literallayout class="monospaced">
65394 av_scanner = clamd:/opt/clamd/socket
65395 av_scanner = clamd:192.0.2.3 1234
65396 av_scanner = clamd:192.0.2.3 1234:local
65397 av_scanner = clamd:192.0.2.3 1234 retry=10s
65398 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
65399 </literallayout>
65400 <para>
65401 If the value of av_scanner points to a UNIX socket file or contains the
65402 <literal>local</literal>
65403 option, then the ClamAV interface will pass a filename containing the data
65404 to be scanned, which should normally result in less I/O happening and be
65405 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
65406 Exim does not assume that there is a common filesystem with the remote host.
65407 </para>
65408 <para>
65409 The final example shows that multiple TCP targets can be specified.  Exim will
65410 randomly use one for each incoming email (i.e. it load balances them).  Note
65411 that only TCP targets may be used if specifying a list of scanners; a UNIX
65412 socket cannot be mixed in with TCP targets.  If one of the servers becomes
65413 unavailable, Exim will try the remaining one(s) until it finds one that works.
65414 When a clamd server becomes unreachable, Exim will log a message.  Exim does
65415 not keep track of scanner state between multiple messages, and the scanner
65416 selection is random, so the message will get logged in the mainlog for each
65417 email that the down scanner gets chosen first (message wrapped to be readable):
65418 </para>
65419 <literallayout class="monospaced">
65420 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
65421    clamd: connection to localhost, port 3310 failed
65422    (Connection refused)
65423 </literallayout>
65424 <para>
65425 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
65426 contributing the code for this scanner.
65427 </para>
65428 </listitem></varlistentry>
65429 <varlistentry>
65430 <term><option>cmdline</option></term>
65431 <listitem>
65432 <para>
65433 <indexterm role="concept">
65434 <primary>virus scanners</primary>
65435 <secondary>command line interface</secondary>
65436 </indexterm>
65437 This is the keyword for the generic command line scanner interface. It can be
65438 used to attach virus scanners that are invoked from the shell. This scanner
65439 type takes 3 mandatory options:
65440 </para>
65441 <orderedlist numeration="arabic">
65442 <listitem>
65443 <para>
65444 The full path and name of the scanner binary, with all command line options,
65445 and a placeholder (<literal>%s</literal>) for the directory to scan.
65446 </para>
65447 </listitem>
65448 <listitem>
65449 <para>
65450 A regular expression to match against the STDOUT and STDERR output of the
65451 virus scanner. If the expression matches, a virus was found. You must make
65452 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
65453 the <quote>trigger</quote> expression.
65454 </para>
65455 </listitem>
65456 <listitem>
65457 <para>
65458 Another regular expression, containing exactly one pair of parentheses, to
65459 match the name of the virus found in the scanners output. This is called the
65460 <quote>name</quote> expression.
65461 </para>
65462 </listitem>
65463 </orderedlist>
65464 <para>
65465 For example, Sophos Sweep reports a virus on a line like this:
65466 </para>
65467 <literallayout class="monospaced">
65468 Virus 'W32/Magistr-B' found in file ./those.bat
65469 </literallayout>
65470 <para>
65471 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
65472 name expression, we want to extract the W32/Magistr-B string, so we can match
65473 for the single quotes left and right of it. Altogether, this makes the
65474 configuration setting:
65475 </para>
65476 <literallayout class="monospaced">
65477 av_scanner = cmdline:\
65478              /path/to/sweep -ss -all -rec -archive %s:\
65479              found in file:'(.+)'
65480 </literallayout>
65481 </listitem></varlistentry>
65482 <varlistentry>
65483 <term><option>drweb</option></term>
65484 <listitem>
65485 <para>
65486 <indexterm role="concept">
65487 <primary>virus scanners</primary>
65488 <secondary>DrWeb</secondary>
65489 </indexterm>
65490 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="https://www.sald.ru/">https://www.sald.ru/</ulink></emphasis>) interface
65491 takes one option,
65492 either a full path to a UNIX socket,
65493 or host and port specifiers separated by white space.
65494 The host may be a name or an IP address; the port is either a
65495 single number or a pair of numbers with a dash between.
65496 For example:
65497 </para>
65498 <literallayout class="monospaced">
65499 av_scanner = drweb:/var/run/drwebd.sock
65500 av_scanner = drweb:192.168.2.20 31337
65501 </literallayout>
65502 <para>
65503 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
65504 is used. Thanks to Alex Miller for contributing the code for this scanner.
65505 </para>
65506 </listitem></varlistentry>
65507 <varlistentry>
65508 <term><option>f-protd</option></term>
65509 <listitem>
65510 <para>
65511 <indexterm role="concept">
65512 <primary>virus scanners</primary>
65513 <secondary>f-protd</secondary>
65514 </indexterm>
65515 The f-protd scanner is accessed via HTTP over TCP.
65516 One argument is taken, being a space-separated hostname and port number
65517 (or port-range).
65518 For example:
65519 </para>
65520 <literallayout class="monospaced">
65521 av_scanner = f-protd:localhost 10200-10204
65522 </literallayout>
65523 <para>
65524 If you omit the argument, the default values shown above are used.
65525 </para>
65526 </listitem></varlistentry>
65527 <varlistentry>
65528 <term><option>f-prot6d</option></term>
65529 <listitem>
65530 <para>
65531 <indexterm role="concept">
65532 <primary>virus scanners</primary>
65533 <secondary>f-prot6d</secondary>
65534 </indexterm>
65535 The f-prot6d scanner is accessed using the FPSCAND protocol over TCP.
65536 One argument is taken, being a space-separated hostname and port number.
65537 For example:
65538 </para>
65539 <literallayout class="monospaced">
65540 av_scanner = f-prot6d:localhost 10200
65541 </literallayout>
65542 <para>
65543 If you omit the argument, the default values show above are used.
65544 </para>
65545 </listitem></varlistentry>
65546 <varlistentry>
65547 <term><option>fsecure</option></term>
65548 <listitem>
65549 <para>
65550 <indexterm role="concept">
65551 <primary>virus scanners</primary>
65552 <secondary>F-Secure</secondary>
65553 </indexterm>
65554 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="https://www.f-secure.com/">https://www.f-secure.com/</ulink></emphasis>) takes one
65555 argument which is the path to a UNIX socket. For example:
65556 </para>
65557 <literallayout class="monospaced">
65558 av_scanner = fsecure:/path/to/.fsav
65559 </literallayout>
65560 <para>
65561 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
65562 Thelmen for contributing the code for this scanner.
65563 </para>
65564 </listitem></varlistentry>
65565 <varlistentry>
65566 <term><option>kavdaemon</option></term>
65567 <listitem>
65568 <para>
65569 <indexterm role="concept">
65570 <primary>virus scanners</primary>
65571 <secondary>Kaspersky</secondary>
65572 </indexterm>
65573 This is the scanner daemon of Kaspersky Version 4. This version of the
65574 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
65575 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
65576 For example:
65577 </para>
65578 <literallayout class="monospaced">
65579 av_scanner = kavdaemon:/opt/AVP/AvpCtl
65580 </literallayout>
65581 <para>
65582 The default path is <filename>/var/run/AvpCtl</filename>.
65583 </para>
65584 </listitem></varlistentry>
65585 <varlistentry>
65586 <term><option>mksd</option></term>
65587 <listitem>
65588 <para>
65589 <indexterm role="concept">
65590 <primary>virus scanners</primary>
65591 <secondary>mksd</secondary>
65592 </indexterm>
65593 This was a daemon type scanner that is aimed mainly at Polish users,
65594 though some documentation was available in English.
65595 The history can be shown at <emphasis role="bold"><ulink url="https://en.wikipedia.org/wiki/Mks_vir">https://en.wikipedia.org/wiki/Mks_vir</ulink></emphasis>
65596 and this appears to be a candidate for removal from Exim, unless
65597 we are informed of other virus scanners which use the same protocol
65598 to integrate.
65599 The only option for this scanner type is
65600 the maximum number of processes used simultaneously to scan the attachments,
65601 provided that mksd has
65602 been run with at least the same number of child processes. For example:
65603 </para>
65604 <literallayout class="monospaced">
65605 av_scanner = mksd:2
65606 </literallayout>
65607 <para>
65608 You can safely omit this option (the default value is 1).
65609 </para>
65610 </listitem></varlistentry>
65611 <varlistentry>
65612 <term><option>sock</option></term>
65613 <listitem>
65614 <para>
65615 <indexterm role="concept">
65616 <primary>virus scanners</primary>
65617 <secondary>simple socket-connected</secondary>
65618 </indexterm>
65619 This is a general-purpose way of talking to simple scanner daemons
65620 running on the local machine.
65621 There are four options:
65622 an address (which may be an IP address and port, or the path of a Unix socket),
65623 a commandline to send (may include a single %s which will be replaced with
65624 the path to the mail file to be scanned),
65625 an RE to trigger on from the returned data,
65626 and an RE to extract malware_name from the returned data.
65627 For example:
65628 </para>
65629 <literallayout class="monospaced">
65630 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$
65631 </literallayout>
65632 <para>
65633 Note that surrounding whitespace is stripped from each option, meaning
65634 there is no way to specify a trailing newline.
65635 The socket specifier and both regular-expressions are required.
65636 Default for the commandline is <filename>%s\n</filename> (note this does have a trailing newline);
65637 specify an empty element to get this.
65638 </para>
65639 </listitem></varlistentry>
65640 <varlistentry>
65641 <term><option>sophie</option></term>
65642 <listitem>
65643 <para>
65644 <indexterm role="concept">
65645 <primary>virus scanners</primary>
65646 <secondary>Sophos and Sophie</secondary>
65647 </indexterm>
65648 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
65649 You can get Sophie at <emphasis role="bold"><ulink url="http://sophie.sourceforge.net/">http://sophie.sourceforge.net/</ulink></emphasis>. The only option
65650 for this scanner type is the path to the UNIX socket that Sophie uses for
65651 client communication. For example:
65652 </para>
65653 <literallayout class="monospaced">
65654 av_scanner = sophie:/tmp/sophie
65655 </literallayout>
65656 <para>
65657 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
65658 the option.
65659 </para>
65660 </listitem></varlistentry>
65661 </variablelist>
65662 <para>
65663 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
65664 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
65665 ACL.
65666 </para>
65667 <para>
65668 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
65669 makes it possible to use different scanners. See further below for an example.
65670 The <option>malware</option> condition caches its results, so when you use it multiple times
65671 for the same message, the actual scanning process is only carried out once.
65672 However, using expandable items in <option>av_scanner</option> disables this caching, in
65673 which case each use of the <option>malware</option> condition causes a new scan of the
65674 message.
65675 </para>
65676 <para>
65677 The <option>malware</option> condition takes a right-hand argument that is expanded before
65678 use and taken as a list, slash-separated by default.
65679 The first element can then be one of
65680 </para>
65681 <itemizedlist>
65682 <listitem>
65683 <para>
65684 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
65685 The condition succeeds if a virus was found, and fail otherwise. This is the
65686 recommended usage.
65687 </para>
65688 </listitem>
65689 <listitem>
65690 <para>
65691 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
65692 the condition fails immediately.
65693 </para>
65694 </listitem>
65695 <listitem>
65696 <para>
65697 A regular expression, in which case the message is scanned for viruses. The
65698 condition succeeds if a virus is found and its name matches the regular
65699 expression. This allows you to take special actions on certain types of virus.
65700 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
65701 unless the separator is changed (in the usual way <xref linkend="SECTlistsepchange"/>).
65702 </para>
65703 </listitem>
65704 </itemizedlist>
65705 <para>
65706 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
65707 messages even if there is a problem with the virus scanner.
65708 Otherwise, such a problem causes the ACL to defer.
65709 </para>
65710 <para>
65711 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
65712 specify a non-default timeout.  The default is two minutes.
65713 For example:
65714 </para>
65715 <literallayout class="monospaced">
65716 malware = * / defer_ok / tmo=10s
65717 </literallayout>
65718 <para>
65719 A timeout causes the ACL to defer.
65720 </para>
65721 <para>
65722 <indexterm role="variable">
65723 <primary><varname>$callout_address</varname></primary>
65724 </indexterm>
65725 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
65726 is set to record the actual address used.
65727 </para>
65728 <para>
65729 <indexterm role="variable">
65730 <primary><varname>$malware_name</varname></primary>
65731 </indexterm>
65732 When a virus is found, the condition sets up an expansion variable called
65733 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
65734 <option>message</option> modifier that specifies the error returned to the sender, and/or in
65735 logging data.
65736 </para>
65737 <para>
65738 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
65739 imposed by your anti-virus scanner.
65740 </para>
65741 <para>
65742 Here is a very simple scanning example:
65743 </para>
65744 <literallayout class="monospaced">
65745 deny malware = *
65746      message = This message contains malware ($malware_name)
65747 </literallayout>
65748 <para>
65749 The next example accepts messages when there is a problem with the scanner:
65750 </para>
65751 <literallayout class="monospaced">
65752 deny malware = */defer_ok
65753      message = This message contains malware ($malware_name)
65754 </literallayout>
65755 <para>
65756 The next example shows how to use an ACL variable to scan with both sophie and
65757 aveserver. It assumes you have set:
65758 </para>
65759 <literallayout class="monospaced">
65760 av_scanner = $acl_m0
65761 </literallayout>
65762 <para>
65763 in the main Exim configuration.
65764 </para>
65765 <literallayout class="monospaced">
65766 deny set acl_m0 = sophie
65767      malware = *
65768      message = This message contains malware ($malware_name)
65769
65770 deny set acl_m0 = aveserver
65771      malware = *
65772      message = This message contains malware ($malware_name)
65773 </literallayout>
65774 </section>
65775 <section id="SECTscanspamass">
65776 <title>Scanning with SpamAssassin and Rspamd</title>
65777 <para>
65778 <indexterm role="concept">
65779 <primary>content scanning</primary>
65780 <secondary>for spam</secondary>
65781 </indexterm>
65782 <indexterm role="concept">
65783 <primary>spam scanning</primary>
65784 </indexterm>
65785 <indexterm role="concept">
65786 <primary>SpamAssassin</primary>
65787 </indexterm>
65788 <indexterm role="concept">
65789 <primary>Rspamd</primary>
65790 </indexterm>
65791 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
65792 score and a report for the message.
65793 Support is also provided for Rspamd.
65794 </para>
65795 <para>
65796 For more information about installation and configuration of SpamAssassin or
65797 Rspamd refer to their respective websites at
65798 <emphasis role="bold"><ulink url="https://spamassassin.apache.org/">https://spamassassin.apache.org/</ulink></emphasis> and <emphasis role="bold"><ulink url="https://www.rspamd.com/">https://www.rspamd.com/</ulink></emphasis>
65799 </para>
65800 <para>
65801 SpamAssassin can be installed with CPAN by running:
65802 </para>
65803 <literallayout class="monospaced">
65804 perl -MCPAN -e 'install Mail::SpamAssassin'
65805 </literallayout>
65806 <para>
65807 SpamAssassin has its own set of configuration files. Please review its
65808 documentation to see how you can tweak it. The default installation should work
65809 nicely, however.
65810 </para>
65811 <para>
65812 <indexterm role="option">
65813 <primary><option>spamd_address</option></primary>
65814 </indexterm>
65815 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
65816 intend to use an instance running on the local host you do not need to set
65817 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
65818 you must set the <option>spamd_address</option> option in the global part of the Exim
65819 configuration as follows (example):
65820 </para>
65821 <literallayout class="monospaced">
65822 spamd_address = 192.168.99.45 783
65823 </literallayout>
65824 <para>
65825 The SpamAssassin protocol relies on a TCP half-close from the client.
65826 If your SpamAssassin client side is running a Linux system with an
65827 iptables firewall, consider setting
65828 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
65829 timeout, Exim uses when waiting for a response from the SpamAssassin
65830 server (currently defaulting to 120s).  With a lower value the Linux
65831 connection tracking may consider your half-closed connection as dead too
65832 soon.
65833 </para>
65834 <para>
65835 To use Rspamd (which by default listens on all local addresses
65836 on TCP port 11333)
65837 you should add <option>variant=rspamd</option> after the address/port pair, for example:
65838 </para>
65839 <literallayout class="monospaced">
65840 spamd_address = 127.0.0.1 11333 variant=rspamd
65841 </literallayout>
65842 <para>
65843 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
65844 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
65845 filename instead of an address/port pair:
65846 </para>
65847 <literallayout class="monospaced">
65848 spamd_address = /var/run/spamd_socket
65849 </literallayout>
65850 <para>
65851 You can have multiple <option>spamd</option> servers to improve scalability. These can
65852 reside on other hardware reachable over the network. To specify multiple
65853 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
65854 option, separated with colons (the separator can be changed in the usual way <xref linkend="SECTlistsepchange"/>):
65855 </para>
65856 <literallayout class="monospaced">
65857 spamd_address = 192.168.2.10 783 : \
65858                 192.168.2.11 783 : \
65859                 192.168.2.12 783
65860 </literallayout>
65861 <para>
65862 Up to 32 <option>spamd</option> servers are supported.
65863 When a server fails to respond to the connection attempt, all other
65864 servers are tried until one succeeds. If no server responds, the <option>spam</option>
65865 condition defers.
65866 </para>
65867 <para>
65868 Unix and TCP socket specifications may be mixed in any order.
65869 Each element of the list is a list itself, space-separated by default
65870 and changeable in the usual way (<xref linkend="SECTlistsepchange"/>);
65871 take care to not double the separator.
65872 </para>
65873 <para>
65874 For TCP socket specifications a host name or IP (v4 or v6, but
65875 subject to list-separator quoting rules) address can be used,
65876 and the port can be one or a dash-separated pair.
65877 In the latter case, the range is tried in strict order.
65878 </para>
65879 <para>
65880 Elements after the first for Unix sockets, or second for TCP socket,
65881 are options.
65882 The supported options are:
65883 </para>
65884 <literallayout class="monospaced">
65885 pri=&lt;priority&gt;      Selection priority
65886 weight=&lt;value&gt;      Selection bias
65887 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
65888 retry=&lt;timespec&gt;    Retry on connect fail
65889 tmo=&lt;timespec&gt;      Connection time limit
65890 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
65891 </literallayout>
65892 <para>
65893 The <literal>pri</literal> option specifies a priority for the server within the list,
65894 higher values being tried first.
65895 The default priority is 1.
65896 </para>
65897 <para>
65898 The <literal>weight</literal> option specifies a selection bias.
65899 Within a priority set
65900 servers are queried in a random fashion, weighted by this value.
65901 The default value for selection bias is 1.
65902 </para>
65903 <para>
65904 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
65905 in the local time zone; each element being one or more digits.
65906 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
65907 characters, may be omitted and will be taken as zero.
65908 </para>
65909 <para>
65910 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
65911 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
65912 </para>
65913 <para>
65914 The <literal>tmo</literal> option specifies an overall timeout for communication.
65915 The default value is two minutes.
65916 </para>
65917 <para>
65918 The <literal>retry</literal> option specifies a time after which a single retry for
65919 a failed connect is made.
65920 The default is to not retry.
65921 </para>
65922 <para>
65923 The <option>spamd_address</option> variable is expanded before use if it starts with
65924 a dollar sign. In this case, the expansion may return a string that is
65925 used as the list so that multiple spamd servers can be the result of an
65926 expansion.
65927 </para>
65928 <para>
65929 <indexterm role="variable">
65930 <primary><varname>$callout_address</varname></primary>
65931 </indexterm>
65932 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
65933 is set to record the actual address used.
65934 </para>
65935 </section>
65936 <section id="SECID206">
65937 <title>Calling SpamAssassin from an Exim ACL</title>
65938 <para>
65939 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
65940 </para>
65941 <literallayout class="monospaced">
65942 deny spam = joe
65943      message = This message was classified as SPAM
65944 </literallayout>
65945 <para>
65946 The right-hand side of the <option>spam</option> condition specifies a name. This is
65947 relevant if you have set up multiple SpamAssassin profiles. If you do not want
65948 to scan using a specific profile, but rather use the SpamAssassin system-wide
65949 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
65950 Rspamd does not use this setting. However, you must put something on the
65951 right-hand side.
65952 </para>
65953 <para>
65954 The name allows you to use per-domain or per-user antispam profiles in
65955 principle, but this is not straightforward in practice, because a message may
65956 have multiple recipients, not necessarily all in the same domain. Because the
65957 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
65958 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
65959 are not set.
65960 Careful enforcement of single-recipient messages
65961 (e.g. by responding with defer in the recipient ACL for all recipients
65962 after the first),
65963 or the use of PRDR,
65964 <indexterm role="concept">
65965 <primary>PRDR</primary>
65966 <secondary>use for per-user SpamAssassin profiles</secondary>
65967 </indexterm>
65968 are needed to use this feature.
65969 </para>
65970 <para>
65971 The right-hand side of the <option>spam</option> condition is expanded before being used, so
65972 you can put lookups or conditions there. When the right-hand side evaluates to
65973 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
65974 </para>
65975 <para>
65976 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
65977 large ones may cause significant performance degradation. As most spam messages
65978 are quite small, it is recommended that you do not scan the big ones. For
65979 example:
65980 </para>
65981 <literallayout class="monospaced">
65982 deny condition = ${if &lt; {$message_size}{10K}}
65983      spam = nobody
65984      message = This message was classified as SPAM
65985 </literallayout>
65986 <para>
65987 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
65988 SpamAssassin profile has been matched or exceeded. If you want to use the
65989 <option>spam</option> condition for its side effects (see the variables below), you can make
65990 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
65991 </para>
65992 <para>
65993 <indexterm role="concept">
65994 <primary>spam scanning</primary>
65995 <secondary>returned variables</secondary>
65996 </indexterm>
65997 When the <option>spam</option> condition is run, it sets up a number of expansion
65998 variables.
65999 Except for <varname>$spam_report</varname>,
66000 these variables are saved with the received message so are
66001 available for use at delivery time.
66002 </para>
66003 <variablelist>
66004 <varlistentry>
66005 <term><varname>$spam_score</varname></term>
66006 <listitem>
66007 <para>
66008 The spam score of the message, for example, <quote>3.4</quote> or <quote>30.5</quote>. This is useful
66009 for inclusion in log or reject messages.
66010 </para>
66011 </listitem></varlistentry>
66012 <varlistentry>
66013 <term><varname>$spam_score_int</varname></term>
66014 <listitem>
66015 <para>
66016 The spam score of the message, multiplied by ten, as an integer value. For
66017 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
66018 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
66019 The integer value is useful for numeric comparisons in conditions.
66020 </para>
66021 </listitem></varlistentry>
66022 <varlistentry>
66023 <term><varname>$spam_bar</varname></term>
66024 <listitem>
66025 <para>
66026 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
66027 integer part of the spam score value. A spam score of 4.4 would have a
66028 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
66029 headers, since MUAs can match on such strings. The maximum length of the
66030 spam bar is 50 characters.
66031 </para>
66032 </listitem></varlistentry>
66033 <varlistentry>
66034 <term><varname>$spam_report</varname></term>
66035 <listitem>
66036 <para>
66037 A multiline text table, containing the full SpamAssassin report for the
66038 message. Useful for inclusion in headers or reject messages.
66039 This variable is only usable in a DATA-time ACL.
66040 Beware that SpamAssassin may return non-ASCII characters, especially
66041 when running in country-specific locales, which are not legal
66042 unencoded in headers.
66043 </para>
66044 </listitem></varlistentry>
66045 <varlistentry>
66046 <term><varname>$spam_action</varname></term>
66047 <listitem>
66048 <para>
66049 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
66050 spam score versus threshold.
66051 For Rspamd, the recommended action.
66052 </para>
66053 </listitem></varlistentry>
66054 </variablelist>
66055 <para>
66056 The <option>spam</option> condition caches its results unless expansion in
66057 spamd_address was used. If you call it again with the same user name, it
66058 does not scan again, but rather returns the same values as before.
66059 </para>
66060 <para>
66061 The <option>spam</option> condition returns DEFER if there is any error while running
66062 the message through SpamAssassin or if the expansion of spamd_address
66063 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
66064 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
66065 spam condition, like this:
66066 </para>
66067 <literallayout class="monospaced">
66068 deny spam    = joe/defer_ok
66069      message = This message was classified as SPAM
66070 </literallayout>
66071 <para>
66072 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
66073 </para>
66074 <para>
66075 Here is a longer, commented example of the use of the <option>spam</option>
66076 condition:
66077 </para>
66078 <literallayout class="monospaced">
66079 # put headers in all messages (no matter if spam or not)
66080 warn  spam = nobody:true
66081       add_header = X-Spam-Score: $spam_score ($spam_bar)
66082       add_header = X-Spam-Report: $spam_report
66083
66084 # add second subject line with *SPAM* marker when message
66085 # is over threshold
66086 warn  spam = nobody
66087       add_header = Subject: *SPAM* $h_Subject:
66088
66089 # reject spam at high scores (&gt; 12)
66090 deny  spam = nobody:true
66091       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
66092       message = This message scored $spam_score spam points.
66093 </literallayout>
66094 </section>
66095 <section id="SECTscanmimepart">
66096 <title>Scanning MIME parts</title>
66097 <para>
66098 <indexterm role="concept">
66099 <primary>content scanning</primary>
66100 <secondary>MIME parts</secondary>
66101 </indexterm>
66102 <indexterm role="concept">
66103 <primary>MIME content scanning</primary>
66104 </indexterm>
66105 <indexterm role="option">
66106 <primary><option>acl_smtp_mime</option></primary>
66107 </indexterm>
66108 <indexterm role="option">
66109 <primary><option>acl_not_smtp_mime</option></primary>
66110 </indexterm>
66111 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
66112 each MIME part of an SMTP message, including multipart types, in the sequence
66113 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
66114 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
66115 options may both refer to the same ACL if you want the same processing in both
66116 cases.
66117 </para>
66118 <para>
66119 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
66120 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
66121 the case of a non-SMTP message. However, a MIME ACL is called only if the
66122 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
66123 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
66124 result code is sent to the client. In the case of an SMTP message, the
66125 <option>acl_smtp_data</option> ACL is not called when this happens.
66126 </para>
66127 <para>
66128 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
66129 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
66130 condition to match against the raw MIME part. You can also use the
66131 <option>mime_regex</option> condition to match against the decoded MIME part (see section
66132 <xref linkend="SECTscanregex"/>).
66133 </para>
66134 <para>
66135 At the start of a MIME ACL, a number of variables are set from the header
66136 information for the relevant MIME part. These are described below. The contents
66137 of the MIME part are not by default decoded into a disk file except for MIME
66138 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
66139 part into a disk file, you can use the <option>decode</option> condition. The general
66140 syntax is:
66141 </para>
66142 <literallayout>
66143 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
66144 </literallayout>
66145 <para>
66146 The right hand side is expanded before use. After expansion,
66147 the value can be:
66148 </para>
66149 <orderedlist numeration="arabic">
66150 <listitem>
66151 <para>
66152 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
66153 </para>
66154 </listitem>
66155 <listitem>
66156 <para>
66157 The string <quote>default</quote>. In that case, the file is put in the temporary
66158 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
66159 a sequential filename consisting of the message id and a sequence number. The
66160 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
66161 </para>
66162 </listitem>
66163 <listitem>
66164 <para>
66165 A full path name starting with a slash. If the full name is an existing
66166 directory, it is used as a replacement for the default directory. The filename
66167 is then sequentially assigned. If the path does not exist, it is used as
66168 the full path and filename.
66169 </para>
66170 </listitem>
66171 <listitem>
66172 <para>
66173 If the string does not start with a slash, it is used as the
66174 filename, and the default path is then used.
66175 </para>
66176 </listitem>
66177 </orderedlist>
66178 <para>
66179 The <option>decode</option> condition normally succeeds. It is only false for syntax
66180 errors or unusual circumstances such as memory shortages. You can easily decode
66181 a file with its original, proposed filename using
66182 </para>
66183 <literallayout class="monospaced">
66184 decode = $mime_filename
66185 </literallayout>
66186 <para>
66187 However, you should keep in mind that <varname>$mime_filename</varname> might contain
66188 anything. If you place files outside of the default path, they are not
66189 automatically unlinked.
66190 </para>
66191 <para>
66192 For RFC822 attachments (these are messages attached to messages, with a
66193 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
66194 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
66195 variable is set (see below). Attached messages are always decoded to disk
66196 before being checked, and the files are unlinked once the check is done.
66197 </para>
66198 <para>
66199 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
66200 used to match regular expressions against raw and decoded MIME parts,
66201 respectively. They are described in section <xref linkend="SECTscanregex"/>.
66202 </para>
66203 <para>
66204 <indexterm role="concept">
66205 <primary>MIME content scanning</primary>
66206 <secondary>returned variables</secondary>
66207 </indexterm>
66208 The following list describes all expansion variables that are
66209 available in the MIME ACL:
66210 </para>
66211 <variablelist>
66212 <varlistentry>
66213 <term><varname>$mime_anomaly_level</varname></term>
66214 <term><varname>$mime_anomaly_text</varname></term>
66215 <listitem>
66216 <para>
66217 <indexterm role="variable">
66218 <primary><varname>$mime_anomaly_level</varname></primary>
66219 </indexterm>
66220 <indexterm role="variable">
66221 <primary><varname>$mime_anomaly_text</varname></primary>
66222 </indexterm>
66223 If there are problems decoding, these variables contain information on
66224 the detected issue.
66225 </para>
66226 </listitem></varlistentry>
66227 <varlistentry>
66228 <term><varname>$mime_boundary</varname></term>
66229 <listitem>
66230 <para>
66231 <indexterm role="variable">
66232 <primary><varname>$mime_boundary</varname></primary>
66233 </indexterm>
66234 If the current part is a multipart (see <varname>$mime_is_multipart</varname> below), it should
66235 have a boundary string, which is stored in this variable. If the current part
66236 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
66237 contains the empty string.
66238 </para>
66239 </listitem></varlistentry>
66240 <varlistentry>
66241 <term><varname>$mime_charset</varname></term>
66242 <listitem>
66243 <para>
66244 <indexterm role="variable">
66245 <primary><varname>$mime_charset</varname></primary>
66246 </indexterm>
66247 This variable contains the character set identifier, if one was found in the
66248 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
66249 </para>
66250 <literallayout class="monospaced">
66251 us-ascii
66252 gb2312 (Chinese)
66253 iso-8859-1
66254 </literallayout>
66255 <para>
66256 Please note that this value is not normalized, so you should do matches
66257 case-insensitively.
66258 </para>
66259 </listitem></varlistentry>
66260 <varlistentry>
66261 <term><varname>$mime_content_description</varname></term>
66262 <listitem>
66263 <para>
66264 <indexterm role="variable">
66265 <primary><varname>$mime_content_description</varname></primary>
66266 </indexterm>
66267 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
66268 header. It can contain a human-readable description of the parts content. Some
66269 implementations repeat the filename for attachments here, but they are usually
66270 only used for display purposes.
66271 </para>
66272 </listitem></varlistentry>
66273 <varlistentry>
66274 <term><varname>$mime_content_disposition</varname></term>
66275 <listitem>
66276 <para>
66277 <indexterm role="variable">
66278 <primary><varname>$mime_content_disposition</varname></primary>
66279 </indexterm>
66280 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
66281 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
66282 </para>
66283 </listitem></varlistentry>
66284 <varlistentry>
66285 <term><varname>$mime_content_id</varname></term>
66286 <listitem>
66287 <para>
66288 <indexterm role="variable">
66289 <primary><varname>$mime_content_id</varname></primary>
66290 </indexterm>
66291 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
66292 This is a unique ID that can be used to reference a part from another part.
66293 </para>
66294 </listitem></varlistentry>
66295 <varlistentry>
66296 <term><varname>$mime_content_size</varname></term>
66297 <listitem>
66298 <para>
66299 <indexterm role="variable">
66300 <primary><varname>$mime_content_size</varname></primary>
66301 </indexterm>
66302 This variable is set only after the <option>decode</option> modifier (see above) has been
66303 successfully run. It contains the size of the decoded part in kilobytes. The
66304 size is always rounded up to full kilobytes, so only a completely empty part
66305 has a <varname>$mime_content_size</varname> of zero.
66306 </para>
66307 </listitem></varlistentry>
66308 <varlistentry>
66309 <term><varname>$mime_content_transfer_encoding</varname></term>
66310 <listitem>
66311 <para>
66312 <indexterm role="variable">
66313 <primary><varname>$mime_content_transfer_encoding</varname></primary>
66314 </indexterm>
66315 This variable contains the normalized content of the
66316 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
66317 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
66318 </para>
66319 </listitem></varlistentry>
66320 <varlistentry>
66321 <term><varname>$mime_content_type</varname></term>
66322 <listitem>
66323 <para>
66324 <indexterm role="variable">
66325 <primary><varname>$mime_content_type</varname></primary>
66326 </indexterm>
66327 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
66328 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
66329 are some examples of popular MIME types, as they may appear in this variable:
66330 </para>
66331 <literallayout class="monospaced">
66332 text/plain
66333 text/html
66334 application/octet-stream
66335 image/jpeg
66336 audio/midi
66337 </literallayout>
66338 <para>
66339 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
66340 empty string.
66341 </para>
66342 </listitem></varlistentry>
66343 <varlistentry>
66344 <term><varname>$mime_decoded_filename</varname></term>
66345 <listitem>
66346 <para>
66347 <indexterm role="variable">
66348 <primary><varname>$mime_decoded_filename</varname></primary>
66349 </indexterm>
66350 This variable is set only after the <option>decode</option> modifier (see above) has been
66351 successfully run. It contains the full path and filename of the file
66352 containing the decoded data.
66353 </para>
66354 </listitem></varlistentry>
66355 </variablelist>
66356 <para>
66357 <indexterm role="concept">
66358 <primary>RFC 2047</primary>
66359 </indexterm>
66360 </para>
66361 <variablelist>
66362 <varlistentry>
66363 <term><varname>$mime_filename</varname></term>
66364 <listitem>
66365 <para>
66366 <indexterm role="variable">
66367 <primary><varname>$mime_filename</varname></primary>
66368 </indexterm>
66369 This is perhaps the most important of the MIME variables. It contains a
66370 proposed filename for an attachment, if one was found in either the
66371 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
66372 RFC2047
66373 or RFC2231
66374 decoded, but no additional sanity checks are done.
66375  If no filename was
66376 found, this variable contains the empty string.
66377 </para>
66378 </listitem></varlistentry>
66379 <varlistentry>
66380 <term><varname>$mime_is_coverletter</varname></term>
66381 <listitem>
66382 <para>
66383 <indexterm role="variable">
66384 <primary><varname>$mime_is_coverletter</varname></primary>
66385 </indexterm>
66386 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
66387 attached data. It can be used to clamp down on flashy or unnecessarily encoded
66388 content in the cover letter, while not restricting attachments at all.
66389 </para>
66390 <para>
66391 The variable contains 1 (true) for a MIME part believed to be part of the
66392 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
66393 follows:
66394 </para>
66395 <orderedlist numeration="arabic">
66396 <listitem>
66397 <para>
66398 The outermost MIME part of a message is always a cover letter.
66399 </para>
66400 </listitem>
66401 <listitem>
66402 <para>
66403 If a multipart/alternative or multipart/related MIME part is a cover letter,
66404 so are all MIME subparts within that multipart.
66405 </para>
66406 </listitem>
66407 <listitem>
66408 <para>
66409 If any other multipart is a cover letter, the first subpart is a cover letter,
66410 and the rest are attachments.
66411 </para>
66412 </listitem>
66413 <listitem>
66414 <para>
66415 All parts contained within an attachment multipart are attachments.
66416 </para>
66417 </listitem>
66418 </orderedlist>
66419 <para>
66420 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
66421 alternative plain text), while allowing HTML files to be attached. HTML
66422 coverletter mail attached to non-HTML coverletter mail will also be allowed:
66423 </para>
66424 <literallayout class="monospaced">
66425 deny !condition = $mime_is_rfc822
66426      condition = $mime_is_coverletter
66427      condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
66428      message = HTML mail is not accepted here
66429 </literallayout>
66430 </listitem></varlistentry>
66431 <varlistentry>
66432 <term><varname>$mime_is_multipart</varname></term>
66433 <listitem>
66434 <para>
66435 <indexterm role="variable">
66436 <primary><varname>$mime_is_multipart</varname></primary>
66437 </indexterm>
66438 This variable has the value 1 (true) when the current part has the main type
66439 <quote>multipart</quote>, for example, <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
66440 Since multipart entities only serve as containers for other parts, you may not
66441 want to carry out specific actions on them.
66442 </para>
66443 </listitem></varlistentry>
66444 <varlistentry>
66445 <term><varname>$mime_is_rfc822</varname></term>
66446 <listitem>
66447 <para>
66448 <indexterm role="variable">
66449 <primary><varname>$mime_is_rfc822</varname></primary>
66450 </indexterm>
66451 This variable has the value 1 (true) if the current part is not a part of the
66452 checked message itself, but part of an attached message. Attached message
66453 decoding is fully recursive.
66454 </para>
66455 </listitem></varlistentry>
66456 <varlistentry>
66457 <term><varname>$mime_part_count</varname></term>
66458 <listitem>
66459 <para>
66460 <indexterm role="variable">
66461 <primary><varname>$mime_part_count</varname></primary>
66462 </indexterm>
66463 This variable is a counter that is raised for each processed MIME part. It
66464 starts at zero for the very first part (which is usually a multipart). The
66465 counter is per-message, so it is reset when processing RFC822 attachments (see
66466 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
66467 complete, so you can use it in the DATA ACL to determine the number of MIME
66468 parts of a message. For non-MIME messages, this variable contains the value -1.
66469 </para>
66470 </listitem></varlistentry>
66471 </variablelist>
66472 </section>
66473 <section id="SECTscanregex">
66474 <title>Scanning with regular expressions</title>
66475 <para>
66476 <indexterm role="concept">
66477 <primary>content scanning</primary>
66478 <secondary>with regular expressions</secondary>
66479 </indexterm>
66480 <indexterm role="concept">
66481 <primary>regular expressions</primary>
66482 <secondary>content scanning with</secondary>
66483 </indexterm>
66484 You can specify your own custom regular expression matches on the full body of
66485 the message, or on individual MIME parts.
66486 </para>
66487 <para>
66488 The <option>regex</option> condition takes one or more regular expressions as arguments and
66489 matches them against the full message (when called in the DATA ACL) or a raw
66490 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
66491 linewise, with a maximum line length of 32K characters. That means you cannot
66492 have multiline matches with the <option>regex</option> condition.
66493 </para>
66494 <para>
66495 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
66496 to 32K of decoded content (the whole content at once, not linewise). If the
66497 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
66498 is decoded automatically when <option>mime_regex</option> is executed (using default path
66499 and filename values). If the decoded data is larger than  32K, only the first
66500 32K characters are checked.
66501 </para>
66502 <para>
66503 The regular expressions are passed as a colon-separated list. To include a
66504 literal colon, you must double it. Since the whole right-hand side string is
66505 expanded before being used, you must also escape dollar signs and backslashes
66506 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
66507 Here is a simple example that contains two regular expressions:
66508 </para>
66509 <literallayout class="monospaced">
66510 deny regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
66511      message = contains blacklisted regex ($regex_match_string)
66512 </literallayout>
66513 <para>
66514 The conditions returns true if any one of the regular expressions matches. The
66515 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
66516 matching regular expression.
66517 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
66518 are set to any substrings captured by the regular expression.
66519 </para>
66520 <para>
66521 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
66522 CPU-intensive.
66523 </para>
66524 <para>
66525 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
66526 </para>
66527 </section>
66528 </chapter>
66529
66530 <chapter id="CHAPlocalscan">
66531 <title>Adding a local scan function to Exim</title>
66532 <titleabbrev>Local scan function</titleabbrev>
66533 <para>
66534 <indexterm role="concept" id="IIDlosca" class="startofrange">
66535 <primary><function>local_scan()</function> function</primary>
66536 <secondary>description of</secondary>
66537 </indexterm>
66538 <indexterm role="concept">
66539 <primary>customizing</primary>
66540 <secondary>input scan using C function</secondary>
66541 </indexterm>
66542 <indexterm role="concept">
66543 <primary>policy control</primary>
66544 <secondary>by local scan function</secondary>
66545 </indexterm>
66546 In these days of email worms, viruses, and ever-increasing spam, some sites
66547 want to apply a lot of checking to messages before accepting them.
66548 </para>
66549 <para>
66550 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
66551 passing messages to external virus and spam scanning software. You can also do
66552 a certain amount in Exim itself through string expansions and the <option>condition</option>
66553 condition in the ACL that runs after the SMTP DATA command or the ACL for
66554 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
66555 </para>
66556 <para>
66557 To allow for further customization to a site&#x2019;s own requirements, there is the
66558 possibility of linking Exim with a private message scanning function, written
66559 in C. If you want to run code that is written in something other than C, you
66560 can of course use a little C stub to call it.
66561 </para>
66562 <para>
66563 The local scan function is run once for every incoming message, at the point
66564 when Exim is just about to accept the message.
66565 It can therefore be used to control non-SMTP messages from local processes as
66566 well as messages arriving via SMTP.
66567 </para>
66568 <para>
66569 Exim applies a timeout to calls of the local scan function, and there is an
66570 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
66571 Zero means <quote>no timeout</quote>.
66572 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
66573 before calling the local scan function, so that the most common types of crash
66574 are caught. If the timeout is exceeded or one of those signals is caught, the
66575 incoming message is rejected with a temporary error if it is an SMTP message.
66576 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
66577 code. The incident is logged on the main and reject logs.
66578 </para>
66579 <section id="SECID207">
66580 <title>Building Exim to use a local scan function</title>
66581 <para>
66582 <indexterm role="concept">
66583 <primary><function>local_scan()</function> function</primary>
66584 <secondary>building Exim to use</secondary>
66585 </indexterm>
66586 To make use of the local scan function feature, you must tell Exim where your
66587 function is before building Exim, by setting
66588 both HAVE_LOCAL_SCAN and
66589 LOCAL_SCAN_SOURCE in your
66590 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
66591 directory, so you might set
66592 </para>
66593 <literallayout class="monospaced">
66594 HAVE_LOCAL_SCAN=yes
66595 LOCAL_SCAN_SOURCE=Local/local_scan.c
66596 </literallayout>
66597 <para>
66598 for example. The function must be called <function>local_scan()</function>;
66599 the source file(s) for it should first #define LOCAL_SCAN
66600 and then #include "local_scan.h".
66601 It is called by
66602 Exim after it has received a message, when the success return code is about to
66603 be sent. This is after all the ACLs have been run. The return code from your
66604 function controls whether the message is actually accepted or not. There is a
66605 commented template function (that just accepts the message) in the file
66606 _src/local_scan.c_.
66607 </para>
66608 <para>
66609 If you want to make use of Exim&#x2019;s runtime configuration file to set options
66610 for your <function>local_scan()</function> function, you must also set
66611 </para>
66612 <literallayout class="monospaced">
66613 LOCAL_SCAN_HAS_OPTIONS=yes
66614 </literallayout>
66615 <para>
66616 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
66617 </para>
66618 </section>
66619 <section id="SECTapiforloc">
66620 <title>API for local_scan()</title>
66621 <para>
66622 <indexterm role="concept">
66623 <primary><function>local_scan()</function> function</primary>
66624 <secondary>API description</secondary>
66625 </indexterm>
66626 <indexterm role="concept">
66627 <primary><option>dlfunc</option></primary>
66628 <secondary>API description</secondary>
66629 </indexterm>
66630 You must include this line near the start of your code:
66631 </para>
66632 <literallayout class="monospaced">
66633 #define LOCAL_SCAN
66634 #include "local_scan.h"
66635 </literallayout>
66636 <para>
66637 This header file defines a number of variables and other values, and the
66638 prototype for the function itself. Exim is coded to use unsigned char values
66639 almost exclusively, and one of the things this header defines is a shorthand
66640 for <literal>unsigned char</literal> called <literal>uschar</literal>.
66641 It also makes available the following macro definitions, to simplify casting character
66642 strings and pointers to character strings:
66643 </para>
66644 <literallayout class="monospaced">
66645 #define CS   (char *)
66646 #define CCS  (const char *)
66647 #define CSS  (char **)
66648 #define US   (unsigned char *)
66649 #define CUS  (const unsigned char *)
66650 #define USS  (unsigned char **)
66651 </literallayout>
66652 <para>
66653 The function prototype for <function>local_scan()</function> is:
66654 </para>
66655 <literallayout class="monospaced">
66656 extern int local_scan(int fd, uschar **return_text);
66657 </literallayout>
66658 <para>
66659 The arguments are as follows:
66660 </para>
66661 <itemizedlist>
66662 <listitem>
66663 <para>
66664 <option>fd</option> is a file descriptor for the file that contains the body of the message
66665 (the -D file). The file is open for reading and writing, but updating it is not
66666 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
66667 </para>
66668 <para>
66669 The descriptor is positioned at character 19 of the file, which is the first
66670 character of the body itself, because the first 19 characters are the message
66671 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
66672 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
66673 case this changes in some future version.
66674 </para>
66675 </listitem>
66676 <listitem>
66677 <para>
66678 <option>return_text</option> is an address which you can use to return a pointer to a text
66679 string at the end of the function. The value it points to on entry is NULL.
66680 </para>
66681 </listitem>
66682 </itemizedlist>
66683 <para>
66684 The function must return an <option>int</option> value which is one of the following macros:
66685 </para>
66686 <variablelist>
66687 <varlistentry>
66688 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
66689 <listitem>
66690 <para>
66691 <indexterm role="variable">
66692 <primary><varname>$local_scan_data</varname></primary>
66693 </indexterm>
66694 The message is accepted. If you pass back a string of text, it is saved with
66695 the message, and made available in the variable <varname>$local_scan_data</varname>. No
66696 newlines are permitted (if there are any, they are turned into spaces) and the
66697 maximum length of text is 1000 characters.
66698 </para>
66699 </listitem></varlistentry>
66700 <varlistentry>
66701 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
66702 <listitem>
66703 <para>
66704 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
66705 queued without immediate delivery, and is frozen.
66706 </para>
66707 </listitem></varlistentry>
66708 <varlistentry>
66709 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
66710 <listitem>
66711 <para>
66712 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
66713 queued without immediate delivery.
66714 </para>
66715 </listitem></varlistentry>
66716 <varlistentry>
66717 <term><literal>LOCAL_SCAN_REJECT</literal></term>
66718 <listitem>
66719 <para>
66720 The message is rejected; the returned text is used as an error message which is
66721 passed back to the sender and which is also logged. Newlines are permitted &ndash;
66722 they cause a multiline response for SMTP rejections, but are converted to
66723 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
66724 used.
66725 </para>
66726 </listitem></varlistentry>
66727 <varlistentry>
66728 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
66729 <listitem>
66730 <para>
66731 The message is temporarily rejected; the returned text is used as an error
66732 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
66733 problem</quote> is used.
66734 </para>
66735 </listitem></varlistentry>
66736 <varlistentry>
66737 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
66738 <listitem>
66739 <para>
66740 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
66741 message is not written to the reject log. It has the effect of unsetting the
66742 <option>rejected_header</option> log selector for just this rejection. If
66743 <option>rejected_header</option> is already unset (see the discussion of the
66744 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
66745 same as LOCAL_SCAN_REJECT.
66746 </para>
66747 </listitem></varlistentry>
66748 <varlistentry>
66749 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
66750 <listitem>
66751 <para>
66752 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
66753 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
66754 </para>
66755 </listitem></varlistentry>
66756 </variablelist>
66757 <para>
66758 If the message is not being received by interactive SMTP, rejections are
66759 reported by writing to <option>stderr</option> or by sending an email, as configured by the
66760 <option>-oe</option> command line options.
66761 </para>
66762 </section>
66763 <section id="SECTconoptloc">
66764 <title>Configuration options for local_scan()</title>
66765 <para>
66766 <indexterm role="concept">
66767 <primary><function>local_scan()</function> function</primary>
66768 <secondary>configuration options</secondary>
66769 </indexterm>
66770 It is possible to have option settings in the main configuration file
66771 that set values in static variables in the <function>local_scan()</function> module. If you
66772 want to do this, you must have the line
66773 </para>
66774 <literallayout class="monospaced">
66775 LOCAL_SCAN_HAS_OPTIONS=yes
66776 </literallayout>
66777 <para>
66778 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
66779 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
66780 file, you must define static variables to hold the option values, and a table
66781 to define them.
66782 </para>
66783 <para>
66784 The table must be a vector called <option>local_scan_options</option>, of type
66785 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
66786 and a pointer to the variable that holds the value. The entries must appear in
66787 alphabetical order. Following <option>local_scan_options</option> you must also define a
66788 variable called <option>local_scan_options_count</option> that contains the number of
66789 entries in the table. Here is a short example, showing two kinds of option:
66790 </para>
66791 <literallayout class="monospaced">
66792 static int my_integer_option = 42;
66793 static uschar *my_string_option = US"a default string";
66794
66795 optionlist local_scan_options[] = {
66796   { "my_integer", opt_int,       &amp;my_integer_option },
66797   { "my_string",  opt_stringptr, &amp;my_string_option }
66798 };
66799
66800 int local_scan_options_count =
66801   sizeof(local_scan_options)/sizeof(optionlist);
66802 </literallayout>
66803 <para>
66804 The values of the variables can now be changed from Exim&#x2019;s runtime
66805 configuration file by including a local scan section as in this example:
66806 </para>
66807 <literallayout class="monospaced">
66808 begin local_scan
66809 my_integer = 99
66810 my_string = some string of text...
66811 </literallayout>
66812 <para>
66813 The available types of option data are as follows:
66814 </para>
66815 <variablelist>
66816 <varlistentry>
66817 <term><emphasis role="bold">opt_bool</emphasis></term>
66818 <listitem>
66819 <para>
66820 This specifies a boolean (true/false) option. The address should point to a
66821 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
66822 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
66823 whether such a variable has been set at all, you can initialize it to
66824 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
66825 values.)
66826 </para>
66827 </listitem></varlistentry>
66828 <varlistentry>
66829 <term><emphasis role="bold">opt_fixed</emphasis></term>
66830 <listitem>
66831 <para>
66832 This specifies a fixed point number, such as is used for load averages.
66833 The address should point to a variable of type <literal>int</literal>. The value is stored
66834 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
66835 </para>
66836 </listitem></varlistentry>
66837 <varlistentry>
66838 <term><emphasis role="bold">opt_int</emphasis></term>
66839 <listitem>
66840 <para>
66841 This specifies an integer; the address should point to a variable of type
66842 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
66843 Exim.
66844 </para>
66845 </listitem></varlistentry>
66846 <varlistentry>
66847 <term><emphasis role="bold">opt_mkint</emphasis></term>
66848 <listitem>
66849 <para>
66850 This is the same as <option>opt_int</option>, except that when such a value is output in a
66851 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
66852 printed with the suffix K or M.
66853 </para>
66854 </listitem></varlistentry>
66855 <varlistentry>
66856 <term><emphasis role="bold">opt_octint</emphasis></term>
66857 <listitem>
66858 <para>
66859 This also specifies an integer, but the value is always interpreted as an
66860 octal integer, whether or not it starts with the digit zero, and it is
66861 always output in octal.
66862 </para>
66863 </listitem></varlistentry>
66864 <varlistentry>
66865 <term><emphasis role="bold">opt_stringptr</emphasis></term>
66866 <listitem>
66867 <para>
66868 This specifies a string value; the address must be a pointer to a
66869 variable that points to a string (for example, of type <literal>uschar *</literal>).
66870 </para>
66871 </listitem></varlistentry>
66872 <varlistentry>
66873 <term><emphasis role="bold">opt_time</emphasis></term>
66874 <listitem>
66875 <para>
66876 This specifies a time interval value. The address must point to a variable of
66877 type <literal>int</literal>. The value that is placed there is a number of seconds.
66878 </para>
66879 </listitem></varlistentry>
66880 </variablelist>
66881 <para>
66882 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
66883 out the values of all the <function>local_scan()</function> options.
66884 </para>
66885 </section>
66886 <section id="SECID208">
66887 <title>Available Exim variables</title>
66888 <para>
66889 <indexterm role="concept">
66890 <primary><function>local_scan()</function> function</primary>
66891 <secondary>available Exim variables</secondary>
66892 </indexterm>
66893 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
66894 are the only ones that are guaranteed to be maintained from release to release.
66895 Note, however, that you can obtain the value of any Exim expansion variable,
66896 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
66897 C variables are as follows:
66898 </para>
66899 <variablelist>
66900 <varlistentry>
66901 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
66902 <listitem>
66903 <para>
66904 This variable contains the number of lines in the message&#x2019;s body.
66905 It is not valid if the <option>spool_wireformat</option> option is used.
66906 </para>
66907 </listitem></varlistentry>
66908 <varlistentry>
66909 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
66910 <listitem>
66911 <para>
66912 This variable contains the number of binary zero bytes in the message&#x2019;s body.
66913 It is not valid if the <option>spool_wireformat</option> option is used.
66914 </para>
66915 </listitem></varlistentry>
66916 <varlistentry>
66917 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
66918 <listitem>
66919 <para>
66920 This variable is set to zero when no debugging is taking place. Otherwise, it
66921 is a bitmap of debugging selectors. Two bits are identified for use in
66922 <function>local_scan()</function>; they are defined as macros:
66923 </para>
66924 <itemizedlist>
66925 <listitem>
66926 <para>
66927 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
66928 testing option that is not privileged &ndash; any caller may set it. All the
66929 other selector bits can be set only by admin users.
66930 </para>
66931 </listitem>
66932 <listitem>
66933 <para>
66934 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
66935 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
66936 of debugging bits.
66937 </para>
66938 </listitem>
66939 </itemizedlist>
66940 <para>
66941 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
66942 selected, you should use code like this:
66943 </para>
66944 <literallayout class="monospaced">
66945 if ((debug_selector &amp; D_local_scan) != 0)
66946   debug_printf("xxx", ...);
66947 </literallayout>
66948 </listitem></varlistentry>
66949 <varlistentry>
66950 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
66951 <listitem>
66952 <para>
66953 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
66954 variable <option>expand_string_message</option> contains the error message, zero-terminated.
66955 </para>
66956 </listitem></varlistentry>
66957 <varlistentry>
66958 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
66959 <listitem>
66960 <para>
66961 A pointer to a chain of header lines. The <option>header_line</option> structure is
66962 discussed below.
66963 </para>
66964 </listitem></varlistentry>
66965 <varlistentry>
66966 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
66967 <listitem>
66968 <para>
66969 A pointer to the last of the header lines.
66970 </para>
66971 </listitem></varlistentry>
66972 <varlistentry>
66973 <term><emphasis role="bold">const&nbsp;uschar&nbsp;*headers_charset</emphasis></term>
66974 <listitem>
66975 <para>
66976 The value of the <option>headers_charset</option> configuration option.
66977 </para>
66978 </listitem></varlistentry>
66979 <varlistentry>
66980 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
66981 <listitem>
66982 <para>
66983 This variable is TRUE during a host checking session that is initiated by the
66984 <option>-bh</option> command line option.
66985 </para>
66986 </listitem></varlistentry>
66987 <varlistentry>
66988 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
66989 <listitem>
66990 <para>
66991 The IP address of the interface that received the message, as a string. This
66992 is NULL for locally submitted messages.
66993 </para>
66994 </listitem></varlistentry>
66995 <varlistentry>
66996 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
66997 <listitem>
66998 <para>
66999 The port on which this message was received. When testing with the <option>-bh</option>
67000 command line option, the value of this variable is -1 unless a port has been
67001 specified via the <option>-oMi</option> option.
67002 </para>
67003 </listitem></varlistentry>
67004 <varlistentry>
67005 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
67006 <listitem>
67007 <para>
67008 This variable contains Exim&#x2019;s message id for the incoming message (the value of
67009 <varname>$message_exim_id</varname>) as a zero-terminated string.
67010 </para>
67011 </listitem></varlistentry>
67012 <varlistentry>
67013 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
67014 <listitem>
67015 <para>
67016 The name of the protocol by which the message was received.
67017 </para>
67018 </listitem></varlistentry>
67019 <varlistentry>
67020 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
67021 <listitem>
67022 <para>
67023 The number of accepted recipients.
67024 </para>
67025 </listitem></varlistentry>
67026 <varlistentry>
67027 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
67028 <listitem>
67029 <para>
67030 <indexterm role="concept">
67031 <primary>recipient</primary>
67032 <secondary>adding in local scan</secondary>
67033 </indexterm>
67034 <indexterm role="concept">
67035 <primary>recipient</primary>
67036 <secondary>removing in local scan</secondary>
67037 </indexterm>
67038 The list of accepted recipients, held in a vector of length
67039 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
67040 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
67041 below). You can delete recipients by removing them from the vector and
67042 adjusting the value in <option>recipients_count</option>. In particular, by setting
67043 <option>recipients_count</option> to zero you remove all recipients. If you then return the
67044 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
67045 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
67046 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
67047 </para>
67048 </listitem></varlistentry>
67049 <varlistentry>
67050 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
67051 <listitem>
67052 <para>
67053 The envelope sender address. For bounce messages this is the empty string.
67054 </para>
67055 </listitem></varlistentry>
67056 <varlistentry>
67057 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
67058 <listitem>
67059 <para>
67060 The IP address of the sending host, as a string. This is NULL for
67061 locally-submitted messages.
67062 </para>
67063 </listitem></varlistentry>
67064 <varlistentry>
67065 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
67066 <listitem>
67067 <para>
67068 The name of the authentication mechanism that was used, or NULL if the message
67069 was not received over an authenticated SMTP connection.
67070 </para>
67071 </listitem></varlistentry>
67072 <varlistentry>
67073 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
67074 <listitem>
67075 <para>
67076 The name of the sending host, if known.
67077 </para>
67078 </listitem></varlistentry>
67079 <varlistentry>
67080 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
67081 <listitem>
67082 <para>
67083 The port on the sending host.
67084 </para>
67085 </listitem></varlistentry>
67086 <varlistentry>
67087 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
67088 <listitem>
67089 <para>
67090 This variable is TRUE for all SMTP input, including BSMTP.
67091 </para>
67092 </listitem></varlistentry>
67093 <varlistentry>
67094 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
67095 <listitem>
67096 <para>
67097 This variable is TRUE for BSMTP input.
67098 </para>
67099 </listitem></varlistentry>
67100 <varlistentry>
67101 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
67102 <listitem>
67103 <para>
67104 The contents of this variable control which pool of memory is used for new
67105 requests. See section <xref linkend="SECTmemhanloc"/> for details.
67106 </para>
67107 </listitem></varlistentry>
67108 </variablelist>
67109 </section>
67110 <section id="SECID209">
67111 <title>Structure of header lines</title>
67112 <para>
67113 The <option>header_line</option> structure contains the members listed below.
67114 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
67115 (see below). You can cause header lines to be ignored (deleted) by setting
67116 their type to *.
67117 </para>
67118 <variablelist>
67119 <varlistentry>
67120 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
67121 <listitem>
67122 <para>
67123 A pointer to the next header line, or NULL for the last line.
67124 </para>
67125 </listitem></varlistentry>
67126 <varlistentry>
67127 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
67128 <listitem>
67129 <para>
67130 A code identifying certain headers that Exim recognizes. The codes are printing
67131 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
67132 Notice in particular that any header line whose type is * is not transmitted
67133 with the message. This flagging is used for header lines that have been
67134 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
67135 lines.) Effectively, * means <quote>deleted</quote>.
67136 </para>
67137 </listitem></varlistentry>
67138 <varlistentry>
67139 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
67140 <listitem>
67141 <para>
67142 The number of characters in the header line, including the terminating and any
67143 internal newlines.
67144 </para>
67145 </listitem></varlistentry>
67146 <varlistentry>
67147 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
67148 <listitem>
67149 <para>
67150 A pointer to the text of the header. It always ends with a newline, followed by
67151 a zero byte. Internal newlines are preserved.
67152 </para>
67153 </listitem></varlistentry>
67154 </variablelist>
67155 </section>
67156 <section id="SECID210">
67157 <title>Structure of recipient items</title>
67158 <para>
67159 The <option>recipient_item</option> structure contains these members:
67160 </para>
67161 <variablelist>
67162 <varlistentry>
67163 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
67164 <listitem>
67165 <para>
67166 This is a pointer to the recipient address as it was received.
67167 </para>
67168 </listitem></varlistentry>
67169 <varlistentry>
67170 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
67171 <listitem>
67172 <para>
67173 This is used in later Exim processing when top level addresses are created by
67174 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
67175 and must always contain -1 at this stage.
67176 </para>
67177 </listitem></varlistentry>
67178 <varlistentry>
67179 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
67180 <listitem>
67181 <para>
67182 If this value is not NULL, bounce messages caused by failing to deliver to the
67183 recipient are sent to the address it contains. In other words, it overrides the
67184 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
67185 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
67186 an unqualified address, Exim qualifies it using the domain from
67187 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
67188 is NULL for all recipients.
67189 </para>
67190 </listitem></varlistentry>
67191 </variablelist>
67192 </section>
67193 <section id="SECID211">
67194 <title>Available Exim functions</title>
67195 <para>
67196 <indexterm role="concept">
67197 <primary><function>local_scan()</function> function</primary>
67198 <secondary>available Exim functions</secondary>
67199 </indexterm>
67200 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
67201 These are the only ones that are guaranteed to be maintained from release to
67202 release:
67203 </para>
67204 <variablelist>
67205 <varlistentry>
67206 <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>
67207 <listitem>
67208 <para>
67209 This function creates a child process that runs the command specified by
67210 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
67211 be NULL if no environment variables are to be passed. A new umask is supplied
67212 for the process in <option>newumask</option>.
67213 </para>
67214 <para>
67215 Pipes to the standard input and output of the new process are set up
67216 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
67217 standard error is cloned to the standard output. If there are any file
67218 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
67219 argument is TRUE, the new process is made into a process group leader.
67220 </para>
67221 <para>
67222 The function returns the pid of the new process, or -1 if things go wrong.
67223 </para>
67224 </listitem></varlistentry>
67225 <varlistentry>
67226 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
67227 <listitem>
67228 <para>
67229 This function waits for a child process to terminate, or for a timeout (in
67230 seconds) to expire. A timeout value of zero means wait as long as it takes. The
67231 return value is as follows:
67232 </para>
67233 <itemizedlist>
67234 <listitem>
67235 <para>
67236 &gt;= 0
67237 </para>
67238 <para>
67239 The process terminated by a normal exit and the value is the process
67240 ending status.
67241 </para>
67242 </listitem>
67243 <listitem>
67244 <para>
67245 &lt; 0 and &gt; &ndash;256
67246 </para>
67247 <para>
67248 The process was terminated by a signal and the value is the negation of the
67249 signal number.
67250 </para>
67251 </listitem>
67252 <listitem>
67253 <para>
67254 &ndash;256
67255 </para>
67256 <para>
67257 The process timed out.
67258 </para>
67259 </listitem>
67260 <listitem>
67261 <para>
67262 &ndash;257
67263 </para>
67264 <para>
67265 The was some other error in wait(); <option>errno</option> is still set.
67266 </para>
67267 </listitem>
67268 </itemizedlist>
67269 </listitem></varlistentry>
67270 <varlistentry>
67271 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
67272 <listitem>
67273 <para>
67274 This function provide you with a means of submitting a new message to
67275 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
67276 want, but this packages it all up for you.) The function creates a pipe,
67277 forks a subprocess that is running
67278 </para>
67279 <literallayout class="monospaced">
67280 exim -t -oem -oi -f &lt;&gt;
67281 </literallayout>
67282 <para>
67283 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
67284 that is connected to the standard input. The yield of the function is the PID
67285 of the subprocess. You can then write a message to the file descriptor, with
67286 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
67287 </para>
67288 <para>
67289 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
67290 finish and to collect its ending status. A timeout value of zero is usually
67291 fine in this circumstance. Unless you have made a mistake with the recipient
67292 addresses, you should get a return code of zero.
67293 </para>
67294 </listitem></varlistentry>
67295 <varlistentry>
67296 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
67297 <listitem>
67298 <para>
67299 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
67300 that it runs is:
67301 </para>
67302 <literallayout>
67303 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
67304 </literallayout>
67305 <para>
67306 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
67307 </para>
67308 </listitem></varlistentry>
67309 <varlistentry>
67310 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
67311 <listitem>
67312 <para>
67313 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
67314 output is written to the standard error stream. If no debugging is selected,
67315 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
67316 conditional on the <literal>local_scan</literal> debug selector by coding like this:
67317 </para>
67318 <literallayout class="monospaced">
67319 if ((debug_selector &amp; D_local_scan) != 0)
67320   debug_printf("xxx", ...);
67321 </literallayout>
67322 </listitem></varlistentry>
67323 <varlistentry>
67324 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
67325 <listitem>
67326 <para>
67327 This is an interface to Exim&#x2019;s string expansion code. The return value is the
67328 expanded string, or NULL if there was an expansion failure.
67329 The C variable <option>expand_string_message</option> contains an error message after an
67330 expansion failure. If expansion does not change the string, the return value is
67331 the pointer to the input string. Otherwise, the return value points to a new
67332 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
67333 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
67334 </para>
67335 </listitem></varlistentry>
67336 <varlistentry>
67337 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
67338 <listitem>
67339 <para>
67340 This function allows you to an add additional header line at the end of the
67341 existing ones. The first argument is the type, and should normally be a space
67342 character. The second argument is a format string and any number of
67343 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
67344 if you want, and you must ensure that the string ends with a newline.
67345 </para>
67346 </listitem></varlistentry>
67347 <varlistentry>
67348 <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>
67349 <listitem>
67350 <para>
67351 This function adds a new header line at a specified point in the header
67352 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
67353 </para>
67354 <para>
67355 If <option>name</option> is NULL, the new header is added at the end of the chain if
67356 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
67357 NULL, the header lines are searched for the first non-deleted header that
67358 matches the name. If one is found, the new header is added before it if
67359 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
67360 found header and any adjacent subsequent ones with the same name (even if
67361 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
67362 option controls where the header is added. If it is true, addition is at the
67363 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
67364 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
67365 </para>
67366 <literallayout class="monospaced">
67367 header_add_at_position(TRUE, US"Received", TRUE,
67368   ' ', "X-xxx: ...");
67369 </literallayout>
67370 <para>
67371 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
67372 there may not be if <option>received_header_text</option> expands to an empty string.
67373 </para>
67374 </listitem></varlistentry>
67375 <varlistentry>
67376 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
67377 <listitem>
67378 <para>
67379 This function removes header lines. If <option>occurrence</option> is zero or negative, all
67380 occurrences of the header are removed. If occurrence is greater than zero, that
67381 particular instance of the header is removed. If no header(s) can be found that
67382 match the specification, the function does nothing.
67383 </para>
67384 </listitem></varlistentry>
67385 <varlistentry>
67386 <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>
67387 <listitem>
67388 <para>
67389 This function tests whether the given header has the given name. It is not just
67390 a string comparison, because white space is permitted between the name and the
67391 colon. If the <option>notdel</option> argument is true, a false return is forced for all
67392 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
67393 </para>
67394 <literallayout class="monospaced">
67395 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
67396 </literallayout>
67397 </listitem></varlistentry>
67398 <varlistentry>
67399 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
67400 <listitem>
67401 <para>
67402 <indexterm role="concept">
67403 <primary>base64 encoding</primary>
67404 <secondary>functions for <function>local_scan()</function> use</secondary>
67405 </indexterm>
67406 This function base64-encodes a string, which is passed by address and length.
67407 The text may contain bytes of any value, including zero. The result is passed
67408 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
67409 zero-terminated.
67410 </para>
67411 </listitem></varlistentry>
67412 <varlistentry>
67413 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
67414 <listitem>
67415 <para>
67416 This function decodes a base64-encoded string. Its arguments are a
67417 zero-terminated base64-encoded string and the address of a variable that is set
67418 to point to the result, which is in dynamic memory. The length of the decoded
67419 string is the yield of the function. If the input is invalid base64 data, the
67420 yield is -1. A zero byte is added to the end of the output string to make it
67421 easy to interpret as a C string (assuming it contains no zeros of its own). The
67422 added zero byte is not included in the returned count.
67423 </para>
67424 </listitem></varlistentry>
67425 <varlistentry>
67426 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
67427 <listitem>
67428 <para>
67429 This function checks for a match in a domain list. Domains are always
67430 matched caselessly. The return value is one of the following:
67431 </para>
67432 <informaltable frame="none">
67433 <tgroup cols="2" colsep="0" rowsep="0">
67434 <colspec colwidth="15*" align="left"/>
67435 <colspec colwidth="85*" align="left"/>
67436 <tbody>
67437 <row>
67438 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>OK</literal></entry>
67439 <entry>match succeeded</entry>
67440 </row>
67441 <row>
67442 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>FAIL</literal></entry>
67443 <entry>match failed</entry>
67444 </row>
67445 <row>
67446 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>DEFER</literal></entry>
67447 <entry>match deferred</entry>
67448 </row>
67449 </tbody>
67450 </tgroup>
67451 </informaltable>
67452 <para>
67453 DEFER is usually caused by some kind of lookup defer, such as the
67454 inability to contact a database.
67455 </para>
67456 </listitem></varlistentry>
67457 <varlistentry>
67458 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
67459 <listitem>
67460 <para>
67461 This function checks for a match in a local part list. The third argument
67462 controls case-sensitivity. The return values are as for
67463 <emphasis>lss_match_domain()</emphasis>.
67464 </para>
67465 </listitem></varlistentry>
67466 <varlistentry>
67467 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
67468 <listitem>
67469 <para>
67470 This function checks for a match in an address list. The third argument
67471 controls the case-sensitivity of the local part match. The domain is always
67472 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
67473 </para>
67474 </listitem></varlistentry>
67475 <varlistentry>
67476 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
67477 <listitem>
67478 <para>
67479 This function checks for a match in a host list. The most common usage is
67480 expected to be
67481 </para>
67482 <literallayout class="monospaced">
67483 lss_match_host(sender_host_name, sender_host_address, ...)
67484 </literallayout>
67485 <para>
67486 <indexterm role="variable">
67487 <primary><varname>$sender_host_address</varname></primary>
67488 </indexterm>
67489 An empty address field matches an empty item in the host list. If the host name
67490 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
67491 looked up if a host name is required to match an item in the list. The return
67492 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
67493 returns ERROR in the case when it had to look up a host name, but the lookup
67494 failed.
67495 </para>
67496 </listitem></varlistentry>
67497 <varlistentry>
67498 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
67499 <listitem>
67500 <para>
67501 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
67502 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
67503 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
67504 them. It specifies to which log or logs the message is written. The remaining
67505 arguments are a format and relevant insertion arguments. The string should not
67506 contain any newlines, not even at the end.
67507 </para>
67508 </listitem></varlistentry>
67509 <varlistentry>
67510 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
67511 <listitem>
67512 <para>
67513 This function adds an additional recipient to the message. The first argument
67514 is the recipient address. If it is unqualified (has no domain), it is qualified
67515 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
67516 </para>
67517 <para>
67518 This function does not allow you to specify a private <option>errors_to</option> address (as
67519 described with the structure of <option>recipient_item</option> above), because it pre-dates
67520 the addition of that field to the structure. However, it is easy to add such a
67521 value afterwards. For example:
67522 </para>
67523 <literallayout class="monospaced">
67524  receive_add_recipient(US"monitor@mydom.example", -1);
67525  recipients_list[recipients_count-1].errors_to =
67526    US"postmaster@mydom.example";
67527 </literallayout>
67528 </listitem></varlistentry>
67529 <varlistentry>
67530 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
67531 <listitem>
67532 <para>
67533 This is a convenience function to remove a named recipient from the list of
67534 recipients. It returns true if a recipient was removed, and false if no
67535 matching recipient could be found. The argument must be a complete email
67536 address.
67537 </para>
67538 </listitem></varlistentry>
67539 </variablelist>
67540 <para>
67541 <indexterm role="concept">
67542 <primary>RFC 2047</primary>
67543 </indexterm>
67544 </para>
67545 <variablelist>
67546 <varlistentry>
67547 <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>
67548 <listitem>
67549 <para>
67550 This function decodes strings that are encoded according to RFC 2047. Typically
67551 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
67552 from the Q or B encoding into a byte-string. Then, if provided with the name of
67553 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
67554 made  to translate the result to the named character set. If this fails, the
67555 binary string is returned with an error message.
67556 </para>
67557 <para>
67558 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
67559 maximum MIME word length is enforced. The third argument is the target
67560 encoding, or NULL if no translation is wanted.
67561 </para>
67562 <para>
67563 <indexterm role="concept">
67564 <primary>binary zero</primary>
67565 <secondary>in RFC 2047 decoding</secondary>
67566 </indexterm>
67567 <indexterm role="concept">
67568 <primary>RFC 2047</primary>
67569 <secondary>binary zero in</secondary>
67570 </indexterm>
67571 If a binary zero is encountered in the decoded string, it is replaced by the
67572 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
67573 not be 0 because header lines are handled as zero-terminated strings.
67574 </para>
67575 <para>
67576 The function returns the result of processing the string, zero-terminated; if
67577 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
67578 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
67579 </para>
67580 <para>
67581 If an error is encountered, the function returns NULL and uses the <option>error</option>
67582 argument to return an error message. The variable pointed to by <option>error</option> is
67583 set to NULL if there is no error; it may be set non-NULL even when the function
67584 returns a non-NULL value if decoding was successful, but there was a problem
67585 with translation.
67586 </para>
67587 </listitem></varlistentry>
67588 <varlistentry>
67589 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
67590 <listitem>
67591 <para>
67592 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
67593 below.
67594 </para>
67595 </listitem></varlistentry>
67596 <varlistentry>
67597 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,BOOL,&nbsp;...)</emphasis></term>
67598 <listitem>
67599 <para>
67600 The arguments of this function are almost like <function>printf()</function>; it writes to the SMTP
67601 output stream. You should use this function only when there is an SMTP output
67602 stream, that is, when the incoming message is being received via interactive
67603 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
67604 is FALSE. If you want to test for an incoming message from another host (as
67605 opposed to a local process that used the <option>-bs</option> command line option), you can
67606 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
67607 is involved.
67608 </para>
67609 <para>
67610 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
67611 output function, so it can be used for all forms of SMTP connection.
67612 </para>
67613 <para>
67614 The second argument is used to request that the data be buffered
67615 (when TRUE) or flushed (along with any previously buffered, when FALSE).
67616 This is advisory only, but likely to save on system-calls and packets
67617 sent when a sequence of calls to the function are made.
67618 </para>
67619 <para>
67620 The argument was added in Exim version 4.90 - changing the API/ABI.
67621 Nobody noticed until 4.93 was imminent, at which point the
67622 ABI version number was incremented.
67623 </para>
67624 <para>
67625 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
67626 must start with an appropriate response code: 550 if you are going to return
67627 LOCAL_SCAN_REJECT, 451 if you are going to return
67628 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
67629 initial lines of a multi-line response, the code must be followed by a hyphen
67630 to indicate that the line is not the final response line. You must also ensure
67631 that the lines you write terminate with CRLF. For example:
67632 </para>
67633 <literallayout class="monospaced">
67634 smtp_printf("550-this is some extra info\r\n");
67635 return LOCAL_SCAN_REJECT;
67636 </literallayout>
67637 <para>
67638 Note that you can also create multi-line responses by including newlines in
67639 the data returned via the <option>return_text</option> argument. The added value of using
67640 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
67641 multiple output lines.
67642 </para>
67643 <para>
67644 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
67645 does not
67646 guarantee a flush of
67647 pending output, and therefore does not test
67648 the state of the stream. (In the main code of Exim, flushing and error
67649 detection is done when Exim is ready for the next SMTP input command.) If
67650 you want to flush the output and check for an error (for example, the
67651 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
67652 arguments. It flushes the output stream, and returns a non-zero value if there
67653 is an error.
67654 </para>
67655 </listitem></varlistentry>
67656 <varlistentry>
67657 <term><emphasis role="bold">void&nbsp;*store_get(int,BOOL)</emphasis></term>
67658 <listitem>
67659 <para>
67660 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
67661 chunk of memory whose size is given by the first argument.
67662 The second argument should be given as TRUE if the memory will be used for
67663 data possibly coming from an attacker (eg. the message content),
67664 FALSE if it is locally-sourced.
67665 Exim bombs out if it ever
67666 runs out of memory. See the next section for a discussion of memory handling.
67667 </para>
67668 </listitem></varlistentry>
67669 <varlistentry>
67670 <term><emphasis role="bold">void&nbsp;*store_get_perm(int,BOOL)</emphasis></term>
67671 <listitem>
67672 <para>
67673 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
67674 permanent pool. See the next section for a discussion of memory handling.
67675 </para>
67676 </listitem></varlistentry>
67677 <varlistentry>
67678 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
67679 <listitem>
67680 <para>
67681 See below.
67682 </para>
67683 </listitem></varlistentry>
67684 <varlistentry>
67685 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
67686 <listitem>
67687 <para>
67688 See below.
67689 </para>
67690 </listitem></varlistentry>
67691 <varlistentry>
67692 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
67693 <listitem>
67694 <para>
67695 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
67696 The first makes a copy of an entire string. The second copies up to a maximum
67697 number of characters, indicated by the second argument. The third uses a format
67698 and insertion arguments to create a new string. In each case, the result is a
67699 pointer to a new string in the current memory pool. See the next section for
67700 more discussion.
67701 </para>
67702 </listitem></varlistentry>
67703 </variablelist>
67704 </section>
67705 <section id="SECTmemhanloc">
67706 <title>More about Exim&#x2019;s memory handling</title>
67707 <para>
67708 <indexterm role="concept">
67709 <primary><function>local_scan()</function> function</primary>
67710 <secondary>memory handling</secondary>
67711 </indexterm>
67712 No function is provided for freeing memory, because that is never needed.
67713 The dynamic memory that Exim uses when receiving a message is automatically
67714 recycled if another message is received by the same process (this applies only
67715 to incoming SMTP connections &ndash; other input methods can supply only one
67716 message at a time). After receiving the last message, a reception process
67717 terminates.
67718 </para>
67719 <para>
67720 Because it is recycled, the normal dynamic memory cannot be used for holding
67721 data that must be preserved over a number of incoming messages on the same SMTP
67722 connection. However, Exim in fact uses two pools of dynamic memory; the second
67723 one is not recycled, and can be used for this purpose.
67724 </para>
67725 <para>
67726 If you want to allocate memory that remains available for subsequent messages
67727 in the same SMTP connection, you should set
67728 </para>
67729 <literallayout class="monospaced">
67730 store_pool = POOL_PERM
67731 </literallayout>
67732 <para>
67733 before calling the function that does the allocation. There is no need to
67734 restore the value if you do not need to; however, if you do want to revert to
67735 the normal pool, you can either restore the previous value of <option>store_pool</option> or
67736 set it explicitly to POOL_MAIN.
67737 </para>
67738 <para>
67739 The pool setting applies to all functions that get dynamic memory, including
67740 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
67741 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
67742 block of memory from the permanent pool while preserving the value of
67743 <option>store_pool</option>.
67744 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
67745 </para>
67746 </section>
67747 </chapter>
67748
67749 <chapter id="CHAPsystemfilter">
67750 <title>System-wide message filtering</title>
67751 <para>
67752 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
67753 <primary>filter</primary>
67754 <secondary>system filter</secondary>
67755 </indexterm>
67756 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
67757 <primary>filtering all mail</primary>
67758 </indexterm>
67759 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
67760 <primary>system filter</primary>
67761 </indexterm>
67762 The previous chapters (on ACLs and the local scan function) describe checks
67763 that can be applied to messages before they are accepted by a host. There is
67764 also a mechanism for checking messages once they have been received, but before
67765 they are delivered. This is called the <emphasis>system filter</emphasis>.
67766 </para>
67767 <para>
67768 The system filter operates in a similar manner to users&#x2019; filter files, but it
67769 is run just once per message (however many recipients the message has).
67770 It should not normally be used as a substitute for routing, because <option>deliver</option>
67771 commands in a system router provide new envelope recipient addresses.
67772 The system filter must be an Exim filter. It cannot be a Sieve filter.
67773 </para>
67774 <para>
67775 The system filter is run at the start of a delivery attempt, before any routing
67776 is done. If a message fails to be completely delivered at the first attempt,
67777 the system filter is run again at the start of every retry.
67778 If you want your filter to do something only once per message, you can make use
67779 <indexterm role="concept">
67780 <primary>retry</primary>
67781 <secondary>condition</secondary>
67782 </indexterm>
67783 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
67784 prevent it happening on retries.
67785 </para>
67786 <para>
67787 <indexterm role="variable">
67788 <primary><varname>$domain</varname></primary>
67789 </indexterm>
67790 <indexterm role="variable">
67791 <primary><varname>$local_part</varname></primary>
67792 </indexterm>
67793 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
67794 specific to individual recipient addresses, such as <varname>$local_part</varname> and
67795 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
67796 you want to run a centrally-specified filter for each recipient address
67797 independently, you can do so by setting up a suitable <command>redirect</command> router, as
67798 described in section <xref linkend="SECTperaddfil"/> below.
67799 </para>
67800 <section id="SECID212">
67801 <title>Specifying a system filter</title>
67802 <para>
67803 <indexterm role="concept">
67804 <primary>uid (user id)</primary>
67805 <secondary>system filter</secondary>
67806 </indexterm>
67807 <indexterm role="concept">
67808 <primary>gid (group id)</primary>
67809 <secondary>system filter</secondary>
67810 </indexterm>
67811 The name of the file that contains the system filter must be specified by
67812 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
67813 other than root, you must also set <option>system_filter_user</option> and
67814 <option>system_filter_group</option> as appropriate. For example:
67815 </para>
67816 <literallayout class="monospaced">
67817 system_filter = /etc/mail/exim.filter
67818 system_filter_user = exim
67819 </literallayout>
67820 <para>
67821 If a system filter generates any deliveries directly to files or pipes (via the
67822 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
67823 specified by setting <option>system_filter_file_transport</option> and
67824 <option>system_filter_pipe_transport</option>, respectively. Similarly,
67825 <option>system_filter_reply_transport</option> must be set to handle any messages generated
67826 by the <option>reply</option> command.
67827 </para>
67828 </section>
67829 <section id="SECID213">
67830 <title>Testing a system filter</title>
67831 <para>
67832 You can run simple tests of a system filter in the same way as for a user
67833 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
67834 are permitted only in system filters are recognized.
67835 </para>
67836 <para>
67837 If you want to test the combined effect of a system filter and a user filter,
67838 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
67839 </para>
67840 </section>
67841 <section id="SECID214">
67842 <title>Contents of a system filter</title>
67843 <para>
67844 The language used to specify system filters is the same as for users&#x2019; filter
67845 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
67846 mail filtering</emphasis>. However, there are some additional features that are
67847 available only in system filters; these are described in subsequent sections.
67848 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
67849 they cause errors.
67850 </para>
67851 <para>
67852 <indexterm role="concept">
67853 <primary>frozen messages</primary>
67854 <secondary>manual thaw; testing in filter</secondary>
67855 </indexterm>
67856 There are two special conditions which, though available in users&#x2019; filter
67857 files, are designed for use in system filters. The condition <option>first_delivery</option>
67858 is true only for the first attempt at delivering a message, and
67859 <option>manually_thawed</option> is true only if the message has been frozen, and
67860 subsequently thawed by an admin user. An explicit forced delivery counts as a
67861 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
67862 </para>
67863 <para>
67864 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
67865 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
67866 succeed, it will not be tried again.
67867 If you want Exim to retry an unseen delivery until it succeeds, you should
67868 arrange to set it up every time the filter runs.
67869 </para>
67870 <para>
67871 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
67872 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
67873 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
67874 to which users&#x2019; filter files can refer.
67875 </para>
67876 </section>
67877 <section id="SECID215">
67878 <title>Additional variable for system filters</title>
67879 <para>
67880 <indexterm role="variable">
67881 <primary><varname>$recipients</varname></primary>
67882 </indexterm>
67883 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
67884 of the message (separated by commas and white space), is available in system
67885 filters. It is not available in users&#x2019; filters for privacy reasons.
67886 </para>
67887 </section>
67888 <section id="SECID216">
67889 <title>Defer, freeze, and fail commands for system filters</title>
67890 <para>
67891 <indexterm role="concept">
67892 <primary>freezing messages</primary>
67893 </indexterm>
67894 <indexterm role="concept">
67895 <primary>message</primary>
67896 <secondary>freezing</secondary>
67897 </indexterm>
67898 <indexterm role="concept">
67899 <primary>message</primary>
67900 <secondary>forced failure</secondary>
67901 </indexterm>
67902 <indexterm role="concept">
67903 <primary><option>fail</option></primary>
67904 <secondary>in system filter</secondary>
67905 </indexterm>
67906 <indexterm role="concept">
67907 <primary><option>freeze</option> in system filter</primary>
67908 </indexterm>
67909 <indexterm role="concept">
67910 <primary><option>defer</option> in system filter</primary>
67911 </indexterm>
67912 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
67913 always available in system filters, but are not normally enabled in users&#x2019;
67914 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
67915 for the <command>redirect</command> router.) These commands can optionally be followed by the
67916 word <option>text</option> and a string containing an error message, for example:
67917 </para>
67918 <literallayout class="monospaced">
67919 fail text "this message looks like spam to me"
67920 </literallayout>
67921 <para>
67922 The keyword <option>text</option> is optional if the next character is a double quote.
67923 </para>
67924 <para>
67925 The <option>defer</option> command defers delivery of the original recipients of the
67926 message. The <option>fail</option> command causes all the original recipients to be failed,
67927 and a bounce message to be created. The <option>freeze</option> command suspends all
67928 delivery attempts for the original recipients. In all cases, any new deliveries
67929 that are specified by the filter are attempted as normal after the filter has
67930 run.
67931 </para>
67932 <para>
67933 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
67934 not manually frozen since. This means that automatic freezing by a system
67935 filter can be used as a way of checking out suspicious messages. If a message
67936 is found to be all right, manually unfreezing it allows it to be delivered.
67937 </para>
67938 <para>
67939 <indexterm role="concept">
67940 <primary>log</primary>
67941 <secondary><option>fail</option> command log line</secondary>
67942 </indexterm>
67943 <indexterm role="concept">
67944 <primary><option>fail</option></primary>
67945 <secondary>log line; reducing</secondary>
67946 </indexterm>
67947 The text given with a fail command is used as part of the bounce message as
67948 well as being written to the log. If the message is quite long, this can fill
67949 up a lot of log space when such failures are common. To reduce the size of the
67950 log message, Exim interprets the text in a special way if it starts with the
67951 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
67952 strings is written to the log, and the rest of the text is used in the bounce
67953 message. For example:
67954 </para>
67955 <literallayout class="monospaced">
67956 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
67957      because it contains attachments that we are \
67958      not prepared to receive."
67959 </literallayout>
67960 <para>
67961 <indexterm role="concept">
67962 <primary>loop</primary>
67963 <secondary>caused by <option>fail</option></secondary>
67964 </indexterm>
67965 Take great care with the <option>fail</option> command when basing the decision to fail on
67966 the contents of the message, because the bounce message will of course include
67967 the contents of the original message and will therefore trigger the <option>fail</option>
67968 command again (causing a mail loop) unless steps are taken to prevent this.
67969 Testing the <option>error_message</option> condition is one way to prevent this. You could
67970 use, for example
67971 </para>
67972 <literallayout class="monospaced">
67973 if $message_body contains "this is spam" and not error_message
67974 then fail text "spam is not wanted here" endif
67975 </literallayout>
67976 <para>
67977 though of course that might let through unwanted bounce messages. The
67978 alternative is clever checking of the body and/or headers to detect bounces
67979 generated by the filter.
67980 </para>
67981 <para>
67982 The interpretation of a system filter file ceases after a
67983 <option>defer</option>,
67984 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
67985 set up earlier in the filter file are honoured, so you can use a sequence such
67986 as
67987 </para>
67988 <literallayout class="monospaced">
67989 mail ...
67990 freeze
67991 </literallayout>
67992 <para>
67993 to send a specified message when the system filter is freezing (or deferring or
67994 failing) a message. The normal deliveries for the message do not, of course,
67995 take place.
67996 </para>
67997 </section>
67998 <section id="SECTaddremheasys">
67999 <title>Adding and removing headers in a system filter</title>
68000 <para>
68001 <indexterm role="concept">
68002 <primary>header lines</primary>
68003 <secondary>adding; in system filter</secondary>
68004 </indexterm>
68005 <indexterm role="concept">
68006 <primary>header lines</primary>
68007 <secondary>removing; in system filter</secondary>
68008 </indexterm>
68009 <indexterm role="concept">
68010 <primary>filter</primary>
68011 <secondary>header lines; adding/removing</secondary>
68012 </indexterm>
68013 Two filter commands that are available only in system filters are:
68014 </para>
68015 <literallayout class="monospaced">
68016 headers add &lt;string&gt;
68017 headers remove &lt;string&gt;
68018 </literallayout>
68019 <para>
68020 The argument for the <option>headers add</option> is a string that is expanded and then
68021 added to the end of the message&#x2019;s headers. It is the responsibility of the
68022 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
68023 space is ignored, and if the string is otherwise empty, or if the expansion is
68024 forced to fail, the command has no effect.
68025 </para>
68026 <para>
68027 You can use <quote>\n</quote> within the string, followed by white space, to specify
68028 continued header lines. More than one header may be added in one command by
68029 including <quote>\n</quote> within the string without any following white space. For
68030 example:
68031 </para>
68032 <literallayout class="monospaced">
68033 headers add "X-header-1: ....\n  \
68034              continuation of X-header-1 ...\n\
68035              X-header-2: ...."
68036 </literallayout>
68037 <para>
68038 Note that the header line continuation white space after the first newline must
68039 be placed before the backslash that continues the input string, because white
68040 space after input continuations is ignored.
68041 </para>
68042 <para>
68043 The argument for <option>headers remove</option> is a colon-separated list of header names.
68044 This command applies only to those headers that are stored with the message;
68045 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
68046 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
68047 header with the same name, they are all removed.
68048 </para>
68049 <para>
68050 The <option>headers</option> command in a system filter makes an immediate change to the set
68051 of header lines that was received with the message (with possible additions
68052 from ACL processing). Subsequent commands in the system filter operate on the
68053 modified set, which also forms the basis for subsequent message delivery.
68054 Unless further modified during routing or transporting, this set of headers is
68055 used for all recipients of the message.
68056 </para>
68057 <para>
68058 During routing and transporting, the variables that refer to the contents of
68059 header lines refer only to those lines that are in this set. Thus, header lines
68060 that are added by a system filter are visible to users&#x2019; filter files and to all
68061 routers and transports. This contrasts with the manipulation of header lines by
68062 routers and transports, which is not immediate, but which instead is saved up
68063 until the message is actually being written (see section
68064 <xref linkend="SECTheadersaddrem"/>).
68065 </para>
68066 <para>
68067 If the message is not delivered at the first attempt, header lines that were
68068 added by the system filter are stored with the message, and so are still
68069 present at the next delivery attempt. Header lines that were removed are still
68070 present, but marked <quote>deleted</quote> so that they are not transported with the
68071 message. For this reason, it is usual to make the <option>headers</option> command
68072 conditional on <option>first_delivery</option> so that the set of header lines is not
68073 modified more than once.
68074 </para>
68075 <para>
68076 Because header modification in a system filter acts immediately, you have to
68077 use an indirect approach if you want to modify the contents of a header line.
68078 For example:
68079 </para>
68080 <literallayout class="monospaced">
68081 headers add "Old-Subject: $h_subject:"
68082 headers remove "Subject"
68083 headers add "Subject: new subject (was: $h_old-subject:)"
68084 headers remove "Old-Subject"
68085 </literallayout>
68086 </section>
68087 <section id="SECID217">
68088 <title>Setting an errors address in a system filter</title>
68089 <para>
68090 <indexterm role="concept">
68091 <primary>envelope from</primary>
68092 </indexterm>
68093 <indexterm role="concept">
68094 <primary>envelope sender</primary>
68095 </indexterm>
68096 In a system filter, if a <option>deliver</option> command is followed by
68097 </para>
68098 <literallayout class="monospaced">
68099 errors_to &lt;some address&gt;
68100 </literallayout>
68101 <para>
68102 in order to change the envelope sender (and hence the error reporting) for that
68103 delivery, any address may be specified. (In a user filter, only the current
68104 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
68105 might use
68106 </para>
68107 <literallayout class="monospaced">
68108 unseen deliver monitor@spying.example errors_to root@local.example
68109 </literallayout>
68110 <para>
68111 to take a copy which would not be sent back to the normal error reporting
68112 address if its delivery failed.
68113 </para>
68114 </section>
68115 <section id="SECTperaddfil">
68116 <title>Per-address filtering</title>
68117 <para>
68118 <indexterm role="variable">
68119 <primary><varname>$domain_data</varname></primary>
68120 </indexterm>
68121 <indexterm role="variable">
68122 <primary><varname>$local_part_data</varname></primary>
68123 </indexterm>
68124 In contrast to the system filter, which is run just once per message for each
68125 delivery attempt, it is also possible to set up a system-wide filtering
68126 operation that runs once for each recipient address. In this case, variables
68127 such as <varname>$local_part_data</varname> and <varname>$domain_data</varname> can be used,
68128 and indeed, the choice of filter file could be made dependent on them.
68129 This is an example of a router which implements such a filter:
68130 </para>
68131 <literallayout class="monospaced">
68132 central_filter:
68133   check_local_user
68134   driver = redirect
68135   domains = +local_domains
68136   file = /central/filters/$local_part_data
68137   no_verify
68138   allow_filter
68139   allow_freeze
68140 </literallayout>
68141 <para>
68142 The filter is run in a separate process under its own uid. Therefore, either
68143 <option>check_local_user</option> must be set (as above), in which case the filter is run as
68144 the local user, or the <option>user</option> option must be used to specify which user to
68145 use. If both are set, <option>user</option> overrides.
68146 </para>
68147 <para>
68148 Care should be taken to ensure that none of the commands in the filter file
68149 specify a significant delivery if the message is to go on to be delivered to
68150 its intended recipient. The router will not then claim to have dealt with the
68151 address, so it will be passed on to subsequent routers to be delivered in the
68152 normal way.
68153 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
68154 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
68155 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
68156 </para>
68157 </section>
68158 </chapter>
68159
68160 <chapter id="CHAPmsgproc">
68161 <title>Message processing</title>
68162 <para>
68163 <indexterm role="concept" id="IIDmesproc" class="startofrange">
68164 <primary>message</primary>
68165 <secondary>general processing</secondary>
68166 </indexterm>
68167 Exim performs various transformations on the sender and recipient addresses of
68168 all messages that it handles, and also on the messages&#x2019; header lines. Some of
68169 these are optional and configurable, while others always take place. All of
68170 this processing, except rewriting as a result of routing, and the addition or
68171 removal of header lines while delivering, happens when a message is received,
68172 before it is placed on Exim&#x2019;s queue.
68173 </para>
68174 <para>
68175 Some of the automatic processing takes place by default only for
68176 <quote>locally-originated</quote> messages. This adjective is used to describe messages
68177 that are not received over TCP/IP, but instead are passed to an Exim process on
68178 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
68179 set up by the <option>-bs</option> command line option.
68180 </para>
68181 <para>
68182 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
68183 or ::1) are not considered to be locally-originated. Exim does not treat the
68184 loopback interface specially in any way.
68185 </para>
68186 <para>
68187 If you want the loopback interface to be treated specially, you must ensure
68188 that there are appropriate entries in your ACLs.
68189 </para>
68190 <section id="SECTsubmodnon">
68191 <title>Submission mode for non-local messages</title>
68192 <para>
68193 <indexterm role="concept">
68194 <primary>message</primary>
68195 <secondary>submission</secondary>
68196 </indexterm>
68197 <indexterm role="concept">
68198 <primary>submission mode</primary>
68199 </indexterm>
68200 Processing that happens automatically for locally-originated messages (unless
68201 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
68202 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
68203 state. Submission mode is set by the modifier
68204 </para>
68205 <literallayout class="monospaced">
68206 control = submission
68207 </literallayout>
68208 <para>
68209 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
68210 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
68211 a local submission, and is normally used when the source of the message is
68212 known to be an MUA running on a client host (as opposed to an MTA). For
68213 example, to set submission mode for messages originating on the IPv4 loopback
68214 interface, you could include the following in the MAIL ACL:
68215 </para>
68216 <literallayout class="monospaced">
68217 warn  hosts = 127.0.0.1
68218       control = submission
68219 </literallayout>
68220 <para>
68221 <indexterm role="concept">
68222 <primary><option>sender_retain</option> submission option</primary>
68223 </indexterm>
68224 There are some options that can be used when setting submission mode. A slash
68225 is used to separate options. For example:
68226 </para>
68227 <literallayout class="monospaced">
68228 control = submission/sender_retain
68229 </literallayout>
68230 <para>
68231 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
68232 true and <option>local_from_check</option> false for the current incoming message. The first
68233 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
68234 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
68235 authenticated sender. With this setting, Exim still fixes up messages by adding
68236 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
68237 attempt to check sender authenticity in header lines.
68238 </para>
68239 <para>
68240 When <option>sender_retain</option> is not set, a submission mode setting may specify a
68241 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
68242 example:
68243 </para>
68244 <literallayout class="monospaced">
68245 control = submission/domain=some.domain
68246 </literallayout>
68247 <para>
68248 The domain may be empty. How this value is used is described in sections
68249 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
68250 that allows you to specify the user&#x2019;s full name for inclusion in a created
68251 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
68252 </para>
68253 <literallayout class="monospaced">
68254 accept authenticated = *
68255        control = submission/domain=wonderland.example/\
68256                             name=${lookup {$authenticated_id} \
68257                                    lsearch {/etc/exim/namelist}}
68258 </literallayout>
68259 <para>
68260 Because the name may contain any characters, including slashes, the <option>name</option>
68261 option must be given last. The remainder of the string is used as the name. For
68262 the example above, if <filename>/etc/exim/namelist</filename> contains:
68263 </para>
68264 <literallayout class="monospaced">
68265 bigegg:  Humpty Dumpty
68266 </literallayout>
68267 <para>
68268 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
68269 line would be:
68270 </para>
68271 <literallayout class="monospaced">
68272 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
68273 </literallayout>
68274 <para>
68275 <indexterm role="concept">
68276 <primary>return path</primary>
68277 <secondary>in submission mode</secondary>
68278 </indexterm>
68279 By default, submission mode forces the return path to the same address as is
68280 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
68281 specified, the return path is also left unchanged.
68282 </para>
68283 <para>
68284 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
68285 ACL. This means that any sender checks performed before the fix-ups use the
68286 untrusted sender address specified by the user, not the trusted sender address
68287 specified by submission mode. Although this might be slightly unexpected, it
68288 does mean that you can configure ACL checks to spot that a user is trying to
68289 spoof another&#x2019;s address.
68290 </para>
68291 </section>
68292 <section id="SECTlineendings">
68293 <title>Line endings</title>
68294 <para>
68295 <indexterm role="concept">
68296 <primary>line endings</primary>
68297 </indexterm>
68298 <indexterm role="concept">
68299 <primary>carriage return</primary>
68300 </indexterm>
68301 <indexterm role="concept">
68302 <primary>linefeed</primary>
68303 </indexterm>
68304 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
68305 linefeed) is the line ending for messages transmitted over the Internet using
68306 SMTP over TCP/IP. However, within individual operating systems, different
68307 conventions are used. For example, Unix-like systems use just LF, but others
68308 use CRLF or just CR.
68309 </para>
68310 <para>
68311 Exim was designed for Unix-like systems, and internally, it stores messages
68312 using the system&#x2019;s convention of a single LF as a line terminator. When
68313 receiving a message, all line endings are translated to this standard format.
68314 Originally, it was thought that programs that passed messages directly to an
68315 MTA within an operating system would use that system&#x2019;s convention. Experience
68316 has shown that this is not the case; for example, there are Unix applications
68317 that use CRLF in this circumstance. For this reason, and for compatibility with
68318 other MTAs, the way Exim handles line endings for all messages is now as
68319 follows:
68320 </para>
68321 <itemizedlist>
68322 <listitem>
68323 <para>
68324 LF not preceded by CR is treated as a line ending.
68325 </para>
68326 </listitem>
68327 <listitem>
68328 <para>
68329 CR is treated as a line ending; if it is immediately followed by LF, the LF
68330 is ignored.
68331 </para>
68332 </listitem>
68333 <listitem>
68334 <para>
68335 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
68336 nor a local message in the state where a line containing only a dot is a
68337 terminator.
68338 </para>
68339 </listitem>
68340 <listitem>
68341 <para>
68342 If a bare CR is encountered within a header line, an extra space is added after
68343 the line terminator so as not to end the header line. The reasoning behind this
68344 is that bare CRs in header lines are most likely either to be mistakes, or
68345 people trying to play silly games.
68346 </para>
68347 </listitem>
68348 <listitem>
68349 <para>
68350 If the first header line received in a message ends with CRLF, a subsequent
68351 bare LF in a header line is treated in the same way as a bare CR in a header
68352 line.
68353 </para>
68354 </listitem>
68355 </itemizedlist>
68356 </section>
68357 <section id="SECID218">
68358 <title>Unqualified addresses</title>
68359 <para>
68360 <indexterm role="concept">
68361 <primary>unqualified addresses</primary>
68362 </indexterm>
68363 <indexterm role="concept">
68364 <primary>address</primary>
68365 <secondary>qualification</secondary>
68366 </indexterm>
68367 By default, Exim expects every envelope address it receives from an external
68368 host to be fully qualified. Unqualified addresses cause negative responses to
68369 SMTP commands. However, because SMTP is used as a means of transporting
68370 messages from MUAs running on personal workstations, there is sometimes a
68371 requirement to accept unqualified addresses from specific hosts or IP networks.
68372 </para>
68373 <para>
68374 Exim has two options that separately control which hosts may send unqualified
68375 sender or recipient addresses in SMTP commands, namely
68376 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
68377 cases, if an unqualified address is accepted, it is qualified by adding the
68378 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
68379 </para>
68380 <para>
68381 <indexterm role="option">
68382 <primary><option>qualify_domain</option></primary>
68383 </indexterm>
68384 <indexterm role="option">
68385 <primary><option>qualify_recipient</option></primary>
68386 </indexterm>
68387 Unqualified addresses in header lines are automatically qualified for messages
68388 that are locally originated, unless the <option>-bnq</option> option is given on the command
68389 line. For messages received over SMTP, unqualified addresses in header lines
68390 are qualified only if unqualified addresses are permitted in SMTP commands. In
68391 other words, such qualification is also controlled by
68392 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
68393 </para>
68394 </section>
68395 <section id="SECID219">
68396 <title>The UUCP From line</title>
68397 <para>
68398 <indexterm role="concept">
68399 <primary><quote>From</quote> line</primary>
68400 </indexterm>
68401 <indexterm role="concept">
68402 <primary>UUCP</primary>
68403 <secondary><quote>From</quote> line</secondary>
68404 </indexterm>
68405 <indexterm role="concept">
68406 <primary>sender</primary>
68407 <secondary>address</secondary>
68408 </indexterm>
68409 <indexterm role="option">
68410 <primary><option>uucp_from_pattern</option></primary>
68411 </indexterm>
68412 <indexterm role="option">
68413 <primary><option>uucp_from_sender</option></primary>
68414 </indexterm>
68415 <indexterm role="concept">
68416 <primary>envelope from</primary>
68417 </indexterm>
68418 <indexterm role="concept">
68419 <primary>envelope sender</primary>
68420 </indexterm>
68421 <indexterm role="concept">
68422 <primary>Sendmail compatibility</primary>
68423 <secondary><quote>From</quote> line</secondary>
68424 </indexterm>
68425 Messages that have come from UUCP (and some other applications) often begin
68426 with a line containing the envelope sender and a timestamp, following the word
68427 <quote>From</quote>. Examples of two common formats are:
68428 </para>
68429 <literallayout class="monospaced">
68430 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
68431 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
68432 </literallayout>
68433 <para>
68434 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
68435 Exim recognizes such lines at the start of messages that are submitted to it
68436 via the command line (that is, on the standard input). It does not recognize
68437 such lines in incoming SMTP messages, unless the sending host matches
68438 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
68439 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
68440 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
68441 default value matches the two common cases shown above and puts the address
68442 that follows <quote>From</quote> into <varname>$1</varname>.
68443 </para>
68444 <para>
68445 <indexterm role="concept">
68446 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
68447 <secondary>in <quote>From </quote> line handling</secondary>
68448 </indexterm>
68449 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
68450 a trusted user, the message&#x2019;s sender address is constructed by expanding the
68451 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
68452 then parsed as an RFC 2822 address. If there is no domain, the local part is
68453 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
68454 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
68455 </para>
68456 <para>
68457 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
68458 sender address is not changed. This is also the case for incoming SMTP messages
68459 that are permitted to contain <quote>From</quote> lines.
68460 </para>
68461 <para>
68462 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
68463 treated as a data line that starts the body of the message, as it is not valid
68464 as a header line. This also happens if a <quote>From</quote> line is present in an
68465 incoming SMTP message from a source that is not permitted to send them.
68466 </para>
68467 </section>
68468 <section>
68469 <title>Header lines</title>
68470 <section id="SECID220">
68471 <title>Resent- header lines</title>
68472 <para>
68473 <indexterm role="concept">
68474 <primary><emphasis>Resent-</emphasis> header line</primary>
68475 </indexterm>
68476 <indexterm role="concept">
68477 <primary>header lines</primary>
68478 <secondary>Resent-</secondary>
68479 </indexterm>
68480 RFC 2822 makes provision for sets of header lines starting with the string
68481 <literal>Resent-</literal> to be added to a message when it is resent by the original
68482 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
68483 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
68484 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
68485 </para>
68486 <blockquote>
68487 <para>
68488 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
68489 processing of replies or other such automatic actions on messages.</emphasis>
68490 </para>
68491 </blockquote>
68492 <para>
68493 This leaves things a bit vague as far as other processing actions such as
68494 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
68495 follows:
68496 </para>
68497 <itemizedlist>
68498 <listitem>
68499 <para>
68500 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
68501 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
68502 </para>
68503 </listitem>
68504 <listitem>
68505 <para>
68506 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
68507 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
68508 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
68509 </para>
68510 </listitem>
68511 <listitem>
68512 <para>
68513 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
68514 also removed.
68515 </para>
68516 </listitem>
68517 <listitem>
68518 <para>
68519 For a locally-submitted message,
68520 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
68521 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
68522 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
68523 included in log lines in this case.
68524 </para>
68525 </listitem>
68526 <listitem>
68527 <para>
68528 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
68529 <option>Resent-</option> header lines are present.
68530 </para>
68531 </listitem>
68532 </itemizedlist>
68533 </section>
68534 <section id="SECID221">
68535 <title>Auto-Submitted:</title>
68536 <para>
68537 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
68538 includes the header line:
68539 </para>
68540 <literallayout class="monospaced">
68541 Auto-Submitted: auto-replied
68542 </literallayout>
68543 </section>
68544 <section id="SECID222">
68545 <title>Bcc:</title>
68546 <para>
68547 <indexterm role="concept">
68548 <primary><emphasis>Bcc:</emphasis> header line</primary>
68549 </indexterm>
68550 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
68551 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
68552 extracting its addresses). If <option>-t</option> is not present on the command line, any
68553 existing <emphasis>Bcc:</emphasis> is not removed.
68554 </para>
68555 </section>
68556 <section id="SECID223">
68557 <title>Date:</title>
68558 <para>
68559 <indexterm role="concept">
68560 <primary>Date:</primary>
68561 </indexterm>
68562 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
68563 Exim adds one, using the current date and time, unless the
68564 <option>suppress_local_fixups</option> control has been specified.
68565 </para>
68566 </section>
68567 <section id="SECID224">
68568 <title>Delivery-date:</title>
68569 <para>
68570 <indexterm role="concept">
68571 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
68572 </indexterm>
68573 <indexterm role="option">
68574 <primary><option>delivery_date_remove</option></primary>
68575 </indexterm>
68576 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
68577 set. Exim can be configured to add them to the final delivery of messages. (See
68578 the generic <option>delivery_date_add</option> transport option.) They should not be present
68579 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
68580 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
68581 messages.
68582 </para>
68583 </section>
68584 <section id="SECID225">
68585 <title>Envelope-to:</title>
68586 <para>
68587 <indexterm role="concept">
68588 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
68589 </indexterm>
68590 <indexterm role="concept">
68591 <primary>header lines</primary>
68592 <secondary>Envelope-to:</secondary>
68593 </indexterm>
68594 <indexterm role="option">
68595 <primary><option>envelope_to_remove</option></primary>
68596 </indexterm>
68597 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
68598 Exim can be configured to add them to the final delivery of messages. (See the
68599 generic <option>envelope_to_add</option> transport option.) They should not be present in
68600 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
68601 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
68602 messages.
68603 </para>
68604 </section>
68605 <section id="SECTthefrohea">
68606 <title>From:</title>
68607 <para>
68608 <indexterm role="concept">
68609 <primary><emphasis>From:</emphasis> header line</primary>
68610 </indexterm>
68611 <indexterm role="concept">
68612 <primary>header lines</primary>
68613 <secondary>From:</secondary>
68614 </indexterm>
68615 <indexterm role="concept">
68616 <primary>Sendmail compatibility</primary>
68617 <secondary><quote>From</quote> line</secondary>
68618 </indexterm>
68619 <indexterm role="concept">
68620 <primary>message</primary>
68621 <secondary>submission</secondary>
68622 </indexterm>
68623 <indexterm role="concept">
68624 <primary>submission mode</primary>
68625 </indexterm>
68626 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
68627 adds one if either of the following conditions is true:
68628 </para>
68629 <itemizedlist>
68630 <listitem>
68631 <para>
68632 The envelope sender address is not empty (that is, this is not a bounce
68633 message). The added header line copies the envelope sender address.
68634 </para>
68635 </listitem>
68636 <listitem>
68637 <para>
68638 <indexterm role="variable">
68639 <primary><varname>$authenticated_id</varname></primary>
68640 </indexterm>
68641 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
68642 </para>
68643 <orderedlist numeration="arabic">
68644 <listitem>
68645 <para>
68646 <indexterm role="variable">
68647 <primary><varname>$qualify_domain</varname></primary>
68648 </indexterm>
68649 If no domain is specified by the submission control, the local part is
68650 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
68651 </para>
68652 </listitem>
68653 <listitem>
68654 <para>
68655 If a non-empty domain is specified by the submission control, the local
68656 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
68657 </para>
68658 </listitem>
68659 <listitem>
68660 <para>
68661 If an empty domain is specified by the submission control,
68662 <varname>$authenticated_id</varname> is assumed to be the complete address.
68663 </para>
68664 </listitem>
68665 </orderedlist>
68666 </listitem>
68667 </itemizedlist>
68668 <para>
68669 A non-empty envelope sender takes precedence.
68670 </para>
68671 <para>
68672 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
68673 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
68674 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
68675 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
68676 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
68677 <option>unknown_login</option> configuration option). The address is qualified with
68678 <option>qualify_domain</option>.
68679 </para>
68680 <para>
68681 For compatibility with Sendmail, if an incoming, non-SMTP message has a
68682 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
68683 user, this is replaced by an address containing the user&#x2019;s login name and full
68684 name as described in section <xref linkend="SECTconstr"/>.
68685 </para>
68686 </section>
68687 <section id="SECID226">
68688 <title>Message-ID:</title>
68689 <para>
68690 <indexterm role="concept">
68691 <primary><emphasis>Message-ID:</emphasis> header line</primary>
68692 </indexterm>
68693 <indexterm role="concept">
68694 <primary>header lines</primary>
68695 <secondary>Message-ID:</secondary>
68696 </indexterm>
68697 <indexterm role="concept">
68698 <primary>message</primary>
68699 <secondary>submission</secondary>
68700 </indexterm>
68701 <indexterm role="option">
68702 <primary><option>message_id_header_text</option></primary>
68703 </indexterm>
68704 If a locally-generated or submission-mode incoming message does not contain a
68705 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
68706 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
68707 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
68708 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
68709 message id, preceded by the letter E to ensure it starts with a letter, and
68710 followed by @ and the primary host name. Additional information can be included
68711 in this header line by setting the <option>message_id_header_text</option> and/or
68712 <option>message_id_header_domain</option> options.
68713 </para>
68714 </section>
68715 <section id="SECID227">
68716 <title>Received:</title>
68717 <para>
68718 <indexterm role="concept">
68719 <primary><emphasis>Received:</emphasis> header line</primary>
68720 </indexterm>
68721 <indexterm role="concept">
68722 <primary>header lines</primary>
68723 <secondary>Received:</secondary>
68724 </indexterm>
68725 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
68726 contents are defined by the <option>received_header_text</option> configuration option, and
68727 Exim automatically adds a semicolon and a timestamp to the configured string.
68728 </para>
68729 <para>
68730 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
68731 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
68732 line is the time that the message started to be received. This is the value
68733 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
68734 </para>
68735 <para>
68736 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
68737 changed to the time of acceptance, which is (apart from a small delay while the
68738 -H spool file is written) the earliest time at which delivery could start.
68739 </para>
68740 </section>
68741 <section id="SECID228">
68742 <title>References:</title>
68743 <para>
68744 <indexterm role="concept">
68745 <primary><emphasis>References:</emphasis> header line</primary>
68746 </indexterm>
68747 <indexterm role="concept">
68748 <primary>header lines</primary>
68749 <secondary>References:</secondary>
68750 </indexterm>
68751 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
68752 header line. This is constructed according to the rules that are described in
68753 section 3.64 of RFC 2822 (which states that replies should contain such a
68754 header line), and section 3.14 of RFC 3834 (which states that automatic
68755 responses are not different in this respect). However, because some mail
68756 processing software does not cope well with very long header lines, no more
68757 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
68758 incoming message. If there are more than 12, the first one and then the final
68759 11 are copied, before adding the message ID of the incoming message.
68760 </para>
68761 </section>
68762 <section id="SECID229">
68763 <title>Return-path:</title>
68764 <para>
68765 <indexterm role="concept">
68766 <primary><emphasis>Return-path:</emphasis> header line</primary>
68767 </indexterm>
68768 <indexterm role="concept">
68769 <primary>header lines</primary>
68770 <secondary>Return-path:</secondary>
68771 </indexterm>
68772 <indexterm role="option">
68773 <primary><option>return_path_remove</option></primary>
68774 </indexterm>
68775 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
68776 it does the final delivery of messages. (See the generic <option>return_path_add</option>
68777 transport option.) Therefore, they should not be present in messages in
68778 transit. If the <option>return_path_remove</option> configuration option is set (the
68779 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
68780 </para>
68781 </section>
68782 <section id="SECTthesenhea">
68783 <title>Sender:</title>
68784 <para>
68785 <indexterm role="concept">
68786 <primary><emphasis>Sender:</emphasis> header line</primary>
68787 </indexterm>
68788 <indexterm role="concept">
68789 <primary>message</primary>
68790 <secondary>submission</secondary>
68791 </indexterm>
68792 <indexterm role="concept">
68793 <primary><emphasis>Sender:</emphasis> header line</primary>
68794 </indexterm>
68795 <indexterm role="concept">
68796 <primary>header lines</primary>
68797 <secondary>Sender:</secondary>
68798 </indexterm>
68799 For a locally-originated message from an untrusted user, Exim may remove an
68800 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
68801 these actions by setting the <option>local_sender_retain</option> option true, the
68802 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
68803 control setting.
68804 </para>
68805 <para>
68806 When a local message is received from an untrusted user and
68807 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
68808 control has not been set, a check is made to see if the address given in the
68809 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
68810 that is expected has the login name as the local part and the value of
68811 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
68812 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
68813 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
68814 line is added to the message.
68815 </para>
68816 <para>
68817 If you set <option>local_from_check</option> false, this checking does not occur. However,
68818 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
68819 <option>local_sender_retain</option> to be true. It is not possible to set both of these
68820 options true at the same time.
68821 </para>
68822 <para>
68823 <indexterm role="concept">
68824 <primary>submission mode</primary>
68825 </indexterm>
68826 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
68827 received over TCP/IP or for messages submitted by trusted users. However, when
68828 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
68829 not specified on the submission control, the following processing takes place:
68830 </para>
68831 <para>
68832 <indexterm role="variable">
68833 <primary><varname>$authenticated_id</varname></primary>
68834 </indexterm>
68835 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
68836 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
68837 created as follows:
68838 </para>
68839 <itemizedlist>
68840 <listitem>
68841 <para>
68842 <indexterm role="variable">
68843 <primary><varname>$qualify_domain</varname></primary>
68844 </indexterm>
68845 If no domain is specified by the submission control, the local part is
68846 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
68847 </para>
68848 </listitem>
68849 <listitem>
68850 <para>
68851 If a non-empty domain is specified by the submission control, the local part
68852 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
68853 </para>
68854 </listitem>
68855 <listitem>
68856 <para>
68857 If an empty domain is specified by the submission control,
68858 <varname>$authenticated_id</varname> is assumed to be the complete address.
68859 </para>
68860 </listitem>
68861 </itemizedlist>
68862 <para>
68863 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
68864 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
68865 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
68866 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
68867 </para>
68868 <para>
68869 <indexterm role="concept">
68870 <primary>return path</primary>
68871 <secondary>created from <emphasis>Sender:</emphasis></secondary>
68872 </indexterm>
68873 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
68874 the message (the envelope sender address) is changed to be the same address,
68875 except in the case of submission mode when <option>sender_retain</option> is specified.
68876 </para>
68877 </section>
68878 </section>
68879 <section id="SECTheadersaddrem">
68880 <title>Adding and removing header lines in routers and transports</title>
68881 <para>
68882 <indexterm role="concept">
68883 <primary>header lines</primary>
68884 <secondary>adding; in router or transport</secondary>
68885 </indexterm>
68886 <indexterm role="concept">
68887 <primary>header lines</primary>
68888 <secondary>removing; in router or transport</secondary>
68889 </indexterm>
68890 When a message is delivered, the addition and removal of header lines can be
68891 specified in a system filter, or on any of the routers and transports that
68892 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
68893 modifying headers in a system filter. Header lines can also be added in an ACL
68894 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
68895 </para>
68896 <para>
68897 In contrast to what happens in a system filter, header modifications that are
68898 specified on routers and transports apply only to the particular recipient
68899 addresses that are being processed by those routers and transports. These
68900 changes do not actually take place until a copy of the message is being
68901 transported. Therefore, they do not affect the basic set of header lines, and
68902 they do not affect the values of the variables that refer to header lines.
68903 </para>
68904 <para>
68905 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
68906 the transport cannot refer to the modified header lines, because such
68907 expansions all occur before the message is actually transported.
68908 </para>
68909 <para>
68910 For both routers and transports, the argument of a <option>headers_add</option>
68911 option must be in the form of one or more RFC 2822 header lines, separated by
68912 newlines (coded as <quote>\n</quote>). For example:
68913 </para>
68914 <literallayout class="monospaced">
68915 headers_add = X-added-header: added by $primary_hostname\n\
68916               X-added-second: another added header line
68917 </literallayout>
68918 <para>
68919 Exim does not check the syntax of these added header lines.
68920 </para>
68921 <para>
68922 Multiple <option>headers_add</option> options for a single router or transport can be
68923 specified; the values will append to a single list of header lines.
68924 Each header-line is separately expanded.
68925 </para>
68926 <para>
68927 The argument of a <option>headers_remove</option> option must consist of a colon-separated
68928 list of header names. This is confusing, because header names themselves are
68929 often terminated by colons. In this case, the colons are the list separators,
68930 not part of the names. For example:
68931 </para>
68932 <literallayout class="monospaced">
68933 headers_remove = return-receipt-to:acknowledge-to
68934 </literallayout>
68935 <para>
68936 Multiple <option>headers_remove</option> options for a single router or transport can be
68937 specified; the arguments will append to a single header-names list.
68938 Each item is separately expanded.
68939 Note that colons in complex expansions which are used to
68940 form all or part of a <option>headers_remove</option> list
68941 will act as list separators.
68942 </para>
68943 <para>
68944 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
68945 items are expanded at routing time,
68946 and then associated with all addresses that are
68947 accepted by that router, and also with any new addresses that it generates. If
68948 an address passes through several routers as a result of aliasing or
68949 forwarding, the changes are cumulative.
68950 </para>
68951 <para>
68952 <indexterm role="option">
68953 <primary><option>unseen</option></primary>
68954 </indexterm>
68955 However, this does not apply to multiple routers that result from the use of
68956 the <option>unseen</option> option. Any header modifications that were specified by the
68957 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
68958 </para>
68959 <para>
68960 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
68961 settings cannot be delivered together in a batch, so a transport is always
68962 dealing with a set of addresses that have the same header-processing
68963 requirements.
68964 </para>
68965 <para>
68966 The transport starts by writing the original set of header lines that arrived
68967 with the message, possibly modified by the system filter. As it writes out
68968 these lines, it consults the list of header names that were attached to the
68969 recipient address(es) by <option>headers_remove</option> options in routers, and it also
68970 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
68971 names are on either of these lists are not written out. If there are multiple
68972 instances of any listed header, they are all skipped.
68973 </para>
68974 <para>
68975 After the remaining original header lines have been written, new header
68976 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
68977 the order in which they were attached to the address. These are followed by any
68978 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
68979 </para>
68980 <para>
68981 This way of handling header line modifications in routers and transports has
68982 the following consequences:
68983 </para>
68984 <itemizedlist>
68985 <listitem>
68986 <para>
68987 The original set of header lines, possibly modified by the system filter,
68988 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
68989 to it, at all times.
68990 </para>
68991 </listitem>
68992 <listitem>
68993 <para>
68994 Header lines that are added by a router&#x2019;s
68995 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
68996 expansion syntax in subsequent routers or the transport.
68997 </para>
68998 </listitem>
68999 <listitem>
69000 <para>
69001 Conversely, header lines that are specified for removal by <option>headers_remove</option>
69002 in a router remain visible to subsequent routers and the transport.
69003 </para>
69004 </listitem>
69005 <listitem>
69006 <para>
69007 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
69008 a later router or by a transport.
69009 </para>
69010 </listitem>
69011 <listitem>
69012 <para>
69013 An added header can refer to the contents of an original header that is to be
69014 removed, even it has the same name as the added header. For example:
69015 </para>
69016 <literallayout class="monospaced">
69017 headers_remove = subject
69018 headers_add = Subject: new subject (was: $h_subject:)
69019 </literallayout>
69020 </listitem>
69021 </itemizedlist>
69022 <para>
69023 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
69024 for a <command>redirect</command> router that has the <option>one_time</option> option set.
69025 </para>
69026 </section>
69027 <section id="SECTconstr">
69028 <title>Constructed addresses</title>
69029 <para>
69030 <indexterm role="concept">
69031 <primary>address</primary>
69032 <secondary>constructed</secondary>
69033 </indexterm>
69034 <indexterm role="concept">
69035 <primary>constructed address</primary>
69036 </indexterm>
69037 When Exim constructs a sender address for a locally-generated message, it uses
69038 the form
69039 </para>
69040 <literallayout>
69041 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
69042 </literallayout>
69043 <para>
69044 For example:
69045 </para>
69046 <literallayout class="monospaced">
69047 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
69048 </literallayout>
69049 <para>
69050 The user name is obtained from the <option>-F</option> command line option if set, or
69051 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
69052 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
69053 ampersand character, this is replaced by the login name with the first letter
69054 upper cased, as is conventional in a number of operating systems. See the
69055 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
69056 The <option>unknown_username</option> option can be used to specify user names in cases when
69057 there is no password file entry.
69058 </para>
69059 <para>
69060 <indexterm role="concept">
69061 <primary>RFC 2047</primary>
69062 </indexterm>
69063 In all cases, the user name is made to conform to RFC 2822 by quoting all or
69064 parts of it if necessary. In addition, if it contains any non-printing
69065 characters, it is encoded as described in RFC 2047, which defines a way of
69066 including non-ASCII characters in header lines. The value of the
69067 <option>headers_charset</option> option specifies the name of the encoding that is used (the
69068 characters are assumed to be in this encoding). The setting of
69069 <option>print_topbitchars</option> controls whether characters with the top bit set (that
69070 is, with codes greater than 127) count as printing characters or not.
69071 </para>
69072 </section>
69073 <section id="SECID230">
69074 <title>Case of local parts</title>
69075 <para>
69076 <indexterm role="concept">
69077 <primary>case of local parts</primary>
69078 </indexterm>
69079 <indexterm role="concept">
69080 <primary>local part</primary>
69081 <secondary>case of</secondary>
69082 </indexterm>
69083 RFC 2822 states that the case of letters in the local parts of addresses cannot
69084 be assumed to be non-significant. Exim preserves the case of local parts of
69085 addresses, but by default it uses a lower-cased form when it is routing,
69086 because on most Unix systems, usernames are in lower case and case-insensitive
69087 routing is required. However, any particular router can be made to use the
69088 original case for local parts by setting the <option>caseful_local_part</option> generic
69089 router option.
69090 </para>
69091 <para>
69092 <indexterm role="concept">
69093 <primary>mixed-case login names</primary>
69094 </indexterm>
69095 If you must have mixed-case user names on your system, the best way to proceed,
69096 assuming you want case-independent handling of incoming email, is to set up
69097 your first router to convert incoming local parts in your domains to the
69098 correct case by means of a file lookup. For example:
69099 </para>
69100 <literallayout class="monospaced">
69101 correct_case:
69102   driver = redirect
69103   domains = +local_domains
69104   data = ${lookup{$local_part}cdb\
69105               {/etc/usercased.cdb}{$value}fail}\
69106               @$domain
69107 </literallayout>
69108 <para>
69109 For this router, the local part is forced to lower case by the default action
69110 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
69111 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
69112 on any subsequent routers which process your domains, they will operate on
69113 local parts with the correct case in a case-sensitive manner.
69114 </para>
69115 </section>
69116 <section id="SECID231">
69117 <title>Dots in local parts</title>
69118 <para>
69119 <indexterm role="concept">
69120 <primary>dot</primary>
69121 <secondary>in local part</secondary>
69122 </indexterm>
69123 <indexterm role="concept">
69124 <primary>local part</primary>
69125 <secondary>dots in</secondary>
69126 </indexterm>
69127 RFC 2822 forbids empty components in local parts. That is, an unquoted local
69128 part may not begin or end with a dot, nor have two consecutive dots in the
69129 middle. However, it seems that many MTAs do not enforce this, so Exim permits
69130 empty components for compatibility.
69131 </para>
69132 </section>
69133 <section id="SECID232">
69134 <title>Rewriting addresses</title>
69135 <para>
69136 <indexterm role="concept">
69137 <primary>rewriting</primary>
69138 <secondary>addresses</secondary>
69139 </indexterm>
69140 Rewriting of sender and recipient addresses, and addresses in headers, can
69141 happen automatically, or as the result of configuration options, as described
69142 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
69143 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
69144 </para>
69145 <para>
69146 Automatic rewriting includes qualification, as mentioned above. The other case
69147 in which it can happen is when an incomplete non-local domain is given. The
69148 routing process may cause this to be expanded into the full domain name. For
69149 example, a header such as
69150 </para>
69151 <literallayout class="monospaced">
69152 To: hare@teaparty
69153 </literallayout>
69154 <para>
69155 might get rewritten as
69156 </para>
69157 <literallayout class="monospaced">
69158 To: hare@teaparty.wonderland.fict.example
69159 </literallayout>
69160 <para>
69161 Rewriting as a result of routing is the one kind of message processing that
69162 does not happen at input time, as it cannot be done until the address has
69163 been routed.
69164 </para>
69165 <para>
69166 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
69167 addresses have been routed, in case any of the headers get changed as a
69168 result of routing. However, doing this in practice would hold up many
69169 deliveries for unreasonable amounts of time, just because one address could not
69170 immediately be routed. Exim therefore does not delay other deliveries when
69171 routing of one or more addresses is deferred.
69172 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
69173 </para>
69174 </section>
69175 </chapter>
69176
69177 <chapter id="CHAPSMTP">
69178 <title>SMTP processing</title>
69179 <para>
69180 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
69181 <primary>SMTP</primary>
69182 <secondary>processing details</secondary>
69183 </indexterm>
69184 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
69185 <primary>LMTP</primary>
69186 <secondary>processing details</secondary>
69187 </indexterm>
69188 Exim supports a number of different ways of using the SMTP protocol, and its
69189 LMTP variant, which is an interactive protocol for transferring messages into a
69190 closed mail store application. This chapter contains details of how SMTP is
69191 processed. For incoming mail, the following are available:
69192 </para>
69193 <itemizedlist>
69194 <listitem>
69195 <para>
69196 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
69197 </para>
69198 </listitem>
69199 <listitem>
69200 <para>
69201 SMTP over the standard input and output (the <option>-bs</option> option);
69202 </para>
69203 </listitem>
69204 <listitem>
69205 <para>
69206 Batched SMTP on the standard input (the <option>-bS</option> option).
69207 </para>
69208 </listitem>
69209 </itemizedlist>
69210 <para>
69211 For mail delivery, the following are available:
69212 </para>
69213 <itemizedlist>
69214 <listitem>
69215 <para>
69216 SMTP over TCP/IP (the <command>smtp</command> transport);
69217 </para>
69218 </listitem>
69219 <listitem>
69220 <para>
69221 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
69222 <quote>lmtp</quote>);
69223 </para>
69224 </listitem>
69225 <listitem>
69226 <para>
69227 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
69228 transport);
69229 </para>
69230 </listitem>
69231 <listitem>
69232 <para>
69233 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
69234 the <option>use_bsmtp</option> option set).
69235 </para>
69236 </listitem>
69237 </itemizedlist>
69238 <para>
69239 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
69240 stored in or read from files (or pipes), in a format in which SMTP commands are
69241 used to contain the envelope information.
69242 </para>
69243 <section id="SECToutSMTPTCP">
69244 <title>Outgoing SMTP and LMTP over TCP/IP</title>
69245 <para>
69246 <indexterm role="concept">
69247 <primary>SMTP</primary>
69248 <secondary>outgoing over TCP/IP</secondary>
69249 </indexterm>
69250 <indexterm role="concept">
69251 <primary>outgoing SMTP over TCP/IP</primary>
69252 </indexterm>
69253 <indexterm role="concept">
69254 <primary>LMTP</primary>
69255 <secondary>over TCP/IP</secondary>
69256 </indexterm>
69257 <indexterm role="concept">
69258 <primary>outgoing LMTP over TCP/IP</primary>
69259 </indexterm>
69260 <indexterm role="concept">
69261 <primary>EHLO</primary>
69262 </indexterm>
69263 <indexterm role="concept">
69264 <primary>HELO</primary>
69265 </indexterm>
69266 <indexterm role="concept">
69267 <primary>SIZE</primary>
69268 <secondary>option on MAIL command</secondary>
69269 </indexterm>
69270 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
69271 The <option>protocol</option> option selects which protocol is to be used, but the actual
69272 processing is the same in both cases.
69273 </para>
69274 <para>
69275 <indexterm role="concept">
69276 <primary>ESMTP extensions</primary>
69277 <secondary>SIZE</secondary>
69278 </indexterm>
69279 If, in response to its EHLO command, Exim is told that the SIZE
69280 extension is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
69281 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
69282 <option>size_addition</option> option (default 1024) to allow for additions to the message
69283 such as per-transport header lines, or changes made in a
69284 <indexterm role="concept">
69285 <primary>transport</primary>
69286 <secondary>filter</secondary>
69287 </indexterm>
69288 <indexterm role="concept">
69289 <primary>filter</primary>
69290 <secondary>transport filter</secondary>
69291 </indexterm>
69292 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
69293 suppressed.
69294 </para>
69295 <para>
69296 If the remote server advertises support for PIPELINING, Exim uses the
69297 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
69298 required for the transaction.
69299 </para>
69300 <para>
69301 If the remote server advertises support for the STARTTLS command, and Exim
69302 was built to support TLS encryption, it tries to start a TLS session unless the
69303 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
69304 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
69305 is called for verification.
69306 </para>
69307 <para>
69308 If the remote server advertises support for the AUTH command, Exim scans
69309 the authenticators configuration for any suitable client settings, as described
69310 in chapter <xref linkend="CHAPSMTPAUTH"/>.
69311 </para>
69312 <para>
69313 <indexterm role="concept">
69314 <primary>carriage return</primary>
69315 </indexterm>
69316 <indexterm role="concept">
69317 <primary>linefeed</primary>
69318 </indexterm>
69319 Responses from the remote host are supposed to be terminated by CR followed by
69320 LF. However, there are known to be hosts that do not send CR characters, so in
69321 order to be able to interwork with such hosts, Exim treats LF on its own as a
69322 line terminator.
69323 </para>
69324 <para>
69325 If a message contains a number of different addresses, all those with the same
69326 characteristics (for example, the same envelope sender) that resolve to the
69327 same set of hosts, in the same order, are sent in a single SMTP transaction,
69328 even if they are for different domains, unless there are more than the setting
69329 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
69330 they are split into groups containing no more than <option>max_rcpt</option>s addresses
69331 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
69332 in parallel sessions. The order of hosts with identical MX values is not
69333 significant when checking whether addresses can be batched in this way.
69334 </para>
69335 <para>
69336 When the <command>smtp</command> transport suffers a temporary failure that is not
69337 message-related, Exim updates its transport-specific database, which contains
69338 records indexed by host name that remember which messages are waiting for each
69339 particular host. It also updates the retry database with new retry times.
69340 </para>
69341 <para>
69342 <indexterm role="concept">
69343 <primary>hints database</primary>
69344 <secondary>retry keys</secondary>
69345 </indexterm>
69346 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
69347 a multi-homed host is broken, it will soon be skipped most of the time.
69348 See the next section for more detail about error handling.
69349 </para>
69350 <para>
69351 <indexterm role="concept">
69352 <primary>SMTP</primary>
69353 <secondary>passed connection</secondary>
69354 </indexterm>
69355 <indexterm role="concept">
69356 <primary>SMTP</primary>
69357 <secondary>batching over TCP/IP</secondary>
69358 </indexterm>
69359 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
69360 looks in the hints database for the transport to see if there are any queued
69361 messages waiting for the host to which it is connected. If it finds one, it
69362 creates a new Exim process using the <option>-MC</option> option (which can only be used by
69363 a process running as root or the Exim user) and passes the TCP/IP socket to it
69364 so that it can deliver another message using the same socket. The new process
69365 does only those deliveries that are routed to the connected host, and may in
69366 turn pass the socket on to a third process, and so on.
69367 </para>
69368 <para>
69369 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
69370 limit the number of messages sent down a single TCP/IP connection.
69371 </para>
69372 <para>
69373 <indexterm role="concept">
69374 <primary>asterisk</primary>
69375 <secondary>after IP address</secondary>
69376 </indexterm>
69377 The second and subsequent messages delivered down an existing connection are
69378 identified in the main log by the addition of an asterisk after the closing
69379 square bracket of the IP address.
69380 </para>
69381 <section id="SECToutSMTPerr">
69382 <title>Errors in outgoing SMTP</title>
69383 <para>
69384 <indexterm role="concept">
69385 <primary>error</primary>
69386 <secondary>in outgoing SMTP</secondary>
69387 </indexterm>
69388 <indexterm role="concept">
69389 <primary>SMTP</primary>
69390 <secondary>errors in outgoing</secondary>
69391 </indexterm>
69392 <indexterm role="concept">
69393 <primary>host</primary>
69394 <secondary>error</secondary>
69395 </indexterm>
69396 Three different kinds of error are recognized for outgoing SMTP: host errors,
69397 message errors, and recipient errors.
69398 </para>
69399 <variablelist>
69400 <varlistentry>
69401 <term><emphasis role="bold">Host errors</emphasis></term>
69402 <listitem>
69403 <para>
69404 A host error is not associated with a particular message or with a
69405 particular recipient of a message. The host errors are:
69406 </para>
69407 <itemizedlist>
69408 <listitem>
69409 <para>
69410 Connection refused or timed out,
69411 </para>
69412 </listitem>
69413 <listitem>
69414 <para>
69415 Any error response code on connection,
69416 </para>
69417 </listitem>
69418 <listitem>
69419 <para>
69420 Any error response code to EHLO or HELO,
69421 </para>
69422 </listitem>
69423 <listitem>
69424 <para>
69425 Loss of connection at any time, except after <quote>.</quote>,
69426 </para>
69427 </listitem>
69428 <listitem>
69429 <para>
69430 I/O errors at any time,
69431 </para>
69432 </listitem>
69433 <listitem>
69434 <para>
69435 Timeouts during the session, other than in response to MAIL, RCPT or
69436 the <quote>.</quote> at the end of the data.
69437 </para>
69438 </listitem>
69439 </itemizedlist>
69440 <para>
69441 For a host error, a permanent error response on connection, or in response to
69442 EHLO, causes all addresses routed to the host to be failed. Any other host
69443 error causes all addresses to be deferred, and retry data to be created for the
69444 host. It is not tried again, for any message, until its retry time arrives. If
69445 the current set of addresses are not all delivered in this run (to some
69446 alternative host), the message is added to the list of those waiting for this
69447 host, so if it is still undelivered when a subsequent successful delivery is
69448 made to the host, it will be sent down the same SMTP connection.
69449 </para>
69450 </listitem></varlistentry>
69451 <varlistentry>
69452 <term><emphasis role="bold">Message errors</emphasis></term>
69453 <listitem>
69454 <para>
69455 <indexterm role="concept">
69456 <primary>message</primary>
69457 <secondary>error</secondary>
69458 </indexterm>
69459 A message error is associated with a particular message when sent to a
69460 particular host, but not with a particular recipient of the message. The
69461 message errors are:
69462 </para>
69463 <itemizedlist>
69464 <listitem>
69465 <para>
69466 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
69467 the data,
69468 </para>
69469 </listitem>
69470 <listitem>
69471 <para>
69472 Timeout after MAIL,
69473 </para>
69474 </listitem>
69475 <listitem>
69476 <para>
69477 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
69478 timeout after the DATA command itself is treated as a host error, as is loss of
69479 connection at any other time.
69480 </para>
69481 </listitem>
69482 </itemizedlist>
69483 <para>
69484 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
69485 to be failed, and a delivery error report to be returned to the sender. A
69486 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
69487 addresses to be deferred. Retry data is not created for the host, but instead,
69488 a retry record for the combination of host plus message id is created. The
69489 message is not added to the list of those waiting for this host. This ensures
69490 that the failing message will not be sent to this host again until the retry
69491 time arrives. However, other messages that are routed to the host are not
69492 affected, so if it is some property of the message that is causing the error,
69493 it will not stop the delivery of other mail.
69494 </para>
69495 <para>
69496 If the remote host specified support for the SIZE parameter in its response
69497 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
69498 over-large message will cause a message error because the error arrives as a
69499 response to MAIL.
69500 </para>
69501 </listitem></varlistentry>
69502 <varlistentry>
69503 <term><emphasis role="bold">Recipient errors</emphasis></term>
69504 <listitem>
69505 <para>
69506 <indexterm role="concept">
69507 <primary>recipient</primary>
69508 <secondary>error</secondary>
69509 </indexterm>
69510 A recipient error is associated with a particular recipient of a message. The
69511 recipient errors are:
69512 </para>
69513 <itemizedlist>
69514 <listitem>
69515 <para>
69516 Any error response to RCPT,
69517 </para>
69518 </listitem>
69519 <listitem>
69520 <para>
69521 Timeout after RCPT.
69522 </para>
69523 </listitem>
69524 </itemizedlist>
69525 <para>
69526 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
69527 recipient address to be failed, and a bounce message to be returned to the
69528 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
69529 address to be deferred, and routing retry data to be created for it. This is
69530 used to delay processing of the address in subsequent queue runs, until its
69531 routing retry time arrives. This applies to all messages, but because it
69532 operates only in queue runs, one attempt will be made to deliver a new message
69533 to the failing address before the delay starts to operate. This ensures that,
69534 if the failure is really related to the message rather than the recipient
69535 (<quote>message too big for this recipient</quote> is a possible example), other messages
69536 have a chance of getting delivered. If a delivery to the address does succeed,
69537 the retry information gets cleared, so all stuck messages get tried again, and
69538 the retry clock is reset.
69539 </para>
69540 <para>
69541 The message is not added to the list of those waiting for this host. Use of the
69542 host for other messages is unaffected, and except in the case of a timeout,
69543 other recipients are processed independently, and may be successfully delivered
69544 in the current SMTP session. After a timeout it is of course impossible to
69545 proceed with the session, so all addresses get deferred. However, those other
69546 than the one that failed do not suffer any subsequent retry delays. Therefore,
69547 if one recipient is causing trouble, the others have a chance of getting
69548 through when a subsequent delivery attempt occurs before the failing
69549 recipient&#x2019;s retry time.
69550 </para>
69551 </listitem></varlistentry>
69552 </variablelist>
69553 <para>
69554 In all cases, if there are other hosts (or IP addresses) available for the
69555 current set of addresses (for example, from multiple MX records), they are
69556 tried in this run for any undelivered addresses, subject of course to their
69557 own retry data. In other words, recipient error retry data does not take effect
69558 until the next delivery attempt.
69559 </para>
69560 <para>
69561 Some hosts have been observed to give temporary error responses to every
69562 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
69563 would be nice if such circumstances could be recognized, and defer data for the
69564 host itself created, but this is not possible within the current Exim design.
69565 What actually happens is that retry data for every (host, message) combination
69566 is created.
69567 </para>
69568 <para>
69569 The reason that timeouts after MAIL and RCPT are treated specially is that
69570 these can sometimes arise as a result of the remote host&#x2019;s verification
69571 procedures. Exim makes this assumption, and treats them as if a temporary error
69572 response had been received. A timeout after <quote>.</quote> is treated specially because
69573 it is known that some broken implementations fail to recognize the end of the
69574 message if the last character of the last line is a binary zero. Thus, it is
69575 helpful to treat this case as a message error.
69576 </para>
69577 <para>
69578 Timeouts at other times are treated as host errors, assuming a problem with the
69579 host, or the connection to it. If a timeout after MAIL, RCPT,
69580 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
69581 the timeout is likely to occur at some other point in the dialogue, causing it
69582 then to be treated as a host error.
69583 </para>
69584 <para>
69585 There is experimental evidence that some MTAs drop the connection after the
69586 terminating <quote>.</quote> if they do not like the contents of the message for some
69587 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
69588 should be given. That is why Exim treats this case as a message rather than a
69589 host error, in order not to delay other messages to the same host.
69590 </para>
69591 </section>
69592 </section>
69593 <section id="SECID233">
69594 <title>Incoming SMTP messages over TCP/IP</title>
69595 <para>
69596 <indexterm role="concept">
69597 <primary>SMTP</primary>
69598 <secondary>incoming over TCP/IP</secondary>
69599 </indexterm>
69600 <indexterm role="concept">
69601 <primary>incoming SMTP over TCP/IP</primary>
69602 </indexterm>
69603 <indexterm role="concept">
69604 <primary>inetd</primary>
69605 </indexterm>
69606 <indexterm role="concept">
69607 <primary>daemon</primary>
69608 </indexterm>
69609 Incoming SMTP messages can be accepted in one of two ways: by running a
69610 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
69611 <filename>/etc/inetd.conf</filename> should be like this:
69612 </para>
69613 <literallayout class="monospaced">
69614 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
69615 </literallayout>
69616 <para>
69617 Exim distinguishes between this case and the case of a locally running user
69618 agent using the <option>-bs</option> option by checking whether or not the standard input is
69619 a socket. When it is, either the port must be privileged (less than 1024), or
69620 the caller must be root or the Exim user. If any other user passes a socket
69621 with an unprivileged port number, Exim prints a message on the standard error
69622 stream and exits with an error code.
69623 </para>
69624 <para>
69625 By default, Exim does not make a log entry when a remote host connects or
69626 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
69627 unexpected. It can be made to write such log entries by setting the
69628 <option>smtp_connection</option> log selector.
69629 </para>
69630 <para>
69631 <indexterm role="concept">
69632 <primary>carriage return</primary>
69633 </indexterm>
69634 <indexterm role="concept">
69635 <primary>linefeed</primary>
69636 </indexterm>
69637 Commands from the remote host are supposed to be terminated by CR followed by
69638 LF. However, there are known to be hosts that do not send CR characters. In
69639 order to be able to interwork with such hosts, Exim treats LF on its own as a
69640 line terminator.
69641 Furthermore, because common code is used for receiving messages from all
69642 sources, a CR on its own is also interpreted as a line terminator. However, the
69643 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
69644 </para>
69645 <para>
69646 <indexterm role="concept">
69647 <primary>EHLO</primary>
69648 <secondary>invalid data</secondary>
69649 </indexterm>
69650 <indexterm role="concept">
69651 <primary>HELO</primary>
69652 <secondary>invalid data</secondary>
69653 </indexterm>
69654 One area that sometimes gives rise to problems concerns the EHLO or
69655 HELO commands. Some clients send syntactically invalid versions of these
69656 commands, which Exim rejects by default. (This is nothing to do with verifying
69657 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
69658 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
69659 match the broken hosts that send invalid commands.
69660 </para>
69661 <para>
69662 <indexterm role="concept">
69663 <primary>SIZE option on MAIL command</primary>
69664 </indexterm>
69665 <indexterm role="concept">
69666 <primary>MAIL</primary>
69667 <secondary>SIZE option</secondary>
69668 </indexterm>
69669 The amount of disk space available is checked whenever SIZE is received on
69670 a MAIL command, independently of whether <option>message_size_limit</option> or
69671 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
69672 false. A temporary error is given if there is not enough space. If
69673 <option>check_spool_space</option> is set, the check is for that amount of space plus the
69674 value given with SIZE, that is, it checks that the addition of the incoming
69675 message will not reduce the space below the threshold.
69676 </para>
69677 <para>
69678 When a message is successfully received, Exim includes the local message id in
69679 its response to the final <quote>.</quote> that terminates the data. If the remote host
69680 logs this text it can help with tracing what has happened to a message.
69681 </para>
69682 <para>
69683 The Exim daemon can limit the number of simultaneous incoming connections it is
69684 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
69685 number of simultaneous incoming connections from a single remote host (see the
69686 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
69687 rejected using the SMTP temporary error code 421.
69688 </para>
69689 <para>
69690 The Exim daemon does not rely on the SIGCHLD signal to detect when a
69691 subprocess has finished, as this can get lost at busy times. Instead, it looks
69692 for completed subprocesses every time it wakes up. Provided there are other
69693 things happening (new incoming calls, starts of queue runs), completed
69694 processes will be noticed and tidied away. On very quiet systems you may
69695 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
69696 it will be noticed when the daemon next wakes up.
69697 </para>
69698 <para>
69699 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
69700 and can also be set up to reject SMTP calls from non-reserved hosts at times of
69701 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
69702 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
69703 applies in both the daemon and <emphasis>inetd</emphasis> cases.
69704 </para>
69705 <para>
69706 Exim normally starts a delivery process for each message received, though this
69707 can be varied by means of the <option>-odq</option> command line option and the
69708 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
69709 number of simultaneously running delivery processes started in this way from
69710 SMTP input can be limited by the <option>smtp_accept_queue</option> and
69711 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
69712 subsequently received messages are just put on the input queue without starting
69713 a delivery process.
69714 </para>
69715 <para>
69716 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
69717 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
69718 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
69719 handled by an entirely independent Exim process. Control by load average is,
69720 however, available with <emphasis>inetd</emphasis>.
69721 </para>
69722 <para>
69723 Exim can be configured to verify addresses in incoming SMTP commands as they
69724 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
69725 to rewrite addresses at this time &ndash; before any syntax checking is done. See
69726 section <xref linkend="SSECTrewriteS"/>.
69727 </para>
69728 <para>
69729 Exim can also be configured to limit the rate at which a client host submits
69730 MAIL and RCPT commands in a single SMTP session. See the
69731 <option>smtp_ratelimit_hosts</option> option.
69732 </para>
69733 <section id="SECID234">
69734 <title>Unrecognized SMTP commands</title>
69735 <para>
69736 <indexterm role="concept">
69737 <primary>SMTP</primary>
69738 <secondary>unrecognized commands</secondary>
69739 </indexterm>
69740 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
69741 commands during a single SMTP connection, it drops the connection after sending
69742 the error response to the last command. The default value for
69743 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
69744 abuse that subvert web servers into making connections to SMTP ports; in these
69745 circumstances, a number of non-SMTP lines are sent first.
69746 </para>
69747 </section>
69748 <section id="SECID235">
69749 <title>Syntax and protocol errors in SMTP commands</title>
69750 <para>
69751 <indexterm role="concept">
69752 <primary>SMTP</primary>
69753 <secondary>syntax errors</secondary>
69754 </indexterm>
69755 <indexterm role="concept">
69756 <primary>SMTP</primary>
69757 <secondary>protocol errors</secondary>
69758 </indexterm>
69759 A syntax error is detected if an SMTP command is recognized, but there is
69760 something syntactically wrong with its data, for example, a malformed email
69761 address in a RCPT command. Protocol errors include invalid command
69762 sequencing such as RCPT before MAIL. If Exim receives more than
69763 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
69764 drops the connection after sending the error response to the last command. The
69765 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
69766 broken clients that loop sending bad commands (yes, it has been seen).
69767 </para>
69768 </section>
69769 <section id="SECID236">
69770 <title>Use of non-mail SMTP commands</title>
69771 <para>
69772 <indexterm role="concept">
69773 <primary>SMTP</primary>
69774 <secondary>non-mail commands</secondary>
69775 </indexterm>
69776 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
69777 DATA. Exim counts such commands, and drops the connection if there are too
69778 many of them in a single SMTP session. This action catches some
69779 denial-of-service attempts and things like repeated failing AUTHs, or a mad
69780 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
69781 defines what <quote>too many</quote> means. Its default value is 10.
69782 </para>
69783 <para>
69784 When a new message is expected, one occurrence of RSET is not counted. This
69785 allows a client to send one RSET between messages (this is not necessary,
69786 but some clients do it). Exim also allows one uncounted occurrence of HELO
69787 or EHLO, and one occurrence of STARTTLS between messages. After
69788 starting up a TLS session, another EHLO is expected, and so it too is not
69789 counted.
69790 </para>
69791 <para>
69792 The first occurrence of AUTH in a connection, or immediately following
69793 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
69794 RCPT, DATA, and QUIT are counted.
69795 </para>
69796 <para>
69797 You can control which hosts are subject to the limit set by
69798 <option>smtp_accept_max_nonmail</option> by setting
69799 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
69800 the limit apply to all hosts. This option means that you can exclude any
69801 specific badly-behaved hosts that you have to live with.
69802 </para>
69803 </section>
69804 <section id="SECID237">
69805 <title>The VRFY and EXPN commands</title>
69806 <para>
69807 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
69808 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
69809 appropriate) in order to decide whether the command should be accepted or not.
69810 </para>
69811 <para>
69812 <indexterm role="concept">
69813 <primary>VRFY</primary>
69814 <secondary>processing</secondary>
69815 </indexterm>
69816 When no ACL is defined for VRFY, or if it rejects without
69817 setting an explicit response code, the command is accepted
69818 (with a 252 SMTP response code)
69819 in order to support awkward clients that do a VRFY before every RCPT.
69820 When VRFY is accepted, it runs exactly the same code as when Exim is
69821 called with the <option>-bv</option> option, and returns 250/451/550
69822 SMTP response codes.
69823 </para>
69824 <para>
69825 <indexterm role="concept">
69826 <primary>EXPN</primary>
69827 <secondary>processing</secondary>
69828 </indexterm>
69829 If no ACL for EXPN is defined, the command is rejected.
69830 When EXPN is accepted, a single-level expansion of the address is done.
69831 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
69832 than a verification (the <option>-bv</option> option). If an unqualified local part is given
69833 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
69834 of VRFY and EXPN commands are logged on the main and reject logs, and
69835 VRFY verification failures are logged in the main log for consistency with
69836 RCPT failures.
69837 </para>
69838 </section>
69839 <section id="SECTETRN">
69840 <title>The ETRN command</title>
69841 <para>
69842 <indexterm role="concept">
69843 <primary>ETRN</primary>
69844 <secondary>processing</secondary>
69845 </indexterm>
69846 <indexterm role="concept">
69847 <primary>ESMTP extensions</primary>
69848 <secondary>ETRN</secondary>
69849 </indexterm>
69850 RFC 1985 describes an ESMTP command called ETRN that is designed to
69851 overcome the security problems of the TURN command (which has fallen into
69852 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
69853 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
69854 should be accepted or not. If no ACL is defined, the command is rejected.
69855 </para>
69856 <para>
69857 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
69858 delivery to certain hosts. As Exim does not organize its message queue by host,
69859 the only form of ETRN that is supported by default is the one where the
69860 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
69861 specific to the SMTP server. A valid ETRN command causes a run of Exim with
69862 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
69863 argument. For example,
69864 </para>
69865 <literallayout class="monospaced">
69866 ETRN #brigadoon
69867 </literallayout>
69868 <para>
69869 runs the command
69870 </para>
69871 <literallayout class="monospaced">
69872 exim -R brigadoon
69873 </literallayout>
69874 <para>
69875 which causes a delivery attempt on all messages with undelivered addresses
69876 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
69877 default), Exim prevents the simultaneous execution of more than one queue run
69878 for the same argument string as a result of an ETRN command. This stops
69879 a misbehaving client from starting more than one queue runner at once.
69880 </para>
69881 <para>
69882 <indexterm role="concept">
69883 <primary>hints database</primary>
69884 <secondary>ETRN serialization</secondary>
69885 </indexterm>
69886 Exim implements the serialization by means of a hints database in which a
69887 record is written whenever a process is started by ETRN, and deleted when
69888 the process completes. However, Exim does not keep the SMTP session waiting for
69889 the ETRN process to complete. Once ETRN is accepted, the client is sent
69890 a <quote>success</quote> return code. Obviously there is scope for hints records to get
69891 left lying around if there is a system or program crash. To guard against this,
69892 Exim ignores any records that are more than six hours old.
69893 </para>
69894 <para>
69895 <indexterm role="option">
69896 <primary><option>smtp_etrn_command</option></primary>
69897 </indexterm>
69898 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
69899 used. This specifies a command that is run whenever ETRN is received,
69900 whatever the form of its argument. For
69901 example:
69902 </para>
69903 <literallayout class="monospaced">
69904 smtp_etrn_command = /etc/etrn_command $domain \
69905                     $sender_host_address
69906 </literallayout>
69907 <para>
69908 <indexterm role="variable">
69909 <primary><varname>$domain</varname></primary>
69910 </indexterm>
69911 The string is split up into arguments which are independently expanded. The
69912 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
69913 and no syntax checking is done on the contents of this argument. Exim does not
69914 wait for the command to complete, so its status code is not checked. Exim runs
69915 under its own uid and gid when receiving incoming SMTP, so it is not possible
69916 for it to change them before running the command.
69917 </para>
69918 </section>
69919 </section>
69920 <section id="SECID238">
69921 <title>Incoming local SMTP</title>
69922 <para>
69923 <indexterm role="concept">
69924 <primary>SMTP</primary>
69925 <secondary>local incoming</secondary>
69926 </indexterm>
69927 Some user agents use SMTP to pass messages to their local MTA using the
69928 standard input and output, as opposed to passing the envelope on the command
69929 line and writing the message to the standard input. This is supported by the
69930 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
69931 messages over TCP/IP (including the use of ACLs), except that the envelope
69932 sender given in a MAIL command is ignored unless the caller is trusted. In
69933 an ACL you can detect this form of SMTP input by testing for an empty host
69934 identification. It is common to have this as the first line in the ACL that
69935 runs for RCPT commands:
69936 </para>
69937 <literallayout class="monospaced">
69938 accept hosts = :
69939 </literallayout>
69940 <para>
69941 This accepts SMTP messages from local processes without doing any other tests.
69942 </para>
69943 </section>
69944 <section id="SECTbatchSMTP">
69945 <title>Outgoing batched SMTP</title>
69946 <para>
69947 <indexterm role="concept">
69948 <primary>SMTP</primary>
69949 <secondary>batched outgoing</secondary>
69950 </indexterm>
69951 <indexterm role="concept">
69952 <primary>batched SMTP output</primary>
69953 </indexterm>
69954 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
69955 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
69956 be output in BSMTP format. No SMTP responses are possible for this form of
69957 delivery. All it is doing is using SMTP commands as a way of transmitting the
69958 envelope along with the message.
69959 </para>
69960 <para>
69961 The message is written to the file or pipe preceded by the SMTP commands
69962 MAIL and RCPT, and followed by a line containing a single dot. Lines in
69963 the message that start with a dot have an extra dot added. The SMTP command
69964 HELO is not normally used. If it is required, the <option>message_prefix</option> option
69965 can be used to specify it.
69966 </para>
69967 <para>
69968 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
69969 one recipient address at a time by default. However, you can arrange for them
69970 to handle several addresses at once by setting the <option>batch_max</option> option. When
69971 this is done for BSMTP, messages may contain multiple RCPT commands. See
69972 chapter <xref linkend="CHAPbatching"/> for more details.
69973 </para>
69974 <para>
69975 <indexterm role="variable">
69976 <primary><varname>$host</varname></primary>
69977 </indexterm>
69978 When one or more addresses are routed to a BSMTP transport by a router that
69979 sets up a host list, the name of the first host on the list is available to the
69980 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
69981 router:
69982 </para>
69983 <literallayout class="monospaced">
69984 begin routers
69985 route_append:
69986   driver = manualroute
69987   transport = smtp_appendfile
69988   route_list = domain.example  batch.host.example
69989
69990 begin transports
69991 smtp_appendfile:
69992   driver = appendfile
69993   directory = /var/bsmtp/$host
69994   batch_max = 1000
69995   use_bsmtp
69996   user = exim
69997 </literallayout>
69998 <para>
69999 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
70000 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
70001 message (unless there are more than 1000 recipients).
70002 </para>
70003 </section>
70004 <section id="SECTincomingbatchedSMTP">
70005 <title>Incoming batched SMTP</title>
70006 <para>
70007 <indexterm role="concept">
70008 <primary>SMTP</primary>
70009 <secondary>batched incoming</secondary>
70010 </indexterm>
70011 <indexterm role="concept">
70012 <primary>batched SMTP input</primary>
70013 </indexterm>
70014 The <option>-bS</option> command line option causes Exim to accept one or more messages by
70015 reading SMTP on the standard input, but to generate no responses. If the caller
70016 is trusted, the senders in the MAIL commands are believed; otherwise the
70017 sender is always the caller of Exim. Unqualified senders and receivers are not
70018 rejected (there seems little point) but instead just get qualified. HELO
70019 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
70020 as NOOP; QUIT quits.
70021 </para>
70022 <para>
70023 Minimal policy checking is done for BSMTP input. Only the non-SMTP
70024 ACL is run in the same way as for non-SMTP local input.
70025 </para>
70026 <para>
70027 If an error is detected while reading a message, including a missing <quote>.</quote> at
70028 the end, Exim gives up immediately. It writes details of the error to the
70029 standard output in a stylized way that the calling program should be able to
70030 make some use of automatically, for example:
70031 </para>
70032 <literallayout class="monospaced">
70033 554 Unexpected end of file
70034 Transaction started in line 10
70035 Error detected in line 14
70036 </literallayout>
70037 <para>
70038 It writes a more verbose version, for human consumption, to the standard error
70039 file, for example:
70040 </para>
70041 <literallayout class="monospaced">
70042 An error was detected while processing a file of BSMTP input.
70043 The error message was:
70044
70045 501 '&gt;' missing at end of address
70046
70047 The SMTP transaction started in line 10.
70048 The error was detected in line 12.
70049 The SMTP command at fault was:
70050
70051 rcpt to:&lt;malformed@in.com.plete
70052
70053 1 previous message was successfully processed.
70054 The rest of the batch was abandoned.
70055 </literallayout>
70056 <para>
70057 The return code from Exim is zero only if there were no errors. It is 1 if some
70058 messages were accepted before an error was detected, and 2 if no messages were
70059 accepted.
70060 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
70061 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
70062 </para>
70063 </section>
70064 </chapter>
70065
70066 <chapter id="CHAPemsgcust">
70067 <title>Customizing bounce and warning messages</title>
70068 <titleabbrev>Customizing messages</titleabbrev>
70069 <para>
70070 When a message fails to be delivered, or remains in the queue for more than a
70071 configured amount of time, Exim sends a message to the original sender, or
70072 to an alternative configured address. The text of these messages is built into
70073 the code of Exim, but it is possible to change it, either by adding a single
70074 string, or by replacing each of the paragraphs by text supplied in a file.
70075 </para>
70076 <para>
70077 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
70078 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
70079 option. Exim also adds the line
70080 </para>
70081 <literallayout class="monospaced">
70082 Auto-Submitted: auto-generated
70083 </literallayout>
70084 <para>
70085 to all warning and bounce messages,
70086 </para>
70087 <section id="SECID239">
70088 <title>Customizing bounce messages</title>
70089 <para>
70090 <indexterm role="concept">
70091 <primary>customizing</primary>
70092 <secondary>bounce message</secondary>
70093 </indexterm>
70094 <indexterm role="concept">
70095 <primary>bounce message</primary>
70096 <secondary>customizing</secondary>
70097 </indexterm>
70098 If <option>bounce_message_text</option> is set, its contents are included in the default
70099 message immediately after <quote>This message was created automatically by mail
70100 delivery software.</quote> The string is not expanded. It is not used if
70101 <option>bounce_message_file</option> is set.
70102 </para>
70103 <para>
70104 When <option>bounce_message_file</option> is set, it must point to a template file for
70105 constructing error messages. The file consists of a series of text items,
70106 separated by lines consisting of exactly four asterisks. If the file cannot be
70107 opened, default text is used and a message is written to the main and panic
70108 logs. If any text item in the file is empty, default text is used for that
70109 item.
70110 </para>
70111 <para>
70112 <indexterm role="variable">
70113 <primary><varname>$bounce_recipient</varname></primary>
70114 </indexterm>
70115 <indexterm role="variable">
70116 <primary><varname>$bounce_return_size_limit</varname></primary>
70117 </indexterm>
70118 Each item of text that is read from the file is expanded, and there are two
70119 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
70120 the recipient of an error message while it is being created, and
70121 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
70122 option, rounded to a whole number.
70123 </para>
70124 <para>
70125 The items must appear in the file in the following order:
70126 </para>
70127 <itemizedlist>
70128 <listitem>
70129 <para>
70130 The first item is included in the headers, and should include at least a
70131 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
70132 </para>
70133 </listitem>
70134 <listitem>
70135 <para>
70136 The second item forms the start of the error message. After it, Exim lists the
70137 failing addresses with their error messages.
70138 </para>
70139 </listitem>
70140 <listitem>
70141 <para>
70142 The third item is used to introduce any text from pipe transports that is to be
70143 returned to the sender. It is omitted if there is no such text.
70144 </para>
70145 </listitem>
70146 <listitem>
70147 <para>
70148 The fourth, fifth and sixth items will be ignored and may be empty.
70149 The fields exist for back-compatibility
70150 </para>
70151 </listitem>
70152 </itemizedlist>
70153 <para>
70154 The default state (<option>bounce_message_file</option> unset) is equivalent to the
70155 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
70156 other lines have been split in order to fit them on the page:
70157 </para>
70158 <literallayout class="monospaced">
70159 Subject: Mail delivery failed
70160   ${if eq{$sender_address}{$bounce_recipient}
70161   {: returning message to sender}}
70162 ****
70163 This message was created automatically by mail delivery software.
70164
70165 A message ${if eq{$sender_address}{$bounce_recipient}
70166   {that you sent }{sent by
70167
70168 &lt;$sender_address&gt;
70169
70170 }}could not be delivered to all of its recipients.
70171 This is a permanent error. The following address(es) failed:
70172 ****
70173 The following text was generated during the delivery attempt(s):
70174 ****
70175 ------ This is a copy of the message, including all the headers.
70176   ------
70177 ****
70178 ------ The body of the message is $message_size characters long;
70179   only the first
70180 ------ $bounce_return_size_limit or so are included here.
70181 ****
70182 </literallayout>
70183 </section>
70184 <section id="SECTcustwarn">
70185 <title>Customizing warning messages</title>
70186 <para>
70187 <indexterm role="concept">
70188 <primary>customizing</primary>
70189 <secondary>warning message</secondary>
70190 </indexterm>
70191 <indexterm role="concept">
70192 <primary>warning of delay</primary>
70193 <secondary>customizing the message</secondary>
70194 </indexterm>
70195 The option <option>warn_message_file</option> can be pointed at a template file for use when
70196 warnings about message delays are created. In this case there are only three
70197 text sections:
70198 </para>
70199 <itemizedlist>
70200 <listitem>
70201 <para>
70202 The first item is included in the headers, and should include at least a
70203 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
70204 </para>
70205 </listitem>
70206 <listitem>
70207 <para>
70208 The second item forms the start of the warning message. After it, Exim lists
70209 the delayed addresses.
70210 </para>
70211 </listitem>
70212 <listitem>
70213 <para>
70214 The third item then ends the message.
70215 </para>
70216 </listitem>
70217 </itemizedlist>
70218 <para>
70219 The default state is equivalent to the following file, except that some lines
70220 have been split here, in order to fit them on the page:
70221 </para>
70222 <literallayout class="monospaced">
70223 Subject: Warning: message $message_exim_id delayed
70224   $warn_message_delay
70225 ****
70226 This message was created automatically by mail delivery software.
70227
70228 A message ${if eq{$sender_address}{$warn_message_recipients}
70229 {that you sent }{sent by
70230
70231 &lt;$sender_address&gt;
70232
70233 }}has not been delivered to all of its recipients after
70234 more than $warn_message_delay in the queue on $primary_hostname.
70235
70236 The message identifier is:     $message_exim_id
70237 The subject of the message is: $h_subject
70238 The date of the message is:    $h_date
70239
70240 The following address(es) have not yet been delivered:
70241 ****
70242 No action is required on your part. Delivery attempts will
70243 continue for some time, and this warning may be repeated at
70244 intervals if the message remains undelivered. Eventually the
70245 mail delivery software will give up, and when that happens,
70246 the message will be returned to you.
70247 </literallayout>
70248 <para>
70249 <indexterm role="variable">
70250 <primary><varname>$warn_message_delay</varname></primary>
70251 </indexterm>
70252 <indexterm role="variable">
70253 <primary><varname>$warn_message_recipients</varname></primary>
70254 </indexterm>
70255 However, in the default state the subject and date lines are omitted if no
70256 appropriate headers exist. During the expansion of this file,
70257 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
70258 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
70259 of recipients for the warning message. There may be more than one if there are
70260 multiple addresses with different <option>errors_to</option> settings on the routers that
70261 handled them.
70262 </para>
70263 </section>
70264 </chapter>
70265
70266 <chapter id="CHAPcomconreq">
70267 <title>Some common configuration settings</title>
70268 <para>
70269 This chapter discusses some configuration settings that seem to be fairly
70270 common. More examples and discussion can be found in the Exim book.
70271 </para>
70272 <section id="SECID240">
70273 <title>Sending mail to a smart host</title>
70274 <para>
70275 <indexterm role="concept">
70276 <primary>smart host</primary>
70277 <secondary>example router</secondary>
70278 </indexterm>
70279 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
70280 should replace the default <command>dnslookup</command> router with a router which does the
70281 routing explicitly:
70282 </para>
70283 <literallayout class="monospaced">
70284 send_to_smart_host:
70285   driver = manualroute
70286   route_list = !+local_domains smart.host.name
70287   transport = remote_smtp
70288 </literallayout>
70289 <para>
70290 You can use the smart host&#x2019;s IP address instead of the name if you wish.
70291 If you are using Exim only to submit messages to a smart host, and not for
70292 receiving incoming messages, you can arrange for it to do the submission
70293 synchronously by setting the <option>mua_wrapper</option> option (see chapter
70294 <xref linkend="CHAPnonqueueing"/>).
70295 </para>
70296 </section>
70297 <section id="SECTmailinglists">
70298 <title>Using Exim to handle mailing lists</title>
70299 <para>
70300 <indexterm role="concept">
70301 <primary>mailing lists</primary>
70302 </indexterm>
70303 Exim can be used to run simple mailing lists, but for large and/or complicated
70304 requirements, the use of additional specialized mailing list software such as
70305 Majordomo or Mailman is recommended.
70306 </para>
70307 <para>
70308 The <command>redirect</command> router can be used to handle mailing lists where each list
70309 is maintained in a separate file, which can therefore be managed by an
70310 independent manager. The <option>domains</option> router option can be used to run these
70311 lists in a separate domain from normal mail. For example:
70312 </para>
70313 <literallayout class="monospaced">
70314 lists:
70315   driver = redirect
70316   domains = lists.example
70317   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
70318   forbid_pipe
70319   forbid_file
70320   errors_to = ${quote_local_part:$local_part-request}@lists.example
70321   no_more
70322 </literallayout>
70323 <para>
70324 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
70325 in that domain, it looks for a file that matches the local part. If there is no
70326 such file, the router declines, but because <option>no_more</option> is set, no subsequent
70327 routers are tried, and so the whole delivery fails.
70328 </para>
70329 <para>
70330 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
70331 expanded into a filename or a pipe delivery, which is usually inappropriate in
70332 a mailing list.
70333 </para>
70334 <para>
70335 <indexterm role="option">
70336 <primary><option>errors_to</option></primary>
70337 </indexterm>
70338 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
70339 taken from a mailing list are to be sent to the given address rather than the
70340 original sender of the message. However, before acting on this, Exim verifies
70341 the error address, and ignores it if verification fails.
70342 </para>
70343 <para>
70344 For example, using the configuration above, mail sent to
70345 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
70346 <filename>/usr/lists/dicts</filename>, with error reports directed to
70347 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
70348 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
70349 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
70350 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
70351 or <option>local_part_suffix</option> options) to handle addresses of the form
70352 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
70353 </para>
70354 </section>
70355 <section id="SECID241">
70356 <title>Syntax errors in mailing lists</title>
70357 <para>
70358 <indexterm role="concept">
70359 <primary>mailing lists</primary>
70360 <secondary>syntax errors in</secondary>
70361 </indexterm>
70362 If an entry in redirection data contains a syntax error, Exim normally defers
70363 delivery of the original address. That means that a syntax error in a mailing
70364 list holds up all deliveries to the list. This may not be appropriate when a
70365 list is being maintained automatically from data supplied by users, and the
70366 addresses are not rigorously checked.
70367 </para>
70368 <para>
70369 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
70370 entries that fail to parse, noting the incident in the log. If in addition
70371 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
70372 whenever a broken address is skipped. It is usually appropriate to set
70373 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
70374 </para>
70375 </section>
70376 <section id="SECID242">
70377 <title>Re-expansion of mailing lists</title>
70378 <para>
70379 <indexterm role="concept">
70380 <primary>mailing lists</primary>
70381 <secondary>re-expansion of</secondary>
70382 </indexterm>
70383 Exim remembers every individual address to which a message has been delivered,
70384 in order to avoid duplication, but it normally stores only the original
70385 recipient addresses with a message. If all the deliveries to a mailing list
70386 cannot be done at the first attempt, the mailing list is re-expanded when the
70387 delivery is next tried. This means that alterations to the list are taken into
70388 account at each delivery attempt, so addresses that have been added to
70389 the list since the message arrived will therefore receive a copy of the
70390 message, even though it pre-dates their subscription.
70391 </para>
70392 <para>
70393 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
70394 on the <command>redirect</command> router. If this is done, any addresses generated by the
70395 router that fail to deliver at the first attempt are added to the message as
70396 <quote>top level</quote> addresses, and the parent address that generated them is marked
70397 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
70398 subsequent delivery attempts. The disadvantage of this is that if any of the
70399 failing addresses are incorrect, correcting them in the file has no effect on
70400 pre-existing messages.
70401 </para>
70402 <para>
70403 The original top-level address is remembered with each of the generated
70404 addresses, and is output in any log messages. However, any intermediate parent
70405 addresses are not recorded. This makes a difference to the log only if the
70406 <option>all_parents</option> selector is set, but for mailing lists there is normally only
70407 one level of expansion anyway.
70408 </para>
70409 </section>
70410 <section id="SECID243">
70411 <title>Closed mailing lists</title>
70412 <para>
70413 <indexterm role="concept">
70414 <primary>mailing lists</primary>
70415 <secondary>closed</secondary>
70416 </indexterm>
70417 The examples so far have assumed open mailing lists, to which anybody may
70418 send mail. It is also possible to set up closed lists, where mail is accepted
70419 from specified senders only. This is done by making use of the generic
70420 <option>senders</option> option to restrict the router that handles the list.
70421 </para>
70422 <para>
70423 The following example uses the same file as a list of recipients and as a list
70424 of permitted senders. It requires three routers:
70425 </para>
70426 <literallayout class="monospaced">
70427 lists_request:
70428   driver = redirect
70429   domains = lists.example
70430   local_part_suffix = -request
70431   local_parts = ${lookup {$local_part} dsearch,filter=file {/usr/lists}}
70432   file = /usr/lists/${local_part_data}-request
70433   no_more
70434
70435 lists_post:
70436   driver = redirect
70437   domains = lists.example
70438   local_parts = ${lookup {$local_part} dsearch,filter=file,ret=full {/usr/lists}}
70439   senders = ${if exists {$local_part_data} {lsearch;$local_part_data}{*}}
70440   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
70441   forbid_pipe
70442   forbid_file
70443   errors_to = ${quote_local_part:$local_part-request}@lists.example
70444   no_more
70445
70446 lists_closed:
70447   driver = redirect
70448   domains = lists.example
70449   allow_fail
70450   data = :fail: $local_part@lists.example is a closed mailing list
70451 </literallayout>
70452 <para>
70453 All three routers have the same <option>domains</option> setting, so for any other domains,
70454 they are all skipped. The first router runs only if the local part ends in
70455 <option>-request</option>. It handles messages to the list manager(s) by means of an open
70456 mailing list.
70457 </para>
70458 <para>
70459 The second router runs only if the <option>senders</option> precondition is satisfied. It
70460 checks for the existence of a list that corresponds to the local part, and then
70461 checks that the sender is on the list by means of a linear search. It is
70462 necessary to check for the existence of the file before trying to search it,
70463 because otherwise Exim thinks there is a configuration error. If the file does
70464 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
70465 means that the router runs, but because there is no list, declines, and
70466 <option>no_more</option> ensures that no further routers are run. The address fails with an
70467 <quote>unrouteable address</quote> error.
70468 </para>
70469 <para>
70470 The third router runs only if the second router is skipped, which happens when
70471 a mailing list exists, but the sender is not on it. This router forcibly fails
70472 the address, giving a suitable error message.
70473 </para>
70474 </section>
70475 <section id="SECTverp">
70476 <title>Variable Envelope Return Paths (VERP)</title>
70477 <para>
70478 <indexterm role="concept">
70479 <primary>VERP</primary>
70480 </indexterm>
70481 <indexterm role="concept">
70482 <primary>Variable Envelope Return Paths</primary>
70483 </indexterm>
70484 <indexterm role="concept">
70485 <primary>envelope from</primary>
70486 </indexterm>
70487 <indexterm role="concept">
70488 <primary>envelope sender</primary>
70489 </indexterm>
70490 Variable Envelope Return Paths &ndash; see <emphasis role="bold"><ulink url="https://cr.yp.to/proto/verp.txt">https://cr.yp.to/proto/verp.txt</ulink></emphasis> &ndash;
70491 are a way of helping mailing list administrators discover which subscription
70492 address is the cause of a particular delivery failure. The idea is to encode
70493 the original recipient address in the outgoing envelope sender address, so that
70494 if the message is forwarded by another host and then subsequently bounces, the
70495 original recipient can be extracted from the recipient address of the bounce.
70496 </para>
70497 <para>
70498 <indexterm role="option">
70499 <primary><option>errors_to</option></primary>
70500 </indexterm>
70501 <indexterm role="option">
70502 <primary><option>return_path</option></primary>
70503 </indexterm>
70504 Envelope sender addresses can be modified by Exim using two different
70505 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
70506 list examples), or the <option>return_path</option> option on a transport. The second of
70507 these is effective only if the message is successfully delivered to another
70508 host; it is not used for errors detected on the local host (see the description
70509 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
70510 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
70511 </para>
70512 <literallayout class="monospaced">
70513 verp_smtp:
70514   driver = smtp
70515   max_rcpt = 1
70516   return_path = \
70517     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
70518       {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
70519 </literallayout>
70520 <para>
70521 This has the effect of rewriting the return path (envelope sender) on outgoing
70522 SMTP messages, if the local part of the original return path ends in
70523 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
70524 local part and domain of the recipient into the return path. Suppose, for
70525 example, that a message whose return path has been set to
70526 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
70527 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
70528 rewritten as
70529 </para>
70530 <literallayout class="monospaced">
70531 somelist-request+subscriber=other.dom.example@your.dom.example
70532 </literallayout>
70533 <para>
70534 <indexterm role="variable">
70535 <primary><varname>$local_part</varname></primary>
70536 </indexterm>
70537 For this to work, you must tell Exim to send multiple copies of messages that
70538 have more than one recipient, so that each copy has just one recipient. This is
70539 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
70540 might be sent to several different recipients in the same domain, in which case
70541 <varname>$local_part</varname> is not available in the transport, because it is not unique.
70542 </para>
70543 <para>
70544 Unless your host is doing nothing but mailing list deliveries, you should
70545 probably use a separate transport for the VERP deliveries, so as not to use
70546 extra resources in making one-per-recipient copies for other deliveries. This
70547 can easily be done by expanding the <option>transport</option> option in the router:
70548 </para>
70549 <literallayout class="monospaced">
70550 dnslookup:
70551   driver = dnslookup
70552   domains = ! +local_domains
70553   transport = \
70554     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
70555       {verp_smtp}{remote_smtp}}
70556   no_more
70557 </literallayout>
70558 <para>
70559 If you want to change the return path using <option>errors_to</option> in a router instead
70560 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
70561 routers that handle mailing list addresses. This will ensure that all delivery
70562 errors, including those detected on the local host, are sent to the VERP
70563 address.
70564 </para>
70565 <para>
70566 On a host that does no local deliveries and has no manual routing, only the
70567 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
70568 SMTP deliveries. Every mailing list recipient has its own return path value,
70569 and so Exim must hand them to the transport one at a time. Here is an example
70570 of a <command>dnslookup</command> router that implements VERP:
70571 </para>
70572 <literallayout class="monospaced">
70573 verp_dnslookup:
70574   driver = dnslookup
70575   domains = ! +local_domains
70576   transport = remote_smtp
70577   errors_to = \
70578     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
70579      {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
70580   no_more
70581 </literallayout>
70582 <para>
70583 Before you start sending out messages with VERPed return paths, you must also
70584 configure Exim to accept the bounce messages that come back to those paths.
70585 Typically this is done by setting a <option>local_part_suffix</option> option for a
70586 router, and using this to route the messages to wherever you want to handle
70587 them.
70588 </para>
70589 <para>
70590 The overhead incurred in using VERP depends very much on the size of the
70591 message, the number of recipient addresses that resolve to the same remote
70592 host, and the speed of the connection over which the message is being sent. If
70593 a lot of addresses resolve to the same host and the connection is slow, sending
70594 a separate copy of the message for each address may take substantially longer
70595 than sending a single copy with many recipients (for which VERP cannot be
70596 used).
70597 </para>
70598 </section>
70599 <section id="SECTvirtualdomains">
70600 <title>Virtual domains</title>
70601 <para>
70602 <indexterm role="concept">
70603 <primary>virtual domains</primary>
70604 </indexterm>
70605 <indexterm role="concept">
70606 <primary>domain</primary>
70607 <secondary>virtual</secondary>
70608 </indexterm>
70609 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
70610 meanings:
70611 </para>
70612 <itemizedlist>
70613 <listitem>
70614 <para>
70615 A domain for which there are no real mailboxes; all valid local parts are
70616 aliases for other email addresses. Common examples are organizational
70617 top-level domains and <quote>vanity</quote> domains.
70618 </para>
70619 </listitem>
70620 <listitem>
70621 <para>
70622 One of a number of independent domains that are all handled by the same host,
70623 with mailboxes on that host, but where the mailbox owners do not necessarily
70624 have login accounts on that host.
70625 </para>
70626 </listitem>
70627 </itemizedlist>
70628 <para>
70629 The first usage is probably more common, and does seem more <quote>virtual</quote> than
70630 the second. This kind of domain can be handled in Exim with a straightforward
70631 aliasing router. One approach is to create a separate alias file for each
70632 virtual domain. Exim can test for the existence of the alias file to determine
70633 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
70634 to a router of this form:
70635 </para>
70636 <literallayout class="monospaced">
70637 virtual:
70638   driver = redirect
70639   domains = dsearch;/etc/mail/virtual
70640   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain_data}}
70641   no_more
70642 </literallayout>
70643 <para>
70644 The <option>domains</option> option specifies that the router is to be skipped, unless there
70645 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
70646 domain that is being processed.
70647 The <command>dsearch</command> lookup used results in an untainted version of <varname>$domain</varname>
70648 being placed into the <varname>$domain_data</varname> variable.
70649 </para>
70650 <para>
70651 When the router runs, it looks up the local
70652 part in the file to find a new address (or list of addresses). The <option>no_more</option>
70653 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
70654 string), Exim gives up on the address without trying any subsequent routers.
70655 </para>
70656 <para>
70657 This one router can handle all the virtual domains because the alias filenames
70658 follow a fixed pattern. Permissions can be arranged so that appropriate people
70659 can edit the different alias files. A successful aliasing operation results in
70660 a new envelope recipient address, which is then routed from scratch.
70661 </para>
70662 <para>
70663 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
70664 way. One approach is to create a file for each domain containing a list of
70665 valid local parts, and use it in a router like this:
70666 </para>
70667 <literallayout class="monospaced">
70668 my_domains:
70669   driver = accept
70670   domains = dsearch;/etc/mail/domains
70671   local_parts = lsearch;/etc/mail/domains/$domain
70672   transport = my_mailboxes
70673 </literallayout>
70674 <para>
70675 The address is accepted if there is a file for the domain, and the local part
70676 can be found in the file. The <option>domains</option> option is used to check for the
70677 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
70678 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
70679 because that option is tested after <option>local_parts</option>. The transport is as
70680 follows:
70681 </para>
70682 <literallayout class="monospaced">
70683 my_mailboxes:
70684   driver = appendfile
70685   file = /var/mail/$domain_data/$local_part_data
70686   user = mail
70687 </literallayout>
70688 <para>
70689 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
70690 required, to specify which uid is to be used for writing to the mailboxes.
70691 </para>
70692 <para>
70693 The configuration shown here is just one example of how you might support this
70694 requirement. There are many other ways this kind of configuration can be set
70695 up, for example, by using a database instead of separate files to hold all the
70696 information about the domains.
70697 </para>
70698 </section>
70699 <section id="SECTmulbox">
70700 <title>Multiple user mailboxes</title>
70701 <para>
70702 <indexterm role="concept">
70703 <primary>multiple mailboxes</primary>
70704 </indexterm>
70705 <indexterm role="concept">
70706 <primary>mailbox</primary>
70707 <secondary>multiple</secondary>
70708 </indexterm>
70709 <indexterm role="concept">
70710 <primary>local part</primary>
70711 <secondary>prefix</secondary>
70712 </indexterm>
70713 <indexterm role="concept">
70714 <primary>local part</primary>
70715 <secondary>suffix</secondary>
70716 </indexterm>
70717 Heavy email users often want to operate with multiple mailboxes, into which
70718 incoming mail is automatically sorted. A popular way of handling this is to
70719 allow users to use multiple sender addresses, so that replies can easily be
70720 identified. Users are permitted to add prefixes or suffixes to their local
70721 parts for this purpose. The wildcard facility of the generic router options
70722 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
70723 example, consider this router:
70724 </para>
70725 <literallayout class="monospaced">
70726 userforward:
70727   driver = redirect
70728   check_local_user
70729   file = $home/.forward
70730   local_part_suffix = -*
70731   local_part_suffix_optional
70732   allow_filter
70733 </literallayout>
70734 <para>
70735 <indexterm role="variable">
70736 <primary><varname>$local_part_suffix</varname></primary>
70737 </indexterm>
70738 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
70739 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
70740 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
70741 </para>
70742 <literallayout class="monospaced">
70743 if $local_part_suffix contains -special then
70744 save /home/$local_part_data/Mail/special
70745 endif
70746 </literallayout>
70747 <para>
70748 If the filter file does not exist, or does not deal with such addresses, they
70749 fall through to subsequent routers, and, assuming no subsequent use of the
70750 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
70751 control over which suffixes are valid.
70752 </para>
70753 <para>
70754 Alternatively, a suffix can be used to trigger the use of a different
70755 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
70756 another MTA:
70757 </para>
70758 <literallayout class="monospaced">
70759 userforward:
70760   driver = redirect
70761   check_local_user
70762   local_part_suffix = -*
70763   local_part_suffix_optional
70764   file = ${lookup {.forward$local_part_suffix} dsearch,ret=full {$home} {$value}fail}
70765   allow_filter
70766 </literallayout>
70767 <para>
70768 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
70769 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
70770 does not exist, or does not deal with the address, it is passed on to
70771 subsequent routers, which could, if required, look for an unqualified
70772 <filename>.forward</filename> file to use as a default.
70773 </para>
70774 </section>
70775 <section id="SECID244">
70776 <title>Simplified vacation processing</title>
70777 <para>
70778 <indexterm role="concept">
70779 <primary>vacation processing</primary>
70780 </indexterm>
70781 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
70782 a pipe command in a <filename>.forward</filename> file
70783 (see section <xref linkend="SECTspecitredli"/> for syntax details).
70784 This is prone to error by inexperienced users. There are two features of Exim
70785 that can be used to make this process simpler for users:
70786 </para>
70787 <itemizedlist>
70788 <listitem>
70789 <para>
70790 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
70791 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
70792 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
70793 <filename>.forward</filename> file are then much simpler. For example:
70794 </para>
70795 <literallayout class="monospaced">
70796 spqr, vacation-spqr
70797 </literallayout>
70798 </listitem>
70799 <listitem>
70800 <para>
70801 The <option>require_files</option> generic router option can be used to trigger a
70802 vacation delivery by checking for the existence of a certain file in the
70803 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
70804 ensure that the original delivery also proceeds. In this case, all the user has
70805 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
70806 message.
70807 </para>
70808 </listitem>
70809 </itemizedlist>
70810 <para>
70811 Another advantage of both these methods is that they both work even when the
70812 use of arbitrary pipes by users is locked out.
70813 </para>
70814 </section>
70815 <section id="SECID245">
70816 <title>Taking copies of mail</title>
70817 <para>
70818 <indexterm role="concept">
70819 <primary>message</primary>
70820 <secondary>copying every</secondary>
70821 </indexterm>
70822 Some installations have policies that require archive copies of all messages to
70823 be made. A single copy of each message can easily be taken by an appropriate
70824 command in a system filter, which could, for example, use a different file for
70825 each day&#x2019;s messages.
70826 </para>
70827 <para>
70828 There is also a shadow transport mechanism that can be used to take copies of
70829 messages that are successfully delivered by local transports, one copy per
70830 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
70831 notification of delivery by sites that insist on doing such things.
70832 </para>
70833 </section>
70834 <section id="SECID246">
70835 <title>Intermittently connected hosts</title>
70836 <para>
70837 <indexterm role="concept">
70838 <primary>intermittently connected hosts</primary>
70839 </indexterm>
70840 It has become quite common (because it is cheaper) for hosts to connect to the
70841 Internet periodically rather than remain connected all the time. The normal
70842 arrangement is that mail for such hosts accumulates on a system that is
70843 permanently connected.
70844 </para>
70845 <para>
70846 Exim was designed for use on permanently connected hosts, and so it is not
70847 particularly well-suited to use in an intermittently connected environment.
70848 Nevertheless there are some features that can be used.
70849 </para>
70850 </section>
70851 <section id="SECID247">
70852 <title>Exim on the upstream server host</title>
70853 <para>
70854 It is tempting to arrange for incoming mail for the intermittently connected
70855 host to remain in Exim&#x2019;s queue until the client connects. However, this
70856 approach does not scale very well. Two different kinds of waiting message are
70857 being mixed up in the same queue &ndash; those that cannot be delivered because of
70858 some temporary problem, and those that are waiting for their destination host
70859 to connect. This makes it hard to manage the queue, as well as wasting
70860 resources, because each queue runner scans the entire queue.
70861 </para>
70862 <para>
70863 A better approach is to separate off those messages that are waiting for an
70864 intermittently connected host. This can be done by delivering these messages
70865 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
70866 format, from where they are transmitted by other software when their
70867 destination connects. This makes it easy to collect all the mail for one host
70868 in a single directory, and to apply local timeout rules on a per-message basis
70869 if required.
70870 </para>
70871 <para>
70872 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
70873 you are doing this, you should configure Exim with a long retry period for the
70874 intermittent host. For example:
70875 </para>
70876 <literallayout class="monospaced">
70877 cheshire.wonderland.fict.example    *   F,5d,24h
70878 </literallayout>
70879 <para>
70880 This stops a lot of failed delivery attempts from occurring, but Exim remembers
70881 which messages it has queued up for that host. Once the intermittent host comes
70882 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
70883 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
70884 causes all the queued up messages to be delivered, often down a single SMTP
70885 connection. While the host remains connected, any new messages get delivered
70886 immediately.
70887 </para>
70888 <para>
70889 If the connecting hosts do not have fixed IP addresses, that is, if a host is
70890 issued with a different IP address each time it connects, Exim&#x2019;s retry
70891 mechanisms on the holding host get confused, because the IP address is normally
70892 used as part of the key string for holding retry information. This can be
70893 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
70894 Since this has disadvantages for permanently connected hosts, it is best to
70895 arrange a separate transport for the intermittently connected ones.
70896 </para>
70897 </section>
70898 <section id="SECID248">
70899 <title>Exim on the intermittently connected client host</title>
70900 <para>
70901 The value of <option>smtp_accept_queue_per_connection</option> should probably be
70902 increased, or even set to zero (that is, disabled) on the intermittently
70903 connected host, so that all incoming messages down a single connection get
70904 delivered immediately.
70905 </para>
70906 <para>
70907 <indexterm role="concept">
70908 <primary>SMTP</primary>
70909 <secondary>passed connection</secondary>
70910 </indexterm>
70911 <indexterm role="concept">
70912 <primary>SMTP</primary>
70913 <secondary>multiple deliveries</secondary>
70914 </indexterm>
70915 <indexterm role="concept">
70916 <primary>multiple SMTP deliveries</primary>
70917 </indexterm>
70918 <indexterm role="concept">
70919 <primary>first pass routing</primary>
70920 </indexterm>
70921 Mail waiting to be sent from an intermittently connected host will probably
70922 not have been routed, because without a connection DNS lookups are not
70923 possible. This means that if a normal queue run is done at connection time,
70924 each message is likely to be sent in a separate SMTP session. This can be
70925 avoided by starting the queue run with a command line option beginning with
70926 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
70927 first pass, routing is done but no deliveries take place. The second pass is a
70928 normal queue run; since all the messages have been previously routed, those
70929 destined for the same host are likely to get sent as multiple deliveries in a
70930 single SMTP connection.
70931 </para>
70932 </section>
70933 </chapter>
70934
70935 <chapter id="CHAPnonqueueing">
70936 <title>Using Exim as a non-queueing client</title>
70937 <titleabbrev>Exim as a non-queueing client</titleabbrev>
70938 <para>
70939 <indexterm role="concept">
70940 <primary>client, non-queueing</primary>
70941 </indexterm>
70942 <indexterm role="concept">
70943 <primary>smart host</primary>
70944 <secondary>suppressing queueing</secondary>
70945 </indexterm>
70946 On a personal computer, it is a common requirement for all
70947 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
70948 configured to operate that way, for all the popular operating systems.
70949 However, there are some MUAs for Unix-like systems that cannot be so
70950 configured: they submit messages using the command line interface of
70951 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
70952 messages this way.
70953 </para>
70954 <para>
70955 If the personal computer runs continuously, there is no problem, because it can
70956 run a conventional MTA that handles delivery to the smart host, and deal with
70957 any delays via its queueing mechanism. However, if the computer does not run
70958 continuously or runs different operating systems at different times, queueing
70959 email is not desirable.
70960 </para>
70961 <para>
70962 There is therefore a requirement for something that can provide the
70963 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
70964 any queueing or retrying facilities. Furthermore, the delivery to the smart
70965 host should be synchronous, so that if it fails, the sending MUA is immediately
70966 informed. In other words, we want something that extends an MUA that submits
70967 to a local MTA via the command line so that it behaves like one that submits
70968 to a remote smart host using TCP/SMTP.
70969 </para>
70970 <para>
70971 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
70972 that do this job. However, people have found them to be lacking in various
70973 ways. For instance, you might want to allow aliasing and forwarding to be done
70974 before sending a message to the smart host.
70975 </para>
70976 <para>
70977 Exim already had the necessary infrastructure for doing this job. Just a few
70978 tweaks were needed to make it behave as required, though it is somewhat of an
70979 overkill to use a fully-featured MTA for this purpose.
70980 </para>
70981 <para>
70982 <indexterm role="option">
70983 <primary><option>mua_wrapper</option></primary>
70984 </indexterm>
70985 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
70986 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
70987 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
70988 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
70989 compatible router and transport configuration. Typically there will be just one
70990 router and one transport, sending everything to a smart host.
70991 </para>
70992 <para>
70993 When run in MUA wrapping mode, the behaviour of Exim changes in the
70994 following ways:
70995 </para>
70996 <itemizedlist>
70997 <listitem>
70998 <para>
70999 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
71000 In other words, the only way to submit messages is via the command line.
71001 </para>
71002 </listitem>
71003 <listitem>
71004 <para>
71005 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
71006 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
71007 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
71008 does not finish until the delivery attempt is complete. If the delivery is
71009 successful, a zero return code is given.
71010 </para>
71011 </listitem>
71012 <listitem>
71013 <para>
71014 Address redirection is permitted, but the final routing for all addresses must
71015 be to the same remote transport, and to the same list of hosts. Furthermore,
71016 the return address (envelope sender) must be the same for all recipients, as
71017 must any added or deleted header lines. In other words, it must be possible to
71018 deliver the message in a single SMTP transaction, however many recipients there
71019 are.
71020 </para>
71021 </listitem>
71022 <listitem>
71023 <para>
71024 If these conditions are not met, or if routing any address results in a
71025 failure or defer status, or if Exim is unable to deliver all the recipients
71026 successfully to one of the smart hosts, delivery of the entire message fails.
71027 </para>
71028 </listitem>
71029 <listitem>
71030 <para>
71031 Because no queueing is allowed, all failures are treated as permanent; there
71032 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
71033 smart host. Furthermore, because only a single yes/no response can be given to
71034 the caller, it is not possible to deliver to some recipients and not others. If
71035 there is an error (temporary or permanent) for any recipient, all are failed.
71036 </para>
71037 </listitem>
71038 <listitem>
71039 <para>
71040 If more than one smart host is listed, Exim will try another host after a
71041 connection failure or a timeout, in the normal way. However, if this kind of
71042 failure happens for all the hosts, the delivery fails.
71043 </para>
71044 </listitem>
71045 <listitem>
71046 <para>
71047 When delivery fails, an error message is written to the standard error stream
71048 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
71049 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
71050 are ever generated.
71051 </para>
71052 </listitem>
71053 <listitem>
71054 <para>
71055 No retry data is maintained, and any retry rules are ignored.
71056 </para>
71057 </listitem>
71058 <listitem>
71059 <para>
71060 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
71061 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
71062 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
71063 </para>
71064 </listitem>
71065 </itemizedlist>
71066 <para>
71067 The overall effect is that Exim makes a single synchronous attempt to deliver
71068 the message, failing if there is any kind of problem. Because no local
71069 deliveries are done and no daemon can be run, Exim does not need root
71070 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
71071 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
71072 the advantages and disadvantages of running without root privilege.
71073 </para>
71074 </chapter>
71075
71076 <chapter id="CHAPlog">
71077 <title>Log files</title>
71078 <para>
71079 <indexterm role="concept" id="IIDloggen" class="startofrange">
71080 <primary>log</primary>
71081 <secondary>general description</secondary>
71082 </indexterm>
71083 <indexterm role="concept">
71084 <primary>log</primary>
71085 <secondary>types of</secondary>
71086 </indexterm>
71087 Exim writes three different logs, referred to as the main log, the reject log,
71088 and the panic log:
71089 </para>
71090 <itemizedlist>
71091 <listitem>
71092 <para>
71093 <indexterm role="concept">
71094 <primary>main log</primary>
71095 </indexterm>
71096 The main log records the arrival of each message and each delivery in a single
71097 line in each case. The format is as compact as possible, in an attempt to keep
71098 down the size of log files. Two-character flag sequences make it easy to pick
71099 out these lines. A number of other events are recorded in the main log. Some of
71100 them are optional, in which case the <option>log_selector</option> option controls whether
71101 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
71102 analysis of main log files, is provided in the Exim distribution (see section
71103 <xref linkend="SECTmailstat"/>).
71104 </para>
71105 </listitem>
71106 <listitem>
71107 <para>
71108 <indexterm role="concept">
71109 <primary>reject log</primary>
71110 </indexterm>
71111 The reject log records information from messages that are rejected as a result
71112 of a configuration option (that is, for policy reasons).
71113 The first line of each rejection is a copy of the line that is also written to
71114 the main log. Then, if the message&#x2019;s header has been read at the time the log
71115 is written, its contents are written to this log. Only the original header
71116 lines are available; header lines added by ACLs are not logged. You can use the
71117 reject log to check that your policy controls are working correctly; on a busy
71118 host this may be easier than scanning the main log for rejection messages. You
71119 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
71120 false.
71121 </para>
71122 </listitem>
71123 <listitem>
71124 <para>
71125 <indexterm role="concept">
71126 <primary>panic log</primary>
71127 </indexterm>
71128 <indexterm role="concept">
71129 <primary>system log</primary>
71130 </indexterm>
71131 When certain serious errors occur, Exim writes entries to its panic log. If the
71132 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
71133 are usually written to the main log as well, but can get lost amid the mass of
71134 other entries. The panic log should be empty under normal circumstances. It is
71135 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
71136 regularly, in order to become aware of any problems. When Exim cannot open its
71137 panic log, it tries as a last resort to write to the system log (syslog). This
71138 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
71139 message itself is written at priority LOG_CRIT.
71140 </para>
71141 </listitem>
71142 </itemizedlist>
71143 <para>
71144 Every log line starts with a timestamp, in the format shown in the following
71145 example. Note that many of the examples shown in this chapter are line-wrapped.
71146 In the log file, this would be all on one line:
71147 </para>
71148 <literallayout class="monospaced">
71149 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
71150   by QUIT
71151 </literallayout>
71152 <para>
71153 By default, the timestamps are in the local timezone. There are two
71154 ways of changing this:
71155 </para>
71156 <itemizedlist>
71157 <listitem>
71158 <para>
71159 You can set the <option>timezone</option> option to a different time zone; in particular, if
71160 you set
71161 </para>
71162 <literallayout class="monospaced">
71163 timezone = UTC
71164 </literallayout>
71165 <para>
71166 the timestamps will be in UTC (aka GMT).
71167 </para>
71168 </listitem>
71169 <listitem>
71170 <para>
71171 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
71172 example:
71173 </para>
71174 <literallayout class="monospaced">
71175 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
71176 </literallayout>
71177 </listitem>
71178 </itemizedlist>
71179 <para>
71180 <indexterm role="concept">
71181 <primary>log</primary>
71182 <secondary>process ids in</secondary>
71183 </indexterm>
71184 <indexterm role="concept">
71185 <primary>pid (process id)</primary>
71186 <secondary>in log lines</secondary>
71187 </indexterm>
71188 Exim does not include its process id in log lines by default, but you can
71189 request that it does so by specifying the <literal>pid</literal> log selector (see section
71190 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
71191 brackets, immediately after the time and date.
71192 </para>
71193 <section id="SECTwhelogwri">
71194 <title>Where the logs are written</title>
71195 <para>
71196 <indexterm role="concept">
71197 <primary>log</primary>
71198 <secondary>destination</secondary>
71199 </indexterm>
71200 <indexterm role="concept">
71201 <primary>log</primary>
71202 <secondary>to file</secondary>
71203 </indexterm>
71204 <indexterm role="concept">
71205 <primary>log</primary>
71206 <secondary>to syslog</secondary>
71207 </indexterm>
71208 <indexterm role="concept">
71209 <primary>syslog</primary>
71210 </indexterm>
71211 The logs may be written to local files, or to syslog, or both. However, it
71212 should be noted that many syslog implementations use UDP as a transport, and
71213 are therefore unreliable in the sense that messages are not guaranteed to
71214 arrive at the loghost, nor is the ordering of messages necessarily maintained.
71215 It has also been reported that on large log files (tens of megabytes) you may
71216 need to tweak syslog to prevent it syncing the file with each write &ndash; on
71217 Linux this has been seen to make syslog take 90% plus of CPU time.
71218 </para>
71219 <para>
71220 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
71221 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the runtime
71222 configuration. This latter string is expanded, so it can contain, for example,
71223 references to the host name:
71224 </para>
71225 <literallayout class="monospaced">
71226 log_file_path = /var/log/$primary_hostname/exim_%slog
71227 </literallayout>
71228 <para>
71229 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
71230 rather than at runtime, because then the setting is available right from the
71231 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
71232 before it has read the configuration file (for example, an error in the
71233 configuration file) it will not use the path you want, and may not be able to
71234 log at all.
71235 </para>
71236 <para>
71237 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
71238 list, currently limited to at most two items. This is one option where the
71239 facility for changing a list separator may not be used. The list must always be
71240 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
71241 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
71242 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
71243 implying the use of a default path.
71244 </para>
71245 <para>
71246 When Exim encounters an empty item in the list, it searches the list defined by
71247 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
71248 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
71249 mean <quote>use the path specified at build time</quote>. If no such item exists, log
71250 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
71251 equivalent to the configuration file setting:
71252 </para>
71253 <literallayout class="monospaced">
71254 log_file_path = $spool_directory/log/%slog
71255 </literallayout>
71256 <para>
71257 If you do not specify anything at build time or runtime,
71258 or if you unset the option at runtime (i.e. <literal>log_file_path = </literal>),
71259 that is where the logs are written.
71260 </para>
71261 <para>
71262 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log filenames
71263 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
71264 </para>
71265 <para>
71266 Here are some examples of possible Makefile settings:
71267 </para>
71268 <literallayout>
71269 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
71270 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
71271 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
71272 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
71273 </literallayout>
71274 <para>
71275 If there are more than two paths in the list, the first is used and a panic
71276 error is logged.
71277 </para>
71278 </section>
71279 <section id="SECID285">
71280 <title>Logging to local files that are periodically <quote>cycled</quote></title>
71281 <para>
71282 <indexterm role="concept">
71283 <primary>log</primary>
71284 <secondary>cycling local files</secondary>
71285 </indexterm>
71286 <indexterm role="concept">
71287 <primary>cycling logs</primary>
71288 </indexterm>
71289 <indexterm role="concept">
71290 <primary><emphasis>exicyclog</emphasis></primary>
71291 </indexterm>
71292 <indexterm role="concept">
71293 <primary>log</primary>
71294 <secondary>local files; writing to</secondary>
71295 </indexterm>
71296 Some operating systems provide centralized and standardized methods for cycling
71297 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
71298 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
71299 main and reject logs each time it is called. The maximum number of old logs to
71300 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
71301 </para>
71302 <para>
71303 An Exim delivery process opens the main log when it first needs to write to it,
71304 and it keeps the file open in case subsequent entries are required &ndash; for
71305 example, if a number of different deliveries are being done for the same
71306 message. However, remote SMTP deliveries can take a long time, and this means
71307 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
71308 something similar is being used to rename log files on a regular basis. To
71309 ensure that a switch of log files is noticed as soon as possible, Exim calls
71310 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
71311 does not exist, or its inode has changed, the old file is closed and Exim
71312 tries to open the main log from scratch. Thus, an old log file may remain open
71313 for quite some time, but no Exim processes should write to it once it has been
71314 renamed.
71315 </para>
71316 </section>
71317 <section id="SECTdatlogfil">
71318 <title>Datestamped log files</title>
71319 <para>
71320 <indexterm role="concept">
71321 <primary>log</primary>
71322 <secondary>datestamped files</secondary>
71323 </indexterm>
71324 Instead of cycling the main and reject log files by renaming them
71325 periodically, some sites like to use files whose names contain a datestamp,
71326 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
71327 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
71328 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
71329 point where the datestamp is required. For example:
71330 </para>
71331 <literallayout class="monospaced">
71332 log_file_path = /var/spool/exim/log/%slog-%D
71333 log_file_path = /var/log/exim-%s-%D.log
71334 log_file_path = /var/spool/exim/log/%D-%slog
71335 log_file_path = /var/log/exim/%s.%M
71336 </literallayout>
71337 <para>
71338 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
71339 examples of names generated by the above examples:
71340 </para>
71341 <literallayout class="monospaced">
71342 /var/spool/exim/log/mainlog-20021225
71343 /var/log/exim-reject-20021225.log
71344 /var/spool/exim/log/20021225-mainlog
71345 /var/log/exim/main.200212
71346 </literallayout>
71347 <para>
71348 When this form of log file is specified, Exim automatically switches to new
71349 files at midnight. It does not make any attempt to compress old logs; you
71350 will need to write your own script if you require this. You should not
71351 run <emphasis>exicyclog</emphasis> with this form of logging.
71352 </para>
71353 <para>
71354 The location of the panic log is also determined by <option>log_file_path</option>, but it
71355 is not datestamped, because rotation of the panic log does not make sense.
71356 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
71357 the string. In addition, if it immediately follows a slash, a following
71358 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
71359 character is removed. Thus, the four examples above would give these panic
71360 log names:
71361 </para>
71362 <literallayout class="monospaced">
71363 /var/spool/exim/log/paniclog
71364 /var/log/exim-panic.log
71365 /var/spool/exim/log/paniclog
71366 /var/log/exim/panic
71367 </literallayout>
71368 </section>
71369 <section id="SECID249">
71370 <title>Logging to syslog</title>
71371 <para>
71372 <indexterm role="concept">
71373 <primary>log</primary>
71374 <secondary>syslog; writing to</secondary>
71375 </indexterm>
71376 The use of syslog does not change what Exim logs or the format of its messages,
71377 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
71378 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
71379 that, the same strings are written to syslog as to log files. The syslog
71380 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
71381 by default, but you can change these by setting the <option>syslog_facility</option> and
71382 <option>syslog_processname</option> options, respectively. If Exim was compiled with
71383 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
71384 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
71385 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
71386 the time and host name to each line.
71387 The three log streams are mapped onto syslog priorities as follows:
71388 </para>
71389 <itemizedlist>
71390 <listitem>
71391 <para>
71392 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
71393 </para>
71394 </listitem>
71395 <listitem>
71396 <para>
71397 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
71398 </para>
71399 </listitem>
71400 <listitem>
71401 <para>
71402 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
71403 </para>
71404 </listitem>
71405 </itemizedlist>
71406 <para>
71407 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
71408 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
71409 these are routed by syslog to the same place. You can suppress this duplication
71410 by setting <option>syslog_duplication</option> false.
71411 </para>
71412 <para>
71413 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
71414 entries contain multiple lines when headers are included. To cope with both
71415 these cases, entries written to syslog are split into separate <function>syslog()</function>
71416 calls at each internal newline, and also after a maximum of
71417 870 data characters. (This allows for a total syslog line length of 1024, when
71418 additions such as timestamps are added.) If you are running a syslog
71419 replacement that can handle lines longer than the 1024 characters allowed by
71420 RFC 3164, you should set
71421 </para>
71422 <literallayout class="monospaced">
71423 SYSLOG_LONG_LINES=yes
71424 </literallayout>
71425 <para>
71426 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
71427 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
71428 </para>
71429 <para>
71430 To make it easy to re-assemble split lines later, each component of a split
71431 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;]
71432 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
71433 components in the entry. The / delimiter is used when the line was split
71434 because it was too long; if it was split because of an internal newline, the \
71435 delimiter is used. For example, supposing the length limit to be 50 instead of
71436 870, the following would be the result of a typical rejection message to
71437 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
71438 name, and pid as added by syslog:
71439 </para>
71440 <literallayout class="monospaced">
71441 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
71442 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
71443 [3/5]  when scanning for sender: missing or malformed lo
71444 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
71445 [5/5] mple&gt;)
71446 </literallayout>
71447 <para>
71448 The same error might cause the following lines to be written to <quote>rejectlog</quote>
71449 (LOG_NOTICE):
71450 </para>
71451 <literallayout class="monospaced">
71452 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
71453 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
71454 [3/18] er when scanning for sender: missing or malformed
71455 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
71456 [5\18] .example&gt;)
71457 [6\18] Recipients: ph10@some.domain.cam.example
71458 [7\18] P Received: from [127.0.0.1] (ident=ph10)
71459 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
71460 [9\18]        id 16RdAL-0006pc-00
71461 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
71462 [11\18] 09:43 +0100
71463 [12\18] F From: &lt;&gt;
71464 [13\18]   Subject: this is a test header
71465 [18\18]   X-something: this is another header
71466 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
71467 [16\18] le&gt;
71468 [17\18] B Bcc:
71469 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
71470 </literallayout>
71471 <para>
71472 Log lines that are neither too long nor contain newlines are written to syslog
71473 without modification.
71474 </para>
71475 <para>
71476 If only syslog is being used, the Exim monitor is unable to provide a log tail
71477 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
71478 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
71479 where it is.
71480 </para>
71481 </section>
71482 <section id="SECID250">
71483 <title>Log line flags</title>
71484 <para>
71485 One line is written to the main log for each message received, and for each
71486 successful, unsuccessful, and delayed delivery. These lines can readily be
71487 picked out by the distinctive two-character flags that immediately follow the
71488 timestamp. The flags are:
71489 </para>
71490 <informaltable frame="none">
71491 <tgroup cols="2" colsep="0" rowsep="0">
71492 <colspec colwidth="10*" align="left"/>
71493 <colspec colwidth="90*" align="left"/>
71494 <tbody>
71495 <row>
71496 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>&lt;=</option></entry>
71497 <entry>message arrival</entry>
71498 </row>
71499 <row>
71500 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>(=</option></entry>
71501 <entry>message fakereject</entry>
71502 </row>
71503 <row>
71504 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>=&gt;</option></entry>
71505 <entry>normal message delivery</entry>
71506 </row>
71507 <row>
71508 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>-&gt;</option></entry>
71509 <entry>additional address in same delivery</entry>
71510 </row>
71511 <row>
71512 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>&gt;&gt;</option></entry>
71513 <entry>cutthrough message delivery</entry>
71514 </row>
71515 <row>
71516 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>*&gt;</option></entry>
71517 <entry>delivery suppressed by <option>-N</option></entry>
71518 </row>
71519 <row>
71520 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>**</option></entry>
71521 <entry>delivery failed; address bounced</entry>
71522 </row>
71523 <row>
71524 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>==</option></entry>
71525 <entry>delivery deferred; temporary problem</entry>
71526 </row>
71527 </tbody>
71528 </tgroup>
71529 </informaltable>
71530 </section>
71531 <section id="SECID251">
71532 <title>Logging message reception</title>
71533 <para>
71534 <indexterm role="concept">
71535 <primary>log</primary>
71536 <secondary>reception line</secondary>
71537 </indexterm>
71538 The format of the single-line entry in the main log that is written for every
71539 message received is shown in the basic example below, which is split over
71540 several lines in order to fit it on the page:
71541 </para>
71542 <literallayout class="monospaced">
71543 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
71544   H=mailer.fict.example [192.168.123.123] U=exim
71545   P=smtp S=5678 id=&lt;incoming message id&gt;
71546 </literallayout>
71547 <para>
71548 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
71549 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
71550 generated, this is followed by an item of the form
71551 </para>
71552 <literallayout class="monospaced">
71553 R=&lt;message id&gt;
71554 </literallayout>
71555 <para>
71556 which is a reference to the message that caused the bounce to be sent.
71557 </para>
71558 <para>
71559 <indexterm role="concept">
71560 <primary>HELO</primary>
71561 </indexterm>
71562 <indexterm role="concept">
71563 <primary>EHLO</primary>
71564 </indexterm>
71565 For messages from other hosts, the H and U fields identify the remote host and
71566 record the RFC 1413 identity of the user that sent the message, if one was
71567 received. The number given in square brackets is the IP address of the sending
71568 host. If there is a single, unparenthesized  host name in the H field, as
71569 above, it has been verified to correspond to the IP address (see the
71570 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
71571 by the remote host in the SMTP HELO or EHLO command, and has not been
71572 verified. If verification yields a different name to that given for HELO or
71573 EHLO, the verified name appears first, followed by the HELO or EHLO
71574 name in parentheses.
71575 </para>
71576 <para>
71577 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
71578 without brackets, in the HELO or EHLO command, leading to entries in
71579 the log containing text like these examples:
71580 </para>
71581 <literallayout class="monospaced">
71582 H=(10.21.32.43) [192.168.8.34]
71583 H=([10.21.32.43]) [192.168.8.34]
71584 </literallayout>
71585 <para>
71586 This can be confusing. Only the final address in square brackets can be relied
71587 on.
71588 </para>
71589 <para>
71590 For locally generated messages (that is, messages not received over TCP/IP),
71591 the H field is omitted, and the U field contains the login name of the caller
71592 of Exim.
71593 </para>
71594 <para>
71595 <indexterm role="concept">
71596 <primary>authentication</primary>
71597 <secondary>logging</secondary>
71598 </indexterm>
71599 <indexterm role="concept">
71600 <primary>AUTH</primary>
71601 <secondary>logging</secondary>
71602 </indexterm>
71603 For all messages, the P field specifies the protocol used to receive the
71604 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
71605 of incoming SMTP messages, the value indicates whether or not any SMTP
71606 extensions (ESMTP), encryption, or authentication were used. If the SMTP
71607 session was encrypted, there is an additional X field that records the cipher
71608 suite that was used.
71609 </para>
71610 <para>
71611 <indexterm role="concept">
71612 <primary>log</primary>
71613 <secondary>protocol</secondary>
71614 </indexterm>
71615 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
71616 hosts that have authenticated themselves using the SMTP AUTH command. The first
71617 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
71618 there is an additional item A= followed by the name of the authenticator that
71619 was used. If an authenticated identification was set up by the authenticator&#x2019;s
71620 <option>server_set_id</option> option, this is logged too, separated by a colon from the
71621 authenticator name.
71622 </para>
71623 <para>
71624 <indexterm role="concept">
71625 <primary>size</primary>
71626 <secondary>of message</secondary>
71627 </indexterm>
71628 The id field records the existing message id, if present. The size of the
71629 received message is given by the S field. When the message is delivered,
71630 headers may be removed or added, so that the size of delivered copies of the
71631 message may not correspond with this value (and indeed may be different to each
71632 other).
71633 </para>
71634 <para>
71635 The <option>log_selector</option> option can be used to request the logging of additional
71636 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
71637 </para>
71638 </section>
71639 <section id="SECID252">
71640 <title>Logging deliveries</title>
71641 <para>
71642 <indexterm role="concept">
71643 <primary>log</primary>
71644 <secondary>delivery line</secondary>
71645 </indexterm>
71646 The format of the single-line entry in the main log that is written for every
71647 delivery is shown in one of the examples below, for local and remote
71648 deliveries, respectively. Each example has been split into multiple lines in order
71649 to fit it on the page:
71650 </para>
71651 <literallayout class="monospaced">
71652 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
71653   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
71654 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
71655   monk@holistic.fict.example R=dnslookup T=remote_smtp
71656   H=holistic.fict.example [192.168.234.234]
71657 </literallayout>
71658 <para>
71659 For ordinary local deliveries, the original address is given in angle brackets
71660 after the final delivery address, which might be a pipe or a file. If
71661 intermediate address(es) exist between the original and the final address, the
71662 last of these is given in parentheses after the final address. The R and T
71663 fields record the router and transport that were used to process the address.
71664 </para>
71665 <para>
71666 If SMTP AUTH was used for the delivery there is an additional item A=
71667 followed by the name of the authenticator that was used.
71668 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
71669 option, this is logged too, as a second colon-separated list item.
71670 Optionally (see the <option>smtp_mailauth</option> <option>log_selector</option>) there may be a third list item.
71671 </para>
71672 <para>
71673 If a shadow transport was run after a successful local delivery, the log line
71674 for the successful delivery has an item added on the end, of the form
71675 </para>
71676 <literallayout>
71677 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
71678 </literallayout>
71679 <para>
71680 If the shadow transport did not succeed, the error message is put in
71681 parentheses afterwards.
71682 </para>
71683 <para>
71684 <indexterm role="concept">
71685 <primary>asterisk</primary>
71686 <secondary>after IP address</secondary>
71687 </indexterm>
71688 When more than one address is included in a single delivery (for example, two
71689 SMTP RCPT commands in one transaction) the second and subsequent addresses are
71690 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
71691 down a single SMTP connection, an asterisk follows the
71692 remote IP address (and port if enabled)
71693 in the log lines for the second and subsequent messages.
71694 When two or more messages are delivered down a single TLS connection, the
71695 DNS and some TLS-related information logged for the first message delivered
71696 will not be present in the log lines for the second and subsequent messages.
71697 TLS cipher information is still available.
71698 </para>
71699 <para>
71700 <indexterm role="concept">
71701 <primary>delivery</primary>
71702 <secondary>cutthrough; logging</secondary>
71703 </indexterm>
71704 <indexterm role="concept">
71705 <primary>cutthrough</primary>
71706 <secondary>logging</secondary>
71707 </indexterm>
71708 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
71709 line precedes the reception line, since cutthrough waits for a possible
71710 rejection from the destination in case it can reject the sourced item.
71711 </para>
71712 <para>
71713 The generation of a reply message by a filter file gets logged as a
71714 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
71715 </para>
71716 <para>
71717 The <option>log_selector</option> option can be used to request the logging of additional
71718 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
71719 </para>
71720 </section>
71721 <section id="SECID253">
71722 <title>Discarded deliveries</title>
71723 <para>
71724 <indexterm role="concept">
71725 <primary>discarded messages</primary>
71726 </indexterm>
71727 <indexterm role="concept">
71728 <primary>message</primary>
71729 <secondary>discarded</secondary>
71730 </indexterm>
71731 <indexterm role="concept">
71732 <primary>delivery</primary>
71733 <secondary>discarded; logging</secondary>
71734 </indexterm>
71735 When a message is discarded as a result of the command <quote>seen finish</quote> being
71736 obeyed in a filter file which generates no deliveries, a log entry of the form
71737 </para>
71738 <literallayout class="monospaced">
71739 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
71740   &lt;low.club@bridge.example&gt; R=userforward
71741 </literallayout>
71742 <para>
71743 is written, to record why no deliveries are logged. When a message is discarded
71744 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
71745 </para>
71746 <literallayout class="monospaced">
71747 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
71748   &lt;hole@nowhere.example&gt; R=blackhole_router
71749 </literallayout>
71750 </section>
71751 <section id="SECID254">
71752 <title>Deferred deliveries</title>
71753 <para>
71754 When a delivery is deferred, a line of the following form is logged:
71755 </para>
71756 <literallayout class="monospaced">
71757 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
71758   R=dnslookup T=smtp defer (146): Connection refused
71759 </literallayout>
71760 <para>
71761 In the case of remote deliveries, the error is the one that was given for the
71762 last IP address that was tried. Details of individual SMTP failures are also
71763 written to the log, so the above line would be preceded by something like
71764 </para>
71765 <literallayout class="monospaced">
71766 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
71767   mail1.endrest.example [192.168.239.239]: Connection refused
71768 </literallayout>
71769 <para>
71770 When a deferred address is skipped because its retry time has not been reached,
71771 a message is written to the log, but this can be suppressed by setting an
71772 appropriate value in <option>log_selector</option>.
71773 </para>
71774 </section>
71775 <section id="SECID255">
71776 <title>Delivery failures</title>
71777 <para>
71778 <indexterm role="concept">
71779 <primary>delivery</primary>
71780 <secondary>failure; logging</secondary>
71781 </indexterm>
71782 If a delivery fails because an address cannot be routed, a line of the
71783 following form is logged:
71784 </para>
71785 <literallayout class="monospaced">
71786 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
71787   &lt;jim@trek99.example&gt;: unknown mail domain
71788 </literallayout>
71789 <para>
71790 If a delivery fails at transport time, the router and transport are shown, and
71791 the response from the remote host is included, as in this example:
71792 </para>
71793 <literallayout class="monospaced">
71794 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
71795   R=dnslookup T=remote_smtp: SMTP error from remote mailer
71796   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
71797   pbmail3.py.example [192.168.63.111]: 553 5.3.0
71798   &lt;ace400@pb.example&gt;...Addressee unknown
71799 </literallayout>
71800 <para>
71801 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
71802 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
71803 disabling PIPELINING. The log lines for all forms of delivery failure are
71804 flagged with <literal>**</literal>.
71805 </para>
71806 </section>
71807 <section id="SECID256">
71808 <title>Fake deliveries</title>
71809 <para>
71810 <indexterm role="concept">
71811 <primary>delivery</primary>
71812 <secondary>fake; logging</secondary>
71813 </indexterm>
71814 If a delivery does not actually take place because the <option>-N</option> option has been
71815 used to suppress it, a normal delivery line is written to the log, except that
71816 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
71817 </para>
71818 </section>
71819 <section id="SECID257">
71820 <title>Completion</title>
71821 <para>
71822 A line of the form
71823 </para>
71824 <literallayout class="monospaced">
71825 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
71826 </literallayout>
71827 <para>
71828 is written to the main log when a message is about to be removed from the spool
71829 at the end of its processing.
71830 </para>
71831 </section>
71832 <section id="SECID258">
71833 <title>Summary of Fields in Log Lines</title>
71834 <para>
71835 <indexterm role="concept">
71836 <primary>log</primary>
71837 <secondary>summary of fields</secondary>
71838 </indexterm>
71839 A summary of the field identifiers that are used in log lines is shown in
71840 the following table:
71841 </para>
71842 <literallayout>
71843 <literal>A   </literal>        authenticator name (and optional id and sender)
71844 <literal>C   </literal>        SMTP confirmation on delivery
71845 <literal>Ci  </literal>        connection identifier
71846 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
71847 <literal>CV  </literal>        certificate verification status
71848 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
71849 <literal>DKIM</literal>        domain verified in incoming message
71850 <literal>DN  </literal>        distinguished name from peer certificate
71851 <literal>DS  </literal>        DNSSEC secured lookups
71852 <literal>DT  </literal>        on <literal>=&gt;</literal>, <emphasis>==</emphasis> and <emphasis>**</emphasis> lines: time taken for, or to attempt, a delivery
71853 <literal>F   </literal>        sender address (on delivery lines)
71854 <literal>H   </literal>        host name and IP address
71855 <literal>I   </literal>        local interface used
71856 <literal>id  </literal>        message id (from header) for incoming message
71857 <literal>K   </literal>        CHUNKING extension used
71858 <literal>L   </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: PIPELINING extension used
71859 <literal>M8S </literal>        8BITMIME status for incoming message
71860 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
71861 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
71862 <literal>PRDR</literal>        PRDR extension used
71863 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
71864 <literal>Q   </literal>        alternate queue name
71865 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
71866 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
71867 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
71868 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
71869 <literal>RT  </literal>        on <literal>&lt;=</literal> lines: time taken for reception
71870 <literal>S   </literal>        size of message in bytes
71871 <literal>SNI </literal>        server name indication from TLS client hello
71872 <literal>ST  </literal>        shadow transport name
71873 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
71874 <literal>TFO </literal>        connection took advantage of TCP Fast Open
71875 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
71876 <literal>U   </literal>        local user or RFC 1413 identity
71877 <literal>X   </literal>        TLS cipher suite
71878 </literallayout>
71879 </section>
71880 <section id="SECID259">
71881 <title>Other log entries</title>
71882 <para>
71883 Various other types of log entry are written from time to time. Most should be
71884 self-explanatory. Among the more common are:
71885 </para>
71886 <itemizedlist>
71887 <listitem>
71888 <para>
71889 <indexterm role="concept">
71890 <primary>retry</primary>
71891 <secondary>time not reached</secondary>
71892 </indexterm>
71893 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
71894 during routing or local delivery, and the time to retry has not yet arrived.
71895 This message is not written to an individual message log file unless it happens
71896 during the first delivery attempt.
71897 </para>
71898 </listitem>
71899 <listitem>
71900 <para>
71901 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
71902 temporary errors during remote delivery, and the retry time has not yet arrived
71903 for any of the hosts to which it is routed.
71904 </para>
71905 </listitem>
71906 <listitem>
71907 <para>
71908 <indexterm role="concept">
71909 <primary>spool directory</primary>
71910 <secondary>file locked</secondary>
71911 </indexterm>
71912 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
71913 some other Exim process is already working on the message. This can be quite
71914 common if queue running processes are started at frequent intervals. The
71915 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
71916 doing.
71917 </para>
71918 </listitem>
71919 <listitem>
71920 <para>
71921 <indexterm role="concept">
71922 <primary>error</primary>
71923 <secondary>ignored</secondary>
71924 </indexterm>
71925 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
71926 message:
71927 </para>
71928 <orderedlist numeration="arabic">
71929 <listitem>
71930 <para>
71931 Exim failed to deliver a bounce message whose age was greater than
71932 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
71933 </para>
71934 </listitem>
71935 <listitem>
71936 <para>
71937 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
71938 failed. The delivery was discarded.
71939 </para>
71940 </listitem>
71941 <listitem>
71942 <para>
71943 A delivery set up by a router configured with
71944 </para>
71945 <literallayout class="monospaced">
71946     errors_to = &lt;&gt;
71947 </literallayout>
71948 <para>
71949 failed. The delivery was discarded.
71950 </para>
71951 </listitem>
71952 </orderedlist>
71953 </listitem>
71954 <listitem>
71955 <para>
71956 <indexterm role="concept">
71957 <primary>DKIM</primary>
71958 <secondary>log line</secondary>
71959 </indexterm>
71960 <emphasis>DKIM: d=</emphasis>&nbsp;&nbsp;Verbose results of a DKIM verification attempt, if enabled for
71961 logging and the message has a DKIM signature header.
71962 </para>
71963 </listitem>
71964 </itemizedlist>
71965 </section>
71966 <section id="SECTlogselector">
71967 <title>Reducing or increasing what is logged</title>
71968 <para>
71969 <indexterm role="concept">
71970 <primary>log</primary>
71971 <secondary>selectors</secondary>
71972 </indexterm>
71973 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
71974 default logging to the main log, or you can request additional logging. The value of
71975 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
71976 example:
71977 </para>
71978 <literallayout class="monospaced">
71979 log_selector = +arguments -retry_defer
71980 </literallayout>
71981 <para>
71982 The list of optional log items is in the following table, with the default
71983 selection marked by asterisks:
71984 </para>
71985 <informaltable frame="none">
71986 <tgroup cols="3" colsep="0" rowsep="0">
71987 <colspec colwidth="2.8in" align="left"/>
71988 <colspec colwidth="10pt" align="center"/>
71989 <colspec colwidth="3in" align="left"/>
71990 <tbody>
71991 <row>
71992 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>8bitmime</literal></entry>
71993 <entry>&nbsp;</entry>
71994 <entry>received 8BITMIME status</entry>
71995 </row>
71996 <row>
71997 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl_warn_skipped</literal></entry>
71998 <entry>*</entry>
71999 <entry>skipped <option>warn</option> statement in ACL</entry>
72000 </row>
72001 <row>
72002 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>address_rewrite</literal></entry>
72003 <entry>&nbsp;</entry>
72004 <entry>address rewriting</entry>
72005 </row>
72006 <row>
72007 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>all_parents</literal></entry>
72008 <entry>&nbsp;</entry>
72009 <entry>all parents in =&gt; lines</entry>
72010 </row>
72011 <row>
72012 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>arguments</literal></entry>
72013 <entry>&nbsp;</entry>
72014 <entry>command line arguments</entry>
72015 </row>
72016 <row>
72017 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection_id</literal></entry>
72018 <entry>&nbsp;</entry>
72019 <entry>connection identifier</entry>
72020 </row>
72021 <row>
72022 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection_reject</literal></entry>
72023 <entry>*</entry>
72024 <entry>connection rejections</entry>
72025 </row>
72026 <row>
72027 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>delay_delivery</literal></entry>
72028 <entry>*</entry>
72029 <entry>immediate delivery delayed</entry>
72030 </row>
72031 <row>
72032 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>deliver_time</literal></entry>
72033 <entry>&nbsp;</entry>
72034 <entry>time taken to attempt delivery</entry>
72035 </row>
72036 <row>
72037 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>delivery_size</literal></entry>
72038 <entry>&nbsp;</entry>
72039 <entry>add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines</entry>
72040 </row>
72041 <row>
72042 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dkim</literal></entry>
72043 <entry>*</entry>
72044 <entry>DKIM verified domain on &lt;= lines</entry>
72045 </row>
72046 <row>
72047 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dkim_verbose</literal></entry>
72048 <entry>&nbsp;</entry>
72049 <entry>separate full DKIM verification result line, per signature</entry>
72050 </row>
72051 <row>
72052 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dnslist_defer</literal></entry>
72053 <entry>*</entry>
72054 <entry>defers of DNS list (aka RBL) lookups</entry>
72055 </row>
72056 <row>
72057 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dnssec</literal></entry>
72058 <entry>&nbsp;</entry>
72059 <entry>DNSSEC secured lookups</entry>
72060 </row>
72061 <row>
72062 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>etrn</literal></entry>
72063 <entry>*</entry>
72064 <entry>ETRN commands</entry>
72065 </row>
72066 <row>
72067 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>host_lookup_failed</literal></entry>
72068 <entry>*</entry>
72069 <entry>as it says</entry>
72070 </row>
72071 <row>
72072 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>ident_timeout</literal></entry>
72073 <entry>&nbsp;</entry>
72074 <entry>timeout for ident connection</entry>
72075 </row>
72076 <row>
72077 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>incoming_interface</literal></entry>
72078 <entry>&nbsp;</entry>
72079 <entry>local interface &amp; port on &lt;= and =&gt; lines</entry>
72080 </row>
72081 <row>
72082 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>incoming_port</literal></entry>
72083 <entry>&nbsp;</entry>
72084 <entry>remote port on &lt;= lines</entry>
72085 </row>
72086 <row>
72087 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>lost_incoming_connection</literal></entry>
72088 <entry>*</entry>
72089 <entry>as it says (includes timeouts)</entry>
72090 </row>
72091 <row>
72092 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>millisec</literal></entry>
72093 <entry>&nbsp;</entry>
72094 <entry>millisecond timestamps and RT,QT,DT,D times</entry>
72095 </row>
72096 <row>
72097 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>msg_id</literal></entry>
72098 <entry>*</entry>
72099 <entry>on &lt;= lines, Message-ID: header value</entry>
72100 </row>
72101 <row>
72102 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>msg_id_created</literal></entry>
72103 <entry>&nbsp;</entry>
72104 <entry>on &lt;= lines, Message-ID: header value when one had to be added</entry>
72105 </row>
72106 <row>
72107 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>outgoing_interface</literal></entry>
72108 <entry>&nbsp;</entry>
72109 <entry>local interface on =&gt; lines</entry>
72110 </row>
72111 <row>
72112 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>outgoing_port</literal></entry>
72113 <entry>&nbsp;</entry>
72114 <entry>add remote port to =&gt; lines</entry>
72115 </row>
72116 <row>
72117 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_run</literal></entry>
72118 <entry>*</entry>
72119 <entry>start and end queue runs</entry>
72120 </row>
72121 <row>
72122 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_time</literal></entry>
72123 <entry>&nbsp;</entry>
72124 <entry>time on queue for one recipient</entry>
72125 </row>
72126 <row>
72127 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_time_exclusive</literal></entry>
72128 <entry>&nbsp;</entry>
72129 <entry>exclude recieve time from QT times</entry>
72130 </row>
72131 <row>
72132 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_time_overall</literal></entry>
72133 <entry>&nbsp;</entry>
72134 <entry>time on queue for whole message</entry>
72135 </row>
72136 <row>
72137 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>pid</literal></entry>
72138 <entry>&nbsp;</entry>
72139 <entry>Exim process id</entry>
72140 </row>
72141 <row>
72142 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>pipelining</literal></entry>
72143 <entry>&nbsp;</entry>
72144 <entry>PIPELINING use, on &lt;= and =&gt; lines</entry>
72145 </row>
72146 <row>
72147 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>proxy</literal></entry>
72148 <entry>&nbsp;</entry>
72149 <entry>proxy address on &lt;= and =&gt; lines</entry>
72150 </row>
72151 <row>
72152 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>receive_time</literal></entry>
72153 <entry>&nbsp;</entry>
72154 <entry>time taken to receive message</entry>
72155 </row>
72156 <row>
72157 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>received_recipients</literal></entry>
72158 <entry>&nbsp;</entry>
72159 <entry>recipients on &lt;= lines</entry>
72160 </row>
72161 <row>
72162 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>received_sender</literal></entry>
72163 <entry>&nbsp;</entry>
72164 <entry>sender on &lt;= lines</entry>
72165 </row>
72166 <row>
72167 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>rejected_header</literal></entry>
72168 <entry>*</entry>
72169 <entry>header contents on reject log</entry>
72170 </row>
72171 <row>
72172 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>retry_defer</literal></entry>
72173 <entry>*</entry>
72174 <entry><quote>retry time not reached</quote></entry>
72175 </row>
72176 <row>
72177 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>return_path_on_delivery</literal></entry>
72178 <entry>&nbsp;</entry>
72179 <entry>put return path on =&gt; and ** lines</entry>
72180 </row>
72181 <row>
72182 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>sender_on_delivery</literal></entry>
72183 <entry>&nbsp;</entry>
72184 <entry>add sender to =&gt; lines</entry>
72185 </row>
72186 <row>
72187 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>sender_verify_fail</literal></entry>
72188 <entry>*</entry>
72189 <entry>sender verification failures</entry>
72190 </row>
72191 <row>
72192 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>size_reject</literal></entry>
72193 <entry>*</entry>
72194 <entry>rejection because too big</entry>
72195 </row>
72196 <row>
72197 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>skip_delivery</literal></entry>
72198 <entry>*</entry>
72199 <entry>delivery skipped in a queue run</entry>
72200 </row>
72201 <row>
72202 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_confirmation</literal></entry>
72203 <entry>*</entry>
72204 <entry>SMTP confirmation on =&gt; lines</entry>
72205 </row>
72206 <row>
72207 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_connection</literal></entry>
72208 <entry>&nbsp;</entry>
72209 <entry>incoming SMTP connections</entry>
72210 </row>
72211 <row>
72212 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_incomplete_transaction</literal></entry>
72213 <entry>&nbsp;</entry>
72214 <entry>incomplete SMTP transactions</entry>
72215 </row>
72216 <row>
72217 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_mailauth</literal></entry>
72218 <entry>&nbsp;</entry>
72219 <entry>AUTH argument to MAIL commands</entry>
72220 </row>
72221 <row>
72222 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_no_mail</literal></entry>
72223 <entry>&nbsp;</entry>
72224 <entry>session with no MAIL commands</entry>
72225 </row>
72226 <row>
72227 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_protocol_error</literal></entry>
72228 <entry>&nbsp;</entry>
72229 <entry>SMTP protocol errors</entry>
72230 </row>
72231 <row>
72232 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_syntax_error</literal></entry>
72233 <entry>&nbsp;</entry>
72234 <entry>SMTP syntax errors</entry>
72235 </row>
72236 <row>
72237 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>subject</literal></entry>
72238 <entry>&nbsp;</entry>
72239 <entry>contents of <emphasis>Subject:</emphasis> on &lt;= lines</entry>
72240 </row>
72241 <row>
72242 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_certificate_verified</literal></entry>
72243 <entry>*</entry>
72244 <entry>certificate verification status</entry>
72245 </row>
72246 <row>
72247 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_cipher</literal></entry>
72248 <entry>*</entry>
72249 <entry>TLS cipher suite on &lt;= and =&gt; lines</entry>
72250 </row>
72251 <row>
72252 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_peerdn</literal></entry>
72253 <entry>&nbsp;</entry>
72254 <entry>TLS peer DN on &lt;= and =&gt; lines</entry>
72255 </row>
72256 <row>
72257 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_resumption</literal></entry>
72258 <entry>&nbsp;</entry>
72259 <entry>append * to cipher field</entry>
72260 </row>
72261 <row>
72262 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_sni</literal></entry>
72263 <entry>&nbsp;</entry>
72264 <entry>TLS SNI on &lt;= lines</entry>
72265 </row>
72266 <row>
72267 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>unknown_in_list</literal></entry>
72268 <entry>&nbsp;</entry>
72269 <entry>DNS lookup failed in list match</entry>
72270 </row>
72271 <row>
72272 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>all</literal></entry>
72273 <entry>&nbsp;</entry>
72274 <entry><emphasis role="bold">all of the above</emphasis></entry>
72275 </row>
72276 </tbody>
72277 </tgroup>
72278 </informaltable>
72279 <para>
72280 See also the <option>slow_lookup_log</option> main configuration option,
72281 section <xref linkend="SECID99"/>
72282 </para>
72283 <para>
72284 More details on each of these items follows:
72285 </para>
72286 <itemizedlist>
72287 <listitem>
72288 <para>
72289 <indexterm role="concept">
72290 <primary>8BITMIME</primary>
72291 </indexterm>
72292 <indexterm role="concept">
72293 <primary>log</primary>
72294 <secondary>8BITMIME</secondary>
72295 </indexterm>
72296 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
72297 which may help in tracking down interoperability issues with ancient MTAs
72298 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
72299 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
72300 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
72301 </para>
72302 </listitem>
72303 <listitem>
72304 <para>
72305 <indexterm role="concept">
72306 <primary><option>warn</option> ACL verb</primary>
72307 <secondary>log when skipping</secondary>
72308 </indexterm>
72309 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
72310 its conditions cannot be evaluated, a log line to this effect is written if
72311 this log selector is set.
72312 </para>
72313 </listitem>
72314 <listitem>
72315 <para>
72316 <indexterm role="concept">
72317 <primary>log</primary>
72318 <secondary>rewriting</secondary>
72319 </indexterm>
72320 <indexterm role="concept">
72321 <primary>rewriting</primary>
72322 <secondary>logging</secondary>
72323 </indexterm>
72324 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
72325 rewrites, but not to rewrites in filters run as an unprivileged user (because
72326 such users cannot access the log).
72327 </para>
72328 </listitem>
72329 <listitem>
72330 <para>
72331 <indexterm role="concept">
72332 <primary>log</primary>
72333 <secondary>full parentage</secondary>
72334 </indexterm>
72335 <option>all_parents</option>: Normally only the original and final addresses are logged on
72336 delivery lines; with this selector, intermediate parents are given in
72337 parentheses between them.
72338 </para>
72339 </listitem>
72340 <listitem>
72341 <para>
72342 <indexterm role="concept">
72343 <primary>log</primary>
72344 <secondary>Exim arguments</secondary>
72345 </indexterm>
72346 <indexterm role="concept">
72347 <primary>Exim arguments, logging</primary>
72348 </indexterm>
72349 <option>arguments</option>: This causes Exim to write the arguments with which it was called
72350 to the main log, preceded by the current working directory. This is a debugging
72351 feature, added to make it easier to find out how certain MUAs call
72352 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
72353 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
72354 that are empty or that contain white space are quoted. Non-printing characters
72355 are shown as escape sequences. This facility cannot log unrecognized arguments,
72356 because the arguments are checked before the configuration file is read. The
72357 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
72358 between the caller and Exim.
72359 </para>
72360 </listitem>
72361 <listitem>
72362 <para>
72363 <indexterm role="concept">
72364 <primary>log</primary>
72365 <secondary>connection identifier</secondary>
72366 </indexterm>
72367 </para>
72368 <para revisionflag="changed">
72369 <option>connection_identifier</option>: An identifier for the accepted connection is added to
72370 connection start and end lines and to message accept lines.
72371 The identifier is tagged by Ci=.
72372 The value is PID-based, so will reset on reboot and will wrap.
72373 </para>
72374 </listitem>
72375 <listitem>
72376 <para>
72377 <indexterm role="concept">
72378 <primary>log</primary>
72379 <secondary>connection rejections</secondary>
72380 </indexterm>
72381 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
72382 connection is rejected, for whatever reason.
72383 </para>
72384 </listitem>
72385 <listitem>
72386 <para>
72387 <indexterm role="concept">
72388 <primary>log</primary>
72389 <secondary>delayed delivery</secondary>
72390 </indexterm>
72391 <indexterm role="concept">
72392 <primary>delayed delivery, logging</primary>
72393 </indexterm>
72394 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
72395 started for an incoming message because the load is too high or too many
72396 messages were received on one connection. Logging does not occur if no delivery
72397 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
72398 </para>
72399 </listitem>
72400 <listitem>
72401 <para>
72402 <indexterm role="concept">
72403 <primary>log</primary>
72404 <secondary>delivery duration</secondary>
72405 </indexterm>
72406 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
72407 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
72408 If millisecond logging is enabled, short times will be shown with greater
72409 precision, eg. <literal>DT=0.304s</literal>.
72410 </para>
72411 </listitem>
72412 <listitem>
72413 <para>
72414 <indexterm role="concept">
72415 <primary>log</primary>
72416 <secondary>message size on delivery</secondary>
72417 </indexterm>
72418 <indexterm role="concept">
72419 <primary>size</primary>
72420 <secondary>of message</secondary>
72421 </indexterm>
72422 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
72423 the <quote>=&gt;</quote> line, tagged with S=.
72424 </para>
72425 </listitem>
72426 <listitem>
72427 <para>
72428 <indexterm role="concept">
72429 <primary>log</primary>
72430 <secondary>DKIM verification</secondary>
72431 </indexterm>
72432 <indexterm role="concept">
72433 <primary>DKIM</primary>
72434 <secondary>verification logging</secondary>
72435 </indexterm>
72436 <option>dkim</option>: For message acceptance log lines, when an DKIM signature in the header
72437 verifies successfully a tag of DKIM is added, with one of the verified domains.
72438 </para>
72439 </listitem>
72440 <listitem>
72441 <para>
72442 <indexterm role="concept">
72443 <primary>log</primary>
72444 <secondary>DKIM verification</secondary>
72445 </indexterm>
72446 <indexterm role="concept">
72447 <primary>DKIM</primary>
72448 <secondary>verification logging</secondary>
72449 </indexterm>
72450 <option>dkim_verbose</option>: A log entry is written for each attempted DKIM verification.
72451 </para>
72452 </listitem>
72453 <listitem>
72454 <para>
72455 <indexterm role="concept">
72456 <primary>log</primary>
72457 <secondary>dnslist defer</secondary>
72458 </indexterm>
72459 <indexterm role="concept">
72460 <primary>DNS list</primary>
72461 <secondary>logging defer</secondary>
72462 </indexterm>
72463 <indexterm role="concept">
72464 <primary>black list (DNS)</primary>
72465 </indexterm>
72466 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
72467 DNS black list suffers a temporary error.
72468 </para>
72469 </listitem>
72470 <listitem>
72471 <para>
72472 <indexterm role="concept">
72473 <primary>log</primary>
72474 <secondary>dnssec</secondary>
72475 </indexterm>
72476 <indexterm role="concept">
72477 <primary>dnssec</primary>
72478 <secondary>logging</secondary>
72479 </indexterm>
72480 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
72481 dns lookups gave secure results a tag of DS is added.
72482 For acceptance this covers the reverse and forward lookups for host name verification.
72483 It does not cover helo-name verification.
72484 For delivery this covers the SRV, MX, A and/or AAAA lookups.
72485 </para>
72486 </listitem>
72487 <listitem>
72488 <para>
72489 <indexterm role="concept">
72490 <primary>log</primary>
72491 <secondary>ETRN commands</secondary>
72492 </indexterm>
72493 <indexterm role="concept">
72494 <primary>ETRN</primary>
72495 <secondary>logging</secondary>
72496 </indexterm>
72497 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
72498 is run to determine whether or not it is actually accepted. An invalid ETRN
72499 command, or one received within a message transaction is not logged by this
72500 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
72501 </para>
72502 </listitem>
72503 <listitem>
72504 <para>
72505 <indexterm role="concept">
72506 <primary>log</primary>
72507 <secondary>host lookup failure</secondary>
72508 </indexterm>
72509 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
72510 any addresses, or when a lookup of an IP address fails to find a host name, a
72511 log line is written. This logging does not apply to direct DNS lookups when
72512 routing email addresses, but it does apply to <quote>byname</quote> lookups.
72513 </para>
72514 </listitem>
72515 <listitem>
72516 <para>
72517 <indexterm role="concept">
72518 <primary>log</primary>
72519 <secondary>ident timeout</secondary>
72520 </indexterm>
72521 <indexterm role="concept">
72522 <primary>RFC 1413</primary>
72523 <secondary>logging timeout</secondary>
72524 </indexterm>
72525 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
72526 client&#x2019;s ident port times out.
72527 </para>
72528 </listitem>
72529 <listitem>
72530 <para>
72531 <indexterm role="concept">
72532 <primary>log</primary>
72533 <secondary>incoming interface</secondary>
72534 </indexterm>
72535 <indexterm role="concept">
72536 <primary>log</primary>
72537 <secondary>outgoing interface</secondary>
72538 </indexterm>
72539 <indexterm role="concept">
72540 <primary>log</primary>
72541 <secondary>local interface</secondary>
72542 </indexterm>
72543 <indexterm role="concept">
72544 <primary>log</primary>
72545 <secondary>local address and port</secondary>
72546 </indexterm>
72547 <indexterm role="concept">
72548 <primary>TCP/IP</primary>
72549 <secondary>logging local address and port</secondary>
72550 </indexterm>
72551 <indexterm role="concept">
72552 <primary>interface</primary>
72553 <secondary>logging</secondary>
72554 </indexterm>
72555 <option>incoming_interface</option>: The interface on which a message was received is added
72556 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
72557 followed by a colon and the port number. The local interface and port are also
72558 added to other SMTP log lines, for example, <quote>SMTP connection from</quote>, to
72559 rejection lines, and (despite the name) to outgoing
72560 <quote>=&gt;</quote>, <quote>-&gt;</quote>, <quote>==</quote> and <quote>**</quote> lines.
72561 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
72562 </para>
72563 </listitem>
72564 <listitem>
72565 <para>
72566 <indexterm role="concept">
72567 <primary>log</primary>
72568 <secondary>incoming proxy address</secondary>
72569 </indexterm>
72570 <indexterm role="concept">
72571 <primary>proxy</primary>
72572 <secondary>logging proxy address</secondary>
72573 </indexterm>
72574 <indexterm role="concept">
72575 <primary>TCP/IP</primary>
72576 <secondary>logging proxy address</secondary>
72577 </indexterm>
72578 <option>proxy</option>: The internal (closest to the system running Exim) IP address
72579 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
72580 on a proxied connection
72581 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
72582 See <xref linkend="SECTproxyInbound"/> for more information.
72583 </para>
72584 </listitem>
72585 <listitem>
72586 <para>
72587 <indexterm role="concept">
72588 <primary>log</primary>
72589 <secondary>incoming remote port</secondary>
72590 </indexterm>
72591 <indexterm role="concept">
72592 <primary>port</primary>
72593 <secondary>logging remote</secondary>
72594 </indexterm>
72595 <indexterm role="concept">
72596 <primary>TCP/IP</primary>
72597 <secondary>logging incoming remote port</secondary>
72598 </indexterm>
72599 <indexterm role="variable">
72600 <primary><varname>$sender_fullhost</varname></primary>
72601 </indexterm>
72602 <indexterm role="variable">
72603 <primary><varname>$sender_rcvhost</varname></primary>
72604 </indexterm>
72605 <option>incoming_port</option>: The remote port number from which a message was received is
72606 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
72607 in square brackets, and separated from it by a colon. This is implemented by
72608 changing the value that is put in the <varname>$sender_fullhost</varname> and
72609 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
72610 important with the widening use of NAT (see RFC 2505).
72611 </para>
72612 </listitem>
72613 <listitem>
72614 <para>
72615 <indexterm role="concept">
72616 <primary>log</primary>
72617 <secondary>dropped connection</secondary>
72618 </indexterm>
72619 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
72620 connection is unexpectedly dropped.
72621 </para>
72622 </listitem>
72623 <listitem>
72624 <para>
72625 <indexterm role="concept">
72626 <primary>log</primary>
72627 <secondary>millisecond timestamps</secondary>
72628 </indexterm>
72629 <indexterm role="concept">
72630 <primary>millisecond</primary>
72631 <secondary>logging</secondary>
72632 </indexterm>
72633 <indexterm role="concept">
72634 <primary>timestamps</primary>
72635 <secondary>millisecond, in logs</secondary>
72636 </indexterm>
72637 <option>millisec</option>: Timestamps have a period and three decimal places of finer granularity
72638 appended to the seconds value.
72639 </para>
72640 </listitem>
72641 <listitem>
72642 <para>
72643 <indexterm role="concept">
72644 <primary>log</primary>
72645 <secondary>message id</secondary>
72646 </indexterm>
72647 <option>msg_id</option>: The value of the Message-ID: header.
72648 </para>
72649 </listitem>
72650 <listitem>
72651 <para>
72652 <option>msg_id_created</option>: The value of the Message-ID: header, when one had to be created.
72653 This will be either because the message is a bounce, or was submitted locally
72654 (submission mode) without one.
72655 The field identifier will have an asterix appended: <quote>id*=</quote>.
72656 </para>
72657 </listitem>
72658 <listitem>
72659 <para>
72660 <indexterm role="concept">
72661 <primary>log</primary>
72662 <secondary>outgoing interface</secondary>
72663 </indexterm>
72664 <indexterm role="concept">
72665 <primary>log</primary>
72666 <secondary>local interface</secondary>
72667 </indexterm>
72668 <indexterm role="concept">
72669 <primary>log</primary>
72670 <secondary>local address and port</secondary>
72671 </indexterm>
72672 <indexterm role="concept">
72673 <primary>TCP/IP</primary>
72674 <secondary>logging local address and port</secondary>
72675 </indexterm>
72676 <indexterm role="concept">
72677 <primary>interface</primary>
72678 <secondary>logging</secondary>
72679 </indexterm>
72680 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
72681 interface on which a message was sent is added to delivery lines as an I= tag
72682 followed by IP address in square brackets. You can disable this by turning
72683 off the <option>outgoing_interface</option> option.
72684 </para>
72685 </listitem>
72686 <listitem>
72687 <para>
72688 <indexterm role="concept">
72689 <primary>log</primary>
72690 <secondary>outgoing remote port</secondary>
72691 </indexterm>
72692 <indexterm role="concept">
72693 <primary>port</primary>
72694 <secondary>logging outgoing remote</secondary>
72695 </indexterm>
72696 <indexterm role="concept">
72697 <primary>TCP/IP</primary>
72698 <secondary>logging outgoing remote port</secondary>
72699 </indexterm>
72700 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
72701 containing =&gt; tags) following the IP address.
72702 The local port is also added if <option>incoming_interface</option> and
72703 <option>outgoing_interface</option> are both enabled.
72704 This option is not included in the default setting, because for most ordinary
72705 configurations, the remote port number is always 25 (the SMTP port), and the
72706 local port is a random ephemeral port.
72707 </para>
72708 </listitem>
72709 <listitem>
72710 <para>
72711 <indexterm role="concept">
72712 <primary>log</primary>
72713 <secondary>process ids in</secondary>
72714 </indexterm>
72715 <indexterm role="concept">
72716 <primary>pid (process id)</primary>
72717 <secondary>in log lines</secondary>
72718 </indexterm>
72719 <option>pid</option>: The current process id is added to every log line, in square brackets,
72720 immediately after the time and date.
72721 </para>
72722 </listitem>
72723 <listitem>
72724 <para>
72725 <indexterm role="concept">
72726 <primary>log</primary>
72727 <secondary>pipelining</secondary>
72728 </indexterm>
72729 <indexterm role="concept">
72730 <primary>pipelining</primary>
72731 <secondary>logging outgoing</secondary>
72732 </indexterm>
72733 <option>pipelining</option>: A field is added to delivery and accept
72734 log lines when the ESMTP PIPELINING extension was used.
72735 The field is a single "L".
72736 </para>
72737 <para>
72738 On accept lines, where PIPELINING was offered but not used by the client,
72739 the field has a minus appended.
72740 </para>
72741 <para>
72742 <indexterm role="concept">
72743 <primary>pipelining</primary>
72744 <secondary>early connection</secondary>
72745 </indexterm>
72746 If Exim is built without the DISABLE_PIPE_CONNECT build option
72747 accept "L" fields have a period appended if the feature was
72748 offered but not used, or an asterisk appended if used.
72749 Delivery "L" fields have an asterisk appended if used.
72750 </para>
72751 </listitem>
72752 <listitem>
72753 <para>
72754 <indexterm role="concept">
72755 <primary>log</primary>
72756 <secondary>queue run</secondary>
72757 </indexterm>
72758 <indexterm role="concept">
72759 <primary>queue runner</primary>
72760 <secondary>logging</secondary>
72761 </indexterm>
72762 <option>queue_run</option>: The start and end of every queue run are logged.
72763 </para>
72764 </listitem>
72765 <listitem>
72766 <para>
72767 <indexterm role="concept">
72768 <primary>log</primary>
72769 <secondary>queue time</secondary>
72770 </indexterm>
72771 <option>queue_time</option>: The amount of time the message has been in the queue on the
72772 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
72773 <literal>QT=3m45s</literal>.
72774 If millisecond logging is enabled, short times will be shown with greater
72775 precision, eg. <literal>QT=1.578s</literal>.
72776 </para>
72777 </listitem>
72778 <listitem>
72779 <para>
72780 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
72781 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
72782 example, <literal>QT=3m45s</literal>.
72783 </para>
72784 </listitem>
72785 <listitem>
72786 <para>
72787 <indexterm role="concept">
72788 <primary>log</primary>
72789 <secondary>receive duration</secondary>
72790 </indexterm>
72791 <option>receive_time</option>: For each message, the amount of real time it has taken to
72792 perform the reception is logged as RT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>RT=1s</literal>.
72793 If millisecond logging is enabled, short times will be shown with greater
72794 precision, eg. <literal>RT=0.204s</literal>.
72795 </para>
72796 </listitem>
72797 <listitem>
72798 <para>
72799 <indexterm role="concept">
72800 <primary>log</primary>
72801 <secondary>recipients</secondary>
72802 </indexterm>
72803 <option>received_recipients</option>: The recipients of a message are listed in the main log
72804 as soon as the message is received. The list appears at the end of the log line
72805 that is written when a message is received, preceded by the word <quote>for</quote>. The
72806 addresses are listed after they have been qualified, but before any rewriting
72807 has taken place.
72808 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
72809 in the list.
72810 </para>
72811 </listitem>
72812 <listitem>
72813 <para>
72814 <indexterm role="concept">
72815 <primary>log</primary>
72816 <secondary>sender reception</secondary>
72817 </indexterm>
72818 <option>received_sender</option>: The unrewritten original sender of a message is added to
72819 the end of the log line that records the message&#x2019;s arrival, after the word
72820 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
72821 </para>
72822 </listitem>
72823 <listitem>
72824 <para>
72825 <indexterm role="concept">
72826 <primary>log</primary>
72827 <secondary>header lines for rejection</secondary>
72828 </indexterm>
72829 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
72830 rejection is written to the reject log, the complete header is added to the
72831 log. Header logging can be turned off individually for messages that are
72832 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
72833 </para>
72834 </listitem>
72835 <listitem>
72836 <para>
72837 <indexterm role="concept">
72838 <primary>log</primary>
72839 <secondary>retry defer</secondary>
72840 </indexterm>
72841 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
72842 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
72843 message is always omitted from individual message logs after the first delivery
72844 attempt.
72845 </para>
72846 </listitem>
72847 <listitem>
72848 <para>
72849 <indexterm role="concept">
72850 <primary>log</primary>
72851 <secondary>return path</secondary>
72852 </indexterm>
72853 <option>return_path_on_delivery</option>: The return path that is being transmitted with
72854 the message is included in delivery and bounce lines, using the tag P=.
72855 This is omitted if no delivery actually happens, for example, if routing fails,
72856 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
72857 </para>
72858 </listitem>
72859 <listitem>
72860 <para>
72861 <indexterm role="concept">
72862 <primary>log</primary>
72863 <secondary>sender on delivery</secondary>
72864 </indexterm>
72865 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
72866 and bounce line, tagged by F= (for <quote>from</quote>).
72867 This is the original sender that was received with the message; it is not
72868 necessarily the same as the outgoing return path.
72869 </para>
72870 </listitem>
72871 <listitem>
72872 <para>
72873 <indexterm role="concept">
72874 <primary>log</primary>
72875 <secondary>sender verify failure</secondary>
72876 </indexterm>
72877 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
72878 gives details of a sender verification failure is not written. Log lines for
72879 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
72880 detail is lost.
72881 </para>
72882 </listitem>
72883 <listitem>
72884 <para>
72885 <indexterm role="concept">
72886 <primary>log</primary>
72887 <secondary>size rejection</secondary>
72888 </indexterm>
72889 <option>size_reject</option>: A log line is written whenever a message is rejected because
72890 it is too big.
72891 </para>
72892 </listitem>
72893 <listitem>
72894 <para>
72895 <indexterm role="concept">
72896 <primary>log</primary>
72897 <secondary>frozen messages; skipped</secondary>
72898 </indexterm>
72899 <indexterm role="concept">
72900 <primary>frozen messages</primary>
72901 <secondary>logging skipping</secondary>
72902 </indexterm>
72903 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
72904 queue run because it another process is already delivering it or because
72905 it is frozen.
72906 <indexterm role="concept">
72907 <primary><quote>spool file is locked</quote></primary>
72908 </indexterm>
72909 <indexterm role="concept">
72910 <primary><quote>message is frozen</quote></primary>
72911 </indexterm>
72912 The message that is written is either <quote>spool file is locked</quote> or
72913 <quote>message is frozen</quote>.
72914 </para>
72915 </listitem>
72916 <listitem>
72917 <para>
72918 <indexterm role="concept">
72919 <primary>log</primary>
72920 <secondary>smtp confirmation</secondary>
72921 </indexterm>
72922 <indexterm role="concept">
72923 <primary>SMTP</primary>
72924 <secondary>logging confirmation</secondary>
72925 </indexterm>
72926 <indexterm role="concept">
72927 <primary>LMTP</primary>
72928 <secondary>logging confirmation</secondary>
72929 </indexterm>
72930 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
72931 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
72932 A number of MTAs (including Exim) return an identifying string in this
72933 response.
72934 </para>
72935 </listitem>
72936 <listitem>
72937 <para>
72938 <indexterm role="concept">
72939 <primary>log</primary>
72940 <secondary>SMTP connections</secondary>
72941 </indexterm>
72942 <indexterm role="concept">
72943 <primary>SMTP</primary>
72944 <secondary>logging connections</secondary>
72945 </indexterm>
72946 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
72947 established or closed, unless the connection is from a host that matches
72948 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
72949 only when the closure is unexpected.) This applies to connections from local
72950 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
72951 dropped in the middle of a message, a log line is always written, whether or
72952 not this selector is set, but otherwise nothing is written at the start and end
72953 of connections unless this selector is enabled.
72954 </para>
72955 <para>
72956 For TCP/IP connections to an Exim daemon, the current number of connections is
72957 included in the log message for each new connection, but note that the count is
72958 reset if the daemon is restarted.
72959 Also, because connections are closed (and the closure is logged) in
72960 subprocesses, the count may not include connections that have been closed but
72961 whose termination the daemon has not yet noticed. Thus, while it is possible to
72962 match up the opening and closing of connections in the log, the value of the
72963 logged counts may not be entirely accurate.
72964 </para>
72965 </listitem>
72966 <listitem>
72967 <para>
72968 <indexterm role="concept">
72969 <primary>log</primary>
72970 <secondary>SMTP transaction; incomplete</secondary>
72971 </indexterm>
72972 <indexterm role="concept">
72973 <primary>SMTP</primary>
72974 <secondary>logging incomplete transactions</secondary>
72975 </indexterm>
72976 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
72977 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
72978 and the message sender plus any accepted recipients are included in the log
72979 line. This can provide evidence of dictionary attacks.
72980 </para>
72981 </listitem>
72982 <listitem>
72983 <para>
72984 <indexterm role="concept">
72985 <primary>log</primary>
72986 <secondary>non-MAIL SMTP sessions</secondary>
72987 </indexterm>
72988 <indexterm role="concept">
72989 <primary>MAIL</primary>
72990 <secondary>logging session without</secondary>
72991 </indexterm>
72992 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
72993 connection terminates without having issued a MAIL command. This includes both
72994 the case when the connection is dropped, and the case when QUIT is used. It
72995 does not include cases where the connection is rejected right at the start (by
72996 an ACL, or because there are too many connections, or whatever). These cases
72997 already have their own log lines.
72998 </para>
72999 <para>
73000 The log line that is written contains the identity of the client in the usual
73001 way, followed by D= and a time, which records the duration of the connection.
73002 If the connection was authenticated, this fact is logged exactly as it is for
73003 an incoming message, with an A= item. If the connection was encrypted, CV=,
73004 DN=, and X= items may appear as they do for an incoming message, controlled by
73005 the same logging options.
73006 </para>
73007 <para>
73008 Finally, if any SMTP commands were issued during the connection, a C= item
73009 is added to the line, listing the commands that were used. For example,
73010 </para>
73011 <literallayout class="monospaced">
73012 C=EHLO,QUIT
73013 </literallayout>
73014 <para>
73015 shows that the client issued QUIT straight after EHLO. If there were fewer
73016 than 20 commands, they are all listed. If there were more than 20 commands,
73017 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
73018 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
73019 have been aborted before 20 non-mail commands are processed.
73020 </para>
73021 </listitem>
73022 <listitem>
73023 <para>
73024 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
73025 colon-separated, is appended to the A= item for a message arrival or delivery
73026 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
73027 was accepted or used.
73028 </para>
73029 </listitem>
73030 <listitem>
73031 <para>
73032 <indexterm role="concept">
73033 <primary>log</primary>
73034 <secondary>SMTP protocol error</secondary>
73035 </indexterm>
73036 <indexterm role="concept">
73037 <primary>SMTP</primary>
73038 <secondary>logging protocol error</secondary>
73039 </indexterm>
73040 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
73041 encountered. Exim does not have perfect detection of all protocol errors
73042 because of transmission delays and the use of pipelining. If PIPELINING has
73043 been advertised to a client, an Exim server assumes that the client will use
73044 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
73045 received after rejecting MAIL) as protocol errors.
73046 </para>
73047 </listitem>
73048 <listitem>
73049 <para>
73050 <indexterm role="concept">
73051 <primary>SMTP</primary>
73052 <secondary>logging syntax errors</secondary>
73053 </indexterm>
73054 <indexterm role="concept">
73055 <primary>SMTP</primary>
73056 <secondary>syntax errors; logging</secondary>
73057 </indexterm>
73058 <indexterm role="concept">
73059 <primary>SMTP</primary>
73060 <secondary>unknown command; logging</secondary>
73061 </indexterm>
73062 <indexterm role="concept">
73063 <primary>log</primary>
73064 <secondary>unknown SMTP command</secondary>
73065 </indexterm>
73066 <indexterm role="concept">
73067 <primary>log</primary>
73068 <secondary>SMTP syntax error</secondary>
73069 </indexterm>
73070 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
73071 encountered. An unrecognized command is treated as a syntax error. For an
73072 external connection, the host identity is given; for an internal connection
73073 using <option>-bs</option> the sender identification (normally the calling user) is given.
73074 </para>
73075 </listitem>
73076 <listitem>
73077 <para>
73078 <indexterm role="concept">
73079 <primary>log</primary>
73080 <secondary>subject</secondary>
73081 </indexterm>
73082 <indexterm role="concept">
73083 <primary>subject, logging</primary>
73084 </indexterm>
73085 <option>subject</option>: The subject of the message is added to the arrival log line,
73086 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
73087 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
73088 specifies whether characters with values greater than 127 should be logged
73089 unchanged, or whether they should be rendered as escape sequences.
73090 </para>
73091 </listitem>
73092 <listitem>
73093 <para>
73094 <indexterm role="concept">
73095 <primary>log</primary>
73096 <secondary>certificate verification</secondary>
73097 </indexterm>
73098 <indexterm role="concept">
73099 <primary>log</primary>
73100 <secondary>DANE</secondary>
73101 </indexterm>
73102 <indexterm role="concept">
73103 <primary>DANE</primary>
73104 <secondary>logging</secondary>
73105 </indexterm>
73106 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
73107 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
73108 verified
73109 using a CA trust anchor,
73110 <literal>CV=dane</literal> if using a DNS trust anchor,
73111 and <literal>CV=no</literal> if not.
73112 </para>
73113 </listitem>
73114 <listitem>
73115 <para>
73116 <indexterm role="concept">
73117 <primary>log</primary>
73118 <secondary>TLS cipher</secondary>
73119 </indexterm>
73120 <indexterm role="concept">
73121 <primary>TLS</primary>
73122 <secondary>logging cipher</secondary>
73123 </indexterm>
73124 <option>tls_cipher</option>: When a message is sent or received over an encrypted
73125 connection, the cipher suite used is added to the log line, preceded by X=.
73126 </para>
73127 </listitem>
73128 <listitem>
73129 <para>
73130 <indexterm role="concept">
73131 <primary>log</primary>
73132 <secondary>TLS peer DN</secondary>
73133 </indexterm>
73134 <indexterm role="concept">
73135 <primary>TLS</primary>
73136 <secondary>logging peer DN</secondary>
73137 </indexterm>
73138 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
73139 connection, and a certificate is supplied by the remote host, the peer DN is
73140 added to the log line, preceded by DN=.
73141 </para>
73142 </listitem>
73143 <listitem>
73144 <para>
73145 <indexterm role="concept">
73146 <primary>log</primary>
73147 <secondary>TLS resumption</secondary>
73148 </indexterm>
73149 <indexterm role="concept">
73150 <primary>TLS</primary>
73151 <secondary>logging session resumption</secondary>
73152 </indexterm>
73153 <option>tls_resumption</option>: When a message is sent or received over an encrypted
73154 connection and the TLS session resumed one used on a previous TCP connection,
73155 an asterisk is appended to the X= cipher field in the log line.
73156 </para>
73157 </listitem>
73158 <listitem>
73159 <para>
73160 <indexterm role="concept">
73161 <primary>log</primary>
73162 <secondary>TLS SNI</secondary>
73163 </indexterm>
73164 <indexterm role="concept">
73165 <primary>TLS</primary>
73166 <secondary>logging SNI</secondary>
73167 </indexterm>
73168 <indexterm role="concept">
73169 <primary>SNI</primary>
73170 <secondary>logging</secondary>
73171 </indexterm>
73172 <option>tls_sni</option>: When a message is received over an encrypted connection, and
73173 the remote host provided the Server Name Indication extension, the SNI is
73174 added to the log line, preceded by SNI=.
73175 </para>
73176 </listitem>
73177 <listitem>
73178 <para>
73179 <indexterm role="concept">
73180 <primary>log</primary>
73181 <secondary>DNS failure in list</secondary>
73182 </indexterm>
73183 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
73184 result of a list match is failure because a DNS lookup failed.
73185 </para>
73186 </listitem>
73187 </itemizedlist>
73188 </section>
73189 <section id="SECID260">
73190 <title>Message log</title>
73191 <para>
73192 <indexterm role="concept">
73193 <primary>message</primary>
73194 <secondary>log file for</secondary>
73195 </indexterm>
73196 <indexterm role="concept">
73197 <primary>log</primary>
73198 <secondary>message log; description of</secondary>
73199 </indexterm>
73200 <indexterm role="concept">
73201 <primary><filename>msglog</filename> directory</primary>
73202 </indexterm>
73203 <indexterm role="option">
73204 <primary><option>preserve_message_logs</option></primary>
73205 </indexterm>
73206 In addition to the general log files, Exim writes a log file for each message
73207 that it handles. The names of these per-message logs are the message ids, and
73208 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
73209 message log contains copies of the log lines that apply to the message. This
73210 makes it easier to inspect the status of an individual message without having
73211 to search the main log. A message log is deleted when processing of the message
73212 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
73213 only with great care because they can fill up your disk very quickly.
73214 </para>
73215 <para>
73216 On a heavily loaded system, it may be desirable to disable the use of
73217 per-message logs, in order to reduce disk I/O. This can be done by setting the
73218 <option>message_logs</option> option false.
73219 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
73220 </para>
73221 </section>
73222 </chapter>
73223
73224 <chapter id="CHAPutils">
73225 <title>Exim utilities</title>
73226 <para>
73227 <indexterm role="concept" id="IIDutils" class="startofrange">
73228 <primary>utilities</primary>
73229 </indexterm>
73230 A number of utility scripts and programs are supplied with Exim and are
73231 described in this chapter. There is also the Exim Monitor, which is covered in
73232 the next chapter. The utilities described here are:
73233 </para>
73234 <informaltable frame="none">
73235 <tgroup cols="3" colsep="0" rowsep="0">
73236 <colspec colwidth="7*" align="left"/>
73237 <colspec colwidth="15*" align="left"/>
73238 <colspec colwidth="40*" align="left"/>
73239 <tbody>
73240 <row>
73241 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
73242 <entry><emphasis>exiwhat</emphasis></entry>
73243 <entry>list what Exim processes are doing</entry>
73244 </row>
73245 <row>
73246 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
73247 <entry><emphasis>exiqgrep</emphasis></entry>
73248 <entry>grep the queue</entry>
73249 </row>
73250 <row>
73251 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
73252 <entry><emphasis>exiqsumm</emphasis></entry>
73253 <entry>summarize the queue</entry>
73254 </row>
73255 <row>
73256 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
73257 <entry><emphasis>exigrep</emphasis></entry>
73258 <entry>search the main log</entry>
73259 </row>
73260 <row>
73261 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
73262 <entry><emphasis>exipick</emphasis></entry>
73263 <entry>select messages on various criteria</entry>
73264 </row>
73265 <row>
73266 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
73267 <entry><emphasis>exicyclog</emphasis></entry>
73268 <entry>cycle (rotate) log files</entry>
73269 </row>
73270 <row>
73271 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
73272 <entry><emphasis>eximstats</emphasis></entry>
73273 <entry>extract statistics from the log</entry>
73274 </row>
73275 <row>
73276 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
73277 <entry><emphasis>exim_checkaccess</emphasis></entry>
73278 <entry>check address acceptance from given IP</entry>
73279 </row>
73280 <row>
73281 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
73282 <entry><emphasis>exim_dbmbuild</emphasis></entry>
73283 <entry>build a DBM file</entry>
73284 </row>
73285 <row>
73286 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
73287 <entry><emphasis>exinext</emphasis></entry>
73288 <entry>extract retry information</entry>
73289 </row>
73290 <row>
73291 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdumpdb"/></entry>
73292 <entry><emphasis>exim_dumpdb</emphasis></entry>
73293 <entry>dump a hints database</entry>
73294 </row>
73295 <row>
73296 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTtidydb"/></entry>
73297 <entry><emphasis>exim_tidydb</emphasis></entry>
73298 <entry>clean up a hints database</entry>
73299 </row>
73300 <row>
73301 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfixdb"/></entry>
73302 <entry><emphasis>exim_fixdb</emphasis></entry>
73303 <entry>patch a hints database</entry>
73304 </row>
73305 <row>
73306 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
73307 <entry><emphasis>exim_lock</emphasis></entry>
73308 <entry>lock a mailbox file</entry>
73309 </row>
73310 <row>
73311 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexim_msgdate"/></entry>
73312 <entry><emphasis>exim_msgdate</emphasis></entry>
73313 <entry>Message Ids for humans (exim_msgdate)</entry>
73314 </row>
73315 </tbody>
73316 </tgroup>
73317 </informaltable>
73318 <para>
73319 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
73320 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
73321 <emphasis role="bold"><ulink url="https://duncanthrax.net/exilog/">https://duncanthrax.net/exilog/</ulink></emphasis> for details.
73322 </para>
73323 <section id="SECTfinoutwha">
73324 <title>Finding out what Exim processes are doing (exiwhat)</title>
73325 <para>
73326 <indexterm role="concept">
73327 <primary><emphasis>exiwhat</emphasis></primary>
73328 </indexterm>
73329 <indexterm role="concept">
73330 <primary>process, querying</primary>
73331 </indexterm>
73332 <indexterm role="concept">
73333 <primary>SIGUSR1</primary>
73334 </indexterm>
73335 On operating systems that can restart a system call after receiving a signal
73336 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
73337 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
73338 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
73339 processes it can find, having first emptied the file. It then waits for one
73340 second to allow the Exim processes to react before displaying the results. In
73341 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
73342 send the signal to the Exim processes, so it is normally run as root.
73343 </para>
73344 <para>
73345 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
73346 use by system administrators. It is not sensible, for example, to set up a
73347 script that sends SIGUSR1 signals to Exim processes at short intervals.
73348 </para>
73349 <para>
73350 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
73351 varies in different operating systems. Not only are different options used,
73352 but the format of the output is different. For this reason, there are some
73353 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
73354 it doesn&#x2019;t seem to be working for you, check the following compile-time
73355 options:
73356 </para>
73357 <informaltable frame="none">
73358 <tgroup cols="2" colsep="0" rowsep="0">
73359 <colspec colwidth="30*" align="left"/>
73360 <colspec colwidth="70*" align="left"/>
73361 <tbody>
73362 <row>
73363 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_PS_CMD</literal></entry>
73364 <entry>the command for running <emphasis>ps</emphasis></entry>
73365 </row>
73366 <row>
73367 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_PS_ARG</literal></entry>
73368 <entry>the argument for <emphasis>ps</emphasis></entry>
73369 </row>
73370 <row>
73371 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_EGREP_ARG</literal></entry>
73372 <entry>the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output</entry>
73373 </row>
73374 <row>
73375 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_KILL_ARG</literal></entry>
73376 <entry>the argument for the <emphasis>kill</emphasis> command</entry>
73377 </row>
73378 </tbody>
73379 </tgroup>
73380 </informaltable>
73381 <para>
73382 An example of typical output from <emphasis>exiwhat</emphasis> is
73383 </para>
73384 <literallayout class="monospaced">
73385 164 daemon: -q1h, listening on port 25
73386 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
73387 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
73388   [10.19.42.42] (editor@ref.example)
73389 10592 handling incoming call from [192.168.243.242]
73390 10628 accepting a local non-SMTP message
73391 </literallayout>
73392 <para>
73393 The first number in the output line is the process number. The third line has
73394 been split here, in order to fit it on the page.
73395 </para>
73396 </section>
73397 <section id="SECTgreptheque">
73398 <title>Selective queue listing (exiqgrep)</title>
73399 <para>
73400 <indexterm role="concept">
73401 <primary><emphasis>exiqgrep</emphasis></primary>
73402 </indexterm>
73403 <indexterm role="concept">
73404 <primary>queue</primary>
73405 <secondary>grepping</secondary>
73406 </indexterm>
73407 This utility is a Perl script contributed by Matt Hubbard. It runs
73408 </para>
73409 <literallayout class="monospaced">
73410 exim -bpu
73411 </literallayout>
73412 <para>
73413 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
73414 </para>
73415 <literallayout class="monospaced">
73416 exim -bp
73417 </literallayout>
73418 <para>
73419 to obtain a queue listing, and then greps the output to select messages
73420 that match given criteria. The following selection options are available:
73421 </para>
73422 <variablelist>
73423 <varlistentry>
73424 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
73425 <listitem>
73426 <para>
73427 Match the sender address using a case-insensitive search. The field that is
73428 tested is enclosed in angle brackets, so you can test for bounce messages with
73429 </para>
73430 <literallayout class="monospaced">
73431 exiqgrep -f '^&lt;&gt;$'
73432 </literallayout>
73433 </listitem></varlistentry>
73434 <varlistentry>
73435 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
73436 <listitem>
73437 <para>
73438 Match a recipient address using a case-insensitive search. The field that is
73439 tested is not enclosed in angle brackets.
73440 </para>
73441 </listitem></varlistentry>
73442 <varlistentry>
73443 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
73444 <listitem>
73445 <para>
73446 Match against the size field.
73447 </para>
73448 </listitem></varlistentry>
73449 <varlistentry>
73450 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
73451 <listitem>
73452 <para>
73453 Match messages that are younger than the given time.
73454 </para>
73455 </listitem></varlistentry>
73456 <varlistentry>
73457 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
73458 <listitem>
73459 <para>
73460 Match messages that are older than the given time.
73461 </para>
73462 </listitem></varlistentry>
73463 <varlistentry>
73464 <term><emphasis role="bold">-z</emphasis></term>
73465 <listitem>
73466 <para>
73467 Match only frozen messages.
73468 </para>
73469 </listitem></varlistentry>
73470 <varlistentry>
73471 <term><emphasis role="bold">-x</emphasis></term>
73472 <listitem>
73473 <para>
73474 Match only non-frozen messages.
73475 </para>
73476 </listitem></varlistentry>
73477 <varlistentry>
73478 <term><emphasis role="bold">-G</emphasis>&nbsp;&lt;<emphasis>queuename</emphasis>&gt;</term>
73479 <listitem>
73480 <para>
73481 Match only messages in the given queue.  Without this, the default queue is searched.
73482 </para>
73483 </listitem></varlistentry>
73484 </variablelist>
73485 <para>
73486 The following options control the format of the output:
73487 </para>
73488 <variablelist>
73489 <varlistentry>
73490 <term><emphasis role="bold">-c</emphasis></term>
73491 <listitem>
73492 <para>
73493 Display only the count of matching messages.
73494 </para>
73495 </listitem></varlistentry>
73496 <varlistentry>
73497 <term><emphasis role="bold">-l</emphasis></term>
73498 <listitem>
73499 <para>
73500 Long format &ndash; display the full message information as output by Exim. This is
73501 the default.
73502 </para>
73503 </listitem></varlistentry>
73504 <varlistentry>
73505 <term><emphasis role="bold">-i</emphasis></term>
73506 <listitem>
73507 <para>
73508 Display message ids only.
73509 </para>
73510 </listitem></varlistentry>
73511 <varlistentry>
73512 <term><emphasis role="bold">-b</emphasis></term>
73513 <listitem>
73514 <para>
73515 Brief format &ndash; one line per message.
73516 </para>
73517 </listitem></varlistentry>
73518 <varlistentry>
73519 <term><emphasis role="bold">-R</emphasis></term>
73520 <listitem>
73521 <para>
73522 Display messages in reverse order.
73523 </para>
73524 </listitem></varlistentry>
73525 <varlistentry>
73526 <term><emphasis role="bold">-a</emphasis></term>
73527 <listitem>
73528 <para>
73529 Include delivered recipients in queue listing.
73530 </para>
73531 </listitem></varlistentry>
73532 </variablelist>
73533 <para>
73534 The following options give alternates for configuration:
73535 </para>
73536 <variablelist>
73537 <varlistentry>
73538 <term><emphasis role="bold">-C</emphasis>&nbsp;&lt;<emphasis>config&nbsp;file</emphasis>&gt;</term>
73539 <listitem>
73540 <para>
73541 is used to specify an alternate <filename>exim.conf</filename> which might
73542 contain alternate exim configuration the queue management might be using.
73543 </para>
73544 </listitem></varlistentry>
73545 <varlistentry>
73546 <term><emphasis role="bold">-E</emphasis>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
73547 <listitem>
73548 <para>
73549 can be used to specify a path for the exim binary,
73550 overriding the built-in one.
73551 </para>
73552 </listitem></varlistentry>
73553 </variablelist>
73554 <para>
73555 There is one more option, <option>-h</option>, which outputs a list of options.
73556 At least one selection option, or either the <emphasis role="bold">-c</emphasis> or <emphasis role="bold">-h</emphasis> option, must be given.
73557 </para>
73558 </section>
73559 <section id="SECTsumtheque">
73560 <title>Summarizing the queue (exiqsumm)</title>
73561 <para>
73562 <indexterm role="concept">
73563 <primary><emphasis>exiqsumm</emphasis></primary>
73564 </indexterm>
73565 <indexterm role="concept">
73566 <primary>queue</primary>
73567 <secondary>summary</secondary>
73568 </indexterm>
73569 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
73570 -bp</literal> and produces a summary of the messages in the queue. Thus, you use it by
73571 running a command such as
73572 </para>
73573 <literallayout class="monospaced">
73574 exim -bp | exiqsumm
73575 </literallayout>
73576 <para>
73577 The output consists of one line for each domain that has messages waiting for
73578 it, as in the following example:
73579 </para>
73580 <literallayout class="monospaced">
73581 3   2322   74m   66m  msn.com.example
73582 </literallayout>
73583 <para>
73584 Each line lists the number of pending deliveries for a domain, their total
73585 volume, and the length of time that the oldest and the newest messages have
73586 been waiting. Note that the number of pending deliveries is greater than the
73587 number of messages when messages have more than one recipient.
73588 </para>
73589 <para>
73590 A summary line is output at the end. By default the output is sorted on the
73591 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
73592 the output to be sorted by oldest message and by count of messages,
73593 respectively. There are also three options that split the messages for each
73594 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
73595 separates frozen messages, and <option>-s</option> separates messages according to their
73596 sender.
73597 </para>
73598 <para>
73599 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
73600 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
73601 generated by aliasing or forwarding are included (unless the <option>one_time</option>
73602 option of the <command>redirect</command> router has been used to convert them into <quote>top
73603 level</quote> addresses).
73604 </para>
73605 </section>
73606 <section id="SECTextspeinf">
73607 <title>Extracting specific information from the log (exigrep)</title>
73608 <para>
73609 <indexterm role="concept">
73610 <primary><emphasis>exigrep</emphasis></primary>
73611 </indexterm>
73612 <indexterm role="concept">
73613 <primary>log</primary>
73614 <secondary>extracts; grepping for</secondary>
73615 </indexterm>
73616 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
73617 files for entries that match a given pattern. When it finds a match, it
73618 extracts all the log entries for the relevant message, not just those that
73619 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
73620 given message, or all mail for a given user, or for a given host, for example.
73621 The input files can be in Exim log format or syslog format.
73622 If a matching log line is not associated with a specific message, it is
73623 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
73624 </para>
73625 <literallayout>
73626 <literal>exigrep [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] [-I] [-l] [-M] [-v] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
73627 </literallayout>
73628 <para>
73629 If no log filenames are given on the command line, the standard input is read.
73630 </para>
73631 <para>
73632 The <option>-t</option> argument specifies a number of seconds. It adds an additional
73633 condition for message selection. Messages that are complete are shown only if
73634 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds in the queue.
73635 </para>
73636 <para>
73637 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
73638 makes it case-sensitive. This may give a performance improvement when searching
73639 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
73640 option; with <option>-I</option> they do not. In both cases it is possible to change the
73641 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
73642 </para>
73643 <para>
73644 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
73645 pattern as standing for themselves. Otherwise the pattern must be a Perl
73646 regular expression.
73647 </para>
73648 <para>
73649 The <option>-v</option> option inverts the matching condition. That is, a line is selected
73650 if it does <emphasis>not</emphasis> match the pattern.
73651 </para>
73652 <para>
73653 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
73654 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
73655 normally.
73656 </para>
73657 <para>
73658 Example of <option>-M</option>:
73659 user_a sends a message to user_b, which generates a bounce back to user_b. If
73660 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
73661 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
73662 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
73663 when searching for <quote>user_a</quote> will show both messages since the bounce is
73664 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
73665 search term.
73666 </para>
73667 <para>
73668 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
73669 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
73670 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
73671 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
73672 autodetection of some well known compression extensions.
73673 </para>
73674 </section>
73675 <section id="SECTexipick">
73676 <title>Selecting messages by various criteria (exipick)</title>
73677 <para>
73678 <indexterm role="concept">
73679 <primary><emphasis>exipick</emphasis></primary>
73680 </indexterm>
73681 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
73682 lists messages from the queue according to a variety of criteria. For details
73683 of <emphasis>exipick</emphasis>&#x2019;s facilities, run <emphasis>exipick</emphasis> with
73684 the <option>--help</option> option.
73685 </para>
73686 </section>
73687 <section id="SECTcyclogfil">
73688 <title>Cycling log files (exicyclog)</title>
73689 <para>
73690 <indexterm role="concept">
73691 <primary>log</primary>
73692 <secondary>cycling local files</secondary>
73693 </indexterm>
73694 <indexterm role="concept">
73695 <primary>cycling logs</primary>
73696 </indexterm>
73697 <indexterm role="concept">
73698 <primary><emphasis>exicyclog</emphasis></primary>
73699 </indexterm>
73700 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
73701 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
73702 you are using log files with datestamps in their names (see section
73703 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
73704 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
73705 There are two command line options for <emphasis>exicyclog</emphasis>:
73706 </para>
73707 <itemizedlist>
73708 <listitem>
73709 <para>
73710 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
73711 default that is set when Exim is built. The default default is 10.
73712 </para>
73713 </listitem>
73714 <listitem>
73715 <para>
73716 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
73717 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
73718 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
73719 configuration.
73720 </para>
73721 </listitem>
73722 </itemizedlist>
73723 <para>
73724 Each time <emphasis>exicyclog</emphasis> is run the filenames get <quote>shuffled down</quote> by one. If
73725 the main log filename is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
73726 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
73727 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
73728 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
73729 logs are handled similarly.
73730 </para>
73731 <para>
73732 If the limit is greater than 99, the script uses 3-digit numbers such as
73733 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
73734 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
73735 any existing log files.
73736 </para>
73737 <para>
73738 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
73739 the end are deleted. All files with numbers greater than 01 are compressed,
73740 using a compression command which is configured by the COMPRESS_COMMAND
73741 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
73742 root <option>crontab</option> entry of the form
73743 </para>
73744 <literallayout class="monospaced">
73745 1 0 * * * su exim -c /usr/exim/bin/exicyclog
73746 </literallayout>
73747 <para>
73748 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
73749 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
73750 </para>
73751 </section>
73752 <section id="SECTmailstat">
73753 <title>Mail statistics (eximstats)</title>
73754 <para>
73755 <indexterm role="concept">
73756 <primary>statistics</primary>
73757 </indexterm>
73758 <indexterm role="concept">
73759 <primary><emphasis>eximstats</emphasis></primary>
73760 </indexterm>
73761 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
73762 information from log files. The output is either plain text, or HTML.
73763 </para>
73764 <para>
73765 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
73766 latest version is the result of some extensive revision by Steve Campbell. A
73767 lot of information is given by default, but there are options for suppressing
73768 various parts of it. Following any options, the arguments to the script are a
73769 list of files, which should be main log files. For example:
73770 </para>
73771 <literallayout class="monospaced">
73772 eximstats -nr /var/spool/exim/log/mainlog.01
73773 </literallayout>
73774 <para>
73775 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
73776 messages received from or delivered to various hosts. The information is sorted
73777 both by message count and by volume, and the top fifty hosts in each category
73778 are listed on the standard output. Similar information, based on email
73779 addresses or domains instead of hosts can be requested by means of various
73780 options. For messages delivered and received locally, similar statistics are
73781 also produced per user.
73782 </para>
73783 <para>
73784 The output also includes total counts and statistics about delivery errors, and
73785 histograms showing the number of messages received and deliveries made in each
73786 hour of the day. A delivery with more than one address in its envelope (for
73787 example, an SMTP transaction with more than one RCPT command) is counted
73788 as a single delivery by <emphasis>eximstats</emphasis>.
73789 </para>
73790 <para>
73791 Though normally more deliveries than receipts are reported (as messages may
73792 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
73793 messages received than delivered, even though the queue is empty at the start
73794 and end of the period in question. If an incoming message contains no valid
73795 recipients, no deliveries are recorded for it. A bounce message is handled as
73796 an entirely separate message.
73797 </para>
73798 <para>
73799 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
73800 of messages received and deliveries made, and the number of hosts involved in
73801 each case. It also outputs the number of messages that were delayed (that is,
73802 not completely delivered at the first attempt), and the number that had at
73803 least one address that failed.
73804 </para>
73805 <para>
73806 The remainder of the output is in sections that can be independently disabled
73807 or modified by various options. It consists of a summary of deliveries by
73808 transport, histograms of messages received and delivered per time interval
73809 (default per hour), information about the time messages spent in the queue,
73810 a list of relayed messages, lists of the top fifty sending hosts, local
73811 senders, destination hosts, and destination local users by count and by volume,
73812 and a list of delivery errors that occurred.
73813 </para>
73814 <para>
73815 The relay information lists messages that were actually relayed, that is, they
73816 came from a remote host and were directly delivered to some other remote host,
73817 without being processed (for example, for aliasing or forwarding) locally.
73818 </para>
73819 <para>
73820 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
73821 outputs. These are documented in the Perl script itself, and can be extracted
73822 by running the command <command>perldoc</command> on the script. For example:
73823 </para>
73824 <literallayout class="monospaced">
73825 perldoc /usr/exim/bin/eximstats
73826 </literallayout>
73827 </section>
73828 <section id="SECTcheckaccess">
73829 <title>Checking access policy (exim_checkaccess)</title>
73830 <para>
73831 <indexterm role="concept">
73832 <primary><emphasis>exim_checkaccess</emphasis></primary>
73833 </indexterm>
73834 <indexterm role="concept">
73835 <primary>policy control</primary>
73836 <secondary>checking access</secondary>
73837 </indexterm>
73838 <indexterm role="concept">
73839 <primary>checking access</primary>
73840 </indexterm>
73841 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
73842 debugging output, in order to check what Exim is doing when it is applying
73843 policy controls to incoming SMTP mail. However, not everybody is sufficiently
73844 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
73845 sometimes you just want to answer the question <quote>Does this address have
73846 access?</quote> without bothering with any further details.
73847 </para>
73848 <para>
73849 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
73850 two arguments, an IP address and an email address:
73851 </para>
73852 <literallayout class="monospaced">
73853 exim_checkaccess 10.9.8.7 A.User@a.domain.example
73854 </literallayout>
73855 <para>
73856 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
73857 given email address would be accepted in a RCPT command in a TCP/IP
73858 connection from the host with the given IP address. The output of the utility
73859 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
73860 </para>
73861 <literallayout class="monospaced">
73862 Rejected:
73863 550 Relay not permitted
73864 </literallayout>
73865 <para>
73866 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
73867 for the MAIL command, but you can change this by providing additional
73868 options. These are passed directly to the Exim command. For example, to specify
73869 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
73870 you can use:
73871 </para>
73872 <literallayout class="monospaced">
73873 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
73874                  -f himself@there.example
73875 </literallayout>
73876 <para>
73877 Note that these additional Exim command line items must be given after the two
73878 mandatory arguments.
73879 </para>
73880 <para>
73881 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
73882 while running its checks. You can run checks that include callouts by using
73883 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
73884 </para>
73885 </section>
73886 <section id="SECTdbmbuild">
73887 <title>Making DBM files (exim_dbmbuild)</title>
73888 <para>
73889 <indexterm role="concept">
73890 <primary>DBM</primary>
73891 <secondary>building dbm files</secondary>
73892 </indexterm>
73893 <indexterm role="concept">
73894 <primary>building DBM files</primary>
73895 </indexterm>
73896 <indexterm role="concept">
73897 <primary><emphasis>exim_dbmbuild</emphasis></primary>
73898 </indexterm>
73899 <indexterm role="concept">
73900 <primary>lower casing</primary>
73901 </indexterm>
73902 <indexterm role="concept">
73903 <primary>binary zero</primary>
73904 <secondary>in lookup key</secondary>
73905 </indexterm>
73906 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
73907 the format used by the <command>lsearch</command> lookup (see section
73908 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
73909 names as keys and the remainder of the information as data. The lower-casing
73910 can be prevented by calling the program with the <option>-nolc</option> option.
73911 </para>
73912 <para>
73913 A terminating zero is included as part of the key string. This is expected by
73914 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
73915 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
73916 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
73917 files.
73918 </para>
73919 <para>
73920 The program requires two arguments: the name of the input file (which can be a
73921 single hyphen to indicate the standard input), and the name of the output file.
73922 It creates the output under a temporary name, and then renames it if all went
73923 well.
73924 </para>
73925 <para>
73926 <indexterm role="concept">
73927 <primary>USE_DB</primary>
73928 </indexterm>
73929 If the native DB interface is in use (USE_DB is set in a compile-time
73930 configuration file &ndash; this is common in free versions of Unix) the two
73931 filenames must be different, because in this mode the Berkeley DB functions
73932 create a single output file using exactly the name given. For example,
73933 </para>
73934 <literallayout class="monospaced">
73935 exim_dbmbuild /etc/aliases /etc/aliases.db
73936 </literallayout>
73937 <para>
73938 reads the system alias file and creates a DBM version of it in
73939 <filename>/etc/aliases.db</filename>.
73940 </para>
73941 <para>
73942 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
73943 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
73944 environment, the suffixes are added to the second argument of
73945 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
73946 when the Berkeley functions are used in compatibility mode (though this is not
73947 recommended), because in that case it adds a <filename>.db</filename> suffix to the filename.
73948 </para>
73949 <para>
73950 If a duplicate key is encountered, the program outputs a warning, and when it
73951 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
73952 option is used. By default, only the first of a set of duplicates is used &ndash;
73953 this makes it compatible with <command>lsearch</command> lookups. There is an option
73954 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
73955 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
73956 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
73957 return code is 2.
73958 </para>
73959 </section>
73960 <section id="SECTfinindret">
73961 <title>Finding individual retry times (exinext)</title>
73962 <para>
73963 <indexterm role="concept">
73964 <primary>retry</primary>
73965 <secondary>times</secondary>
73966 </indexterm>
73967 <indexterm role="concept">
73968 <primary><emphasis>exinext</emphasis></primary>
73969 </indexterm>
73970 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
73971 fish specific information out of the retry database. Given a mail domain (or a
73972 complete address), it looks up the hosts for that domain, and outputs any retry
73973 information for the hosts or for the domain. At present, the retry information
73974 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
73975 output. For example:
73976 </para>
73977 <literallayout class="monospaced">
73978 $ exinext piglet@milne.fict.example
73979 kanga.milne.example:192.168.8.1 error 146: Connection refused
73980   first failed: 21-Feb-1996 14:57:34
73981   last tried:   21-Feb-1996 14:57:34
73982   next try at:  21-Feb-1996 15:02:34
73983 roo.milne.example:192.168.8.3 error 146: Connection refused
73984   first failed: 20-Jan-1996 13:12:08
73985   last tried:   21-Feb-1996 11:42:03
73986   next try at:  21-Feb-1996 19:42:03
73987   past final cutoff time
73988 </literallayout>
73989 <para>
73990 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
73991 will give any retry information for that local part in your default domain.
73992 A message id can be used to obtain retry information pertaining to a specific
73993 message. This exists only when an attempt to deliver a message to a remote host
73994 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
73995 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
73996 run very often.
73997 </para>
73998 <para>
73999 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
74000 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
74001 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
74002 configuration file, and the second sets macros for use within the configuration
74003 file. These features are mainly to help in testing, but might also be useful in
74004 environments where more than one configuration file is in use.
74005 </para>
74006 </section>
74007 <section id="SECThindatmai">
74008 <title>Hints database maintenance</title>
74009 <para>
74010 <indexterm role="concept">
74011 <primary>hints database</primary>
74012 <secondary>maintenance</secondary>
74013 </indexterm>
74014 <indexterm role="concept">
74015 <primary>maintaining Exim&#x2019;s hints database</primary>
74016 </indexterm>
74017 Three utility programs are provided for maintaining the DBM files that Exim
74018 uses to contain its delivery hint information. Each program requires two
74019 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
74020 second is the name of the database it is to operate on. These are as follows:
74021 </para>
74022 <itemizedlist>
74023 <listitem>
74024 <para>
74025 <emphasis>retry</emphasis>: the database of retry information
74026 </para>
74027 </listitem>
74028 <listitem>
74029 <para>
74030 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
74031 for remote hosts
74032 </para>
74033 </listitem>
74034 <listitem>
74035 <para>
74036 <emphasis>callout</emphasis>: the callout cache
74037 </para>
74038 </listitem>
74039 <listitem>
74040 <para>
74041 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
74042 </para>
74043 </listitem>
74044 <listitem>
74045 <para>
74046 <emphasis>tls</emphasis>: TLS session resumption data
74047 </para>
74048 </listitem>
74049 <listitem>
74050 <para>
74051 <emphasis>misc</emphasis>: other hints data
74052 </para>
74053 </listitem>
74054 </itemizedlist>
74055 <para>
74056 The <emphasis>misc</emphasis> database is used for
74057 </para>
74058 <itemizedlist>
74059 <listitem>
74060 <para>
74061 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
74062 </para>
74063 </listitem>
74064 <listitem>
74065 <para>
74066 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
74067 <command>smtp</command> transport)
74068 </para>
74069 </listitem>
74070 <listitem>
74071 <para>
74072 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
74073 in a transport)
74074 </para>
74075 </listitem>
74076 <listitem>
74077 <para>
74078 Recording EHLO-time facilities advertised by hosts
74079 </para>
74080 </listitem>
74081 </itemizedlist>
74082 </section>
74083 <section id="SECTdumpdb">
74084 <title>exim_dumpdb</title>
74085 <para>
74086 <indexterm role="concept">
74087 <primary><emphasis>exim_dumpdb</emphasis></primary>
74088 </indexterm>
74089 The entire contents of a database are written to the standard output by the
74090 <emphasis>exim_dumpdb</emphasis> program,
74091 taking as arguments the spool and database names.
74092 An option <emphasis>-z</emphasis> may be given to request times in UTC;
74093 otherwise times are in the local timezone.
74094 An option <emphasis>-k</emphasis> may be given to dump only the record keys.
74095 For example, to dump the retry database:
74096 </para>
74097 <literallayout class="monospaced">
74098 exim_dumpdb /var/spool/exim retry
74099 </literallayout>
74100 <para>
74101 For the retry database
74102 two lines of output are produced for each entry:
74103 </para>
74104 <literallayout class="monospaced">
74105 T:mail.ref.example:192.168.242.242 146 77 Connection refused
74106 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
74107 </literallayout>
74108 <para>
74109 The first item on the first line is the key of the record. It starts with one
74110 of the letters R, or T, depending on whether it refers to a routing or
74111 transport retry. For a local delivery, the next part is the local address; for
74112 a remote delivery it is the name of the remote host, followed by its failing IP
74113 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
74114 transport). If the remote port is not the standard one (port 25), it is added
74115 to the IP address. Then there follows an error code, an additional error code,
74116 and a textual description of the error.
74117 </para>
74118 <para>
74119 The three times on the second line are the time of first failure, the time of
74120 the last delivery attempt, and the computed time for the next attempt. The line
74121 ends with an asterisk if the cutoff time for the last retry rule has been
74122 exceeded.
74123 </para>
74124 <para>
74125 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
74126 consists of a host name followed by a list of ids for messages that are or were
74127 waiting to be delivered to that host. If there are a very large number for any
74128 one host, continuation records, with a sequence number added to the host name,
74129 may be seen. The data in these records is often out of date, because a message
74130 may be routed to several alternative hosts, and Exim makes no effort to keep
74131 cross-references.
74132 </para>
74133 </section>
74134 <section id="SECTtidydb">
74135 <title>exim_tidydb</title>
74136 <para>
74137 <indexterm role="concept">
74138 <primary><emphasis>exim_tidydb</emphasis></primary>
74139 </indexterm>
74140 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
74141 database. If run with no options, it removes all records that are more than 30
74142 days old. The age is calculated from the date and time that the record was last
74143 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
74144 since the first delivery failure. Information about a host that has been down
74145 for more than 30 days will remain in the database, provided that the record is
74146 updated sufficiently often.
74147 </para>
74148 <para>
74149 The cutoff date can be altered by means of the <option>-t</option> option, which must be
74150 followed by a time. For example, to remove all records older than a week from
74151 the retry database:
74152 </para>
74153 <literallayout class="monospaced">
74154 exim_tidydb -t 7d /var/spool/exim retry
74155 </literallayout>
74156 <para>
74157 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
74158 message ids. In the former these appear as data in records keyed by host &ndash;
74159 they were messages that were waiting for that host &ndash; and in the latter they
74160 are the keys for retry information for messages that have suffered certain
74161 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
74162 message ids in database records are those of messages that are still on the
74163 queue. Message ids for messages that no longer exist are removed from
74164 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
74165 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
74166 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
74167 whenever it removes information from the database.
74168 </para>
74169 <para>
74170 Certain records are automatically removed by Exim when they are no longer
74171 needed, but others are not. For example, if all the MX hosts for a domain are
74172 down, a retry record is created for each one. If the primary MX host comes back
74173 first, its record is removed when Exim successfully delivers to it, but the
74174 records for the others remain because Exim has not tried to use those hosts.
74175 </para>
74176 <para>
74177 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
74178 hints databases. You should do this at a quiet time of day, because it requires
74179 a database to be locked (and therefore inaccessible to Exim) while it does its
74180 work. Removing records from a DBM file does not normally make the file smaller,
74181 but all the common DBM libraries are able to re-use the space that is released.
74182 After an initial phase of increasing in size, the databases normally reach a
74183 point at which they no longer get any bigger, as long as they are regularly
74184 tidied.
74185 </para>
74186 <para>
74187 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
74188 databases is likely to keep on increasing.
74189 </para>
74190 </section>
74191 <section id="SECTfixdb">
74192 <title>exim_fixdb</title>
74193 <para>
74194 <indexterm role="concept">
74195 <primary><emphasis>exim_fixdb</emphasis></primary>
74196 </indexterm>
74197 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
74198 Its main use is for testing Exim, but it might also be occasionally useful for
74199 getting round problems in a live system. Its interface
74200 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
74201 key of a database record can then be entered, and the data for that record is
74202 displayed.
74203 </para>
74204 <para>
74205 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
74206 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
74207 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
74208 data for individual fields can be changed by typing the field number followed
74209 by new data, for example:
74210 </para>
74211 <literallayout class="monospaced">
74212 &gt; 4 951102:1000
74213 </literallayout>
74214 <para>
74215 resets the time of the next delivery attempt. Time values are given as a
74216 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
74217 used as optional separators.
74218 </para>
74219 <para>
74220 Both displayed and input times are in the local timezone by default.
74221 If an option <emphasis>-z</emphasis> is used on the command line, displayed times
74222 are in UTC.
74223 </para>
74224 </section>
74225 <section id="SECTmailboxmaint">
74226 <title>Mailbox maintenance (exim_lock)</title>
74227 <para>
74228 <indexterm role="concept">
74229 <primary>mailbox</primary>
74230 <secondary>maintenance</secondary>
74231 </indexterm>
74232 <indexterm role="concept">
74233 <primary><emphasis>exim_lock</emphasis></primary>
74234 </indexterm>
74235 <indexterm role="concept">
74236 <primary>locking mailboxes</primary>
74237 </indexterm>
74238 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
74239 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
74240 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
74241 a user agent while investigating a problem. The utility requires the name of
74242 the file as its first argument. If the locking is successful, the second
74243 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
74244 second argument, the value of the SHELL environment variable is used; if this
74245 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
74246 is unlocked and the utility ends. The following options are available:
74247 </para>
74248 <variablelist>
74249 <varlistentry>
74250 <term><option>-fcntl</option></term>
74251 <listitem>
74252 <para>
74253 Use <function>fcntl()</function> locking on the open mailbox.
74254 </para>
74255 </listitem></varlistentry>
74256 <varlistentry>
74257 <term><option>-flock</option></term>
74258 <listitem>
74259 <para>
74260 Use <function>flock()</function> locking on the open mailbox, provided the operating system
74261 supports it.
74262 </para>
74263 </listitem></varlistentry>
74264 <varlistentry>
74265 <term><option>-interval</option></term>
74266 <listitem>
74267 <para>
74268 This must be followed by a number, which is a number of seconds; it sets the
74269 interval to sleep between retries (default 3).
74270 </para>
74271 </listitem></varlistentry>
74272 <varlistentry>
74273 <term><option>-lockfile</option></term>
74274 <listitem>
74275 <para>
74276 Create a lock file before opening the mailbox.
74277 </para>
74278 </listitem></varlistentry>
74279 <varlistentry>
74280 <term><option>-mbx</option></term>
74281 <listitem>
74282 <para>
74283 Lock the mailbox using MBX rules.
74284 </para>
74285 </listitem></varlistentry>
74286 <varlistentry>
74287 <term><option>-q</option></term>
74288 <listitem>
74289 <para>
74290 Suppress verification output.
74291 </para>
74292 </listitem></varlistentry>
74293 <varlistentry>
74294 <term><option>-retries</option></term>
74295 <listitem>
74296 <para>
74297 This must be followed by a number; it sets the number of times to try to get
74298 the lock (default 10).
74299 </para>
74300 </listitem></varlistentry>
74301 <varlistentry>
74302 <term><option>-restore_time</option></term>
74303 <listitem>
74304 <para>
74305 This option causes <option>exim_lock</option> to restore the modified and read times to the
74306 locked file before exiting. This allows you to access a locked mailbox (for
74307 example, to take a backup copy) without disturbing the times that the user
74308 subsequently sees.
74309 </para>
74310 </listitem></varlistentry>
74311 <varlistentry>
74312 <term><option>-timeout</option></term>
74313 <listitem>
74314 <para>
74315 This must be followed by a number, which is a number of seconds; it sets a
74316 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
74317 default), a non-blocking call is used.
74318 </para>
74319 </listitem></varlistentry>
74320 <varlistentry>
74321 <term><option>-v</option></term>
74322 <listitem>
74323 <para>
74324 Generate verbose output.
74325 </para>
74326 </listitem></varlistentry>
74327 </variablelist>
74328 <para>
74329 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
74330 default is to create a lock file and also to use <function>fcntl()</function> locking on the
74331 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
74332 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
74333 requires that the directory containing the file be writeable. Locking by lock
74334 file does not last forever; Exim assumes that a lock file is expired if it is
74335 more than 30 minutes old.
74336 </para>
74337 <para>
74338 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
74339 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
74340 to be taken out on the open mailbox, and an exclusive lock on the file
74341 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
74342 number of the mailbox file. When the locking is released, if an exclusive lock
74343 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
74344 </para>
74345 <para>
74346 The default output contains verification of the locking that takes place. The
74347 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
74348 suppresses all output except error messages.
74349 </para>
74350 <para>
74351 A command such as
74352 </para>
74353 <literallayout class="monospaced">
74354 exim_lock /var/spool/mail/spqr
74355 </literallayout>
74356 <para>
74357 runs an interactive shell while the file is locked, whereas
74358 </para>
74359 <literallayout>
74360 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
74361 &lt;<emphasis>some commands</emphasis>&gt;
74362 <literal>End</literal>
74363 </literallayout>
74364 <para>
74365 runs a specific non-interactive sequence of commands while the file is locked,
74366 suppressing all verification output. A single command can be run by a command
74367 such as
74368 </para>
74369 <literallayout class="monospaced">
74370 exim_lock -q /var/spool/mail/spqr \
74371   "cp /var/spool/mail/spqr /some/where"
74372 </literallayout>
74373 <para>
74374 Note that if a command is supplied, it must be entirely contained within the
74375 second argument &ndash; hence the quotes.
74376 </para>
74377 </section>
74378 <section id="SECTexim_msgdate">
74379 <title>Message Ids for humans (exim_msgdate)</title>
74380 <para>
74381 <indexterm role="concept">
74382 <primary>exim_msgdate</primary>
74383 </indexterm>
74384 The <emphasis>exim_msgdate</emphasis> utility is written by Andrew Aitchison and included in the Exim distribution.
74385 This Perl script converts an Exim Mesage ID back into a human readable form.
74386 For details of <emphasis>exim_msgdate</emphasis>&#x2019;s options, run <emphasis>exim_msgdate</emphasis> with the <option>--help</option> option.
74387 </para>
74388 <para>
74389 Section <xref linkend="SECTmessiden"/> (Message identification) describes Exim Mesage IDs.
74390 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
74391 </para>
74392 </section>
74393 </chapter>
74394
74395 <chapter id="CHAPeximon">
74396 <title>The Exim monitor</title>
74397 <para>
74398 <indexterm role="concept" id="IIDeximon" class="startofrange">
74399 <primary>Exim monitor</primary>
74400 <secondary>description</secondary>
74401 </indexterm>
74402 <indexterm role="concept">
74403 <primary>X-windows</primary>
74404 </indexterm>
74405 <indexterm role="concept">
74406 <primary><emphasis>eximon</emphasis></primary>
74407 </indexterm>
74408 <indexterm role="concept">
74409 <primary>Local/eximon.conf</primary>
74410 </indexterm>
74411 <indexterm role="concept">
74412 <primary><filename>exim_monitor/EDITME</filename></primary>
74413 </indexterm>
74414 The Exim monitor is an application which displays in an X window information
74415 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
74416 perform certain operations on messages from this GUI interface; however all
74417 such facilities are also available from the command line, and indeed, the
74418 monitor itself makes use of the command line to perform any actions requested.
74419 </para>
74420 <section id="SECID264">
74421 <title>Running the monitor</title>
74422 <para>
74423 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
74424 script that sets up a number of environment variables, and then runs the
74425 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
74426 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
74427 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
74428 parameters are for.
74429 </para>
74430 <para>
74431 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
74432 a particular invocation by setting up environment variables of the same names,
74433 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
74434 </para>
74435 <literallayout class="monospaced">
74436 EXIMON_LOG_DEPTH=400 eximon
74437 </literallayout>
74438 <para>
74439 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
74440 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
74441 overrides the Exim log file configuration. This makes it possible to have
74442 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
74443 syslog messages are routed to a file on the local host.
74444 </para>
74445 <para>
74446 X resources can be used to change the appearance of the window in the normal
74447 way. For example, a resource setting of the form
74448 </para>
74449 <literallayout class="monospaced">
74450 Eximon*background: gray94
74451 </literallayout>
74452 <para>
74453 changes the colour of the background to light grey rather than white. The
74454 stripcharts are drawn with both the data lines and the reference lines in
74455 black. This means that the reference lines are not visible when on top of the
74456 data. However, their colour can be changed by setting a resource called
74457 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
74458 For example, if your X server is running Unix, you could set up lighter
74459 reference lines in the stripcharts by obeying
74460 </para>
74461 <literallayout class="monospaced">
74462 xrdb -merge &lt;&lt;End
74463 Eximon*highlight: gray
74464 End
74465 </literallayout>
74466 <para>
74467 <indexterm role="concept">
74468 <primary>admin user</primary>
74469 </indexterm>
74470 In order to see the contents of messages in the queue, and to operate on them,
74471 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
74472 </para>
74473 <para>
74474 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
74475 contain X11 resource parameters interpreted by the X11 library.  In addition,
74476 if the first parameter starts with the string "gdb" then it is removed and the
74477 binary is invoked under gdb (the parameter is used as the gdb command-name, so
74478 versioned variants of gdb can be invoked).
74479 </para>
74480 <para>
74481 The monitor&#x2019;s window is divided into three parts. The first contains one or
74482 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
74483 main log file, and the third is a display of the queue of messages awaiting
74484 delivery, with two more action buttons. The following sections describe these
74485 different parts of the display.
74486 </para>
74487 </section>
74488 <section id="SECID265">
74489 <title>The stripcharts</title>
74490 <para>
74491 <indexterm role="concept">
74492 <primary>stripchart</primary>
74493 </indexterm>
74494 The first stripchart is always a count of messages in the queue. Its name can
74495 be configured by setting QUEUE_STRIPCHART_NAME in the
74496 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
74497 configuration script by regular expression matches on log file entries, making
74498 it possible to display, for example, counts of messages delivered to certain
74499 hosts or using certain transports. The supplied defaults display counts of
74500 received and delivered messages, and of local and SMTP deliveries. The default
74501 period between stripchart updates is one minute; this can be adjusted by a
74502 parameter in the <filename>Local/eximon.conf</filename> file.
74503 </para>
74504 <para>
74505 The stripchart displays rescale themselves automatically as the value they are
74506 displaying changes. There are always 10 horizontal lines in each chart; the
74507 title string indicates the value of each division when it is greater than one.
74508 For example, <quote>x2</quote> means that each division represents a value of 2.
74509 </para>
74510 <para>
74511 It is also possible to have a stripchart which shows the percentage fullness of
74512 a particular disk partition, which is useful when local deliveries are confined
74513 to a single partition.
74514 </para>
74515 <para>
74516 <indexterm role="concept">
74517 <primary><option>statvfs</option> function</primary>
74518 </indexterm>
74519 This relies on the availability of the <function>statvfs()</function> function or equivalent in
74520 the operating system. Most, but not all versions of Unix that support Exim have
74521 this. For this particular stripchart, the top of the chart always represents
74522 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
74523 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
74524 <filename>Local/eximon.conf</filename> file.
74525 </para>
74526 </section>
74527 <section id="SECID266">
74528 <title>Main action buttons</title>
74529 <para>
74530 <indexterm role="concept">
74531 <primary>size</primary>
74532 <secondary>of monitor window</secondary>
74533 </indexterm>
74534 <indexterm role="concept">
74535 <primary>Exim monitor</primary>
74536 <secondary>window size</secondary>
74537 </indexterm>
74538 <indexterm role="concept">
74539 <primary>window size</primary>
74540 </indexterm>
74541 Below the stripcharts there is an action button for quitting the monitor. Next
74542 to this is another button marked <quote>Size</quote>. They are placed here so that
74543 shrinking the window to its default minimum size leaves just the queue count
74544 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
74545 the window to expand to its maximum size, unless it is already at the maximum,
74546 in which case it is reduced to its minimum.
74547 </para>
74548 <para>
74549 When expanding to the maximum, if the window cannot be fully seen where it
74550 currently is, it is moved back to where it was the last time it was at full
74551 size. When it is expanding from its minimum size, the old position is
74552 remembered, and next time it is reduced to the minimum it is moved back there.
74553 </para>
74554 <para>
74555 The idea is that you can keep a reduced window just showing one or two
74556 stripcharts at a convenient place on your screen, easily expand it to show
74557 the full window when required, and just as easily put it back to what it was.
74558 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
74559 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
74560 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
74561 </para>
74562 <para>
74563 Normally, the monitor starts up with the window at its full size, but it can be
74564 built so that it starts up with the window at its smallest size, by setting
74565 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
74566 </para>
74567 </section>
74568 <section id="SECID267">
74569 <title>The log display</title>
74570 <para>
74571 <indexterm role="concept">
74572 <primary>log</primary>
74573 <secondary>tail of; in monitor</secondary>
74574 </indexterm>
74575 The second section of the window is an area in which a display of the tail of
74576 the main log is maintained.
74577 To save space on the screen, the timestamp on each log line is shortened by
74578 removing the date and, if <option>log_timezone</option> is set, the timezone.
74579 The log tail is not available when the only destination for logging data is
74580 syslog, unless the syslog lines are routed to a local file whose name is passed
74581 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
74582 </para>
74583 <para>
74584 The log sub-window has a scroll bar at its lefthand side which can be used to
74585 move back to look at earlier text, and the up and down arrow keys also have a
74586 scrolling effect. The amount of log that is kept depends on the setting of
74587 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
74588 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
74589 much more efficient than throwing it away line by line. The sub-window also has
74590 a horizontal scroll bar for accessing the ends of long log lines. This is the
74591 only means of horizontal scrolling; the right and left arrow keys are not
74592 available. Text can be cut from this part of the window using the mouse in the
74593 normal way. The size of this subwindow is controlled by parameters in the
74594 configuration file <filename>Local/eximon.conf</filename>.
74595 </para>
74596 <para>
74597 Searches of the text in the log window can be carried out by means of the ^R
74598 and ^S keystrokes, which default to a reverse and a forward search,
74599 respectively. The search covers only the text that is displayed in the window.
74600 It cannot go further back up the log.
74601 </para>
74602 <para>
74603 The point from which the search starts is indicated by a caret marker. This is
74604 normally at the end of the text in the window, but can be positioned explicitly
74605 by pointing and clicking with the left mouse button, and is moved automatically
74606 by a successful search. If new text arrives in the window when it is scrolled
74607 back, the caret remains where it is, but if the window is not scrolled back,
74608 the caret is moved to the end of the new text.
74609 </para>
74610 <para>
74611 Pressing ^R or ^S pops up a window into which the search text can be typed.
74612 There are buttons for selecting forward or reverse searching, for carrying out
74613 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
74614 happens and the window remains so that further searches can be done. If the
74615 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
74616 ^C is typed the search is cancelled.
74617 </para>
74618 <para>
74619 The searching facility is implemented using the facilities of the Athena text
74620 widget. By default this pops up a window containing both <quote>search</quote> and
74621 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
74622 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
74623 However, the linkers in BSDI and HP-UX seem unable to handle an externally
74624 provided version of <option>TextPop</option> when the remaining parts of the text widget
74625 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
74626 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
74627 on these systems, at the expense of having unwanted items in the search popup
74628 window.
74629 </para>
74630 </section>
74631 <section id="SECID268">
74632 <title>The queue display</title>
74633 <para>
74634 <indexterm role="concept">
74635 <primary>queue</primary>
74636 <secondary>display in monitor</secondary>
74637 </indexterm>
74638 The bottom section of the monitor window contains a list of all messages that
74639 are in the queue, which includes those currently being received or delivered,
74640 as well as those awaiting delivery. The size of this subwindow is controlled by
74641 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
74642 at which it is updated is controlled by another parameter in the same file &ndash;
74643 the default is 5 minutes, since queue scans can be quite expensive. However,
74644 there is an <quote>Update</quote> action button just above the display which can be used
74645 to force an update of the queue display at any time.
74646 </para>
74647 <para>
74648 When a host is down for some time, a lot of pending mail can build up for it,
74649 and this can make it hard to deal with other messages in the queue. To help
74650 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
74651 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
74652 type anything in here and press <quote>Return</quote>, the text is added to a chain of
74653 such texts, and if every undelivered address in a message matches at least one
74654 of the texts, the message is not displayed.
74655 </para>
74656 <para>
74657 If there is an address that does not match any of the texts, all the addresses
74658 are displayed as normal. The matching happens on the ends of addresses so, for
74659 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
74660 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
74661 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
74662 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
74663 a hide request is automatically cancelled after one hour.
74664 </para>
74665 <para>
74666 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
74667 else to the monitor window. For this reason, if you want to cut text from the
74668 queue display to use in the dialogue box, you have to do the cutting before
74669 pressing the <quote>Hide</quote> button.
74670 </para>
74671 <para>
74672 The queue display contains, for each unhidden queued message, the length of
74673 time it has been in the queue, the size of the message, the message id, the
74674 message sender, and the first undelivered recipient, all on one line. If it is
74675 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
74676 recipient to which the message has not yet been delivered, subsequent ones are
74677 listed on additional lines, up to a maximum configured number, following which
74678 an ellipsis is displayed. Recipients that have already received the message are
74679 not shown.
74680 </para>
74681 <para>
74682 <indexterm role="concept">
74683 <primary>frozen messages</primary>
74684 <secondary>display</secondary>
74685 </indexterm>
74686 If a message is frozen, an asterisk is displayed at the left-hand side.
74687 </para>
74688 <para>
74689 The queue display has a vertical scroll bar, and can also be scrolled by means
74690 of the arrow keys. Text can be cut from it using the mouse in the normal way.
74691 The text searching facilities, as described above for the log window, are also
74692 available, but the caret is always moved to the end of the text when the queue
74693 display is updated.
74694 </para>
74695 </section>
74696 <section id="SECID269">
74697 <title>The queue menu</title>
74698 <para>
74699 <indexterm role="concept">
74700 <primary>queue</primary>
74701 <secondary>menu in monitor</secondary>
74702 </indexterm>
74703 If the <option>shift</option> key is held down and the left button is clicked when the mouse
74704 pointer is over the text for any message, an action menu pops up, and the first
74705 line of the queue display for the message is highlighted. This does not affect
74706 any selected text.
74707 </para>
74708 <para>
74709 If you want to use some other event for popping up the menu, you can set the
74710 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
74711 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
74712 value set in this parameter is a standard X event description. For example, to
74713 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
74714 </para>
74715 <literallayout class="monospaced">
74716 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
74717 </literallayout>
74718 <para>
74719 The title of the menu is the message id, and it contains entries which act as
74720 follows:
74721 </para>
74722 <itemizedlist>
74723 <listitem>
74724 <para>
74725 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
74726 in a new text window.
74727 </para>
74728 </listitem>
74729 <listitem>
74730 <para>
74731 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
74732 information and headers is displayed in a new text window. See chapter
74733 <xref linkend="CHAPspool"/> for a description of the format of spool files.
74734 </para>
74735 </listitem>
74736 <listitem>
74737 <para>
74738 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
74739 displayed in a new text window. There is a default limit of 20,000 bytes to the
74740 amount of data displayed. This can be changed by setting the BODY_MAX
74741 option at compile time, or the EXIMON_BODY_MAX option at runtime.
74742 </para>
74743 </listitem>
74744 <listitem>
74745 <para>
74746 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
74747 delivery of the message. This causes an automatic thaw if the message is
74748 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
74749 a new text window. The delivery is run in a separate process, to avoid holding
74750 up the monitor while the delivery proceeds.
74751 </para>
74752 </listitem>
74753 <listitem>
74754 <para>
74755 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
74756 that the message be frozen.
74757 </para>
74758 </listitem>
74759 <listitem>
74760 <para>
74761 <indexterm role="concept">
74762 <primary>thawing messages</primary>
74763 </indexterm>
74764 <indexterm role="concept">
74765 <primary>unfreezing messages</primary>
74766 </indexterm>
74767 <indexterm role="concept">
74768 <primary>frozen messages</primary>
74769 <secondary>thawing</secondary>
74770 </indexterm>
74771 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
74772 that the message be thawed.
74773 </para>
74774 </listitem>
74775 <listitem>
74776 <para>
74777 <indexterm role="concept">
74778 <primary>delivery</primary>
74779 <secondary>forcing failure</secondary>
74780 </indexterm>
74781 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
74782 that Exim gives up trying to deliver the message. A bounce message is generated
74783 for any remaining undelivered addresses.
74784 </para>
74785 </listitem>
74786 <listitem>
74787 <para>
74788 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
74789 that the message be deleted from the system without generating a bounce
74790 message.
74791 </para>
74792 </listitem>
74793 <listitem>
74794 <para>
74795 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
74796 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
74797 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
74798 Otherwise it must be entered as a fully qualified address. Pressing RETURN
74799 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
74800 additional recipient be added to the message, unless the entry box is empty, in
74801 which case no action is taken.
74802 </para>
74803 </listitem>
74804 <listitem>
74805 <para>
74806 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
74807 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
74808 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
74809 Otherwise it must be entered as a fully qualified address. Pressing RETURN
74810 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
74811 recipient address as already delivered, unless the entry box is empty, in which
74812 case no action is taken.
74813 </para>
74814 </listitem>
74815 <listitem>
74816 <para>
74817 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
74818 mark all recipient addresses as already delivered.
74819 </para>
74820 </listitem>
74821 <listitem>
74822 <para>
74823 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
74824 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
74825 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
74826 in which case no action is taken. If you want to set an empty sender (as in
74827 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
74828 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
74829 the address is qualified with that domain.
74830 </para>
74831 </listitem>
74832 </itemizedlist>
74833 <para>
74834 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
74835 other cases when a call to Exim is made, if there is any output from Exim (in
74836 particular, if the command fails) a window containing the command and the
74837 output is displayed. Otherwise, the results of the action are normally apparent
74838 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
74839 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
74840 if no output is generated.
74841 </para>
74842 <para>
74843 The queue display is automatically updated for actions such as freezing and
74844 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
74845 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
74846 force an update of the display after one of these actions.
74847 </para>
74848 <para>
74849 In any text window that is displayed as result of a menu action, the normal
74850 cut-and-paste facility is available, and searching can be carried out using ^R
74851 and ^S, as described above for the log tail window.
74852 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
74853 </para>
74854 </section>
74855 </chapter>
74856
74857 <chapter id="CHAPsecurity">
74858 <title>Security considerations</title>
74859 <para>
74860 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
74861 <primary>security</primary>
74862 <secondary>discussion of</secondary>
74863 </indexterm>
74864 This chapter discusses a number of issues concerned with security, some of
74865 which are also covered in other parts of this manual.
74866 </para>
74867 <para>
74868 For reasons that this author does not understand, some people have promoted
74869 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
74870 existence of this chapter in the documentation. However, the intent of the
74871 chapter is simply to describe the way Exim works in relation to certain
74872 security concerns, not to make any specific claims about the effectiveness of
74873 its security as compared with other MTAs.
74874 </para>
74875 <para>
74876 What follows is a description of the way Exim is supposed to be. Best efforts
74877 have been made to try to ensure that the code agrees with the theory, but an
74878 absence of bugs can never be guaranteed. Any that are reported will get fixed
74879 as soon as possible.
74880 </para>
74881 <section id="SECID286">
74882 <title>Building a more <quote>hardened</quote> Exim</title>
74883 <para>
74884 <indexterm role="concept">
74885 <primary>security</primary>
74886 <secondary>build-time features</secondary>
74887 </indexterm>
74888 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
74889 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
74890 Exim administrator who does not have the root password, or by someone who has
74891 penetrated the Exim (but not the root) account. These options are as follows:
74892 </para>
74893 <itemizedlist>
74894 <listitem>
74895 <para>
74896 ALT_CONFIG_PREFIX can be set to a string that is required to match the
74897 start of any filenames used with the <option>-C</option> option. When it is set, these
74898 filenames are also not allowed to contain the sequence <quote>/../</quote>. (However, if
74899 the value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
74900 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
74901 default setting for <option>ALT_CONFIG_PREFIX</option>.
74902 </para>
74903 <para>
74904 If the permitted configuration files are confined to a directory to
74905 which only root has access, this guards against someone who has broken
74906 into the Exim account from running a privileged Exim with an arbitrary
74907 configuration file, and using it to break into other accounts.
74908 </para>
74909 </listitem>
74910 <listitem>
74911 <para>
74912 If a non-trusted configuration file (i.e. not the default configuration file
74913 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
74914 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
74915 the next item), then root privilege is retained only if the caller of Exim is
74916 root. This locks out the possibility of testing a configuration using <option>-C</option>
74917 right through message reception and delivery, even if the caller is root. The
74918 reception works, but by that time, Exim is running as the Exim user, so when
74919 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
74920 privilege to be lost. However, root can test reception and delivery using two
74921 separate commands.
74922 </para>
74923 </listitem>
74924 <listitem>
74925 <para>
74926 The WHITELIST_D_MACROS build option declares some macros to be safe to override
74927 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
74928 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
74929 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
74930 the restrictive side.  Requiring build-time selection of safe macros is onerous
74931 but this option is intended solely as a transition mechanism to permit
74932 previously-working configurations to continue to work after release 4.73.
74933 </para>
74934 </listitem>
74935 <listitem>
74936 <para>
74937 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
74938 is disabled.
74939 </para>
74940 </listitem>
74941 <listitem>
74942 <para>
74943 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
74944 never to be used for any deliveries. This is like the <option>never_users</option> runtime
74945 option, but it cannot be overridden; the runtime option adds additional users
74946 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
74947 is permitted to modify the runtime file from using Exim as a way to get root.
74948 </para>
74949 </listitem>
74950 </itemizedlist>
74951 </section>
74952 <section id="SECID270">
74953 <title>Root privilege</title>
74954 <para>
74955 <indexterm role="concept">
74956 <primary>setuid</primary>
74957 </indexterm>
74958 <indexterm role="concept">
74959 <primary>root privilege</primary>
74960 </indexterm>
74961 The Exim binary is normally setuid to root, which means that it gains root
74962 privilege (runs as root) when it starts execution. In some special cases (for
74963 example, when the daemon is not in use and there are no local deliveries), it
74964 may be possible to run Exim setuid to some user other than root. This is
74965 discussed in the next section. However, in most installations, root privilege
74966 is required for two things:
74967 </para>
74968 <itemizedlist>
74969 <listitem>
74970 <para>
74971 To set up a socket connected to the standard SMTP port (25) when initialising
74972 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
74973 not required.
74974 </para>
74975 </listitem>
74976 <listitem>
74977 <para>
74978 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
74979 perform local deliveries as the receiving user or as specified in the
74980 configuration.
74981 </para>
74982 </listitem>
74983 </itemizedlist>
74984 <para>
74985 It is not necessary to be root to do any of the other things Exim does, such as
74986 receiving messages and delivering them externally over SMTP, and it is
74987 obviously more secure if Exim does not run as root except when necessary.
74988 For this reason, a user and group for Exim to use must be defined in
74989 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
74990 group</quote>. Their values can be changed by the runtime configuration, though this
74991 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
74992 <emphasis>mail</emphasis> or another user name altogether.
74993 </para>
74994 <para>
74995 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
74996 abdication; the process cannot regain root afterwards. Prior to release 4.00,
74997 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
74998 </para>
74999 <para>
75000 After a new Exim process has interpreted its command line options, it changes
75001 uid and gid in the following cases:
75002 </para>
75003 <itemizedlist>
75004 <listitem>
75005 <para>
75006 <indexterm role="option">
75007 <primary><option>-C</option></primary>
75008 </indexterm>
75009 <indexterm role="option">
75010 <primary><option>-D</option></primary>
75011 </indexterm>
75012 If the <option>-C</option> option is used to specify an alternate configuration file, or if
75013 the <option>-D</option> option is used to define macro values for the configuration, and the
75014 calling process is not running as root, the uid and gid are changed to those of
75015 the calling process.
75016 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
75017 option may not be used at all.
75018 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
75019 can be supplied if the calling process is running as root, the Exim run-time
75020 user or CONFIGURE_OWNER, if defined.
75021 </para>
75022 </listitem>
75023 <listitem>
75024 <para>
75025 <indexterm role="option">
75026 <primary><option>-be</option></primary>
75027 </indexterm>
75028 <indexterm role="option">
75029 <primary><option>-bf</option></primary>
75030 </indexterm>
75031 <indexterm role="option">
75032 <primary><option>-bF</option></primary>
75033 </indexterm>
75034 If the expansion test option (<option>-be</option>) or one of the filter testing options
75035 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
75036 calling process.
75037 </para>
75038 </listitem>
75039 <listitem>
75040 <para>
75041 If the process is not a daemon process or a queue runner process or a delivery
75042 process or a process for testing address routing (started with <option>-bt</option>), the
75043 uid and gid are changed to the Exim user and group. This means that Exim always
75044 runs under its own uid and gid when receiving messages. This also applies when
75045 testing address verification
75046 <indexterm role="option">
75047 <primary><option>-bv</option></primary>
75048 </indexterm>
75049 <indexterm role="option">
75050 <primary><option>-bh</option></primary>
75051 </indexterm>
75052 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
75053 option).
75054 </para>
75055 </listitem>
75056 <listitem>
75057 <para>
75058 For a daemon, queue runner, delivery, or address testing process, the uid
75059 remains as root at this stage, but the gid is changed to the Exim group.
75060 </para>
75061 </listitem>
75062 </itemizedlist>
75063 <para>
75064 The processes that initially retain root privilege behave as follows:
75065 </para>
75066 <itemizedlist>
75067 <listitem>
75068 <para>
75069 A daemon process changes the gid to the Exim group and the uid to the Exim
75070 user after setting up one or more listening sockets. The <function>initgroups()</function>
75071 function is called, so that if the Exim user is in any additional groups, they
75072 will be used during message reception.
75073 </para>
75074 </listitem>
75075 <listitem>
75076 <para>
75077 A queue runner process retains root privilege throughout its execution. Its
75078 job is to fork a controlled sequence of delivery processes.
75079 </para>
75080 </listitem>
75081 <listitem>
75082 <para>
75083 A delivery process retains root privilege throughout most of its execution,
75084 but any actual deliveries (that is, the transports themselves) are run in
75085 subprocesses which always change to a non-root uid and gid. For local
75086 deliveries this is typically the uid and gid of the owner of the mailbox; for
75087 remote deliveries, the Exim uid and gid are used. Once all the delivery
75088 subprocesses have been run, a delivery process changes to the Exim uid and gid
75089 while doing post-delivery tidying up such as updating the retry database and
75090 generating bounce and warning messages.
75091 </para>
75092 <para>
75093 While the recipient addresses in a message are being routed, the delivery
75094 process runs as root. However, if a user&#x2019;s filter file has to be processed,
75095 this is done in a subprocess that runs under the individual user&#x2019;s uid and
75096 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
75097 </para>
75098 </listitem>
75099 <listitem>
75100 <para>
75101 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
75102 the routing is done in the same environment as a message delivery.
75103 </para>
75104 </listitem>
75105 </itemizedlist>
75106 </section>
75107 <section id="SECTrunexiwitpri">
75108 <title>Running Exim without privilege</title>
75109 <para>
75110 <indexterm role="concept">
75111 <primary>privilege, running without</primary>
75112 </indexterm>
75113 <indexterm role="concept">
75114 <primary>unprivileged running</primary>
75115 </indexterm>
75116 <indexterm role="concept">
75117 <primary>root privilege</primary>
75118 <secondary>running without</secondary>
75119 </indexterm>
75120 Some installations like to run Exim in an unprivileged state for more of its
75121 operation, for added security. Support for this mode of operation is provided
75122 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
75123 gid are changed to the Exim user and group at the start of a delivery process
75124 (and also queue runner and address testing processes). This means that address
75125 routing is no longer run as root, and the deliveries themselves cannot change
75126 to any other uid.
75127 </para>
75128 <para>
75129 <indexterm role="concept">
75130 <primary>SIGHUP</primary>
75131 </indexterm>
75132 <indexterm role="concept">
75133 <primary>daemon</primary>
75134 <secondary>restarting</secondary>
75135 </indexterm>
75136 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
75137 that the daemon can still be started in the usual way, and it can respond
75138 correctly to SIGHUP because the re-invocation regains root privilege.
75139 </para>
75140 <para>
75141 An alternative approach is to make Exim setuid to the Exim user and also setgid
75142 to the Exim group. If you do this, the daemon must be started from a root
75143 process. (Calling Exim from a root process makes it behave in the way it does
75144 when it is setuid root.) However, the daemon cannot restart itself after a
75145 SIGHUP signal because it cannot regain privilege.
75146 </para>
75147 <para>
75148 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
75149 stops Exim from trying to re-invoke itself to do a delivery after a message has
75150 been received. Such a re-invocation is a waste of resources because it has no
75151 effect.
75152 </para>
75153 <para>
75154 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
75155 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
75156 to the Exim user seems a clean approach, but there is one complication:
75157 </para>
75158 <para>
75159 In this style of operation, Exim is running with the real uid and gid set to
75160 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
75161 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
75162 that is, the real uid/gid should be reset to the effective values so as to
75163 discard any privileges that the caller may have. While some operating systems
75164 have a function that permits this action for a non-root effective uid, quite a
75165 number of them do not. Because of this lack of standardization, Exim does not
75166 address this problem at this time.
75167 </para>
75168 <para>
75169 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
75170 is to keep the Exim binary setuid to root, and to set
75171 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
75172 be used in the most straightforward way.
75173 </para>
75174 <para>
75175 If you configure Exim not to run delivery processes as root, there are a
75176 number of restrictions on what you can do:
75177 </para>
75178 <itemizedlist>
75179 <listitem>
75180 <para>
75181 You can deliver only as the Exim user/group. You should  explicitly use the
75182 <option>user</option> and <option>group</option> options to override routers or local transports that
75183 normally deliver as the recipient. This makes sure that configurations that
75184 work in this mode function the same way in normal mode. Any implicit or
75185 explicit specification of another user causes an error.
75186 </para>
75187 </listitem>
75188 <listitem>
75189 <para>
75190 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
75191 not worthwhile to include them in the configuration.
75192 </para>
75193 </listitem>
75194 <listitem>
75195 <para>
75196 Users who wish to use <filename>.forward</filename> would have to make their home directory and
75197 the file itself accessible to the Exim user. Pipe and append-to-file entries,
75198 and their equivalents in Exim filters, cannot be used. While they could be
75199 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
75200 </para>
75201 </listitem>
75202 <listitem>
75203 <para>
75204 Unless the local user mailboxes are all owned by the Exim user (possible in
75205 some POP3 or IMAP-only environments):
75206 </para>
75207 <orderedlist numeration="arabic">
75208 <listitem>
75209 <para>
75210 They must be owned by the Exim group and be writeable by that group. This
75211 implies you must set <option>mode</option> in the appendfile configuration, as well as the
75212 mode of the mailbox files themselves.
75213 </para>
75214 </listitem>
75215 <listitem>
75216 <para>
75217 You must set <option>no_check_owner</option>, since most or all of the files will not be
75218 owned by the Exim user.
75219 </para>
75220 </listitem>
75221 <listitem>
75222 <para>
75223 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
75224 on a newly created mailbox when unprivileged. This also implies that new
75225 mailboxes need to be created manually.
75226 </para>
75227 </listitem>
75228 </orderedlist>
75229 </listitem>
75230 </itemizedlist>
75231 <para>
75232 These restrictions severely restrict what can be done in local deliveries.
75233 However, there are no restrictions on remote deliveries. If you are running a
75234 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
75235 gives more security at essentially no cost.
75236 </para>
75237 <para>
75238 If you are using the <option>mua_wrapper</option> facility (see chapter
75239 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
75240 </para>
75241 </section>
75242 <section id="SECID271">
75243 <title>Delivering to local files</title>
75244 <para>
75245 Full details of the checks applied by <command>appendfile</command> before it writes to a file
75246 are given in chapter <xref linkend="CHAPappendfile"/>.
75247 </para>
75248 </section>
75249 <section id="SECTsecconslocalcmds">
75250 <title>Running local commands</title>
75251 <para>
75252 <indexterm role="concept">
75253 <primary>security</primary>
75254 <secondary>local commands</secondary>
75255 </indexterm>
75256 <indexterm role="concept">
75257 <primary>security</primary>
75258 <secondary>command injection attacks</secondary>
75259 </indexterm>
75260 There are a number of ways in which an administrator can configure Exim to run
75261 commands based upon received, untrustworthy, data. Further, in some
75262 configurations a user who can control a <filename>.forward</filename> file can also arrange to
75263 run commands. Configuration to check includes, but is not limited to:
75264 </para>
75265 <itemizedlist>
75266 <listitem>
75267 <para>
75268 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
75269 injection may be possible with this option present. It is dangerous and should
75270 be used only with considerable caution. Consider constraints which whitelist
75271 allowed characters in a variable which is to be used in a pipe transport that
75272 has <option>use_shell</option> enabled.
75273 </para>
75274 </listitem>
75275 <listitem>
75276 <para>
75277 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
75278 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
75279 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
75280 hub to which ordinary users do not have shell access, but home directories are
75281 NFS mounted (for instance) then administrators should review the list of these
75282 forbid options available, and should bear in mind that the options that may
75283 need forbidding can change as new features are added between releases.
75284 </para>
75285 </listitem>
75286 <listitem>
75287 <para>
75288 The <option>${run...}</option> expansion item does not use a shell by default, but
75289 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
75290 Such invocations should be viewed with prejudicial suspicion.
75291 </para>
75292 </listitem>
75293 <listitem>
75294 <para>
75295 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
75296 taint checking might apply to their usage.
75297 </para>
75298 </listitem>
75299 <listitem>
75300 <para>
75301 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
75302 administrators are well advised to view its use with suspicion, in case (for
75303 instance) it allows a local-part to contain embedded Exim directives.
75304 </para>
75305 </listitem>
75306 <listitem>
75307 <para>
75308 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
75309 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
75310 each can reference arbitrary lists and files, rather than just being a list
75311 of opaque strings.
75312 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
75313 real-world security vulnerabilities caused by its use with untrustworthy data
75314 injected in, for SQL injection attacks.
75315 Consider the use of the <option>inlisti</option> expansion condition instead.
75316 </para>
75317 </listitem>
75318 </itemizedlist>
75319 </section>
75320 <section id="SECTsecconfdata">
75321 <title>Trust in configuration data</title>
75322 <para>
75323 <indexterm role="concept">
75324 <primary>security</primary>
75325 <secondary>data sources</secondary>
75326 </indexterm>
75327 <indexterm role="concept">
75328 <primary>security</primary>
75329 <secondary>regular expressions</secondary>
75330 </indexterm>
75331 <indexterm role="concept">
75332 <primary>regular expressions</primary>
75333 <secondary>security</secondary>
75334 </indexterm>
75335 <indexterm role="concept">
75336 <primary>PCRE2</primary>
75337 <secondary>security</secondary>
75338 </indexterm>
75339 If configuration data for Exim can come from untrustworthy sources, there
75340 are some issues to be aware of:
75341 </para>
75342 <itemizedlist>
75343 <listitem>
75344 <para>
75345 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
75346 </para>
75347 </listitem>
75348 <listitem>
75349 <para>
75350 Letting untrusted data provide a regular expression is unwise.
75351 </para>
75352 </listitem>
75353 <listitem>
75354 <para>
75355 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
75356 data may result in pathological behaviour within PCRE2.  Be aware of what
75357 "backtracking" means and consider options for being more strict with a regular
75358 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
75359 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
75360 possessive quantifiers or just not using regular expressions against untrusted
75361 data.
75362 </para>
75363 </listitem>
75364 <listitem>
75365 <para>
75366 It can be important to correctly use <option>${quote:...}</option>,
75367 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
75368 items to ensure that data is correctly constructed.
75369 </para>
75370 </listitem>
75371 <listitem>
75372 <para>
75373 Some lookups might return multiple results, even though normal usage is only
75374 expected to yield one result.
75375 </para>
75376 </listitem>
75377 </itemizedlist>
75378 </section>
75379 <section id="SECID272">
75380 <title>IPv4 source routing</title>
75381 <para>
75382 <indexterm role="concept">
75383 <primary>source routing</primary>
75384 <secondary>in IP packets</secondary>
75385 </indexterm>
75386 <indexterm role="concept">
75387 <primary>IP source routing</primary>
75388 </indexterm>
75389 Many operating systems suppress IP source-routed packets in the kernel, but
75390 some cannot be made to do this, so Exim does its own check. It logs incoming
75391 IPv4 source-routed TCP calls, and then drops them. Things are all different in
75392 IPv6. No special checking is currently done.
75393 </para>
75394 </section>
75395 <section id="SECID273">
75396 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
75397 <para>
75398 Support for these SMTP commands is disabled by default. If required, they can
75399 be enabled by defining suitable ACLs.
75400 </para>
75401 </section>
75402 <section id="SECID274">
75403 <title>Privileged users</title>
75404 <para>
75405 <indexterm role="concept">
75406 <primary>trusted users</primary>
75407 </indexterm>
75408 <indexterm role="concept">
75409 <primary>admin user</primary>
75410 </indexterm>
75411 <indexterm role="concept">
75412 <primary>privileged user</primary>
75413 </indexterm>
75414 <indexterm role="concept">
75415 <primary>user</primary>
75416 <secondary>trusted</secondary>
75417 </indexterm>
75418 <indexterm role="concept">
75419 <primary>user</primary>
75420 <secondary>admin</secondary>
75421 </indexterm>
75422 Exim recognizes two sets of users with special privileges. Trusted users are
75423 able to submit new messages to Exim locally, but supply their own sender
75424 addresses and information about a sending host. For other users submitting
75425 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
75426 permit a remote host to be specified.
75427 </para>
75428 <para>
75429 <indexterm role="option">
75430 <primary><option>-f</option></primary>
75431 </indexterm>
75432 However, an untrusted user is permitted to use the <option>-f</option> command line option
75433 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
75434 message should not cause an error report. This affects the message&#x2019;s envelope,
75435 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
75436 permitted to use specific forms of address with the <option>-f</option> option by setting
75437 the <option>untrusted_set_sender</option> option.
75438 </para>
75439 <para>
75440 Trusted users are used to run processes that receive mail messages from some
75441 other mail domain and pass them on to Exim for delivery either locally, or over
75442 the Internet. Exim trusts a caller that is running as root, as the Exim user,
75443 as any user listed in the <option>trusted_users</option> configuration option, or under any
75444 group listed in the <option>trusted_groups</option> option.
75445 </para>
75446 <para>
75447 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
75448 can freeze or thaw messages, cause them to be returned to their senders, remove
75449 them entirely, or modify them in various ways. In addition, admin users can run
75450 the Exim monitor and see all the information it is capable of providing, which
75451 includes the contents of files on the spool.
75452 </para>
75453 <para>
75454 <indexterm role="option">
75455 <primary><option>-M</option></primary>
75456 </indexterm>
75457 <indexterm role="option">
75458 <primary><option>-q</option></primary>
75459 </indexterm>
75460 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
75461 delivery of messages on its queue is restricted to admin users. This
75462 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
75463 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
75464 queue is also restricted to admin users. This restriction can be relaxed by
75465 setting <option>no_queue_list_requires_admin</option>.
75466 </para>
75467 <para>
75468 Exim recognizes an admin user if the calling process is running as root or as
75469 the Exim user or if any of the groups associated with the calling process is
75470 the Exim group. It is not necessary actually to be running under the Exim
75471 group. However, if admin users who are not root or the Exim user are to access
75472 the contents of files on the spool via the Exim monitor (which runs
75473 unprivileged), Exim must be built to allow group read access to its spool
75474 files.
75475 </para>
75476 <para>
75477 By default, regular users are trusted to perform basic testing and
75478 introspection commands, as themselves.  This setting can be tightened by
75479 setting the <option>commandline_checks_require_admin</option> option.
75480 This affects most of the checking options,
75481 such as <option>-be</option> and anything else <option>-b*</option>.
75482 </para>
75483 </section>
75484 <section id="SECID275">
75485 <title>Spool files</title>
75486 <para>
75487 <indexterm role="concept">
75488 <primary>spool directory</primary>
75489 <secondary>files</secondary>
75490 </indexterm>
75491 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
75492 set to the Exim group. The mode for spool files is defined in the
75493 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
75494 any user who is a member of the Exim group can access these files.
75495 </para>
75496 </section>
75497 <section id="SECID276">
75498 <title>Use of argv[0]</title>
75499 <para>
75500 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
75501 of specific strings, Exim assumes certain options. For example, calling Exim
75502 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
75503 to calling it with the option <option>-bS</option>. There are no security implications in
75504 this.
75505 </para>
75506 </section>
75507 <section id="SECID277">
75508 <title>Use of %f formatting</title>
75509 <para>
75510 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
75511 are actually stored in integer variables as 1000 times the load average.
75512 Consequently, their range is limited and so therefore is the length of the
75513 converted output.
75514 </para>
75515 </section>
75516 <section id="SECID278">
75517 <title>Embedded Exim path</title>
75518 <para>
75519 Exim uses its own path name, which is embedded in the code, only when it needs
75520 to re-exec in order to regain root privilege. Therefore, it is not root when it
75521 does so. If some bug allowed the path to get overwritten, it would lead to an
75522 arbitrary program&#x2019;s being run as exim, not as root.
75523 </para>
75524 </section>
75525 <section id="SECTdynmoddir">
75526 <title>Dynamic module directory</title>
75527 <para>
75528 Any dynamically loadable modules must be installed into the directory
75529 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
75530 loading it.
75531 </para>
75532 </section>
75533 <section id="SECID279">
75534 <title>Use of sprintf()</title>
75535 <para>
75536 <indexterm role="concept">
75537 <primary><function>sprintf()</function></primary>
75538 </indexterm>
75539 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
75540 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
75541 The intermediate formatting is done into a large fixed buffer by a function
75542 that runs through the format string itself, and checks the length of each
75543 conversion before performing it, thus preventing buffer overruns.
75544 </para>
75545 <para>
75546 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
75547 the output buffer is known to be sufficiently long to contain the converted
75548 string.
75549 </para>
75550 </section>
75551 <section id="SECID280">
75552 <title>Use of debug_printf() and log_write()</title>
75553 <para>
75554 Arbitrary strings are passed to both these functions, but they do their
75555 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
75556 the format string itself, and checks the length of each conversion.
75557 </para>
75558 </section>
75559 <section id="SECID281">
75560 <title>Use of strcat() and strcpy()</title>
75561 <para>
75562 These are used only in cases where the output buffer is known to be large
75563 enough to hold the result.
75564 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
75565 </para>
75566 </section>
75567 </chapter>
75568
75569 <chapter id="CHAPspool">
75570 <title>Format of spool files</title>
75571 <para>
75572 <indexterm role="concept" id="IIDforspo1" class="startofrange">
75573 <primary>format</primary>
75574 <secondary>spool files</secondary>
75575 </indexterm>
75576 <indexterm role="concept" id="IIDforspo2" class="startofrange">
75577 <primary>spool directory</primary>
75578 <secondary>format of files</secondary>
75579 </indexterm>
75580 <indexterm role="concept" id="IIDforspo3" class="startofrange">
75581 <primary>spool files</primary>
75582 <secondary>format of</secondary>
75583 </indexterm>
75584 <indexterm role="concept">
75585 <primary>spool files</primary>
75586 <secondary>editing</secondary>
75587 </indexterm>
75588 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
75589 followed by -D and -H, respectively. The data portion of the message is kept in
75590 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
75591 kept in the -H file, whose format is described in this chapter. Each of these
75592 two files contains the final component of its own name as its first line. This
75593 is insurance against disk crashes where the directory is lost but the files
75594 themselves are recoverable.
75595 </para>
75596 <para>
75597 The file formats may be changed, or new formats added, at any release.
75598 Spool files are not intended as an interface to other programs
75599 and should not be used as such.
75600 </para>
75601 <para>
75602 Some people are tempted into editing -D files in order to modify messages. You
75603 need to be extremely careful if you do this; it is not recommended and you are
75604 on your own if you do it. Here are some of the pitfalls:
75605 </para>
75606 <itemizedlist>
75607 <listitem>
75608 <para>
75609 You must ensure that Exim does not try to deliver the message while you are
75610 fiddling with it. The safest way is to take out a write lock on the -D file,
75611 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
75612 place, the lock will be retained. If you write a new file and rename it, the
75613 lock will be lost at the instant of rename.
75614 </para>
75615 </listitem>
75616 <listitem>
75617 <para>
75618 <indexterm role="variable">
75619 <primary><varname>$body_linecount</varname></primary>
75620 </indexterm>
75621 If you change the number of lines in the file, the value of
75622 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
75623 cause incomplete transmission of messages or undeliverable messages.
75624 </para>
75625 </listitem>
75626 <listitem>
75627 <para>
75628 If the message is in MIME format, you must take care not to break it.
75629 </para>
75630 </listitem>
75631 <listitem>
75632 <para>
75633 If the message is cryptographically signed, any change will invalidate the
75634 signature.
75635 </para>
75636 </listitem>
75637 </itemizedlist>
75638 <para>
75639 All in all, modifying -D files is fraught with danger.
75640 </para>
75641 <para>
75642 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
75643 its subdirectories when <option>split_spool_directory</option> is set). These are journal
75644 files, used to record addresses to which the message has been delivered during
75645 the course of a delivery attempt. If there are still undelivered recipients at
75646 the end, the -H file is updated, and the -J file is deleted. If, however, there
75647 is some kind of crash (for example, a power outage) before this happens, the -J
75648 file remains in existence. When Exim next processes the message, it notices the
75649 -J file and uses it to update the -H file before starting the next delivery
75650 attempt.
75651 </para>
75652 <para>
75653 Files whose names end with -K or .eml may also be seen in the spool.
75654 These are temporaries used for DKIM or malware processing, when that is used.
75655 They should be tidied up by normal operations; any old ones are probably
75656 relics of crashes and can be removed.
75657 </para>
75658 <section id="SECID282">
75659 <title>Format of the -H file</title>
75660 <para>
75661 <indexterm role="concept">
75662 <primary>uid (user id)</primary>
75663 <secondary>in spool file</secondary>
75664 </indexterm>
75665 <indexterm role="concept">
75666 <primary>gid (group id)</primary>
75667 <secondary>in spool file</secondary>
75668 </indexterm>
75669 The second line of the -H file contains the login name for the uid of the
75670 process that called Exim to read the message, followed by the numerical uid and
75671 gid. For a locally generated message, this is normally the user who sent the
75672 message. For a message received over TCP/IP via the daemon, it is
75673 normally the Exim user.
75674 </para>
75675 <para>
75676 The third line of the file contains the address of the message&#x2019;s sender as
75677 transmitted in the envelope, contained in angle brackets. The sender address is
75678 empty for bounce messages. For incoming SMTP mail, the sender address is given
75679 in the MAIL command. For locally generated mail, the sender address is
75680 created by Exim from the login name of the current user and the configured
75681 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
75682 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
75683 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
75684 </para>
75685 <para>
75686 The fourth line contains two numbers. The first is the time that the message
75687 was received, in the conventional Unix form &ndash; the number of seconds since the
75688 start of the epoch. The second number is a count of the number of messages
75689 warning of delayed delivery that have been sent to the sender.
75690 </para>
75691 <para>
75692 There follow a number of lines starting with a hyphen.
75693 These contain variables, can appear in any
75694 order, and are omitted when not relevant.
75695 </para>
75696 <para>
75697 If there is a second hyphen after the first,
75698 the corresponding data is tainted.
75699 If there is a value in parentheses, the data is quoted for a lookup.
75700 </para>
75701 <para>
75702 The following word specifies a variable,
75703 and the remainder of the item depends on the variable.
75704 </para>
75705 <variablelist>
75706 <varlistentry>
75707 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
75708 <listitem>
75709 <para>
75710 This item is obsolete, and is not generated from Exim release 4.61 onwards;
75711 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
75712 recognized, to provide backward compatibility. In the old format, a line of
75713 this form is present for every ACL variable that is not empty. The number
75714 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
75715 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
75716 the data string for the variable. The string itself starts at the beginning of
75717 the next line, and is followed by a newline character. It may contain internal
75718 newlines.
75719 </para>
75720 </listitem></varlistentry>
75721 <varlistentry>
75722 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
75723 <listitem>
75724 <para>
75725 A line of this form is present for every ACL connection variable that is
75726 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
75727 The length is the length of the data string for the variable. The string itself
75728 starts at the beginning of the next line, and is followed by a newline
75729 character. It may contain internal newlines.
75730 </para>
75731 </listitem></varlistentry>
75732 <varlistentry>
75733 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
75734 <listitem>
75735 <para>
75736 A line of this form is present for every ACL message variable that is defined.
75737 Note that there is a space between <option>-aclm</option> and the rest of the name. The
75738 length is the length of the data string for the variable. The string itself
75739 starts at the beginning of the next line, and is followed by a newline
75740 character. It may contain internal newlines.
75741 </para>
75742 </listitem></varlistentry>
75743 <varlistentry>
75744 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
75745 <listitem>
75746 <para>
75747 This is present if, when the message was received over SMTP, the value of
75748 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
75749 </para>
75750 </listitem></varlistentry>
75751 <varlistentry>
75752 <term><option>-allow_unqualified_recipient</option></term>
75753 <listitem>
75754 <para>
75755 This is present if unqualified recipient addresses are permitted in header
75756 lines (to stop such addresses from being qualified if rewriting occurs at
75757 transport time). Local messages that were input using <option>-bnq</option> and remote
75758 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
75759 </para>
75760 </listitem></varlistentry>
75761 <varlistentry>
75762 <term><option>-allow_unqualified_sender</option></term>
75763 <listitem>
75764 <para>
75765 This is present if unqualified sender addresses are permitted in header lines
75766 (to stop such addresses from being qualified if rewriting occurs at transport
75767 time). Local messages that were input using <option>-bnq</option> and remote messages from
75768 hosts that match <option>sender_unqualified_hosts</option> set this flag.
75769 </para>
75770 </listitem></varlistentry>
75771 <varlistentry>
75772 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75773 <listitem>
75774 <para>
75775 The id information for a message received on an authenticated SMTP connection
75776 &ndash; the value of the <varname>$authenticated_id</varname> variable.
75777 </para>
75778 </listitem></varlistentry>
75779 <varlistentry>
75780 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
75781 <listitem>
75782 <para>
75783 The address of an authenticated sender &ndash; the value of the
75784 <varname>$authenticated_sender</varname> variable.
75785 </para>
75786 </listitem></varlistentry>
75787 <varlistentry>
75788 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
75789 <listitem>
75790 <para>
75791 This records the number of lines in the body of the message, and is
75792 present unless <option>-spool_file_wireformat</option> is.
75793 </para>
75794 </listitem></varlistentry>
75795 <varlistentry>
75796 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
75797 <listitem>
75798 <para>
75799 This records the number of binary zero bytes in the body of the message, and is
75800 present if the number is greater than zero.
75801 </para>
75802 </listitem></varlistentry>
75803 <varlistentry>
75804 <term><option>-deliver_firsttime</option></term>
75805 <listitem>
75806 <para>
75807 This is written when a new message is first added to the spool. When the spool
75808 file is updated after a deferral, it is omitted.
75809 </para>
75810 </listitem></varlistentry>
75811 <varlistentry>
75812 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
75813 <listitem>
75814 <para>
75815 <indexterm role="concept">
75816 <primary>frozen messages</primary>
75817 <secondary>spool data</secondary>
75818 </indexterm>
75819 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
75820 </para>
75821 </listitem></varlistentry>
75822 <varlistentry>
75823 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75824 <listitem>
75825 <para>
75826 This records the host name as specified by a remote host in a HELO or EHLO
75827 command.
75828 </para>
75829 </listitem></varlistentry>
75830 <varlistentry>
75831 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
75832 <listitem>
75833 <para>
75834 This records the IP address of the host from which the message was received and
75835 the remote port number that was used. It is omitted for locally generated
75836 messages.
75837 </para>
75838 </listitem></varlistentry>
75839 <varlistentry>
75840 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75841 <listitem>
75842 <para>
75843 If the message was received on an authenticated SMTP connection, this records
75844 the name of the authenticator &ndash; the value of the
75845 <varname>$sender_host_authenticated</varname> variable.
75846 </para>
75847 </listitem></varlistentry>
75848 <varlistentry>
75849 <term><option>-host_lookup_failed</option></term>
75850 <listitem>
75851 <para>
75852 This is present if an attempt to look up the sending host&#x2019;s name from its IP
75853 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
75854 </para>
75855 </listitem></varlistentry>
75856 <varlistentry>
75857 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75858 <listitem>
75859 <para>
75860 <indexterm role="concept">
75861 <primary>reverse DNS lookup</primary>
75862 </indexterm>
75863 <indexterm role="concept">
75864 <primary>DNS</primary>
75865 <secondary>reverse lookup</secondary>
75866 </indexterm>
75867 This records the name of the remote host from which the message was received,
75868 if the host name was looked up from the IP address when the message was being
75869 received. It is not present if no reverse lookup was done.
75870 </para>
75871 </listitem></varlistentry>
75872 <varlistentry>
75873 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75874 <listitem>
75875 <para>
75876 For locally submitted messages, this records the login of the originating user,
75877 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
75878 ident value. For messages received over TCP/IP, this records the ident string
75879 supplied by the remote host, if any.
75880 </para>
75881 </listitem></varlistentry>
75882 <varlistentry>
75883 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
75884 <listitem>
75885 <para>
75886 This records the IP address of the local interface and the port number through
75887 which a message was received from a remote host. It is omitted for locally
75888 generated messages.
75889 </para>
75890 </listitem></varlistentry>
75891 <varlistentry>
75892 <term><option>-local</option></term>
75893 <listitem>
75894 <para>
75895 The message is from a local sender.
75896 </para>
75897 </listitem></varlistentry>
75898 <varlistentry>
75899 <term><option>-localerror</option></term>
75900 <listitem>
75901 <para>
75902 The message is a locally-generated bounce message.
75903 </para>
75904 </listitem></varlistentry>
75905 <varlistentry>
75906 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
75907 <listitem>
75908 <para>
75909 This records the data string that was returned by the <function>local_scan()</function> function
75910 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
75911 variable. It is omitted if no data was returned.
75912 </para>
75913 </listitem></varlistentry>
75914 <varlistentry>
75915 <term><option>-manual_thaw</option></term>
75916 <listitem>
75917 <para>
75918 The message was frozen but has been thawed manually, that is, by an explicit
75919 Exim command rather than via the auto-thaw process.
75920 </para>
75921 </listitem></varlistentry>
75922 <varlistentry>
75923 <term><option>-N</option></term>
75924 <listitem>
75925 <para>
75926 A testing delivery process was started using the <option>-N</option> option to suppress any
75927 actual deliveries, but delivery was deferred. At any further delivery attempts,
75928 <option>-N</option> is assumed.
75929 </para>
75930 </listitem></varlistentry>
75931 <varlistentry>
75932 <term><option>-received_protocol</option></term>
75933 <listitem>
75934 <para>
75935 This records the value of the <varname>$received_protocol</varname> variable, which contains
75936 the name of the protocol by which the message was received.
75937 </para>
75938 </listitem></varlistentry>
75939 <varlistentry>
75940 <term><option>-sender_set_untrusted</option></term>
75941 <listitem>
75942 <para>
75943 The envelope sender of this message was set by an untrusted local caller (used
75944 to ensure that the caller is displayed in queue listings).
75945 </para>
75946 </listitem></varlistentry>
75947 <varlistentry>
75948 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
75949 <listitem>
75950 <para>
75951 If a message was scanned by SpamAssassin, this is present. It records the value
75952 of <varname>$spam_score_int</varname>.
75953 </para>
75954 </listitem></varlistentry>
75955 <varlistentry>
75956 <term><option>-spool_file_wireformat</option></term>
75957 <listitem>
75958 <para>
75959 The -D file for this message is in wire-format (for ESMTP CHUNKING)
75960 rather than Unix-format.
75961 The line-ending is CRLF rather than newline.
75962 There is still, however, no leading-dot-stuffing.
75963 </para>
75964 </listitem></varlistentry>
75965 <varlistentry>
75966 <term><option>-tls_certificate_verified</option></term>
75967 <listitem>
75968 <para>
75969 A TLS certificate was received from the client that sent this message, and the
75970 certificate was verified by the server.
75971 </para>
75972 </listitem></varlistentry>
75973 <varlistentry>
75974 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
75975 <listitem>
75976 <para>
75977 When the message was received over an encrypted connection, this records the
75978 name of the cipher suite that was used.
75979 </para>
75980 </listitem></varlistentry>
75981 <varlistentry>
75982 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
75983 <listitem>
75984 <para>
75985 When the message was received over an encrypted connection, and a certificate
75986 was received from the client, this records the Distinguished Name from that
75987 certificate.
75988 </para>
75989 </listitem></varlistentry>
75990 </variablelist>
75991 <para>
75992 Following the options there is a list of those addresses to which the message
75993 is not to be delivered. This set of addresses is initialized from the command
75994 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
75995 is set; otherwise it starts out empty. Whenever a successful delivery is made,
75996 the address is added to this set. The addresses are kept internally as a
75997 balanced binary tree, and it is a representation of that tree which is written
75998 to the spool file. If an address is expanded via an alias or forward file, the
75999 original address is added to the tree when deliveries to all its child
76000 addresses are complete.
76001 </para>
76002 <para>
76003 If the tree is empty, there is a single line in the spool file containing just
76004 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
76005 Y or N, followed by an address. The address is the value for the node of the
76006 tree, and the letters indicate whether the node has a left branch and/or a
76007 right branch attached to it, respectively. If branches exist, they immediately
76008 follow. Here is an example of a three-node tree:
76009 </para>
76010 <literallayout class="monospaced">
76011 YY darcy@austen.fict.example
76012 NN alice@wonderland.fict.example
76013 NN editor@thesaurus.ref.example
76014 </literallayout>
76015 <para>
76016 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
76017 This is a simple list, preceded by a count. It includes all the original
76018 recipients of the message, including those to whom the message has already been
76019 delivered. In the simplest case, the list contains one address per line. For
76020 example:
76021 </para>
76022 <literallayout class="monospaced">
76023 4
76024 editor@thesaurus.ref.example
76025 darcy@austen.fict.example
76026 rdo@foundation
76027 alice@wonderland.fict.example
76028 </literallayout>
76029 <para>
76030 However, when a child address has been added to the top-level addresses as a
76031 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
76032 line is of the following form:
76033 </para>
76034 <literallayout>
76035 &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;
76036 </literallayout>
76037 <para>
76038 The 01 flag bit indicates the presence of the three other fields that follow
76039 the top-level address. Other bits may be used in future to support additional
76040 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
76041 original parent of the <quote>one time</quote> address. The first two fields are the
76042 envelope sender that is associated with this address and its length. If the
76043 length is zero, there is no special envelope sender (there are then two space
76044 characters in the line). A non-empty field can arise from a <command>redirect</command> router
76045 that has an <option>errors_to</option> setting.
76046 </para>
76047 <para>
76048 A blank line separates the envelope and status information from the headers
76049 which follow. A header may occupy several lines of the file, and to save effort
76050 when reading it in, each header is preceded by a number and an identifying
76051 character. The number is the number of characters in the header, including any
76052 embedded newlines and the terminating newline. The character is one of the
76053 following:
76054 </para>
76055 <informaltable frame="none">
76056 <tgroup cols="2" colsep="0" rowsep="0">
76057 <colspec colwidth="50pt" align="left"/>
76058 <colspec colwidth="254pt" align="left"/>
76059 <tbody>
76060 <row>
76061 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
76062 <entry>header in which Exim has no special interest</entry>
76063 </row>
76064 <row>
76065 <entry><literal>B</literal></entry>
76066 <entry><emphasis>Bcc:</emphasis> header</entry>
76067 </row>
76068 <row>
76069 <entry><literal>C</literal></entry>
76070 <entry><emphasis>Cc:</emphasis> header</entry>
76071 </row>
76072 <row>
76073 <entry><literal>F</literal></entry>
76074 <entry><emphasis>From:</emphasis> header</entry>
76075 </row>
76076 <row>
76077 <entry><literal>I</literal></entry>
76078 <entry><emphasis>Message-id:</emphasis> header</entry>
76079 </row>
76080 <row>
76081 <entry><literal>P</literal></entry>
76082 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
76083 </row>
76084 <row>
76085 <entry><literal>R</literal></entry>
76086 <entry><emphasis>Reply-To:</emphasis> header</entry>
76087 </row>
76088 <row>
76089 <entry><literal>S</literal></entry>
76090 <entry><emphasis>Sender:</emphasis> header</entry>
76091 </row>
76092 <row>
76093 <entry><literal>T</literal></entry>
76094 <entry><emphasis>To:</emphasis> header</entry>
76095 </row>
76096 <row>
76097 <entry><literal>*</literal></entry>
76098 <entry>replaced or deleted header</entry>
76099 </row>
76100 </tbody>
76101 </tgroup>
76102 </informaltable>
76103 <para>
76104 Deleted or replaced (rewritten) headers remain in the spool file for debugging
76105 purposes. They are not transmitted when the message is delivered. Here is a
76106 typical set of headers:
76107 </para>
76108 <literallayout class="monospaced">
76109 111P Received: by hobbit.fict.example with local (Exim 4.00)
76110 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
76111 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
76112 038* X-rewrote-sender: bb@hobbit.fict.example
76113 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
76114 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
76115 099* To: alice@wonderland.fict.example, rdo@foundation,
76116 darcy@austen.fict.example, editor@thesaurus.ref.example
76117 104T To: alice@wonderland.fict.example, rdo@foundation.example,
76118 darcy@austen.fict.example, editor@thesaurus.ref.example
76119 038  Date: Fri, 11 May 2001 10:28:59 +0100
76120 </literallayout>
76121 <para>
76122 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
76123 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
76124 unqualified domain <emphasis>foundation</emphasis>.
76125 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
76126 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
76127 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
76128 </para>
76129 </section>
76130 <section id="SECID282a">
76131 <title>Format of the -D file</title>
76132 <para>
76133 The data file is traditionally in Unix-standard format: lines are ended with
76134 an ASCII newline character.
76135 However, when the <option>spool_wireformat</option> main option is used some -D files
76136 can have an alternate format.
76137 This is flagged by a <option>-spool_file_wireformat</option> line in the corresponding -H file.
76138 The -D file lines (not including the first name-component line) are
76139 suitable for direct copying to the wire when transmitting using the
76140 ESMTP CHUNKING option, meaning lower processing overhead.
76141 Lines are terminated with an ASCII CRLF pair.
76142 There is no dot-stuffing (and no dot-termination).
76143 </para>
76144 </section>
76145 </chapter>
76146
76147 <chapter id="CHAPdkim">
76148 <title>DKIM, SPF, SRS and DMARC</title>
76149 <titleabbrev>DKIM, SPF, SRS and DMARC Support</titleabbrev>
76150 <section id="SECDKIM">
76151 <title>DKIM (DomainKeys Identified Mail)</title>
76152 <para>
76153 <indexterm role="concept">
76154 <primary>DKIM</primary>
76155 </indexterm>
76156 </para>
76157 <para>
76158 DKIM is a mechanism by which messages sent by some entity can be provably
76159 linked to a domain which that entity controls.  It permits reputation to
76160 be tracked on a per-domain basis, rather than merely upon source IP address.
76161 DKIM is documented in RFC 6376.
76162 </para>
76163 <para>
76164 As DKIM relies on the message being unchanged in transit, messages handled
76165 by a mailing-list (which traditionally adds to the message) will not match
76166 any original DKIM signature.
76167 </para>
76168 <para>
76169 DKIM support is compiled into Exim by default if TLS support is present.
76170 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
76171 </para>
76172 <para>
76173 Exim&#x2019;s DKIM implementation allows for
76174 </para>
76175 <orderedlist numeration="arabic">
76176 <listitem>
76177 <para>
76178 Signing outgoing messages: This function is implemented in the SMTP transport.
76179 It can co-exist with all other Exim features
76180 (including transport filters)
76181 except cutthrough delivery.
76182 </para>
76183 </listitem>
76184 <listitem>
76185 <para>
76186 Verifying signatures in incoming messages: This is implemented by an additional
76187 ACL (acl_smtp_dkim), which can be called several times per message, with
76188 different signature contexts.
76189 </para>
76190 </listitem>
76191 </orderedlist>
76192 <para>
76193 In typical Exim style, the verification implementation does not include any
76194 default "policy". Instead it enables you to build your own policy using
76195 Exim&#x2019;s standard controls.
76196 </para>
76197 <para>
76198 Please note that verification of DKIM signatures in incoming mail is turned
76199 on by default for logging (in the &lt;= line) purposes.
76200 </para>
76201 <para>
76202 Additional log detail can be enabled using the <option>dkim_verbose</option> log_selector.
76203 When set, for each signature in incoming email,
76204 exim will log a line displaying the most important signature details, and the
76205 signature status. Here is an example (with line-breaks added for clarity):
76206 </para>
76207 <literallayout class="monospaced">
76208 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
76209     d=facebookmail.com s=q1-2009b
76210     c=relaxed/relaxed a=rsa-sha1
76211     i=@facebookmail.com t=1252484542 [verification succeeded]
76212 </literallayout>
76213 <para>
76214 You might want to turn off DKIM verification processing entirely for internal
76215 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
76216 control modifier. This should typically be done in the RCPT ACL, at points
76217 where you accept mail from relay sources (internal hosts or authenticated
76218 senders).
76219 </para>
76220 <section id="SECDKIMSIGN">
76221 <title>Signing outgoing messages</title>
76222 <para>
76223 <indexterm role="concept">
76224 <primary>DKIM</primary>
76225 <secondary>signing</secondary>
76226 </indexterm>
76227 </para>
76228 <para>
76229 For signing to be usable you must have published a DKIM record in DNS.
76230 Note that RFC 8301 (which does not cover EC keys) says:
76231 </para>
76232 <literallayout class="monospaced">
76233 rsa-sha1 MUST NOT be used for signing or verifying.
76234
76235 Signers MUST use RSA keys of at least 1024 bits for all keys.
76236 Signers SHOULD use RSA keys of at least 2048 bits.
76237 </literallayout>
76238 <para>
76239 Note also that the key content (the &#x2019;p=&#x2019; field)
76240 in the DNS record is different between RSA and EC keys;
76241 for the former it is the base64 of the ASN.1 for the RSA public key
76242 (equivalent to the private-key .pem with the header/trailer stripped)
76243 but for EC keys it is the base64 of the pure key; no ASN.1 wrapping.
76244 </para>
76245 <para>
76246 Signing is enabled by setting private options on the SMTP transport.
76247 These options take (expandable) strings as arguments.
76248 </para>
76249 <para>
76250 <indexterm role="option">
76251 <primary><option>dkim_domain</option></primary>
76252 </indexterm>
76253 </para>
76254 <informaltable frame="all">
76255 <tgroup cols="4" colsep="0" rowsep="0">
76256 <colspec colwidth="8*" align="left"/>
76257 <colspec colwidth="6*" align="center"/>
76258 <colspec colwidth="6*" align="center"/>
76259 <colspec colwidth="6*" align="right"/>
76260 <tbody>
76261 <row>
76262 <entry><option>dkim_domain</option></entry>
76263 <entry>Use: <emphasis>smtp</emphasis></entry>
76264 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
76265 <entry>Default: <emphasis>unset</emphasis></entry>
76266 </row>
76267 </tbody>
76268 </tgroup>
76269 </informaltable>
76270 <para>
76271 The domain(s) you want to sign with.
76272 After expansion, this can be a list.
76273 Each element in turn,
76274 lowercased,
76275 <indexterm role="variable">
76276 <primary><varname>$dkim_domain</varname></primary>
76277 </indexterm>
76278 is put into the <option>$dkim_domain</option> expansion variable
76279 while expanding the remaining signing options.
76280 If it is empty after expansion, DKIM signing is not done,
76281 and no error will result even if <option>dkim_strict</option> is set.
76282 </para>
76283 <para>
76284 <indexterm role="option">
76285 <primary><option>dkim_selector</option></primary>
76286 </indexterm>
76287 </para>
76288 <informaltable frame="all">
76289 <tgroup cols="4" colsep="0" rowsep="0">
76290 <colspec colwidth="8*" align="left"/>
76291 <colspec colwidth="6*" align="center"/>
76292 <colspec colwidth="6*" align="center"/>
76293 <colspec colwidth="6*" align="right"/>
76294 <tbody>
76295 <row>
76296 <entry><option>dkim_selector</option></entry>
76297 <entry>Use: <emphasis>smtp</emphasis></entry>
76298 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
76299 <entry>Default: <emphasis>unset</emphasis></entry>
76300 </row>
76301 </tbody>
76302 </tgroup>
76303 </informaltable>
76304 <para>
76305 This sets the key selector string.
76306 After expansion, which can use <varname>$dkim_domain</varname>, this can be a list.
76307 Each element in turn is put in the expansion
76308 <indexterm role="variable">
76309 <primary><varname>$dkim_selector</varname></primary>
76310 </indexterm>
76311 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
76312 option along with <option>$dkim_domain</option>.
76313 If the option is empty after expansion, DKIM signing is not done for this domain,
76314 and no error will result even if <option>dkim_strict</option> is set.
76315 </para>
76316 <para>
76317 To do, for example, dual-signing with RSA and EC keys
76318 this could be be used:
76319 </para>
76320 <literallayout class="monospaced">
76321 dkim_selector = ec_sel : rsa_sel
76322 dkim_private_key = KEYS_DIR/$dkim_selector
76323 </literallayout>
76324 <para>
76325 <indexterm role="option">
76326 <primary><option>dkim_private_key</option></primary>
76327 </indexterm>
76328 </para>
76329 <informaltable frame="all">
76330 <tgroup cols="4" colsep="0" rowsep="0">
76331 <colspec colwidth="8*" align="left"/>
76332 <colspec colwidth="6*" align="center"/>
76333 <colspec colwidth="6*" align="center"/>
76334 <colspec colwidth="6*" align="right"/>
76335 <tbody>
76336 <row>
76337 <entry><option>dkim_private_key</option></entry>
76338 <entry>Use: <emphasis>smtp</emphasis></entry>
76339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76340 <entry>Default: <emphasis>unset</emphasis></entry>
76341 </row>
76342 </tbody>
76343 </tgroup>
76344 </informaltable>
76345 <para>
76346 This sets the private key to use.
76347 You can use the <option>$dkim_domain</option> and
76348 <option>$dkim_selector</option> expansion variables to determine the private key to use.
76349 The result can either
76350 </para>
76351 <itemizedlist>
76352 <listitem>
76353 <para>
76354 be a valid RSA private key in ASCII armor (.pem file), including line breaks
76355 </para>
76356 </listitem>
76357 <listitem>
76358 <para>
76359 with GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
76360 be a valid Ed25519 private key (same format as above)
76361 </para>
76362 </listitem>
76363 <listitem>
76364 <para>
76365 start with a slash, in which case it is treated as a file that contains
76366 the private key
76367 </para>
76368 </listitem>
76369 <listitem>
76370 <para>
76371 be "0", "false" or the empty string, in which case the message will not
76372 be signed. This case will not result in an error, even if <option>dkim_strict</option>
76373 is set.
76374 </para>
76375 </listitem>
76376 </itemizedlist>
76377 <para>
76378 To generate keys under OpenSSL:
76379 </para>
76380 <literallayout class="monospaced">
76381 openssl genrsa -out dkim_rsa.private 2048
76382 openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM
76383 </literallayout>
76384 <para>
76385 The result file from the first command should be retained, and
76386 this option set to use it.
76387 Take the base-64 lines from the output of the second command, concatenated,
76388 for the DNS TXT record.
76389 See section 3.6 of RFC6376 for the record specification.
76390 </para>
76391 <para>
76392 Under GnuTLS:
76393 </para>
76394 <literallayout class="monospaced">
76395 certtool --generate-privkey --rsa --bits=2048 --password='' -8 --outfile=dkim_rsa.private
76396 certtool --load-privkey=dkim_rsa.private --pubkey-info
76397 </literallayout>
76398 <para>
76399 Note that RFC 8301 says:
76400 </para>
76401 <literallayout class="monospaced">
76402 Signers MUST use RSA keys of at least 1024 bits for all keys.
76403 Signers SHOULD use RSA keys of at least 2048 bits.
76404 </literallayout>
76405 <para>
76406 EC keys for DKIM are defined by RFC 8463.
76407 They are considerably smaller than RSA keys for equivalent protection.
76408 As they are a recent development, users should consider dual-signing
76409 (by setting a list of selectors, and an expansion for this option)
76410 for some transition period.
76411 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
76412 for EC keys.
76413 </para>
76414 <para>
76415 OpenSSL 1.1.1 and GnuTLS 3.6.0 can create Ed25519 private keys:
76416 </para>
76417 <literallayout class="monospaced">
76418 openssl genpkey -algorithm ed25519 -out dkim_ed25519.private
76419 certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private
76420 </literallayout>
76421 <para>
76422 To produce the required public key value for a DNS record:
76423 </para>
76424 <literallayout class="monospaced">
76425 openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base64
76426 certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64
76427 </literallayout>
76428 <para>
76429 Exim also supports an alternate format
76430 of Ed25519 keys in DNS which was a candidate during development
76431 of the standard, but not adopted.
76432 A future release will probably drop that support.
76433 </para>
76434 <para>
76435 <indexterm role="option">
76436 <primary><option>dkim_hash</option></primary>
76437 </indexterm>
76438 </para>
76439 <informaltable frame="all">
76440 <tgroup cols="4" colsep="0" rowsep="0">
76441 <colspec colwidth="8*" align="left"/>
76442 <colspec colwidth="6*" align="center"/>
76443 <colspec colwidth="6*" align="center"/>
76444 <colspec colwidth="6*" align="right"/>
76445 <tbody>
76446 <row>
76447 <entry><option>dkim_hash</option></entry>
76448 <entry>Use: <emphasis>smtp</emphasis></entry>
76449 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76450 <entry>Default: <emphasis>sha256</emphasis></entry>
76451 </row>
76452 </tbody>
76453 </tgroup>
76454 </informaltable>
76455 <para>
76456 Can be set to any one of the supported hash methods, which are:
76457 </para>
76458 <itemizedlist>
76459 <listitem>
76460 <para>
76461 <literal>sha1</literal> &ndash; should not be used, is old and insecure
76462 </para>
76463 </listitem>
76464 <listitem>
76465 <para>
76466 <literal>sha256</literal> &ndash; the default
76467 </para>
76468 </listitem>
76469 <listitem>
76470 <para>
76471 <literal>sha512</literal> &ndash; possibly more secure but less well supported
76472 </para>
76473 </listitem>
76474 </itemizedlist>
76475 <para>
76476 Note that RFC 8301 says:
76477 </para>
76478 <literallayout class="monospaced">
76479 rsa-sha1 MUST NOT be used for signing or verifying.
76480 </literallayout>
76481 <para>
76482 <indexterm role="option">
76483 <primary><option>dkim_identity</option></primary>
76484 </indexterm>
76485 </para>
76486 <informaltable frame="all">
76487 <tgroup cols="4" colsep="0" rowsep="0">
76488 <colspec colwidth="8*" align="left"/>
76489 <colspec colwidth="6*" align="center"/>
76490 <colspec colwidth="6*" align="center"/>
76491 <colspec colwidth="6*" align="right"/>
76492 <tbody>
76493 <row>
76494 <entry><option>dkim_identity</option></entry>
76495 <entry>Use: <emphasis>smtp</emphasis></entry>
76496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76497 <entry>Default: <emphasis>unset</emphasis></entry>
76498 </row>
76499 </tbody>
76500 </tgroup>
76501 </informaltable>
76502 <para>
76503 If set after expansion, the value is used to set an "i=" tag in
76504 the signing header.  The DKIM standards restrict the permissible
76505 syntax of this optional tag to a mail address, with possibly-empty
76506 local part, an @, and a domain identical to or subdomain of the "d="
76507 tag value.  Note that Exim does not check the value.
76508 </para>
76509 <para>
76510 <indexterm role="option">
76511 <primary><option>dkim_canon</option></primary>
76512 </indexterm>
76513 </para>
76514 <informaltable frame="all">
76515 <tgroup cols="4" colsep="0" rowsep="0">
76516 <colspec colwidth="8*" align="left"/>
76517 <colspec colwidth="6*" align="center"/>
76518 <colspec colwidth="6*" align="center"/>
76519 <colspec colwidth="6*" align="right"/>
76520 <tbody>
76521 <row>
76522 <entry><option>dkim_canon</option></entry>
76523 <entry>Use: <emphasis>smtp</emphasis></entry>
76524 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76525 <entry>Default: <emphasis>unset</emphasis></entry>
76526 </row>
76527 </tbody>
76528 </tgroup>
76529 </informaltable>
76530 <para>
76531 This option sets the canonicalization method used when signing a message.
76532 The DKIM RFC currently supports two methods: "simple" and "relaxed".
76533 The option defaults to "relaxed" when unset. Note: the current implementation
76534 only supports signing with the same canonicalization method for both headers and body.
76535 </para>
76536 <para>
76537 <indexterm role="option">
76538 <primary><option>dkim_strict</option></primary>
76539 </indexterm>
76540 </para>
76541 <informaltable frame="all">
76542 <tgroup cols="4" colsep="0" rowsep="0">
76543 <colspec colwidth="8*" align="left"/>
76544 <colspec colwidth="6*" align="center"/>
76545 <colspec colwidth="6*" align="center"/>
76546 <colspec colwidth="6*" align="right"/>
76547 <tbody>
76548 <row>
76549 <entry><option>dkim_strict</option></entry>
76550 <entry>Use: <emphasis>smtp</emphasis></entry>
76551 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76552 <entry>Default: <emphasis>unset</emphasis></entry>
76553 </row>
76554 </tbody>
76555 </tgroup>
76556 </informaltable>
76557 <para>
76558 This  option  defines  how  Exim  behaves  when  signing a message that
76559 should be signed fails for some reason.  When the expansion evaluates to
76560 either <quote>1</quote> or <quote>true</quote>, Exim will defer. Otherwise Exim will send the message
76561 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
76562 variables here.
76563 </para>
76564 <para>
76565 <indexterm role="option">
76566 <primary><option>dkim_sign_headers</option></primary>
76567 </indexterm>
76568 </para>
76569 <informaltable frame="all">
76570 <tgroup cols="4" colsep="0" rowsep="0">
76571 <colspec colwidth="8*" align="left"/>
76572 <colspec colwidth="6*" align="center"/>
76573 <colspec colwidth="6*" align="center"/>
76574 <colspec colwidth="6*" align="right"/>
76575 <tbody>
76576 <row>
76577 <entry><option>dkim_sign_headers</option></entry>
76578 <entry>Use: <emphasis>smtp</emphasis></entry>
76579 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76580 <entry>Default: <emphasis>see below</emphasis></entry>
76581 </row>
76582 </tbody>
76583 </tgroup>
76584 </informaltable>
76585 <para>
76586 If set, this option must expand to a colon-separated
76587 list of header names.
76588 Headers with these names, or the absence or such a header, will be included
76589 in the message signature.
76590 When unspecified, the header names listed in RFC4871 will be used,
76591 whether or not each header is present in the message.
76592 The default list is available for the expansion in the macro
76593 <quote>_DKIM_SIGN_HEADERS</quote>
76594 and an oversigning variant is in <quote>_DKIM_OVERSIGN_HEADERS</quote>.
76595 </para>
76596 <para>
76597 If a name is repeated, multiple headers by that name (or the absence thereof)
76598 will be signed.  The textually later headers in the headers part of the
76599 message are signed first, if there are multiples.
76600 </para>
76601 <para>
76602 A name can be prefixed with either an <quote>=</quote> or a <quote>+</quote> character.
76603 If an <quote>=</quote> prefix is used, all headers that are present with this name
76604 will be signed.
76605 If a <quote>+</quote> prefix if used, all headers that are present with this name
76606 will be signed, and one signature added for a missing header with the
76607 name will be appended.
76608 </para>
76609 <para>
76610 <indexterm role="option">
76611 <primary><option>dkim_timestamps</option></primary>
76612 </indexterm>
76613 </para>
76614 <informaltable frame="all">
76615 <tgroup cols="4" colsep="0" rowsep="0">
76616 <colspec colwidth="8*" align="left"/>
76617 <colspec colwidth="6*" align="center"/>
76618 <colspec colwidth="6*" align="center"/>
76619 <colspec colwidth="6*" align="right"/>
76620 <tbody>
76621 <row>
76622 <entry><option>dkim_timestamps</option></entry>
76623 <entry>Use: <emphasis>smtp</emphasis></entry>
76624 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
76625 <entry>Default: <emphasis>unset</emphasis></entry>
76626 </row>
76627 </tbody>
76628 </tgroup>
76629 </informaltable>
76630 <para>
76631 This option controls the inclusion of timestamp information in the signature.
76632 If not set, no such information will be included.
76633 Otherwise, must be an unsigned number giving an offset in seconds from the current time
76634 for the expiry tag
76635 (eg. 1209600 for two weeks);
76636 both creation (t=) and expiry (x=) tags will be included.
76637 </para>
76638 <para>
76639 RFC 6376 lists these tags as RECOMMENDED.
76640 </para>
76641 </section>
76642 <section id="SECDKIMVFY">
76643 <title>Verifying DKIM signatures in incoming mail</title>
76644 <para>
76645 <indexterm role="concept">
76646 <primary>DKIM</primary>
76647 <secondary>verification</secondary>
76648 </indexterm>
76649 </para>
76650 <para>
76651 Verification of DKIM signatures in SMTP incoming email is done for all
76652 messages for which an ACL control <option>dkim_disable_verify</option> has not been set.
76653 <indexterm role="concept">
76654 <primary>DKIM</primary>
76655 <secondary>selecting signature algorithms</secondary>
76656 </indexterm>
76657 Individual classes of signature algorithm can be ignored by changing
76658 the main options <option>dkim_verify_hashes</option> or <option>dkim_verify_keytypes</option>.
76659 The <option>dkim_verify_minimal</option> option can be set to cease verification
76660 processing for a message once the first passing signature is found.
76661 </para>
76662 <para>
76663 <indexterm role="concept">
76664 <primary>authentication</primary>
76665 <secondary>expansion item</secondary>
76666 </indexterm>
76667 Performing verification sets up information used by the
76668 <option>authresults</option> expansion item.
76669 </para>
76670 <para>
76671 For most purposes the default option settings suffice and the remainder
76672 of this section can be ignored.
76673 </para>
76674 <para>
76675 The results of verification are made available to the
76676 <option>acl_smtp_dkim</option> ACL, which can examine and modify them.
76677 A missing ACL definition defaults to accept.
76678 By default, the ACL is called once for each
76679 syntactically(!) correct signature in the incoming message.
76680 If any ACL call does not accept, the message is not accepted.
76681 If a cutthrough delivery was in progress for the message, that is
76682 summarily dropped (having wasted the transmission effort).
76683 </para>
76684 <para>
76685 To evaluate the verification result in the ACL
76686 a large number of expansion variables
76687 containing the signature status and its details are set up during the
76688 runtime of the ACL.
76689 </para>
76690 <para>
76691 Calling the ACL only for existing signatures is not sufficient to build
76692 more advanced policies. For that reason, the main option
76693 <option>dkim_verify_signers</option>, and an expansion variable
76694 <option>$dkim_signers</option> exist.
76695 </para>
76696 <para>
76697 The main option <option>dkim_verify_signers</option> can be set to a colon-separated
76698 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
76699 called. It is expanded when the message has been received. At this point,
76700 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
76701 list of signer domains and identities for the message. When
76702 <option>dkim_verify_signers</option> is not specified in the main configuration,
76703 it defaults as:
76704 </para>
76705 <literallayout class="monospaced">
76706 dkim_verify_signers = $dkim_signers
76707 </literallayout>
76708 <para>
76709 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
76710 DKIM signature in the message. Current DKIM verifiers may want to explicitly
76711 call the ACL for known domains or identities. This would be achieved as follows:
76712 </para>
76713 <literallayout class="monospaced">
76714 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
76715 </literallayout>
76716 <para>
76717 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
76718 and "ebay.com", plus all domains and identities that have signatures in the message.
76719 You can also be more creative in constructing your policy. For example:
76720 </para>
76721 <literallayout class="monospaced">
76722 dkim_verify_signers = $sender_address_domain:$dkim_signers
76723 </literallayout>
76724 <para>
76725 If a domain or identity is listed several times in the (expanded) value of
76726 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
76727 </para>
76728 <para>
76729 Note that if the option is set using untrustworthy data
76730 (such as the From: header)
76731 care should be taken to force lowercase for domains
76732 and for the domain part if identities.
76733 The default setting can be regarded as trustworthy in this respect.
76734 </para>
76735 <para>
76736 If multiple signatures match a domain (or identity), the ACL is called once
76737 for each matching signature.
76738 </para>
76739 <para>
76740 Inside the DKIM ACL, the following expansion variables are
76741 available (from most to least important):
76742 </para>
76743 <variablelist>
76744 <varlistentry>
76745 <term><option>$dkim_cur_signer</option></term>
76746 <listitem>
76747 <para>
76748 The signer that is being evaluated in this ACL run. This can be a domain or
76749 an identity. This is one of the list items from the expanded main option
76750 <option>dkim_verify_signers</option> (see above).
76751 </para>
76752 </listitem></varlistentry>
76753 <varlistentry>
76754 <term><option>$dkim_verify_status</option></term>
76755 <listitem>
76756 <para>
76757 Within the DKIM ACL,
76758 a string describing the general status of the signature. One of
76759 </para>
76760 <itemizedlist>
76761 <listitem>
76762 <para>
76763 <option>none</option>: There is no signature in the message for the current domain or
76764 identity (as reflected by <option>$dkim_cur_signer</option>).
76765 </para>
76766 </listitem>
76767 <listitem>
76768 <para>
76769 <option>invalid</option>: The signature could not be verified due to a processing error.
76770 More detail is available in <option>$dkim_verify_reason</option>.
76771 </para>
76772 </listitem>
76773 <listitem>
76774 <para>
76775 <option>fail</option>: Verification of the signature failed.  More detail is
76776 available in <option>$dkim_verify_reason</option>.
76777 </para>
76778 </listitem>
76779 <listitem>
76780 <para>
76781 <option>pass</option>: The signature passed verification. It is valid.
76782 </para>
76783 </listitem>
76784 </itemizedlist>
76785 <para>
76786 This variable can be overwritten using an ACL &#x2019;set&#x2019; modifier.
76787 This might, for instance, be done to enforce a policy restriction on
76788 hash-method or key-size:
76789 </para>
76790 <literallayout class="monospaced">
76791   warn condition       = ${if eq {$dkim_verify_status}{pass}}
76792        condition       = ${if eq {${length_3:$dkim_algo}}{rsa}}
76793        condition       = ${if or {{eq {$dkim_algo}{rsa-sha1}} \
76794                                   {&lt; {$dkim_key_length}{1024}}}}
76795        logwrite        = NOTE: forcing DKIM verify fail (was pass)
76796        set dkim_verify_status = fail
76797        set dkim_verify_reason = hash too weak or key too short
76798 </literallayout>
76799 <para>
76800 So long as a DKIM ACL is defined (it need do no more than accept),
76801 after all the DKIM ACL runs have completed, the value becomes a
76802 colon-separated list of the values after each run.
76803 This is maintained for the mime, prdr and data ACLs.
76804 </para>
76805 </listitem></varlistentry>
76806 <varlistentry>
76807 <term><option>$dkim_verify_reason</option></term>
76808 <listitem>
76809 <para>
76810 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
76811 "fail" or "invalid". One of
76812 </para>
76813 <itemizedlist>
76814 <listitem>
76815 <para>
76816 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
76817 key for the domain could not be retrieved. This may be a temporary problem.
76818 </para>
76819 </listitem>
76820 <listitem>
76821 <para>
76822 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
76823 record for the domain is syntactically invalid.
76824 </para>
76825 </listitem>
76826 <listitem>
76827 <para>
76828 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
76829 body hash does not match the one specified in the signature header. This
76830 means that the message body was modified in transit.
76831 </para>
76832 </listitem>
76833 <listitem>
76834 <para>
76835 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
76836 could not be verified. This may mean that headers were modified,
76837 re-written or otherwise changed in a way which is incompatible with
76838 DKIM verification. It may of course also mean that the signature is forged.
76839 </para>
76840 </listitem>
76841 </itemizedlist>
76842 <para>
76843 This variable can be overwritten, with any value, using an ACL &#x2019;set&#x2019; modifier.
76844 </para>
76845 </listitem></varlistentry>
76846 <varlistentry>
76847 <term><option>$dkim_domain</option></term>
76848 <listitem>
76849 <para>
76850 The signing domain. IMPORTANT: This variable is only populated if there is
76851 an actual signature in the message for the current domain or identity (as
76852 reflected by <option>$dkim_cur_signer</option>).
76853 </para>
76854 </listitem></varlistentry>
76855 <varlistentry>
76856 <term><option>$dkim_identity</option></term>
76857 <listitem>
76858 <para>
76859 The signing identity, if present. IMPORTANT: This variable is only populated
76860 if there is an actual signature in the message for the current domain or
76861 identity (as reflected by <option>$dkim_cur_signer</option>).
76862 </para>
76863 </listitem></varlistentry>
76864 <varlistentry>
76865 <term><option>$dkim_selector</option></term>
76866 <listitem>
76867 <para>
76868 The key record selector string.
76869 </para>
76870 </listitem></varlistentry>
76871 <varlistentry>
76872 <term><option>$dkim_algo</option></term>
76873 <listitem>
76874 <para>
76875 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
76876 If running under GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
76877 may also be &#x2019;ed25519-sha256&#x2019;.
76878 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
76879 for EC keys.
76880 </para>
76881 <para>
76882 Note that RFC 8301 says:
76883 </para>
76884 <literallayout class="monospaced">
76885 rsa-sha1 MUST NOT be used for signing or verifying.
76886
76887 DKIM signatures identified as having been signed with historic
76888 algorithms (currently, rsa-sha1) have permanently failed evaluation
76889 </literallayout>
76890 <para>
76891 To enforce this you must either have a DKIM ACL which checks this variable
76892 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above,
76893 or have set the main option <option>dkim_verify_hashes</option> to exclude
76894 processing of such signatures.
76895 </para>
76896 </listitem></varlistentry>
76897 <varlistentry>
76898 <term><option>$dkim_canon_body</option></term>
76899 <listitem>
76900 <para>
76901 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
76902 </para>
76903 </listitem></varlistentry>
76904 <varlistentry>
76905 <term><option>$dkim_canon_headers</option></term>
76906 <listitem>
76907 <para>
76908 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
76909 </para>
76910 </listitem></varlistentry>
76911 <varlistentry>
76912 <term><option>$dkim_copiedheaders</option></term>
76913 <listitem>
76914 <para>
76915 A transcript of headers and their values which are included in the signature
76916 (copied from the &#x2019;z=&#x2019; tag of the signature).
76917 Note that RFC6376 requires that verification fail if the From: header is
76918 not included in the signature.  Exim does not enforce this; sites wishing
76919 strict enforcement should code the check explicitly.
76920 </para>
76921 </listitem></varlistentry>
76922 <varlistentry>
76923 <term><option>$dkim_bodylength</option></term>
76924 <listitem>
76925 <para>
76926 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
76927 limit was set by the signer, "9999999999999" is returned. This makes sure
76928 that this variable always expands to an integer value.
76929 <emphasis role="bold">Note:</emphasis> The presence of the signature tag specifying a signing body length
76930 is one possible route to spoofing of valid DKIM signatures.
76931 A paranoid implementation might wish to regard signature where this variable
76932 shows less than the "no limit" return as being invalid.
76933 </para>
76934 </listitem></varlistentry>
76935 <varlistentry>
76936 <term><option>$dkim_created</option></term>
76937 <listitem>
76938 <para>
76939 UNIX timestamp reflecting the date and time when the signature was created.
76940 When this was not specified by the signer, "0" is returned.
76941 </para>
76942 </listitem></varlistentry>
76943 <varlistentry>
76944 <term><option>$dkim_expires</option></term>
76945 <listitem>
76946 <para>
76947 UNIX timestamp reflecting the date and time when the signer wants the
76948 signature to be treated as "expired". When this was not specified by the
76949 signer, "9999999999999" is returned. This makes it possible to do useful
76950 integer size comparisons against this value.
76951 Note that Exim does not check this value.
76952 </para>
76953 </listitem></varlistentry>
76954 <varlistentry>
76955 <term><option>$dkim_headernames</option></term>
76956 <listitem>
76957 <para>
76958 A colon-separated list of names of headers included in the signature.
76959 </para>
76960 </listitem></varlistentry>
76961 <varlistentry>
76962 <term><option>$dkim_key_testing</option></term>
76963 <listitem>
76964 <para>
76965 "1" if the key record has the "testing" flag set, "0" if not.
76966 </para>
76967 </listitem></varlistentry>
76968 <varlistentry>
76969 <term><option>$dkim_key_nosubdomains</option></term>
76970 <listitem>
76971 <para>
76972 "1" if the key record forbids subdomaining, "0" otherwise.
76973 </para>
76974 </listitem></varlistentry>
76975 <varlistentry>
76976 <term><option>$dkim_key_srvtype</option></term>
76977 <listitem>
76978 <para>
76979 Service type (tag s=) from the key record. Defaults to "*" if not specified
76980 in the key record.
76981 </para>
76982 </listitem></varlistentry>
76983 <varlistentry>
76984 <term><option>$dkim_key_granularity</option></term>
76985 <listitem>
76986 <para>
76987 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
76988 in the key record.
76989 </para>
76990 </listitem></varlistentry>
76991 <varlistentry>
76992 <term><option>$dkim_key_notes</option></term>
76993 <listitem>
76994 <para>
76995 Notes from the key record (tag n=).
76996 </para>
76997 </listitem></varlistentry>
76998 <varlistentry>
76999 <term><option>$dkim_key_length</option></term>
77000 <listitem>
77001 <para>
77002 Number of bits in the key.
77003 Valid only once the key is loaded, which is at the time the header signature
77004 is verified, which is after the body hash is.
77005 </para>
77006 <para>
77007 Note that RFC 8301 says:
77008 </para>
77009 <literallayout class="monospaced">
77010 Verifiers MUST NOT consider signatures using RSA keys of
77011 less than 1024 bits as valid signatures.
77012 </literallayout>
77013 <para>
77014 This is enforced by the default setting for the <option>dkim_verify_min_keysizes</option>
77015 option.
77016 </para>
77017 </listitem></varlistentry>
77018 </variablelist>
77019 <para>
77020 In addition, two ACL conditions are provided, usable only in a DKIM ACL:
77021 </para>
77022 <variablelist>
77023 <varlistentry>
77024 <term><option>dkim_signers</option></term>
77025 <listitem>
77026 <para>
77027 ACL condition that checks a colon-separated list of domains or identities
77028 for a match against the domain or identity that the ACL is currently verifying
77029 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
77030 verb to a group of domains or identities. For example:
77031 </para>
77032 <literallayout class="monospaced">
77033 # Warn when Mail purportedly from GMail has no gmail signature
77034 warn sender_domains = gmail.com
77035      dkim_signers = gmail.com
77036      dkim_status = none
77037      log_message = GMail sender without gmail.com DKIM signature
77038 </literallayout>
77039 <para>
77040 Note that the above does not check for a total lack of DKIM signing;
77041 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
77042 </para>
77043 </listitem></varlistentry>
77044 <varlistentry>
77045 <term><option>dkim_status</option></term>
77046 <listitem>
77047 <para>
77048 ACL condition that checks a colon-separated list of possible DKIM verification
77049 results against the actual result of verification. This is typically used
77050 to restrict an ACL verb to a list of verification outcomes, for example:
77051 </para>
77052 <literallayout class="monospaced">
77053 deny sender_domains = paypal.com:paypal.de
77054      dkim_signers = paypal.com:paypal.de
77055      dkim_status = none:invalid:fail
77056      message = Mail from Paypal with invalid/missing signature
77057 </literallayout>
77058 <para>
77059 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
77060 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
77061 for more information of what they mean.
77062 </para>
77063 </listitem></varlistentry>
77064 </variablelist>
77065 </section>
77066 </section>
77067 <section id="SECSPF">
77068 <title>SPF (Sender Policy Framework)</title>
77069 <para>
77070 <indexterm role="concept">
77071 <primary>SPF</primary>
77072 <secondary>verification</secondary>
77073 </indexterm>
77074 </para>
77075 <para>
77076 SPF is a mechanism whereby a domain may assert which IP addresses may transmit
77077 messages with its domain in the envelope from, documented by RFC 7208.
77078 For more information on SPF see <emphasis role="bold"><ulink url="http://www.open-spf.org">http://www.open-spf.org</ulink></emphasis>, a static copy of
77079 the <emphasis role="bold"><ulink url="http://openspf.org">http://openspf.org</ulink></emphasis>.
77080 </para>
77081 <para>
77082 Messages sent by a system not authorised will fail checking of such assertions.
77083 This includes retransmissions done by traditional forwarders.
77084 </para>
77085 <para>
77086 SPF verification support is built into Exim if SUPPORT_SPF=yes is set in
77087 <filename>Local/Makefile</filename>.  The support uses the <filename>libspf2</filename> library
77088 <emphasis role="bold"><ulink url="https://www.libspf2.org/">https://www.libspf2.org/</ulink></emphasis>.
77089 There is no Exim involvement in the transmission of messages;
77090 publishing certain DNS records is all that is required.
77091 </para>
77092 <para>
77093 For verification, an ACL condition and an expansion lookup are provided.
77094 <indexterm role="concept">
77095 <primary>authentication</primary>
77096 <secondary>expansion item</secondary>
77097 </indexterm>
77098 Performing verification sets up information used by the
77099 <option>authresults</option> expansion item.
77100 </para>
77101 <para>
77102 <indexterm role="concept">
77103 <primary>SPF</primary>
77104 <secondary>ACL condition</secondary>
77105 </indexterm>
77106 <indexterm role="concept">
77107 <primary>ACL</primary>
77108 <secondary>spf condition</secondary>
77109 </indexterm>
77110 The ACL condition "spf" can be used at or after the MAIL ACL.
77111 It takes as an argument a list of strings giving the outcome of the SPF check,
77112 and will succeed for any matching outcome.
77113 Valid strings are:
77114 </para>
77115 <variablelist>
77116 <varlistentry>
77117 <term><option>pass</option></term>
77118 <listitem>
77119 <para>
77120 The SPF check passed, the sending host is positively verified by SPF.
77121 </para>
77122 </listitem></varlistentry>
77123 <varlistentry>
77124 <term><option>fail</option></term>
77125 <listitem>
77126 <para>
77127 The SPF check failed, the sending host is NOT allowed to send mail for the
77128 domain in the envelope-from address.
77129 </para>
77130 </listitem></varlistentry>
77131 <varlistentry>
77132 <term><option>softfail</option></term>
77133 <listitem>
77134 <para>
77135 The SPF check failed, but the queried domain can&#x2019;t absolutely confirm that this
77136 is a forgery.
77137 </para>
77138 </listitem></varlistentry>
77139 <varlistentry>
77140 <term><option>none</option></term>
77141 <listitem>
77142 <para>
77143 The queried domain does not publish SPF records.
77144 </para>
77145 </listitem></varlistentry>
77146 <varlistentry>
77147 <term><option>neutral</option></term>
77148 <listitem>
77149 <para>
77150 The SPF check returned a "neutral" state.  This means the queried domain has
77151 published a SPF record, but wants to allow outside servers to send mail under
77152 its domain as well.  This should be treated like "none".
77153 </para>
77154 </listitem></varlistentry>
77155 <varlistentry>
77156 <term><option>permerror</option></term>
77157 <listitem>
77158 <para>
77159 This indicates a syntax error in the SPF record of the queried domain.
77160 You may deny messages when this occurs.
77161 </para>
77162 </listitem></varlistentry>
77163 <varlistentry>
77164 <term><option>temperror</option></term>
77165 <listitem>
77166 <para>
77167 This indicates a temporary error during all processing, including Exim&#x2019;s
77168 SPF processing.  You may defer messages when this occurs.
77169 </para>
77170 </listitem></varlistentry>
77171 <varlistentry>
77172 <term><option>invalid</option></term>
77173 <listitem>
77174 <para>
77175 There was an error during processing of the SPF lookup
77176 </para>
77177 </listitem></varlistentry>
77178 </variablelist>
77179 <para>
77180 You can prefix each string with an exclamation mark to  invert
77181 its meaning,  for example  "!fail" will  match all  results but
77182 "fail".  The  string  list is  evaluated  left-to-right,  in a
77183 short-circuit fashion.
77184 </para>
77185 <para>
77186 Example:
77187 </para>
77188 <literallayout class="monospaced">
77189 deny spf = fail
77190      message = $sender_host_address is not allowed to send mail from \
77191                ${if def:sender_address_domain \
77192                     {$sender_address_domain}{$sender_helo_name}}.  \
77193                Please see http://www.open-spf.org/Why;\
77194                identity=${if def:sender_address_domain \
77195                              {$sender_address}{$sender_helo_name}};\
77196                ip=$sender_host_address
77197 </literallayout>
77198 <para>
77199 Note: The above mentioned URL may not be as helpful as expected. You are
77200 encouraged to replace the link with a link to a site with more
77201 explanations.
77202 </para>
77203 <para>
77204 When the spf condition has run, it sets up several expansion
77205 variables:
77206 </para>
77207 <para>
77208 <indexterm role="concept">
77209 <primary>SPF</primary>
77210 <secondary>verification variables</secondary>
77211 </indexterm>
77212 </para>
77213 <variablelist>
77214 <varlistentry>
77215 <term><varname>$spf_header_comment</varname></term>
77216 <listitem>
77217 <para>
77218 <indexterm role="variable">
77219 <primary><varname>$spf_header_comment</varname></primary>
77220 </indexterm>
77221   This contains a human-readable string describing the outcome
77222   of the SPF check. You can add it to a custom header or use
77223   it for logging purposes.
77224 </para>
77225 </listitem></varlistentry>
77226 <varlistentry>
77227 <term><varname>$spf_received</varname></term>
77228 <listitem>
77229 <para>
77230 <indexterm role="variable">
77231 <primary><varname>$spf_received</varname></primary>
77232 </indexterm>
77233   This contains a complete Received-SPF: header (name and
77234   content) that can be added to the message. Please note that
77235   according to the SPF draft, this header must be added at the
77236   top of the header list, i.e. with
77237 </para>
77238 <literallayout class="monospaced">
77239 add_header = :at_start:$spf_received
77240 </literallayout>
77241 <para>
77242   See section <xref linkend="SECTaddheadacl"/> for further details.
77243 </para>
77244 <para>
77245   Note: in case of "Best-guess" (see below), the convention is
77246   to put this string in a header called X-SPF-Guess: instead.
77247 </para>
77248 </listitem></varlistentry>
77249 <varlistentry>
77250 <term><varname>$spf_result</varname></term>
77251 <listitem>
77252 <para>
77253 <indexterm role="variable">
77254 <primary><varname>$spf_result</varname></primary>
77255 </indexterm>
77256   This contains the outcome of the SPF check in string form,
77257   currently one of pass, fail, softfail, none, neutral, permerror,
77258   temperror, or <quote>(invalid)</quote>.
77259 </para>
77260 </listitem></varlistentry>
77261 <varlistentry>
77262 <term><varname>$spf_result_guessed</varname></term>
77263 <listitem>
77264 <para>
77265 <indexterm role="variable">
77266 <primary><varname>$spf_result_guessed</varname></primary>
77267 </indexterm>
77268   This boolean is true only if a best-guess operation was used
77269   and required in order to obtain a result.
77270 </para>
77271 </listitem></varlistentry>
77272 <varlistentry>
77273 <term><varname>$spf_smtp_comment</varname></term>
77274 <listitem>
77275 <para>
77276 <indexterm role="variable">
77277 <primary><varname>$spf_smtp_comment</varname></primary>
77278 </indexterm>
77279 <indexterm role="variable">
77280 <primary><option>spf_smtp_comment_template</option></primary>
77281 </indexterm>
77282   This contains a string that can be used in a SMTP response
77283   to the calling party. Useful for "fail".
77284   The string is generated by the SPF library from the template configured in the main config
77285   option <option>spf_smtp_comment_template</option>.
77286 </para>
77287 </listitem></varlistentry>
77288 </variablelist>
77289 <para>
77290 <indexterm role="concept">
77291 <primary>SPF</primary>
77292 <secondary>ACL condition</secondary>
77293 </indexterm>
77294 <indexterm role="concept">
77295 <primary>ACL</primary>
77296 <secondary>spf_guess condition</secondary>
77297 </indexterm>
77298 <indexterm role="concept">
77299 <primary>SPF</primary>
77300 <secondary>best guess</secondary>
77301 </indexterm>
77302 In addition to SPF, you can also perform checks for so-called
77303 "Best-guess".  Strictly speaking, "Best-guess" is not standard
77304 SPF, but it is supported by the same framework that enables SPF
77305 capability.
77306 Refer to <emphasis role="bold"><ulink url="http://www.open-spf.org/FAQ/Best_guess_record">http://www.open-spf.org/FAQ/Best_guess_record</ulink></emphasis>
77307 for a description of what it means.
77308 </para>
77309 <para>
77310 To access this feature, simply use the spf_guess condition in place
77311 of the spf one.  For example:
77312 </para>
77313 <literallayout class="monospaced">
77314 deny spf_guess = fail
77315      message = $sender_host_address doesn't look trustworthy to me
77316 </literallayout>
77317 <para>
77318 In case you decide to reject messages based on this check, you
77319 should note that although it uses the same framework, "Best-guess"
77320 is not SPF, and therefore you should not mention SPF at all in your
77321 reject message.
77322 </para>
77323 <para>
77324 When the spf_guess condition has run, it sets up the same expansion
77325 variables as when spf condition is run, described above.
77326 </para>
77327 <para>
77328 Additionally, since Best-guess is not standardized, you may redefine
77329 what "Best-guess" means to you by redefining the main configuration
77330 <option>spf_guess</option> option.
77331 For example, the following:
77332 </para>
77333 <literallayout class="monospaced">
77334 spf_guess = v=spf1 a/16 mx/16 ptr ?all
77335 </literallayout>
77336 <para>
77337 would relax host matching rules to a broader network range.
77338 </para>
77339 <para>
77340 <indexterm role="concept">
77341 <primary>SPF</primary>
77342 <secondary>lookup expansion</secondary>
77343 </indexterm>
77344 <indexterm role="concept">
77345 <primary>lookup</primary>
77346 <secondary>spf</secondary>
77347 </indexterm>
77348 A lookup expansion is also available. It takes an email
77349 address as the key and an IP address
77350 (v4 or v6)
77351 as the database:
77352 </para>
77353 <literallayout class="monospaced">
77354   ${lookup {username@domain} spf {ip.ip.ip.ip}}
77355 </literallayout>
77356 <para>
77357 The lookup will return the same result strings as can appear in
77358 <varname>$spf_result</varname> (pass,fail,softfail,neutral,none,err_perm,err_temp).
77359 </para>
77360 <section id="SECTSRS">
77361 <title>SRS (Sender Rewriting Scheme)</title>
77362 <para>
77363 <indexterm role="concept">
77364 <primary>SRS</primary>
77365 <secondary>sender rewriting scheme</secondary>
77366 </indexterm>
77367 </para>
77368 <para>
77369 SRS can be used to modify sender addresses when forwarding so that
77370 SPF verification does not object to them.
77371 It operates by encoding the original envelope sender in a new
77372 sender local part and using a domain run by the forwarding site
77373 as the new domain for the sender.  Any DSN message should be returned
77374 to this new sender at the forwarding site, which can extract the
77375 original sender from the coded local part and forward the DSN to
77376 the originator.
77377 </para>
77378 <para>
77379 This is a way of avoiding the breakage that SPF does to forwarding.
77380 The constructed local-part will be longer than the original,
77381 leading to possible problems with very long addresses.
77382 The changing of the sender address also hinders the tracing of mail
77383 problems.
77384 </para>
77385 <para>
77386 Exim can be built to include native SRS support.  To do this
77387 SUPPORT_SRS=yes must be defined in <filename>Local/Makefile</filename>.
77388 If this has been done, the macros _HAVE_SRS and _HAVE_NATIVE_SRS
77389 will be defined.
77390 The support is limited to SRS0-encoding; SRS1 is not supported.
77391 </para>
77392 <para>
77393 <indexterm role="concept">
77394 <primary>SRS</primary>
77395 <secondary>excoding</secondary>
77396 </indexterm>
77397 To encode an address use this expansion item:
77398 </para>
77399 <variablelist>
77400 <varlistentry>
77401 <term><emphasis role="bold">${srs_encode&nbsp;{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>return&nbsp;path</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>original&nbsp;domain</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
77402 <listitem>
77403 <para>
77404 <indexterm role="concept">
77405 <primary><option>srs_encode</option> expansion item</primary>
77406 </indexterm>
77407 <indexterm role="concept">
77408 <primary>SRS</primary>
77409 <secondary>expansion item</secondary>
77410 </indexterm>
77411 The first argument should be a secret known and used by all systems
77412 handling the recipient domain for the original message.
77413 There is no need to periodically change this key; a timestamp is also
77414 encoded.
77415 The second argument should be given as the envelope sender address before this
77416 encoding operation.
77417 If this value is empty the the expansion result will be empty.
77418 The third argument should be the recipient domain of the message when
77419 it arrived at this system.
77420 All arguments are expanded before use.
77421 </para>
77422 <para>
77423 The result of the expansion is the replacement envelope-from (return path)
77424 to be used.
77425 </para>
77426 </listitem></varlistentry>
77427 </variablelist>
77428 <para>
77429 <indexterm role="concept">
77430 <primary>SRS</primary>
77431 <secondary>decoding</secondary>
77432 </indexterm>
77433 To decode an address use this expansion condition:
77434 </para>
77435 <variablelist>
77436 <varlistentry>
77437 <term><emphasis role="bold">inbound_srs&nbsp;{</emphasis>&lt;<emphasis>local&nbsp;part</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
77438 <listitem>
77439 <para>
77440 The first argument should be the recipient local part as it was received.
77441 The second argument is the site secret.
77442 Both arguments are expanded before use.
77443 </para>
77444 <para>
77445 If the messages is not for an SRS-encoded recipient the condition will
77446 return false.
77447 If it is, the condition will return true and the variable
77448 <varname>$srs_recipient</varname> will be set to the decoded (original) value.
77449 </para>
77450 <para revisionflag="changed">
77451 If the second argument is empty then the condition returns true if
77452 the first argument is in valid SRS formet, else false.
77453 The variable <varname>$srs_recipient</varname> is not set for this case.
77454 </para>
77455 </listitem></varlistentry>
77456 </variablelist>
77457 <para>
77458 Example usage:
77459 </para>
77460 <literallayout class="monospaced">
77461   #macro
77462   SRS_SECRET = &lt;pick something unique for your site for this. Use on all MXs.&gt;
77463
77464   #routers
77465
77466   outbound:
77467     driver =    dnslookup
77468     # if outbound, and forwarding has been done, use an alternate transport
77469     domains =   ! +my_domains
77470     transport = ${if eq {$local_part@$domain} \
77471                         {$original_local_part@$original_domain} \
77472                      {remote_smtp} {remote_forwarded_smtp}}
77473
77474   inbound_srs:
77475     driver =    redirect
77476     senders =   :
77477     domains =   +my_domains
77478     # detect inbound bounces which are SRS'd, and decode them
77479     condition = ${if inbound_srs {$local_part} {SRS_SECRET}}
77480     data =      $srs_recipient
77481
77482   inbound_srs_failure:
77483     driver =    redirect
77484     senders =   :
77485     domains =   +my_domains
77486     # detect inbound bounces which look SRS'd but are invalid
77487     condition = ${if inbound_srs {$local_part} {}}
77488     allow_fail
77489     data =      :fail: Invalid SRS recipient address
77490
77491   #... further routers here
77492
77493
77494   # transport; should look like the non-forward outbound
77495   # one, plus the max_rcpt and return_path options
77496   remote_forwarded_smtp:
77497     driver =              smtp
77498     # single-recipient so that $original_domain is valid
77499     max_rcpt =            1
77500     # modify the envelope from, for mails that we forward
77501     return_path =         ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}
77502 </literallayout>
77503 </section>
77504 </section>
77505 <section id="SECDMARC">
77506 <title>DMARC</title>
77507 <para>
77508 <indexterm role="concept">
77509 <primary>DMARC</primary>
77510 <secondary>verification</secondary>
77511 </indexterm>
77512 </para>
77513 <para>
77514 DMARC combines feedback from SPF, DKIM, and header From: in order
77515 to attempt to provide better indicators of the authenticity of an
77516 email.  This document does not explain the fundamentals; you
77517 should read and understand how it works by visiting the website at
77518 <emphasis role="bold"><ulink url="http://www.dmarc.org/">http://www.dmarc.org/</ulink></emphasis>.
77519 </para>
77520 <para>
77521 If Exim is built with DMARC support,
77522 the libopendmarc library is used.
77523 </para>
77524 <para>
77525 For building Exim yourself, obtain the library from
77526 <emphasis role="bold"><ulink url="http://sourceforge.net/projects/opendmarc/">http://sourceforge.net/projects/opendmarc/</ulink></emphasis>
77527 to obtain a copy, or find it in your favorite package
77528 repository.  You will need to attend to the local/Makefile feature
77529 SUPPORT_DMARC and the associated LDFLAGS addition.
77530 This description assumes
77531 that headers will be in /usr/local/include, and that the libraries
77532 are in /usr/local/lib.
77533 </para>
77534 <section id="SSECDMARCCONFIG">
77535 <title>Configuration</title>
77536 <para>
77537 <indexterm role="concept">
77538 <primary>DMARC</primary>
77539 <secondary>configuration</secondary>
77540 </indexterm>
77541 </para>
77542 <para>
77543 There are three main-configuration options:
77544 <indexterm role="concept">
77545 <primary>DMARC</primary>
77546 <secondary>configuration options</secondary>
77547 </indexterm>
77548 </para>
77549 <para>
77550 The <option>dmarc_tld_file</option> option
77551 <indexterm role="option">
77552 <primary><option>dmarc_tld_file</option></primary>
77553 </indexterm>
77554 defines the location of a text file of valid
77555 top level domains the opendmarc library uses
77556 during domain parsing. Maintained by Mozilla,
77557 the most current version can be downloaded
77558 from a link at <emphasis role="bold"><ulink url="https://publicsuffix.org/list/public_suffix_list.dat">https://publicsuffix.org/list/public_suffix_list.dat</ulink></emphasis>.
77559 See also the util/renew-opendmarc-tlds.sh script.
77560 The default for the option is unset.
77561 If not set, DMARC processing is disabled.
77562 </para>
77563 <para>
77564 The <option>dmarc_history_file</option> option, if set
77565 <indexterm role="option">
77566 <primary><option>dmarc_history_file</option></primary>
77567 </indexterm>
77568 defines the location of a file to log results
77569 of dmarc verification on inbound emails. The
77570 contents are importable by the opendmarc tools
77571 which will manage the data, send out DMARC
77572 reports, and expire the data. Make sure the
77573 directory of this file is writable by the user
77574 exim runs as.
77575 The default is unset.
77576 </para>
77577 <para>
77578 The <option>dmarc_forensic_sender</option> option
77579 <indexterm role="option">
77580 <primary><option>dmarc_forensic_sender</option></primary>
77581 </indexterm>
77582 defines an alternate email address to use when sending a
77583 forensic report detailing alignment failures
77584 if a sender domain&#x2019;s dmarc record specifies it
77585 and you have configured Exim to send them.
77586 If set, this is expanded and used for the
77587 From: header line; the address is extracted
77588 from it and used for the envelope from.
77589 If not set (the default), the From: header is expanded from
77590 the dsn_from option, and &lt;&gt; is used for the
77591 envelope from.
77592 </para>
77593 </section>
77594 <section id="SSECDMARCCONTROLS">
77595 <title>Controls</title>
77596 <para>
77597 <indexterm role="concept">
77598 <primary>DMARC</primary>
77599 <secondary>controls</secondary>
77600 </indexterm>
77601 </para>
77602 <para>
77603 By default, the DMARC processing will run for any remote,
77604 non-authenticated user.  It makes sense to only verify DMARC
77605 status of messages coming from remote, untrusted sources.  You can
77606 use standard conditions such as hosts, senders, etc, to decide that
77607 DMARC verification should *not* be performed for them and disable
77608 DMARC with an ACL control modifier:
77609 </para>
77610 <literallayout class="monospaced">
77611   control = dmarc_disable_verify
77612 </literallayout>
77613 <para>
77614 A DMARC record can also specify a "forensic address", which gives
77615 exim an email address to submit reports about failed alignment.
77616 Exim does not do this by default because in certain conditions it
77617 results in unintended information leakage (what lists a user might
77618 be subscribed to, etc).  You must configure exim to submit forensic
77619 reports to the owner of the domain.  If the DMARC record contains a
77620 forensic address and you specify the control statement below, then
77621 exim will send these forensic emails.  It is also advised that you
77622 configure a <option>dmarc_forensic_sender</option> because the default sender address
77623 construction might be inadequate.
77624 </para>
77625 <literallayout class="monospaced">
77626   control = dmarc_enable_forensic
77627 </literallayout>
77628 <para>
77629 (AGAIN: You can choose not to send these forensic reports by simply
77630 not putting the dmarc_enable_forensic control line at any point in
77631 your exim config.  If you don&#x2019;t tell exim to send them, it will not
77632 send them.)
77633 </para>
77634 <para>
77635 There are no options to either control.  Both must appear before
77636 the DATA acl.
77637 </para>
77638 </section>
77639 <section id="SSECDMARCACL">
77640 <title>ACL</title>
77641 <para>
77642 <indexterm role="concept">
77643 <primary>DMARC</primary>
77644 <secondary>ACL condition</secondary>
77645 </indexterm>
77646 </para>
77647 <para>
77648 DMARC checks can be run on incoming SMTP  messages by using the
77649 <quote>dmarc_status</quote> ACL condition in the DATA ACL.  You are required to
77650 call the <quote>spf</quote> condition first in the ACLs, then the <quote>dmarc_status</quote>
77651 condition.  Putting this condition in the ACLs is required in order
77652 for a DMARC check to actually occur.  All of the variables are set
77653 up before the DATA ACL, but there is no actual DMARC check that
77654 occurs until a <quote>dmarc_status</quote> condition is encountered in the ACLs.
77655 </para>
77656 <para>
77657 The <quote>dmarc_status</quote> condition takes a list of strings on its
77658 right-hand side.  These strings describe recommended action based
77659 on the DMARC check.  To understand what the policy recommendations
77660 mean, refer to the DMARC website above.  Valid strings are:
77661 </para>
77662 <informaltable frame="none">
77663 <tgroup cols="2" colsep="0" rowsep="0">
77664 <colspec colwidth="20*" align="left"/>
77665 <colspec colwidth="80*" align="left"/>
77666 <tbody>
77667 <row>
77668 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>accept</emphasis></entry>
77669 <entry>The DMARC check passed and the library recommends accepting the email</entry>
77670 </row>
77671 <row>
77672 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>reject</emphasis></entry>
77673 <entry>The DMARC check failed and the library recommends rejecting the email</entry>
77674 </row>
77675 <row>
77676 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>quarantine</emphasis></entry>
77677 <entry>The DMARC check failed and the library recommends keeping it for further inspection</entry>
77678 </row>
77679 <row>
77680 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>none</emphasis></entry>
77681 <entry>The DMARC check passed and the library recommends no specific action, neutral</entry>
77682 </row>
77683 <row>
77684 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>norecord</emphasis></entry>
77685 <entry>No policy section in the DMARC record for this RFC5322.From field</entry>
77686 </row>
77687 <row>
77688 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>nofrom</emphasis></entry>
77689 <entry>Unable to determine the domain of the sender</entry>
77690 </row>
77691 <row>
77692 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>temperror</emphasis></entry>
77693 <entry>Library error or dns error</entry>
77694 </row>
77695 <row>
77696 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>off</emphasis></entry>
77697 <entry>The DMARC check was disabled for this email</entry>
77698 </row>
77699 </tbody>
77700 </tgroup>
77701 </informaltable>
77702 <para>
77703 You can prefix each string with an exclamation mark to invert its
77704 meaning, for example "!accept" will match all results but
77705 "accept".  The string list is evaluated left-to-right in a
77706 short-circuit fashion.  When a string matches the outcome of the
77707 DMARC check, the condition succeeds.  If none of the listed
77708 strings matches the outcome of the DMARC check, the condition
77709 fails.
77710 </para>
77711 <para>
77712 Of course, you can also use any other lookup method that Exim
77713 supports, including LDAP, Postgres, MySQL, etc, as long as the
77714 result is a list of colon-separated strings.
77715 </para>
77716 <para>
77717 Performing the check sets up information used by the
77718 <option>authresults</option> expansion item.
77719 </para>
77720 <para>
77721 Several expansion variables are set before the DATA ACL is
77722 processed, and you can use them in this ACL.  The following
77723 expansion variables are available:
77724 </para>
77725 <variablelist>
77726 <varlistentry>
77727 <term><varname>$dmarc_status</varname></term>
77728 <listitem>
77729 <para>
77730 <indexterm role="variable">
77731 <primary><varname>$dmarc_status</varname></primary>
77732 </indexterm>
77733 <indexterm role="concept">
77734 <primary>DMARC</primary>
77735 <secondary>result</secondary>
77736 </indexterm>
77737 A one word status indicating what the DMARC library
77738 thinks of the email.  It is a combination of the results of
77739 DMARC record lookup and the SPF/DKIM/DMARC processing results
77740 (if a DMARC record was found).  The actual policy declared
77741 in the DMARC record is in a separate expansion variable.
77742 </para>
77743 </listitem></varlistentry>
77744 <varlistentry>
77745 <term><varname>$dmarc_status_text</varname></term>
77746 <listitem>
77747 <para>
77748 <indexterm role="variable">
77749 <primary><varname>$dmarc_status_text</varname></primary>
77750 </indexterm>
77751 Slightly longer, human readable status.
77752 </para>
77753 </listitem></varlistentry>
77754 <varlistentry>
77755 <term><varname>$dmarc_used_domain</varname></term>
77756 <listitem>
77757 <para>
77758 <indexterm role="variable">
77759 <primary><varname>$dmarc_used_domain</varname></primary>
77760 </indexterm>
77761 The domain which DMARC used to look up the DMARC policy record.
77762 </para>
77763 </listitem></varlistentry>
77764 <varlistentry>
77765 <term><varname>$dmarc_domain_policy</varname></term>
77766 <listitem>
77767 <para>
77768 <indexterm role="variable">
77769 <primary><varname>$dmarc_domain_policy</varname></primary>
77770 </indexterm>
77771 The policy declared in the DMARC record.  Valid values
77772 are "none", "reject" and "quarantine".  It is blank when there
77773 is any error, including no DMARC record.
77774 </para>
77775 </listitem></varlistentry>
77776 </variablelist>
77777 </section>
77778 <section id="SSECDMARCLOGGING">
77779 <title>Logging</title>
77780 <para>
77781 <indexterm role="concept">
77782 <primary>DMARC</primary>
77783 <secondary>logging</secondary>
77784 </indexterm>
77785 </para>
77786 <para>
77787 By default, Exim&#x2019;s DMARC configuration is intended to be
77788 non-intrusive and conservative.  To facilitate this, Exim will not
77789 create any type of logging files without explicit configuration by
77790 you, the admin.  Nor will Exim send out any emails/reports about
77791 DMARC issues without explicit configuration by you, the admin (other
77792 than typical bounce messages that may come about due to ACL
77793 processing or failure delivery issues).
77794 </para>
77795 <para>
77796 In order to log statistics suitable to be imported by the opendmarc
77797 tools, you need to:
77798 </para>
77799 <itemizedlist>
77800 <listitem>
77801 <para>
77802 Configure the global option <option>dmarc_history_file</option>
77803 </para>
77804 </listitem>
77805 <listitem>
77806 <para>
77807 Configure cron jobs to call the appropriate opendmarc history
77808 import scripts and truncating the dmarc_history_file
77809 </para>
77810 </listitem>
77811 </itemizedlist>
77812 <para>
77813 In order to send forensic reports, you need to:
77814 </para>
77815 <itemizedlist>
77816 <listitem>
77817 <para>
77818 Configure the global option <option>dmarc_forensic_sender</option>
77819 </para>
77820 </listitem>
77821 <listitem>
77822 <para>
77823 Configure, somewhere before the DATA ACL, the control option to
77824 enable sending DMARC forensic reports
77825 </para>
77826 </listitem>
77827 </itemizedlist>
77828 </section>
77829 <section id="SSECDMARCEXAMPLE">
77830 <title>Example</title>
77831 <para>
77832 <indexterm role="concept">
77833 <primary>DMARC</primary>
77834 <secondary>example</secondary>
77835 </indexterm>
77836 </para>
77837 <para>
77838 Example usage:
77839 </para>
77840 <literallayout class="monospaced">
77841 (RCPT ACL)
77842   warn    domains        = +local_domains
77843           hosts          = +local_hosts
77844           control        = dmarc_disable_verify
77845
77846   warn    !domains       = +screwed_up_dmarc_records
77847           control        = dmarc_enable_forensic
77848
77849   warn    condition      = (lookup if destined to mailing list)
77850           set acl_m_mailing_list = 1
77851
77852 (DATA ACL)
77853   warn    dmarc_status   = accept : none : off
77854           !authenticated = *
77855           log_message    = DMARC DEBUG: $dmarc_status $dmarc_used_domain
77856
77857   warn    dmarc_status   = !accept
77858           !authenticated = *
77859           log_message    = DMARC DEBUG: '$dmarc_status' for $dmarc_used_domain
77860
77861   warn    dmarc_status   = quarantine
77862           !authenticated = *
77863           set $acl_m_quarantine = 1
77864           # Do something in a transport with this flag variable
77865
77866   deny    condition      = ${if eq{$dmarc_domain_policy}{reject}}
77867           condition      = ${if eq{$acl_m_mailing_list}{1}}
77868           message        = Messages from $dmarc_used_domain break mailing lists
77869
77870   deny    dmarc_status   = reject
77871           !authenticated = *
77872           message        = Message from $dmarc_used_domain failed sender's DMARC policy, REJECT
77873
77874   warn    add_header     = :at_start:${authresults {$primary_hostname}}
77875 </literallayout>
77876 </section>
77877 </section>
77878 </chapter>
77879
77880 <chapter id="CHAPproxies">
77881 <title>Proxies</title>
77882 <titleabbrev>Proxy support</titleabbrev>
77883 <para>
77884 <indexterm role="concept">
77885 <primary>proxy support</primary>
77886 </indexterm>
77887 <indexterm role="concept">
77888 <primary>proxy</primary>
77889 <secondary>access via</secondary>
77890 </indexterm>
77891 </para>
77892 <para>
77893 A proxy is an intermediate system through which communication is passed.
77894 Proxies may provide a security, availability or load-distribution function.
77895 </para>
77896 <section id="SECTproxyInbound">
77897 <title>Inbound proxies</title>
77898 <para>
77899 <indexterm role="concept">
77900 <primary>proxy</primary>
77901 <secondary>inbound</secondary>
77902 </indexterm>
77903 <indexterm role="concept">
77904 <primary>proxy</primary>
77905 <secondary>server side</secondary>
77906 </indexterm>
77907 <indexterm role="concept">
77908 <primary>proxy</primary>
77909 <secondary>Proxy protocol</secondary>
77910 </indexterm>
77911 <indexterm role="concept">
77912 <primary>Proxy protocol</primary>
77913 <secondary>proxy</secondary>
77914 </indexterm>
77915 </para>
77916 <para>
77917 Exim has support for receiving inbound SMTP connections via a proxy
77918 that uses <quote>Proxy Protocol</quote> to speak to it.
77919 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
77920 in Local/Makefile.
77921 </para>
77922 <para>
77923 It was built on the HAProxy specification, found at
77924 <emphasis role="bold"><ulink url="https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt">https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt</ulink></emphasis>.
77925 </para>
77926 <para>
77927 The purpose of this facility is so that an application load balancer,
77928 such as HAProxy, can sit in front of several Exim servers
77929 to distribute load.
77930 Exim uses the local protocol communication with the proxy to obtain
77931 the remote SMTP system IP address and port information.
77932 There is no logging if a host passes or
77933 fails Proxy Protocol negotiation, but it can easily be determined and
77934 recorded in an ACL (example is below).
77935 </para>
77936 <para>
77937 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
77938 main configuration option to a hostlist; connections from these
77939 hosts will use Proxy Protocol.
77940 Exim supports both version 1 and version 2 of the Proxy Protocol and
77941 automatically determines which version is in use.
77942 </para>
77943 <para>
77944 The Proxy Protocol header is the first data received on a TCP connection
77945 and is inserted before any TLS-on-connect handshake from the client; Exim
77946 negotiates TLS between Exim-as-server and the remote client, not between
77947 Exim and the proxy server. The Proxy Protocol header must be received
77948 within <option>proxy_protocol_timeout</option>, which defaults to 3s.
77949 </para>
77950 <para>
77951 The following expansion variables are usable
77952 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
77953 of the proxy):
77954 </para>
77955 <informaltable frame="none">
77956 <tgroup cols="2" colsep="0" rowsep="0">
77957 <colspec colwidth="30*" align="left"/>
77958 <colspec colwidth="70*" align="left"/>
77959 <tbody>
77960 <row>
77961 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_external_address</entry>
77962 <entry>IP of host being proxied or IP of remote interface of proxy</entry>
77963 </row>
77964 <row>
77965 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_external_port</entry>
77966 <entry>Port of host being proxied or Port on remote interface of proxy</entry>
77967 </row>
77968 <row>
77969 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_local_address</entry>
77970 <entry>IP of proxy server inbound or IP of local interface of proxy</entry>
77971 </row>
77972 <row>
77973 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_local_port</entry>
77974 <entry>Port of proxy server inbound or Port on local interface of proxy</entry>
77975 </row>
77976 <row>
77977 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_session</entry>
77978 <entry>boolean: SMTP connection via proxy</entry>
77979 </row>
77980 </tbody>
77981 </tgroup>
77982 </informaltable>
77983 <para>
77984 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
77985 there was a protocol error.
77986 The variables <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>
77987 will have values for the actual client system, not the proxy.
77988 </para>
77989 <para>
77990 Since the real connections are all coming from the proxy, and the
77991 per host connection tracking is done before Proxy Protocol is
77992 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
77993 handle all of the parallel volume you expect per inbound proxy.
77994 With the option set so high, you lose the ability
77995 to protect your server from many connections from one IP.
77996 In order to prevent your server from overload, you
77997 need to add a per connection ratelimit to your connect ACL.
77998 A possible solution is:
77999 </para>
78000 <literallayout>
78001   # Set max number of connections per host
78002   LIMIT   = 5
78003   # Or do some kind of IP lookup in a flat file or database
78004   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
78005
78006   defer   ratelimit      = LIMIT / 5s / per_conn / strict
78007           message        = Too many connections from this IP right now
78008 </literallayout>
78009 </section>
78010 <section id="SECTproxySOCKS">
78011 <title>Outbound proxies</title>
78012 <para>
78013 <indexterm role="concept">
78014 <primary>proxy</primary>
78015 <secondary>outbound</secondary>
78016 </indexterm>
78017 <indexterm role="concept">
78018 <primary>proxy</primary>
78019 <secondary>client side</secondary>
78020 </indexterm>
78021 <indexterm role="concept">
78022 <primary>proxy</primary>
78023 <secondary>SOCKS</secondary>
78024 </indexterm>
78025 <indexterm role="concept">
78026 <primary>SOCKS</primary>
78027 <secondary>proxy</secondary>
78028 </indexterm>
78029 Exim has support for sending outbound SMTP via a proxy
78030 using a protocol called SOCKS5 (defined by RFC1928).
78031 The support can be optionally included by defining SUPPORT_SOCKS=yes in
78032 Local/Makefile.
78033 </para>
78034 <para>
78035 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
78036 on an smtp transport.
78037 The option value is expanded and should then be a list
78038 (colon-separated by default) of proxy specifiers.
78039 Each proxy specifier is a list
78040 (space-separated by default) where the initial element
78041 is an IP address and any subsequent elements are options.
78042 </para>
78043 <para>
78044 Options are a string &lt;name&gt;=&lt;value&gt;.
78045 The list of options is in the following table:
78046 </para>
78047 <informaltable frame="none">
78048 <tgroup cols="2" colsep="0" rowsep="0">
78049 <colspec colwidth="10*" align="left"/>
78050 <colspec colwidth="90*" align="left"/>
78051 <tbody>
78052 <row>
78053 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>auth</emphasis></entry>
78054 <entry>authentication method</entry>
78055 </row>
78056 <row>
78057 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>name</emphasis></entry>
78058 <entry>authentication username</entry>
78059 </row>
78060 <row>
78061 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>pass</emphasis></entry>
78062 <entry>authentication password</entry>
78063 </row>
78064 <row>
78065 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>port</emphasis></entry>
78066 <entry>tcp port</entry>
78067 </row>
78068 <row>
78069 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>tmo</emphasis></entry>
78070 <entry>connection timeout</entry>
78071 </row>
78072 <row>
78073 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>pri</emphasis></entry>
78074 <entry>priority</entry>
78075 </row>
78076 <row>
78077 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>weight</emphasis></entry>
78078 <entry>selection bias</entry>
78079 </row>
78080 </tbody>
78081 </tgroup>
78082 </informaltable>
78083 <para>
78084 More details on each of these options follows:
78085 </para>
78086 <itemizedlist>
78087 <listitem>
78088 <para>
78089 <indexterm role="concept">
78090 <primary>authentication</primary>
78091 <secondary>to proxy</secondary>
78092 </indexterm>
78093 <indexterm role="concept">
78094 <primary>proxy</primary>
78095 <secondary>authentication</secondary>
78096 </indexterm>
78097 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
78098 Using <quote>name</quote> selects username/password authentication per RFC 1929
78099 for access to the proxy.
78100 Default is <quote>none</quote>.
78101 </para>
78102 </listitem>
78103 <listitem>
78104 <para>
78105 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
78106 Default is empty.
78107 </para>
78108 </listitem>
78109 <listitem>
78110 <para>
78111 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
78112 Default is empty.
78113 </para>
78114 </listitem>
78115 <listitem>
78116 <para>
78117 <option>port</option>: the TCP port number to use for the connection to the proxy.
78118 Default is 1080.
78119 </para>
78120 </listitem>
78121 <listitem>
78122 <para>
78123 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
78124 Default is 5.
78125 </para>
78126 </listitem>
78127 <listitem>
78128 <para>
78129 <option>pri</option>: specifies a priority for the proxy within the list,
78130 higher values being tried first.
78131 The default priority is 1.
78132 </para>
78133 </listitem>
78134 <listitem>
78135 <para>
78136 <option>weight</option>: specifies a selection bias.
78137 Within a priority set servers are queried in a random fashion,
78138 weighted by this value.
78139 The default value for selection bias is 1.
78140 </para>
78141 </listitem>
78142 </itemizedlist>
78143 <para>
78144 Proxies from the list are tried according to their priority
78145 and weight settings until one responds.  The timeout for the
78146 overall connection applies to the set of proxied attempts.
78147 </para>
78148 </section>
78149 <section id="SECTproxyLog">
78150 <title>Logging</title>
78151 <para>
78152 To log the (local) IP of a proxy in the incoming or delivery logline,
78153 add <quote>+proxy</quote> to the <option>log_selector</option> option.
78154 This will add a component tagged with <quote>PRX=</quote> to the line.
78155 </para>
78156 </section>
78157 </chapter>
78158
78159 <chapter id="CHAPi18n">
78160 <title>Internationalisation</title>
78161 <titleabbrev>Internationalisation"</titleabbrev>
78162 <para>
78163 <indexterm role="concept">
78164 <primary>internationalisation</primary>
78165 <secondary>email address</secondary>
78166 </indexterm>
78167 <indexterm role="concept">
78168 <primary>EAI</primary>
78169 </indexterm>
78170 <indexterm role="concept">
78171 <primary>i18n</primary>
78172 </indexterm>
78173 <indexterm role="concept">
78174 <primary>utf8</primary>
78175 <secondary>mail name handling</secondary>
78176 </indexterm>
78177 </para>
78178 <para>
78179 Exim has support for Internationalised mail names.
78180 To include this it must be built with SUPPORT_I18N and the libidn library.
78181 Standards supported are RFCs 2060, 5890, 6530 and 6533.
78182 </para>
78183 <para>
78184 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
78185 instead of it) then IDNA2008 is supported; this adds an extra library
78186 requirement, upon libidn2.
78187 </para>
78188 <section id="SECTi18nMTA">
78189 <title>MTA operations</title>
78190 <para>
78191 <indexterm role="concept">
78192 <primary>SMTPUTF8</primary>
78193 <secondary>ESMTP option</secondary>
78194 </indexterm>
78195 <indexterm role="concept">
78196 <primary>ESMTP extensions</primary>
78197 <secondary>SMTPUTF8</secondary>
78198 </indexterm>
78199 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
78200 a host list.  If this matches the sending host and
78201 accept_8bitmime is true (the default) then the ESMTP option
78202 SMTPUTF8 will be advertised.
78203 </para>
78204 <para>
78205 If the sender specifies the SMTPUTF8 option on a MAIL command
78206 international handling for the message is enabled and
78207 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
78208 </para>
78209 <para>
78210 The option <option>allow_utf8_domains</option> is set to true for this
78211 message. All DNS lookups are converted to a-label form
78212 whatever the setting of <option>allow_utf8_domains</option>
78213 when Exim is built with SUPPORT_I18N.
78214 </para>
78215 <para>
78216 Both localparts and domain are maintained as the original
78217 UTF-8 form internally; any comparison or regular-expression use will
78218 require appropriate care.  Filenames created, eg. by
78219 the appendfile transport, will have UTF-8 names.
78220 </para>
78221 <para>
78222 HELO names sent by the smtp transport will have any UTF-8
78223 components expanded to a-label form,
78224 and any certificate name checks will be done using the a-label
78225 form of the name.
78226 </para>
78227 <para>
78228 <indexterm role="concept">
78229 <primary>log</primary>
78230 <secondary>protocol</secondary>
78231 </indexterm>
78232 <indexterm role="concept">
78233 <primary>SMTPUTF8</primary>
78234 <secondary>logging</secondary>
78235 </indexterm>
78236 <indexterm role="concept">
78237 <primary>i18n</primary>
78238 <secondary>logging</secondary>
78239 </indexterm>
78240 Log lines and Received-by: header lines will acquire a "utf8"
78241 prefix on the protocol element, eg. utf8esmtp.
78242 </para>
78243 <para>
78244 The following expansion operators can be used:
78245 </para>
78246 <literallayout class="monospaced">
78247 ${utf8_domain_to_alabel:str}
78248 ${utf8_domain_from_alabel:str}
78249 ${utf8_localpart_to_alabel:str}
78250 ${utf8_localpart_from_alabel:str}
78251 </literallayout>
78252 <para>
78253 <indexterm role="concept">
78254 <primary>utf8</primary>
78255 <secondary>address downconversion</secondary>
78256 </indexterm>
78257 <indexterm role="concept">
78258 <primary>i18n</primary>
78259 <secondary>utf8 address downconversion</secondary>
78260 </indexterm>
78261 The RCPT ACL
78262 may use the following modifier:
78263 </para>
78264 <literallayout>
78265 control = utf8_downconvert
78266 control = utf8_downconvert/&lt;value&gt;
78267 </literallayout>
78268 <para>
78269 This sets a flag requiring that envelope addresses are converted to
78270 a-label form before smtp delivery.
78271 This is usually for use in a Message Submission Agent context,
78272 but could be used for any message.
78273 </para>
78274 <para>
78275 If a value is appended it may be:
78276 </para>
78277 <informaltable frame="none">
78278 <tgroup cols="2" colsep="0" rowsep="0">
78279 <colspec colwidth="5*" align="right"/>
78280 <colspec colwidth="95*" align="left"/>
78281 <tbody>
78282 <row>
78283 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>1</literal></entry>
78284 <entry>mandatory downconversion</entry>
78285 </row>
78286 <row>
78287 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>0</literal></entry>
78288 <entry>no downconversion</entry>
78289 </row>
78290 <row>
78291 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>-1</literal></entry>
78292 <entry>if SMTPUTF8 not supported by destination host</entry>
78293 </row>
78294 </tbody>
78295 </tgroup>
78296 </informaltable>
78297 <para>
78298 If no value is given, 1 is used.
78299 </para>
78300 <para>
78301 If mua_wrapper is set, the utf8_downconvert control
78302 is initially set to -1.
78303 </para>
78304 <para>
78305 The smtp transport has an option <option>utf8_downconvert</option>.
78306 If set it must expand to one of the three values described above,
78307 or an empty string.
78308 If non-empty it overrides value previously set
78309 (due to mua_wrapper or by an ACL control).
78310 </para>
78311 <para>
78312 There is no explicit support for VRFY and EXPN.
78313 Configurations supporting these should inspect
78314 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
78315 </para>
78316 <para>
78317 There is no support for LMTP on Unix sockets.
78318 Using the "lmtp" protocol option on an smtp transport,
78319 for LMTP over TCP, should work as expected.
78320 </para>
78321 <para>
78322 There is no support for DSN unitext handling,
78323 and no provision for converting logging from or to UTF-8.
78324 </para>
78325 </section>
78326 <section id="SECTi18nMDA">
78327 <title>MDA operations</title>
78328 <para>
78329 To aid in constructing names suitable for IMAP folders
78330 the following expansion operator can be used:
78331 </para>
78332 <literallayout class="monospaced">
78333 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
78334 </literallayout>
78335 <para>
78336 The string is converted from the charset specified by
78337 the "headers charset" command (in a filter file)
78338 or <option>headers_charset</option> main configuration option (otherwise),
78339 to the
78340 modified UTF-7 encoding specified by RFC 2060,
78341 with the following exception: All occurrences of &lt;sep&gt;
78342 (which has to be a single character)
78343 are replaced with periods ("."), and all periods and slashes that are not
78344 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
78345 </para>
78346 <para>
78347 The third argument can be omitted, defaulting to an empty string.
78348 The second argument can be omitted, defaulting to "/".
78349 </para>
78350 <para>
78351 This is the encoding used by Courier for Maildir names on disk, and followed
78352 by many other IMAP servers.
78353 </para>
78354 <para>
78355 Examples:
78356 </para>
78357 <literallayout>
78358 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
78359 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
78360 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
78361 </literallayout>
78362 <para>
78363 Note that the source charset setting is vital, and also that characters
78364 must be representable in UTF-16.
78365 </para>
78366 </section>
78367 </chapter>
78368
78369 <chapter id="CHAPevents">
78370 <title>Events</title>
78371 <titleabbrev>Events</titleabbrev>
78372 <para>
78373 <indexterm role="concept">
78374 <primary>events</primary>
78375 </indexterm>
78376 </para>
78377 <para>
78378 The events mechanism in Exim can be used to intercept processing at a number
78379 of points.  It was originally invented to give a way to do customised logging
78380 actions (for example, to a database) but can also be used to modify some
78381 processing actions.
78382 </para>
78383 <para>
78384 Most installations will never need to use Events.
78385 The support can be left out of a build by defining DISABLE_EVENT=yes
78386 in <filename>Local/Makefile</filename>.
78387 </para>
78388 <para>
78389 There are two major classes of events: main and transport.
78390 The main configuration option <option>event_action</option> controls reception events;
78391 a transport option <option>event_action</option> controls delivery events.
78392 </para>
78393 <para>
78394 Both options are a string which is expanded when the event fires.
78395 An example might look like:
78396 <indexterm role="concept">
78397 <primary>logging</primary>
78398 <secondary>custom</secondary>
78399 </indexterm>
78400 </para>
78401 <literallayout class="monospaced">
78402 event_action = ${if eq {msg:delivery}{$event_name} \
78403 {${lookup pgsql {SELECT * FROM record_Delivery( \
78404     '${quote_pgsql:$sender_address_domain}',\
78405     '${quote_pgsql:${lc:$sender_address_local_part}}', \
78406     '${quote_pgsql:$domain}', \
78407     '${quote_pgsql:${lc:$local_part}}', \
78408     '${quote_pgsql:$host_address}', \
78409     '${quote_pgsql:${lc:$host}}', \
78410     '${quote_pgsql:$message_exim_id}')}} \
78411 } {}}
78412 </literallayout>
78413 <para>
78414 Events have names which correspond to the point in process at which they fire.
78415 The name is placed in the variable <varname>$event_name</varname> and the event action
78416 expansion must check this, as it will be called for every possible event type.
78417 </para>
78418 <para>
78419 The current list of events is:
78420 </para>
78421 <informaltable frame="all">
78422 <tgroup cols="4" colsep="0" rowsep="0">
78423 <colspec colwidth="25*" align="left"/>
78424 <colspec colwidth="10*" align="center"/>
78425 <colspec colwidth="15*" align="center"/>
78426 <colspec colwidth="50*" align="left"/>
78427 <tbody>
78428 <row>
78429 <entry>auth:fail</entry>
78430 <entry>after</entry>
78431 <entry>both</entry>
78432 <entry>per driver per authentication attempt</entry>
78433 </row>
78434 <row>
78435 <entry>dane:fail</entry>
78436 <entry>after</entry>
78437 <entry>transport</entry>
78438 <entry>per connection</entry>
78439 </row>
78440 <row>
78441 <entry>msg:complete</entry>
78442 <entry>after</entry>
78443 <entry>main</entry>
78444 <entry>per message</entry>
78445 </row>
78446 <row>
78447 <entry>msg:defer</entry>
78448 <entry>after</entry>
78449 <entry>transport</entry>
78450 <entry>per message per delivery try</entry>
78451 </row>
78452 <row>
78453 <entry>msg:delivery</entry>
78454 <entry>after</entry>
78455 <entry>transport</entry>
78456 <entry>per recipient</entry>
78457 </row>
78458 <row>
78459 <entry>msg:rcpt:host:defer</entry>
78460 <entry>after</entry>
78461 <entry>transport</entry>
78462 <entry>per recipient per host</entry>
78463 </row>
78464 <row>
78465 <entry>msg:rcpt:defer</entry>
78466 <entry>after</entry>
78467 <entry>transport</entry>
78468 <entry>per recipient</entry>
78469 </row>
78470 <row>
78471 <entry>msg:host:defer</entry>
78472 <entry>after</entry>
78473 <entry>transport</entry>
78474 <entry>per host per delivery try; host errors</entry>
78475 </row>
78476 <row>
78477 <entry>msg:fail:delivery</entry>
78478 <entry>after</entry>
78479 <entry>transport</entry>
78480 <entry>per recipient</entry>
78481 </row>
78482 <row>
78483 <entry>msg:fail:internal</entry>
78484 <entry>after</entry>
78485 <entry>main</entry>
78486 <entry>per recipient</entry>
78487 </row>
78488 <row>
78489 <entry>tcp:connect</entry>
78490 <entry>before</entry>
78491 <entry>transport</entry>
78492 <entry>per connection</entry>
78493 </row>
78494 <row>
78495 <entry>tcp:close</entry>
78496 <entry>after</entry>
78497 <entry>transport</entry>
78498 <entry>per connection</entry>
78499 </row>
78500 <row>
78501 <entry>tls:cert</entry>
78502 <entry>before</entry>
78503 <entry>both</entry>
78504 <entry>per certificate in verification chain</entry>
78505 </row>
78506 <row>
78507 <entry>tls:fail:connect</entry>
78508 <entry>after</entry>
78509 <entry>main</entry>
78510 <entry>per connection</entry>
78511 </row>
78512 <row>
78513 <entry>smtp:connect</entry>
78514 <entry>after</entry>
78515 <entry>transport</entry>
78516 <entry>per connection</entry>
78517 </row>
78518 <row>
78519 <entry>smtp:ehlo</entry>
78520 <entry>after</entry>
78521 <entry>transport</entry>
78522 <entry>per connection</entry>
78523 </row>
78524 </tbody>
78525 </tgroup>
78526 </informaltable>
78527 <para>
78528 New event types may be added in future.
78529 </para>
78530 <para>
78531 The event name is a colon-separated list, defining the type of
78532 event in a tree of possibilities.  It may be used as a list
78533 or just matched on as a whole.  There will be no spaces in the name.
78534 </para>
78535 <para>
78536 The second column in the table above describes whether the event fires
78537 before or after the action is associates with.  Those which fire before
78538 can be used to affect that action (more on this below).
78539 </para>
78540 <para>
78541 The third column in the table above says what section of the configuration
78542 should define the event action.
78543 </para>
78544 <para>
78545 An additional variable, <varname>$event_data</varname>, is filled with information varying
78546 with the event type:
78547 </para>
78548 <informaltable frame="all">
78549 <tgroup cols="2" colsep="0" rowsep="0">
78550 <colspec colwidth="20*" align="left"/>
78551 <colspec colwidth="80*" align="left"/>
78552 <tbody>
78553 <row>
78554 <entry>auth:fail</entry>
78555 <entry>smtp response</entry>
78556 </row>
78557 <row>
78558 <entry>dane:fail</entry>
78559 <entry>failure reason</entry>
78560 </row>
78561 <row>
78562 <entry>msg:defer</entry>
78563 <entry>error string</entry>
78564 </row>
78565 <row>
78566 <entry>msg:delivery</entry>
78567 <entry>smtp confirmation message</entry>
78568 </row>
78569 <row>
78570 <entry>msg:fail:internal</entry>
78571 <entry>failure reason</entry>
78572 </row>
78573 <row>
78574 <entry>msg:fail:delivery</entry>
78575 <entry>smtp error message</entry>
78576 </row>
78577 <row>
78578 <entry>msg:host:defer</entry>
78579 <entry>error string</entry>
78580 </row>
78581 <row>
78582 <entry>msg:rcpt:host:defer</entry>
78583 <entry>error string</entry>
78584 </row>
78585 <row>
78586 <entry>msg:rcpt:defer</entry>
78587 <entry>error string</entry>
78588 </row>
78589 <row>
78590 <entry>tls:cert</entry>
78591 <entry>verification chain depth</entry>
78592 </row>
78593 <row>
78594 <entry>tls:fail:connect</entry>
78595 <entry>error string</entry>
78596 </row>
78597 <row>
78598 <entry>smtp:connect</entry>
78599 <entry>smtp banner</entry>
78600 </row>
78601 <row>
78602 <entry>smtp:ehlo</entry>
78603 <entry>smtp ehlo response</entry>
78604 </row>
78605 </tbody>
78606 </tgroup>
78607 </informaltable>
78608 <para>
78609 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
78610 </para>
78611 <para>
78612 For complex operations an ACL expansion can be used in <option>event_action</option>,
78613 however due to the multiple contexts that Exim operates in during
78614 the course of its processing:
78615 </para>
78616 <itemizedlist>
78617 <listitem>
78618 <para>
78619 variables set in transport events will not be visible outside that
78620 transport call
78621 </para>
78622 </listitem>
78623 <listitem>
78624 <para>
78625 acl_m variables in a server context are lost on a new connection,
78626 and after smtp helo/ehlo/mail/starttls/rset commands
78627 </para>
78628 </listitem>
78629 </itemizedlist>
78630 <para>
78631 Using an ACL expansion with the logwrite modifier can be
78632 a useful way of writing to the main log.
78633 </para>
78634 <para>
78635 The expansion of the event_action option should normally
78636 return an empty string.  Should it return anything else the
78637 following will be forced:
78638 </para>
78639 <informaltable frame="all">
78640 <tgroup cols="2" colsep="0" rowsep="0">
78641 <colspec colwidth="20*" align="left"/>
78642 <colspec colwidth="80*" align="left"/>
78643 <tbody>
78644 <row>
78645 <entry>auth:fail</entry>
78646 <entry>log information to write</entry>
78647 </row>
78648 <row>
78649 <entry>tcp:connect</entry>
78650 <entry>do not connect</entry>
78651 </row>
78652 <row>
78653 <entry>tls:cert</entry>
78654 <entry>refuse verification</entry>
78655 </row>
78656 <row>
78657 <entry>smtp:connect</entry>
78658 <entry>close connection</entry>
78659 </row>
78660 </tbody>
78661 </tgroup>
78662 </informaltable>
78663 <para>
78664 All other message types ignore the result string, and
78665 no other use is made of it.
78666 </para>
78667 <para>
78668 For a tcp:connect event, if the connection is being made to a proxy
78669 then the <varname>$host_address</varname> and <varname>$host_port</varname> variables
78670 will be that of the proxy and not the target system.
78671 </para>
78672 <para>
78673 For tls:cert events, if GnuTLS is in use this will trigger only per
78674 chain element received on the connection.
78675 For OpenSSL it will trigger for every chain element including those
78676 loaded locally.
78677 </para>
78678 </chapter>
78679
78680 <chapter id="CHID13">
78681 <title>Adding new drivers or lookup types</title>
78682 <titleabbrev>Adding drivers or lookups</titleabbrev>
78683 <para>
78684 <indexterm role="concept">
78685 <primary>adding drivers</primary>
78686 </indexterm>
78687 <indexterm role="concept">
78688 <primary>new drivers, adding</primary>
78689 </indexterm>
78690 <indexterm role="concept">
78691 <primary>drivers</primary>
78692 <secondary>adding new</secondary>
78693 </indexterm>
78694 The following actions have to be taken in order to add a new router, transport,
78695 authenticator, or lookup type to Exim:
78696 </para>
78697 <orderedlist numeration="arabic">
78698 <listitem>
78699 <para>
78700 Choose a name for the driver or lookup type that does not conflict with any
78701 existing name; I will use <quote>newdriver</quote> in what follows.
78702 </para>
78703 </listitem>
78704 <listitem>
78705 <para>
78706 Add to <filename>src/EDITME</filename> the line:
78707 </para>
78708 <literallayout>
78709 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
78710 </literallayout>
78711 <para>
78712 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
78713 code is not to be included in the binary by default, comment this line out. You
78714 should also add any relevant comments about the driver or lookup type.
78715 </para>
78716 </listitem>
78717 <listitem>
78718 <para>
78719 Add to <filename>src/config.h.defaults</filename> the line:
78720 </para>
78721 <literallayout class="monospaced">
78722 #define &lt;type&gt;_NEWDRIVER
78723 </literallayout>
78724 </listitem>
78725 <listitem>
78726 <para>
78727 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
78728 and create a table entry as is done for all the other drivers and lookup types.
78729 </para>
78730 </listitem>
78731 <listitem>
78732 <para>
78733 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
78734 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
78735 Add your <literal>NEWDRIVER</literal> to that list.
78736 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
78737 simple form that most lookups have.
78738 </para>
78739 </listitem>
78740 <listitem>
78741 <para>
78742 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
78743 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
78744 driver or lookup type and add it to the definition of OBJ.
78745 </para>
78746 </listitem>
78747 <listitem>
78748 <para>
78749 Edit <filename>OS/Makefile-Base</filename> adding a <filename>.o</filename> file for the predefined-macros, to the
78750 definition of OBJ_MACRO.  Add a set of line to do the compile also.
78751 </para>
78752 </listitem>
78753 <listitem>
78754 <para>
78755 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
78756 <filename>src</filename>.
78757 </para>
78758 </listitem>
78759 <listitem>
78760 <para>
78761 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
78762 as for other drivers and lookups.
78763 </para>
78764 </listitem>
78765 </orderedlist>
78766 <para>
78767 Then all you need to do is write the code! A good way to start is to make a
78768 proforma by copying an existing module of the same type, globally changing all
78769 occurrences of the name, and cutting out most of the code. Note that any
78770 options you create must be listed in alphabetical order, because the tables are
78771 searched using a binary chop procedure.
78772 </para>
78773 <para>
78774 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
78775 the interface that is expected.
78776 </para>
78777 <?sdop
78778   format="newpage"
78779   foot_right_recto="&chaptertitle;"
78780   foot_right_verso="&chaptertitle;"
78781 ?>
78782 </chapter>
78783
78784 <index role="option">
78785 <title>Options index</title>
78786 </index>
78787
78788 <index role="variable">
78789 <title>Variables index</title>
78790 </index>
78791
78792 <index role="concept">
78793 <title>Concept index</title>
78794 </index>
78795
78796 </book>