Add 4.94.1, 4.94.2 and initial draft of CVE-2020-qualys
[exim-website.git] / docbook / 4.94.2 / 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 30 Apr 2021
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.94.2</revnumber>
22 <date>30 Apr 2021</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2020
27            </year><holder>University of Cambridge</holder></copyright>
28 </bookinfo>
29 <chapter id="CHID1">
30 <title>Introduction</title>
31
32 <indexterm role="variable">
33   <primary>$1, $2, etc.</primary>
34   <see><emphasis>numerical variables</emphasis></see>
35 </indexterm>
36 <indexterm role="concept">
37   <primary>address</primary>
38   <secondary>rewriting</secondary>
39   <see><emphasis>rewriting</emphasis></see>
40 </indexterm>
41 <indexterm role="concept">
42   <primary>Bounce Address Tag Validation</primary>
43   <see><emphasis>BATV</emphasis></see>
44 </indexterm>
45 <indexterm role="concept">
46   <primary>Client SMTP Authorization</primary>
47   <see><emphasis>CSA</emphasis></see>
48 </indexterm>
49 <indexterm role="concept">
50   <primary>CR character</primary>
51   <see><emphasis>carriage return</emphasis></see>
52 </indexterm>
53 <indexterm role="concept">
54   <primary>CRL</primary>
55   <see><emphasis>certificate revocation list</emphasis></see>
56 </indexterm>
57 <indexterm role="concept">
58   <primary>delivery</primary>
59   <secondary>failure report</secondary>
60   <see><emphasis>bounce message</emphasis></see>
61 </indexterm>
62 <indexterm role="concept">
63   <primary>dialup</primary>
64   <see><emphasis>intermittently connected hosts</emphasis></see>
65 </indexterm>
66 <indexterm role="concept">
67   <primary>exiscan</primary>
68   <see><emphasis>content scanning</emphasis></see>
69 </indexterm>
70 <indexterm role="concept">
71   <primary>failover</primary>
72   <see><emphasis>fallback</emphasis></see>
73 </indexterm>
74 <indexterm role="concept">
75   <primary>fallover</primary>
76   <see><emphasis>fallback</emphasis></see>
77 </indexterm>
78 <indexterm role="concept">
79   <primary>filter</primary>
80   <secondary>Sieve</secondary>
81   <see><emphasis>Sieve filter</emphasis></see>
82 </indexterm>
83 <indexterm role="concept">
84   <primary>ident</primary>
85   <see><emphasis>RFC 1413</emphasis></see>
86 </indexterm>
87 <indexterm role="concept">
88   <primary>LF character</primary>
89   <see><emphasis>linefeed</emphasis></see>
90 </indexterm>
91 <indexterm role="concept">
92   <primary>maximum</primary>
93   <seealso><emphasis>limit</emphasis></seealso>
94 </indexterm>
95 <indexterm role="concept">
96   <primary>monitor</primary>
97   <see><emphasis>Exim monitor</emphasis></see>
98 </indexterm>
99 <indexterm role="concept">
100   <primary>no_<emphasis>xxx</emphasis></primary>
101   <see>entry for xxx</see>
102 </indexterm>
103 <indexterm role="concept">
104   <primary>NUL</primary>
105   <see><emphasis>binary zero</emphasis></see>
106 </indexterm>
107 <indexterm role="concept">
108   <primary>passwd file</primary>
109   <see><emphasis>/etc/passwd</emphasis></see>
110 </indexterm>
111 <indexterm role="concept">
112   <primary>process id</primary>
113   <see><emphasis>pid</emphasis></see>
114 </indexterm>
115 <indexterm role="concept">
116   <primary>RBL</primary>
117   <see><emphasis>DNS list</emphasis></see>
118 </indexterm>
119 <indexterm role="concept">
120   <primary>redirection</primary>
121   <see><emphasis>address redirection</emphasis></see>
122 </indexterm>
123 <indexterm role="concept">
124   <primary>return path</primary>
125   <seealso><emphasis>envelope sender</emphasis></seealso>
126 </indexterm>
127 <indexterm role="concept">
128   <primary>scanning</primary>
129   <see><emphasis>content scanning</emphasis></see>
130 </indexterm>
131 <indexterm role="concept">
132   <primary>SSL</primary>
133   <see><emphasis>TLS</emphasis></see>
134 </indexterm>
135 <indexterm role="concept">
136   <primary>string</primary>
137   <secondary>expansion</secondary>
138   <see><emphasis>expansion</emphasis></see>
139 </indexterm>
140 <indexterm role="concept">
141   <primary>top bit</primary>
142   <see><emphasis>8-bit characters</emphasis></see>
143 </indexterm>
144 <indexterm role="concept">
145   <primary>variables</primary>
146   <see><emphasis>expansion, variables</emphasis></see>
147 </indexterm>
148 <indexterm role="concept">
149   <primary>zero, binary</primary>
150   <see><emphasis>binary zero</emphasis></see>
151 </indexterm>
152
153 <para>
154 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
155 Unix-like operating systems. It was designed on the assumption that it would be
156 run on hosts that are permanently connected to the Internet. However, it can be
157 used on intermittently connected hosts with suitable configuration adjustments.
158 </para>
159 <para>
160 Configuration files currently exist for the following operating systems: AIX,
161 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
162 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
163 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
164 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and UnixWare.
165 Some of these operating systems are no longer current and cannot easily be
166 tested, so the configuration files may no longer work in practice.
167 </para>
168 <para>
169 There are also configuration files for compiling Exim in the Cygwin environment
170 that can be installed on systems running Windows. However, this document does
171 not contain any information about running Exim in the Cygwin environment.
172 </para>
173 <para>
174 The terms and conditions for the use and distribution of Exim are contained in
175 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
176 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
177 </para>
178 <para>
179 The use, supply, or promotion of Exim for the purpose of sending bulk,
180 unsolicited electronic mail is incompatible with the basic aims of Exim,
181 which revolve around the free provision of a service that enhances the quality
182 of personal communications. The author of Exim regards indiscriminate
183 mass-mailing as an antisocial, irresponsible abuse of the Internet.
184 </para>
185 <para>
186 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
187 experience of running and working on the Smail 3 code, I could never have
188 contemplated starting to write a new MTA. Many of the ideas and user interfaces
189 were originally taken from Smail 3, though the actual code of Exim is entirely
190 new, and has developed far beyond the initial concept.
191 </para>
192 <para>
193 Many people, both in Cambridge and around the world, have contributed to the
194 development and the testing of Exim, and to porting it to various operating
195 systems. I am grateful to them all. The distribution now contains a file called
196 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
197 contributors.
198 </para>
199 <section id="SECID1">
200 <title>Exim documentation</title>
201 <para revisionflag="changed">
202 <indexterm role="concept">
203 <primary>documentation</primary>
204 </indexterm>
205 This edition of the Exim specification applies to version 4.94.2 of Exim.
206 Substantive changes from the 4.93 edition are marked in some
207 renditions of this document; this paragraph is so marked if the rendition is
208 capable of showing a change indicator.
209 </para>
210 <para>
211 This document is very much a reference manual; it is not a tutorial. The reader
212 is expected to have some familiarity with the SMTP mail transfer protocol and
213 with general Unix system administration. Although there are some discussions
214 and examples in places, the information is mostly organized in a way that makes
215 it easy to look up, rather than in a natural order for sequential reading.
216 Furthermore, this manual aims to cover every aspect of Exim in detail, including
217 a number of rarely-used, special-purpose features that are unlikely to be of
218 very wide interest.
219 </para>
220 <para>
221 <indexterm role="concept">
222 <primary>books about Exim</primary>
223 </indexterm>
224 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
225 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
226 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
227 (<emphasis role="bold"><ulink url="https://www.uit.co.uk/exim-book/">https://www.uit.co.uk/exim-book/</ulink></emphasis>).
228 </para>
229 <para>
230 The book also contains a chapter that gives a general introduction to SMTP and
231 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
232 with the latest release of Exim. (Note that the earlier book about Exim,
233 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
234 </para>
235 <para>
236 <indexterm role="concept">
237 <primary>Debian</primary>
238 <secondary>information sources</secondary>
239 </indexterm>
240 If you are using a Debian distribution of Exim, you will find information about
241 Debian-specific features in the file
242 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
243 The command <command>man update-exim.conf</command> is another source of Debian-specific
244 information.
245 </para>
246 <para>
247 <indexterm role="concept">
248 <primary><filename>doc/NewStuff</filename></primary>
249 </indexterm>
250 <indexterm role="concept">
251 <primary><filename>doc/ChangeLog</filename></primary>
252 </indexterm>
253 <indexterm role="concept">
254 <primary>change log</primary>
255 </indexterm>
256 As Exim develops, there may be features in newer versions that have not
257 yet made it into this document, which is updated only when the most significant
258 digit of the fractional part of the version number changes. Specifications of
259 new features that are not yet in this manual are placed in the file
260 <filename>doc/NewStuff</filename> in the Exim distribution.
261 </para>
262 <para>
263 Some features may be classified as <quote>experimental</quote>. These may change
264 incompatibly while they are developing, or even be withdrawn. For this reason,
265 they are not documented in this manual. Information about experimental features
266 can be found in the file <filename>doc/experimental.txt</filename>.
267 </para>
268 <para>
269 All changes to Exim (whether new features, bug fixes, or other kinds of
270 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
271 </para>
272 <para>
273 <indexterm role="concept">
274 <primary><filename>doc/spec.txt</filename></primary>
275 </indexterm>
276 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
277 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
278 directory are:
279 </para>
280 <informaltable frame="none">
281 <tgroup cols="2" colsep="0" rowsep="0">
282 <colspec colwidth="100pt" align="left"/>
283 <colspec colwidth="254pt" align="left"/>
284 <tbody>
285 <row>
286 <entry><filename>OptionLists.txt</filename></entry>
287 <entry>list of all options in alphabetical order</entry>
288 </row>
289 <row>
290 <entry><filename>dbm.discuss.txt</filename></entry>
291 <entry>discussion about DBM libraries</entry>
292 </row>
293 <row>
294 <entry><filename>exim.8</filename></entry>
295 <entry>a man page of Exim&#x2019;s command line options</entry>
296 </row>
297 <row>
298 <entry><filename>experimental.txt</filename></entry>
299 <entry>documentation of experimental features</entry>
300 </row>
301 <row>
302 <entry><filename>filter.txt</filename></entry>
303 <entry>specification of the filter language</entry>
304 </row>
305 <row>
306 <entry><filename>Exim3.upgrade</filename></entry>
307 <entry>upgrade notes from release 2 to release 3</entry>
308 </row>
309 <row>
310 <entry><filename>Exim4.upgrade</filename></entry>
311 <entry>upgrade notes from release 3 to release 4</entry>
312 </row>
313 <row>
314 <entry><filename>openssl.txt</filename></entry>
315 <entry>installing a current OpenSSL release</entry>
316 </row>
317 </tbody>
318 </tgroup>
319 </informaltable>
320 <para>
321 The main specification and the specification of the filtering language are also
322 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
323 <xref linkend="SECTavail"/> below tells you how to get hold of these.
324 </para>
325 </section>
326 <section id="SECID2">
327 <title>FTP site and websites</title>
328 <para>
329 <indexterm role="concept">
330 <primary>website</primary>
331 </indexterm>
332 <indexterm role="concept">
333 <primary>FTP site</primary>
334 </indexterm>
335 The primary site for Exim source distributions is the <option>exim.org</option> FTP site,
336 available over HTTPS, HTTP and FTP.  These services, and the <option>exim.org</option>
337 website, are hosted at the University of Cambridge.
338 </para>
339 <para>
340 <indexterm role="concept">
341 <primary>wiki</primary>
342 </indexterm>
343 <indexterm role="concept">
344 <primary>FAQ</primary>
345 </indexterm>
346 As well as Exim distribution tar files, the Exim website contains a number of
347 differently formatted versions of the documentation. A recent addition to the
348 online information is the Exim wiki (<emphasis role="bold"><ulink url="https://wiki.exim.org">https://wiki.exim.org</ulink></emphasis>),
349 which contains what used to be a separate FAQ, as well as various other
350 examples, tips, and know-how that have been contributed by Exim users.
351 The wiki site should always redirect to the correct place, which is currently
352 provided by GitHub, and is open to editing by anyone with a GitHub account.
353 </para>
354 <para>
355 <indexterm role="concept">
356 <primary>Bugzilla</primary>
357 </indexterm>
358 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>. You can use
359 this to report bugs, and also to add items to the wish list. Please search
360 first to check that you are not duplicating a previous entry.
361 Please do not ask for configuration help in the bug-tracker.
362 </para>
363 </section>
364 <section id="SECID3">
365 <title>Mailing lists</title>
366 <para>
367 <indexterm role="concept">
368 <primary>mailing lists</primary>
369 <secondary>for Exim users</secondary>
370 </indexterm>
371 The following Exim mailing lists exist:
372 </para>
373 <informaltable frame="none">
374 <tgroup cols="2" colsep="0" rowsep="0">
375 <colspec colwidth="140pt" align="left"/>
376 <colspec colwidth="254pt" align="left"/>
377 <tbody>
378 <row>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-users@exim.org</emphasis></entry>
384 <entry>General discussion list</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
388 <entry>Discussion of bugs, enhancements, etc.</entry>
389 </row>
390 <row>
391 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
392 <entry>Automated commit messages from the VCS</entry>
393 </row>
394 </tbody>
395 </tgroup>
396 </informaltable>
397 <para>
398 You can subscribe to these lists, change your existing subscriptions, and view
399 or search the archives via the mailing lists link on the Exim home page.
400 <indexterm role="concept">
401 <primary>Debian</primary>
402 <secondary>mailing list for</secondary>
403 </indexterm>
404 If you are using a Debian distribution of Exim, you may wish to subscribe to
405 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
406 via this web page:
407 </para>
408 <literallayout>
409 <emphasis role="bold"><ulink url="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>
410 </literallayout>
411 <para>
412 Please ask Debian-specific questions on that list and not on the general Exim
413 lists.
414 </para>
415 </section>
416 <section id="SECID5">
417 <title>Bug reports</title>
418 <para>
419 <indexterm role="concept">
420 <primary>bug reports</primary>
421 </indexterm>
422 <indexterm role="concept">
423 <primary>reporting bugs</primary>
424 </indexterm>
425 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
426 via the Bugzilla (<emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>). However, if you are unsure
427 whether some behaviour is a bug or not, the best thing to do is to post a
428 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
429 </para>
430 </section>
431 <section id="SECTavail">
432 <title>Where to find the Exim distribution</title>
433 <para>
434 <indexterm role="concept">
435 <primary>FTP site</primary>
436 </indexterm>
437 <indexterm role="concept">
438 <primary>HTTPS download site</primary>
439 </indexterm>
440 <indexterm role="concept">
441 <primary>distribution</primary>
442 <secondary>FTP site</secondary>
443 </indexterm>
444 <indexterm role="concept">
445 <primary>distribution</primary>
446 <secondary>https site</secondary>
447 </indexterm>
448 The master distribution site for the Exim distribution is
449 </para>
450 <literallayout>
451 <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis>
452 </literallayout>
453 <para>
454 The service is available over HTTPS, HTTP and FTP.
455 We encourage people to migrate to HTTPS.
456 </para>
457 <para>
458 The content served at <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis> is identical to the
459 content served at <emphasis role="bold"><ulink url="https://ftp.exim.org/pub/exim">https://ftp.exim.org/pub/exim</ulink></emphasis> and
460 <emphasis role="bold"><ulink url="ftp://ftp.exim.org/pub/exim">ftp://ftp.exim.org/pub/exim</ulink></emphasis>.
461 </para>
462 <para>
463 If accessing via a hostname containing <emphasis>ftp</emphasis>, then the file references that
464 follow are relative to the <filename>exim</filename> directories at these sites.
465 If accessing via the hostname <emphasis>downloads</emphasis> then the subdirectories described
466 here are top-level directories.
467 </para>
468 <para>
469 There are now quite a number of independent mirror sites around
470 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
471 </para>
472 <para>
473 Within the top exim directory there are subdirectories called <filename>exim3</filename> (for
474 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
475 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
476 subdirectory, the current release can always be found in files called
477 </para>
478 <literallayout>
479 <filename>exim-n.nn.tar.xz</filename>
480 <filename>exim-n.nn.tar.gz</filename>
481 <filename>exim-n.nn.tar.bz2</filename>
482 </literallayout>
483 <para>
484 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The three
485 files contain identical data; the only difference is the type of compression.
486 The <filename>.xz</filename> file is usually the smallest, while the <filename>.gz</filename> file is the
487 most portable to old systems.
488 </para>
489 <para>
490 <indexterm role="concept">
491 <primary>distribution</primary>
492 <secondary>signing details</secondary>
493 </indexterm>
494 <indexterm role="concept">
495 <primary>distribution</primary>
496 <secondary>public key</secondary>
497 </indexterm>
498 <indexterm role="concept">
499 <primary>public key for signed distribution</primary>
500 </indexterm>
501 The distributions will be PGP signed by an individual key of the Release
502 Coordinator.  This key will have a uid containing an email address in the
503 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
504 other Exim maintainers.  We expect that the key will be in the "strong set" of
505 PGP keys.  There should be a trust path to that key from the Exim Maintainer&#x2019;s
506 PGP keys, a version of which can be found in the release directory in the file
507 <filename>Exim-Maintainers-Keyring.asc</filename>.  All keys used will be available in public keyserver pools,
508 such as <emphasis>pool.sks-keyservers.net</emphasis>.
509 </para>
510 <para>
511 At the time of the last update, releases were being made by Jeremy Harris and signed
512 with key <emphasis>0xBCE58C8CE41F32DF</emphasis>.  Other recent keys used for signing are those
513 of Heiko Schlittermann, <emphasis>0x26101B62F69376CE</emphasis>,
514 and of Phil Pennock, <emphasis>0x4D1E900E14C1CC04</emphasis>.
515 </para>
516 <para>
517 The signatures for the tar bundles are in:
518 </para>
519 <literallayout>
520 <filename>exim-n.nn.tar.xz.asc</filename>
521 <filename>exim-n.nn.tar.gz.asc</filename>
522 <filename>exim-n.nn.tar.bz2.asc</filename>
523 </literallayout>
524 <para>
525 For each released version, the log of changes is made available in a
526 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
527 find out what has changed without having to download the entire distribution.
528 </para>
529 <para>
530 <indexterm role="concept">
531 <primary>documentation</primary>
532 <secondary>available formats</secondary>
533 </indexterm>
534 The main distribution contains ASCII versions of this specification and other
535 documentation; other formats of the documents are available in separate files
536 inside the <filename>exim4</filename> directory of the FTP site:
537 </para>
538 <literallayout>
539 <filename>exim-html-n.nn.tar.gz</filename>
540 <filename>exim-pdf-n.nn.tar.gz</filename>
541 <filename>exim-postscript-n.nn.tar.gz</filename>
542 <filename>exim-texinfo-n.nn.tar.gz</filename>
543 </literallayout>
544 <para>
545 These tar files contain only the <filename>doc</filename> directory, not the complete
546 distribution, and are also available in <filename>.bz2</filename> and <filename>.xz</filename> forms.
547 </para>
548 </section>
549 <section id="SECID6">
550 <title>Limitations</title>
551 <itemizedlist>
552 <listitem>
553 <para>
554 <indexterm role="concept">
555 <primary>limitations of Exim</primary>
556 </indexterm>
557 <indexterm role="concept">
558 <primary>bang paths</primary>
559 <secondary>not handled by Exim</secondary>
560 </indexterm>
561 Exim is designed for use as an Internet MTA, and therefore handles addresses in
562 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
563 simple two-component bang paths can be converted by a straightforward rewriting
564 configuration. This restriction does not prevent Exim from being interfaced to
565 UUCP as a transport mechanism, provided that domain addresses are used.
566 </para>
567 </listitem>
568 <listitem>
569 <para>
570 <indexterm role="concept">
571 <primary>domainless addresses</primary>
572 </indexterm>
573 <indexterm role="concept">
574 <primary>address</primary>
575 <secondary>without domain</secondary>
576 </indexterm>
577 Exim insists that every address it handles has a domain attached. For incoming
578 local messages, domainless addresses are automatically qualified with a
579 configured domain value. Configuration options specify from which remote
580 systems unqualified addresses are acceptable. These are then qualified on
581 arrival.
582 </para>
583 </listitem>
584 <listitem>
585 <para>
586 <indexterm role="concept">
587 <primary>transport</primary>
588 <secondary>external</secondary>
589 </indexterm>
590 <indexterm role="concept">
591 <primary>external transports</primary>
592 </indexterm>
593 The only external transport mechanisms that are currently implemented are SMTP
594 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
595 transport is available, and there are facilities for writing messages to files
596 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
597 to send messages to other transport mechanisms such as UUCP, provided they can
598 handle domain-style addresses. Batched SMTP input is also catered for.
599 </para>
600 </listitem>
601 <listitem>
602 <para>
603 Exim is not designed for storing mail for dial-in hosts. When the volumes of
604 such mail are large, it is better to get the messages <quote>delivered</quote> into files
605 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
606 other means.
607 </para>
608 </listitem>
609 <listitem>
610 <para>
611 Although Exim does have basic facilities for scanning incoming messages, these
612 are not comprehensive enough to do full virus or spam scanning. Such operations
613 are best carried out using additional specialized software packages. If you
614 compile Exim with the content-scanning extension, straightforward interfaces to
615 a number of common scanners are provided.
616 </para>
617 </listitem>
618 </itemizedlist>
619 </section>
620 <section id="SECID7">
621 <title>Runtime configuration</title>
622 <para>
623 Exim&#x2019;s runtime configuration is held in a single text file that is divided
624 into a number of sections. The entries in this file consist of keywords and
625 values, in the style of Smail 3 configuration files. A default configuration
626 file which is suitable for simple online installations is provided in the
627 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
628 </para>
629 </section>
630 <section id="SECID8">
631 <title>Calling interface</title>
632 <para>
633 <indexterm role="concept">
634 <primary>Sendmail compatibility</primary>
635 <secondary>command line interface</secondary>
636 </indexterm>
637 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
638 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
639 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
640 about Sendmail in order to run Exim. For actions other than sending messages,
641 Sendmail-compatible options also exist, but those that produce output (for
642 example, <option>-bp</option>, which lists the messages in the queue) do so in Exim&#x2019;s own
643 format. There are also some additional options that are compatible with Smail
644 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
645 documents all Exim&#x2019;s command line options. This information is automatically
646 made into the man page that forms part of the Exim distribution.
647 </para>
648 <para>
649 Control of messages in the queue can be done via certain privileged command
650 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
651 which displays current information in an X window, and which contains a menu
652 interface to Exim&#x2019;s command line administration options.
653 </para>
654 </section>
655 <section id="SECID9">
656 <title>Terminology</title>
657 <para>
658 <indexterm role="concept">
659 <primary>terminology definitions</primary>
660 </indexterm>
661 <indexterm role="concept">
662 <primary>body of message</primary>
663 <secondary>definition of</secondary>
664 </indexterm>
665 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
666 It is the last part of a message and is separated from the <emphasis>header</emphasis> (see
667 below) by a blank line.
668 </para>
669 <para>
670 <indexterm role="concept">
671 <primary>bounce message</primary>
672 <secondary>definition of</secondary>
673 </indexterm>
674 When a message cannot be delivered, it is normally returned to the sender in a
675 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
676 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
677 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
678 failure error report</quote>. Such messages have an empty sender address in the
679 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
680 rise to further bounce messages.
681 </para>
682 <para>
683 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
684 value which is used in the absence of any setting in the configuration. It may
685 also qualify an action which is taken unless a configuration setting specifies
686 otherwise.
687 </para>
688 <para>
689 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
690 destination cannot immediately take place for some reason (a remote host may be
691 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
692 until a later time.
693 </para>
694 <para>
695 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
696 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
697 the part of an email address following the @ sign.
698 </para>
699 <para>
700 <indexterm role="concept">
701 <primary>envelope, definition of</primary>
702 </indexterm>
703 <indexterm role="concept">
704 <primary>sender</primary>
705 <secondary>definition of</secondary>
706 </indexterm>
707 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
708 body. The envelope contains a sender address (to which bounce messages should
709 be delivered), and any number of recipient addresses. References to the
710 sender or the recipients of a message usually mean the addresses in the
711 envelope. An MTA uses these addresses for delivery, and for returning bounce
712 messages, not the addresses that appear in the header lines.
713 </para>
714 <para>
715 <indexterm role="concept">
716 <primary>message</primary>
717 <secondary>header, definition of</secondary>
718 </indexterm>
719 <indexterm role="concept">
720 <primary>header section</primary>
721 <secondary>definition of</secondary>
722 </indexterm>
723 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
724 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
725 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
726 indenting the continuations. The header is separated from the body by a blank
727 line.
728 </para>
729 <para>
730 <indexterm role="concept">
731 <primary>local part</primary>
732 <secondary>definition of</secondary>
733 </indexterm>
734 <indexterm role="concept">
735 <primary>domain</primary>
736 <secondary>definition of</secondary>
737 </indexterm>
738 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to the
739 part of an email address that precedes the @ sign. The part that follows the
740 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
741 </para>
742 <para>
743 <indexterm role="concept">
744 <primary>local delivery</primary>
745 <secondary>definition of</secondary>
746 </indexterm>
747 <indexterm role="concept">
748 <primary>remote delivery, definition of</primary>
749 </indexterm>
750 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
751 delivery to a file or a pipe on the local host from delivery by SMTP over
752 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
753 host it is running on are <emphasis>remote</emphasis>.
754 </para>
755 <para>
756 <indexterm role="concept">
757 <primary>return path</primary>
758 <secondary>definition of</secondary>
759 </indexterm>
760 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
761 message&#x2019;s envelope.
762 </para>
763 <para>
764 <indexterm role="concept">
765 <primary>queue</primary>
766 <secondary>definition of</secondary>
767 </indexterm>
768 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery
769 because this term is in widespread use in the context of MTAs. However, in
770 Exim&#x2019;s case, the reality is more like a pool than a queue, because there is
771 normally no ordering of waiting messages.
772 </para>
773 <para>
774 <indexterm role="concept">
775 <primary>queue runner</primary>
776 <secondary>definition of</secondary>
777 </indexterm>
778 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
779 and attempts to deliver those messages whose retry times have come. This term
780 is used by other MTAs and also relates to the command <option>runq</option>, but in Exim
781 the waiting messages are normally processed in an unpredictable order.
782 </para>
783 <para>
784 <indexterm role="concept">
785 <primary>spool directory</primary>
786 <secondary>definition of</secondary>
787 </indexterm>
788 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
789 messages in its queue &ndash; that is, those that it is in the process of
790 delivering. This should not be confused with the directory in which local
791 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
792 the Exim documentation, <quote>spool</quote> is always used in the first sense.
793 </para>
794 </section>
795 </chapter>
796
797 <chapter id="CHID2">
798 <title>Incorporated code</title>
799 <para>
800 <indexterm role="concept">
801 <primary>incorporated code</primary>
802 </indexterm>
803 <indexterm role="concept">
804 <primary>regular expressions</primary>
805 <secondary>library</secondary>
806 </indexterm>
807 <indexterm role="concept">
808 <primary>PCRE</primary>
809 </indexterm>
810 <indexterm role="concept">
811 <primary>OpenDMARC</primary>
812 </indexterm>
813 A number of pieces of external code are included in the Exim distribution.
814 </para>
815 <itemizedlist>
816 <listitem>
817 <para>
818 Regular expressions are supported in the main Exim program and in the
819 Exim monitor using the freely-distributable PCRE library, copyright
820 &copy; University of Cambridge. The source to PCRE is no longer shipped with
821 Exim, so you will need to use the version of PCRE shipped with your system,
822 or obtain and install the full version of the library from
823 <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
824 </para>
825 </listitem>
826 <listitem>
827 <para>
828 <indexterm role="concept">
829 <primary>cdb</primary>
830 <secondary>acknowledgment</secondary>
831 </indexterm>
832 Support for the cdb (Constant DataBase) lookup method is provided by code
833 contributed by Nigel Metheringham of (at the time he contributed it) Planet
834 Online Ltd. The implementation is completely contained within the code of Exim.
835 It does not link against an external cdb library. The code contains the
836 following statements:
837 </para>
838 <blockquote>
839 <para>
840 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
841 </para>
842 <para>
843 This program is free software; you can redistribute it and/or modify it under
844 the terms of the GNU General Public License as published by the Free Software
845 Foundation; either version 2 of the License, or (at your option) any later
846 version.
847 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
848 the spec and sample code for cdb can be obtained from
849 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>. This implementation borrows
850 some code from Dan Bernstein&#x2019;s implementation (which has no license
851 restrictions applied to it).
852 </para>
853 </blockquote>
854 </listitem>
855 <listitem>
856 <para>
857 <indexterm role="concept">
858 <primary>SPA authentication</primary>
859 </indexterm>
860 <indexterm role="concept">
861 <primary>Samba project</primary>
862 </indexterm>
863 <indexterm role="concept">
864 <primary>Microsoft Secure Password Authentication</primary>
865 </indexterm>
866 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
867 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
868 Tom Kistner. This includes code taken from the Samba project, which is released
869 under the Gnu GPL.
870 </para>
871 </listitem>
872 <listitem>
873 <para>
874 <indexterm role="concept">
875 <primary>Cyrus</primary>
876 </indexterm>
877 <indexterm role="concept">
878 <primary><emphasis>pwcheck</emphasis> daemon</primary>
879 </indexterm>
880 <indexterm role="concept">
881 <primary><emphasis>pwauthd</emphasis> daemon</primary>
882 </indexterm>
883 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
884 by code taken from the Cyrus-SASL library and adapted by Alexander S.
885 Sabourenkov. The permission notice appears below, in accordance with the
886 conditions expressed therein.
887 </para>
888 <blockquote>
889 <para>
890 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
891 </para>
892 <para>
893 Redistribution and use in source and binary forms, with or without
894 modification, are permitted provided that the following conditions
895 are met:
896 </para>
897 <orderedlist numeration="arabic">
898 <listitem>
899 <para>
900 Redistributions of source code must retain the above copyright
901 notice, this list of conditions and the following disclaimer.
902 </para>
903 </listitem>
904 <listitem>
905 <para>
906 Redistributions in binary form must reproduce the above copyright
907 notice, this list of conditions and the following disclaimer in
908 the documentation and/or other materials provided with the
909 distribution.
910 </para>
911 </listitem>
912 <listitem>
913 <para>
914 The name <quote>Carnegie Mellon University</quote> must not be used to
915 endorse or promote products derived from this software without
916 prior written permission. For permission or any other legal
917 details, please contact
918 </para>
919 <literallayout>
920               Office of Technology Transfer
921               Carnegie Mellon University
922               5000 Forbes Avenue
923               Pittsburgh, PA  15213-3890
924               (412) 268-4387, fax: (412) 268-7395
925               tech-transfer@andrew.cmu.edu
926 </literallayout>
927 </listitem>
928 <listitem>
929 <para>
930 Redistributions of any form whatsoever must retain the following
931 acknowledgment:
932 </para>
933 <para>
934 <quote>This product includes software developed by Computing Services
935 at Carnegie Mellon University (<emphasis role="bold"><ulink url="https://www.cmu.edu/computing/">https://www.cmu.edu/computing/</ulink></emphasis>.</quote>
936 </para>
937 <para>
938 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
939 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
940 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
941 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
942 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
943 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
944 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
945 </para>
946 </listitem>
947 </orderedlist>
948 </blockquote>
949 </listitem>
950 <listitem>
951 <para>
952 <indexterm role="concept">
953 <primary>Exim monitor</primary>
954 <secondary>acknowledgment</secondary>
955 </indexterm>
956 <indexterm role="concept">
957 <primary>X-windows</primary>
958 </indexterm>
959 <indexterm role="concept">
960 <primary>Athena</primary>
961 </indexterm>
962 The Exim Monitor program, which is an X-Window application, includes
963 modified versions of the Athena StripChart and TextPop widgets.
964 This code is copyright by DEC and MIT, and their permission notice appears
965 below, in accordance with the conditions expressed therein.
966 </para>
967 <blockquote>
968 <para>
969 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
970 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
971 </para>
972 <para>
973 All Rights Reserved
974 </para>
975 <para>
976 Permission to use, copy, modify, and distribute this software and its
977 documentation for any purpose and without fee is hereby granted,
978 provided that the above copyright notice appear in all copies and that
979 both that copyright notice and this permission notice appear in
980 supporting documentation, and that the names of Digital or MIT not be
981 used in advertising or publicity pertaining to distribution of the
982 software without specific, written prior permission.
983 </para>
984 <para>
985 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
986 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
987 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
988 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
989 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
990 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
991 SOFTWARE.
992 </para>
993 </blockquote>
994 </listitem>
995 <listitem>
996 <para>
997 <indexterm role="concept">
998 <primary>opendmarc</primary>
999 <secondary>acknowledgment</secondary>
1000 </indexterm>
1001 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
1002 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
1003 derived code are indicated in the respective source files. The full OpenDMARC
1004 license is provided in the LICENSE.opendmarc file contained in the distributed
1005 source code.
1006 </para>
1007 </listitem>
1008 <listitem>
1009 <para>
1010 Many people have contributed code fragments, some large, some small, that were
1011 not covered by any specific license requirements. It is assumed that the
1012 contributors are happy to see their code incorporated into Exim under the GPL.
1013 </para>
1014 </listitem>
1015 </itemizedlist>
1016 </chapter>
1017
1018 <chapter id="CHID11">
1019 <title>How Exim receives and delivers mail</title>
1020 <titleabbrev>Receiving and delivering mail</titleabbrev>
1021 <section id="SECID10">
1022 <title>Overall philosophy</title>
1023 <para>
1024 <indexterm role="concept">
1025 <primary>design philosophy</primary>
1026 </indexterm>
1027 Exim is designed to work efficiently on systems that are permanently connected
1028 to the Internet and are handling a general mix of mail. In such circumstances,
1029 most messages can be delivered immediately. Consequently, Exim does not
1030 maintain independent queues of messages for specific domains or hosts, though
1031 it does try to send several messages in a single SMTP connection after a host
1032 has been down, and it also maintains per-host retry information.
1033 </para>
1034 </section>
1035 <section id="SECID11">
1036 <title>Policy control</title>
1037 <para>
1038 <indexterm role="concept">
1039 <primary>policy control</primary>
1040 <secondary>overview</secondary>
1041 </indexterm>
1042 Policy controls are now an important feature of MTAs that are connected to the
1043 Internet. Perhaps their most important job is to stop MTAs from being abused as
1044 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1045 unsolicited junk and want to disguise its source. Exim provides flexible
1046 facilities for specifying policy controls on incoming mail:
1047 </para>
1048 <itemizedlist>
1049 <listitem>
1050 <para>
1051 <indexterm role="concept">
1052 <primary>access control lists (ACLs)</primary>
1053 <secondary>introduction</secondary>
1054 </indexterm>
1055 Exim 4 (unlike previous versions of Exim) implements policy controls on
1056 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1057 series of statements that may either grant or deny access. ACLs can be used at
1058 several places in the SMTP dialogue while receiving a message from a remote
1059 host. However, the most common places are after each RCPT command, and at the
1060 very end of the message. The sysadmin can specify conditions for accepting or
1061 rejecting individual recipients or the entire message, respectively, at these
1062 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1063 error code.
1064 </para>
1065 </listitem>
1066 <listitem>
1067 <para>
1068 An ACL is also available for locally generated, non-SMTP messages. In this
1069 case, the only available actions are to accept or deny the entire message.
1070 </para>
1071 </listitem>
1072 <listitem>
1073 <para>
1074 When Exim is compiled with the content-scanning extension, facilities are
1075 provided in the ACL mechanism for passing the message to external virus and/or
1076 spam scanning software. The result of such a scan is passed back to the ACL,
1077 which can then use it to decide what to do with the message.
1078 </para>
1079 </listitem>
1080 <listitem>
1081 <para>
1082 When a message has been received, either from a remote host or from the local
1083 host, but before the final acknowledgment has been sent, a locally supplied C
1084 function called <function>local_scan()</function> can be run to inspect the message and decide
1085 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1086 is accepted, the list of recipients can be modified by the function.
1087 </para>
1088 </listitem>
1089 <listitem>
1090 <para>
1091 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1092 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1093 Exim to be compiled with the content-scanning extension.
1094 </para>
1095 </listitem>
1096 <listitem>
1097 <para>
1098 After a message has been accepted, a further checking mechanism is available in
1099 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1100 runs at the start of every delivery process.
1101 </para>
1102 </listitem>
1103 </itemizedlist>
1104 </section>
1105 <section id="SECID12">
1106 <title>User filters</title>
1107 <para>
1108 <indexterm role="concept">
1109 <primary>filter</primary>
1110 <secondary>introduction</secondary>
1111 </indexterm>
1112 <indexterm role="concept">
1113 <primary>Sieve filter</primary>
1114 </indexterm>
1115 In a conventional Exim configuration, users are able to run private filters by
1116 setting up appropriate <filename>.forward</filename> files in their home directories. See
1117 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1118 configuration needed to support this, and the separate document entitled
1119 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1120 of filtering are available:
1121 </para>
1122 <itemizedlist>
1123 <listitem>
1124 <para>
1125 Sieve filters are written in the standard filtering language that is defined
1126 by RFC 3028.
1127 </para>
1128 </listitem>
1129 <listitem>
1130 <para>
1131 Exim filters are written in a syntax that is unique to Exim, but which is more
1132 powerful than Sieve, which it pre-dates.
1133 </para>
1134 </listitem>
1135 </itemizedlist>
1136 <para>
1137 User filters are run as part of the routing process, described below.
1138 </para>
1139 </section>
1140 <section id="SECTmessiden">
1141 <title>Message identification</title>
1142 <para>
1143 <indexterm role="concept">
1144 <primary>message ids</primary>
1145 <secondary>details of format</secondary>
1146 </indexterm>
1147 <indexterm role="concept">
1148 <primary>format</primary>
1149 <secondary>of message id</secondary>
1150 </indexterm>
1151 <indexterm role="concept">
1152 <primary>id of message</primary>
1153 </indexterm>
1154 <indexterm role="concept">
1155 <primary>base62</primary>
1156 </indexterm>
1157 <indexterm role="concept">
1158 <primary>base36</primary>
1159 </indexterm>
1160 <indexterm role="concept">
1161 <primary>Darwin</primary>
1162 </indexterm>
1163 <indexterm role="concept">
1164 <primary>Cygwin</primary>
1165 </indexterm>
1166 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1167 characters long. It is divided into three parts, separated by hyphens, for
1168 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1169 normally encoding numbers in base 62. However, in the Darwin operating
1170 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1171 (avoiding the use of lower case letters) is used instead, because the message
1172 id is used to construct filenames, and the names of files in those systems are
1173 not always case-sensitive.
1174 </para>
1175 <para>
1176 <indexterm role="concept">
1177 <primary>pid (process id)</primary>
1178 <secondary>re-use of</secondary>
1179 </indexterm>
1180 The detail of the contents of the message id have changed as Exim has evolved.
1181 Earlier versions relied on the operating system not re-using a process id (pid)
1182 within one second. On modern operating systems, this assumption can no longer
1183 be made, so the algorithm had to be changed. To retain backward compatibility,
1184 the format of the message id was retained, which is why the following rules are
1185 somewhat eccentric:
1186 </para>
1187 <itemizedlist>
1188 <listitem>
1189 <para>
1190 The first six characters of the message id are the time at which the message
1191 started to be received, to a granularity of one second. That is, this field
1192 contains the number of seconds since the start of the epoch (the normal Unix
1193 way of representing the date and time of day).
1194 </para>
1195 </listitem>
1196 <listitem>
1197 <para>
1198 After the first hyphen, the next six characters are the id of the process that
1199 received the message.
1200 </para>
1201 </listitem>
1202 <listitem>
1203 <para>
1204 There are two different possibilities for the final two characters:
1205 </para>
1206 <orderedlist numeration="arabic">
1207 <listitem>
1208 <para>
1209 <indexterm role="option">
1210 <primary><option>localhost_number</option></primary>
1211 </indexterm>
1212 If <option>localhost_number</option> is not set, this value is the fractional part of the
1213 time of reception, normally in units of 1/2000 of a second, but for systems
1214 that must use base 36 instead of base 62 (because of case-insensitive file
1215 systems), the units are 1/1000 of a second.
1216 </para>
1217 </listitem>
1218 <listitem>
1219 <para>
1220 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1221 the fractional part of the time, which in this case is in units of 1/200
1222 (1/100) of a second.
1223 </para>
1224 </listitem>
1225 </orderedlist>
1226 </listitem>
1227 </itemizedlist>
1228 <para>
1229 After a message has been received, Exim waits for the clock to tick at the
1230 appropriate resolution before proceeding, so that if another message is
1231 received by the same process, or by another process with the same (re-used)
1232 pid, it is guaranteed that the time will be different. In most cases, the clock
1233 will already have ticked while the message was being received.
1234 </para>
1235 </section>
1236 <section id="SECID13">
1237 <title>Receiving mail</title>
1238 <para>
1239 <indexterm role="concept">
1240 <primary>receiving mail</primary>
1241 </indexterm>
1242 <indexterm role="concept">
1243 <primary>message</primary>
1244 <secondary>reception</secondary>
1245 </indexterm>
1246 The only way Exim can receive mail from another host is using SMTP over
1247 TCP/IP, in which case the sender and recipient addresses are transferred using
1248 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1249 there are several possibilities:
1250 </para>
1251 <itemizedlist>
1252 <listitem>
1253 <para>
1254 If the process runs Exim with the <option>-bm</option> option, the message is read
1255 non-interactively (usually via a pipe), with the recipients taken from the
1256 command line, or from the body of the message if <option>-t</option> is also used.
1257 </para>
1258 </listitem>
1259 <listitem>
1260 <para>
1261 If the process runs Exim with the <option>-bS</option> option, the message is also read
1262 non-interactively, but in this case the recipients are listed at the start of
1263 the message in a series of SMTP RCPT commands, terminated by a DATA
1264 command. This is called <quote>batch SMTP</quote> format,
1265 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1266 envelope addresses in a non-interactive submission.
1267 </para>
1268 </listitem>
1269 <listitem>
1270 <para>
1271 If the process runs Exim with the <option>-bs</option> option, the message is read
1272 interactively, using the SMTP protocol. A two-way pipe is normally used for
1273 passing data between the local process and the Exim process.
1274 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1275 example, the ACLs for SMTP commands are used for this form of submission.
1276 </para>
1277 </listitem>
1278 <listitem>
1279 <para>
1280 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1281 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1282 does not treat the loopback address specially. It treats all such connections
1283 in the same way as connections from other hosts.
1284 </para>
1285 </listitem>
1286 </itemizedlist>
1287 <para>
1288 <indexterm role="concept">
1289 <primary>message sender, constructed by Exim</primary>
1290 </indexterm>
1291 <indexterm role="concept">
1292 <primary>sender</primary>
1293 <secondary>constructed by Exim</secondary>
1294 </indexterm>
1295 In the three cases that do not involve TCP/IP, the sender address is
1296 constructed from the login name of the user that called Exim and a default
1297 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1298 option). For local or batch SMTP, a sender address that is passed using the
1299 SMTP MAIL command is ignored. However, the system administrator may allow
1300 certain users (<quote>trusted users</quote>) to specify a different sender addresses
1301 unconditionally, or all users to specify certain forms of different sender
1302 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1303 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1304 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1305 users to change sender addresses.
1306 </para>
1307 <para>
1308 Messages received by either of the non-interactive mechanisms are subject to
1309 checking by the non-SMTP ACL if one is defined. Messages received using SMTP
1310 (either over TCP/IP or interacting with a local process) can be checked by a
1311 number of ACLs that operate at different times during the SMTP session. Either
1312 individual recipients or the entire message can be rejected if local policy
1313 requirements are not met. The <function>local_scan()</function> function (see chapter
1314 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1315 </para>
1316 <para>
1317 Exim can be configured not to start a delivery process when a message is
1318 received; this can be unconditional, or depend on the number of incoming SMTP
1319 connections or the system load. In these situations, new messages wait on the
1320 queue until a queue runner process picks them up. However, in standard
1321 configurations under normal conditions, delivery is started as soon as a
1322 message is received.
1323 </para>
1324 </section>
1325 <section id="SECID14">
1326 <title>Handling an incoming message</title>
1327 <para>
1328 <indexterm role="concept">
1329 <primary>spool directory</primary>
1330 <secondary>files that hold a message</secondary>
1331 </indexterm>
1332 <indexterm role="concept">
1333 <primary>file</primary>
1334 <secondary>how a message is held</secondary>
1335 </indexterm>
1336 When Exim accepts a message, it writes two files in its spool directory. The
1337 first contains the envelope information, the current status of the message, and
1338 the header lines, and the second contains the body of the message. The names of
1339 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1340 file containing the envelope and header, and <literal>-D</literal> for the data file.
1341 </para>
1342 <para>
1343 <indexterm role="concept">
1344 <primary>spool directory</primary>
1345 <secondary><filename>input</filename> sub-directory</secondary>
1346 </indexterm>
1347 By default, all these message files are held in a single directory called
1348 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1349 not perform very well if the number of files in a directory gets large; to
1350 improve performance in such cases, the <option>split_spool_directory</option> option can be
1351 used. This causes Exim to split up the input files into 62 sub-directories
1352 whose names are single letters or digits. When this is done, the queue is
1353 processed one sub-directory at a time instead of all at once, which can improve
1354 overall performance even when there are not enough files in each directory to
1355 affect file system performance.
1356 </para>
1357 <para>
1358 The envelope information consists of the address of the message&#x2019;s sender and
1359 the addresses of the recipients. This information is entirely separate from
1360 any addresses contained in the header lines. The status of the message includes
1361 a list of recipients who have already received the message. The format of the
1362 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1363 </para>
1364 <para>
1365 <indexterm role="concept">
1366 <primary>rewriting</primary>
1367 <secondary>addresses</secondary>
1368 </indexterm>
1369 Address rewriting that is specified in the rewrite section of the configuration
1370 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1371 both in the header lines and the envelope, at the time the message is accepted.
1372 If during the course of delivery additional addresses are generated (for
1373 example, via aliasing), these new addresses are rewritten as soon as they are
1374 generated. At the time a message is actually delivered (transported) further
1375 rewriting can take place; because this is a transport option, it can be
1376 different for different forms of delivery. It is also possible to specify the
1377 addition or removal of certain header lines at the time the message is
1378 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1379 <xref linkend="CHAPtransportgeneric"/>).
1380 </para>
1381 </section>
1382 <section id="SECID15">
1383 <title>Life of a message</title>
1384 <para>
1385 <indexterm role="concept">
1386 <primary>message</primary>
1387 <secondary>life of</secondary>
1388 </indexterm>
1389 <indexterm role="concept">
1390 <primary>message</primary>
1391 <secondary>frozen</secondary>
1392 </indexterm>
1393 A message remains in the spool directory until it is completely delivered to
1394 its recipients or to an error address, or until it is deleted by an
1395 administrator or by the user who originally created it. In cases when delivery
1396 cannot proceed &ndash; for example when a message can neither be delivered to its
1397 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1398 spool, and no more deliveries are attempted.
1399 </para>
1400 <para>
1401 <indexterm role="concept">
1402 <primary>frozen messages</primary>
1403 <secondary>thawing</secondary>
1404 </indexterm>
1405 <indexterm role="concept">
1406 <primary>message</primary>
1407 <secondary>thawing frozen</secondary>
1408 </indexterm>
1409 An administrator can <quote>thaw</quote> such messages when the problem has been
1410 corrected, and can also freeze individual messages by hand if necessary. In
1411 addition, an administrator can force a delivery error, causing a bounce message
1412 to be sent.
1413 </para>
1414 <para>
1415 <indexterm role="option">
1416 <primary><option>timeout_frozen_after</option></primary>
1417 </indexterm>
1418 <indexterm role="option">
1419 <primary><option>ignore_bounce_errors_after</option></primary>
1420 </indexterm>
1421 There are options called <option>ignore_bounce_errors_after</option> and
1422 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1423 The first applies only to frozen bounces, the second to all frozen messages.
1424 </para>
1425 <para>
1426 <indexterm role="concept">
1427 <primary>message</primary>
1428 <secondary>log file for</secondary>
1429 </indexterm>
1430 <indexterm role="concept">
1431 <primary>log</primary>
1432 <secondary>file for each message</secondary>
1433 </indexterm>
1434 While Exim is working on a message, it writes information about each delivery
1435 attempt to its main log file. This includes successful, unsuccessful, and
1436 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1437 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1438 These logs are solely for the benefit of the administrator and are normally
1439 deleted along with the spool files when processing of a message is complete.
1440 The use of individual message logs can be disabled by setting
1441 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1442 systems.
1443 </para>
1444 <para>
1445 <indexterm role="concept">
1446 <primary>journal file</primary>
1447 </indexterm>
1448 <indexterm role="concept">
1449 <primary>file</primary>
1450 <secondary>journal</secondary>
1451 </indexterm>
1452 All the information Exim itself needs to set up a delivery is kept in the first
1453 spool file, along with the header lines. When a successful delivery occurs, the
1454 address is immediately written at the end of a journal file, whose name is the
1455 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1456 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1457 is updated to indicate which these are, and the journal file is then deleted.
1458 Updating the spool file is done by writing a new file and renaming it, to
1459 minimize the possibility of data loss.
1460 </para>
1461 <para>
1462 Should the system or Exim crash after a successful delivery but before
1463 the spool file has been updated, the journal is left lying around. The next
1464 time Exim attempts to deliver the message, it reads the journal file and
1465 updates the spool file before proceeding. This minimizes the chances of double
1466 deliveries caused by crashes.
1467 </para>
1468 </section>
1469 <section id="SECTprocaddress">
1470 <title>Processing an address for delivery</title>
1471 <para>
1472 <indexterm role="concept">
1473 <primary>drivers</primary>
1474 <secondary>definition of</secondary>
1475 </indexterm>
1476 <indexterm role="concept">
1477 <primary>router</primary>
1478 <secondary>definition of</secondary>
1479 </indexterm>
1480 <indexterm role="concept">
1481 <primary>transport</primary>
1482 <secondary>definition of</secondary>
1483 </indexterm>
1484 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1485 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1486 number of them is provided in the source distribution, and compile-time options
1487 specify which ones are included in the binary. Runtime options specify which
1488 ones are actually used for delivering messages.
1489 </para>
1490 <para>
1491 <indexterm role="concept">
1492 <primary>drivers</primary>
1493 <secondary>instance definition</secondary>
1494 </indexterm>
1495 Each driver that is specified in the runtime configuration is an <emphasis>instance</emphasis>
1496 of that particular driver type. Multiple instances are allowed; for example,
1497 you can set up several different <command>smtp</command> transports, each with different
1498 option values that might specify different ports or different timeouts. Each
1499 instance has its own identifying name. In what follows we will normally use the
1500 instance name when discussing one particular instance (that is, one specific
1501 configuration of the driver), and the generic driver name when discussing
1502 the driver&#x2019;s features in general.
1503 </para>
1504 <para>
1505 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1506 its delivery should happen, by assigning it to a specific transport, or
1507 converting the address into one or more new addresses (for example, via an
1508 alias file). A router may also explicitly choose to fail an address, causing it
1509 to be bounced.
1510 </para>
1511 <para>
1512 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1513 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1514 transport, the destination is a file or a pipe on the local host, whereas for a
1515 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1516 to a specific transport as a result of successful routing. If a message has
1517 several recipients, it may be passed to a number of different transports.
1518 </para>
1519 <para>
1520 <indexterm role="concept">
1521 <primary>preconditions</primary>
1522 <secondary>definition of</secondary>
1523 </indexterm>
1524 An address is processed by passing it to each configured router instance in
1525 turn, subject to certain preconditions, until a router accepts the address or
1526 specifies that it should be bounced. We will describe this process in more
1527 detail shortly. First, as a simple example, we consider how each recipient
1528 address in a message is processed in a small configuration of three routers.
1529 </para>
1530 <para>
1531 To make this a more concrete example, it is described in terms of some actual
1532 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1533 routers in many different ways, and there may be any number of routers in a
1534 configuration.
1535 </para>
1536 <para>
1537 The first router that is specified in a configuration is often one that handles
1538 addresses in domains that are not recognized specifically by the local host.
1539 Typically these are addresses for arbitrary domains on the Internet. A precondition
1540 is set up which looks for the special domains known to the host (for example,
1541 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1542 match. Typically, this is a router that looks up domains in the DNS in order to
1543 find the hosts to which this address routes. If it succeeds, the address is
1544 assigned to a suitable SMTP transport; if it does not succeed, the router is
1545 configured to fail the address.
1546 </para>
1547 <para>
1548 The second router is reached only when the domain is recognized as one that
1549 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1550 aliasing and forwarding. When it generates one or more new addresses from the
1551 original, each of them is routed independently from the start. Otherwise, the
1552 router may cause an address to fail, or it may simply decline to handle the
1553 address, in which case the address is passed to the next router.
1554 </para>
1555 <para>
1556 The final router in many configurations is one that checks to see if the
1557 address belongs to a local mailbox. The precondition may involve a check to
1558 see if the local part is the name of a login account, or it may look up the
1559 local part in a file or a database. If its preconditions are not met, or if
1560 the router declines, we have reached the end of the routers. When this happens,
1561 the address is bounced.
1562 </para>
1563 </section>
1564 <section id="SECID16">
1565 <title>Processing an address for verification</title>
1566 <para>
1567 <indexterm role="concept">
1568 <primary>router</primary>
1569 <secondary>for verification</secondary>
1570 </indexterm>
1571 <indexterm role="concept">
1572 <primary>verifying address</primary>
1573 <secondary>overview</secondary>
1574 </indexterm>
1575 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1576 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1577 one of the checks to be performed in an ACL for incoming messages, on both
1578 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1579 <option>-bvs</option> command line options.
1580 </para>
1581 <para>
1582 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1583 does not affect the way the routers work, but it is a state that can be
1584 detected. By this means, a router can be skipped or made to behave differently
1585 when verifying. A common example is a configuration in which the first router
1586 sends all messages to a message-scanning program unless they have been
1587 previously scanned. Thus, the first router accepts all addresses without any
1588 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1589 would be set for such a router, causing it to be skipped in verify mode.
1590 </para>
1591 </section>
1592 <section id="SECTrunindrou">
1593 <title>Running an individual router</title>
1594 <para>
1595 <indexterm role="concept">
1596 <primary>router</primary>
1597 <secondary>running details</secondary>
1598 </indexterm>
1599 <indexterm role="concept">
1600 <primary>preconditions</primary>
1601 <secondary>checking</secondary>
1602 </indexterm>
1603 <indexterm role="concept">
1604 <primary>router</primary>
1605 <secondary>result of running</secondary>
1606 </indexterm>
1607 As explained in the example above, a number of preconditions are checked before
1608 running a router. If any are not met, the router is skipped, and the address is
1609 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1610 the router is run. What happens next depends on the outcome, which is one of
1611 the following:
1612 </para>
1613 <itemizedlist>
1614 <listitem>
1615 <para>
1616 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1617 transport or generates one or more <quote>child</quote> addresses. Processing the
1618 original address ceases
1619 <indexterm role="option">
1620 <primary><option>unseen</option></primary>
1621 </indexterm>
1622 unless the <option>unseen</option> option is set on the router. This option
1623 can be used to set up multiple deliveries with different routing (for example,
1624 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1625 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1626 end of routing.
1627 </para>
1628 <para>
1629 Any child addresses generated by the router are processed independently,
1630 starting with the first router by default. It is possible to change this by
1631 setting the <option>redirect_router</option> option to specify which router to start at for
1632 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1633 <option>redirect_router</option> may be anywhere in the router configuration.
1634 </para>
1635 </listitem>
1636 <listitem>
1637 <para>
1638 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1639 requests that the address be passed to another router. By default, the address
1640 is passed to the next router, but this can be changed by setting the
1641 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1642 must be below the current router (to avoid loops).
1643 </para>
1644 </listitem>
1645 <listitem>
1646 <para>
1647 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1648 recognize it at all. By default, the address is passed to the next router, but
1649 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1650 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1651 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1652 </para>
1653 </listitem>
1654 <listitem>
1655 <para>
1656 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1657 the generation of a bounce message. There is no further processing of the
1658 original address unless <option>unseen</option> is set on the router.
1659 </para>
1660 </listitem>
1661 <listitem>
1662 <para>
1663 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1664 database may be offline, or a DNS lookup may have timed out.) No further
1665 processing of the address happens in this delivery attempt. It is tried again
1666 next time the message is considered for delivery.
1667 </para>
1668 </listitem>
1669 <listitem>
1670 <para>
1671 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1672 its configuration). The action is as for defer.
1673 </para>
1674 </listitem>
1675 </itemizedlist>
1676 <para>
1677 If an address reaches the end of the routers without having been accepted by
1678 any of them, it is bounced as unrouteable. The default error message in this
1679 situation is <quote>unrouteable address</quote>, but you can set your own message by
1680 making use of the <option>cannot_route_message</option> option. This can be set for any
1681 router; the value from the last router that <quote>saw</quote> the address is used.
1682 </para>
1683 <para>
1684 Sometimes while routing you want to fail a delivery when some conditions are
1685 met but others are not, instead of passing the address on for further routing.
1686 You can do this by having a second router that explicitly fails the delivery
1687 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1688 facility for this purpose.
1689 </para>
1690 </section>
1691 <section id="SECID17">
1692 <title>Duplicate addresses</title>
1693 <para>
1694 <indexterm role="concept">
1695 <primary>case of local parts</primary>
1696 </indexterm>
1697 <indexterm role="concept">
1698 <primary>address duplicate, discarding</primary>
1699 </indexterm>
1700 <indexterm role="concept">
1701 <primary>duplicate addresses</primary>
1702 </indexterm>
1703 Once routing is complete, Exim scans the addresses that are assigned to local
1704 and remote transports and discards any duplicates that it finds. During this
1705 check, local parts are treated case-sensitively. This happens only when
1706 actually delivering a message; when testing routers with <option>-bt</option>, all the
1707 routed addresses are shown.
1708 </para>
1709 </section>
1710 <section id="SECTrouprecon">
1711 <title>Router preconditions</title>
1712 <para>
1713 <indexterm role="concept">
1714 <primary>router</primary>
1715 <secondary>preconditions, order of processing</secondary>
1716 </indexterm>
1717 <indexterm role="concept">
1718 <primary>preconditions</primary>
1719 <secondary>order of processing</secondary>
1720 </indexterm>
1721 The preconditions that are tested for each router are listed below, in the
1722 order in which they are tested. The individual configuration options are
1723 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1724 </para>
1725 <itemizedlist>
1726 <listitem>
1727 <para>
1728 <indexterm role="concept">
1729 <primary>affix</primary>
1730 <secondary>router precondition</secondary>
1731 </indexterm>
1732 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1733 the local parts handled by the router may or must have certain prefixes and/or
1734 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1735 skipped. These conditions are tested first. When an affix is present, it is
1736 removed from the local part before further processing, including the evaluation
1737 of any other conditions.
1738 </para>
1739 </listitem>
1740 <listitem>
1741 <para>
1742 Routers can be designated for use only when not verifying an address, that is,
1743 only when routing it for delivery (or testing its delivery routing). If the
1744 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1745 address.
1746 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1747 <option>verify_recipient</option>, which independently control the use of the router for
1748 sender and recipient verification. You can set these options directly if
1749 you want a router to be used for only one type of verification.
1750 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1751 </para>
1752 </listitem>
1753 <listitem>
1754 <para>
1755 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1756 run with the <option>-bt</option> option to test an address routing. This can be helpful
1757 when the first router sends all new messages to a scanner of some sort; it
1758 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1759 having to simulate the effect of the scanner.
1760 </para>
1761 </listitem>
1762 <listitem>
1763 <para>
1764 Routers can be designated for use only when verifying an address, as
1765 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1766 Again, cutthrough delivery counts as a verification.
1767 </para>
1768 </listitem>
1769 <listitem>
1770 <para>
1771 Individual routers can be explicitly skipped when running the routers to
1772 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1773 </para>
1774 </listitem>
1775 <listitem>
1776 <para>
1777 If the <option>domains</option> option is set, the domain of the address must be in the set
1778 of domains that it defines.
1779 </para>
1780 </listitem>
1781 <listitem>
1782 <para>
1783 <indexterm role="variable">
1784 <primary><varname>$local_part_prefix</varname></primary>
1785 </indexterm>
1786 <indexterm role="variable">
1787 <primary><varname>$local_part_prefix_v</varname></primary>
1788 </indexterm>
1789 <indexterm role="variable">
1790 <primary><varname>$local_part</varname></primary>
1791 </indexterm>
1792 <indexterm role="variable">
1793 <primary><varname>$local_part_suffix</varname></primary>
1794 </indexterm>
1795 <indexterm role="variable">
1796 <primary><varname>$local_part_suffix_v</varname></primary>
1797 </indexterm>
1798 <indexterm role="concept">
1799 <primary>affix</primary>
1800 <secondary>router precondition</secondary>
1801 </indexterm>
1802 If the <option>local_parts</option> option is set, the local part of the address must be in
1803 the set of local parts that it defines. If <option>local_part_prefix</option> or
1804 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1805 part before this check. If you want to do precondition tests on local parts
1806 that include affixes, you can do so by using a <option>condition</option> option (see below)
1807 </para>
1808 <para revisionflag="changed">
1809 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>,
1810 <varname>$local_part_prefix_v</varname>, <varname>$local_part_suffix</varname>
1811 and <varname>$local_part_suffix_v</varname> as necessary.
1812 </para>
1813 </listitem>
1814 <listitem>
1815 <para>
1816 <indexterm role="variable">
1817 <primary><varname>$local_user_uid</varname></primary>
1818 </indexterm>
1819 <indexterm role="variable">
1820 <primary><varname>$local_user_gid</varname></primary>
1821 </indexterm>
1822 <indexterm role="variable">
1823 <primary><varname>$home</varname></primary>
1824 </indexterm>
1825 If the <option>check_local_user</option> option is set, the local part must be the name of
1826 an account on the local host. If this check succeeds, the uid and gid of the
1827 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1828 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1829 remaining preconditions.
1830 </para>
1831 </listitem>
1832 <listitem>
1833 <para>
1834 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1835 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1836 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1837 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1838 could lead to confusion.
1839 </para>
1840 </listitem>
1841 <listitem>
1842 <para>
1843 If the <option>senders</option> option is set, the envelope sender address must be in the
1844 set of addresses that it defines.
1845 </para>
1846 </listitem>
1847 <listitem>
1848 <para>
1849 If the <option>require_files</option> option is set, the existence or non-existence of
1850 specified files is tested.
1851 </para>
1852 </listitem>
1853 <listitem>
1854 <para>
1855 <indexterm role="concept">
1856 <primary>customizing</primary>
1857 <secondary>precondition</secondary>
1858 </indexterm>
1859 If the <option>condition</option> option is set, it is evaluated and tested. This option
1860 uses an expanded string to allow you to set up your own custom preconditions.
1861 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1862 </para>
1863 </listitem>
1864 </itemizedlist>
1865 <para>
1866 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1867 it to check for the existence of a file in which to lookup up a domain, local
1868 part, or sender. However, as these options are all expanded, you can use the
1869 <option>exists</option> expansion condition to make such tests within each condition. The
1870 <option>require_files</option> option is intended for checking files that the router may be
1871 going to use internally, or which are needed by a specific transport (for
1872 example, <filename>.procmailrc</filename>).
1873 </para>
1874 </section>
1875 <section id="SECID18">
1876 <title>Delivery in detail</title>
1877 <para>
1878 <indexterm role="concept">
1879 <primary>delivery</primary>
1880 <secondary>in detail</secondary>
1881 </indexterm>
1882 When a message is to be delivered, the sequence of events is as follows:
1883 </para>
1884 <itemizedlist>
1885 <listitem>
1886 <para>
1887 If a system-wide filter file is specified, the message is passed to it. The
1888 filter may add recipients to the message, replace the recipients, discard the
1889 message, cause a new message to be generated, or cause the message delivery to
1890 fail. The format of the system filter file is the same as for Exim user filter
1891 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1892 filtering</emphasis>.
1893 <indexterm role="concept">
1894 <primary>Sieve filter</primary>
1895 <secondary>not available for system filter</secondary>
1896 </indexterm>
1897 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1898 </para>
1899 <para>
1900 Some additional features are available in system filters &ndash; see chapter
1901 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1902 filter only once per delivery attempt, however many recipients it has. However,
1903 if there are several delivery attempts because one or more addresses could not
1904 be immediately delivered, the system filter is run each time. The filter
1905 condition <option>first_delivery</option> can be used to detect the first run of the system
1906 filter.
1907 </para>
1908 </listitem>
1909 <listitem>
1910 <para>
1911 Each recipient address is offered to each configured router, in turn, subject to
1912 its preconditions, until one is able to handle it. If no router can handle the
1913 address, that is, if they all decline, the address is failed. Because routers
1914 can be targeted at particular domains, several locally handled domains can be
1915 processed entirely independently of each other.
1916 </para>
1917 </listitem>
1918 <listitem>
1919 <para>
1920 <indexterm role="concept">
1921 <primary>routing</primary>
1922 <secondary>loops in</secondary>
1923 </indexterm>
1924 <indexterm role="concept">
1925 <primary>loop</primary>
1926 <secondary>while routing</secondary>
1927 </indexterm>
1928 A router that accepts an address may assign it to a local or a remote
1929 transport. However, the transport is not run at this time. Instead, the address
1930 is placed on a list for the particular transport, which will be run later.
1931 Alternatively, the router may generate one or more new addresses (typically
1932 from alias, forward, or filter files). New addresses are fed back into this
1933 process from the top, but in order to avoid loops, a router ignores any address
1934 which has an identically-named ancestor that was processed by itself.
1935 </para>
1936 </listitem>
1937 <listitem>
1938 <para>
1939 When all the routing has been done, addresses that have been successfully
1940 handled are passed to their assigned transports. When local transports are
1941 doing real local deliveries, they handle only one address at a time, but if a
1942 local transport is being used as a pseudo-remote transport (for example, to
1943 collect batched SMTP messages for transmission by some other means) multiple
1944 addresses can be handled. Remote transports can always handle more than one
1945 address at a time, but can be configured not to do so, or to restrict multiple
1946 addresses to the same domain.
1947 </para>
1948 </listitem>
1949 <listitem>
1950 <para>
1951 Each local delivery to a file or a pipe runs in a separate process under a
1952 non-privileged uid, and these deliveries are run one at a time. Remote
1953 deliveries also run in separate processes, normally under a uid that is private
1954 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1955 run in parallel. The maximum number of simultaneous remote deliveries for any
1956 one message is set by the <option>remote_max_parallel</option> option.
1957 The order in which deliveries are done is not defined, except that all local
1958 deliveries happen before any remote deliveries.
1959 </para>
1960 </listitem>
1961 <listitem>
1962 <para>
1963 <indexterm role="concept">
1964 <primary>queue runner</primary>
1965 </indexterm>
1966 When it encounters a local delivery during a queue run, Exim checks its retry
1967 database to see if there has been a previous temporary delivery failure for the
1968 address before running the local transport. If there was a previous failure,
1969 Exim does not attempt a new delivery until the retry time for the address is
1970 reached. However, this happens only for delivery attempts that are part of a
1971 queue run. Local deliveries are always attempted when delivery immediately
1972 follows message reception, even if retry times are set for them. This makes for
1973 better behaviour if one particular message is causing problems (for example,
1974 causing quota overflow, or provoking an error in a filter file).
1975 </para>
1976 </listitem>
1977 <listitem>
1978 <para>
1979 <indexterm role="concept">
1980 <primary>delivery</primary>
1981 <secondary>retry in remote transports</secondary>
1982 </indexterm>
1983 Remote transports do their own retry handling, since an address may be
1984 deliverable to one of a number of hosts, each of which may have a different
1985 retry time. If there have been previous temporary failures and no host has
1986 reached its retry time, no delivery is attempted, whether in a queue run or
1987 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1988 </para>
1989 </listitem>
1990 <listitem>
1991 <para>
1992 If there were any permanent errors, a bounce message is returned to an
1993 appropriate address (the sender in the common case), with details of the error
1994 for each failing address. Exim can be configured to send copies of bounce
1995 messages to other addresses.
1996 </para>
1997 </listitem>
1998 <listitem>
1999 <para>
2000 <indexterm role="concept">
2001 <primary>delivery</primary>
2002 <secondary>deferral</secondary>
2003 </indexterm>
2004 If one or more addresses suffered a temporary failure, the message is left on
2005 the queue, to be tried again later. Delivery of these addresses is said to be
2006 <emphasis>deferred</emphasis>.
2007 </para>
2008 </listitem>
2009 <listitem>
2010 <para>
2011 When all the recipient addresses have either been delivered or bounced,
2012 handling of the message is complete. The spool files and message log are
2013 deleted, though the message log can optionally be preserved if required.
2014 </para>
2015 </listitem>
2016 </itemizedlist>
2017 </section>
2018 <section id="SECID19">
2019 <title>Retry mechanism</title>
2020 <para>
2021 <indexterm role="concept">
2022 <primary>delivery</primary>
2023 <secondary>retry mechanism</secondary>
2024 </indexterm>
2025 <indexterm role="concept">
2026 <primary>retry</primary>
2027 <secondary>description of mechanism</secondary>
2028 </indexterm>
2029 <indexterm role="concept">
2030 <primary>queue runner</primary>
2031 </indexterm>
2032 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2033 attempt is the queue runner process. You must either run an Exim daemon that
2034 uses the <option>-q</option> option with a time interval to start queue runners at regular
2035 intervals or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2036 not arrange for queue runners to be run, messages that fail temporarily at the
2037 first attempt will remain in your queue forever. A queue runner process works
2038 its way through the queue, one message at a time, trying each delivery that has
2039 passed its retry time.
2040 You can run several queue runners at once.
2041 </para>
2042 <para>
2043 Exim uses a set of configured rules to determine when next to retry the failing
2044 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2045 should give up trying to deliver to the address, at which point it generates a
2046 bounce message. If no retry rules are set for a particular host, address, and
2047 error combination, no retries are attempted, and temporary errors are treated
2048 as permanent.
2049 </para>
2050 </section>
2051 <section id="SECID20">
2052 <title>Temporary delivery failure</title>
2053 <para>
2054 <indexterm role="concept">
2055 <primary>delivery</primary>
2056 <secondary>temporary failure</secondary>
2057 </indexterm>
2058 There are many reasons why a message may not be immediately deliverable to a
2059 particular address. Failure to connect to a remote machine (because it, or the
2060 connection to it, is down) is one of the most common. Temporary failures may be
2061 detected during routing as well as during the transport stage of delivery.
2062 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2063 is on a file system where the user is over quota. Exim can be configured to
2064 impose its own quotas on local mailboxes; where system quotas are set they will
2065 also apply.
2066 </para>
2067 <para>
2068 If a host is unreachable for a period of time, a number of messages may be
2069 waiting for it by the time it recovers, and sending them in a single SMTP
2070 connection is clearly beneficial. Whenever a delivery to a remote host is
2071 deferred,
2072 <indexterm role="concept">
2073 <primary>hints database</primary>
2074 <secondary>deferred deliveries</secondary>
2075 </indexterm>
2076 Exim makes a note in its hints database, and whenever a successful
2077 SMTP delivery has happened, it looks to see if any other messages are waiting
2078 for the same host. If any are found, they are sent over the same SMTP
2079 connection, subject to a configuration limit as to the maximum number in any
2080 one connection.
2081 </para>
2082 </section>
2083 <section id="SECID21">
2084 <title>Permanent delivery failure</title>
2085 <para>
2086 <indexterm role="concept">
2087 <primary>delivery</primary>
2088 <secondary>permanent failure</secondary>
2089 </indexterm>
2090 <indexterm role="concept">
2091 <primary>bounce message</primary>
2092 <secondary>when generated</secondary>
2093 </indexterm>
2094 When a message cannot be delivered to some or all of its intended recipients, a
2095 bounce message is generated. Temporary delivery failures turn into permanent
2096 errors when their timeout expires. All the addresses that fail in a given
2097 delivery attempt are listed in a single message. If the original message has
2098 many recipients, it is possible for some addresses to fail in one delivery
2099 attempt and others to fail subsequently, giving rise to more than one bounce
2100 message. The wording of bounce messages can be customized by the administrator.
2101 See chapter <xref linkend="CHAPemsgcust"/> for details.
2102 </para>
2103 <para>
2104 <indexterm role="concept">
2105 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2106 </indexterm>
2107 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2108 failed addresses, for the benefit of programs that try to analyse such messages
2109 automatically.
2110 </para>
2111 <para>
2112 <indexterm role="concept">
2113 <primary>bounce message</primary>
2114 <secondary>recipient of</secondary>
2115 </indexterm>
2116 A bounce message is normally sent to the sender of the original message, as
2117 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2118 address given in the MAIL command. However, when an address is expanded via a
2119 forward or alias file, an alternative address can be specified for delivery
2120 failures of the generated addresses. For a mailing list expansion (see section
2121 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2122 of the list.
2123 </para>
2124 </section>
2125 <section id="SECID22">
2126 <title>Failures to deliver bounce messages</title>
2127 <para>
2128 <indexterm role="concept">
2129 <primary>bounce message</primary>
2130 <secondary>failure to deliver</secondary>
2131 </indexterm>
2132 If a bounce message (either locally generated or received from a remote host)
2133 itself suffers a permanent delivery failure, the message is left in the queue,
2134 but it is frozen, awaiting the attention of an administrator. There are options
2135 that can be used to make Exim discard such failed messages, or to keep them
2136 for only a short time (see <option>timeout_frozen_after</option> and
2137 <option>ignore_bounce_errors_after</option>).
2138 </para>
2139 </section>
2140 </chapter>
2141
2142 <chapter id="CHID3">
2143 <title>Building and installing Exim</title>
2144 <para>
2145 <indexterm role="concept" id="IIDbuex" class="startofrange">
2146 <primary>building Exim</primary>
2147 </indexterm>
2148 </para>
2149 <section id="SECID23">
2150 <title>Unpacking</title>
2151 <para>
2152 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2153 creates a directory with the name of the current release (for example,
2154 <filename>exim-4.94.2</filename>) into which the following files are placed:
2155 </para>
2156 <informaltable frame="none">
2157 <tgroup cols="2" colsep="0" rowsep="0">
2158 <colspec colwidth="140pt" align="left"/>
2159 <colspec colwidth="254pt" align="left"/>
2160 <tbody>
2161 <row>
2162 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2163 <entry>contains some acknowledgments</entry>
2164 </row>
2165 <row>
2166 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2167 <entry>contains a reference to where changes are documented</entry>
2168 </row>
2169 <row>
2170 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2171 <entry>the GNU General Public Licence</entry>
2172 </row>
2173 <row>
2174 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2175 <entry>top-level make file</entry>
2176 </row>
2177 <row>
2178 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2179 <entry>conditions for the use of Exim</entry>
2180 </row>
2181 <row>
2182 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2183 <entry>list of files, directories and simple build instructions</entry>
2184 </row>
2185 </tbody>
2186 </tgroup>
2187 </informaltable>
2188 <para>
2189 Other files whose names begin with <filename>README</filename> may also be present. The
2190 following subdirectories are created:
2191 </para>
2192 <informaltable frame="none">
2193 <tgroup cols="2" colsep="0" rowsep="0">
2194 <colspec colwidth="140pt" align="left"/>
2195 <colspec colwidth="254pt" align="left"/>
2196 <tbody>
2197 <row>
2198 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2199 <entry>an empty directory for local configuration files</entry>
2200 </row>
2201 <row>
2202 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2203 <entry>OS-specific files</entry>
2204 </row>
2205 <row>
2206 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2207 <entry>documentation files</entry>
2208 </row>
2209 <row>
2210 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2211 <entry>source files for the Exim monitor</entry>
2212 </row>
2213 <row>
2214 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2215 <entry>scripts used in the build process</entry>
2216 </row>
2217 <row>
2218 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2219 <entry>remaining source files</entry>
2220 </row>
2221 <row>
2222 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2223 <entry>independent utilities</entry>
2224 </row>
2225 </tbody>
2226 </tgroup>
2227 </informaltable>
2228 <para>
2229 The main utility programs are contained in the <filename>src</filename> directory and are built
2230 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2231 that may be useful to some sites.
2232 </para>
2233 </section>
2234 <section id="SECID24">
2235 <title>Multiple machine architectures and operating systems</title>
2236 <para>
2237 <indexterm role="concept">
2238 <primary>building Exim</primary>
2239 <secondary>multiple OS/architectures</secondary>
2240 </indexterm>
2241 The building process for Exim is arranged to make it easy to build binaries for
2242 a number of different architectures and operating systems from the same set of
2243 source files. Compilation does not take place in the <filename>src</filename> directory.
2244 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2245 system.
2246 <indexterm role="concept">
2247 <primary>symbolic link</primary>
2248 <secondary>to build directory</secondary>
2249 </indexterm>
2250 Symbolic links to the sources are installed in this directory, which is where
2251 the actual building takes place. In most cases, Exim can discover the machine
2252 architecture and operating system for itself, but the defaults can be
2253 overridden if necessary.
2254 <indexterm role="concept">
2255 <primary>compiler</primary>
2256 <secondary>requirements</secondary>
2257 </indexterm>
2258 <indexterm role="concept">
2259 <primary>compiler</primary>
2260 <secondary>version</secondary>
2261 </indexterm>
2262 A C99-capable compiler will be required for the build.
2263 </para>
2264 </section>
2265 <section id="SECTpcre">
2266 <title>PCRE library</title>
2267 <para>
2268 <indexterm role="concept">
2269 <primary>PCRE library</primary>
2270 </indexterm>
2271 Exim no longer has an embedded PCRE library as the vast majority of
2272 modern systems include PCRE as a system library, although you may need to
2273 install the PCRE package or the PCRE development package for your operating
2274 system. If your system has a normal PCRE installation the Exim build
2275 process will need no further configuration. If the library or the
2276 headers are in an unusual location you will need to either set the PCRE_LIBS
2277 and INCLUDE directives appropriately,
2278 or set PCRE_CONFIG=yes to use the installed <command>pcre-config</command> command.
2279 If your operating system has no
2280 PCRE support then you will need to obtain and build the current PCRE
2281 from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/</ulink></emphasis>.
2282 More information on PCRE is available at <emphasis role="bold"><ulink url="https://www.pcre.org/">https://www.pcre.org/</ulink></emphasis>.
2283 </para>
2284 </section>
2285 <section id="SECTdb">
2286 <title>DBM libraries</title>
2287 <para>
2288 <indexterm role="concept">
2289 <primary>DBM libraries</primary>
2290 <secondary>discussion of</secondary>
2291 </indexterm>
2292 <indexterm role="concept">
2293 <primary>hints database</primary>
2294 <secondary>DBM files used for</secondary>
2295 </indexterm>
2296 Even if you do not use any DBM files in your configuration, Exim still needs a
2297 DBM library in order to operate, because it uses indexed files for its hints
2298 databases. Unfortunately, there are a number of DBM libraries in existence, and
2299 different operating systems often have different ones installed.
2300 </para>
2301 <para>
2302 <indexterm role="concept">
2303 <primary>Solaris</primary>
2304 <secondary>DBM library for</secondary>
2305 </indexterm>
2306 <indexterm role="concept">
2307 <primary>IRIX, DBM library for</primary>
2308 </indexterm>
2309 <indexterm role="concept">
2310 <primary>BSD, DBM library for</primary>
2311 </indexterm>
2312 <indexterm role="concept">
2313 <primary>Linux, DBM library for</primary>
2314 </indexterm>
2315 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2316 Linux distribution, the DBM configuration should happen automatically, and you
2317 may be able to ignore this section. Otherwise, you may have to learn more than
2318 you would like about DBM libraries from what follows.
2319 </para>
2320 <para>
2321 <indexterm role="concept">
2322 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2323 </indexterm>
2324 Licensed versions of Unix normally contain a library of DBM functions operating
2325 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2326 versions of Unix seem to vary in what they contain as standard. In particular,
2327 some early versions of Linux have no default DBM library, and different
2328 distributors have chosen to bundle different libraries with their packaged
2329 versions. However, the more recent releases seem to have standardized on the
2330 Berkeley DB library.
2331 </para>
2332 <para>
2333 Different DBM libraries have different conventions for naming the files they
2334 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2335 possibilities:
2336 </para>
2337 <orderedlist numeration="arabic">
2338 <listitem>
2339 <para>
2340 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2341 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2342 </para>
2343 </listitem>
2344 <listitem>
2345 <para>
2346 <indexterm role="concept">
2347 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2348 </indexterm>
2349 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2350 compatibility interface it makes two different hard links to it with names
2351 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2352 filename is used unmodified.
2353 </para>
2354 </listitem>
2355 <listitem>
2356 <para>
2357 <indexterm role="concept">
2358 <primary>Berkeley DB library</primary>
2359 </indexterm>
2360 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2361 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2362 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2363 </para>
2364 </listitem>
2365 <listitem>
2366 <para>
2367 If the Berkeley package is used in its native mode, it operates on a single
2368 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2369 the traditional <emphasis>ndbm</emphasis> interface.
2370 </para>
2371 </listitem>
2372 <listitem>
2373 <para>
2374 To complicate things further, there are several very different versions of the
2375 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2376 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions when Exim last revamped support were numbered 4.<emphasis>x</emphasis>.
2377 Maintenance of some of the earlier releases has ceased. All versions of
2378 Berkeley DB could be obtained from
2379 <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
2380 page with far newer versions listed.
2381 It is probably wise to plan to move your storage configurations away from
2382 Berkeley DB format, as today there are smaller and simpler alternatives more
2383 suited to Exim&#x2019;s usage model.
2384 </para>
2385 </listitem>
2386 <listitem>
2387 <para>
2388 <indexterm role="concept">
2389 <primary><emphasis>tdb</emphasis> DBM library</primary>
2390 </indexterm>
2391 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2392 <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
2393 operates on a single file.
2394 </para>
2395 </listitem>
2396 </orderedlist>
2397 <para>
2398 <indexterm role="concept">
2399 <primary>USE_DB</primary>
2400 </indexterm>
2401 <indexterm role="concept">
2402 <primary>DBM libraries</primary>
2403 <secondary>configuration for building</secondary>
2404 </indexterm>
2405 Exim and its utilities can be compiled to use any of these interfaces. In order
2406 to use any version of the Berkeley DB package in native mode, you must set
2407 USE_DB in an appropriate configuration file (typically
2408 <filename>Local/Makefile</filename>). For example:
2409 </para>
2410 <literallayout class="monospaced">
2411 USE_DB=yes
2412 </literallayout>
2413 <para>
2414 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2415 error is diagnosed if you set more than one of these.
2416 </para>
2417 <para>
2418 At the lowest level, the build-time configuration sets none of these options,
2419 thereby assuming an interface of type (1). However, some operating system
2420 configuration files (for example, those for the BSD operating systems and
2421 Linux) assume type (4) by setting USE_DB as their default, and the
2422 configuration files for Cygwin set USE_GDBM. Anything you set in
2423 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2424 </para>
2425 <para>
2426 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2427 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2428 in one of these lines:
2429 </para>
2430 <literallayout class="monospaced">
2431 DBMLIB = -ldb
2432 DBMLIB = -ltdb
2433 </literallayout>
2434 <para>
2435 Settings like that will work if the DBM library is installed in the standard
2436 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2437 the default path. You may need to set INCLUDE to specify where the header
2438 file is, and to specify the path to the library more fully in DBMLIB, as in
2439 this example:
2440 </para>
2441 <literallayout class="monospaced">
2442 INCLUDE=-I/usr/local/include/db-4.1
2443 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2444 </literallayout>
2445 <para>
2446 There is further detailed discussion about the various DBM libraries in the
2447 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2448 </para>
2449 </section>
2450 <section id="SECID25">
2451 <title>Pre-building configuration</title>
2452 <para>
2453 <indexterm role="concept">
2454 <primary>building Exim</primary>
2455 <secondary>pre-building configuration</secondary>
2456 </indexterm>
2457 <indexterm role="concept">
2458 <primary>configuration for building Exim</primary>
2459 </indexterm>
2460 <indexterm role="concept">
2461 <primary><filename>Local/Makefile</filename></primary>
2462 </indexterm>
2463 <indexterm role="concept">
2464 <primary><filename>src/EDITME</filename></primary>
2465 </indexterm>
2466 Before building Exim, a local configuration file that specifies options
2467 independent of any operating system has to be created with the name
2468 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2469 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2470 therein. These descriptions are therefore not repeated here. If you are
2471 building Exim for the first time, the simplest thing to do is to copy
2472 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2473 </para>
2474 <para>
2475 There are three settings that you must supply, because Exim will not build
2476 without them. They are the location of the runtime configuration file
2477 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2478 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2479 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2480 a colon-separated list of filenames; Exim uses the first of them that exists.
2481 </para>
2482 <para>
2483 There are a few other parameters that can be specified either at build time or
2484 at runtime, to enable the same binary to be used on a number of different
2485 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2486 directory (if not within the spool directory) are fixed, it is recommended that
2487 you specify them in <filename>Local/Makefile</filename> instead of at runtime, so that errors
2488 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2489 be logged.
2490 </para>
2491 <para>
2492 <indexterm role="concept">
2493 <primary>content scanning</primary>
2494 <secondary>specifying at build time</secondary>
2495 </indexterm>
2496 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2497 access control lists are not compiled by default. If you want to include these
2498 facilities, you need to set
2499 </para>
2500 <literallayout class="monospaced">
2501 WITH_CONTENT_SCAN=yes
2502 </literallayout>
2503 <para>
2504 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2505 chapter <xref linkend="CHAPexiscan"/>.
2506 </para>
2507 <para>
2508 <indexterm role="concept">
2509 <primary><filename>Local/eximon.conf</filename></primary>
2510 </indexterm>
2511 <indexterm role="concept">
2512 <primary><filename>exim_monitor/EDITME</filename></primary>
2513 </indexterm>
2514 If you are going to build the Exim monitor, a similar configuration process is
2515 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2516 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2517 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2518 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2519 </para>
2520 <para>
2521 This is all the configuration that is needed in straightforward cases for known
2522 operating systems. However, the building process is set up so that it is easy
2523 to override options that are set by default or by operating-system-specific
2524 configuration files, for example, to change the C compiler, which
2525 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2526 do this.
2527 </para>
2528 </section>
2529 <section id="SECID26">
2530 <title>Support for iconv()</title>
2531 <para>
2532 <indexterm role="concept">
2533 <primary><function>iconv()</function> support</primary>
2534 </indexterm>
2535 <indexterm role="concept">
2536 <primary>RFC 2047</primary>
2537 </indexterm>
2538 The contents of header lines in messages may be encoded according to the rules
2539 described RFC 2047. This makes it possible to transmit characters that are not
2540 in the ASCII character set, and to label them as being in a particular
2541 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2542 mechanism, it decodes them, and translates them into a specified character set
2543 (default is set at build time). The translation is possible only if the operating system
2544 supports the <function>iconv()</function> function.
2545 </para>
2546 <para>
2547 However, some of the operating systems that supply <function>iconv()</function> do not support
2548 very many conversions. The GNU <option>libiconv</option> library (available from
2549 <emphasis role="bold"><ulink url="https://www.gnu.org/software/libiconv/">https://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2550 systems to remedy this deficiency, as well as on systems that do not supply
2551 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2552 </para>
2553 <literallayout class="monospaced">
2554 HAVE_ICONV=yes
2555 </literallayout>
2556 <para>
2557 to your <filename>Local/Makefile</filename> and rebuild Exim.
2558 </para>
2559 </section>
2560 <section id="SECTinctlsssl">
2561 <title>Including TLS/SSL encryption support</title>
2562 <para>
2563 <indexterm role="concept">
2564 <primary>TLS</primary>
2565 <secondary>including support for TLS</secondary>
2566 </indexterm>
2567 <indexterm role="concept">
2568 <primary>encryption</primary>
2569 <secondary>including support for</secondary>
2570 </indexterm>
2571 <indexterm role="concept">
2572 <primary>OpenSSL</primary>
2573 <secondary>building Exim with</secondary>
2574 </indexterm>
2575 <indexterm role="concept">
2576 <primary>GnuTLS</primary>
2577 <secondary>building Exim with</secondary>
2578 </indexterm>
2579 Exim is usually built to support encrypted SMTP connections, using the STARTTLS
2580 command as per RFC 2487. It can also support clients that expect to
2581 start a TLS session immediately on connection to a non-standard port (see the
2582 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2583 line option).
2584 </para>
2585 <para>
2586 If you want to build Exim with TLS support, you must first install either the
2587 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2588 implementing SSL.
2589 </para>
2590 <para>
2591 If you do not want TLS support you should set
2592 </para>
2593 <literallayout class="monospaced">
2594 DISABLE_TLS=yes
2595 </literallayout>
2596 <para>
2597 in <filename>Local/Makefile</filename>.
2598 </para>
2599 <para>
2600 If OpenSSL is installed, you should set
2601 </para>
2602 <literallayout class="monospaced">
2603 USE_OPENSL=yes
2604 TLS_LIBS=-lssl -lcrypto
2605 </literallayout>
2606 <para>
2607 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2608 OpenSSL library and include files. For example:
2609 </para>
2610 <literallayout class="monospaced">
2611 USE_OPENSSL=yes
2612 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2613 TLS_INCLUDE=-I/usr/local/openssl/include/
2614 </literallayout>
2615 <para>
2616 <indexterm role="concept">
2617 <primary>pkg-config</primary>
2618 <secondary>OpenSSL</secondary>
2619 </indexterm>
2620 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2621 </para>
2622 <literallayout class="monospaced">
2623 USE_OPENSSL=yes
2624 USE_OPENSSL_PC=openssl
2625 </literallayout>
2626 <para>
2627 <indexterm role="concept">
2628 <primary>USE_GNUTLS</primary>
2629 </indexterm>
2630 If GnuTLS is installed, you should set
2631 </para>
2632 <literallayout class="monospaced">
2633 USE_GNUTLS=yes
2634 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2635 </literallayout>
2636 <para>
2637 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2638 library and include files. For example:
2639 </para>
2640 <literallayout class="monospaced">
2641 USE_GNUTLS=yes
2642 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2643 TLS_INCLUDE=-I/usr/gnu/include
2644 </literallayout>
2645 <para>
2646 <indexterm role="concept">
2647 <primary>pkg-config</primary>
2648 <secondary>GnuTLS</secondary>
2649 </indexterm>
2650 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2651 </para>
2652 <literallayout class="monospaced">
2653 USE_GNUTLS=yes
2654 USE_GNUTLS_PC=gnutls
2655 </literallayout>
2656 <para>
2657 You do not need to set TLS_INCLUDE if the relevant directory is already
2658 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2659 given in chapter <xref linkend="CHAPTLS"/>.
2660 </para>
2661 </section>
2662 <section id="SECID27">
2663 <title>Use of tcpwrappers</title>
2664 <para>
2665 <indexterm role="concept">
2666 <primary>tcpwrappers, building Exim to support</primary>
2667 </indexterm>
2668 <indexterm role="concept">
2669 <primary>USE_TCP_WRAPPERS</primary>
2670 </indexterm>
2671 <indexterm role="concept">
2672 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2673 </indexterm>
2674 <indexterm role="concept">
2675 <primary>tcp_wrappers_daemon_name</primary>
2676 </indexterm>
2677 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2678 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2679 alternative to Exim&#x2019;s own checking facilities for installations that are
2680 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2681 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2682 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2683 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2684 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2685 you might have
2686 </para>
2687 <literallayout class="monospaced">
2688 USE_TCP_WRAPPERS=yes
2689 CFLAGS=-O -I/usr/local/include
2690 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2691 </literallayout>
2692 <para>
2693 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2694 files is <quote>exim</quote>. For example, the line
2695 </para>
2696 <literallayout class="monospaced">
2697 exim : LOCAL  192.168.1.  .friendly.domain.example
2698 </literallayout>
2699 <para>
2700 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2701 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2702 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2703 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2704 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2705 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2706 further details.
2707 </para>
2708 </section>
2709 <section id="SECID28">
2710 <title>Including support for IPv6</title>
2711 <para>
2712 <indexterm role="concept">
2713 <primary>IPv6</primary>
2714 <secondary>including support for</secondary>
2715 </indexterm>
2716 Exim contains code for use on systems that have IPv6 support. Setting
2717 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2718 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2719 where the IPv6 support is not fully integrated into the normal include and
2720 library files.
2721 </para>
2722 <para>
2723 Two different types of DNS record for handling IPv6 addresses have been
2724 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2725 currently seen as the mainstream. Another record type called A6 was proposed
2726 as better than AAAA because it had more flexibility. However, it was felt to be
2727 over-complex, and its status was reduced to <quote>experimental</quote>.
2728 Exim used to
2729 have a compile option for including A6 record support but this has now been
2730 withdrawn.
2731 </para>
2732 </section>
2733 <section id="SECTdynamicmodules">
2734 <title>Dynamically loaded lookup module support</title>
2735 <para>
2736 <indexterm role="concept">
2737 <primary>lookup modules</primary>
2738 </indexterm>
2739 <indexterm role="concept">
2740 <primary>dynamic modules</primary>
2741 </indexterm>
2742 <indexterm role="concept">
2743 <primary>.so building</primary>
2744 </indexterm>
2745 On some platforms, Exim supports not compiling all lookup types directly into
2746 the main binary, instead putting some into external modules which can be loaded
2747 on demand.
2748 This permits packagers to build Exim with support for lookups with extensive
2749 library dependencies without requiring all users to install all of those
2750 dependencies.
2751 Most, but not all, lookup types can be built this way.
2752 </para>
2753 <para>
2754 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2755 installed; Exim will only load modules from that directory, as a security
2756 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2757 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2758 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2759 see <filename>src/EDITME</filename> for details.
2760 </para>
2761 <para>
2762 Then, for each module to be loaded dynamically, define the relevant
2763 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2764 For example, this will build in lsearch but load sqlite and mysql support
2765 on demand:
2766 </para>
2767 <literallayout class="monospaced">
2768 LOOKUP_LSEARCH=yes
2769 LOOKUP_SQLITE=2
2770 LOOKUP_MYSQL=2
2771 </literallayout>
2772 </section>
2773 <section id="SECID29">
2774 <title>The building process</title>
2775 <para>
2776 <indexterm role="concept">
2777 <primary>build directory</primary>
2778 </indexterm>
2779 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2780 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2781 operating system types, and creates a build directory if one does not exist.
2782 For example, on a Sun system running Solaris 8, the directory
2783 <filename>build-SunOS5-5.8-sparc</filename> is created.
2784 <indexterm role="concept">
2785 <primary>symbolic link</primary>
2786 <secondary>to source files</secondary>
2787 </indexterm>
2788 Symbolic links to relevant source files are installed in the build directory.
2789 </para>
2790 <para>
2791 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2792 a make file inside the build directory, using the configuration files from the
2793 <filename>Local</filename> directory. The new make file is then passed to another instance of
2794 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2795 then compiling and linking the binaries for the Exim monitor (if configured), a
2796 number of utility programs, and finally Exim itself. The command <literal>make
2797 makefile</literal> can be used to force a rebuild of the make file in the build
2798 directory, should this ever be necessary.
2799 </para>
2800 <para>
2801 If you have problems building Exim, check for any comments there may be in the
2802 <filename>README</filename> file concerning your operating system, and also take a look at the
2803 FAQ, where some common problems are covered.
2804 </para>
2805 </section>
2806 <section id="SECID283">
2807 <title>Output from <quote>make</quote></title>
2808 <para>
2809 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2810 unreadable, because these lines can be very long. For this reason, the normal
2811 output is suppressed by default, and instead output similar to that which
2812 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2813 each module that is being compiled or linked. However, it is still possible to
2814 get the full output, by calling <emphasis>make</emphasis> like this:
2815 </para>
2816 <literallayout class="monospaced">
2817 FULLECHO='' make -e
2818 </literallayout>
2819 <para>
2820 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2821 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2822 given in addition to the short output.
2823 </para>
2824 </section>
2825 <section id="SECToverride">
2826 <title>Overriding build-time options for Exim</title>
2827 <para>
2828 <indexterm role="concept">
2829 <primary>build-time options, overriding</primary>
2830 </indexterm>
2831 The main make file that is created at the beginning of the building process
2832 consists of the concatenation of a number of files which set configuration
2833 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2834 more than once, the last setting overrides any previous ones. This provides a
2835 convenient way of overriding defaults. The files that are concatenated are, in
2836 order:
2837 </para>
2838 <literallayout>
2839 <filename>OS/Makefile-Default</filename>
2840 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2841 <filename>Local/Makefile</filename>
2842 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2843 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2844 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2845 <filename>OS/Makefile-Base</filename>
2846 </literallayout>
2847 <para>
2848 <indexterm role="concept">
2849 <primary><filename>Local/Makefile</filename></primary>
2850 </indexterm>
2851 <indexterm role="concept">
2852 <primary>building Exim</primary>
2853 <secondary>operating system type</secondary>
2854 </indexterm>
2855 <indexterm role="concept">
2856 <primary>building Exim</primary>
2857 <secondary>architecture type</secondary>
2858 </indexterm>
2859 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2860 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2861 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2862 and are often not needed.
2863 </para>
2864 <para>
2865 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2866 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2867 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2868 values are used, thereby providing a means of forcing particular settings.
2869 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2870 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2871 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2872 that Exim expects. You can run these scripts directly from the shell in order
2873 to find out what values are being used on your system.
2874 </para>
2875 <para>
2876 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2877 therein. Some (but not all) are mentioned below. If there is something that
2878 needs changing, review the contents of this file and the contents of the make
2879 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2880 default values are.
2881 </para>
2882 <para>
2883 <indexterm role="concept">
2884 <primary>building Exim</primary>
2885 <secondary>overriding default settings</secondary>
2886 </indexterm>
2887 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2888 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2889 need to change the original files. Instead, you should make the changes by
2890 putting the new values in an appropriate <filename>Local</filename> file. For example,
2891 <indexterm role="concept">
2892 <primary>Tru64-Unix build-time settings</primary>
2893 </indexterm>
2894 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2895 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2896 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2897 called with the option <option>-std1</option>, to make it recognize some of the features of
2898 Standard C that Exim uses. (Most other compilers recognize Standard C by
2899 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2900 containing the lines
2901 </para>
2902 <literallayout class="monospaced">
2903 CC=cc
2904 CFLAGS=-std1
2905 </literallayout>
2906 <para>
2907 If you are compiling for just one operating system, it may be easier to put
2908 these lines directly into <filename>Local/Makefile</filename>.
2909 </para>
2910 <para>
2911 Keeping all your local configuration settings separate from the distributed
2912 files makes it easy to transfer them to new versions of Exim simply by copying
2913 the contents of the <filename>Local</filename> directory.
2914 </para>
2915 <para>
2916 <indexterm role="concept">
2917 <primary>NIS lookup type</primary>
2918 <secondary>including support for</secondary>
2919 </indexterm>
2920 <indexterm role="concept">
2921 <primary>NIS+ lookup type</primary>
2922 <secondary>including support for</secondary>
2923 </indexterm>
2924 <indexterm role="concept">
2925 <primary>LDAP</primary>
2926 <secondary>including support for</secondary>
2927 </indexterm>
2928 <indexterm role="concept">
2929 <primary>lookup</primary>
2930 <secondary>inclusion in binary</secondary>
2931 </indexterm>
2932 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2933 lookup, but not all systems have these components installed, so the default is
2934 not to include the relevant code in the binary. All the different kinds of file
2935 and database lookup that Exim supports are implemented as separate code modules
2936 which are included only if the relevant compile-time options are set. In the
2937 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2938 </para>
2939 <literallayout class="monospaced">
2940 LOOKUP_LDAP=yes
2941 LOOKUP_NIS=yes
2942 LOOKUP_NISPLUS=yes
2943 </literallayout>
2944 <para>
2945 and similar settings apply to the other lookup types. They are all listed in
2946 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2947 libraries need to be installed before compiling Exim.
2948 <indexterm role="concept">
2949 <primary>cdb</primary>
2950 <secondary>including support for</secondary>
2951 </indexterm>
2952 However, there are some optional lookup types (such as cdb) for which
2953 the code is entirely contained within Exim, and no external include
2954 files or libraries are required. When a lookup type is not included in the
2955 binary, attempts to configure Exim to use it cause runtime configuration
2956 errors.
2957 </para>
2958 <para>
2959 <indexterm role="concept">
2960 <primary>pkg-config</primary>
2961 <secondary>lookups</secondary>
2962 </indexterm>
2963 <indexterm role="concept">
2964 <primary>pkg-config</primary>
2965 <secondary>authenticators</secondary>
2966 </indexterm>
2967 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
2968 about how to compile against a library; Exim has some initial support for
2969 being able to use pkg-config for lookups and authenticators.  For any given
2970 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
2971 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
2972 name of the package to be queried.  The results of querying via the
2973 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
2974 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
2975 syntax.  For instance:
2976 </para>
2977 <literallayout class="monospaced">
2978 LOOKUP_SQLITE=yes
2979 LOOKUP_SQLITE_PC=sqlite3
2980 AUTH_GSASL=yes
2981 AUTH_GSASL_PC=libgsasl
2982 AUTH_HEIMDAL_GSSAPI=yes
2983 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
2984 </literallayout>
2985 <para>
2986 <indexterm role="concept">
2987 <primary>Perl</primary>
2988 <secondary>including support for</secondary>
2989 </indexterm>
2990 Exim can be linked with an embedded Perl interpreter, allowing Perl
2991 subroutines to be called during string expansion. To enable this facility,
2992 </para>
2993 <literallayout class="monospaced">
2994 EXIM_PERL=perl.o
2995 </literallayout>
2996 <para>
2997 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2998 chapter <xref linkend="CHAPperl"/>.
2999 </para>
3000 <para>
3001 <indexterm role="concept">
3002 <primary>X11 libraries, location of</primary>
3003 </indexterm>
3004 The location of the X11 libraries is something that varies a lot between
3005 operating systems, and there may be different versions of X11 to cope
3006 with. Exim itself makes no use of X11, but if you are compiling the Exim
3007 monitor, the X11 libraries must be available.
3008 The following three variables are set in <filename>OS/Makefile-Default</filename>:
3009 </para>
3010 <literallayout class="monospaced">
3011 X11=/usr/X11R6
3012 XINCLUDE=-I$(X11)/include
3013 XLFLAGS=-L$(X11)/lib
3014 </literallayout>
3015 <para>
3016 These are overridden in some of the operating-system configuration files. For
3017 example, in <filename>OS/Makefile-SunOS5</filename> there is
3018 </para>
3019 <literallayout class="monospaced">
3020 X11=/usr/openwin
3021 XINCLUDE=-I$(X11)/include
3022 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
3023 </literallayout>
3024 <para>
3025 If you need to override the default setting for your operating system, place a
3026 definition of all three of these variables into your
3027 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
3028 </para>
3029 <para>
3030 <indexterm role="concept">
3031 <primary>EXTRALIBS</primary>
3032 </indexterm>
3033 If you need to add any extra libraries to the link steps, these can be put in a
3034 variable called EXTRALIBS, which appears in all the link commands, but by
3035 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3036 command for linking the main Exim binary, and not for any associated utilities.
3037 </para>
3038 <para>
3039 <indexterm role="concept">
3040 <primary>DBM libraries</primary>
3041 <secondary>configuration for building</secondary>
3042 </indexterm>
3043 There is also DBMLIB, which appears in the link commands for binaries that
3044 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3045 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3046 binary, and which can be used, for example, to include additional X11
3047 libraries.
3048 </para>
3049 <para>
3050 <indexterm role="concept">
3051 <primary>configuration file</primary>
3052 <secondary>editing</secondary>
3053 </indexterm>
3054 The make file copes with rebuilding Exim correctly if any of the configuration
3055 files are edited. However, if an optional configuration file is deleted, it is
3056 necessary to touch the associated non-optional file (that is,
3057 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3058 </para>
3059 </section>
3060 <section id="SECID30">
3061 <title>OS-specific header files</title>
3062 <para>
3063 <indexterm role="concept">
3064 <primary><filename>os.h</filename></primary>
3065 </indexterm>
3066 <indexterm role="concept">
3067 <primary>building Exim</primary>
3068 <secondary>OS-specific C header files</secondary>
3069 </indexterm>
3070 The <filename>OS</filename> directory contains a number of files with names of the form
3071 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3072 normally need to be changed. There is a list of macro settings that are
3073 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3074 are porting Exim to a new operating system.
3075 </para>
3076 </section>
3077 <section id="SECID31">
3078 <title>Overriding build-time options for the monitor</title>
3079 <para>
3080 <indexterm role="concept">
3081 <primary>building Eximon</primary>
3082 </indexterm>
3083 A similar process is used for overriding things when building the Exim monitor,
3084 where the files that are involved are
3085 </para>
3086 <literallayout>
3087 <filename>OS/eximon.conf-Default</filename>
3088 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3089 <filename>Local/eximon.conf</filename>
3090 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3091 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3092 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3093 </literallayout>
3094 <para>
3095 <indexterm role="concept">
3096 <primary><filename>Local/eximon.conf</filename></primary>
3097 </indexterm>
3098 As with Exim itself, the final three files need not exist, and in this case the
3099 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3100 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3101 variables of the same name, preceded by EXIMON_. For example, setting
3102 EXIMON_LOG_DEPTH in the environment overrides the value of
3103 LOG_DEPTH at runtime.
3104 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3105 </para>
3106 </section>
3107 <section id="SECID32">
3108 <title>Installing Exim binaries and scripts</title>
3109 <para>
3110 <indexterm role="concept">
3111 <primary>installing Exim</primary>
3112 </indexterm>
3113 <indexterm role="concept">
3114 <primary>BIN_DIRECTORY</primary>
3115 </indexterm>
3116 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3117 arguments. The script copies binaries and utility scripts into the directory
3118 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3119 <indexterm role="concept">
3120 <primary>setuid</primary>
3121 <secondary>installing Exim with</secondary>
3122 </indexterm>
3123 The install script copies files only if they are newer than the files they are
3124 going to replace. The Exim binary is required to be owned by root and have the
3125 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3126 install</literal> as root so that it can set up the Exim binary in this way. However, in
3127 some special situations (for example, if a host is doing no local deliveries)
3128 it may be possible to run Exim without making the binary setuid root (see
3129 chapter <xref linkend="CHAPsecurity"/> for details).
3130 </para>
3131 <para>
3132 <indexterm role="concept">
3133 <primary>CONFIGURE_FILE</primary>
3134 </indexterm>
3135 Exim&#x2019;s runtime configuration file is named by the CONFIGURE_FILE setting
3136 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3137 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3138 by the installation script. If a runtime configuration file already exists, it
3139 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3140 alternative files, no default is installed.
3141 </para>
3142 <para>
3143 <indexterm role="concept">
3144 <primary>system aliases file</primary>
3145 </indexterm>
3146 <indexterm role="concept">
3147 <primary><filename>/etc/aliases</filename></primary>
3148 </indexterm>
3149 One change is made to the default configuration file when it is installed: the
3150 default configuration contains a router that references a system aliases file.
3151 The path to this file is set to the value specified by
3152 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3153 If the system aliases file does not exist, the installation script creates it,
3154 and outputs a comment to the user.
3155 </para>
3156 <para>
3157 The created file contains no aliases, but it does contain comments about the
3158 aliases a site should normally have. Mail aliases have traditionally been
3159 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3160 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3161 Exim&#x2019;s configuration if necessary.
3162 </para>
3163 <para>
3164 The default configuration uses the local host&#x2019;s name as the only local domain,
3165 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3166 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3167 directories are supported, but no NIS or NIS+ support is configured. Domains
3168 other than the name of the local host are routed using the DNS, with delivery
3169 over SMTP.
3170 </para>
3171 <para>
3172 It is possible to install Exim for special purposes (such as building a binary
3173 distribution) in a private part of the file system. You can do this by a
3174 command such as
3175 </para>
3176 <literallayout class="monospaced">
3177 make DESTDIR=/some/directory/ install
3178 </literallayout>
3179 <para>
3180 This has the effect of pre-pending the specified directory to all the file
3181 paths, except the name of the system aliases file that appears in the default
3182 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3183 For backwards compatibility, ROOT is used if DESTDIR is not set,
3184 but this usage is deprecated.
3185 </para>
3186 <para>
3187 <indexterm role="concept">
3188 <primary>installing Exim</primary>
3189 <secondary>what is not installed</secondary>
3190 </indexterm>
3191 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3192 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3193 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3194 directory are copied, except for the info files when you have set
3195 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3196 </para>
3197 <para>
3198 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3199 to their names. The Exim binary itself, however, is handled differently. It is
3200 installed under a name that includes the version number and the compile number,
3201 for example, <filename>exim-4.94.2-1</filename>. The script then arranges for a symbolic link
3202 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3203 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3204 from the directory (as seen by other processes).
3205 </para>
3206 <para>
3207 <indexterm role="concept">
3208 <primary>installing Exim</primary>
3209 <secondary>testing the script</secondary>
3210 </indexterm>
3211 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3212 real, you can pass the <option>-n</option> option to the installation script by this
3213 command:
3214 </para>
3215 <literallayout class="monospaced">
3216 make INSTALL_ARG=-n install
3217 </literallayout>
3218 <para>
3219 The contents of the variable INSTALL_ARG are passed to the installation
3220 script. You do not need to be root to run this test. Alternatively, you can run
3221 the installation script directly, but this must be from within the build
3222 directory. For example, from the top-level Exim directory you could use this
3223 command:
3224 </para>
3225 <literallayout class="monospaced">
3226 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3227 </literallayout>
3228 <para>
3229 <indexterm role="concept">
3230 <primary>installing Exim</primary>
3231 <secondary>install script options</secondary>
3232 </indexterm>
3233 There are two other options that can be supplied to the installation script.
3234 </para>
3235 <itemizedlist>
3236 <listitem>
3237 <para>
3238 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3239 to root, and the call to make it a setuid binary.
3240 </para>
3241 </listitem>
3242 <listitem>
3243 <para>
3244 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3245 installed binary.
3246 </para>
3247 </listitem>
3248 </itemizedlist>
3249 <para>
3250 INSTALL_ARG can be used to pass these options to the script. For example:
3251 </para>
3252 <literallayout class="monospaced">
3253 make INSTALL_ARG=-no_symlink install
3254 </literallayout>
3255 <para>
3256 The installation script can also be given arguments specifying which files are
3257 to be copied. For example, to install just the Exim binary, and nothing else,
3258 without creating the symbolic link, you could use:
3259 </para>
3260 <literallayout class="monospaced">
3261 make INSTALL_ARG='-no_symlink exim' install
3262 </literallayout>
3263 </section>
3264 <section id="SECTinsinfdoc">
3265 <title>Installing info documentation</title>
3266 <para>
3267 <indexterm role="concept">
3268 <primary>installing Exim</primary>
3269 <secondary><emphasis>info</emphasis> documentation</secondary>
3270 </indexterm>
3271 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3272 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3273 distribution. Instead it is available separately from the FTP site (see section
3274 <xref linkend="SECTavail"/>).
3275 </para>
3276 <para>
3277 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3278 source of the documentation is found in the source tree, running <literal>make
3279 install</literal> automatically builds the info files and installs them.
3280 </para>
3281 </section>
3282 <section id="SECID33">
3283 <title>Setting up the spool directory</title>
3284 <para>
3285 <indexterm role="concept">
3286 <primary>spool directory</primary>
3287 <secondary>creating</secondary>
3288 </indexterm>
3289 When it starts up, Exim tries to create its spool directory if it does not
3290 exist. The Exim uid and gid are used for the owner and group of the spool
3291 directory. Sub-directories are automatically created in the spool directory as
3292 necessary.
3293 </para>
3294 </section>
3295 <section id="SECID34">
3296 <title>Testing</title>
3297 <para>
3298 <indexterm role="concept">
3299 <primary>testing</primary>
3300 <secondary>installation</secondary>
3301 </indexterm>
3302 Having installed Exim, you can check that the runtime configuration file is
3303 syntactically valid by running the following command, which assumes that the
3304 Exim binary directory is within your PATH environment variable:
3305 </para>
3306 <literallayout class="monospaced">
3307 exim -bV
3308 </literallayout>
3309 <para>
3310 If there are any errors in the configuration file, Exim outputs error messages.
3311 Otherwise it outputs the version number and build date,
3312 the DBM library that is being used, and information about which drivers and
3313 other optional code modules are included in the binary.
3314 Some simple routing tests can be done by using the address testing option. For
3315 example,
3316 </para>
3317 <literallayout>
3318 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3319 </literallayout>
3320 <para>
3321 should verify that it recognizes a local mailbox, and
3322 </para>
3323 <literallayout>
3324 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3325 </literallayout>
3326 <para>
3327 a remote one. Then try getting it to deliver mail, both locally and remotely.
3328 This can be done by passing messages directly to Exim, without going through a
3329 user agent. For example:
3330 </para>
3331 <literallayout class="monospaced">
3332 exim -v postmaster@your.domain.example
3333 From: user@your.domain.example
3334 To: postmaster@your.domain.example
3335 Subject: Testing Exim
3336
3337 This is a test message.
3338 ^D
3339 </literallayout>
3340 <para>
3341 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3342 In this case you should see copies of three log lines, one for the message&#x2019;s
3343 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3344 </para>
3345 <para>
3346 <indexterm role="concept">
3347 <primary>delivery</primary>
3348 <secondary>problems with</secondary>
3349 </indexterm>
3350 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3351 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3352 of information is running Exim with debugging turned on, by specifying the
3353 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3354 with debugging turned on by a command of the form
3355 </para>
3356 <literallayout>
3357 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3358 </literallayout>
3359 <para>
3360 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3361 produces rather a lot of output, but you can cut this down to specific areas.
3362 For example, if you use <option>-d-all+route</option> only the debugging information
3363 relevant to routing is included. (See the <option>-d</option> option in chapter
3364 <xref linkend="CHAPcommandline"/> for more details.)
3365 </para>
3366 <para>
3367 <indexterm role="concept">
3368 <primary><quote>sticky</quote> bit</primary>
3369 </indexterm>
3370 <indexterm role="concept">
3371 <primary>lock files</primary>
3372 </indexterm>
3373 One specific problem that has shown up on some sites is the inability to do
3374 local deliveries into a shared mailbox directory, because it does not have the
3375 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3376 writing to a mailbox file, and if it cannot create the lock file, the delivery
3377 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3378 directory, or by setting a specific group for local deliveries and allowing
3379 that group to create files in the directory (see the comments above the
3380 <command>local_delivery</command> transport in the default configuration file). Another
3381 approach is to configure Exim not to use lock files, but just to rely on
3382 <function>fcntl()</function> locking instead. However, you should do this only if all user
3383 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3384 see chapter <xref linkend="CHAPappendfile"/>.
3385 </para>
3386 <para>
3387 One thing that cannot be tested on a system that is already running an MTA is
3388 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3389 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3390 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3391 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3392 incoming SMTP mail.
3393 </para>
3394 <para>
3395 Testing a new version on a system that is already running Exim can most easily
3396 be done by building a binary with a different CONFIGURE_FILE setting. From
3397 within the runtime configuration, all other file and directory names
3398 that Exim uses can be altered, in order to keep it entirely clear of the
3399 production version.
3400 </para>
3401 </section>
3402 <section id="SECID35">
3403 <title>Replacing another MTA with Exim</title>
3404 <para>
3405 <indexterm role="concept">
3406 <primary>replacing another MTA</primary>
3407 </indexterm>
3408 Building and installing Exim for the first time does not of itself put it in
3409 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3410 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3411 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3412 binary in order to get the user agents to pass messages to Exim. This is
3413 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3414 or <filename>/usr/lib/sendmail</filename>
3415 <indexterm role="concept">
3416 <primary>symbolic link</primary>
3417 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3418 </indexterm>
3419 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3420 privilege and executable status from the old MTA. It is then necessary to stop
3421 and restart the mailer daemon, if one is running.
3422 </para>
3423 <para>
3424 <indexterm role="concept">
3425 <primary>FreeBSD, MTA indirection</primary>
3426 </indexterm>
3427 <indexterm role="concept">
3428 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3429 </indexterm>
3430 Some operating systems have introduced alternative ways of switching MTAs. For
3431 example, if you are running FreeBSD, you need to edit the file
3432 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3433 described. A typical example of the contents of this file for running Exim is
3434 as follows:
3435 </para>
3436 <literallayout class="monospaced">
3437 sendmail            /usr/exim/bin/exim
3438 send-mail           /usr/exim/bin/exim
3439 mailq               /usr/exim/bin/exim -bp
3440 newaliases          /usr/bin/true
3441 </literallayout>
3442 <para>
3443 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3444 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3445 favourite user agent.
3446 </para>
3447 <para>
3448 You should consider what to tell your users about the change of MTA. Exim may
3449 have different capabilities to what was previously running, and there are
3450 various operational differences such as the text of messages produced by
3451 command line options and in bounce messages. If you allow your users to make
3452 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3453 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3454 </para>
3455 </section>
3456 <section id="SECID36">
3457 <title>Upgrading Exim</title>
3458 <para>
3459 <indexterm role="concept">
3460 <primary>upgrading Exim</primary>
3461 </indexterm>
3462 If you are already running Exim on your host, building and installing a new
3463 version automatically makes it available to MUAs, or any other programs that
3464 call the MTA directly. However, if you are running an Exim daemon, you do need
3465 <indexterm role="concept">
3466 <primary>restart</primary>
3467 <secondary>on HUP signal</secondary>
3468 </indexterm>
3469 <indexterm role="concept">
3470 <primary>signal</primary>
3471 <secondary>HUP, to restart</secondary>
3472 </indexterm>
3473 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3474 new binary. You do not need to stop processing mail in order to install a new
3475 version of Exim. The install script does not modify an existing runtime
3476 configuration file.
3477 </para>
3478 </section>
3479 <section id="SECID37">
3480 <title>Stopping the Exim daemon on Solaris</title>
3481 <para>
3482 <indexterm role="concept">
3483 <primary>Solaris</primary>
3484 <secondary>stopping Exim on</secondary>
3485 </indexterm>
3486 The standard command for stopping the mailer daemon on Solaris is
3487 </para>
3488 <literallayout class="monospaced">
3489 /etc/init.d/sendmail stop
3490 </literallayout>
3491 <para>
3492 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3493 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3494 for the text <quote>sendmail</quote>; this is not present because the actual program name
3495 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3496 solution is to replace the line that finds the process id with something like
3497 </para>
3498 <literallayout class="monospaced">
3499 pid=`cat /var/spool/exim/exim-daemon.pid`
3500 </literallayout>
3501 <para>
3502 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3503 </para>
3504 <para>
3505 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3506 still be received from local processes, and if automatic delivery is configured
3507 (the normal case), deliveries will still occur.
3508 </para>
3509 </section>
3510 </chapter>
3511
3512 <chapter id="CHAPcommandline">
3513 <title>The Exim command line</title>
3514 <para>
3515 <indexterm role="concept" id="IIDclo1" class="startofrange">
3516 <primary>command line</primary>
3517 <secondary>options</secondary>
3518 </indexterm>
3519 <indexterm role="concept" id="IIDclo2" class="startofrange">
3520 <primary>options</primary>
3521 <secondary>command line</secondary>
3522 </indexterm>
3523 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3524 each starting with a hyphen character, followed by a number of arguments. The
3525 options are compatible with the main options of Sendmail, and there are also
3526 some additional options, some of which are compatible with Smail 3. Certain
3527 combinations of options do not make sense, and provoke an error if used.
3528 The form of the arguments depends on which options are set.
3529 </para>
3530 <section id="SECID38">
3531 <title>Setting options by program name</title>
3532 <para>
3533 <indexterm role="concept">
3534 <primary><emphasis>mailq</emphasis></primary>
3535 </indexterm>
3536 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3537 were present before any other options.
3538 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3539 standard output.
3540 This feature is for compatibility with some systems that contain a command of
3541 that name in one of the standard libraries, symbolically linked to
3542 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3543 </para>
3544 <para>
3545 <indexterm role="concept">
3546 <primary><emphasis>rsmtp</emphasis></primary>
3547 </indexterm>
3548 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3549 were present before any other options, for compatibility with Smail. The
3550 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3551 format.
3552 </para>
3553 <para>
3554 <indexterm role="concept">
3555 <primary><emphasis>rmail</emphasis></primary>
3556 </indexterm>
3557 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3558 <option>-oee</option> options were present before any other options, for compatibility with
3559 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3560 </para>
3561 <para>
3562 <indexterm role="concept">
3563 <primary><emphasis>runq</emphasis></primary>
3564 </indexterm>
3565 <indexterm role="concept">
3566 <primary>queue runner</primary>
3567 </indexterm>
3568 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3569 were present before any other options, for compatibility with Smail. The <option>-q</option>
3570 option causes a single queue runner process to be started.
3571 </para>
3572 <para>
3573 <indexterm role="concept">
3574 <primary><emphasis>newaliases</emphasis></primary>
3575 </indexterm>
3576 <indexterm role="concept">
3577 <primary>alias file</primary>
3578 <secondary>building</secondary>
3579 </indexterm>
3580 <indexterm role="concept">
3581 <primary>Sendmail compatibility</primary>
3582 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3583 </indexterm>
3584 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3585 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3586 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3587 the concept of a single alias file, but can be configured to run a given
3588 command if called with the <option>-bi</option> option.
3589 </para>
3590 </section>
3591 <section id="SECTtrustedadmin">
3592 <title>Trusted and admin users</title>
3593 <para>
3594 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3595 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3596 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3597 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3598 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3599 </para>
3600 <itemizedlist>
3601 <listitem>
3602 <para>
3603 <indexterm role="concept">
3604 <primary>trusted users</primary>
3605 <secondary>definition of</secondary>
3606 </indexterm>
3607 <indexterm role="concept">
3608 <primary>user</primary>
3609 <secondary>trusted definition of</secondary>
3610 </indexterm>
3611 The trusted users are root, the Exim user, any user listed in the
3612 <option>trusted_users</option> configuration option, and any user whose current group or any
3613 supplementary group is one of those listed in the <option>trusted_groups</option>
3614 configuration option. Note that the Exim group is not automatically trusted.
3615 </para>
3616 <para>
3617 <indexterm role="concept">
3618 <primary><quote>From</quote> line</primary>
3619 </indexterm>
3620 <indexterm role="concept">
3621 <primary>envelope from</primary>
3622 </indexterm>
3623 <indexterm role="concept">
3624 <primary>envelope sender</primary>
3625 </indexterm>
3626 Trusted users are always permitted to use the <option>-f</option> option or a leading
3627 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3628 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3629 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3630 users to set envelope senders.
3631 </para>
3632 <para>
3633 <indexterm role="concept">
3634 <primary><emphasis>From:</emphasis> header line</primary>
3635 </indexterm>
3636 <indexterm role="concept">
3637 <primary><emphasis>Sender:</emphasis> header line</primary>
3638 </indexterm>
3639 <indexterm role="concept">
3640 <primary>header lines</primary>
3641 <secondary>From:</secondary>
3642 </indexterm>
3643 <indexterm role="concept">
3644 <primary>header lines</primary>
3645 <secondary>Sender:</secondary>
3646 </indexterm>
3647 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3648 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3649 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3650 </para>
3651 <para>
3652 Trusted users may also specify a host name, host address, interface address,
3653 protocol name, ident value, and authentication data when submitting a message
3654 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3655 have the characteristics of messages received from a remote host. Untrusted
3656 users may in some circumstances use <option>-f</option>, but can never set the other values
3657 that are available to trusted users.
3658 </para>
3659 </listitem>
3660 <listitem>
3661 <para>
3662 <indexterm role="concept">
3663 <primary>user</primary>
3664 <secondary>admin definition of</secondary>
3665 </indexterm>
3666 <indexterm role="concept">
3667 <primary>admin user</primary>
3668 <secondary>definition of</secondary>
3669 </indexterm>
3670 The admin users are root, the Exim user, and any user that is a member of the
3671 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3672 The current group does not have to be one of these groups.
3673 </para>
3674 <para>
3675 Admin users are permitted to list the queue, and to carry out certain
3676 operations on messages, for example, to force delivery failures. It is also
3677 necessary to be an admin user in order to see the full information provided by
3678 the Exim monitor, and full debugging output.
3679 </para>
3680 <para>
3681 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3682 Exim to attempt delivery of messages on its queue is restricted to admin users.
3683 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3684 option false (that is, specifying <option>no_prod_requires_admin</option>).
3685 </para>
3686 <para>
3687 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3688 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3689 false.
3690 </para>
3691 </listitem>
3692 </itemizedlist>
3693 <para>
3694 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3695 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3696 getting root. There is further discussion of this issue at the start of chapter
3697 <xref linkend="CHAPconf"/>.
3698 </para>
3699 </section>
3700 <section id="SECID39">
3701 <title>Command line options</title>
3702 <para>
3703 Exim&#x2019;s command line options are described in alphabetical order below. If none
3704 of the options that specifies a specific action (such as starting the daemon or
3705 a queue runner, or testing an address, or receiving a message in a specific
3706 format, or listing the queue) are present, and there is at least one argument
3707 on the command line, <option>-bm</option> (accept a local message on the standard input,
3708 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3709 outputs a brief message about itself and exits.
3710 </para>
3711 <!-- === Start of command line options === -->
3712 <variablelist>
3713 <varlistentry>
3714 <term><option>--</option></term>
3715 <listitem>
3716 <para>
3717 <indexterm role="option">
3718 <primary>--</primary>
3719 </indexterm>
3720 <indexterm role="concept">
3721 <primary>options</primary>
3722 <secondary>command line; terminating</secondary>
3723 </indexterm>
3724 This is a pseudo-option whose only purpose is to terminate the options and
3725 therefore to cause subsequent command line items to be treated as arguments
3726 rather than options, even if they begin with hyphens.
3727 </para>
3728 </listitem></varlistentry>
3729 <varlistentry>
3730 <term><option>--help</option></term>
3731 <listitem>
3732 <para>
3733 <indexterm role="option">
3734 <primary><option>--help</option></primary>
3735 </indexterm>
3736 This option causes Exim to output a few sentences stating what it is.
3737 The same output is generated if the Exim binary is called with no options and
3738 no arguments.
3739 </para>
3740 </listitem></varlistentry>
3741 <varlistentry>
3742 <term><option>--version</option></term>
3743 <listitem>
3744 <para>
3745 <indexterm role="option">
3746 <primary><option>--version</option></primary>
3747 </indexterm>
3748 This option is an alias for <option>-bV</option> and causes version information to be
3749 displayed.
3750 </para>
3751 </listitem></varlistentry>
3752 <varlistentry>
3753 <term><option>-Ac</option></term>
3754 <term><option>-Am</option></term>
3755 <listitem>
3756 <para>
3757 <indexterm role="option">
3758 <primary><option>-Ac</option></primary>
3759 </indexterm>
3760 <indexterm role="option">
3761 <primary><option>-Am</option></primary>
3762 </indexterm>
3763 These options are used by Sendmail for selecting configuration files and are
3764 ignored by Exim.
3765 </para>
3766 </listitem></varlistentry>
3767 <varlistentry>
3768 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3769 <listitem>
3770 <para>
3771 <indexterm role="option">
3772 <primary><option>-B</option></primary>
3773 </indexterm>
3774 <indexterm role="concept">
3775 <primary>8-bit characters</primary>
3776 </indexterm>
3777 <indexterm role="concept">
3778 <primary>Sendmail compatibility</primary>
3779 <secondary>8-bit characters</secondary>
3780 </indexterm>
3781 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3782 clean; it ignores this option.
3783 </para>
3784 </listitem></varlistentry>
3785 <varlistentry>
3786 <term><option>-bd</option></term>
3787 <listitem>
3788 <para>
3789 <indexterm role="option">
3790 <primary><option>-bd</option></primary>
3791 </indexterm>
3792 <indexterm role="concept">
3793 <primary>daemon</primary>
3794 </indexterm>
3795 <indexterm role="concept">
3796 <primary>SMTP</primary>
3797 <secondary>listener</secondary>
3798 </indexterm>
3799 <indexterm role="concept">
3800 <primary>queue runner</primary>
3801 </indexterm>
3802 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3803 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3804 that the daemon should also initiate periodic queue runs.
3805 </para>
3806 <para>
3807 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3808 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3809 disconnect from the controlling terminal. When running this way, it can be
3810 stopped by pressing ctrl-C.
3811 </para>
3812 <para>
3813 By default, Exim listens for incoming connections to the standard SMTP port on
3814 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3815 ports, on multiple ports, and only on specific interfaces. Chapter
3816 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3817 </para>
3818 <para>
3819 When a listening daemon
3820 <indexterm role="concept">
3821 <primary>daemon</primary>
3822 <secondary>process id (pid)</secondary>
3823 </indexterm>
3824 <indexterm role="concept">
3825 <primary>pid (process id)</primary>
3826 <secondary>of daemon</secondary>
3827 </indexterm>
3828 is started without the use of <option>-oX</option> (that is, without overriding the normal
3829 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3830 in Exim&#x2019;s spool directory. This location can be overridden by setting
3831 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3832 running as root.
3833 </para>
3834 <para>
3835 When <option>-oX</option> is used on the command line to start a listening daemon, the
3836 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3837 used to specify a path on the command line if a pid file is required.
3838 </para>
3839 <para>
3840 The SIGHUP signal
3841 <indexterm role="concept">
3842 <primary>SIGHUP</primary>
3843 </indexterm>
3844 <indexterm role="concept">
3845 <primary>restart</primary>
3846 <secondary>on HUP signal</secondary>
3847 </indexterm>
3848 <indexterm role="concept">
3849 <primary>signal</primary>
3850 <secondary>HUP, to restart</secondary>
3851 </indexterm>
3852 <indexterm role="concept">
3853 <primary>daemon</primary>
3854 <secondary>restarting</secondary>
3855 </indexterm>
3856 <indexterm role="concept">
3857 <primary>signal</primary>
3858 <secondary>to reload configuration</secondary>
3859 </indexterm>
3860 <indexterm role="concept">
3861 <primary>daemon</primary>
3862 <secondary>reload configuration</secondary>
3863 </indexterm>
3864 <indexterm role="concept">
3865 <primary>reload</primary>
3866 <secondary>configuration</secondary>
3867 </indexterm>
3868 can be used to cause the daemon to re-execute itself. This should be done
3869 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3870 means of the <option>.include</option> facility, is changed, and also whenever a new version
3871 of Exim is installed. It is not necessary to do this when other files that are
3872 referenced from the configuration (for example, alias files) are changed,
3873 because these are reread each time they are used.
3874 </para>
3875 </listitem></varlistentry>
3876 <varlistentry>
3877 <term><option>-bdf</option></term>
3878 <listitem>
3879 <para>
3880 <indexterm role="option">
3881 <primary><option>-bdf</option></primary>
3882 </indexterm>
3883 This option has the same effect as <option>-bd</option> except that it never disconnects
3884 from the controlling terminal, even when no debugging is specified.
3885 </para>
3886 </listitem></varlistentry>
3887 <varlistentry>
3888 <term><option>-be</option></term>
3889 <listitem>
3890 <para>
3891 <indexterm role="option">
3892 <primary><option>-be</option></primary>
3893 </indexterm>
3894 <indexterm role="concept">
3895 <primary>testing</primary>
3896 <secondary>string expansion</secondary>
3897 </indexterm>
3898 <indexterm role="concept">
3899 <primary>expansion</primary>
3900 <secondary>testing</secondary>
3901 </indexterm>
3902 Run Exim in expansion testing mode. Exim discards its root privilege, to
3903 prevent ordinary users from using this mode to read otherwise inaccessible
3904 files. If no arguments are given, Exim runs interactively, prompting for lines
3905 of data. Otherwise, it processes each argument in turn.
3906 </para>
3907 <para>
3908 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3909 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3910 used without command line arguments. If successful, it uses the <function>readline()</function>
3911 function, which provides extensive line-editing facilities, for reading the
3912 test data. A line history is supported.
3913 </para>
3914 <para>
3915 Long expansion expressions can be split over several lines by using backslash
3916 continuations. As in Exim&#x2019;s runtime configuration, white space at the start of
3917 continuation lines is ignored. Each argument or data line is passed through the
3918 string expansion mechanism, and the result is output. Variable values from the
3919 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3920 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
3921 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3922 </para>
3923 <para>
3924 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3925 files or databases you are using, you must exit and restart Exim before trying
3926 the same lookup again. Otherwise, because each Exim process caches the results
3927 of lookups, you will just get the same result as before.
3928 </para>
3929 <para>
3930 Macro processing is done on lines before string-expansion: new macros can be
3931 defined and macros will be expanded.
3932 Because macros in the config file are often used for secrets, those are only
3933 available to admin users.
3934 </para>
3935 </listitem></varlistentry>
3936 <varlistentry>
3937 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3938 <listitem>
3939 <para>
3940 <indexterm role="option">
3941 <primary><option>-bem</option></primary>
3942 </indexterm>
3943 <indexterm role="concept">
3944 <primary>testing</primary>
3945 <secondary>string expansion</secondary>
3946 </indexterm>
3947 <indexterm role="concept">
3948 <primary>expansion</primary>
3949 <secondary>testing</secondary>
3950 </indexterm>
3951 This option operates like <option>-be</option> except that it must be followed by the name
3952 of a file. For example:
3953 </para>
3954 <literallayout class="monospaced">
3955 exim -bem /tmp/testmessage
3956 </literallayout>
3957 <para>
3958 The file is read as a message (as if receiving a locally-submitted non-SMTP
3959 message) before any of the test expansions are done. Thus, message-specific
3960 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3961 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3962 recipients are read from the headers in the normal way, and are shown in the
3963 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3964 line, because further arguments are taken as strings to expand (just like
3965 <option>-be</option>).
3966 </para>
3967 </listitem></varlistentry>
3968 <varlistentry>
3969 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3970 <listitem>
3971 <para>
3972 <indexterm role="option">
3973 <primary><option>-bF</option></primary>
3974 </indexterm>
3975 <indexterm role="concept">
3976 <primary>system filter</primary>
3977 <secondary>testing</secondary>
3978 </indexterm>
3979 <indexterm role="concept">
3980 <primary>testing</primary>
3981 <secondary>system filter</secondary>
3982 </indexterm>
3983 This option is the same as <option>-bf</option> except that it assumes that the filter being
3984 tested is a system filter. The additional commands that are available only in
3985 system filters are recognized.
3986 </para>
3987 </listitem></varlistentry>
3988 <varlistentry>
3989 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3990 <listitem>
3991 <para>
3992 <indexterm role="option">
3993 <primary><option>-bf</option></primary>
3994 </indexterm>
3995 <indexterm role="concept">
3996 <primary>filter</primary>
3997 <secondary>testing</secondary>
3998 </indexterm>
3999 <indexterm role="concept">
4000 <primary>testing</primary>
4001 <secondary>filter file</secondary>
4002 </indexterm>
4003 <indexterm role="concept">
4004 <primary>forward file</primary>
4005 <secondary>testing</secondary>
4006 </indexterm>
4007 <indexterm role="concept">
4008 <primary>testing</primary>
4009 <secondary>forward file</secondary>
4010 </indexterm>
4011 <indexterm role="concept">
4012 <primary>Sieve filter</primary>
4013 <secondary>testing</secondary>
4014 </indexterm>
4015 This option runs Exim in user filter testing mode; the file is the filter file
4016 to be tested, and a test message must be supplied on the standard input. If
4017 there are no message-dependent tests in the filter, an empty file can be
4018 supplied.
4019 </para>
4020 <para>
4021 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
4022 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
4023 filter and a user filter in the same run. For example:
4024 </para>
4025 <literallayout class="monospaced">
4026 exim -bF /system/filter -bf /user/filter &lt;/test/message
4027 </literallayout>
4028 <para>
4029 This is helpful when the system filter adds header lines or sets filter
4030 variables that are used by the user filter.
4031 </para>
4032 <para>
4033 If the test filter file does not begin with one of the special lines
4034 </para>
4035 <literallayout class="monospaced">
4036 # Exim filter
4037 # Sieve filter
4038 </literallayout>
4039 <para>
4040 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
4041 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
4042 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
4043 redirection lists.
4044 </para>
4045 <para>
4046 The result of an Exim command that uses <option>-bf</option>, provided no errors are
4047 detected, is a list of the actions that Exim would try to take if presented
4048 with the message for real. More details of filter testing are given in the
4049 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
4050 </para>
4051 <para>
4052 When testing a filter file,
4053 <indexterm role="concept">
4054 <primary><quote>From</quote> line</primary>
4055 </indexterm>
4056 <indexterm role="concept">
4057 <primary>envelope from</primary>
4058 </indexterm>
4059 <indexterm role="concept">
4060 <primary>envelope sender</primary>
4061 </indexterm>
4062 <indexterm role="option">
4063 <primary><option>-f</option></primary>
4064 <secondary>for filter testing</secondary>
4065 </indexterm>
4066 the envelope sender can be set by the <option>-f</option> option,
4067 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
4068 that would normally be taken from the envelope recipient address of the message
4069 can be set by means of additional command line options (see the next four
4070 options).
4071 </para>
4072 </listitem></varlistentry>
4073 <varlistentry>
4074 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
4075 <listitem>
4076 <para>
4077 <indexterm role="option">
4078 <primary><option>-bfd</option></primary>
4079 </indexterm>
4080 <indexterm role="variable">
4081 <primary><varname>$qualify_domain</varname></primary>
4082 </indexterm>
4083 This sets the domain of the recipient address when a filter file is being
4084 tested by means of the <option>-bf</option> option. The default is the value of
4085 <varname>$qualify_domain</varname>.
4086 </para>
4087 </listitem></varlistentry>
4088 <varlistentry>
4089 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4090 <listitem>
4091 <para>
4092 <indexterm role="option">
4093 <primary><option>-bfl</option></primary>
4094 </indexterm>
4095 This sets the local part of the recipient address when a filter file is being
4096 tested by means of the <option>-bf</option> option. The default is the username of the
4097 process that calls Exim. A local part should be specified with any prefix or
4098 suffix stripped, because that is how it appears to the filter when a message is
4099 actually being delivered.
4100 </para>
4101 </listitem></varlistentry>
4102 <varlistentry>
4103 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4104 <listitem>
4105 <para>
4106 <indexterm role="option">
4107 <primary><option>-bfp</option></primary>
4108 </indexterm>
4109 <indexterm role="concept">
4110 <primary>affix</primary>
4111 <secondary>filter testing</secondary>
4112 </indexterm>
4113 This sets the prefix of the local part of the recipient address when a filter
4114 file is being tested by means of the <option>-bf</option> option. The default is an empty
4115 prefix.
4116 </para>
4117 </listitem></varlistentry>
4118 <varlistentry>
4119 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4120 <listitem>
4121 <para>
4122 <indexterm role="option">
4123 <primary><option>-bfs</option></primary>
4124 </indexterm>
4125 <indexterm role="concept">
4126 <primary>affix</primary>
4127 <secondary>filter testing</secondary>
4128 </indexterm>
4129 This sets the suffix of the local part of the recipient address when a filter
4130 file is being tested by means of the <option>-bf</option> option. The default is an empty
4131 suffix.
4132 </para>
4133 </listitem></varlistentry>
4134 <varlistentry>
4135 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4136 <listitem>
4137 <para>
4138 <indexterm role="option">
4139 <primary><option>-bh</option></primary>
4140 </indexterm>
4141 <indexterm role="concept">
4142 <primary>testing</primary>
4143 <secondary>incoming SMTP</secondary>
4144 </indexterm>
4145 <indexterm role="concept">
4146 <primary>SMTP</primary>
4147 <secondary>testing incoming</secondary>
4148 </indexterm>
4149 <indexterm role="concept">
4150 <primary>testing</primary>
4151 <secondary>relay control</secondary>
4152 </indexterm>
4153 <indexterm role="concept">
4154 <primary>relaying</primary>
4155 <secondary>testing configuration</secondary>
4156 </indexterm>
4157 <indexterm role="concept">
4158 <primary>policy control</primary>
4159 <secondary>testing</secondary>
4160 </indexterm>
4161 <indexterm role="concept">
4162 <primary>debugging</primary>
4163 <secondary><option>-bh</option> option</secondary>
4164 </indexterm>
4165 This option runs a fake SMTP session as if from the given IP address, using the
4166 standard input and output. The IP address may include a port number at the end,
4167 after a full stop. For example:
4168 </para>
4169 <literallayout class="monospaced">
4170 exim -bh 10.9.8.7.1234
4171 exim -bh fe80::a00:20ff:fe86:a061.5678
4172 </literallayout>
4173 <para>
4174 When an IPv6 address is given, it is converted into canonical form. In the case
4175 of the second example above, the value of <varname>$sender_host_address</varname> after
4176 conversion to the canonical form is
4177 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4178 </para>
4179 <para>
4180 Comments as to what is going on are written to the standard error file. These
4181 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4182 This facility is provided for testing configuration options for incoming
4183 messages, to make sure they implement the required policy. For example, you can
4184 test your relay controls using <option>-bh</option>.
4185 </para>
4186 <para>
4187 <emphasis role="bold">Warning 1</emphasis>:
4188 <indexterm role="concept">
4189 <primary>RFC 1413</primary>
4190 </indexterm>
4191 You can test features of the configuration that rely on ident (RFC 1413)
4192 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4193 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4194 connection.
4195 </para>
4196 <para>
4197 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4198 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4199 occur, use <option>-bhc</option> instead.
4200 </para>
4201 <para>
4202 Messages supplied during the testing session are discarded, and nothing is
4203 written to any of the real log files. There may be pauses when DNS (and other)
4204 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4205 can be used to specify a specific IP interface and port if this is important,
4206 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4207 session were authenticated.
4208 </para>
4209 <para>
4210 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4211 output just states whether a given recipient address from a given host is
4212 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4213 </para>
4214 <para>
4215 Features such as authentication and encryption, where the client input is not
4216 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4217 specialized SMTP test program such as
4218 <emphasis role="bold"><ulink url="https://www.jetmore.org/john/code/swaks/">swaks</ulink></emphasis>.
4219 </para>
4220 </listitem></varlistentry>
4221 <varlistentry>
4222 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4223 <listitem>
4224 <para>
4225 <indexterm role="option">
4226 <primary><option>-bhc</option></primary>
4227 </indexterm>
4228 This option operates in the same way as <option>-bh</option>, except that address
4229 verification callouts are performed if required. This includes consulting and
4230 updating the callout cache database.
4231 </para>
4232 </listitem></varlistentry>
4233 <varlistentry>
4234 <term><option>-bi</option></term>
4235 <listitem>
4236 <para>
4237 <indexterm role="option">
4238 <primary><option>-bi</option></primary>
4239 </indexterm>
4240 <indexterm role="concept">
4241 <primary>alias file</primary>
4242 <secondary>building</secondary>
4243 </indexterm>
4244 <indexterm role="concept">
4245 <primary>building alias file</primary>
4246 </indexterm>
4247 <indexterm role="concept">
4248 <primary>Sendmail compatibility</primary>
4249 <secondary><option>-bi</option> option</secondary>
4250 </indexterm>
4251 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4252 Exim does not have the concept of a single alias file, and so it cannot mimic
4253 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4254 tend to appear in various scripts such as NIS make files, so the option must be
4255 recognized.
4256 </para>
4257 <para>
4258 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4259 configuration option is run, under the uid and gid of the caller of Exim. If
4260 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4261 The command set by <option>bi_command</option> may not contain arguments. The command can
4262 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4263 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4264 <option>-bi</option> is a no-op.
4265 </para>
4266 </listitem></varlistentry>
4267 <varlistentry>
4268 <term><option>-bI:help</option></term>
4269 <listitem>
4270 <para>
4271 <indexterm role="option">
4272 <primary><option>-bI:help</option></primary>
4273 </indexterm>
4274 <indexterm role="concept">
4275 <primary>querying exim information</primary>
4276 </indexterm>
4277 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4278 information.  The output of many of these will be intended for machine
4279 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4280 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4281 options shall cause Exim to exit after producing the requested output.
4282 </para>
4283 </listitem></varlistentry>
4284 <varlistentry>
4285 <term><option>-bI:dscp</option></term>
4286 <listitem>
4287 <para>
4288 <indexterm role="option">
4289 <primary><option>-bI:dscp</option></primary>
4290 </indexterm>
4291 <indexterm role="concept">
4292 <primary>DSCP</primary>
4293 <secondary>values</secondary>
4294 </indexterm>
4295 This option causes Exim to emit an alphabetically sorted list of all
4296 recognised DSCP names.
4297 </para>
4298 </listitem></varlistentry>
4299 <varlistentry>
4300 <term><option>-bI:sieve</option></term>
4301 <listitem>
4302 <para>
4303 <indexterm role="option">
4304 <primary><option>-bI:sieve</option></primary>
4305 </indexterm>
4306 <indexterm role="concept">
4307 <primary>Sieve filter</primary>
4308 <secondary>capabilities</secondary>
4309 </indexterm>
4310 This option causes Exim to emit an alphabetically sorted list of all supported
4311 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4312 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4313 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4314 compile-time build options, which this option will adapt to, this is the only
4315 way to guarantee a correct response.
4316 </para>
4317 </listitem></varlistentry>
4318 <varlistentry>
4319 <term><option>-bm</option></term>
4320 <listitem>
4321 <para>
4322 <indexterm role="option">
4323 <primary><option>-bm</option></primary>
4324 </indexterm>
4325 <indexterm role="concept">
4326 <primary>local message reception</primary>
4327 </indexterm>
4328 This option runs an Exim receiving process that accepts an incoming,
4329 locally-generated message on the standard input. The recipients are given as the
4330 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4331 argument can be a comma-separated list of RFC 2822 addresses. This is the
4332 default option for selecting the overall action of an Exim call; it is assumed
4333 if no other conflicting option is present.
4334 </para>
4335 <para>
4336 If any addresses in the message are unqualified (have no domain), they are
4337 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4338 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4339 suppressing this for special cases.
4340 </para>
4341 <para>
4342 Policy checks on the contents of local messages can be enforced by means of
4343 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4344 </para>
4345 <para>
4346 <indexterm role="concept">
4347 <primary>return code</primary>
4348 <secondary>for <option>-bm</option></secondary>
4349 </indexterm>
4350 The return code is zero if the message is successfully accepted. Otherwise, the
4351 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4352 </para>
4353 <para>
4354 The format
4355 <indexterm role="concept">
4356 <primary>message</primary>
4357 <secondary>format</secondary>
4358 </indexterm>
4359 <indexterm role="concept">
4360 <primary>format</primary>
4361 <secondary>message</secondary>
4362 </indexterm>
4363 <indexterm role="concept">
4364 <primary><quote>From</quote> line</primary>
4365 </indexterm>
4366 <indexterm role="concept">
4367 <primary>UUCP</primary>
4368 <secondary><quote>From</quote> line</secondary>
4369 </indexterm>
4370 <indexterm role="concept">
4371 <primary>Sendmail compatibility</primary>
4372 <secondary><quote>From</quote> line</secondary>
4373 </indexterm>
4374 of the message must be as defined in RFC 2822, except that, for
4375 compatibility with Sendmail and Smail, a line in one of the forms
4376 </para>
4377 <literallayout class="monospaced">
4378 From sender Fri Jan  5 12:55 GMT 1997
4379 From sender Fri, 5 Jan 97 12:55:01
4380 </literallayout>
4381 <para>
4382 (with the weekday optional, and possibly with additional text after the date)
4383 is permitted to appear at the start of the message. There appears to be no
4384 authoritative specification of the format of this line. Exim recognizes it by
4385 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4386 option, which can be changed if necessary.
4387 </para>
4388 <para>
4389 <indexterm role="option">
4390 <primary><option>-f</option></primary>
4391 <secondary>overriding <quote>From</quote> line</secondary>
4392 </indexterm>
4393 The specified sender is treated as if it were given as the argument to the
4394 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4395 preference to the address taken from the message. The caller of Exim must be a
4396 trusted user for the sender of a message to be set in this way.
4397 </para>
4398 </listitem></varlistentry>
4399 <varlistentry>
4400 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4401 <listitem>
4402 <para>
4403 <indexterm role="option">
4404 <primary><option>-bmalware</option></primary>
4405 </indexterm>
4406 <indexterm role="concept">
4407 <primary>testing</primary>
4408 <secondary>,</secondary>
4409 </indexterm>
4410 <indexterm role="concept">
4411 <primary>malware scan test</primary>
4412 </indexterm>
4413 This debugging option causes Exim to scan the given file or directory
4414 (depending on the used scanner interface),
4415 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4416 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4417 the expansion should have defaults which apply to this invocation.  ACLs are
4418 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4419 will never be populated and <option>-bmalware</option> will fail.
4420 </para>
4421 <para>
4422 Exim will have changed working directory before resolving the filename, so
4423 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4424 user when it tries to open the file, rather than as the invoking user.
4425 This option requires admin privileges.
4426 </para>
4427 <para>
4428 The <option>-bmalware</option> option will not be extended to be more generally useful,
4429 there are better tools for file-scanning.  This option exists to help
4430 administrators verify their Exim and AV scanner configuration.
4431 </para>
4432 </listitem></varlistentry>
4433 <varlistentry>
4434 <term><option>-bnq</option></term>
4435 <listitem>
4436 <para>
4437 <indexterm role="option">
4438 <primary><option>-bnq</option></primary>
4439 </indexterm>
4440 <indexterm role="concept">
4441 <primary>address qualification, suppressing</primary>
4442 </indexterm>
4443 By default, Exim automatically qualifies unqualified addresses (those
4444 without domains) that appear in messages that are submitted locally (that
4445 is, not over TCP/IP). This qualification applies both to addresses in
4446 envelopes, and addresses in header lines. Sender addresses are qualified using
4447 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4448 defaults to the value of <option>qualify_domain</option>).
4449 </para>
4450 <para>
4451 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4452 being used to re-submit messages that originally came from remote hosts after
4453 content scanning, you probably do not want to qualify unqualified addresses in
4454 header lines. (Such lines will be present only if you have not enabled a header
4455 syntax check in the appropriate ACL.)
4456 </para>
4457 <para>
4458 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4459 messages that originate on the local host. When this is used, unqualified
4460 addresses in the envelope provoke errors (causing message rejection) and
4461 unqualified addresses in header lines are left alone.
4462 </para>
4463 </listitem></varlistentry>
4464 <varlistentry>
4465 <term><option>-bP</option></term>
4466 <listitem>
4467 <para>
4468 <indexterm role="option">
4469 <primary><option>-bP</option></primary>
4470 </indexterm>
4471 <indexterm role="concept">
4472 <primary>configuration options</primary>
4473 <secondary>extracting</secondary>
4474 </indexterm>
4475 <indexterm role="concept">
4476 <primary>options</primary>
4477 <secondary>configuration &ndash; extracting</secondary>
4478 </indexterm>
4479 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4480 main configuration options to be written to the standard output. The values
4481 of one or more specific options can be requested by giving their names as
4482 arguments, for example:
4483 </para>
4484 <literallayout class="monospaced">
4485 exim -bP qualify_domain hold_domains
4486 </literallayout>
4487 <para>
4488 <indexterm role="concept">
4489 <primary>hiding configuration option values</primary>
4490 </indexterm>
4491 <indexterm role="concept">
4492 <primary>configuration options</primary>
4493 <secondary>hiding value of</secondary>
4494 </indexterm>
4495 <indexterm role="concept">
4496 <primary>options</primary>
4497 <secondary>hiding value of</secondary>
4498 </indexterm>
4499 However, any option setting that is preceded by the word <quote>hide</quote> in the
4500 configuration file is not shown in full, except to an admin user. For other
4501 users, the output is as in this example:
4502 </para>
4503 <literallayout class="monospaced">
4504 mysql_servers = &lt;value not displayable&gt;
4505 </literallayout>
4506 <para>
4507 If <option>config</option> is given as an argument, the config is
4508 output, as it was parsed, any include file resolved, any comment removed.
4509 </para>
4510 <para>
4511 If <option>config_file</option> is given as an argument, the name of the runtime
4512 configuration file is output. (<option>configure_file</option> works too, for
4513 backward compatibility.)
4514 If a list of configuration files was supplied, the value that is output here
4515 is the name of the file that was actually used.
4516 </para>
4517 <para>
4518 <indexterm role="concept">
4519 <primary>options</primary>
4520 <secondary>hiding name of</secondary>
4521 </indexterm>
4522 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4523 name will not be output.
4524 </para>
4525 <para>
4526 <indexterm role="concept">
4527 <primary>daemon</primary>
4528 <secondary>process id (pid)</secondary>
4529 </indexterm>
4530 <indexterm role="concept">
4531 <primary>pid (process id)</primary>
4532 <secondary>of daemon</secondary>
4533 </indexterm>
4534 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4535 directories where log files and daemon pid files are written are output,
4536 respectively. If these values are unset, log files are written in a
4537 sub-directory of the spool directory called <option>log</option>, and the pid file is
4538 written directly into the spool directory.
4539 </para>
4540 <para>
4541 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4542 </para>
4543 <literallayout class="monospaced">
4544 exim -bP +local_domains
4545 </literallayout>
4546 <para>
4547 it searches for a matching named list of any type (domain, host, address, or
4548 local part) and outputs what it finds.
4549 </para>
4550 <para>
4551 <indexterm role="concept">
4552 <primary>options</primary>
4553 <secondary>router &ndash; extracting</secondary>
4554 </indexterm>
4555 <indexterm role="concept">
4556 <primary>options</primary>
4557 <secondary>transport &ndash; extracting</secondary>
4558 </indexterm>
4559 <indexterm role="concept">
4560 <primary>options</primary>
4561 <secondary>authenticator &ndash; extracting</secondary>
4562 </indexterm>
4563 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4564 followed by the name of an appropriate driver instance, the option settings for
4565 that driver are output. For example:
4566 </para>
4567 <literallayout class="monospaced">
4568 exim -bP transport local_delivery
4569 </literallayout>
4570 <para>
4571 The generic driver options are output first, followed by the driver&#x2019;s private
4572 options. A list of the names of drivers of a particular type can be obtained by
4573 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4574 <option>authenticator_list</option>, and a complete list of all drivers with their option
4575 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4576 <option>authenticators</option>.
4577 </para>
4578 <para>
4579 <indexterm role="concept">
4580 <primary>environment</primary>
4581 </indexterm>
4582 If <option>environment</option> is given as an argument, the set of environment
4583 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4584 variables.
4585 </para>
4586 <para>
4587 <indexterm role="concept">
4588 <primary>options</primary>
4589 <secondary>macro &ndash; extracting</secondary>
4590 </indexterm>
4591 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4592 are available, similarly to the drivers.  Because macros are sometimes used
4593 for storing passwords, this option is restricted.
4594 The output format is one item per line.
4595 For the "-bP macro &lt;name&gt;" form, if no such macro is found
4596 the exit status will be nonzero.
4597 </para>
4598 </listitem></varlistentry>
4599 <varlistentry>
4600 <term><option>-bp</option></term>
4601 <listitem>
4602 <para>
4603 <indexterm role="option">
4604 <primary><option>-bp</option></primary>
4605 </indexterm>
4606 <indexterm role="concept">
4607 <primary>queue</primary>
4608 <secondary>listing messages in</secondary>
4609 </indexterm>
4610 <indexterm role="concept">
4611 <primary>listing</primary>
4612 <secondary>messages in the queue</secondary>
4613 </indexterm>
4614 This option requests a listing of the contents of the mail queue on the
4615 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4616 just those messages are listed. By default, this option can be used only by an
4617 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4618 to allow any user to see the queue.
4619 </para>
4620 <para>
4621 Each message in the queue is displayed as in the following example:
4622 </para>
4623 <literallayout class="monospaced">
4624 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4625           red.king@looking-glass.fict.example
4626           &lt;other addresses&gt;
4627 </literallayout>
4628 <para>
4629 <indexterm role="concept">
4630 <primary>message</primary>
4631 <secondary>size in queue listing</secondary>
4632 </indexterm>
4633 <indexterm role="concept">
4634 <primary>size</primary>
4635 <secondary>of message</secondary>
4636 </indexterm>
4637 The first line contains the length of time the message has been in the queue
4638 (in this case 25 minutes), the size of the message (2.9K), the unique local
4639 identifier for the message, and the message sender, as contained in the
4640 envelope. For bounce messages, the sender address is empty, and appears as
4641 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4642 the default sender address, the user&#x2019;s login name is shown in parentheses
4643 before the sender address.
4644 </para>
4645 <para>
4646 <indexterm role="concept">
4647 <primary>frozen messages</primary>
4648 <secondary>in queue listing</secondary>
4649 </indexterm>
4650 If the message is frozen (attempts to deliver it are suspended) then the text
4651 <quote>*** frozen ***</quote> is displayed at the end of this line.
4652 </para>
4653 <para>
4654 The recipients of the message (taken from the envelope, not the headers) are
4655 displayed on subsequent lines. Those addresses to which the message has already
4656 been delivered are marked with the letter D. If an original address gets
4657 expanded into several addresses via an alias or forward file, the original is
4658 displayed with a D only when deliveries for all of its child addresses are
4659 complete.
4660 </para>
4661 </listitem></varlistentry>
4662 <varlistentry>
4663 <term><option>-bpa</option></term>
4664 <listitem>
4665 <para>
4666 <indexterm role="option">
4667 <primary><option>-bpa</option></primary>
4668 </indexterm>
4669 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4670 that were generated from the original top level address(es) in each message by
4671 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4672 of just <quote>D</quote>.
4673 </para>
4674 </listitem></varlistentry>
4675 <varlistentry>
4676 <term><option>-bpc</option></term>
4677 <listitem>
4678 <para>
4679 <indexterm role="option">
4680 <primary><option>-bpc</option></primary>
4681 </indexterm>
4682 <indexterm role="concept">
4683 <primary>queue</primary>
4684 <secondary>count of messages on</secondary>
4685 </indexterm>
4686 This option counts the number of messages in the queue, and writes the total
4687 to the standard output. It is restricted to admin users, unless
4688 <option>queue_list_requires_admin</option> is set false.
4689 </para>
4690 </listitem></varlistentry>
4691 <varlistentry>
4692 <term><option>-bpr</option></term>
4693 <listitem>
4694 <para>
4695 <indexterm role="option">
4696 <primary><option>-bpr</option></primary>
4697 </indexterm>
4698 This option operates like <option>-bp</option>, but the output is not sorted into
4699 chronological order of message arrival. This can speed it up when there are
4700 lots of messages in the queue, and is particularly useful if the output is
4701 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4702 </para>
4703 </listitem></varlistentry>
4704 <varlistentry>
4705 <term><option>-bpra</option></term>
4706 <listitem>
4707 <para>
4708 <indexterm role="option">
4709 <primary><option>-bpra</option></primary>
4710 </indexterm>
4711 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4712 </para>
4713 </listitem></varlistentry>
4714 <varlistentry>
4715 <term><option>-bpru</option></term>
4716 <listitem>
4717 <para>
4718 <indexterm role="option">
4719 <primary><option>-bpru</option></primary>
4720 </indexterm>
4721 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4722 </para>
4723 </listitem></varlistentry>
4724 <varlistentry>
4725 <term><option>-bpu</option></term>
4726 <listitem>
4727 <para>
4728 <indexterm role="option">
4729 <primary><option>-bpu</option></primary>
4730 </indexterm>
4731 This option operates like <option>-bp</option> but shows only undelivered top-level
4732 addresses for each message displayed. Addresses generated by aliasing or
4733 forwarding are not shown, unless the message was deferred after processing by a
4734 router with the <option>one_time</option> option set.
4735 </para>
4736 </listitem></varlistentry>
4737 <varlistentry>
4738 <term><option>-brt</option></term>
4739 <listitem>
4740 <para>
4741 <indexterm role="option">
4742 <primary><option>-brt</option></primary>
4743 </indexterm>
4744 <indexterm role="concept">
4745 <primary>testing</primary>
4746 <secondary>retry configuration</secondary>
4747 </indexterm>
4748 <indexterm role="concept">
4749 <primary>retry</primary>
4750 <secondary>configuration testing</secondary>
4751 </indexterm>
4752 This option is for testing retry rules, and it must be followed by up to three
4753 arguments. It causes Exim to look for a retry rule that matches the values
4754 and to write it to the standard output. For example:
4755 </para>
4756 <literallayout class="monospaced">
4757 exim -brt bach.comp.mus.example
4758 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4759 </literallayout>
4760 <para>
4761 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4762 argument, which is required, can be a complete address in the form
4763 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4764 contains a dot, it is interpreted as an optional second domain name; if no
4765 retry rule is found for the first argument, the second is tried. This ties in
4766 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4767 rule is found that matches the host, one that matches the mail domain is
4768 sought. Finally, an argument that is the name of a specific delivery error, as
4769 used in setting up retry rules, can be given. For example:
4770 </para>
4771 <literallayout class="monospaced">
4772 exim -brt haydn.comp.mus.example quota_3d
4773 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4774 </literallayout>
4775 </listitem></varlistentry>
4776 <varlistentry>
4777 <term><option>-brw</option></term>
4778 <listitem>
4779 <para>
4780 <indexterm role="option">
4781 <primary><option>-brw</option></primary>
4782 </indexterm>
4783 <indexterm role="concept">
4784 <primary>testing</primary>
4785 <secondary>rewriting</secondary>
4786 </indexterm>
4787 <indexterm role="concept">
4788 <primary>rewriting</primary>
4789 <secondary>testing</secondary>
4790 </indexterm>
4791 This option is for testing address rewriting rules, and it must be followed by
4792 a single argument, consisting of either a local part without a domain, or a
4793 complete address with a fully qualified domain. Exim outputs how this address
4794 would be rewritten for each possible place it might appear. See chapter
4795 <xref linkend="CHAPrewrite"/> for further details.
4796 </para>
4797 </listitem></varlistentry>
4798 <varlistentry>
4799 <term><option>-bS</option></term>
4800 <listitem>
4801 <para>
4802 <indexterm role="option">
4803 <primary><option>-bS</option></primary>
4804 </indexterm>
4805 <indexterm role="concept">
4806 <primary>SMTP</primary>
4807 <secondary>batched incoming</secondary>
4808 </indexterm>
4809 <indexterm role="concept">
4810 <primary>batched SMTP input</primary>
4811 </indexterm>
4812 This option is used for batched SMTP input, which is an alternative interface
4813 for non-interactive local message submission. A number of messages can be
4814 submitted in a single run. However, despite its name, this is not really SMTP
4815 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4816 input, but generates no responses. If the caller is trusted, or
4817 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4818 believed; otherwise the sender is always the caller of Exim.
4819 </para>
4820 <para>
4821 The message itself is read from the standard input, in SMTP format (leading
4822 dots doubled), terminated by a line containing just a single dot. An error is
4823 provoked if the terminating dot is missing. A further message may then follow.
4824 </para>
4825 <para>
4826 As for other local message submissions, the contents of incoming batch SMTP
4827 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4828 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4829 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4830 </para>
4831 <para>
4832 Some other SMTP commands are recognized in the input. HELO and EHLO act
4833 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4834 QUIT quits, ignoring the rest of the standard input.
4835 </para>
4836 <para>
4837 <indexterm role="concept">
4838 <primary>return code</primary>
4839 <secondary>for <option>-bS</option></secondary>
4840 </indexterm>
4841 If any error is encountered, reports are written to the standard output and
4842 error streams, and Exim gives up immediately. The return code is 0 if no error
4843 was detected; it is 1 if one or more messages were accepted before the error
4844 was detected; otherwise it is 2.
4845 </para>
4846 <para>
4847 More details of input using batched SMTP are given in section
4848 <xref linkend="SECTincomingbatchedSMTP"/>.
4849 </para>
4850 </listitem></varlistentry>
4851 <varlistentry>
4852 <term><option>-bs</option></term>
4853 <listitem>
4854 <para>
4855 <indexterm role="option">
4856 <primary><option>-bs</option></primary>
4857 </indexterm>
4858 <indexterm role="concept">
4859 <primary>SMTP</primary>
4860 <secondary>local input</secondary>
4861 </indexterm>
4862 <indexterm role="concept">
4863 <primary>local SMTP input</primary>
4864 </indexterm>
4865 This option causes Exim to accept one or more messages by reading SMTP commands
4866 on the standard input, and producing SMTP replies on the standard output. SMTP
4867 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4868 Some user agents use this interface as a way of passing locally-generated
4869 messages to the MTA.
4870 </para>
4871 <para>
4872 In
4873 <indexterm role="concept">
4874 <primary>sender</primary>
4875 <secondary>source of</secondary>
4876 </indexterm>
4877 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4878 set, the senders of messages are taken from the SMTP MAIL commands.
4879 Otherwise the content of these commands is ignored and the sender is set up as
4880 the calling user. Unqualified addresses are automatically qualified using
4881 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4882 <option>-bnq</option> option is used.
4883 </para>
4884 <para>
4885 <indexterm role="concept">
4886 <primary>inetd</primary>
4887 </indexterm>
4888 The
4889 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4890 using a listening daemon. Exim can distinguish the two cases by checking
4891 whether the standard input is a TCP/IP socket. When Exim is called from
4892 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4893 above concerning senders and qualification do not apply. In this situation,
4894 Exim behaves in exactly the same way as it does when receiving a message via
4895 the listening daemon.
4896 </para>
4897 </listitem></varlistentry>
4898 <varlistentry>
4899 <term><option>-bt</option></term>
4900 <listitem>
4901 <para>
4902 <indexterm role="option">
4903 <primary><option>-bt</option></primary>
4904 </indexterm>
4905 <indexterm role="concept">
4906 <primary>testing</primary>
4907 <secondary>addresses</secondary>
4908 </indexterm>
4909 <indexterm role="concept">
4910 <primary>address</primary>
4911 <secondary>testing</secondary>
4912 </indexterm>
4913 This option runs Exim in address testing mode, in which each argument is taken
4914 as a recipient address to be tested for deliverability. The results are
4915 written to the standard output. If a test fails, and the caller is not an admin
4916 user, no details of the failure are output, because these might contain
4917 sensitive information such as usernames and passwords for database lookups.
4918 </para>
4919 <para>
4920 If no arguments are given, Exim runs in an interactive manner, prompting with a
4921 right angle bracket for addresses to be tested.
4922 </para>
4923 <para>
4924 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4925 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4926 security issues.
4927 </para>
4928 <para>
4929 Each address is handled as if it were the recipient address of a message
4930 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4931 written to the standard output. However, any router that has
4932 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4933 genuine routing tests if your first router passes everything to a scanner
4934 program.
4935 </para>
4936 <para>
4937 <indexterm role="concept">
4938 <primary>return code</primary>
4939 <secondary>for <option>-bt</option></secondary>
4940 </indexterm>
4941 The return code is 2 if any address failed outright; it is 1 if no address
4942 failed outright but at least one could not be resolved for some reason. Return
4943 code 0 is given only when all addresses succeed.
4944 </para>
4945 <para>
4946 <indexterm role="concept">
4947 <primary>duplicate addresses</primary>
4948 </indexterm>
4949 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4950 addresses after routing is complete, so that only one delivery takes place.
4951 This does not happen when testing with <option>-bt</option>; the full results of routing are
4952 always shown.
4953 </para>
4954 <para>
4955 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4956 routers in the configuration makes any tests on the sender address of a
4957 message,
4958 <indexterm role="option">
4959 <primary><option>-f</option></primary>
4960 <secondary>for address testing</secondary>
4961 </indexterm>
4962 you can use the <option>-f</option> option to set an appropriate sender when running
4963 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4964 default qualifying domain. However, if you have set up (for example) routers
4965 whose behaviour depends on the contents of an incoming message, you cannot test
4966 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4967 doing such tests.
4968 </para>
4969 </listitem></varlistentry>
4970 <varlistentry>
4971 <term><option>-bV</option></term>
4972 <listitem>
4973 <para>
4974 <indexterm role="option">
4975 <primary><option>-bV</option></primary>
4976 </indexterm>
4977 <indexterm role="concept">
4978 <primary>version number of Exim</primary>
4979 </indexterm>
4980 This option causes Exim to write the current version number, compilation
4981 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4982 It also lists the DBM library that is being used, the optional modules (such as
4983 specific lookup types), the drivers that are included in the binary, and the
4984 name of the runtime configuration file that is in use.
4985 </para>
4986 <para>
4987 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4988 configuration file. However, this is a static check only. It cannot check
4989 values that are to be expanded. For example, although a misspelt ACL verb is
4990 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4991 alone to discover (for example) all the typos in the configuration; some
4992 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4993 dynamic testing facilities.
4994 </para>
4995 </listitem></varlistentry>
4996 <varlistentry>
4997 <term><option>-bv</option></term>
4998 <listitem>
4999 <para>
5000 <indexterm role="option">
5001 <primary><option>-bv</option></primary>
5002 </indexterm>
5003 <indexterm role="concept">
5004 <primary>verifying address</primary>
5005 <secondary>using <option>-bv</option></secondary>
5006 </indexterm>
5007 <indexterm role="concept">
5008 <primary>address</primary>
5009 <secondary>verification</secondary>
5010 </indexterm>
5011 This option runs Exim in address verification mode, in which each argument is
5012 taken as a recipient address to be verified by the routers. (This does
5013 not involve any verification callouts). During normal operation, verification
5014 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
5015 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
5016 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
5017 </para>
5018 <para>
5019 If verification fails, and the caller is not an admin user, no details of the
5020 failure are output, because these might contain sensitive information such as
5021 usernames and passwords for database lookups.
5022 </para>
5023 <para>
5024 If no arguments are given, Exim runs in an interactive manner, prompting with a
5025 right angle bracket for addresses to be verified.
5026 </para>
5027 <para>
5028 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
5029 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
5030 security issues.
5031 </para>
5032 <para>
5033 Verification differs from address testing (the <option>-bt</option> option) in that routers
5034 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
5035 router that has <option>fail_verify</option> set, verification fails. The address is
5036 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
5037 address, <option>-bvs</option> should be used.
5038 </para>
5039 <para>
5040 If the <option>-v</option> option is not set, the output consists of a single line for each
5041 address, stating whether it was verified or not, and giving a reason in the
5042 latter case. Without <option>-v</option>, generating more than one address by redirection
5043 causes verification to end successfully, without considering the generated
5044 addresses. However, if just one address is generated, processing continues,
5045 and the generated address must verify successfully for the overall verification
5046 to succeed.
5047 </para>
5048 <para>
5049 When <option>-v</option> is set, more details are given of how the address has been handled,
5050 and in the case of address redirection, all the generated addresses are also
5051 considered. Verification may succeed for some and fail for others.
5052 </para>
5053 <para>
5054 The
5055 <indexterm role="concept">
5056 <primary>return code</primary>
5057 <secondary>for <option>-bv</option></secondary>
5058 </indexterm>
5059 return code is 2 if any address failed outright; it is 1 if no address
5060 failed outright but at least one could not be resolved for some reason. Return
5061 code 0 is given only when all addresses succeed.
5062 </para>
5063 <para>
5064 If any of the routers in the configuration makes any tests on the sender
5065 address of a message, you should use the <option>-f</option> option to set an appropriate
5066 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
5067 calling user at the default qualifying domain.
5068 </para>
5069 </listitem></varlistentry>
5070 <varlistentry>
5071 <term><option>-bvs</option></term>
5072 <listitem>
5073 <para>
5074 <indexterm role="option">
5075 <primary><option>-bvs</option></primary>
5076 </indexterm>
5077 This option acts like <option>-bv</option>, but verifies the address as a sender rather
5078 than a recipient address. This affects any rewriting and qualification that
5079 might happen.
5080 </para>
5081 </listitem></varlistentry>
5082 <varlistentry>
5083 <term><option>-bw</option></term>
5084 <listitem>
5085 <para>
5086 <indexterm role="option">
5087 <primary><option>-bw</option></primary>
5088 </indexterm>
5089 <indexterm role="concept">
5090 <primary>daemon</primary>
5091 </indexterm>
5092 <indexterm role="concept">
5093 <primary>inetd</primary>
5094 </indexterm>
5095 <indexterm role="concept">
5096 <primary>inetd</primary>
5097 <secondary>wait mode</secondary>
5098 </indexterm>
5099 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5100 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5101 and in the configuration file are ignored.  Queue-running may not be specified.
5102 </para>
5103 <para>
5104 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5105 listening for connections.  This permits the system to start up and have
5106 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5107 each port only when the first connection is received.
5108 </para>
5109 <para>
5110 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5111 which the daemon will exit, which should cause inetd to listen once more.
5112 </para>
5113 </listitem></varlistentry>
5114 <varlistentry>
5115 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5116 <listitem>
5117 <para>
5118 <indexterm role="option">
5119 <primary><option>-C</option></primary>
5120 </indexterm>
5121 <indexterm role="concept">
5122 <primary>configuration file</primary>
5123 <secondary>alternate</secondary>
5124 </indexterm>
5125 <indexterm role="concept">
5126 <primary>CONFIGURE_FILE</primary>
5127 </indexterm>
5128 <indexterm role="concept">
5129 <primary>alternate configuration file</primary>
5130 </indexterm>
5131 This option causes Exim to find the runtime configuration file from the given
5132 list instead of from the list specified by the CONFIGURE_FILE
5133 compile-time setting. Usually, the list will consist of just a single filename,
5134 but it can be a colon-separated list of names. In this case, the first
5135 file that exists is used. Failure to open an existing file stops Exim from
5136 proceeding any further along the list, and an error is generated.
5137 </para>
5138 <para>
5139 When this option is used by a caller other than root, and the list is different
5140 from the compiled-in list, Exim gives up its root privilege immediately, and
5141 runs with the real and effective uid and gid set to those of the caller.
5142 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5143 file contains a list of full pathnames, one per line, for configuration files
5144 which are trusted. Root privilege is retained for any configuration file so
5145 listed, as long as the caller is the Exim user (or the user specified in the
5146 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5147 not writeable by inappropriate users or groups.
5148 </para>
5149 <para>
5150 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5151 configuration using <option>-C</option> right through message reception and delivery,
5152 even if the caller is root. The reception works, but by that time, Exim is
5153 running as the Exim user, so when it re-executes to regain privilege for the
5154 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5155 test reception and delivery using two separate commands (one to put a message
5156 in the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5157 </para>
5158 <para>
5159 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5160 prefix string with which any file named in a <option>-C</option> command line option
5161 must start. In addition, the filename must not contain the sequence <literal>/../</literal>.
5162 However, if the value of the <option>-C</option> option is identical to the value of
5163 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5164 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5165 unset, any filename can be used with <option>-C</option>.
5166 </para>
5167 <para>
5168 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5169 to a directory to which only root has access. This prevents someone who has
5170 broken into the Exim account from running a privileged Exim with an arbitrary
5171 configuration file.
5172 </para>
5173 <para>
5174 The <option>-C</option> facility is useful for ensuring that configuration files are
5175 syntactically correct, but cannot be used for test deliveries, unless the
5176 caller is privileged, or unless it is an exotic configuration that does not
5177 require privilege. No check is made on the owner or group of the files
5178 specified by this option.
5179 </para>
5180 </listitem></varlistentry>
5181 <varlistentry>
5182 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5183 <listitem>
5184 <para>
5185 <indexterm role="option">
5186 <primary><option>-D</option></primary>
5187 </indexterm>
5188 <indexterm role="concept">
5189 <primary>macro</primary>
5190 <secondary>setting on command line</secondary>
5191 </indexterm>
5192 This option can be used to override macro definitions in the configuration file
5193 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5194 unprivileged caller, it causes Exim to give up its root privilege.
5195 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5196 completely disabled, and its use causes an immediate error exit.
5197 </para>
5198 <para>
5199 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5200 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5201 supplies macros from this list, and the values are acceptable, then Exim will
5202 not give up root privilege if the caller is root, the Exim run-time user, or
5203 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5204 to be removed in the future.  Acceptable values for the macros satisfy the
5205 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5206 </para>
5207 <para>
5208 The entire option (including equals sign if present) must all be within one
5209 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5210 string, in which case the equals sign is optional. These two commands are
5211 synonymous:
5212 </para>
5213 <literallayout class="monospaced">
5214 exim -DABC  ...
5215 exim -DABC= ...
5216 </literallayout>
5217 <para>
5218 To include spaces in a macro definition item, quotes must be used. If you use
5219 quotes, spaces are permitted around the macro name and the equals sign. For
5220 example:
5221 </para>
5222 <literallayout class="monospaced">
5223 exim '-D ABC = something' ...
5224 </literallayout>
5225 <para>
5226 <option>-D</option> may be repeated up to 10 times on a command line.
5227 Only macro names up to 22 letters long can be set.
5228 </para>
5229 </listitem></varlistentry>
5230 <varlistentry>
5231 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5232 <listitem>
5233 <para>
5234 <indexterm role="option">
5235 <primary><option>-d</option></primary>
5236 </indexterm>
5237 <indexterm role="concept">
5238 <primary>debugging</primary>
5239 <secondary>list of selectors</secondary>
5240 </indexterm>
5241 <indexterm role="concept">
5242 <primary>debugging</primary>
5243 <secondary><option>-d</option> option</secondary>
5244 </indexterm>
5245 This option causes debugging information to be written to the standard
5246 error stream. It is restricted to admin users because debugging output may show
5247 database queries that contain password information. Also, the details of users&#x2019;
5248 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5249 writes an error message to the standard error stream and exits with a non-zero
5250 return code.
5251 </para>
5252 <para>
5253 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5254 standard debugging data is output. This can be reduced, or increased to include
5255 some more rarely needed information, by directly following <option>-d</option> with a string
5256 made up of names preceded by plus or minus characters. These add or remove sets
5257 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5258 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5259 no spaces are allowed in the debug setting. The available debugging categories
5260 are:
5261 </para>
5262 <literallayout>
5263 <literal>acl            </literal> ACL interpretation
5264 <literal>auth           </literal> authenticators
5265 <literal>deliver        </literal> general delivery logic
5266 <literal>dns            </literal> DNS lookups (see also resolver)
5267 <literal>dnsbl          </literal> DNS black list (aka RBL) code
5268 <literal>exec           </literal> arguments for <function>execv()</function> calls
5269 <literal>expand         </literal> detailed debugging for string expansions
5270 <literal>filter         </literal> filter handling
5271 <literal>hints_lookup   </literal> hints data lookups
5272 <literal>host_lookup    </literal> all types of name-to-IP address handling
5273 <literal>ident          </literal> ident lookup
5274 <literal>interface      </literal> lists of local interfaces
5275 <literal>lists          </literal> matching things in lists
5276 <literal>load           </literal> system load checks
5277 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
5278 <literal>lookup         </literal> general lookup code and all lookups
5279 <literal>memory         </literal> memory handling
5280 <literal>noutf8         </literal> modifier: avoid UTF-8 line-drawing
5281 <literal>pid            </literal> modifier: add pid to debug output lines
5282 <literal>process_info   </literal> setting info for the process log
5283 <literal>queue_run      </literal> queue runs
5284 <literal>receive        </literal> general message reception logic
5285 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
5286 <literal>retry          </literal> retry handling
5287 <literal>rewrite        </literal> address rewriting
5288 <literal>route          </literal> address routing
5289 <literal>timestamp      </literal> modifier: add timestamp to debug output lines
5290 <literal>tls            </literal> TLS logic
5291 <literal>transport      </literal> transports
5292 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
5293 <literal>verify         </literal> address verification logic
5294 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
5295 </literallayout>
5296 <para>
5297 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5298 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5299 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5300 is included, an awful lot of output that is very rarely of interest is
5301 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5302 turn everything off.
5303 </para>
5304 <para>
5305 <indexterm role="concept">
5306 <primary>resolver, debugging output</primary>
5307 </indexterm>
5308 <indexterm role="concept">
5309 <primary>DNS resolver, debugging output</primary>
5310 </indexterm>
5311 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5312 with DEBUG enabled. This is not the case in some operating systems. Also,
5313 unfortunately, debugging output from the DNS resolver is written to stdout
5314 rather than stderr.
5315 </para>
5316 <para>
5317 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5318 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5319 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5320 daemon, which then passes it on to any re-executed Exims. Exim also
5321 automatically adds the pid to debug lines when several remote deliveries are
5322 run in parallel.
5323 </para>
5324 <para>
5325 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5326 of all debug output lines. This can be useful when trying to track down delays
5327 in processing.
5328 </para>
5329 <para>
5330 <indexterm role="concept">
5331 <primary>debugging</primary>
5332 <secondary>UTF-8 in</secondary>
5333 </indexterm>
5334 <indexterm role="concept">
5335 <primary>UTF-8</primary>
5336 <secondary>in debug output</secondary>
5337 </indexterm>
5338 The <literal>noutf8</literal> selector disables the use of
5339 UTF-8 line-drawing characters to group related information.
5340 When disabled. ascii-art is used instead.
5341 Using the <literal>+all</literal> option does not set this modifier,
5342 </para>
5343 <para>
5344 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5345 any debugging is selected, or if <option>-v</option> is used.
5346 </para>
5347 </listitem></varlistentry>
5348 <varlistentry>
5349 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5350 <listitem>
5351 <para>
5352 <indexterm role="option">
5353 <primary><option>-dd</option></primary>
5354 </indexterm>
5355 This option behaves exactly like <option>-d</option> except when used on a command that
5356 starts a daemon process. In that case, debugging is turned off for the
5357 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5358 behaviour of the daemon without creating as much output as full debugging does.
5359 </para>
5360 </listitem></varlistentry>
5361 <varlistentry>
5362 <term><option>-dropcr</option></term>
5363 <listitem>
5364 <para>
5365 <indexterm role="option">
5366 <primary><option>-dropcr</option></primary>
5367 </indexterm>
5368 This is an obsolete option that is now a no-op. It used to affect the way Exim
5369 handled CR and LF characters in incoming messages. What happens now is
5370 described in section <xref linkend="SECTlineendings"/>.
5371 </para>
5372 </listitem></varlistentry>
5373 <varlistentry>
5374 <term><option>-E</option></term>
5375 <listitem>
5376 <para>
5377 <indexterm role="option">
5378 <primary><option>-E</option></primary>
5379 </indexterm>
5380 <indexterm role="concept">
5381 <primary>bounce message</primary>
5382 <secondary>generating</secondary>
5383 </indexterm>
5384 This option specifies that an incoming message is a locally-generated delivery
5385 failure report. It is used internally by Exim when handling delivery failures
5386 and is not intended for external use. Its only effect is to stop Exim
5387 generating certain messages to the postmaster, as otherwise message cascades
5388 could occur in some situations. As part of the same option, a message id may
5389 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5390 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5391 </para>
5392 </listitem></varlistentry>
5393 <varlistentry>
5394 <term><option>-e</option><emphasis>x</emphasis></term>
5395 <listitem>
5396 <para>
5397 <indexterm role="option">
5398 <primary><option>-e</option><emphasis>x</emphasis></primary>
5399 </indexterm>
5400 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5401 called by various programs without the leading <option>o</option> in the option. For
5402 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5403 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5404 </para>
5405 </listitem></varlistentry>
5406 <varlistentry>
5407 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5408 <listitem>
5409 <para>
5410 <indexterm role="option">
5411 <primary><option>-F</option></primary>
5412 </indexterm>
5413 <indexterm role="concept">
5414 <primary>sender</primary>
5415 <secondary>name</secondary>
5416 </indexterm>
5417 <indexterm role="concept">
5418 <primary>name</primary>
5419 <secondary>of sender</secondary>
5420 </indexterm>
5421 This option sets the sender&#x2019;s full name for use when a locally-generated
5422 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5423 entry from the password data is used. As users are generally permitted to alter
5424 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5425 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5426 </para>
5427 </listitem></varlistentry>
5428 <varlistentry>
5429 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5430 <listitem>
5431 <para>
5432 <indexterm role="option">
5433 <primary><option>-f</option></primary>
5434 </indexterm>
5435 <indexterm role="concept">
5436 <primary>sender</primary>
5437 <secondary>address</secondary>
5438 </indexterm>
5439 <indexterm role="concept">
5440 <primary>address</primary>
5441 <secondary>sender</secondary>
5442 </indexterm>
5443 <indexterm role="concept">
5444 <primary>trusted users</primary>
5445 </indexterm>
5446 <indexterm role="concept">
5447 <primary>envelope from</primary>
5448 </indexterm>
5449 <indexterm role="concept">
5450 <primary>envelope sender</primary>
5451 </indexterm>
5452 <indexterm role="concept">
5453 <primary>user</primary>
5454 <secondary>trusted</secondary>
5455 </indexterm>
5456 This option sets the address of the envelope sender of a locally-generated
5457 message (also known as the return path). The option can normally be used only
5458 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5459 users to use it.
5460 </para>
5461 <para>
5462 Processes running as root or the Exim user are always trusted. Other
5463 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5464 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5465 of a local message is set to the caller&#x2019;s login name at the default qualify
5466 domain.
5467 </para>
5468 <para>
5469 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5470 can be specified by any user, trusted or not, to create a message that can
5471 never provoke a bounce. An empty sender can be specified either as an empty
5472 string, or as a pair of angle brackets with nothing between them, as in these
5473 examples of shell commands:
5474 </para>
5475 <literallayout class="monospaced">
5476 exim -f '&lt;&gt;' user@domain
5477 exim -f "" user@domain
5478 </literallayout>
5479 <para>
5480 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5481 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5482 <option>-bv</option> options.
5483 </para>
5484 <para>
5485 Allowing untrusted users to change the sender address does not of itself make
5486 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5487 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5488 though this can be overridden by setting <option>no_local_from_check</option>.
5489 </para>
5490 <para>
5491 White
5492 <indexterm role="concept">
5493 <primary><quote>From</quote> line</primary>
5494 </indexterm>
5495 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5496 given as two arguments or one combined argument). The sender of a
5497 locally-generated message can also be set (when permitted) by an initial
5498 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5499 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5500 </para>
5501 </listitem></varlistentry>
5502 <varlistentry>
5503 <term><option>-G</option></term>
5504 <listitem>
5505 <para>
5506 <indexterm role="option">
5507 <primary><option>-G</option></primary>
5508 </indexterm>
5509 <indexterm role="concept">
5510 <primary>submission fixups, suppressing (command-line)</primary>
5511 </indexterm>
5512 This option is equivalent to an ACL applying:
5513 </para>
5514 <literallayout class="monospaced">
5515 control = suppress_local_fixups
5516 </literallayout>
5517 <para>
5518 for every message received.  Note that Sendmail will complain about such
5519 bad formatting, where Exim silently just does not fix it up.  This may change
5520 in future.
5521 </para>
5522 <para>
5523 As this affects audit information, the caller must be a trusted user to use
5524 this option.
5525 </para>
5526 </listitem></varlistentry>
5527 <varlistentry>
5528 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5529 <listitem>
5530 <para>
5531 <indexterm role="option">
5532 <primary><option>-h</option></primary>
5533 </indexterm>
5534 <indexterm role="concept">
5535 <primary>Sendmail compatibility</primary>
5536 <secondary><option>-h</option> option ignored</secondary>
5537 </indexterm>
5538 This option is accepted for compatibility with Sendmail, but has no effect. (In
5539 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5540 headers.)
5541 </para>
5542 </listitem></varlistentry>
5543 <varlistentry>
5544 <term><option>-i</option></term>
5545 <listitem>
5546 <para>
5547 <indexterm role="option">
5548 <primary><option>-i</option></primary>
5549 </indexterm>
5550 <indexterm role="concept">
5551 <primary>Solaris</primary>
5552 <secondary><emphasis>mail</emphasis> command</secondary>
5553 </indexterm>
5554 <indexterm role="concept">
5555 <primary>dot</primary>
5556 <secondary>in incoming non-SMTP message</secondary>
5557 </indexterm>
5558 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5559 line by itself should not terminate an incoming, non-SMTP message. I can find
5560 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5561 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5562 </para>
5563 </listitem></varlistentry>
5564 <varlistentry>
5565 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5566 <listitem>
5567 <para>
5568 <indexterm role="option">
5569 <primary><option>-L</option></primary>
5570 </indexterm>
5571 <indexterm role="concept">
5572 <primary>syslog</primary>
5573 <secondary>process name; set with flag</secondary>
5574 </indexterm>
5575 This option is equivalent to setting <option>syslog_processname</option> in the config
5576 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5577 Its use is restricted to administrators.  The configuration file has to be
5578 read and parsed, to determine access rights, before this is set and takes
5579 effect, so early configuration file errors will not honour this flag.
5580 </para>
5581 <para>
5582 The tag should not be longer than 32 characters.
5583 </para>
5584 </listitem></varlistentry>
5585 <varlistentry>
5586 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5587 <listitem>
5588 <para>
5589 <indexterm role="option">
5590 <primary><option>-M</option></primary>
5591 </indexterm>
5592 <indexterm role="concept">
5593 <primary>forcing delivery</primary>
5594 </indexterm>
5595 <indexterm role="concept">
5596 <primary>delivery</primary>
5597 <secondary>forcing attempt</secondary>
5598 </indexterm>
5599 <indexterm role="concept">
5600 <primary>frozen messages</primary>
5601 <secondary>forcing delivery</secondary>
5602 </indexterm>
5603 This option requests Exim to run a delivery attempt on each message in turn. If
5604 any of the messages are frozen, they are automatically thawed before the
5605 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5606 and <option>hold_domains</option> are ignored.
5607 </para>
5608 <para>
5609 Retry
5610 <indexterm role="concept">
5611 <primary>hints database</primary>
5612 <secondary>overriding retry hints</secondary>
5613 </indexterm>
5614 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5615 the normal retry time has not yet been reached. This option requires the caller
5616 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5617 which can be set false to relax this restriction (and also the same requirement
5618 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5619 </para>
5620 <para>
5621 The deliveries happen synchronously, that is, the original Exim process does
5622 not terminate until all the delivery attempts have finished. No output is
5623 produced unless there is a serious error. If you want to see what is happening,
5624 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5625 </para>
5626 </listitem></varlistentry>
5627 <varlistentry>
5628 <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>
5629 <listitem>
5630 <para>
5631 <indexterm role="option">
5632 <primary><option>-Mar</option></primary>
5633 </indexterm>
5634 <indexterm role="concept">
5635 <primary>message</primary>
5636 <secondary>adding recipients</secondary>
5637 </indexterm>
5638 <indexterm role="concept">
5639 <primary>recipient</primary>
5640 <secondary>adding</secondary>
5641 </indexterm>
5642 This option requests Exim to add the addresses to the list of recipients of the
5643 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5644 id, and the remaining ones must be email addresses. However, if the message is
5645 active (in the middle of a delivery attempt), it is not altered. This option
5646 can be used only by an admin user.
5647 </para>
5648 </listitem></varlistentry>
5649 <varlistentry>
5650 <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>
5651 <listitem>
5652 <para>
5653 <indexterm role="option">
5654 <primary><option>-MC</option></primary>
5655 </indexterm>
5656 <indexterm role="concept">
5657 <primary>SMTP</primary>
5658 <secondary>passed connection</secondary>
5659 </indexterm>
5660 <indexterm role="concept">
5661 <primary>SMTP</primary>
5662 <secondary>multiple deliveries</secondary>
5663 </indexterm>
5664 <indexterm role="concept">
5665 <primary>multiple SMTP deliveries</primary>
5666 </indexterm>
5667 This option is not intended for use by external callers. It is used internally
5668 by Exim to invoke another instance of itself to deliver a waiting message using
5669 an existing SMTP connection, which is passed as the standard input. Details are
5670 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5671 must be root or the Exim user in order to use it.
5672 </para>
5673 </listitem></varlistentry>
5674 <varlistentry>
5675 <term><option>-MCA</option></term>
5676 <listitem>
5677 <para>
5678 <indexterm role="option">
5679 <primary><option>-MCA</option></primary>
5680 </indexterm>
5681 This option is not intended for use by external callers. It is used internally
5682 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5683 connection to the remote host has been authenticated.
5684 </para>
5685 </listitem></varlistentry>
5686 <varlistentry>
5687 <term><option>-MCD</option></term>
5688 <listitem>
5689 <para>
5690 <indexterm role="option">
5691 <primary><option>-MCD</option></primary>
5692 </indexterm>
5693 This option is not intended for use by external callers. It is used internally
5694 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5695 remote host supports the ESMTP <filename>DSN</filename> extension.
5696 </para>
5697 </listitem></varlistentry>
5698 <varlistentry revisionflag="changed">
5699 <term><option>-MCd</option></term>
5700 <listitem>
5701 <para revisionflag="changed">
5702 <indexterm role="option">
5703 <primary><option>-MCd</option></primary>
5704 </indexterm>
5705 This option is not intended for use by external callers. It is used internally
5706 by Exim in conjunction with the <option>-d</option> option
5707 to pass on an information string on the purpose of the process.
5708 </para>
5709 </listitem></varlistentry>
5710 <varlistentry>
5711 <term><option>-MCG</option>&nbsp;&lt;<emphasis>queue&nbsp;name</emphasis>&gt;</term>
5712 <listitem>
5713 <para>
5714 <indexterm role="option">
5715 <primary><option>-MCG</option></primary>
5716 </indexterm>
5717 This option is not intended for use by external callers. It is used internally
5718 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5719 alternate queue is used, named by the following argument.
5720 </para>
5721 </listitem></varlistentry>
5722 <varlistentry>
5723 <term><option>-MCK</option></term>
5724 <listitem>
5725 <para>
5726 <indexterm role="option">
5727 <primary><option>-MCK</option></primary>
5728 </indexterm>
5729 This option is not intended for use by external callers. It is used internally
5730 by Exim in conjunction with the <option>-MC</option> option. It signifies that a
5731 remote host supports the ESMTP <filename>CHUNKING</filename> extension.
5732 </para>
5733 </listitem></varlistentry>
5734 <varlistentry>
5735 <term><option>-MCP</option></term>
5736 <listitem>
5737 <para>
5738 <indexterm role="option">
5739 <primary><option>-MCP</option></primary>
5740 </indexterm>
5741 This option is not intended for use by external callers. It is used internally
5742 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5743 which Exim is connected supports pipelining.
5744 </para>
5745 </listitem></varlistentry>
5746 <varlistentry>
5747 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5748 <listitem>
5749 <para>
5750 <indexterm role="option">
5751 <primary><option>-MCQ</option></primary>
5752 </indexterm>
5753 This option is not intended for use by external callers. It is used internally
5754 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5755 started by a queue runner. It passes on the process id of the queue runner,
5756 together with the file descriptor number of an open pipe. Closure of the pipe
5757 signals the final completion of the sequence of processes that are passing
5758 messages through the same SMTP connection.
5759 </para>
5760 </listitem></varlistentry>
5761 <varlistentry>
5762 <term><option>-MCS</option></term>
5763 <listitem>
5764 <para>
5765 <indexterm role="option">
5766 <primary><option>-MCS</option></primary>
5767 </indexterm>
5768 This option is not intended for use by external callers. It is used internally
5769 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5770 ESMTP SIZE option should be used on messages delivered down the existing
5771 connection.
5772 </para>
5773 </listitem></varlistentry>
5774 <varlistentry>
5775 <term><option>-MCT</option></term>
5776 <listitem>
5777 <para>
5778 <indexterm role="option">
5779 <primary><option>-MCT</option></primary>
5780 </indexterm>
5781 This option is not intended for use by external callers. It is used internally
5782 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5783 host to which Exim is connected supports TLS encryption.
5784 </para>
5785 </listitem></varlistentry>
5786 <varlistentry revisionflag="changed">
5787 <term><option>-MCr</option>&nbsp;&lt;<emphasis>SNI</emphasis>&gt;</term>
5788 <term><option>-MCs</option>&nbsp;&lt;<emphasis>SNI</emphasis>&gt;</term>
5789 <listitem>
5790 <para revisionflag="changed">
5791 <indexterm role="option">
5792 <primary><option>-MCs</option></primary>
5793 </indexterm>
5794 <indexterm role="option">
5795 <primary><option>-MCr</option></primary>
5796 </indexterm>
5797 These options are not intended for use by external callers. It is used internally
5798 by Exim in conjunction with the <option>-MCt</option> option, and passes on the fact that
5799 a TLS Server Name Indication was sent as part of the channel establishment.
5800 The argument gives the SNI string.
5801 The "r" variant indicates a DANE-verified connection.
5802 </para>
5803 </listitem></varlistentry>
5804 <varlistentry>
5805 <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>
5806 <listitem>
5807 <para>
5808 <indexterm role="option">
5809 <primary><option>-MCt</option></primary>
5810 </indexterm>
5811 This option is not intended for use by external callers. It is used internally
5812 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5813 connection is being proxied by a parent process for handling TLS encryption.
5814 The arguments give the local address and port being proxied, and the TLS cipher.
5815 </para>
5816 </listitem></varlistentry>
5817 <varlistentry>
5818 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5819 <listitem>
5820 <para>
5821 <indexterm role="option">
5822 <primary><option>-Mc</option></primary>
5823 </indexterm>
5824 <indexterm role="concept">
5825 <primary>hints database</primary>
5826 <secondary>not overridden by <option>-Mc</option></secondary>
5827 </indexterm>
5828 <indexterm role="concept">
5829 <primary>delivery</primary>
5830 <secondary>manually started &ndash; not forced</secondary>
5831 </indexterm>
5832 This option requests Exim to run a delivery attempt on each message, in turn,
5833 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5834 that are found. This option is not very useful to external callers. It is
5835 provided mainly for internal use by Exim when it needs to re-invoke itself in
5836 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5837 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5838 respects retry times and other options such as <option>hold_domains</option> that are
5839 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5840 If you want to run a specific delivery as if in a queue run, you should use
5841 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5842 and other deliveries is made in one or two places.
5843 </para>
5844 </listitem></varlistentry>
5845 <varlistentry>
5846 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5847 <listitem>
5848 <para>
5849 <indexterm role="option">
5850 <primary><option>-Mes</option></primary>
5851 </indexterm>
5852 <indexterm role="concept">
5853 <primary>message</primary>
5854 <secondary>changing sender</secondary>
5855 </indexterm>
5856 <indexterm role="concept">
5857 <primary>sender</primary>
5858 <secondary>changing</secondary>
5859 </indexterm>
5860 This option requests Exim to change the sender address in the message to the
5861 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5862 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5863 be a message id, and the second one an email address. However, if the message
5864 is active (in the middle of a delivery attempt), its status is not altered.
5865 This option can be used only by an admin user.
5866 </para>
5867 </listitem></varlistentry>
5868 <varlistentry>
5869 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5870 <listitem>
5871 <para>
5872 <indexterm role="option">
5873 <primary><option>-Mf</option></primary>
5874 </indexterm>
5875 <indexterm role="concept">
5876 <primary>freezing messages</primary>
5877 </indexterm>
5878 <indexterm role="concept">
5879 <primary>message</primary>
5880 <secondary>manually freezing</secondary>
5881 </indexterm>
5882 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5883 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5884 either manually or as a result of the <option>auto_thaw</option> configuration option.
5885 However, if any of the messages are active (in the middle of a delivery
5886 attempt), their status is not altered. This option can be used only by an admin
5887 user.
5888 </para>
5889 </listitem></varlistentry>
5890 <varlistentry>
5891 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5892 <listitem>
5893 <para>
5894 <indexterm role="option">
5895 <primary><option>-Mg</option></primary>
5896 </indexterm>
5897 <indexterm role="concept">
5898 <primary>giving up on messages</primary>
5899 </indexterm>
5900 <indexterm role="concept">
5901 <primary>message</primary>
5902 <secondary>abandoning delivery attempts</secondary>
5903 </indexterm>
5904 <indexterm role="concept">
5905 <primary>delivery</primary>
5906 <secondary>abandoning further attempts</secondary>
5907 </indexterm>
5908 This option requests Exim to give up trying to deliver the listed messages,
5909 including any that are frozen. However, if any of the messages are active,
5910 their status is not altered. For non-bounce messages, a delivery error message
5911 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5912 Bounce messages are just discarded. This option can be used only by an admin
5913 user.
5914 </para>
5915 </listitem></varlistentry>
5916 <varlistentry>
5917 <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>
5918 <listitem>
5919 <para>
5920 <indexterm role="option">
5921 <primary><option>-MG</option></primary>
5922 </indexterm>
5923 <indexterm role="concept">
5924 <primary>queue</primary>
5925 <secondary>named</secondary>
5926 </indexterm>
5927 <indexterm role="concept">
5928 <primary>named queues</primary>
5929 <secondary>moving messages</secondary>
5930 </indexterm>
5931 <indexterm role="concept">
5932 <primary>queue</primary>
5933 <secondary>moving messages</secondary>
5934 </indexterm>
5935 This option requests that each listed message be moved from its current
5936 queue to the given named queue.
5937 The destination queue name argument is required, but can be an empty
5938 string to define the default queue.
5939 If the messages are not currently located in the default queue,
5940 a <option>-qG&lt;name&gt;</option> option will be required to define the source queue.
5941 </para>
5942 </listitem></varlistentry>
5943 <varlistentry>
5944 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5945 <listitem>
5946 <para>
5947 <indexterm role="option">
5948 <primary><option>-Mmad</option></primary>
5949 </indexterm>
5950 <indexterm role="concept">
5951 <primary>delivery</primary>
5952 <secondary>cancelling all</secondary>
5953 </indexterm>
5954 This option requests Exim to mark all the recipient addresses in the messages
5955 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5956 message is active (in the middle of a delivery attempt), its status is not
5957 altered. This option can be used only by an admin user.
5958 </para>
5959 </listitem></varlistentry>
5960 <varlistentry>
5961 <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>
5962 <listitem>
5963 <para>
5964 <indexterm role="option">
5965 <primary><option>-Mmd</option></primary>
5966 </indexterm>
5967 <indexterm role="concept">
5968 <primary>delivery</primary>
5969 <secondary>cancelling by address</secondary>
5970 </indexterm>
5971 <indexterm role="concept">
5972 <primary>recipient</primary>
5973 <secondary>removing</secondary>
5974 </indexterm>
5975 <indexterm role="concept">
5976 <primary>removing recipients</primary>
5977 </indexterm>
5978 This option requests Exim to mark the given addresses as already delivered
5979 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5980 the remaining ones must be email addresses. These are matched to recipient
5981 addresses in the message in a case-sensitive manner. If the message is active
5982 (in the middle of a delivery attempt), its status is not altered. This option
5983 can be used only by an admin user.
5984 </para>
5985 </listitem></varlistentry>
5986 <varlistentry>
5987 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5988 <listitem>
5989 <para>
5990 <indexterm role="option">
5991 <primary><option>-Mrm</option></primary>
5992 </indexterm>
5993 <indexterm role="concept">
5994 <primary>removing messages</primary>
5995 </indexterm>
5996 <indexterm role="concept">
5997 <primary>abandoning mail</primary>
5998 </indexterm>
5999 <indexterm role="concept">
6000 <primary>message</primary>
6001 <secondary>manually discarding</secondary>
6002 </indexterm>
6003 This option requests Exim to remove the given messages from the queue. No
6004 bounce messages are sent; each message is simply forgotten. However, if any of
6005 the messages are active, their status is not altered. This option can be used
6006 only by an admin user or by the user who originally caused the message to be
6007 placed in the queue.
6008 </para>
6009 </listitem></varlistentry>
6010 <varlistentry>
6011 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6012 <listitem>
6013 <para>
6014 <indexterm role="option">
6015 <primary><option>-Mset</option></primary>
6016 </indexterm>
6017 <indexterm role="concept">
6018 <primary>testing</primary>
6019 <secondary>string expansion</secondary>
6020 </indexterm>
6021 <indexterm role="concept">
6022 <primary>expansion</primary>
6023 <secondary>testing</secondary>
6024 </indexterm>
6025 This option is useful only in conjunction with <option>-be</option> (that is, when testing
6026 string expansions). Exim loads the given message from its spool before doing
6027 the test expansions, thus setting message-specific variables such as
6028 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
6029 available. This feature is provided to make it easier to test expansions that
6030 make use of these variables. However, this option can be used only by an admin
6031 user. See also <option>-bem</option>.
6032 </para>
6033 </listitem></varlistentry>
6034 <varlistentry>
6035 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6036 <listitem>
6037 <para>
6038 <indexterm role="option">
6039 <primary><option>-Mt</option></primary>
6040 </indexterm>
6041 <indexterm role="concept">
6042 <primary>thawing messages</primary>
6043 </indexterm>
6044 <indexterm role="concept">
6045 <primary>unfreezing messages</primary>
6046 </indexterm>
6047 <indexterm role="concept">
6048 <primary>frozen messages</primary>
6049 <secondary>thawing</secondary>
6050 </indexterm>
6051 <indexterm role="concept">
6052 <primary>message</primary>
6053 <secondary>thawing frozen</secondary>
6054 </indexterm>
6055 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
6056 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
6057 messages are active, their status is not altered. This option can be used only
6058 by an admin user.
6059 </para>
6060 </listitem></varlistentry>
6061 <varlistentry>
6062 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6063 <listitem>
6064 <para>
6065 <indexterm role="option">
6066 <primary><option>-Mvb</option></primary>
6067 </indexterm>
6068 <indexterm role="concept">
6069 <primary>listing</primary>
6070 <secondary>message body</secondary>
6071 </indexterm>
6072 <indexterm role="concept">
6073 <primary>message</primary>
6074 <secondary>listing body of</secondary>
6075 </indexterm>
6076 This option causes the contents of the message body (-D) spool file to be
6077 written to the standard output. This option can be used only by an admin user.
6078 </para>
6079 </listitem></varlistentry>
6080 <varlistentry>
6081 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6082 <listitem>
6083 <para>
6084 <indexterm role="option">
6085 <primary><option>-Mvc</option></primary>
6086 </indexterm>
6087 <indexterm role="concept">
6088 <primary>message</primary>
6089 <secondary>listing in RFC 2822 format</secondary>
6090 </indexterm>
6091 <indexterm role="concept">
6092 <primary>listing</primary>
6093 <secondary>message in RFC 2822 format</secondary>
6094 </indexterm>
6095 This option causes a copy of the complete message (header lines plus body) to
6096 be written to the standard output in RFC 2822 format. This option can be used
6097 only by an admin user.
6098 </para>
6099 </listitem></varlistentry>
6100 <varlistentry>
6101 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6102 <listitem>
6103 <para>
6104 <indexterm role="option">
6105 <primary><option>-Mvh</option></primary>
6106 </indexterm>
6107 <indexterm role="concept">
6108 <primary>listing</primary>
6109 <secondary>message headers</secondary>
6110 </indexterm>
6111 <indexterm role="concept">
6112 <primary>header lines</primary>
6113 <secondary>listing</secondary>
6114 </indexterm>
6115 <indexterm role="concept">
6116 <primary>message</primary>
6117 <secondary>listing header lines</secondary>
6118 </indexterm>
6119 This option causes the contents of the message headers (-H) spool file to be
6120 written to the standard output. This option can be used only by an admin user.
6121 </para>
6122 </listitem></varlistentry>
6123 <varlistentry>
6124 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6125 <listitem>
6126 <para>
6127 <indexterm role="option">
6128 <primary><option>-Mvl</option></primary>
6129 </indexterm>
6130 <indexterm role="concept">
6131 <primary>listing</primary>
6132 <secondary>message log</secondary>
6133 </indexterm>
6134 <indexterm role="concept">
6135 <primary>message</primary>
6136 <secondary>listing message log</secondary>
6137 </indexterm>
6138 This option causes the contents of the message log spool file to be written to
6139 the standard output. This option can be used only by an admin user.
6140 </para>
6141 </listitem></varlistentry>
6142 <varlistentry>
6143 <term><option>-m</option></term>
6144 <listitem>
6145 <para>
6146 <indexterm role="option">
6147 <primary><option>-m</option></primary>
6148 </indexterm>
6149 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
6150 treats it that way too.
6151 </para>
6152 </listitem></varlistentry>
6153 <varlistentry>
6154 <term><option>-N</option></term>
6155 <listitem>
6156 <para>
6157 <indexterm role="option">
6158 <primary><option>-N</option></primary>
6159 </indexterm>
6160 <indexterm role="concept">
6161 <primary>debugging</primary>
6162 <secondary><option>-N</option> option</secondary>
6163 </indexterm>
6164 <indexterm role="concept">
6165 <primary>debugging</primary>
6166 <secondary>suppressing delivery</secondary>
6167 </indexterm>
6168 This is a debugging option that inhibits delivery of a message at the transport
6169 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
6170 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
6171 had successfully done so. However, it does not make any updates to the retry
6172 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
6173 than <quote>=&gt;</quote>.
6174 </para>
6175 <para>
6176 Because <option>-N</option> discards any message to which it applies, only root or the Exim
6177 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
6178 words, an ordinary user can use it only when supplying an incoming message to
6179 which it will apply. Although transportation never fails when <option>-N</option> is set, an
6180 address may be deferred because of a configuration problem on a transport, or a
6181 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
6182 the message, and applies to any subsequent delivery attempts that may happen
6183 for that message.
6184 </para>
6185 </listitem></varlistentry>
6186 <varlistentry>
6187 <term><option>-n</option></term>
6188 <listitem>
6189 <para>
6190 <indexterm role="option">
6191 <primary><option>-n</option></primary>
6192 </indexterm>
6193 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6194 For normal modes of operation, it is ignored by Exim.
6195 When combined with <option>-bP</option> it makes the output more terse (suppresses
6196 option names, environment values and config pretty printing).
6197 </para>
6198 </listitem></varlistentry>
6199 <varlistentry>
6200 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6201 <listitem>
6202 <para>
6203 <indexterm role="option">
6204 <primary><option>-O</option></primary>
6205 </indexterm>
6206 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6207 Exim.
6208 </para>
6209 </listitem></varlistentry>
6210 <varlistentry>
6211 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6212 <listitem>
6213 <para>
6214 <indexterm role="option">
6215 <primary><option>-oA</option></primary>
6216 </indexterm>
6217 <indexterm role="concept">
6218 <primary>Sendmail compatibility</primary>
6219 <secondary><option>-oA</option> option</secondary>
6220 </indexterm>
6221 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6222 alternative alias filename. Exim handles <option>-bi</option> differently; see the
6223 description above.
6224 </para>
6225 </listitem></varlistentry>
6226 <varlistentry>
6227 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6228 <listitem>
6229 <para>
6230 <indexterm role="option">
6231 <primary><option>-oB</option></primary>
6232 </indexterm>
6233 <indexterm role="concept">
6234 <primary>SMTP</primary>
6235 <secondary>passed connection</secondary>
6236 </indexterm>
6237 <indexterm role="concept">
6238 <primary>SMTP</primary>
6239 <secondary>multiple deliveries</secondary>
6240 </indexterm>
6241 <indexterm role="concept">
6242 <primary>multiple SMTP deliveries</primary>
6243 </indexterm>
6244 This is a debugging option which limits the maximum number of messages that can
6245 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6246 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6247 </para>
6248 </listitem></varlistentry>
6249 <varlistentry>
6250 <term><option>-odb</option></term>
6251 <listitem>
6252 <para>
6253 <indexterm role="option">
6254 <primary><option>-odb</option></primary>
6255 </indexterm>
6256 <indexterm role="concept">
6257 <primary>background delivery</primary>
6258 </indexterm>
6259 <indexterm role="concept">
6260 <primary>delivery</primary>
6261 <secondary>in the background</secondary>
6262 </indexterm>
6263 This option applies to all modes in which Exim accepts incoming messages,
6264 including the listening daemon. It requests <quote>background</quote> delivery of such
6265 messages, which means that the accepting process automatically starts a
6266 delivery process for each message received, but does not wait for the delivery
6267 processes to finish.
6268 </para>
6269 <para>
6270 When all the messages have been received, the reception process exits,
6271 leaving the delivery processes to finish in their own time. The standard output
6272 and error streams are closed at the start of each delivery process.
6273 This is the default action if none of the <option>-od</option> options are present.
6274 </para>
6275 <para>
6276 If one of the queueing options in the configuration file
6277 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6278 overrides it if <option>queue_only_override</option> is set true, which is the default
6279 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6280 </para>
6281 </listitem></varlistentry>
6282 <varlistentry>
6283 <term><option>-odf</option></term>
6284 <listitem>
6285 <para>
6286 <indexterm role="option">
6287 <primary><option>-odf</option></primary>
6288 </indexterm>
6289 <indexterm role="concept">
6290 <primary>foreground delivery</primary>
6291 </indexterm>
6292 <indexterm role="concept">
6293 <primary>delivery</primary>
6294 <secondary>in the foreground</secondary>
6295 </indexterm>
6296 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6297 accepted a locally-generated message. (For the daemon it is exactly the same as
6298 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6299 and Exim waits for it to complete before proceeding.
6300 </para>
6301 <para>
6302 The original Exim reception process does not finish until the delivery
6303 process for the final message has ended. The standard error stream is left open
6304 during deliveries.
6305 </para>
6306 <para>
6307 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6308 false and one of the queueing options in the configuration file is in effect.
6309 </para>
6310 <para>
6311 If there is a temporary delivery error during foreground delivery, the
6312 message is left in the queue for later delivery, and the original reception
6313 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6314 restricted configuration that never queues messages.
6315 </para>
6316 </listitem></varlistentry>
6317 <varlistentry>
6318 <term><option>-odi</option></term>
6319 <listitem>
6320 <para>
6321 <indexterm role="option">
6322 <primary><option>-odi</option></primary>
6323 </indexterm>
6324 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6325 Sendmail.
6326 </para>
6327 </listitem></varlistentry>
6328 <varlistentry>
6329 <term><option>-odq</option></term>
6330 <listitem>
6331 <para>
6332 <indexterm role="option">
6333 <primary><option>-odq</option></primary>
6334 </indexterm>
6335 <indexterm role="concept">
6336 <primary>non-immediate delivery</primary>
6337 </indexterm>
6338 <indexterm role="concept">
6339 <primary>delivery</primary>
6340 <secondary>suppressing immediate</secondary>
6341 </indexterm>
6342 <indexterm role="concept">
6343 <primary>queueing incoming messages</primary>
6344 </indexterm>
6345 This option applies to all modes in which Exim accepts incoming messages,
6346 including the listening daemon. It specifies that the accepting process should
6347 not automatically start a delivery process for each message received. Messages
6348 are placed in the queue, and remain there until a subsequent queue runner
6349 process encounters them. There are several configuration options (such as
6350 <option>queue_only</option>) that can be used to queue incoming messages under certain
6351 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6352 forces queueing.
6353 </para>
6354 </listitem></varlistentry>
6355 <varlistentry>
6356 <term><option>-odqs</option></term>
6357 <listitem>
6358 <para>
6359 <indexterm role="option">
6360 <primary><option>-odqs</option></primary>
6361 </indexterm>
6362 <indexterm role="concept">
6363 <primary>SMTP</primary>
6364 <secondary>delaying delivery</secondary>
6365 </indexterm>
6366 <indexterm role="concept">
6367 <primary>first pass routing</primary>
6368 </indexterm>
6369 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6370 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6371 <option>queue_only_override</option> is false and one of the queueing options in the
6372 configuration file is in effect.
6373 </para>
6374 <para>
6375 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6376 message, in the background by default, but in the foreground if <option>-odi</option> is
6377 also present. The recipient addresses are routed, and local deliveries are done
6378 in the normal way. However, if any SMTP deliveries are required, they are not
6379 done at this time, so the message remains in the queue until a subsequent queue
6380 runner process encounters it. Because routing was done, Exim knows which
6381 messages are waiting for which hosts, and so a number of messages for the same
6382 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6383 configuration option has the same effect for specific domains. See also the
6384 <option>-qq</option> option.
6385 </para>
6386 </listitem></varlistentry>
6387 <varlistentry>
6388 <term><option>-oee</option></term>
6389 <listitem>
6390 <para>
6391 <indexterm role="option">
6392 <primary><option>-oee</option></primary>
6393 </indexterm>
6394 <indexterm role="concept">
6395 <primary>error</primary>
6396 <secondary>reporting</secondary>
6397 </indexterm>
6398 If an error is detected while a non-SMTP message is being received (for
6399 example, a malformed address), the error is reported to the sender in a mail
6400 message.
6401 </para>
6402 <para>
6403 <indexterm role="concept">
6404 <primary>return code</primary>
6405 <secondary>for <option>-oee</option></secondary>
6406 </indexterm>
6407 Provided
6408 this error message is successfully sent, the Exim receiving process
6409 exits with a return code of zero. If not, the return code is 2 if the problem
6410 is that the original message has no recipients, or 1 for any other error.
6411 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6412 </para>
6413 </listitem></varlistentry>
6414 <varlistentry>
6415 <term><option>-oem</option></term>
6416 <listitem>
6417 <para>
6418 <indexterm role="option">
6419 <primary><option>-oem</option></primary>
6420 </indexterm>
6421 <indexterm role="concept">
6422 <primary>error</primary>
6423 <secondary>reporting</secondary>
6424 </indexterm>
6425 <indexterm role="concept">
6426 <primary>return code</primary>
6427 <secondary>for <option>-oem</option></secondary>
6428 </indexterm>
6429 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6430 return code, whether or not the error message was successfully sent.
6431 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6432 </para>
6433 </listitem></varlistentry>
6434 <varlistentry>
6435 <term><option>-oep</option></term>
6436 <listitem>
6437 <para>
6438 <indexterm role="option">
6439 <primary><option>-oep</option></primary>
6440 </indexterm>
6441 <indexterm role="concept">
6442 <primary>error</primary>
6443 <secondary>reporting</secondary>
6444 </indexterm>
6445 If an error is detected while a non-SMTP message is being received, the
6446 error is reported by writing a message to the standard error file (stderr).
6447 <indexterm role="concept">
6448 <primary>return code</primary>
6449 <secondary>for <option>-oep</option></secondary>
6450 </indexterm>
6451 The return code is 1 for all errors.
6452 </para>
6453 </listitem></varlistentry>
6454 <varlistentry>
6455 <term><option>-oeq</option></term>
6456 <listitem>
6457 <para>
6458 <indexterm role="option">
6459 <primary><option>-oeq</option></primary>
6460 </indexterm>
6461 <indexterm role="concept">
6462 <primary>error</primary>
6463 <secondary>reporting</secondary>
6464 </indexterm>
6465 This option is supported for compatibility with Sendmail, but has the same
6466 effect as <option>-oep</option>.
6467 </para>
6468 </listitem></varlistentry>
6469 <varlistentry>
6470 <term><option>-oew</option></term>
6471 <listitem>
6472 <para>
6473 <indexterm role="option">
6474 <primary><option>-oew</option></primary>
6475 </indexterm>
6476 <indexterm role="concept">
6477 <primary>error</primary>
6478 <secondary>reporting</secondary>
6479 </indexterm>
6480 This option is supported for compatibility with Sendmail, but has the same
6481 effect as <option>-oem</option>.
6482 </para>
6483 </listitem></varlistentry>
6484 <varlistentry>
6485 <term><option>-oi</option></term>
6486 <listitem>
6487 <para>
6488 <indexterm role="option">
6489 <primary><option>-oi</option></primary>
6490 </indexterm>
6491 <indexterm role="concept">
6492 <primary>dot</primary>
6493 <secondary>in incoming non-SMTP message</secondary>
6494 </indexterm>
6495 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6496 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6497 single dot does terminate, though Exim does no special processing for other
6498 lines that start with a dot. This option is set by default if Exim is called as
6499 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6500 </para>
6501 </listitem></varlistentry>
6502 <varlistentry>
6503 <term><option>-oitrue</option></term>
6504 <listitem>
6505 <para>
6506 <indexterm role="option">
6507 <primary><option>-oitrue</option></primary>
6508 </indexterm>
6509 This option is treated as synonymous with <option>-oi</option>.
6510 </para>
6511 </listitem></varlistentry>
6512 <varlistentry>
6513 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6514 <listitem>
6515 <para>
6516 <indexterm role="option">
6517 <primary><option>-oMa</option></primary>
6518 </indexterm>
6519 <indexterm role="concept">
6520 <primary>sender</primary>
6521 <secondary>host address, specifying for local message</secondary>
6522 </indexterm>
6523 A number of options starting with <option>-oM</option> can be used to set values associated
6524 with remote hosts on locally-submitted messages (that is, messages not received
6525 over TCP/IP). These options can be used by any caller in conjunction with the
6526 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6527 other circumstances, they are ignored unless the caller is trusted.
6528 </para>
6529 <para>
6530 The <option>-oMa</option> option sets the sender host address. This may include a port
6531 number at the end, after a full stop (period). For example:
6532 </para>
6533 <literallayout class="monospaced">
6534 exim -bs -oMa 10.9.8.7.1234
6535 </literallayout>
6536 <para>
6537 An alternative syntax is to enclose the IP address in square brackets,
6538 followed by a colon and the port number:
6539 </para>
6540 <literallayout class="monospaced">
6541 exim -bs -oMa [10.9.8.7]:1234
6542 </literallayout>
6543 <para>
6544 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6545 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6546 are present on the command line, the sender host IP address is taken from
6547 whichever one is last.
6548 </para>
6549 </listitem></varlistentry>
6550 <varlistentry>
6551 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6552 <listitem>
6553 <para>
6554 <indexterm role="option">
6555 <primary><option>-oMaa</option></primary>
6556 </indexterm>
6557 <indexterm role="concept">
6558 <primary>authentication</primary>
6559 <secondary>name, specifying for local message</secondary>
6560 </indexterm>
6561 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6562 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6563 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6564 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6565 authenticated SMTP session without actually using the SMTP AUTH command.
6566 </para>
6567 </listitem></varlistentry>
6568 <varlistentry>
6569 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6570 <listitem>
6571 <para>
6572 <indexterm role="option">
6573 <primary><option>-oMai</option></primary>
6574 </indexterm>
6575 <indexterm role="concept">
6576 <primary>authentication</primary>
6577 <secondary>id, specifying for local message</secondary>
6578 </indexterm>
6579 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6580 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6581 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6582 where there is no default) for messages from local sources. See chapter
6583 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6584 </para>
6585 </listitem></varlistentry>
6586 <varlistentry>
6587 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6588 <listitem>
6589 <para>
6590 <indexterm role="option">
6591 <primary><option>-oMas</option></primary>
6592 </indexterm>
6593 <indexterm role="concept">
6594 <primary>authentication</primary>
6595 <secondary>sender, specifying for local message</secondary>
6596 </indexterm>
6597 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6598 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6599 overrides the sender address that is created from the caller&#x2019;s login id for
6600 messages from local sources, except when <option>-bh</option> is used, when there is no
6601 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6602 specified on a MAIL command overrides this value. See chapter
6603 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6604 </para>
6605 </listitem></varlistentry>
6606 <varlistentry>
6607 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6608 <listitem>
6609 <para>
6610 <indexterm role="option">
6611 <primary><option>-oMi</option></primary>
6612 </indexterm>
6613 <indexterm role="concept">
6614 <primary>interface</primary>
6615 <secondary>address, specifying for local message</secondary>
6616 </indexterm>
6617 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6618 option sets the IP interface address value. A port number may be included,
6619 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6620 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6621 </para>
6622 </listitem></varlistentry>
6623 <varlistentry>
6624 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6625 <listitem>
6626 <para>
6627 <indexterm role="option">
6628 <primary><option>-oMm</option></primary>
6629 </indexterm>
6630 <indexterm role="concept">
6631 <primary>message reference</primary>
6632 <secondary>message reference, specifying for local message</secondary>
6633 </indexterm>
6634 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6635 option sets the message reference, e.g. message-id, and is logged during
6636 delivery. This is useful when some kind of audit trail is required to tie
6637 messages together. The format of the message reference is checked and will
6638 abort if the format is invalid. The option will only be accepted if exim is
6639 running in trusted mode, not as any regular user.
6640 </para>
6641 <para>
6642 The best example of a message reference is when Exim sends a bounce message.
6643 The message reference is the message-id of the original message for which Exim
6644 is sending the bounce.
6645 </para>
6646 </listitem></varlistentry>
6647 <varlistentry>
6648 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6649 <listitem>
6650 <para>
6651 <indexterm role="option">
6652 <primary><option>-oMr</option></primary>
6653 </indexterm>
6654 <indexterm role="concept">
6655 <primary>protocol, specifying for local message</primary>
6656 </indexterm>
6657 <indexterm role="variable">
6658 <primary><varname>$received_protocol</varname></primary>
6659 </indexterm>
6660 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6661 option sets the received protocol value that is stored in
6662 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6663 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6664 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6665 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6666 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6667 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6668 </para>
6669 </listitem></varlistentry>
6670 <varlistentry>
6671 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6672 <listitem>
6673 <para>
6674 <indexterm role="option">
6675 <primary><option>-oMs</option></primary>
6676 </indexterm>
6677 <indexterm role="concept">
6678 <primary>sender</primary>
6679 <secondary>host name, specifying for local message</secondary>
6680 </indexterm>
6681 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6682 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6683 present, Exim does not attempt to look up a host name from an IP address; it
6684 uses the name it is given.
6685 </para>
6686 </listitem></varlistentry>
6687 <varlistentry>
6688 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6689 <listitem>
6690 <para>
6691 <indexterm role="option">
6692 <primary><option>-oMt</option></primary>
6693 </indexterm>
6694 <indexterm role="concept">
6695 <primary>sender</primary>
6696 <secondary>ident string, specifying for local message</secondary>
6697 </indexterm>
6698 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6699 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6700 local callers is the login id of the calling process, except when <option>-bh</option> is
6701 used, when there is no default.
6702 </para>
6703 </listitem></varlistentry>
6704 <varlistentry>
6705 <term><option>-om</option></term>
6706 <listitem>
6707 <para>
6708 <indexterm role="option">
6709 <primary><option>-om</option></primary>
6710 </indexterm>
6711 <indexterm role="concept">
6712 <primary>Sendmail compatibility</primary>
6713 <secondary><option>-om</option> option ignored</secondary>
6714 </indexterm>
6715 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6716 message should receive a copy of the message if the sender appears in an alias
6717 expansion. Exim always does this, so the option does nothing.
6718 </para>
6719 </listitem></varlistentry>
6720 <varlistentry>
6721 <term><option>-oo</option></term>
6722 <listitem>
6723 <para>
6724 <indexterm role="option">
6725 <primary><option>-oo</option></primary>
6726 </indexterm>
6727 <indexterm role="concept">
6728 <primary>Sendmail compatibility</primary>
6729 <secondary><option>-oo</option> option ignored</secondary>
6730 </indexterm>
6731 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6732 whatever that means.
6733 </para>
6734 </listitem></varlistentry>
6735 <varlistentry>
6736 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6737 <listitem>
6738 <para>
6739 <indexterm role="option">
6740 <primary><option>-oP</option></primary>
6741 </indexterm>
6742 <indexterm role="concept">
6743 <primary>pid (process id)</primary>
6744 <secondary>of daemon</secondary>
6745 </indexterm>
6746 <indexterm role="concept">
6747 <primary>daemon</primary>
6748 <secondary>process id (pid)</secondary>
6749 </indexterm>
6750 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6751 value. The option specifies the file to which the process id of the daemon is
6752 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6753 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6754 because in those cases, the normal pid file is not used.
6755 </para>
6756 </listitem></varlistentry>
6757 <varlistentry revisionflag="changed">
6758 <term><option>-oPX</option></term>
6759 <listitem>
6760 <para revisionflag="changed">
6761 <indexterm role="option">
6762 <primary><option>-oPX</option></primary>
6763 </indexterm>
6764 <indexterm role="concept">
6765 <primary>pid (process id)</primary>
6766 <secondary>of daemon</secondary>
6767 </indexterm>
6768 <indexterm role="concept">
6769 <primary>daemon</primary>
6770 <secondary>process id (pid)</secondary>
6771 </indexterm>
6772 This option is not intended for general use.
6773 The daemon uses it when terminating due to a SIGTEM, possibly in
6774 combination with <option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;.
6775 It causes the pid file to be removed.
6776 </para>
6777 </listitem></varlistentry>
6778 <varlistentry>
6779 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6780 <listitem>
6781 <para>
6782 <indexterm role="option">
6783 <primary><option>-or</option></primary>
6784 </indexterm>
6785 <indexterm role="concept">
6786 <primary>timeout</primary>
6787 <secondary>for non-SMTP input</secondary>
6788 </indexterm>
6789 This option sets a timeout value for incoming non-SMTP messages. If it is not
6790 set, Exim will wait forever for the standard input. The value can also be set
6791 by the <option>receive_timeout</option> option. The format used for specifying times is
6792 described in section <xref linkend="SECTtimeformat"/>.
6793 </para>
6794 </listitem></varlistentry>
6795 <varlistentry>
6796 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6797 <listitem>
6798 <para>
6799 <indexterm role="option">
6800 <primary><option>-os</option></primary>
6801 </indexterm>
6802 <indexterm role="concept">
6803 <primary>timeout</primary>
6804 <secondary>for SMTP input</secondary>
6805 </indexterm>
6806 <indexterm role="concept">
6807 <primary>SMTP</primary>
6808 <secondary>input timeout</secondary>
6809 </indexterm>
6810 This option sets a timeout value for incoming SMTP messages. The timeout
6811 applies to each SMTP command and block of data. The value can also be set by
6812 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6813 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6814 </para>
6815 </listitem></varlistentry>
6816 <varlistentry>
6817 <term><option>-ov</option></term>
6818 <listitem>
6819 <para>
6820 <indexterm role="option">
6821 <primary><option>-ov</option></primary>
6822 </indexterm>
6823 This option has exactly the same effect as <option>-v</option>.
6824 </para>
6825 </listitem></varlistentry>
6826 <varlistentry>
6827 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6828 <listitem>
6829 <para>
6830 <indexterm role="option">
6831 <primary><option>-oX</option></primary>
6832 </indexterm>
6833 <indexterm role="concept">
6834 <primary>TCP/IP</primary>
6835 <secondary>setting listening ports</secondary>
6836 </indexterm>
6837 <indexterm role="concept">
6838 <primary>TCP/IP</primary>
6839 <secondary>setting listening interfaces</secondary>
6840 </indexterm>
6841 <indexterm role="concept">
6842 <primary>port</primary>
6843 <secondary>receiving TCP/IP</secondary>
6844 </indexterm>
6845 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6846 is also given. It controls which ports and interfaces the daemon uses. Details
6847 of the syntax, and how it interacts with configuration file options, are given
6848 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6849 file is written unless <option>-oP</option> is also present to specify a pid filename.
6850 </para>
6851 </listitem></varlistentry>
6852 <varlistentry>
6853 <term><option>-pd</option></term>
6854 <listitem>
6855 <para>
6856 <indexterm role="option">
6857 <primary><option>-pd</option></primary>
6858 </indexterm>
6859 <indexterm role="concept">
6860 <primary>Perl</primary>
6861 <secondary>starting the interpreter</secondary>
6862 </indexterm>
6863 This option applies when an embedded Perl interpreter is linked with Exim (see
6864 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6865 option, forcing the starting of the interpreter to be delayed until it is
6866 needed.
6867 </para>
6868 </listitem></varlistentry>
6869 <varlistentry>
6870 <term><option>-ps</option></term>
6871 <listitem>
6872 <para>
6873 <indexterm role="option">
6874 <primary><option>-ps</option></primary>
6875 </indexterm>
6876 <indexterm role="concept">
6877 <primary>Perl</primary>
6878 <secondary>starting the interpreter</secondary>
6879 </indexterm>
6880 This option applies when an embedded Perl interpreter is linked with Exim (see
6881 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6882 option, forcing the starting of the interpreter to occur as soon as Exim is
6883 started.
6884 </para>
6885 </listitem></varlistentry>
6886 <varlistentry>
6887 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6888 <listitem>
6889 <para>
6890 <indexterm role="option">
6891 <primary><option>-p</option></primary>
6892 </indexterm>
6893 For compatibility with Sendmail, this option is equivalent to
6894 </para>
6895 <literallayout>
6896 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6897 </literallayout>
6898 <para>
6899 It sets the incoming protocol and host name (for trusted callers). The
6900 host name and its colon can be omitted when only the protocol is to be set.
6901 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6902 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
6903 or <literal>s</literal> using this option (but that does not seem a real limitation).
6904 Repeated use of this option is not supported.
6905 </para>
6906 </listitem></varlistentry>
6907 <varlistentry>
6908 <term><option>-q</option></term>
6909 <listitem>
6910 <para>
6911 <indexterm role="option">
6912 <primary><option>-q</option></primary>
6913 </indexterm>
6914 <indexterm role="concept">
6915 <primary>queue runner</primary>
6916 <secondary>starting manually</secondary>
6917 </indexterm>
6918 This option is normally restricted to admin users. However, there is a
6919 configuration option called <option>prod_requires_admin</option> which can be set false to
6920 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6921 and <option>-S</option> options).
6922 </para>
6923 <para>
6924 <indexterm role="concept">
6925 <primary>queue runner</primary>
6926 <secondary>description of operation</secondary>
6927 </indexterm>
6928 If other commandline options do not specify an action,
6929 the <option>-q</option> option starts one queue runner process. This scans the queue of
6930 waiting messages, and runs a delivery process for each one in turn. It waits
6931 for each delivery process to finish before starting the next one. A delivery
6932 process may not actually do any deliveries if the retry times for the addresses
6933 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6934 </para>
6935 <para>
6936 If
6937 <indexterm role="concept">
6938 <primary>SMTP</primary>
6939 <secondary>passed connection</secondary>
6940 </indexterm>
6941 <indexterm role="concept">
6942 <primary>SMTP</primary>
6943 <secondary>multiple deliveries</secondary>
6944 </indexterm>
6945 <indexterm role="concept">
6946 <primary>multiple SMTP deliveries</primary>
6947 </indexterm>
6948 the delivery process spawns other processes to deliver other messages down
6949 passed SMTP connections, the queue runner waits for these to finish before
6950 proceeding.
6951 </para>
6952 <para>
6953 When all the queued messages have been considered, the original queue runner
6954 process terminates. In other words, a single pass is made over the waiting
6955 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6956 this to be repeated periodically.
6957 </para>
6958 <para>
6959 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6960 random, but it is likely to be different each time, which is all that matters.
6961 If one particular message screws up a remote MTA, other messages to the same
6962 MTA have a chance of getting through if they get tried first.
6963 </para>
6964 <para>
6965 It is possible to cause the messages to be processed in lexical message id
6966 order, which is essentially the order in which they arrived, by setting the
6967 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6968 </para>
6969 </listitem></varlistentry>
6970 <varlistentry>
6971 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6972 <listitem>
6973 <para>
6974 The <option>-q</option> option may be followed by one or more flag letters that change its
6975 behaviour. They are all optional, but if more than one is present, they must
6976 appear in the correct order. Each flag is described in a separate item below.
6977 </para>
6978 </listitem></varlistentry>
6979 <varlistentry>
6980 <term><option>-qq...</option></term>
6981 <listitem>
6982 <para>
6983 <indexterm role="option">
6984 <primary><option>-qq</option></primary>
6985 </indexterm>
6986 <indexterm role="concept">
6987 <primary>queue</primary>
6988 <secondary>double scanning</secondary>
6989 </indexterm>
6990 <indexterm role="concept">
6991 <primary>queue</primary>
6992 <secondary>routing</secondary>
6993 </indexterm>
6994 <indexterm role="concept">
6995 <primary>routing</primary>
6996 <secondary>whole queue before delivery</secondary>
6997 </indexterm>
6998 <indexterm role="concept">
6999 <primary>first pass routing</primary>
7000 </indexterm>
7001 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
7002 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
7003 every domain. Addresses are routed, local deliveries happen, but no remote
7004 transports are run.
7005 </para>
7006 <para revisionflag="changed">
7007 Performance will be best if the <option>queue_run_in_order</option> option is false.
7008 </para>
7009 <para>
7010 <indexterm role="concept">
7011 <primary>hints database</primary>
7012 <secondary>remembering routing</secondary>
7013 </indexterm>
7014 The hints database that remembers which messages are waiting for specific hosts
7015 is updated, as if delivery to those hosts had been deferred. After this is
7016 complete, a second, normal queue scan happens, with routing and delivery taking
7017 place as normal. Messages that are routed to the same host should mostly be
7018 delivered down a single SMTP
7019 <indexterm role="concept">
7020 <primary>SMTP</primary>
7021 <secondary>passed connection</secondary>
7022 </indexterm>
7023 <indexterm role="concept">
7024 <primary>SMTP</primary>
7025 <secondary>multiple deliveries</secondary>
7026 </indexterm>
7027 <indexterm role="concept">
7028 <primary>multiple SMTP deliveries</primary>
7029 </indexterm>
7030 connection because of the hints that were set up during the first queue scan.
7031 This option may be useful for hosts that are connected to the Internet
7032 intermittently.
7033 </para>
7034 </listitem></varlistentry>
7035 <varlistentry>
7036 <term><option>-q[q]i...</option></term>
7037 <listitem>
7038 <para>
7039 <indexterm role="option">
7040 <primary><option>-qi</option></primary>
7041 </indexterm>
7042 <indexterm role="concept">
7043 <primary>queue</primary>
7044 <secondary>initial delivery</secondary>
7045 </indexterm>
7046 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
7047 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
7048 delivery</quote>.) This can be helpful if you are putting messages in the queue using
7049 <option>-odq</option> and want a queue runner just to process the new messages.
7050 </para>
7051 </listitem></varlistentry>
7052 <varlistentry>
7053 <term><option>-q[q][i]f...</option></term>
7054 <listitem>
7055 <para>
7056 <indexterm role="option">
7057 <primary><option>-qf</option></primary>
7058 </indexterm>
7059 <indexterm role="concept">
7060 <primary>queue</primary>
7061 <secondary>forcing delivery</secondary>
7062 </indexterm>
7063 <indexterm role="concept">
7064 <primary>delivery</primary>
7065 <secondary>forcing in queue run</secondary>
7066 </indexterm>
7067 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
7068 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
7069 their retry times are tried.
7070 </para>
7071 </listitem></varlistentry>
7072 <varlistentry>
7073 <term><option>-q[q][i]ff...</option></term>
7074 <listitem>
7075 <para>
7076 <indexterm role="option">
7077 <primary><option>-qff</option></primary>
7078 </indexterm>
7079 <indexterm role="concept">
7080 <primary>frozen messages</primary>
7081 <secondary>forcing delivery</secondary>
7082 </indexterm>
7083 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
7084 frozen or not.
7085 </para>
7086 </listitem></varlistentry>
7087 <varlistentry>
7088 <term><option>-q[q][i][f[f]]l</option></term>
7089 <listitem>
7090 <para>
7091 <indexterm role="option">
7092 <primary><option>-ql</option></primary>
7093 </indexterm>
7094 <indexterm role="concept">
7095 <primary>queue</primary>
7096 <secondary>local deliveries only</secondary>
7097 </indexterm>
7098 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
7099 be done. If a message requires any remote deliveries, it remains in the queue
7100 for later delivery.
7101 </para>
7102 </listitem></varlistentry>
7103 <varlistentry>
7104 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
7105 <listitem>
7106 <para>
7107 <indexterm role="option">
7108 <primary><option>-qG</option></primary>
7109 </indexterm>
7110 <indexterm role="concept">
7111 <primary>queue</primary>
7112 <secondary>named</secondary>
7113 </indexterm>
7114 <indexterm role="concept">
7115 <primary>named queues</primary>
7116 <secondary>deliver from</secondary>
7117 </indexterm>
7118 <indexterm role="concept">
7119 <primary>queue</primary>
7120 <secondary>delivering specific messages</secondary>
7121 </indexterm>
7122 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
7123 queue with the given name rather than the default queue.
7124 The name should not contain a <emphasis>/</emphasis> character.
7125 For a periodic queue run (see below)
7126 append to the name a slash and a time value.
7127 </para>
7128 <para>
7129 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
7130 will specify a queue to operate on.
7131 For example:
7132 </para>
7133 <literallayout class="monospaced">
7134 exim -bp -qGquarantine
7135 mailq -qGquarantine
7136 exim -qGoffpeak -Rf @special.domain.example
7137 </literallayout>
7138 </listitem></varlistentry>
7139 <varlistentry>
7140 <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>
7141 <listitem>
7142 <para>
7143 When scanning the queue, Exim can be made to skip over messages whose ids are
7144 lexically less than a given value by following the <option>-q</option> option with a
7145 starting message id. For example:
7146 </para>
7147 <literallayout class="monospaced">
7148 exim -q 0t5C6f-0000c8-00
7149 </literallayout>
7150 <para>
7151 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
7152 second message id is given, messages whose ids are lexically greater than it
7153 are also skipped. If the same id is given twice, for example,
7154 </para>
7155 <literallayout class="monospaced">
7156 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
7157 </literallayout>
7158 <para>
7159 just one delivery process is started, for that message. This differs from
7160 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
7161 that it counts as a delivery from a queue run. Note that the selection
7162 mechanism does not affect the order in which the messages are scanned. There
7163 are also other ways of selecting specific sets of messages for delivery in a
7164 queue run &ndash; see <option>-R</option> and <option>-S</option>.
7165 </para>
7166 </listitem></varlistentry>
7167 <varlistentry>
7168 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
7169 <listitem>
7170 <para>
7171 <indexterm role="concept">
7172 <primary>queue runner</primary>
7173 <secondary>starting periodically</secondary>
7174 </indexterm>
7175 <indexterm role="concept">
7176 <primary>periodic queue running</primary>
7177 </indexterm>
7178 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
7179 starting a queue runner process at intervals specified by the given time value
7180 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
7181 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
7182 single daemon process handles both functions. A common way of starting up a
7183 combined daemon at system boot time is to use a command such as
7184 </para>
7185 <literallayout class="monospaced">
7186 /usr/exim/bin/exim -bd -q30m
7187 </literallayout>
7188 <para>
7189 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
7190 process every 30 minutes.
7191 </para>
7192 <para>
7193 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
7194 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
7195 </para>
7196 </listitem></varlistentry>
7197 <varlistentry>
7198 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7199 <listitem>
7200 <para>
7201 <indexterm role="option">
7202 <primary><option>-qR</option></primary>
7203 </indexterm>
7204 This option is synonymous with <option>-R</option>. It is provided for Sendmail
7205 compatibility.
7206 </para>
7207 </listitem></varlistentry>
7208 <varlistentry>
7209 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7210 <listitem>
7211 <para>
7212 <indexterm role="option">
7213 <primary><option>-qS</option></primary>
7214 </indexterm>
7215 This option is synonymous with <option>-S</option>.
7216 </para>
7217 </listitem></varlistentry>
7218 <varlistentry>
7219 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7220 <listitem>
7221 <para>
7222 <indexterm role="option">
7223 <primary><option>-R</option></primary>
7224 </indexterm>
7225 <indexterm role="concept">
7226 <primary>queue runner</primary>
7227 <secondary>for specific recipients</secondary>
7228 </indexterm>
7229 <indexterm role="concept">
7230 <primary>delivery</primary>
7231 <secondary>to given domain</secondary>
7232 </indexterm>
7233 <indexterm role="concept">
7234 <primary>domain</primary>
7235 <secondary>delivery to</secondary>
7236 </indexterm>
7237 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7238 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7239 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7240 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7241 </para>
7242 <para>
7243 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7244 perform a single queue run, except that, when scanning the messages on the
7245 queue, Exim processes only those that have at least one undelivered recipient
7246 address containing the given string, which is checked in a case-independent
7247 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7248 regular expression; otherwise it is a literal string.
7249 </para>
7250 <para>
7251 If you want to do periodic queue runs for messages with specific recipients,
7252 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7253 </para>
7254 <literallayout class="monospaced">
7255 exim -q25m -R @special.domain.example
7256 </literallayout>
7257 <para>
7258 This example does a queue run for messages with recipients in the given domain
7259 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7260 applied to each queue run.
7261 </para>
7262 <para>
7263 Once a message is selected for delivery by this mechanism, all its addresses
7264 are processed. For the first selected message, Exim overrides any retry
7265 information and forces a delivery attempt for each undelivered address. This
7266 means that if delivery of any address in the first message is successful, any
7267 existing retry information is deleted, and so delivery attempts for that
7268 address in subsequently selected messages (which are processed without forcing)
7269 will run. However, if delivery of any address does not succeed, the retry
7270 information is updated, and in subsequently selected messages, the failing
7271 address will be skipped.
7272 </para>
7273 <para>
7274 <indexterm role="concept">
7275 <primary>frozen messages</primary>
7276 <secondary>forcing delivery</secondary>
7277 </indexterm>
7278 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7279 all selected messages, not just the first; frozen messages are included when
7280 <emphasis>ff</emphasis> is present.
7281 </para>
7282 <para>
7283 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7284 to a given domain after a host has been down for some time. When the SMTP
7285 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7286 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7287 an arbitrary command instead.
7288 </para>
7289 </listitem></varlistentry>
7290 <varlistentry>
7291 <term><option>-r</option></term>
7292 <listitem>
7293 <para>
7294 <indexterm role="option">
7295 <primary><option>-r</option></primary>
7296 </indexterm>
7297 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7298 </para>
7299 </listitem></varlistentry>
7300 <varlistentry>
7301 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7302 <listitem>
7303 <para>
7304 <indexterm role="option">
7305 <primary><option>-S</option></primary>
7306 </indexterm>
7307 <indexterm role="concept">
7308 <primary>delivery</primary>
7309 <secondary>from given sender</secondary>
7310 </indexterm>
7311 <indexterm role="concept">
7312 <primary>queue runner</primary>
7313 <secondary>for specific senders</secondary>
7314 </indexterm>
7315 This option acts like <option>-R</option> except that it checks the string against each
7316 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7317 conditions must be met for a message to be selected. If either of the options
7318 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7319 </para>
7320 </listitem></varlistentry>
7321 <varlistentry>
7322 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7323 <listitem>
7324 <para>
7325 <indexterm role="option">
7326 <primary><option>-Tqt</option></primary>
7327 </indexterm>
7328 This is an option that is exclusively for use by the Exim testing suite. It is not
7329 recognized when Exim is run normally. It allows for the setting up of explicit
7330 <quote>queue times</quote> so that various warning/retry features can be tested.
7331 </para>
7332 </listitem></varlistentry>
7333 <varlistentry>
7334 <term><option>-t</option></term>
7335 <listitem>
7336 <para>
7337 <indexterm role="option">
7338 <primary><option>-t</option></primary>
7339 </indexterm>
7340 <indexterm role="concept">
7341 <primary>recipient</primary>
7342 <secondary>extracting from header lines</secondary>
7343 </indexterm>
7344 <indexterm role="concept">
7345 <primary><emphasis>Bcc:</emphasis> header line</primary>
7346 </indexterm>
7347 <indexterm role="concept">
7348 <primary><emphasis>Cc:</emphasis> header line</primary>
7349 </indexterm>
7350 <indexterm role="concept">
7351 <primary><emphasis>To:</emphasis> header line</primary>
7352 </indexterm>
7353 When Exim is receiving a locally-generated, non-SMTP message on its standard
7354 input, the <option>-t</option> option causes the recipients of the message to be obtained
7355 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7356 from the command arguments. The addresses are extracted before any rewriting
7357 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7358 </para>
7359 <para>
7360 <indexterm role="concept">
7361 <primary>Sendmail compatibility</primary>
7362 <secondary><option>-t</option> option</secondary>
7363 </indexterm>
7364 If the command has any arguments, they specify addresses to which the message
7365 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7366 the recipients list obtained from the headers. This is compatible with Smail 3
7367 and in accordance with the documented behaviour of several versions of
7368 Sendmail, as described in man pages on a number of operating systems (e.g.
7369 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7370 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7371 Sendmail book documents it that way. Exim can be made to add argument addresses
7372 instead of subtracting them by setting the option
7373 <option>extract_addresses_remove_arguments</option> false.
7374 </para>
7375 <para>
7376 <indexterm role="concept">
7377 <primary><option>Resent-</option> header lines</primary>
7378 <secondary>with <option>-t</option></secondary>
7379 </indexterm>
7380 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7381 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7382 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7383 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7384 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7385 </para>
7386 <para>
7387 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7388 message is resent several times). The RFC also specifies that they should be
7389 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7390 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7391 nor indeed exactly what constitutes a <quote>set</quote>.
7392 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7393 are often added at the end of the header, and if a message is resent more than
7394 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7395 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7396 </para>
7397 </listitem></varlistentry>
7398 <varlistentry>
7399 <term><option>-ti</option></term>
7400 <listitem>
7401 <para>
7402 <indexterm role="option">
7403 <primary><option>-ti</option></primary>
7404 </indexterm>
7405 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7406 compatibility with Sendmail.
7407 </para>
7408 </listitem></varlistentry>
7409 <varlistentry>
7410 <term><option>-tls-on-connect</option></term>
7411 <listitem>
7412 <para>
7413 <indexterm role="option">
7414 <primary><option>-tls-on-connect</option></primary>
7415 </indexterm>
7416 <indexterm role="concept">
7417 <primary>TLS</primary>
7418 <secondary>use without STARTTLS</secondary>
7419 </indexterm>
7420 <indexterm role="concept">
7421 <primary>TLS</primary>
7422 <secondary>automatic start</secondary>
7423 </indexterm>
7424 This option is available when Exim is compiled with TLS support. It forces all
7425 incoming SMTP connections to behave as if the incoming port is listed in the
7426 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7427 <xref linkend="CHAPTLS"/> for further details.
7428 </para>
7429 </listitem></varlistentry>
7430 <varlistentry>
7431 <term><option>-U</option></term>
7432 <listitem>
7433 <para>
7434 <indexterm role="option">
7435 <primary><option>-U</option></primary>
7436 </indexterm>
7437 <indexterm role="concept">
7438 <primary>Sendmail compatibility</primary>
7439 <secondary><option>-U</option> option ignored</secondary>
7440 </indexterm>
7441 Sendmail uses this option for <quote>initial message submission</quote>, and its
7442 documentation states that in future releases, it may complain about
7443 syntactically invalid messages rather than fixing them when this flag is not
7444 set. Exim ignores this option.
7445 </para>
7446 </listitem></varlistentry>
7447 <varlistentry>
7448 <term><option>-v</option></term>
7449 <listitem>
7450 <para>
7451 <indexterm role="option">
7452 <primary><option>-v</option></primary>
7453 </indexterm>
7454 This option causes Exim to write information to the standard error stream,
7455 describing what it is doing. In particular, it shows the log lines for
7456 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7457 dialogue is shown. Some of the log lines shown may not actually be written to
7458 the log if the setting of <option>log_selector</option> discards them. Any relevant
7459 selectors are shown with each log line. If none are shown, the logging is
7460 unconditional.
7461 </para>
7462 </listitem></varlistentry>
7463 <varlistentry>
7464 <term><option>-x</option></term>
7465 <listitem>
7466 <para>
7467 <indexterm role="option">
7468 <primary><option>-x</option></primary>
7469 </indexterm>
7470 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7471 National Language Support extended characters in the body of the mail item</quote>).
7472 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7473 this option.
7474 </para>
7475 </listitem></varlistentry>
7476 <varlistentry>
7477 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7478 <listitem>
7479 <para>
7480 <indexterm role="option">
7481 <primary><option>-X</option></primary>
7482 </indexterm>
7483 This option is interpreted by Sendmail to cause debug information to be sent
7484 to the named file.  It is ignored by Exim.
7485 </para>
7486 </listitem></varlistentry>
7487 <varlistentry>
7488 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7489 <listitem>
7490 <para>
7491 <indexterm role="option">
7492 <primary><option>-z</option></primary>
7493 </indexterm>
7494 This option writes its argument to Exim&#x2019;s logfile.
7495 Use is restricted to administrators; the intent is for operational notes.
7496 Quotes should be used to maintain a multi-word item as a single argument,
7497 under most shells.
7498 </para>
7499 </listitem></varlistentry>
7500 </variablelist>
7501 <para>
7502 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7503 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7504 </para>
7505 <!-- === End of command line options === -->
7506 </section>
7507 </chapter>
7508
7509 <chapter id="CHAPconf">
7510 <title>The Exim runtime configuration file</title>
7511 <titleabbrev>The runtime configuration file</titleabbrev>
7512 <para>
7513 <indexterm role="concept">
7514 <primary>runtime configuration</primary>
7515 </indexterm>
7516 <indexterm role="concept">
7517 <primary>configuration file</primary>
7518 <secondary>general description</secondary>
7519 </indexterm>
7520 <indexterm role="concept">
7521 <primary>CONFIGURE_FILE</primary>
7522 </indexterm>
7523 <indexterm role="concept">
7524 <primary>configuration file</primary>
7525 <secondary>errors in</secondary>
7526 </indexterm>
7527 <indexterm role="concept">
7528 <primary>error</primary>
7529 <secondary>in configuration file</secondary>
7530 </indexterm>
7531 <indexterm role="concept">
7532 <primary>return code</primary>
7533 <secondary>for bad configuration</secondary>
7534 </indexterm>
7535 Exim uses a single runtime configuration file that is read whenever an Exim
7536 binary is executed. Note that in normal operation, this happens frequently,
7537 because Exim is designed to operate in a distributed manner, without central
7538 control.
7539 </para>
7540 <para>
7541 If a syntax error is detected while reading the configuration file, Exim
7542 writes a message on the standard error, and exits with a non-zero return code.
7543 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7544 errors can be detected at this time. The values of any expanded options are
7545 not checked until the expansion happens, even when the expansion does not
7546 actually alter the string.
7547 </para>
7548 <para>
7549 The name of the configuration file is compiled into the binary for security
7550 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7551 most configurations, this specifies a single file. However, it is permitted to
7552 give a colon-separated list of filenames, in which case Exim uses the first
7553 existing file in the list.
7554 </para>
7555 <para>
7556 <indexterm role="concept">
7557 <primary>EXIM_USER</primary>
7558 </indexterm>
7559 <indexterm role="concept">
7560 <primary>EXIM_GROUP</primary>
7561 </indexterm>
7562 <indexterm role="concept">
7563 <primary>CONFIGURE_OWNER</primary>
7564 </indexterm>
7565 <indexterm role="concept">
7566 <primary>CONFIGURE_GROUP</primary>
7567 </indexterm>
7568 <indexterm role="concept">
7569 <primary>configuration file</primary>
7570 <secondary>ownership</secondary>
7571 </indexterm>
7572 <indexterm role="concept">
7573 <primary>ownership</primary>
7574 <secondary>configuration file</secondary>
7575 </indexterm>
7576 The runtime configuration file must be owned by root or by the user that is
7577 specified at compile time by the CONFIGURE_OWNER option (if set). The
7578 configuration file must not be world-writeable, or group-writeable unless its
7579 group is the root group or the one specified at compile time by the
7580 CONFIGURE_GROUP option.
7581 </para>
7582 <para>
7583 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7584 to root, anybody who is able to edit the runtime configuration file has an
7585 easy way to run commands as root. If you specify a user or group in the
7586 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7587 who are members of that group will trivially be able to obtain root privileges.
7588 </para>
7589 <para>
7590 Up to Exim version 4.72, the runtime configuration file was also permitted to
7591 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7592 since it offered a simple privilege escalation for any attacker who managed to
7593 compromise the Exim user account.
7594 </para>
7595 <para>
7596 A default configuration file, which will work correctly in simple situations,
7597 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7598 defines just one filename, the installation process copies the default
7599 configuration to a new file of that name if it did not previously exist. If
7600 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7601 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7602 configuration.
7603 </para>
7604 <section id="SECID40">
7605 <title>Using a different configuration file</title>
7606 <para>
7607 <indexterm role="concept">
7608 <primary>configuration file</primary>
7609 <secondary>alternate</secondary>
7610 </indexterm>
7611 A one-off alternate configuration can be specified by the <option>-C</option> command line
7612 option, which may specify a single file or a list of files. However, when
7613 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7614 unless the argument for <option>-C</option> is identical to the built-in value from
7615 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7616 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7617 is useful mainly for checking the syntax of configuration files before
7618 installing them. No owner or group checks are done on a configuration file
7619 specified by <option>-C</option>, if root privilege has been dropped.
7620 </para>
7621 <para>
7622 Even the Exim user is not trusted to specify an arbitrary configuration file
7623 with the <option>-C</option> option to be used with root privileges, unless that file is
7624 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7625 testing a configuration using <option>-C</option> right through message reception and
7626 delivery, even if the caller is root. The reception works, but by that time,
7627 Exim is running as the Exim user, so when it re-execs to regain privilege for
7628 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7629 can test reception and delivery using two separate commands (one to put a
7630 message in the queue, using <option>-odq</option>, and another to do the delivery, using
7631 <option>-M</option>).
7632 </para>
7633 <para>
7634 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7635 prefix string with which any file named in a <option>-C</option> command line option must
7636 start. In addition, the filename must not contain the sequence <quote><literal>/../</literal></quote>.
7637 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any
7638 filename can be used with <option>-C</option>.
7639 </para>
7640 <para>
7641 One-off changes to a configuration can be specified by the <option>-D</option> command line
7642 option, which defines and overrides values for macros used inside the
7643 configuration file. However, like <option>-C</option>, the use of this option by a
7644 non-privileged user causes Exim to discard its root privilege.
7645 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7646 completely disabled, and its use causes an immediate error exit.
7647 </para>
7648 <para>
7649 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7650 to declare certain macro names trusted, such that root privilege will not
7651 necessarily be discarded.
7652 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7653 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7654 values are acceptable, then Exim will not give up root privilege if the caller
7655 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7656 transition mechanism and is expected to be removed in the future.  Acceptable
7657 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7658 </para>
7659 <para>
7660 Some sites may wish to use the same Exim binary on different machines that
7661 share a file system, but to use different configuration files on each machine.
7662 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7663 looks for a file whose name is the configuration filename followed by a dot
7664 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7665 file does not exist, the standard name is tried. This processing occurs for
7666 each filename in the list given by CONFIGURE_FILE or <option>-C</option>.
7667 </para>
7668 <para>
7669 In some esoteric situations different versions of Exim may be run under
7670 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7671 help with this. See the comments in <filename>src/EDITME</filename> for details.
7672 </para>
7673 </section>
7674 <section id="SECTconffilfor">
7675 <title>Configuration file format</title>
7676 <para>
7677 <indexterm role="concept">
7678 <primary>configuration file</primary>
7679 <secondary>format of</secondary>
7680 </indexterm>
7681 <indexterm role="concept">
7682 <primary>format</primary>
7683 <secondary>configuration file</secondary>
7684 </indexterm>
7685 Exim&#x2019;s configuration file is divided into a number of different parts. General
7686 option settings must always appear at the start of the file. The other parts
7687 are all optional, and may appear in any order. Each part other than the first
7688 is introduced by the word <quote>begin</quote> followed by at least one literal
7689 space, and the name of the part. The optional parts are:
7690 </para>
7691 <itemizedlist>
7692 <listitem>
7693 <para>
7694 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7695 <xref linkend="CHAPACL"/>).
7696 </para>
7697 </listitem>
7698 <listitem>
7699 <para>
7700 <indexterm role="concept">
7701 <primary>AUTH</primary>
7702 <secondary>configuration</secondary>
7703 </indexterm>
7704 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7705 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7706 </para>
7707 </listitem>
7708 <listitem>
7709 <para>
7710 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7711 addresses and determine how the message is to be delivered (see chapters
7712 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7713 </para>
7714 </listitem>
7715 <listitem>
7716 <para>
7717 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7718 define mechanisms for copying messages to destinations (see chapters
7719 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
7720 </para>
7721 </listitem>
7722 <listitem>
7723 <para>
7724 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7725 If there is no retry section, or if it is empty (that is, no retry rules are
7726 defined), Exim will not retry deliveries. In this situation, temporary errors
7727 are treated the same as permanent errors. Retry rules are discussed in chapter
7728 <xref linkend="CHAPretry"/>.
7729 </para>
7730 </listitem>
7731 <listitem>
7732 <para>
7733 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7734 when new addresses are generated during delivery. Rewriting is discussed in
7735 chapter <xref linkend="CHAPrewrite"/>.
7736 </para>
7737 </listitem>
7738 <listitem>
7739 <para>
7740 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7741 want to use this feature, you must set
7742 </para>
7743 <literallayout class="monospaced">
7744 LOCAL_SCAN_HAS_OPTIONS=yes
7745 </literallayout>
7746 <para>
7747 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7748 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7749 </para>
7750 </listitem>
7751 </itemizedlist>
7752 <para>
7753 <indexterm role="concept">
7754 <primary>configuration file</primary>
7755 <secondary>leading white space in</secondary>
7756 </indexterm>
7757 <indexterm role="concept">
7758 <primary>configuration file</primary>
7759 <secondary>trailing white space in</secondary>
7760 </indexterm>
7761 <indexterm role="concept">
7762 <primary>white space</primary>
7763 <secondary>in configuration file</secondary>
7764 </indexterm>
7765 Leading and trailing white space in configuration lines is always ignored.
7766 </para>
7767 <para>
7768 Blank lines in the file, and lines starting with a # character (ignoring
7769 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7770 # character other than at the beginning of a line is not treated specially,
7771 and does not introduce a comment.
7772 </para>
7773 <para>
7774 Any non-comment line can be continued by ending it with a backslash. Note that
7775 the general rule for white space means that trailing white space after the
7776 backslash and leading white space at the start of continuation
7777 lines is ignored. Comment lines beginning with # (but not empty lines) may
7778 appear in the middle of a sequence of continuation lines.
7779 </para>
7780 <para>
7781 A convenient way to create a configuration file is to start from the
7782 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7783 change settings as required.
7784 </para>
7785 <para>
7786 The ACLs, retry rules, and rewriting rules have their own syntax which is
7787 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7788 respectively. The other parts of the configuration file have some syntactic
7789 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7790 onwards. Before that, the inclusion, macro, and conditional facilities are
7791 described.
7792 </para>
7793 </section>
7794 <section id="SECID41">
7795 <title>File inclusions in the configuration file</title>
7796 <para>
7797 <indexterm role="concept">
7798 <primary>inclusions in configuration file</primary>
7799 </indexterm>
7800 <indexterm role="concept">
7801 <primary>configuration file</primary>
7802 <secondary>including other files</secondary>
7803 </indexterm>
7804 <indexterm role="concept">
7805 <primary><literal>.include</literal> in configuration file</primary>
7806 </indexterm>
7807 <indexterm role="concept">
7808 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7809 </indexterm>
7810 You can include other files inside Exim&#x2019;s runtime configuration file by
7811 using this syntax:
7812 </para>
7813 <literallayout>
7814 <literal>.include</literal> &lt;<emphasis>filename</emphasis>&gt;
7815 <literal>.include_if_exists</literal> &lt;<emphasis>filename</emphasis>&gt;
7816 </literallayout>
7817 <para>
7818 on a line by itself. Double quotes round the filename are optional. If you use
7819 the first form, a configuration error occurs if the file does not exist; the
7820 second form does nothing for non-existent files.
7821 The first form allows a relative name. It is resolved relative to
7822 the directory of the including file. For the second form an absolute filename
7823 is required.
7824 </para>
7825 <para>
7826 Includes may be nested to any depth, but remember that Exim reads its
7827 configuration file often, so it is a good idea to keep them to a minimum.
7828 If you change the contents of an included file, you must HUP the daemon,
7829 because an included file is read only when the configuration itself is read.
7830 </para>
7831 <para>
7832 The processing of inclusions happens early, at a physical line level, so, like
7833 comment lines, an inclusion can be used in the middle of an option setting,
7834 for example:
7835 </para>
7836 <literallayout class="monospaced">
7837 hosts_lookup = a.b.c \
7838                .include /some/file
7839 </literallayout>
7840 <para>
7841 Include processing happens after macro processing (see below). Its effect is to
7842 process the lines of the included file as if they occurred inline where the
7843 inclusion appears.
7844 </para>
7845 </section>
7846 <section id="SECTmacrodefs">
7847 <title>Macros in the configuration file</title>
7848 <para>
7849 <indexterm role="concept">
7850 <primary>macro</primary>
7851 <secondary>description of</secondary>
7852 </indexterm>
7853 <indexterm role="concept">
7854 <primary>configuration file</primary>
7855 <secondary>macros</secondary>
7856 </indexterm>
7857 If a line in the main part of the configuration (that is, before the first
7858 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7859 definition, and must be of the form
7860 </para>
7861 <literallayout>
7862 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7863 </literallayout>
7864 <para>
7865 The name must consist of letters, digits, and underscores, and need not all be
7866 in upper case, though that is recommended. The rest of the line, including any
7867 continuations, is the replacement text, and has leading and trailing white
7868 space removed. Quotes are not removed. The replacement text can never end with
7869 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7870 </para>
7871 <para>
7872 Macros may also be defined between router, transport, authenticator, or ACL
7873 definitions. They may not, however, be defined within an individual driver or
7874 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7875 </para>
7876 </section>
7877 <section id="SECID42">
7878 <title>Macro substitution</title>
7879 <para>
7880 Once a macro is defined, all subsequent lines in the file (and any included
7881 files) are scanned for the macro name; if there are several macros, the line is
7882 scanned for each, in turn, in the order in which the macros are defined. The
7883 replacement text is not re-scanned for the current macro, though it is scanned
7884 for subsequently defined macros. For this reason, a macro name may not contain
7885 the name of a previously defined macro as a substring. You could, for example,
7886 define
7887 </para>
7888 <literallayout>
7889 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7890 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7891 </literallayout>
7892 <para>
7893 but putting the definitions in the opposite order would provoke a configuration
7894 error. Macro expansion is applied to individual physical lines from the file,
7895 before checking for line continuation or file inclusion (see above). If a line
7896 consists solely of a macro name, and the expansion of the macro is empty, the
7897 line is ignored. A macro at the start of a line may turn the line into a
7898 comment line or a <literal>.include</literal> line.
7899 </para>
7900 </section>
7901 <section id="SECID43">
7902 <title>Redefining macros</title>
7903 <para>
7904 Once defined, the value of a macro can be redefined later in the configuration
7905 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7906 <emphasis>=</emphasis>. For example:
7907 </para>
7908 <literallayout class="monospaced">
7909 MAC =  initial value
7910 ...
7911 MAC == updated value
7912 </literallayout>
7913 <para>
7914 Redefinition does not alter the order in which the macros are applied to the
7915 subsequent lines of the configuration file. It is still the same order in which
7916 the macros were originally defined. All that changes is the macro&#x2019;s value.
7917 Redefinition makes it possible to accumulate values. For example:
7918 </para>
7919 <literallayout class="monospaced">
7920 MAC =  initial value
7921 ...
7922 MAC == MAC and something added
7923 </literallayout>
7924 <para>
7925 This can be helpful in situations where the configuration file is built
7926 from a number of other files.
7927 </para>
7928 </section>
7929 <section id="SECID44">
7930 <title>Overriding macro values</title>
7931 <para>
7932 The values set for macros in the configuration file can be overridden by the
7933 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7934 used, unless called by root or the Exim user. A definition on the command line
7935 using the <option>-D</option> option causes all definitions and redefinitions within the
7936 file to be ignored.
7937 </para>
7938 </section>
7939 <section id="SECID45">
7940 <title>Example of macro usage</title>
7941 <para>
7942 As an example of macro usage, consider a configuration where aliases are looked
7943 up in a MySQL database. It helps to keep the file less cluttered if long
7944 strings such as SQL statements are defined separately as macros, for example:
7945 </para>
7946 <literallayout class="monospaced">
7947 ALIAS_QUERY = select mailbox from user where \
7948               login='${quote_mysql:$local_part}';
7949 </literallayout>
7950 <para>
7951 This can then be used in a <command>redirect</command> router setting like this:
7952 </para>
7953 <literallayout class="monospaced">
7954 data = ${lookup mysql{ALIAS_QUERY}}
7955 </literallayout>
7956 <para>
7957 In earlier versions of Exim macros were sometimes used for domain, host, or
7958 address lists. In Exim 4 these are handled better by named lists &ndash; see
7959 section <xref linkend="SECTnamedlists"/>.
7960 </para>
7961 </section>
7962 <section id="SECTbuiltinmacros">
7963 <title>Builtin macros</title>
7964 <para>
7965 Exim defines some macros depending on facilities available, which may
7966 differ due to build-time definitions and from one release to another.
7967 All of these macros start with an underscore.
7968 They can be used to conditionally include parts of a configuration
7969 (see below).
7970 </para>
7971 <para>
7972 The following classes of macros are defined:
7973 </para>
7974 <literallayout>
7975 <literal> _HAVE_*                    </literal>  build-time defines
7976 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
7977 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
7978 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
7979 <literal> _LOG_*                     </literal>  log_selector values
7980 <literal> _OPT_MAIN_*                </literal>  main config options
7981 <literal> _OPT_ROUTERS_*             </literal>  generic router options
7982 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
7983 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
7984 <literal> _OPT_ROUTER_*_*            </literal>  private router options
7985 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
7986 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
7987 </literallayout>
7988 <para>
7989 Use an <quote>exim -bP macros</quote> command to get the list of macros.
7990 </para>
7991 </section>
7992 <section id="SECID46">
7993 <title>Conditional skips in the configuration file</title>
7994 <para>
7995 <indexterm role="concept">
7996 <primary>configuration file</primary>
7997 <secondary>conditional skips</secondary>
7998 </indexterm>
7999 <indexterm role="concept">
8000 <primary><literal>.ifdef</literal></primary>
8001 </indexterm>
8002 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
8003 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
8004 portions of the configuration file. The processing happens whenever the file is
8005 read (that is, when an Exim binary starts to run).
8006 </para>
8007 <para>
8008 The implementation is very simple. Instances of the first four directives must
8009 be followed by text that includes the names of one or macros. The condition
8010 that is tested is whether or not any macro substitution has taken place in the
8011 line. Thus:
8012 </para>
8013 <literallayout class="monospaced">
8014 .ifdef AAA
8015 message_size_limit = 50M
8016 .else
8017 message_size_limit = 100M
8018 .endif
8019 </literallayout>
8020 <para>
8021 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
8022 (or <literal>A</literal> or <literal>AA</literal>), and 100M
8023 otherwise. If there is more than one macro named on the line, the condition
8024 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
8025 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
8026 </para>
8027 <para>
8028 Although you can use a macro expansion to generate one of these directives,
8029 it is not very useful, because the condition <quote>there was a macro substitution
8030 in this line</quote> will always be true.
8031 </para>
8032 <para>
8033 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
8034 to clarify complicated nestings.
8035 </para>
8036 </section>
8037 <section id="SECTcos">
8038 <title>Common option syntax</title>
8039 <para>
8040 <indexterm role="concept">
8041 <primary>common option syntax</primary>
8042 </indexterm>
8043 <indexterm role="concept">
8044 <primary>syntax of common options</primary>
8045 </indexterm>
8046 <indexterm role="concept">
8047 <primary>configuration file</primary>
8048 <secondary>common option syntax</secondary>
8049 </indexterm>
8050 For the main set of options, driver options, and <function>local_scan()</function> options,
8051 each setting is on a line by itself, and starts with a name consisting of
8052 lower-case letters and underscores. Many options require a data value, and in
8053 these cases the name must be followed by an equals sign (with optional white
8054 space) and then the value. For example:
8055 </para>
8056 <literallayout class="monospaced">
8057 qualify_domain = mydomain.example.com
8058 </literallayout>
8059 <para>
8060 <indexterm role="concept">
8061 <primary>hiding configuration option values</primary>
8062 </indexterm>
8063 <indexterm role="concept">
8064 <primary>configuration options</primary>
8065 <secondary>hiding value of</secondary>
8066 </indexterm>
8067 <indexterm role="concept">
8068 <primary>options</primary>
8069 <secondary>hiding value of</secondary>
8070 </indexterm>
8071 Some option settings may contain sensitive data, for example, passwords for
8072 accessing databases. To stop non-admin users from using the <option>-bP</option> command
8073 line option to read these values, you can precede the option settings with the
8074 word <quote>hide</quote>. For example:
8075 </para>
8076 <literallayout class="monospaced">
8077 hide mysql_servers = localhost/users/admin/secret-password
8078 </literallayout>
8079 <para>
8080 For non-admin users, such options are displayed like this:
8081 </para>
8082 <literallayout class="monospaced">
8083 mysql_servers = &lt;value not displayable&gt;
8084 </literallayout>
8085 <para>
8086 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
8087 all instances of the same driver.
8088 </para>
8089 <para>
8090 The following sections describe the syntax used for the different data types
8091 that are found in option settings.
8092 </para>
8093 </section>
8094 <section id="SECID47">
8095 <title>Boolean options</title>
8096 <para>
8097 <indexterm role="concept">
8098 <primary>format</primary>
8099 <secondary>boolean</secondary>
8100 </indexterm>
8101 <indexterm role="concept">
8102 <primary>boolean configuration values</primary>
8103 </indexterm>
8104 <indexterm role="option">
8105 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
8106 </indexterm>
8107 <indexterm role="option">
8108 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
8109 </indexterm>
8110 Options whose type is given as boolean are on/off switches. There are two
8111 different ways of specifying such options: with and without a data value. If
8112 the option name is specified on its own without data, the switch is turned on;
8113 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
8114 boolean options may be followed by an equals sign and one of the words
8115 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
8116 the following two settings have exactly the same effect:
8117 </para>
8118 <literallayout class="monospaced">
8119 queue_only
8120 queue_only = true
8121 </literallayout>
8122 <para>
8123 The following two lines also have the same (opposite) effect:
8124 </para>
8125 <literallayout class="monospaced">
8126 no_queue_only
8127 queue_only = false
8128 </literallayout>
8129 <para>
8130 You can use whichever syntax you prefer.
8131 </para>
8132 </section>
8133 <section id="SECID48">
8134 <title>Integer values</title>
8135 <para>
8136 <indexterm role="concept">
8137 <primary>integer configuration values</primary>
8138 </indexterm>
8139 <indexterm role="concept">
8140 <primary>format</primary>
8141 <secondary>integer</secondary>
8142 </indexterm>
8143 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
8144 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
8145 number is assumed. Otherwise, it is treated as an octal number unless it starts
8146 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
8147 hexadecimal number.
8148 </para>
8149 <para>
8150 If an integer value is followed by the letter K, it is multiplied by 1024; if
8151 it is followed by the letter M, it is multiplied by 1024x1024;
8152 if by the letter G, 1024x1024x1024.
8153 When the values
8154 of integer option settings are output, values which are an exact multiple of
8155 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
8156 and M. The printing style is independent of the actual input format that was
8157 used.
8158 </para>
8159 </section>
8160 <section id="SECID49">
8161 <title>Octal integer values</title>
8162 <para>
8163 <indexterm role="concept">
8164 <primary>integer format</primary>
8165 </indexterm>
8166 <indexterm role="concept">
8167 <primary>format</primary>
8168 <secondary>octal integer</secondary>
8169 </indexterm>
8170 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
8171 interpreted as an octal number, whether or not it starts with the digit zero.
8172 Such options are always output in octal.
8173 </para>
8174 </section>
8175 <section id="SECID50">
8176 <title>Fixed point numbers</title>
8177 <para>
8178 <indexterm role="concept">
8179 <primary>fixed point configuration values</primary>
8180 </indexterm>
8181 <indexterm role="concept">
8182 <primary>format</primary>
8183 <secondary>fixed point</secondary>
8184 </indexterm>
8185 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
8186 integer, optionally followed by a decimal point and up to three further digits.
8187 </para>
8188 </section>
8189 <section id="SECTtimeformat">
8190 <title>Time intervals</title>
8191 <para>
8192 <indexterm role="concept">
8193 <primary>time interval</primary>
8194 <secondary>specifying in configuration</secondary>
8195 </indexterm>
8196 <indexterm role="concept">
8197 <primary>format</primary>
8198 <secondary>time interval</secondary>
8199 </indexterm>
8200 A time interval is specified as a sequence of numbers, each followed by one of
8201 the following letters, with no intervening white space:
8202 </para>
8203 <informaltable frame="none">
8204 <tgroup cols="2" colsep="0" rowsep="0">
8205 <colspec colwidth="30pt" align="left"/>
8206 <colspec colwidth="254pt" align="left"/>
8207 <tbody>
8208 <row>
8209 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
8210 <entry>seconds</entry>
8211 </row>
8212 <row>
8213 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8214 <entry>minutes</entry>
8215 </row>
8216 <row>
8217 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8218 <entry>hours</entry>
8219 </row>
8220 <row>
8221 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8222 <entry>days</entry>
8223 </row>
8224 <row>
8225 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8226 <entry>weeks</entry>
8227 </row>
8228 </tbody>
8229 </tgroup>
8230 </informaltable>
8231 <para>
8232 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8233 intervals are output in the same format. Exim does not restrict the values; it
8234 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8235 </para>
8236 </section>
8237 <section id="SECTstrings">
8238 <title>String values</title>
8239 <para>
8240 <indexterm role="concept">
8241 <primary>string</primary>
8242 <secondary>format of configuration values</secondary>
8243 </indexterm>
8244 <indexterm role="concept">
8245 <primary>format</primary>
8246 <secondary>string</secondary>
8247 </indexterm>
8248 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8249 or without double-quotes. If it does not start with a double-quote, the value
8250 consists of the remainder of the line plus any continuation lines, starting at
8251 the first character after any leading white space, with trailing white space
8252 removed, and with no interpretation of the characters in the string. Because
8253 Exim removes comment lines (those beginning with #) at an early stage, they can
8254 appear in the middle of a multi-line string. The following two settings are
8255 therefore equivalent:
8256 </para>
8257 <literallayout class="monospaced">
8258 trusted_users = uucp:mail
8259 trusted_users = uucp:\
8260                 # This comment line is ignored
8261                 mail
8262 </literallayout>
8263 <para>
8264 <indexterm role="concept">
8265 <primary>string</primary>
8266 <secondary>quoted</secondary>
8267 </indexterm>
8268 <indexterm role="concept">
8269 <primary>escape characters in quoted strings</primary>
8270 </indexterm>
8271 If a string does start with a double-quote, it must end with a closing
8272 double-quote, and any backslash characters other than those used for line
8273 continuation are interpreted as escape characters, as follows:
8274 </para>
8275 <informaltable frame="none">
8276 <tgroup cols="2" colsep="0" rowsep="0">
8277 <colspec colwidth="100pt" align="left"/>
8278 <colspec colwidth="254pt" align="left"/>
8279 <tbody>
8280 <row>
8281 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8282 <entry>single backslash</entry>
8283 </row>
8284 <row>
8285 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8286 <entry>newline</entry>
8287 </row>
8288 <row>
8289 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8290 <entry>carriage return</entry>
8291 </row>
8292 <row>
8293 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8294 <entry>tab</entry>
8295 </row>
8296 <row>
8297 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8298 <entry>up to 3 octal digits specify one character</entry>
8299 </row>
8300 <row>
8301 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8302 <entry>up to 2 hexadecimal digits specify one character</entry>
8303 </row>
8304 </tbody>
8305 </tgroup>
8306 </informaltable>
8307 <para>
8308 If a backslash is followed by some other character, including a double-quote
8309 character, that character replaces the pair.
8310 </para>
8311 <para>
8312 Quoting is necessary only if you want to make use of the backslash escapes to
8313 insert special characters, or if you need to specify a value with leading or
8314 trailing spaces. These cases are rare, so quoting is almost never needed in
8315 current versions of Exim. In versions of Exim before 3.14, quoting was required
8316 in order to continue lines, so you may come across older configuration files
8317 and examples that apparently quote unnecessarily.
8318 </para>
8319 </section>
8320 <section id="SECID51">
8321 <title>Expanded strings</title>
8322 <para>
8323 <indexterm role="concept">
8324 <primary>expansion</primary>
8325 <secondary>definition of</secondary>
8326 </indexterm>
8327 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8328 by which means various parts of the string may be changed according to the
8329 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8330 is as just described; in particular, the handling of backslashes in quoted
8331 strings is done as part of the input process, before expansion takes place.
8332 However, backslash is also an escape character for the expander, so any
8333 backslashes that are required for that reason must be doubled if they are
8334 within a quoted configuration string.
8335 </para>
8336 </section>
8337 <section id="SECID52">
8338 <title>User and group names</title>
8339 <para>
8340 <indexterm role="concept">
8341 <primary>user name</primary>
8342 <secondary>format of</secondary>
8343 </indexterm>
8344 <indexterm role="concept">
8345 <primary>format</primary>
8346 <secondary>user name</secondary>
8347 </indexterm>
8348 <indexterm role="concept">
8349 <primary>groups</primary>
8350 <secondary>name format</secondary>
8351 </indexterm>
8352 <indexterm role="concept">
8353 <primary>format</primary>
8354 <secondary>group name</secondary>
8355 </indexterm>
8356 User and group names are specified as strings, using the syntax described
8357 above, but the strings are interpreted specially. A user or group name must
8358 either consist entirely of digits, or be a name that can be looked up using the
8359 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8360 </para>
8361 </section>
8362 <section id="SECTlistconstruct">
8363 <title>List construction</title>
8364 <para>
8365 <indexterm role="concept">
8366 <primary>list</primary>
8367 <secondary>syntax of in configuration</secondary>
8368 </indexterm>
8369 <indexterm role="concept">
8370 <primary>format</primary>
8371 <secondary>list item in configuration</secondary>
8372 </indexterm>
8373 <indexterm role="concept">
8374 <primary>string</primary>
8375 <secondary>list, definition of</secondary>
8376 </indexterm>
8377 The data for some configuration options is a list of items, with colon as the
8378 default separator. Many of these options are shown with type <quote>string list</quote> in
8379 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8380 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8381 are all the same; however, those other than <quote>string list</quote> are subject to
8382 particular kinds of interpretation, as described in chapter
8383 <xref linkend="CHAPdomhosaddlists"/>.
8384 </para>
8385 <para>
8386 In all these cases, the entire list is treated as a single string as far as the
8387 input syntax is concerned. The <option>trusted_users</option> setting in section
8388 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8389 in a list, it must be entered as two colons. Leading and trailing white space
8390 on each item in a list is ignored. This makes it possible to include items that
8391 start with a colon, and in particular, certain forms of IPv6 address. For
8392 example, the list
8393 </para>
8394 <literallayout class="monospaced">
8395 local_interfaces = 127.0.0.1 : ::::1
8396 </literallayout>
8397 <para>
8398 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8399 </para>
8400 <para>
8401 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8402 list items, it is not ignored when parsing the list. The space after the first
8403 colon in the example above is necessary. If it were not there, the list would
8404 be interpreted as the two items 127.0.0.1:: and 1.
8405 </para>
8406 </section>
8407 <section id="SECTlistsepchange">
8408 <title>Changing list separators</title>
8409 <para>
8410 <indexterm role="concept">
8411 <primary>list separator</primary>
8412 <secondary>changing</secondary>
8413 </indexterm>
8414 <indexterm role="concept">
8415 <primary>IPv6</primary>
8416 <secondary>addresses in lists</secondary>
8417 </indexterm>
8418 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8419 introduced to allow the separator character to be changed. If a list begins
8420 with a left angle bracket, followed by any punctuation character, that
8421 character is used instead of colon as the list separator. For example, the list
8422 above can be rewritten to use a semicolon separator like this:
8423 </para>
8424 <literallayout class="monospaced">
8425 local_interfaces = &lt;; 127.0.0.1 ; ::1
8426 </literallayout>
8427 <para>
8428 This facility applies to all lists, with the exception of the list in
8429 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8430 confined to circumstances where they really are needed.
8431 </para>
8432 <para>
8433 <indexterm role="concept">
8434 <primary>list separator</primary>
8435 <secondary>newline as</secondary>
8436 </indexterm>
8437 <indexterm role="concept">
8438 <primary>newline</primary>
8439 <secondary>as list separator</secondary>
8440 </indexterm>
8441 It is also possible to use newline and other control characters (those with
8442 code values less than 32, plus DEL) as separators in lists. Such separators
8443 must be provided literally at the time the list is processed. For options that
8444 are string-expanded, you can write the separator using a normal escape
8445 sequence. This will be processed by the expander before the string is
8446 interpreted as a list. For example, if a newline-separated list of domains is
8447 generated by a lookup, you can process it directly by a line such as this:
8448 </para>
8449 <literallayout class="monospaced">
8450 domains = &lt;\n ${lookup mysql{.....}}
8451 </literallayout>
8452 <para>
8453 This avoids having to change the list separator in such data. You are unlikely
8454 to want to use a control character as a separator in an option that is not
8455 expanded, because the value is literal text. However, it can be done by giving
8456 the value in quotes. For example:
8457 </para>
8458 <literallayout class="monospaced">
8459 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8460 </literallayout>
8461 <para>
8462 Unlike printing character separators, which can be included in list items by
8463 doubling, it is not possible to include a control character as data when it is
8464 set as the separator. Two such characters in succession are interpreted as
8465 enclosing an empty list item.
8466 </para>
8467 </section>
8468 <section id="SECTempitelis">
8469 <title>Empty items in lists</title>
8470 <para>
8471 <indexterm role="concept">
8472 <primary>list</primary>
8473 <secondary>empty item in</secondary>
8474 </indexterm>
8475 An empty item at the end of a list is always ignored. In other words, trailing
8476 separator characters are ignored. Thus, the list in
8477 </para>
8478 <literallayout class="monospaced">
8479 senders = user@domain :
8480 </literallayout>
8481 <para>
8482 contains only a single item. If you want to include an empty string as one item
8483 in a list, it must not be the last item. For example, this list contains three
8484 items, the second of which is empty:
8485 </para>
8486 <literallayout class="monospaced">
8487 senders = user1@domain : : user2@domain
8488 </literallayout>
8489 <para>
8490 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8491 are interpreted as representing a single colon data character (and the list
8492 would then contain just one item). If you want to specify a list that contains
8493 just one, empty item, you can do it as in this example:
8494 </para>
8495 <literallayout class="monospaced">
8496 senders = :
8497 </literallayout>
8498 <para>
8499 In this case, the first item is empty, and the second is discarded because it
8500 is at the end of the list.
8501 </para>
8502 </section>
8503 <section id="SECTfordricon">
8504 <title>Format of driver configurations</title>
8505 <para>
8506 <indexterm role="concept">
8507 <primary>drivers</primary>
8508 <secondary>configuration format</secondary>
8509 </indexterm>
8510 There are separate parts in the configuration for defining routers, transports,
8511 and authenticators. In each part, you are defining a number of driver
8512 instances, each with its own set of options. Each driver instance is defined by
8513 a sequence of lines like this:
8514 </para>
8515 <literallayout>
8516 &lt;<emphasis>instance name</emphasis>&gt;:
8517   &lt;<emphasis>option</emphasis>&gt;
8518   ...
8519   &lt;<emphasis>option</emphasis>&gt;
8520 </literallayout>
8521 <para>
8522 In the following example, the instance name is <command>localuser</command>, and it is
8523 followed by three options settings:
8524 </para>
8525 <literallayout class="monospaced">
8526 localuser:
8527   driver = accept
8528   check_local_user
8529   transport = local_delivery
8530 </literallayout>
8531 <para>
8532 For each driver instance, you specify which Exim code module it uses &ndash; by the
8533 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8534 settings. For example, in the case of transports, if you want a transport to
8535 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8536 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8537 described in detail in its own separate chapter later in this manual.
8538 </para>
8539 <para>
8540 You can have several routers, transports, or authenticators that are based on
8541 the same underlying driver (each must have a different instance name).
8542 </para>
8543 <para>
8544 The order in which routers are defined is important, because addresses are
8545 passed to individual routers one by one, in order. The order in which
8546 transports are defined does not matter at all. The order in which
8547 authenticators are defined is used only when Exim, as a client, is searching
8548 them to find one that matches an authentication mechanism offered by the
8549 server.
8550 </para>
8551 <para>
8552 <indexterm role="concept">
8553 <primary>generic options</primary>
8554 </indexterm>
8555 <indexterm role="concept">
8556 <primary>options</primary>
8557 <secondary>generic &ndash; definition of</secondary>
8558 </indexterm>
8559 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8560 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8561 same type (that is, all routers, all transports or all authenticators). The
8562 <option>driver</option> option is a generic option that must appear in every definition.
8563 <indexterm role="concept">
8564 <primary>private options</primary>
8565 </indexterm>
8566 The private options are special for each driver, and none need appear, because
8567 they all have default values.
8568 </para>
8569 <para>
8570 The options may appear in any order, except that the <option>driver</option> option must
8571 precede any private options, since these depend on the particular driver. For
8572 this reason, it is recommended that <option>driver</option> always be the first option.
8573 </para>
8574 <para>
8575 Driver instance names, which are used for reference in log entries and
8576 elsewhere, can be any sequence of letters, digits, and underscores (starting
8577 with a letter) and must be unique among drivers of the same type. A router and
8578 a transport (for example) can each have the same name, but no two router
8579 instances can have the same name. The name of a driver instance should not be
8580 confused with the name of the underlying driver module. For example, the
8581 configuration lines:
8582 </para>
8583 <literallayout class="monospaced">
8584 remote_smtp:
8585   driver = smtp
8586 </literallayout>
8587 <para>
8588 create an instance of the <command>smtp</command> transport driver whose name is
8589 <command>remote_smtp</command>. The same driver code can be used more than once, with
8590 different instance names and different option settings each time. A second
8591 instance of the <command>smtp</command> transport, with different options, might be defined
8592 thus:
8593 </para>
8594 <literallayout class="monospaced">
8595 special_smtp:
8596   driver = smtp
8597   port = 1234
8598   command_timeout = 10s
8599 </literallayout>
8600 <para>
8601 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8602 these transport instances from routers, and these names would appear in log
8603 lines.
8604 </para>
8605 <para>
8606 Comment lines may be present in the middle of driver specifications. The full
8607 list of option settings for any particular driver instance, including all the
8608 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8609 option.
8610 </para>
8611 </section>
8612 </chapter>
8613
8614 <chapter id="CHAPdefconfil">
8615 <title>The default configuration file</title>
8616 <para>
8617 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8618 <primary>configuration file</primary>
8619 <secondary>default <quote>walk through</quote></secondary>
8620 </indexterm>
8621 <indexterm role="concept">
8622 <primary>default</primary>
8623 <secondary>configuration file <quote>walk through</quote></secondary>
8624 </indexterm>
8625 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8626 is sufficient for a host with simple mail requirements. As an introduction to
8627 the way Exim is configured, this chapter <quote>walks through</quote> the default
8628 configuration, giving brief explanations of the settings. Detailed descriptions
8629 of the options are given in subsequent chapters. The default configuration file
8630 itself contains extensive comments about ways you might want to modify the
8631 initial settings. However, note that there are many options that are not
8632 mentioned at all in the default configuration.
8633 </para>
8634 <section id="SECTdefconfmacros">
8635 <title>Macros</title>
8636 <para>
8637 All macros should be defined before any options.
8638 </para>
8639 <para>
8640 One macro is specified, but commented out, in the default configuration:
8641 </para>
8642 <literallayout class="monospaced">
8643 # ROUTER_SMARTHOST=MAIL.HOSTNAME.FOR.CENTRAL.SERVER.EXAMPLE
8644 </literallayout>
8645 <para>
8646 If all off-site mail is expected to be delivered to a "smarthost", then set the
8647 hostname here and uncomment the macro.  This will affect which router is used
8648 later on.  If this is left commented out, then Exim will perform direct-to-MX
8649 deliveries using a <command>dnslookup</command> router.
8650 </para>
8651 <para>
8652 In addition to macros defined here, Exim includes a number of built-in macros
8653 to enable configuration to be guarded by a binary built with support for a
8654 given feature.  See section <xref linkend="SECTbuiltinmacros"/> for more details.
8655 </para>
8656 </section>
8657 <section id="SECTdefconfmain">
8658 <title>Main configuration settings</title>
8659 <para>
8660 The main (global) configuration option settings section must always come first
8661 in the file, after the macros.
8662 The first thing you&#x2019;ll see in the file, after some initial comments, is the line
8663 </para>
8664 <literallayout class="monospaced">
8665 # primary_hostname =
8666 </literallayout>
8667 <para>
8668 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8669 to know the official, fully qualified name of your host, and this is where you
8670 can specify it. However, in most cases you do not need to set this option. When
8671 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8672 </para>
8673 <para>
8674 The first three non-comment configuration lines are as follows:
8675 </para>
8676 <literallayout class="monospaced">
8677 domainlist local_domains    = @
8678 domainlist relay_to_domains =
8679 hostlist   relay_from_hosts = 127.0.0.1
8680 </literallayout>
8681 <para>
8682 These are not, in fact, option settings. They are definitions of two named
8683 domain lists and one named host list. Exim allows you to give names to lists of
8684 domains, hosts, and email addresses, in order to make it easier to manage the
8685 configuration file (see section <xref linkend="SECTnamedlists"/>).
8686 </para>
8687 <para>
8688 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8689 later in the configuration to identify domains that are to be delivered
8690 on the local host.
8691 </para>
8692 <para>
8693 <indexterm role="concept">
8694 <primary>@ in a domain list</primary>
8695 </indexterm>
8696 There is just one item in this list, the string <quote>@</quote>. This is a special form
8697 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8698 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8699 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8700 the same configuration file can be used on different hosts.
8701 </para>
8702 <para>
8703 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8704 list itself is empty. Later in the configuration we will come to the part that
8705 controls mail relaying through the local host; it allows relaying to any
8706 domains in this list. By default, therefore, no relaying on the basis of a mail
8707 domain is permitted.
8708 </para>
8709 <para>
8710 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8711 used later in the configuration to permit relaying from any host or IP address
8712 that matches the list. The default contains just the IP address of the IPv4
8713 loopback interface, which means that processes on the local host are able to
8714 submit mail for relaying by sending it over TCP/IP to that interface. No other
8715 hosts are permitted to submit messages for relaying.
8716 </para>
8717 <para>
8718 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
8719 we aren&#x2019;t actually setting up any controls. We are just defining some domains
8720 and hosts that will be used in the controls that are specified later.
8721 </para>
8722 <para>
8723 The next two configuration lines are genuine option settings:
8724 </para>
8725 <literallayout class="monospaced">
8726 acl_smtp_rcpt = acl_check_rcpt
8727 acl_smtp_data = acl_check_data
8728 </literallayout>
8729 <para>
8730 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8731 during an incoming SMTP session for every recipient of a message (every RCPT
8732 command), and after the contents of the message have been received,
8733 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8734 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8735 section of the configuration. The RCPT ACL controls which recipients are
8736 accepted for an incoming message &ndash; if a configuration does not provide an ACL
8737 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8738 contents of a message to be checked.
8739 </para>
8740 <para>
8741 Two commented-out option settings are next:
8742 </para>
8743 <literallayout class="monospaced">
8744 # av_scanner = clamd:/tmp/clamd
8745 # spamd_address = 127.0.0.1 783
8746 </literallayout>
8747 <para>
8748 These are example settings that can be used when Exim is compiled with the
8749 content-scanning extension. The first specifies the interface to the virus
8750 scanner, and the second specifies the interface to SpamAssassin. Further
8751 details are given in chapter <xref linkend="CHAPexiscan"/>.
8752 </para>
8753 <para>
8754 Three more commented-out option settings follow:
8755 </para>
8756 <literallayout class="monospaced">
8757 # tls_advertise_hosts = *
8758 # tls_certificate = /etc/ssl/exim.crt
8759 # tls_privatekey = /etc/ssl/exim.pem
8760 </literallayout>
8761 <para>
8762 These are example settings that can be used when Exim is compiled with
8763 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8764 first one specifies the list of clients that are allowed to use TLS when
8765 connecting to this server; in this case, the wildcard means all clients. The
8766 other options specify where Exim should find its TLS certificate and private
8767 key, which together prove the server&#x2019;s identity to any clients that connect.
8768 More details are given in chapter <xref linkend="CHAPTLS"/>.
8769 </para>
8770 <para>
8771 Another two commented-out option settings follow:
8772 </para>
8773 <literallayout class="monospaced">
8774 # daemon_smtp_ports = 25 : 465 : 587
8775 # tls_on_connect_ports = 465
8776 </literallayout>
8777 <para>
8778 <indexterm role="concept">
8779 <primary>port</primary>
8780 <secondary>465 and 587</secondary>
8781 </indexterm>
8782 <indexterm role="concept">
8783 <primary>port</primary>
8784 <secondary>for message submission</secondary>
8785 </indexterm>
8786 <indexterm role="concept">
8787 <primary>message</primary>
8788 <secondary>submission, ports for</secondary>
8789 </indexterm>
8790 <indexterm role="concept">
8791 <primary>submissions protocol</primary>
8792 </indexterm>
8793 <indexterm role="concept">
8794 <primary>smtps protocol</primary>
8795 </indexterm>
8796 <indexterm role="concept">
8797 <primary>ssmtp protocol</primary>
8798 </indexterm>
8799 <indexterm role="concept">
8800 <primary>SMTP</primary>
8801 <secondary>submissions protocol</secondary>
8802 </indexterm>
8803 <indexterm role="concept">
8804 <primary>SMTP</primary>
8805 <secondary>ssmtp protocol</secondary>
8806 </indexterm>
8807 <indexterm role="concept">
8808 <primary>SMTP</primary>
8809 <secondary>smtps protocol</secondary>
8810 </indexterm>
8811 These options provide better support for roaming users who wish to use this
8812 server for message submission. They are not much use unless you have turned on
8813 TLS (as described in the previous paragraph) and authentication (about which
8814 more in section <xref linkend="SECTdefconfauth"/>).
8815 Mail submission from mail clients (MUAs) should be separate from inbound mail
8816 to your domain (MX delivery) for various good reasons (eg, ability to impose
8817 much saner TLS protocol and ciphersuite requirements without unintended
8818 consequences).
8819 RFC 6409 (previously 4409) specifies use of port 587 for SMTP Submission,
8820 which uses STARTTLS, so this is the <quote>submission</quote> port.
8821 RFC 8314 specifies use of port 465 as the <quote>submissions</quote> protocol,
8822 which should be used in preference to 587.
8823 You should also consider deploying SRV records to help clients find
8824 these ports.
8825 Older names for <quote>submissions</quote> are <quote>smtps</quote> and <quote>ssmtp</quote>.
8826 </para>
8827 <para>
8828 Two more commented-out options settings follow:
8829 </para>
8830 <literallayout class="monospaced">
8831 # qualify_domain =
8832 # qualify_recipient =
8833 </literallayout>
8834 <para>
8835 The first of these specifies a domain that Exim uses when it constructs a
8836 complete email address from a local login name. This is often needed when Exim
8837 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8838 the value of <option>primary_hostname</option> is used. If you set both of these options,
8839 you can have different qualification domains for sender and recipient
8840 addresses. If you set only the first one, its value is used in both cases.
8841 </para>
8842 <para>
8843 <indexterm role="concept">
8844 <primary>domain literal</primary>
8845 <secondary>recognizing format</secondary>
8846 </indexterm>
8847 The following line must be uncommented if you want Exim to recognize
8848 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8849 (an IP address within square brackets) instead of a named domain.
8850 </para>
8851 <literallayout class="monospaced">
8852 # allow_domain_literals
8853 </literallayout>
8854 <para>
8855 The RFCs still require this form, but many people think that in the modern
8856 Internet it makes little sense to permit mail to be sent to specific hosts by
8857 quoting their IP addresses. This ancient format has been used by people who
8858 try to abuse hosts by using them for unwanted relaying. However, some
8859 people believe there are circumstances (for example, messages addressed to
8860 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8861 </para>
8862 <para>
8863 The next configuration line is a kind of trigger guard:
8864 </para>
8865 <literallayout class="monospaced">
8866 never_users = root
8867 </literallayout>
8868 <para>
8869 It specifies that no delivery must ever be run as the root user. The normal
8870 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8871 setting is a guard against slips in the configuration.
8872 The list of users specified by <option>never_users</option> is not, however, the complete
8873 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8874 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8875 contents of <option>never_users</option> are added to this list. By default
8876 FIXED_NEVER_USERS also specifies root.
8877 </para>
8878 <para>
8879 When a remote host connects to Exim in order to send mail, the only information
8880 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8881 line,
8882 </para>
8883 <literallayout class="monospaced">
8884 host_lookup = *
8885 </literallayout>
8886 <para>
8887 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8888 in order to get a host name. This improves the quality of the logging
8889 information, but if you feel it is too expensive, you can remove it entirely,
8890 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8891 Note that it is not always possible to find a host name from an IP address,
8892 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8893 unreachable.
8894 </para>
8895 <para>
8896 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8897 1413 (hence their names):
8898 </para>
8899 <literallayout class="monospaced">
8900 rfc1413_hosts = *
8901 rfc1413_query_timeout = 0s
8902 </literallayout>
8903 <para>
8904 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
8905 Few hosts offer RFC1413 service these days; calls have to be
8906 terminated by a timeout and this needlessly delays the startup
8907 of an incoming SMTP connection.
8908 If you have hosts for which you trust RFC1413 and need this
8909 information, you can change this.
8910 </para>
8911 <para>
8912 This line enables an efficiency SMTP option.  It is negotiated by clients
8913 and not expected to cause problems but can be disabled if needed.
8914 </para>
8915 <literallayout class="monospaced">
8916 prdr_enable = true
8917 </literallayout>
8918 <para>
8919 When Exim receives messages over SMTP connections, it expects all addresses to
8920 be fully qualified with a domain, as required by the SMTP definition. However,
8921 if you are running a server to which simple clients submit messages, you may
8922 find that they send unqualified addresses. The two commented-out options:
8923 </para>
8924 <literallayout class="monospaced">
8925 # sender_unqualified_hosts =
8926 # recipient_unqualified_hosts =
8927 </literallayout>
8928 <para>
8929 show how you can specify hosts that are permitted to send unqualified sender
8930 and recipient addresses, respectively.
8931 </para>
8932 <para>
8933 The <option>log_selector</option> option is used to increase the detail of logging
8934 over the default:
8935 </para>
8936 <literallayout class="monospaced">
8937 log_selector = +smtp_protocol_error +smtp_syntax_error \
8938                +tls_certificate_verified
8939 </literallayout>
8940 <para>
8941 The <option>percent_hack_domains</option> option is also commented out:
8942 </para>
8943 <literallayout class="monospaced">
8944 # percent_hack_domains =
8945 </literallayout>
8946 <para>
8947 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8948 This is an almost obsolete form of explicit email routing. If you do not know
8949 anything about it, you can safely ignore this topic.
8950 </para>
8951 <para>
8952 The next two settings in the main part of the default configuration are
8953 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8954 message is frozen, Exim no longer continues to try to deliver it. Freezing
8955 occurs when a bounce message encounters a permanent failure because the sender
8956 address of the original message that caused the bounce is invalid, so the
8957 bounce cannot be delivered. This is probably the most common case, but there
8958 are also other conditions that cause freezing, and frozen messages are not
8959 always bounce messages.
8960 </para>
8961 <literallayout class="monospaced">
8962 ignore_bounce_errors_after = 2d
8963 timeout_frozen_after = 7d
8964 </literallayout>
8965 <para>
8966 The first of these options specifies that failing bounce messages are to be
8967 discarded after 2 days in the queue. The second specifies that any frozen
8968 message (whether a bounce message or not) is to be timed out (and discarded)
8969 after a week. In this configuration, the first setting ensures that no failing
8970 bounce message ever lasts a week.
8971 </para>
8972 <para>
8973 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
8974 large queues, you may consider using this option. It splits the spool
8975 directory into subdirectories to avoid file system degradation from
8976 many files in a single directory, resulting in better performance.
8977 Manual manipulation of queued messages becomes more complex (though fortunately
8978 not often needed).
8979 </para>
8980 <literallayout class="monospaced">
8981 # split_spool_directory = true
8982 </literallayout>
8983 <para>
8984 In an ideal world everybody follows the standards. For non-ASCII
8985 messages RFC 2047 is a standard, allowing a maximum line length of 76
8986 characters. Exim adheres that standard and won&#x2019;t process messages which
8987 violate this standard. (Even ${rfc2047:...} expansions will fail.)
8988 In particular, the Exim maintainers have had multiple reports of
8989 problems from Russian administrators of issues until they disable this
8990 check, because of some popular, yet buggy, mail composition software.
8991 </para>
8992 <literallayout class="monospaced">
8993 # check_rfc2047_length = false
8994 </literallayout>
8995 <para>
8996 If you need to be strictly RFC compliant you may wish to disable the
8997 8BITMIME advertisement. Use this, if you exchange mails with systems
8998 that are not 8-bit clean.
8999 </para>
9000 <literallayout class="monospaced">
9001 # accept_8bitmime = false
9002 </literallayout>
9003 <para>
9004 Libraries you use may depend on specific environment settings.  This
9005 imposes a security risk (e.g. PATH). There are two lists:
9006 <option>keep_environment</option> for the variables to import as they are, and
9007 <option>add_environment</option> for variables we want to set to a fixed value.
9008 Note that TZ is handled separately, by the $%timezone%$ runtime
9009 option and by the TIMEZONE_DEFAULT buildtime option.
9010 </para>
9011 <literallayout class="monospaced">
9012 # keep_environment = ^LDAP
9013 # add_environment = PATH=/usr/bin::/bin
9014 </literallayout>
9015 </section>
9016 <section id="SECID54">
9017 <title>ACL configuration</title>
9018 <para>
9019 <indexterm role="concept">
9020 <primary>default</primary>
9021 <secondary>ACLs</secondary>
9022 </indexterm>
9023 <indexterm role="concept">
9024 <primary>access control lists (ACLs)</primary>
9025 <secondary>default configuration</secondary>
9026 </indexterm>
9027 In the default configuration, the ACL section follows the main configuration.
9028 It starts with the line
9029 </para>
9030 <literallayout class="monospaced">
9031 begin acl
9032 </literallayout>
9033 <para>
9034 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
9035 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
9036 and <option>acl_smtp_data</option> above.
9037 </para>
9038 <para>
9039 <indexterm role="concept">
9040 <primary>RCPT</primary>
9041 <secondary>ACL for</secondary>
9042 </indexterm>
9043 The first ACL is used for every RCPT command in an incoming SMTP message. Each
9044 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
9045 are considered in order, until the recipient address is either accepted or
9046 rejected. The RCPT command is then accepted or rejected, according to the
9047 result of the ACL processing.
9048 </para>
9049 <literallayout class="monospaced">
9050 acl_check_rcpt:
9051 </literallayout>
9052 <para>
9053 This line, consisting of a name terminated by a colon, marks the start of the
9054 ACL, and names it.
9055 </para>
9056 <literallayout class="monospaced">
9057 accept  hosts = :
9058 </literallayout>
9059 <para>
9060 This ACL statement accepts the recipient if the sending host matches the list.
9061 But what does that strange list mean? It doesn&#x2019;t actually contain any host
9062 names or IP addresses. The presence of the colon puts an empty item in the
9063 list; Exim matches this only if the incoming message did not come from a remote
9064 host, because in that case, the remote hostname is empty. The colon is
9065 important. Without it, the list itself is empty, and can never match anything.
9066 </para>
9067 <para>
9068 What this statement is doing is to accept unconditionally all recipients in
9069 messages that are submitted by SMTP from local processes using the standard
9070 input and output (that is, not using TCP/IP). A number of MUAs operate in this
9071 manner.
9072 </para>
9073 <literallayout class="monospaced">
9074 deny    domains       = +local_domains
9075         local_parts   = ^[.] : ^.*[@%!/|]
9076         message       = Restricted characters in address
9077
9078 deny    domains       = !+local_domains
9079         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
9080         message       = Restricted characters in address
9081 </literallayout>
9082 <para>
9083 These statements are concerned with local parts that contain any of the
9084 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
9085 Although these characters are entirely legal in local parts (in the case of
9086 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
9087 in Internet mail addresses.
9088 </para>
9089 <para>
9090 The first three have in the past been associated with explicitly routed
9091 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
9092 option). Addresses containing these characters are regularly tried by spammers
9093 in an attempt to bypass relaying restrictions, and also by open relay testing
9094 programs. Unless you really need them it is safest to reject these characters
9095 at this early stage. This configuration is heavy-handed in rejecting these
9096 characters for all messages it accepts from remote hosts. This is a deliberate
9097 policy of being as safe as possible.
9098 </para>
9099 <para>
9100 The first rule above is stricter, and is applied to messages that are addressed
9101 to one of the local domains handled by this host. This is implemented by the
9102 first condition, which restricts it to domains that are listed in the
9103 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9104 reference to a named list. In this configuration, there is just one domain in
9105 <emphasis>local_domains</emphasis>, but in general there may be many.
9106 </para>
9107 <para>
9108 The second condition on the first statement uses two regular expressions to
9109 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
9110 or <quote>|</quote>. If you have local accounts that include these characters, you will
9111 have to modify this rule.
9112 </para>
9113 <para>
9114 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
9115 allows them because they have been encountered in practice. (Consider the
9116 common convention of local parts constructed as
9117 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
9118 the author of Exim, who has no second initial.) However, a local part starting
9119 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
9120 filename (for example, for a mailing list). This is also true for local parts
9121 that contain slashes. A pipe symbol can also be troublesome if the local part
9122 is incorporated unthinkingly into a shell command line.
9123 </para>
9124 <para>
9125 The second rule above applies to all other domains, and is less strict. This
9126 allows your own users to send outgoing messages to sites that use slashes
9127 and vertical bars in their local parts. It blocks local parts that begin
9128 with a dot, slash, or vertical bar, but allows these characters within the
9129 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
9130 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
9131 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
9132 </para>
9133 <literallayout class="monospaced">
9134 accept  local_parts   = postmaster
9135         domains       = +local_domains
9136 </literallayout>
9137 <para>
9138 This statement, which has two conditions, accepts an incoming address if the
9139 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
9140 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9141 reference to a named list. In this configuration, there is just one domain in
9142 <emphasis>local_domains</emphasis>, but in general there may be many.
9143 </para>
9144 <para>
9145 The presence of this statement means that mail to postmaster is never blocked
9146 by any of the subsequent tests. This can be helpful while sorting out problems
9147 in cases where the subsequent tests are incorrectly denying access.
9148 </para>
9149 <literallayout class="monospaced">
9150 require verify        = sender
9151 </literallayout>
9152 <para>
9153 This statement requires the sender address to be verified before any subsequent
9154 ACL statement can be used. If verification fails, the incoming recipient
9155 address is refused. Verification consists of trying to route the address, to
9156 see if a bounce message could be delivered to it. In the case of remote
9157 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
9158 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
9159 discusses the details of address verification.
9160 </para>
9161 <literallayout class="monospaced">
9162 accept  hosts         = +relay_from_hosts
9163         control       = submission
9164 </literallayout>
9165 <para>
9166 This statement accepts the address if the message is coming from one of the
9167 hosts that are defined as being allowed to relay through this host. Recipient
9168 verification is omitted here, because in many cases the clients are dumb MUAs
9169 that do not cope well with SMTP error responses. For the same reason, the
9170 second line specifies <quote>submission mode</quote> for messages that are accepted. This
9171 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
9172 messages that are deficient in some way, for example, because they lack a
9173 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
9174 probably add recipient verification here, and disable submission mode.
9175 </para>
9176 <literallayout class="monospaced">
9177 accept  authenticated = *
9178         control       = submission
9179 </literallayout>
9180 <para>
9181 This statement accepts the address if the client host has authenticated itself.
9182 Submission mode is again specified, on the grounds that such messages are most
9183 likely to come from MUAs. The default configuration does not define any
9184 authenticators, though it does include some nearly complete commented-out
9185 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
9186 fact authenticate until you complete the authenticator definitions.
9187 </para>
9188 <literallayout class="monospaced">
9189 require message = relay not permitted
9190         domains = +local_domains : +relay_to_domains
9191 </literallayout>
9192 <para>
9193 This statement rejects the address if its domain is neither a local domain nor
9194 one of the domains for which this host is a relay.
9195 </para>
9196 <literallayout class="monospaced">
9197 require verify = recipient
9198 </literallayout>
9199 <para>
9200 This statement requires the recipient address to be verified; if verification
9201 fails, the address is rejected.
9202 </para>
9203 <literallayout class="monospaced">
9204 # deny    dnslists    = black.list.example
9205 #         message     = rejected because $sender_host_address \
9206 #                       is in a black list at $dnslist_domain\n\
9207 #                       $dnslist_text
9208 #
9209 # warn    dnslists    = black.list.example
9210 #         add_header  = X-Warning: $sender_host_address is in \
9211 #                       a black list at $dnslist_domain
9212 #         log_message = found in $dnslist_domain
9213 </literallayout>
9214 <para>
9215 These commented-out lines are examples of how you could configure Exim to check
9216 sending hosts against a DNS black list. The first statement rejects messages
9217 from blacklisted hosts, whereas the second just inserts a warning header
9218 line.
9219 </para>
9220 <literallayout class="monospaced">
9221 # require verify = csa
9222 </literallayout>
9223 <para>
9224 This commented-out line is an example of how you could turn on client SMTP
9225 authorization (CSA) checking. Such checks do DNS lookups for special SRV
9226 records.
9227 </para>
9228 <literallayout class="monospaced">
9229 accept
9230 </literallayout>
9231 <para>
9232 The final statement in the first ACL unconditionally accepts any recipient
9233 address that has successfully passed all the previous tests.
9234 </para>
9235 <literallayout class="monospaced">
9236 acl_check_data:
9237 </literallayout>
9238 <para>
9239 This line marks the start of the second ACL, and names it. Most of the contents
9240 of this ACL are commented out:
9241 </para>
9242 <literallayout class="monospaced">
9243 # deny    malware   = *
9244 #         message   = This message contains a virus \
9245 #                     ($malware_name).
9246 </literallayout>
9247 <para>
9248 These lines are examples of how to arrange for messages to be scanned for
9249 viruses when Exim has been compiled with the content-scanning extension, and a
9250 suitable virus scanner is installed. If the message is found to contain a
9251 virus, it is rejected with the given custom error message.
9252 </para>
9253 <literallayout class="monospaced">
9254 # warn    spam      = nobody
9255 #         message   = X-Spam_score: $spam_score\n\
9256 #                     X-Spam_score_int: $spam_score_int\n\
9257 #                     X-Spam_bar: $spam_bar\n\
9258 #                     X-Spam_report: $spam_report
9259 </literallayout>
9260 <para>
9261 These lines are an example of how to arrange for messages to be scanned by
9262 SpamAssassin when Exim has been compiled with the content-scanning extension,
9263 and SpamAssassin has been installed. The SpamAssassin check is run with
9264 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9265 series of extra header line. In this case, the message is not rejected,
9266 whatever the spam score.
9267 </para>
9268 <literallayout class="monospaced">
9269 accept
9270 </literallayout>
9271 <para>
9272 This final line in the DATA ACL accepts the message unconditionally.
9273 </para>
9274 </section>
9275 <section id="SECID55">
9276 <title>Router configuration</title>
9277 <para>
9278 <indexterm role="concept">
9279 <primary>default</primary>
9280 <secondary>routers</secondary>
9281 </indexterm>
9282 <indexterm role="concept">
9283 <primary>routers</primary>
9284 <secondary>default</secondary>
9285 </indexterm>
9286 The router configuration comes next in the default configuration, introduced
9287 by the line
9288 </para>
9289 <literallayout class="monospaced">
9290 begin routers
9291 </literallayout>
9292 <para>
9293 Routers are the modules in Exim that make decisions about where to send
9294 messages. An address is passed to each router, in turn, until it is either
9295 accepted, or failed. This means that the order in which you define the routers
9296 matters. Each router is fully described in its own chapter later in this
9297 manual. Here we give only brief overviews.
9298 </para>
9299 <literallayout class="monospaced">
9300 # domain_literal:
9301 #   driver = ipliteral
9302 #   domains = !+local_domains
9303 #   transport = remote_smtp
9304 </literallayout>
9305 <para>
9306 <indexterm role="concept">
9307 <primary>domain literal</primary>
9308 <secondary>default router</secondary>
9309 </indexterm>
9310 This router is commented out because the majority of sites do not want to
9311 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9312 you uncomment this router, you also need to uncomment the setting of
9313 <option>allow_domain_literals</option> in the main part of the configuration.
9314 </para>
9315 <para>
9316 Which router is used next depends upon whether or not the ROUTER_SMARTHOST
9317 macro has been defined, per
9318 </para>
9319 <literallayout class="monospaced">
9320 .ifdef ROUTER_SMARTHOST
9321 smarthost:
9322 #...
9323 .else
9324 dnslookup:
9325 #...
9326 .endif
9327 </literallayout>
9328 <para>
9329 If ROUTER_SMARTHOST has been defined, either at the top of the file or on the
9330 command-line, then we route all non-local mail to that smarthost; otherwise, we&#x2019;ll
9331 perform DNS lookups for direct-to-MX lookup.  Any mail which is to a local domain will
9332 skip these routers because of the <option>domains</option> option.
9333 </para>
9334 <literallayout class="monospaced">
9335 smarthost:
9336   driver = manualroute
9337   domains = ! +local_domains
9338   transport = smarthost_smtp
9339   route_data = ROUTER_SMARTHOST
9340   ignore_target_hosts = &lt;; 0.0.0.0 ; 127.0.0.0/8 ; ::1
9341   no_more
9342 </literallayout>
9343 <para>
9344 This router only handles mail which is not to any local domains; this is
9345 specified by the line
9346 </para>
9347 <literallayout class="monospaced">
9348 domains = ! +local_domains
9349 </literallayout>
9350 <para>
9351 The <option>domains</option> option lists the domains to which this router applies, but the
9352 exclamation mark is a negation sign, so the router is used only for domains
9353 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9354 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9355 indicates that it is referring to a named list. Addresses in other domains are
9356 passed on to the following routers.
9357 </para>
9358 <para>
9359 The name of the router driver is <command>manualroute</command> because we are manually
9360 specifying how mail should be routed onwards, instead of using DNS MX.
9361 While the name of this router instance is arbitrary, the <option>driver</option> option must
9362 be one of the driver modules that is in the Exim binary.
9363 </para>
9364 <para>
9365 With no pre-conditions other than <option>domains</option>, all mail for non-local domains
9366 will be handled by this router, and the <option>no_more</option> setting will ensure that no
9367 other routers will be used for messages matching the pre-conditions.  See
9368 <xref linkend="SECTrouprecon"/> for more on how the pre-conditions apply.  For messages which
9369 are handled by this router, we provide a hostname to deliver to in <option>route_data</option>
9370 and the macro supplies the value; the address is then queued for the
9371 <command>smarthost_smtp</command> transport.
9372 </para>
9373 <literallayout class="monospaced">
9374 dnslookup:
9375   driver = dnslookup
9376   domains = ! +local_domains
9377   transport = remote_smtp
9378   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9379   no_more
9380 </literallayout>
9381 <para>
9382 The <option>domains</option> option behaves as per smarthost, above.
9383 </para>
9384 <para>
9385 The name of the router driver is <command>dnslookup</command>,
9386 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9387 the name of this router instance is the same as the name of the driver. The
9388 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9389 one of the driver modules that is in the Exim binary.
9390 </para>
9391 <para>
9392 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9393 DNS in order to obtain a list of hosts to which the address is routed. If the
9394 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9395 specified by the <option>transport</option> option. If the router does not find the domain
9396 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9397 the address fails and is bounced.
9398 </para>
9399 <para>
9400 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9401 be entirely ignored. This option is present because a number of cases have been
9402 encountered where MX records in the DNS point to host names
9403 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9404 Completely ignoring these IP addresses causes Exim to fail to route the
9405 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9406 continue to try to deliver the message periodically until the address timed
9407 out.
9408 </para>
9409 <literallayout class="monospaced">
9410 system_aliases:
9411   driver = redirect
9412   allow_fail
9413   allow_defer
9414   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9415 # user = exim
9416   file_transport = address_file
9417   pipe_transport = address_pipe
9418 </literallayout>
9419 <para>
9420 Control reaches this and subsequent routers only for addresses in the local
9421 domains. This router checks to see whether the local part is defined as an
9422 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9423 data that it looks up from that file. If no data is found for the local part,
9424 the value of the <option>data</option> option is empty, causing the address to be passed to
9425 the next router.
9426 </para>
9427 <para>
9428 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9429 often used. That is why it is referenced by from the default configuration
9430 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9431 <filename>Local/Makefile</filename> before building Exim.
9432 </para>
9433 <literallayout class="monospaced">
9434 userforward:
9435   driver = redirect
9436   check_local_user
9437 # local_part_suffix = +* : -*
9438 # local_part_suffix_optional
9439   file = $home/.forward
9440 # allow_filter
9441   no_verify
9442   no_expn
9443   check_ancestor
9444   file_transport = address_file
9445   pipe_transport = address_pipe
9446   reply_transport = address_reply
9447 </literallayout>
9448 <para>
9449 This is the most complicated router in the default configuration. It is another
9450 redirection router, but this time it is looking for forwarding data set up by
9451 individual users. The <option>check_local_user</option> setting specifies a check that the
9452 local part of the address is the login name of a local user. If it is not, the
9453 router is skipped. The two commented options that follow <option>check_local_user</option>,
9454 namely:
9455 </para>
9456 <literallayout class="monospaced">
9457 # local_part_suffix = +* : -*
9458 # local_part_suffix_optional
9459 </literallayout>
9460 <para>
9461 <indexterm role="variable">
9462 <primary><varname>$local_part_suffix</varname></primary>
9463 </indexterm>
9464 show how you can specify the recognition of local part suffixes. If the first
9465 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9466 by any sequence of characters, is removed from the local part and placed in the
9467 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9468 presence of a suffix in the local part is optional. When a suffix is present,
9469 the check for a local login uses the local part with the suffix removed.
9470 </para>
9471 <para>
9472 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9473 home directory is consulted. If it does not exist, or is empty, the router
9474 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9475 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9476 </para>
9477 <para>
9478 <indexterm role="concept">
9479 <primary>Sieve filter</primary>
9480 <secondary>enabling in default router</secondary>
9481 </indexterm>
9482 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9483 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9484 is commented out by default), the contents of the file are interpreted as a set
9485 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9486 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9487 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9488 </para>
9489 <para>
9490 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9491 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9492 There are two reasons for doing this:
9493 </para>
9494 <orderedlist numeration="arabic">
9495 <listitem>
9496 <para>
9497 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9498 checking an address for validity; it makes sense not to waste resources doing
9499 unnecessary work.
9500 </para>
9501 </listitem>
9502 <listitem>
9503 <para>
9504 More importantly, when Exim is verifying addresses or handling an EXPN
9505 command during an SMTP session, it is running as the Exim user, not as root.
9506 The group is the Exim group, and no additional groups are set up.
9507 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9508 this time.
9509 </para>
9510 </listitem>
9511 </orderedlist>
9512 <para>
9513 The setting of <option>check_ancestor</option> prevents the router from generating a new
9514 address that is the same as any previous address that was redirected. (This
9515 works round a problem concerning a bad interaction between aliasing and
9516 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9517 </para>
9518 <para>
9519 The final three option settings specify the transports that are to be used when
9520 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9521 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9522 </para>
9523 <literallayout class="monospaced">
9524 a.nother@elsewhere.example, /home/spqr/archive
9525 </literallayout>
9526 <para>
9527 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9528 transport.
9529 </para>
9530 <literallayout class="monospaced">
9531 localuser:
9532   driver = accept
9533   check_local_user
9534 # local_part_suffix = +* : -*
9535 # local_part_suffix_optional
9536   transport = local_delivery
9537 </literallayout>
9538 <para>
9539 The final router sets up delivery into local mailboxes, provided that the local
9540 part is the name of a local login, by accepting the address and assigning it to
9541 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9542 routers, so the address is bounced. The commented suffix settings fulfil the
9543 same purpose as they do for the <command>userforward</command> router.
9544 </para>
9545 </section>
9546 <section id="SECID56">
9547 <title>Transport configuration</title>
9548 <para>
9549 <indexterm role="concept">
9550 <primary>default</primary>
9551 <secondary>transports</secondary>
9552 </indexterm>
9553 <indexterm role="concept">
9554 <primary>transports</primary>
9555 <secondary>default</secondary>
9556 </indexterm>
9557 Transports define mechanisms for actually delivering messages. They operate
9558 only when referenced from routers, so the order in which they are defined does
9559 not matter. The transports section of the configuration starts with
9560 </para>
9561 <literallayout class="monospaced">
9562 begin transports
9563 </literallayout>
9564 <para>
9565 Two remote transports and four local transports are defined.
9566 </para>
9567 <literallayout class="monospaced">
9568 remote_smtp:
9569   driver = smtp
9570   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9571 .ifdef _HAVE_PRDR
9572   hosts_try_prdr = *
9573 .endif
9574 </literallayout>
9575 <para>
9576 This transport is used for delivering messages over SMTP connections.
9577 The list of remote hosts comes from the router.
9578 The <option>message_size_limit</option> usage is a hack to avoid sending on messages
9579 with over-long lines.
9580 </para>
9581 <para>
9582 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.  It is
9583 negotiated between client and server and not expected to cause problems
9584 but can be disabled if needed.  The built-in macro _HAVE_PRDR guards the
9585 use of the <option>hosts_try_prdr</option> configuration option.
9586 </para>
9587 <para>
9588 The other remote transport is used when delivering to a specific smarthost
9589 with whom there must be some kind of existing relationship, instead of the
9590 usual federated system.
9591 </para>
9592 <literallayout class="monospaced">
9593 smarthost_smtp:
9594   driver = smtp
9595   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9596   multi_domain
9597   #
9598 .ifdef _HAVE_TLS
9599   # Comment out any of these which you have to, then file a Support
9600   # request with your smarthost provider to get things fixed:
9601   hosts_require_tls = *
9602   tls_verify_hosts = *
9603   # As long as tls_verify_hosts is enabled, this won't matter, but if you
9604   # have to comment it out then this will at least log whether you succeed
9605   # or not:
9606   tls_try_verify_hosts = *
9607   #
9608   # The SNI name should match the name which we'll expect to verify;
9609   # many mail systems don't use SNI and this doesn't matter, but if it does,
9610   # we need to send a name which the remote site will recognize.
9611   # This _should_ be the name which the smarthost operators specified as
9612   # the hostname for sending your mail to.
9613   tls_sni = ROUTER_SMARTHOST
9614   #
9615 .ifdef _HAVE_OPENSSL
9616   tls_require_ciphers = HIGH:!aNULL:@STRENGTH
9617 .endif
9618 .ifdef _HAVE_GNUTLS
9619   tls_require_ciphers = SECURE192:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1
9620 .endif
9621 .endif
9622 .ifdef _HAVE_PRDR
9623   hosts_try_prdr = *
9624 .endif
9625 </literallayout>
9626 <para>
9627 After the same <option>message_size_limit</option> hack, we then specify that this Transport
9628 can handle messages to multiple domains in one run.  The assumption here is
9629 that you&#x2019;re routing all non-local mail to the same place and that place is
9630 happy to take all messages from you as quickly as possible.
9631 All other options depend upon built-in macros; if Exim was built without TLS support
9632 then no other options are defined.
9633 If TLS is available, then we configure "stronger than default" TLS ciphersuites
9634 and versions using the <option>tls_require_ciphers</option> option, where the value to be
9635 used depends upon the library providing TLS.
9636 Beyond that, the options adopt the stance that you should have TLS support available
9637 from your smarthost on today&#x2019;s Internet, so we turn on requiring TLS for the
9638 mail to be delivered, and requiring that the certificate be valid, and match
9639 the expected hostname.  The <option>tls_sni</option> option can be used by service providers
9640 to select an appropriate certificate to present to you and here we re-use the
9641 ROUTER_SMARTHOST macro, because that is unaffected by CNAMEs present in DNS.
9642 You want to specify the hostname which you&#x2019;ll expect to validate for, and that
9643 should not be subject to insecure tampering via DNS results.
9644 </para>
9645 <para>
9646 For the <option>hosts_try_prdr</option> option see the previous transport.
9647 </para>
9648 <para>
9649 All other options are defaulted.
9650 </para>
9651 <literallayout class="monospaced">
9652 local_delivery:
9653   driver = appendfile
9654   file = /var/mail/$local_part_data
9655   delivery_date_add
9656   envelope_to_add
9657   return_path_add
9658 # group = mail
9659 # mode = 0660
9660 </literallayout>
9661 <para>
9662 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9663 traditional BSD mailbox format.
9664 </para>
9665 <para revisionflag="changed">
9666 We prefer to avoid using <varname>$local_part</varname> directly to define the mailbox filename,
9667 as it is provided by a potential bad actor.
9668 Instead we use <varname>$local_part_data</varname>,
9669 the result of looking up <varname>$local_part</varname> in the user database
9670 (done by using <option>check_local_user</option> in the the router).
9671 </para>
9672 <para>
9673 By default <command>appendfile</command> runs under the uid and gid of the
9674 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9675 directory. Some systems use the alternative approach of running mail deliveries
9676 under a particular group instead of using the sticky bit. The commented options
9677 show how this can be done.
9678 </para>
9679 <para>
9680 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9681 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9682 similarly-named options above.
9683 </para>
9684 <literallayout class="monospaced">
9685 address_pipe:
9686   driver = pipe
9687   return_output
9688 </literallayout>
9689 <para>
9690 This transport is used for handling deliveries to pipes that are generated by
9691 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9692 option specifies that any output on stdout or stderr generated by the pipe is to
9693 be returned to the sender.
9694 </para>
9695 <literallayout class="monospaced">
9696 address_file:
9697   driver = appendfile
9698   delivery_date_add
9699   envelope_to_add
9700   return_path_add
9701 </literallayout>
9702 <para>
9703 This transport is used for handling deliveries to files that are generated by
9704 redirection. The name of the file is not specified in this instance of
9705 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9706 </para>
9707 <literallayout class="monospaced">
9708 address_reply:
9709   driver = autoreply
9710 </literallayout>
9711 <para>
9712 This transport is used for handling automatic replies generated by users&#x2019;
9713 filter files.
9714 </para>
9715 </section>
9716 <section id="SECID57">
9717 <title>Default retry rule</title>
9718 <para>
9719 <indexterm role="concept">
9720 <primary>retry</primary>
9721 <secondary>default rule</secondary>
9722 </indexterm>
9723 <indexterm role="concept">
9724 <primary>default</primary>
9725 <secondary>retry rule</secondary>
9726 </indexterm>
9727 The retry section of the configuration file contains rules which affect the way
9728 Exim retries deliveries that cannot be completed at the first attempt. It is
9729 introduced by the line
9730 </para>
9731 <literallayout class="monospaced">
9732 begin retry
9733 </literallayout>
9734 <para>
9735 In the default configuration, there is just one rule, which applies to all
9736 errors:
9737 </para>
9738 <literallayout class="monospaced">
9739 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
9740 </literallayout>
9741 <para>
9742 This causes any temporarily failing address to be retried every 15 minutes for
9743 2 hours, then at intervals starting at one hour and increasing by a factor of
9744 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
9745 is not delivered after 4 days of temporary failure, it is bounced. The time is
9746 measured from first failure, not from the time the message was received.
9747 </para>
9748 <para>
9749 If the retry section is removed from the configuration, or is empty (that is,
9750 if no retry rules are defined), Exim will not retry deliveries. This turns
9751 temporary errors into permanent errors.
9752 </para>
9753 </section>
9754 <section id="SECID58">
9755 <title>Rewriting configuration</title>
9756 <para>
9757 The rewriting section of the configuration, introduced by
9758 </para>
9759 <literallayout class="monospaced">
9760 begin rewrite
9761 </literallayout>
9762 <para>
9763 contains rules for rewriting addresses in messages as they arrive. There are no
9764 rewriting rules in the default configuration file.
9765 </para>
9766 </section>
9767 <section id="SECTdefconfauth">
9768 <title>Authenticators configuration</title>
9769 <para>
9770 <indexterm role="concept">
9771 <primary>AUTH</primary>
9772 <secondary>configuration</secondary>
9773 </indexterm>
9774 The authenticators section of the configuration, introduced by
9775 </para>
9776 <literallayout class="monospaced">
9777 begin authenticators
9778 </literallayout>
9779 <para>
9780 defines mechanisms for the use of the SMTP AUTH command. The default
9781 configuration file contains two commented-out example authenticators
9782 which support plaintext username/password authentication using the
9783 standard PLAIN mechanism and the traditional but non-standard LOGIN
9784 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
9785 to support most MUA software.
9786 </para>
9787 <para>
9788 The example PLAIN authenticator looks like this:
9789 </para>
9790 <literallayout class="monospaced">
9791 #PLAIN:
9792 #  driver                  = plaintext
9793 #  server_set_id           = $auth2
9794 #  server_prompts          = :
9795 #  server_condition        = Authentication is not yet configured
9796 #  server_advertise_condition = ${if def:tls_in_cipher }
9797 </literallayout>
9798 <para>
9799 And the example LOGIN authenticator looks like this:
9800 </para>
9801 <literallayout class="monospaced">
9802 #LOGIN:
9803 #  driver                  = plaintext
9804 #  server_set_id           = $auth1
9805 #  server_prompts          = &lt;| Username: | Password:
9806 #  server_condition        = Authentication is not yet configured
9807 #  server_advertise_condition = ${if def:tls_in_cipher }
9808 </literallayout>
9809 <para>
9810 The <option>server_set_id</option> option makes Exim remember the authenticated username
9811 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
9812 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
9813 that it implements the details of the specific authentication mechanism,
9814 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
9815 when Exim offers authentication to clients; in the examples, this is only
9816 when TLS or SSL has been started, so to enable the authenticators you also
9817 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
9818 </para>
9819 <para>
9820 The <option>server_condition</option> setting defines how to verify that the username and
9821 password are correct. In the examples it just produces an error message.
9822 To make the authenticators work, you can use a string expansion
9823 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
9824 </para>
9825 <para>
9826 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
9827 usercode and password are in different positions.
9828 Chapter <xref linkend="CHAPplaintext"/> covers both.
9829 </para>
9830 <para>
9831 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9832 </para>
9833 </section>
9834 </chapter>
9835
9836 <chapter id="CHAPregexp">
9837 <title>Regular expressions</title>
9838 <para>
9839 <indexterm role="concept">
9840 <primary>regular expressions</primary>
9841 <secondary>library</secondary>
9842 </indexterm>
9843 <indexterm role="concept">
9844 <primary>PCRE</primary>
9845 </indexterm>
9846 Exim supports the use of regular expressions in many of its options. It
9847 uses the PCRE regular expression library; this provides regular expression
9848 matching that is compatible with Perl 5. The syntax and semantics of
9849 regular expressions is discussed in
9850 online Perl manpages, in
9851 many Perl reference books, and also in
9852 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9853 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9854 </para>
9855 <para>
9856 The documentation for the syntax and semantics of the regular expressions that
9857 are supported by PCRE is included in the PCRE distribution, and no further
9858 description is included here. The PCRE functions are called from Exim using
9859 the default option settings (that is, with no PCRE options set), except that
9860 the PCRE_CASELESS option is set when the matching is required to be
9861 case-insensitive.
9862 </para>
9863 <para>
9864 In most cases, when a regular expression is required in an Exim configuration,
9865 it has to start with a circumflex, in order to distinguish it from plain text
9866 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9867 second item in the colon-separated list is a regular expression.
9868 </para>
9869 <literallayout class="monospaced">
9870 domains = a.b.c : ^\\d{3} : *.y.z : ...
9871 </literallayout>
9872 <para>
9873 The doubling of the backslash is required because of string expansion that
9874 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
9875 of this issue, and a way of avoiding the need for doubling backslashes. The
9876 regular expression that is eventually used in this example contains just one
9877 backslash. The circumflex is included in the regular expression, and has the
9878 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9879 matched.
9880 </para>
9881 <para>
9882 There are, however, two cases where a circumflex is not required for the
9883 recognition of a regular expression: these are the <option>match</option> condition in a
9884 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9885 these cases, the relevant string is always treated as a regular expression; if
9886 it does not start with a circumflex, the expression is not anchored, and can
9887 match anywhere in the subject string.
9888 </para>
9889 <para>
9890 In all cases, if you want a regular expression to match at the end of a string,
9891 you must code the $ metacharacter to indicate this. For example:
9892 </para>
9893 <literallayout class="monospaced">
9894 domains = ^\\d{3}\\.example
9895 </literallayout>
9896 <para>
9897 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9898 You need to use:
9899 </para>
9900 <literallayout class="monospaced">
9901 domains = ^\\d{3}\\.example\$
9902 </literallayout>
9903 <para>
9904 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9905 $ is needed because string expansion also interprets dollar characters.
9906 </para>
9907 </chapter>
9908
9909 <chapter id="CHAPfdlookup">
9910 <title>File and database lookups</title>
9911 <para>
9912 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9913 <primary>file</primary>
9914 <secondary>lookups</secondary>
9915 </indexterm>
9916 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9917 <primary>database</primary>
9918 <secondary>lookups</secondary>
9919 </indexterm>
9920 <indexterm role="concept">
9921 <primary>lookup</primary>
9922 <secondary>description of</secondary>
9923 </indexterm>
9924 Exim can be configured to look up data in files or databases as it processes
9925 messages. Two different kinds of syntax are used:
9926 </para>
9927 <orderedlist numeration="arabic">
9928 <listitem>
9929 <para>
9930 A string that is to be expanded may contain explicit lookup requests. These
9931 cause parts of the string to be replaced by data that is obtained from the
9932 lookup. Lookups of this type are conditional expansion items. Different results
9933 can be defined for the cases of lookup success and failure. See chapter
9934 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9935 The key for the lookup is specified as part of the string expansion.
9936 </para>
9937 </listitem>
9938 <listitem>
9939 <para>
9940 Lists of domains, hosts, and email addresses can contain lookup requests as a
9941 way of avoiding excessively long linear lists. In this case, the data that is
9942 returned by the lookup is often (but not always) discarded; whether the lookup
9943 succeeds or fails is what really counts. These kinds of list are described in
9944 chapter <xref linkend="CHAPdomhosaddlists"/>.
9945 The key for the lookup is given by the context in which the list is expanded.
9946 </para>
9947 </listitem>
9948 </orderedlist>
9949 <para>
9950 String expansions, lists, and lookups interact with each other in such a way
9951 that there is no order in which to describe any one of them that does not
9952 involve references to the others. Each of these three chapters makes more sense
9953 if you have read the other two first. If you are reading this for the first
9954 time, be aware that some of it will make a lot more sense after you have read
9955 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9956 </para>
9957 <section id="SECID60">
9958 <title>Examples of different lookup syntax</title>
9959 <para>
9960 It is easy to confuse the two different kinds of lookup, especially as the
9961 lists that may contain the second kind are always expanded before being
9962 processed as lists. Therefore, they may also contain lookups of the first kind.
9963 Be careful to distinguish between the following two examples:
9964 </para>
9965 <literallayout class="monospaced">
9966 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9967 domains = lsearch;/some/file
9968 </literallayout>
9969 <para>
9970 The first uses a string expansion, the result of which must be a domain list.
9971 No strings have been specified for a successful or a failing lookup; the
9972 defaults in this case are the looked-up data and an empty string, respectively.
9973 The expansion takes place before the string is processed as a list, and the
9974 file that is searched could contain lines like this:
9975 </para>
9976 <literallayout class="monospaced">
9977 192.168.3.4: domain1:domain2:...
9978 192.168.1.9: domain3:domain4:...
9979 </literallayout>
9980 <para>
9981 When the lookup succeeds, the result of the expansion is a list of domains (and
9982 possibly other types of item that are allowed in domain lists).
9983 <indexterm role="concept">
9984 <primary>tainted data</primary>
9985 <secondary>de-tainting</secondary>
9986 </indexterm>
9987 The result of the expansion is not tainted.
9988 </para>
9989 <para>
9990 In the second example, the lookup is a single item in a domain list. It causes
9991 Exim to use a lookup to see if the domain that is being processed can be found
9992 in the file. The file could contains lines like this:
9993 </para>
9994 <literallayout class="monospaced">
9995 domain1:
9996 domain2:
9997 </literallayout>
9998 <para>
9999 Any data that follows the keys is not relevant when checking that the domain
10000 matches the list item.
10001 </para>
10002 <para>
10003 It is possible, though no doubt confusing, to use both kinds of lookup at once.
10004 Consider a file containing lines like this:
10005 </para>
10006 <literallayout class="monospaced">
10007 192.168.5.6: lsearch;/another/file
10008 </literallayout>
10009 <para>
10010 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
10011 first <option>domains</option> setting above generates the second setting, which therefore
10012 causes a second lookup to occur.
10013 </para>
10014 <para revisionflag="changed">
10015 The lookup type may optionally be followed by a comma
10016 and a comma-separated list of options.
10017 Each option is a <quote>name=value</quote> pair.
10018 Whether an option is meaningful depands on the lookup type.
10019 </para>
10020 <para>
10021 The rest of this chapter describes the different lookup types that are
10022 available. Any of them can be used in any part of the configuration where a
10023 lookup is permitted.
10024 </para>
10025 </section>
10026 <section id="SECID61">
10027 <title>Lookup types</title>
10028 <para>
10029 <indexterm role="concept">
10030 <primary>lookup</primary>
10031 <secondary>types of</secondary>
10032 </indexterm>
10033 <indexterm role="concept">
10034 <primary>single-key lookup</primary>
10035 <secondary>definition of</secondary>
10036 </indexterm>
10037 Two different types of data lookup are implemented:
10038 </para>
10039 <itemizedlist>
10040 <listitem>
10041 <para>
10042 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
10043 and a single key to search for. The key must be a non-empty string for the
10044 lookup to succeed. The lookup type determines how the file is searched.
10045 </para>
10046 <para revisionflag="changed">
10047 <indexterm role="concept">
10048 <primary>tainted data</primary>
10049 <secondary>single-key lookups</secondary>
10050 </indexterm>
10051 The file string may not be tainted
10052 </para>
10053 <para revisionflag="changed">
10054 <indexterm role="concept">
10055 <primary>tainted data</primary>
10056 <secondary>de-tainting</secondary>
10057 </indexterm>
10058 All single-key lookups support the option <quote>ret=key</quote>.
10059 If this is given and the lookup
10060 (either underlying implementation or cached value)
10061 returns data, the result is replaced with a non-tainted
10062 version of the lookup key.
10063 </para>
10064 </listitem>
10065 <listitem>
10066 <para>
10067 <indexterm role="concept">
10068 <primary>query-style lookup</primary>
10069 <secondary>definition of</secondary>
10070 </indexterm>
10071 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
10072 key value is assumed by Exim for query-style lookups. You can use whichever
10073 Exim variables you need to construct the database query.
10074 </para>
10075 </listitem>
10076 </itemizedlist>
10077 <para>
10078 The code for each lookup type is in a separate source file that is included in
10079 the binary of Exim only if the corresponding compile-time option is set. The
10080 default settings in <filename>src/EDITME</filename> are:
10081 </para>
10082 <literallayout class="monospaced">
10083 LOOKUP_DBM=yes
10084 LOOKUP_LSEARCH=yes
10085 </literallayout>
10086 <para>
10087 which means that only linear searching and DBM lookups are included by default.
10088 For some types of lookup (e.g. SQL databases), you need to install appropriate
10089 libraries and header files before building Exim.
10090 </para>
10091 </section>
10092 <section id="SECTsinglekeylookups">
10093 <title>Single-key lookup types</title>
10094 <para>
10095 <indexterm role="concept">
10096 <primary>lookup</primary>
10097 <secondary>single-key types</secondary>
10098 </indexterm>
10099 <indexterm role="concept">
10100 <primary>single-key lookup</primary>
10101 <secondary>list of types</secondary>
10102 </indexterm>
10103 The following single-key lookup types are implemented:
10104 </para>
10105 <itemizedlist>
10106 <listitem>
10107 <para>
10108 <indexterm role="concept">
10109 <primary>cdb</primary>
10110 <secondary>description of</secondary>
10111 </indexterm>
10112 <indexterm role="concept">
10113 <primary>lookup</primary>
10114 <secondary>cdb</secondary>
10115 </indexterm>
10116 <indexterm role="concept">
10117 <primary>binary zero</primary>
10118 <secondary>in lookup key</secondary>
10119 </indexterm>
10120 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
10121 string without a terminating binary zero. The cdb format is designed for
10122 indexed files that are read frequently and never updated, except by total
10123 re-creation. As such, it is particularly suitable for large files containing
10124 aliases or other indexed data referenced by an MTA. Information about cdb and
10125 tools for building the files can be found in several places:
10126 </para>
10127 <literallayout>
10128 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>
10129 <emphasis role="bold"><ulink url="https://www.corpit.ru/mjt/tinycdb.html">https://www.corpit.ru/mjt/tinycdb.html</ulink></emphasis>
10130 <emphasis role="bold"><ulink url="https://packages.debian.org/stable/utils/freecdb">https://packages.debian.org/stable/utils/freecdb</ulink></emphasis>
10131 <emphasis role="bold"><ulink url="https://github.com/philpennock/cdbtools">https://github.com/philpennock/cdbtools</ulink></emphasis> (in Go)
10132 </literallayout>
10133 <para>
10134 A cdb distribution is not needed in order to build Exim with cdb support,
10135 because the code for reading cdb files is included directly in Exim itself.
10136 However, no means of building or testing cdb files is provided with Exim, so
10137 you need to obtain a cdb distribution in order to do this.
10138 </para>
10139 </listitem>
10140 <listitem>
10141 <para>
10142 <indexterm role="concept">
10143 <primary>DBM</primary>
10144 <secondary>lookup type</secondary>
10145 </indexterm>
10146 <indexterm role="concept">
10147 <primary>lookup</primary>
10148 <secondary>dbm</secondary>
10149 </indexterm>
10150 <indexterm role="concept">
10151 <primary>binary zero</primary>
10152 <secondary>in lookup key</secondary>
10153 </indexterm>
10154 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
10155 DBM file by looking up the record with the given key. A terminating binary
10156 zero is included in the key that is passed to the DBM library. See section
10157 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
10158 </para>
10159 <para>
10160 <indexterm role="concept">
10161 <primary>Berkeley DB library</primary>
10162 <secondary>file format</secondary>
10163 </indexterm>
10164 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
10165 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
10166 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
10167 the DB_UNKNOWN option. This enables it to handle any of the types of database
10168 that the library supports, and can be useful for accessing DBM files created by
10169 other applications. (For earlier DB versions, DB_HASH is always used.)
10170 </para>
10171 </listitem>
10172 <listitem>
10173 <para>
10174 <indexterm role="concept">
10175 <primary>lookup</primary>
10176 <secondary>dbmjz</secondary>
10177 </indexterm>
10178 <indexterm role="concept">
10179 <primary>lookup</primary>
10180 <secondary>dbm &ndash; embedded NULs</secondary>
10181 </indexterm>
10182 <indexterm role="concept">
10183 <primary>sasldb2</primary>
10184 </indexterm>
10185 <indexterm role="concept">
10186 <primary>dbmjz lookup type</primary>
10187 </indexterm>
10188 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
10189 interpreted as an Exim list; the elements of the list are joined together with
10190 ASCII NUL characters to form the lookup key.  An example usage would be to
10191 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
10192 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
10193 <command>cram_md5</command> authenticator.
10194 </para>
10195 </listitem>
10196 <listitem>
10197 <para>
10198 <indexterm role="concept">
10199 <primary>lookup</primary>
10200 <secondary>dbmnz</secondary>
10201 </indexterm>
10202 <indexterm role="concept">
10203 <primary>lookup</primary>
10204 <secondary>dbm &ndash; terminating zero</secondary>
10205 </indexterm>
10206 <indexterm role="concept">
10207 <primary>binary zero</primary>
10208 <secondary>in lookup key</secondary>
10209 </indexterm>
10210 <indexterm role="concept">
10211 <primary>Courier</primary>
10212 </indexterm>
10213 <indexterm role="concept">
10214 <primary><filename>/etc/userdbshadow.dat</filename></primary>
10215 </indexterm>
10216 <indexterm role="concept">
10217 <primary>dbmnz lookup type</primary>
10218 </indexterm>
10219 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
10220 is not included in the key that is passed to the DBM library. You may need this
10221 if you want to look up data in files that are created by or shared with some
10222 other application that does not use terminating zeros. For example, you need to
10223 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
10224 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
10225 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
10226 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
10227 </para>
10228 </listitem>
10229 <listitem>
10230 <para>
10231 <indexterm role="concept">
10232 <primary>lookup</primary>
10233 <secondary>dsearch</secondary>
10234 </indexterm>
10235 <indexterm role="concept">
10236 <primary>dsearch lookup type</primary>
10237 </indexterm>
10238 <command>dsearch</command>: The given file must be an
10239 </para>
10240 <para revisionflag="changed">
10241 absolute
10242 </para>
10243 <para>
10244 directory path; this is searched for an entry
10245 whose name is the key by calling the <function>lstat()</function> function.
10246 The key may not
10247 contain any forward slash characters.
10248 If <function>lstat()</function> succeeds then so does the lookup.
10249 </para>
10250 <para revisionflag="changed">
10251 <indexterm role="concept">
10252 <primary>tainted data</primary>
10253 <secondary>dsearch result</secondary>
10254 </indexterm>
10255 The result is regarded as untainted.
10256 </para>
10257 <para revisionflag="changed">
10258 Options for the lookup can be given by appending them after the word "dsearch",
10259 separated by a comma.  Options, if present, are a comma-separated list having
10260 each element starting with a tag name and an equals.
10261 </para>
10262 <para revisionflag="changed">
10263 Two options are supported, for the return value and for filtering match
10264 candidates.
10265 The "ret" option requests an alternate result value of
10266 the entire path for the entry. Example:
10267 </para>
10268 <literallayout class="monospaced" revisionflag="changed">
10269 ${lookup {passwd} dsearch,ret=full {/etc}}
10270 </literallayout>
10271 <para revisionflag="changed">
10272 The default result is just the requested entry.
10273 The "filter" option requests that only directory entries of a given type
10274 are matched. The match value is one of "file", "dir" or "subdir" (the latter
10275 not matching "." or ".."). Example:
10276 </para>
10277 <literallayout class="monospaced" revisionflag="changed">
10278 ${lookup {passwd} dsearch,filter=file {/etc}}
10279 </literallayout>
10280 <para revisionflag="changed">
10281 The default matching is for any entry type, including directories
10282 and symlinks.
10283 </para>
10284 <para>
10285 An example of how this
10286 lookup can be used to support virtual domains is given in section
10287 <xref linkend="SECTvirtualdomains"/>.
10288 </para>
10289 </listitem>
10290 <listitem>
10291 <para>
10292 <indexterm role="concept">
10293 <primary>lookup</primary>
10294 <secondary>iplsearch</secondary>
10295 </indexterm>
10296 <indexterm role="concept">
10297 <primary>iplsearch lookup type</primary>
10298 </indexterm>
10299 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
10300 terminated by a colon or white space or the end of the line. The keys in the
10301 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
10302 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
10303 being interpreted as a key terminator. For example:
10304 </para>
10305 <literallayout class="monospaced">
10306 1.2.3.4:           data for 1.2.3.4
10307 192.168.0.0/16:    data for 192.168.0.0/16
10308 "abcd::cdab":      data for abcd::cdab
10309 "abcd:abcd::/32"   data for abcd:abcd::/32
10310 </literallayout>
10311 <para>
10312 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
10313 file is searched linearly, using the CIDR masks where present, until a matching
10314 key is found. The first key that matches is used; there is no attempt to find a
10315 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
10316 <command>iplsearch</command> is the same as for <command>lsearch</command>.
10317 </para>
10318 <para>
10319 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
10320 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10321 lookup types support only literal keys.
10322 </para>
10323 <para>
10324 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
10325 the implicit key is the host&#x2019;s IP address rather than its name (see section
10326 <xref linkend="SECThoslispatsikey"/>).
10327 </para>
10328 <para>
10329 <emphasis role="bold">Warning 3</emphasis>: Do not use an IPv4-mapped IPv6 address for a key; use the
10330 IPv4, in dotted-quad form. (Exim converts IPv4-mapped IPv6 addresses to this
10331 notation before executing the lookup.)
10332 </para>
10333 </listitem>
10334 <listitem>
10335 <para>
10336 <indexterm role="concept">
10337 <primary>lookup</primary>
10338 <secondary>json</secondary>
10339 </indexterm>
10340 <indexterm role="concept">
10341 <primary>json</primary>
10342 <secondary>lookup type</secondary>
10343 </indexterm>
10344 <indexterm role="concept">
10345 <primary>JSON</primary>
10346 <secondary>expansions</secondary>
10347 </indexterm>
10348 <command>json</command>: The given file is a text file with a JSON structure.
10349 An element of the structure is extracted, defined by the search key.
10350 The key is a list of subelement selectors
10351 (colon-separated by default but changeable in the usual way)
10352 which are applied in turn to select smaller and smaller portions
10353 of the JSON structure.
10354 If a selector is numeric, it must apply to a JSON array; the (zero-based)
10355 nunbered array element is selected.
10356 Otherwise it must apply to a JSON object; the named element is selected.
10357 The final resulting element can be a simple JSON type or a JSON object
10358 or array; for the latter two a string-representation of the JSON
10359 is returned.
10360 For elements of type string, the returned value is de-quoted.
10361 </para>
10362 </listitem>
10363 <listitem>
10364 <para>
10365 <indexterm role="concept">
10366 <primary>linear search</primary>
10367 </indexterm>
10368 <indexterm role="concept">
10369 <primary>lookup</primary>
10370 <secondary>lsearch</secondary>
10371 </indexterm>
10372 <indexterm role="concept">
10373 <primary>lsearch lookup type</primary>
10374 </indexterm>
10375 <indexterm role="concept">
10376 <primary>case sensitivity</primary>
10377 <secondary>in lsearch lookup</secondary>
10378 </indexterm>
10379 <command>lsearch</command>: The given file is a text file that is searched linearly for a
10380 line beginning with the search key, terminated by a colon or white space or the
10381 end of the line. The search is case-insensitive; that is, upper and lower case
10382 letters are treated as the same. The first occurrence of the key that is found
10383 in the file is used.
10384 </para>
10385 <para>
10386 White space between the key and the colon is permitted. The remainder of the
10387 line, with leading and trailing white space removed, is the data. This can be
10388 continued onto subsequent lines by starting them with any amount of white
10389 space, but only a single space character is included in the data at such a
10390 junction. If the data begins with a colon, the key must be terminated by a
10391 colon, for example:
10392 </para>
10393 <literallayout class="monospaced">
10394 baduser:  :fail:
10395 </literallayout>
10396 <para>
10397 Empty lines and lines beginning with # are ignored, even if they occur in the
10398 middle of an item. This is the traditional textual format of alias files. Note
10399 that the keys in an <command>lsearch</command> file are literal strings. There is no
10400 wildcarding of any kind.
10401 </para>
10402 <para>
10403 <indexterm role="concept">
10404 <primary>lookup</primary>
10405 <secondary>lsearch &ndash; colons in keys</secondary>
10406 </indexterm>
10407 <indexterm role="concept">
10408 <primary>white space</primary>
10409 <secondary>in lsearch key</secondary>
10410 </indexterm>
10411 In most <command>lsearch</command> files, keys are not required to contain colons or #
10412 characters, or white space. However, if you need this feature, it is available.
10413 If a key begins with a doublequote character, it is terminated only by a
10414 matching quote (or end of line), and the normal escaping rules apply to its
10415 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
10416 quoted keys (exactly as for unquoted keys). There is no special handling of
10417 quotes for the data part of an <command>lsearch</command> line.
10418 </para>
10419 </listitem>
10420 <listitem>
10421 <para>
10422 <indexterm role="concept">
10423 <primary>NIS lookup type</primary>
10424 </indexterm>
10425 <indexterm role="concept">
10426 <primary>lookup</primary>
10427 <secondary>NIS</secondary>
10428 </indexterm>
10429 <indexterm role="concept">
10430 <primary>binary zero</primary>
10431 <secondary>in lookup key</secondary>
10432 </indexterm>
10433 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
10434 the given key, without a terminating binary zero. There is a variant called
10435 <command>nis0</command> which does include the terminating binary zero in the key. This is
10436 reportedly needed for Sun-style alias files. Exim does not recognize NIS
10437 aliases; the full map names must be used.
10438 </para>
10439 </listitem>
10440 <listitem>
10441 <para>
10442 <indexterm role="concept">
10443 <primary>wildlsearch lookup type</primary>
10444 </indexterm>
10445 <indexterm role="concept">
10446 <primary>lookup</primary>
10447 <secondary>wildlsearch</secondary>
10448 </indexterm>
10449 <indexterm role="concept">
10450 <primary>nwildlsearch lookup type</primary>
10451 </indexterm>
10452 <indexterm role="concept">
10453 <primary>lookup</primary>
10454 <secondary>nwildlsearch</secondary>
10455 </indexterm>
10456 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
10457 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
10458 the file may be wildcarded. The difference between these two lookup types is
10459 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
10460 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
10461 </para>
10462 <para>
10463 <indexterm role="concept">
10464 <primary>case sensitivity</primary>
10465 <secondary>in (n)wildlsearch lookup</secondary>
10466 </indexterm>
10467 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
10468 file that are regular expressions can be made case-sensitive by the use of
10469 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
10470 </para>
10471 <orderedlist numeration="arabic">
10472 <listitem>
10473 <para>
10474 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
10475 </para>
10476 <literallayout class="monospaced">
10477     *.a.b.c       data for anything.a.b.c
10478     *fish         data for anythingfish
10479 </literallayout>
10480 </listitem>
10481 <listitem>
10482 <para>
10483 The string may begin with a circumflex to indicate a regular expression. For
10484 example, for <command>wildlsearch</command>:
10485 </para>
10486 <literallayout class="monospaced">
10487     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10488 </literallayout>
10489 <para>
10490 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10491 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10492 string-expanded, the equivalent entry is:
10493 </para>
10494 <literallayout class="monospaced">
10495     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10496 </literallayout>
10497 <para>
10498 The case-insensitive flag is set at the start of compiling the regular
10499 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10500 For example, to make the entire pattern case-sensitive:
10501 </para>
10502 <literallayout class="monospaced">
10503     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10504 </literallayout>
10505 <para>
10506 If the regular expression contains white space or colon characters, you must
10507 either quote it (see <command>lsearch</command> above), or represent these characters in other
10508 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10509 colon. This may be easier than quoting, because if you quote, you have to
10510 escape all the backslashes inside the quotes.
10511 </para>
10512 <para>
10513 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10514 match for later use, because the results of all lookups are cached. If a lookup
10515 is repeated, the result is taken from the cache, and no actual pattern matching
10516 takes place. The values of all the numeric variables are unset after a
10517 <command>(n)wildlsearch</command> match.
10518 </para>
10519 </listitem>
10520 <listitem>
10521 <para>
10522 Although I cannot see it being of much use, the general matching function that
10523 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10524 lookup name terminated by a semicolon, and followed by lookup data. For
10525 example:
10526 </para>
10527 <literallayout class="monospaced">
10528     cdb;/some/file  data for keys that match the file
10529 </literallayout>
10530 <para>
10531 The data that is obtained from the nested lookup is discarded.
10532 </para>
10533 </listitem>
10534 </orderedlist>
10535 <para>
10536 Keys that do not match any of these patterns are interpreted literally. The
10537 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10538 be followed by optional colons.
10539 </para>
10540 <para>
10541 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10542 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10543 lookup types support only literal keys.
10544 </para>
10545 </listitem>
10546 <listitem>
10547 <para>
10548 <indexterm role="concept">
10549 <primary>spf lookup type</primary>
10550 </indexterm>
10551 <indexterm role="concept">
10552 <primary>lookup</primary>
10553 <secondary>spf</secondary>
10554 </indexterm>
10555 <command>spf</command>: If Exim is built with SPF support, manual lookups can be done
10556 (as opposed to the standard ACL condition method).
10557 For details see section <xref linkend="SECSPF"/>.
10558 </para>
10559 </listitem>
10560 </itemizedlist>
10561 </section>
10562 <section id="SECTquerystylelookups">
10563 <title>Query-style lookup types</title>
10564 <para>
10565 <indexterm role="concept">
10566 <primary>lookup</primary>
10567 <secondary>query-style types</secondary>
10568 </indexterm>
10569 <indexterm role="concept">
10570 <primary>query-style lookup</primary>
10571 <secondary>list of types</secondary>
10572 </indexterm>
10573 The supported query-style lookup types are listed below. Further details about
10574 many of them are given in later sections.
10575 </para>
10576 <itemizedlist>
10577 <listitem>
10578 <para>
10579 <indexterm role="concept">
10580 <primary>DNS</primary>
10581 <secondary>as a lookup type</secondary>
10582 </indexterm>
10583 <indexterm role="concept">
10584 <primary>lookup</primary>
10585 <secondary>DNS</secondary>
10586 </indexterm>
10587 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10588 are given in the supplied query. The resulting data is the contents of the
10589 records. See section <xref linkend="SECTdnsdb"/>.
10590 </para>
10591 </listitem>
10592 <listitem>
10593 <para>
10594 <indexterm role="concept">
10595 <primary>InterBase lookup type</primary>
10596 </indexterm>
10597 <indexterm role="concept">
10598 <primary>lookup</primary>
10599 <secondary>InterBase</secondary>
10600 </indexterm>
10601 <command>ibase</command>: This does a lookup in an InterBase database.
10602 </para>
10603 </listitem>
10604 <listitem>
10605 <para>
10606 <indexterm role="concept">
10607 <primary>LDAP</primary>
10608 <secondary>lookup type</secondary>
10609 </indexterm>
10610 <indexterm role="concept">
10611 <primary>lookup</primary>
10612 <secondary>LDAP</secondary>
10613 </indexterm>
10614 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10615 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10616 that permits values from multiple entries to be returned. A third variant
10617 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10618 any attribute values. See section <xref linkend="SECTldap"/>.
10619 </para>
10620 </listitem>
10621 <listitem>
10622 <para>
10623 <indexterm role="concept">
10624 <primary>MySQL</primary>
10625 <secondary>lookup type</secondary>
10626 </indexterm>
10627 <indexterm role="concept">
10628 <primary>lookup</primary>
10629 <secondary>MySQL</secondary>
10630 </indexterm>
10631 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10632 MySQL database. See section <xref linkend="SECTsql"/>.
10633 </para>
10634 </listitem>
10635 <listitem>
10636 <para>
10637 <indexterm role="concept">
10638 <primary>NIS+ lookup type</primary>
10639 </indexterm>
10640 <indexterm role="concept">
10641 <primary>lookup</primary>
10642 <secondary>NIS+</secondary>
10643 </indexterm>
10644 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10645 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10646 </para>
10647 </listitem>
10648 <listitem>
10649 <para>
10650 <indexterm role="concept">
10651 <primary>Oracle</primary>
10652 <secondary>lookup type</secondary>
10653 </indexterm>
10654 <indexterm role="concept">
10655 <primary>lookup</primary>
10656 <secondary>Oracle</secondary>
10657 </indexterm>
10658 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
10659 Oracle database. See section <xref linkend="SECTsql"/>.
10660 </para>
10661 </listitem>
10662 <listitem>
10663 <para>
10664 <indexterm role="concept">
10665 <primary>lookup</primary>
10666 <secondary>passwd</secondary>
10667 </indexterm>
10668 <indexterm role="concept">
10669 <primary>passwd lookup type</primary>
10670 </indexterm>
10671 <indexterm role="concept">
10672 <primary><filename>/etc/passwd</filename></primary>
10673 </indexterm>
10674 <command>passwd</command> is a query-style lookup with queries that are just user names. The
10675 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
10676 success, the result string is the same as you would get from an <command>lsearch</command>
10677 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
10678 password value. For example:
10679 </para>
10680 <literallayout class="monospaced">
10681 *:42:42:King Rat:/home/kr:/bin/bash
10682 </literallayout>
10683 </listitem>
10684 <listitem>
10685 <para>
10686 <indexterm role="concept">
10687 <primary>PostgreSQL lookup type</primary>
10688 </indexterm>
10689 <indexterm role="concept">
10690 <primary>lookup</primary>
10691 <secondary>PostgreSQL</secondary>
10692 </indexterm>
10693 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
10694 PostgreSQL database. See section <xref linkend="SECTsql"/>.
10695 </para>
10696 </listitem>
10697 <listitem>
10698 <para>
10699 <indexterm role="concept">
10700 <primary>Redis lookup type</primary>
10701 </indexterm>
10702 <indexterm role="concept">
10703 <primary>lookup</primary>
10704 <secondary>Redis</secondary>
10705 </indexterm>
10706 <command>redis</command>: The format of the query is either a simple get or simple set,
10707 passed to a Redis database. See section <xref linkend="SECTsql"/>.
10708 </para>
10709 </listitem>
10710 <listitem>
10711 <para>
10712 <indexterm role="concept">
10713 <primary>sqlite lookup type</primary>
10714 </indexterm>
10715 <indexterm role="concept">
10716 <primary>lookup</primary>
10717 <secondary>sqlite</secondary>
10718 </indexterm>
10719 <command>sqlite</command>: The format of the query is
10720 new
10721 an optional filename
10722 </para>
10723 <para>
10724 followed by an SQL statement
10725 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
10726 </para>
10727 </listitem>
10728 <listitem>
10729 <para>
10730 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
10731 not likely to be useful in normal operation.
10732 </para>
10733 </listitem>
10734 <listitem>
10735 <para>
10736 <indexterm role="concept">
10737 <primary>whoson lookup type</primary>
10738 </indexterm>
10739 <indexterm role="concept">
10740 <primary>lookup</primary>
10741 <secondary>whoson</secondary>
10742 </indexterm>
10743 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a protocol that
10744 allows a server to check whether a particular (dynamically allocated) IP
10745 address is currently allocated to a known (trusted) user and, optionally, to
10746 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
10747 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
10748 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
10749 <quote>POP before SMTP</quote> checking using ACL statements such as
10750 </para>
10751 <literallayout class="monospaced">
10752 require condition = \
10753   ${lookup whoson {$sender_host_address}{yes}{no}}
10754 </literallayout>
10755 <para>
10756 The query consists of a single IP address. The value returned is the name of
10757 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
10758 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
10759 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
10760 </para>
10761 </listitem>
10762 </itemizedlist>
10763 </section>
10764 <section id="SECID63">
10765 <title>Temporary errors in lookups</title>
10766 <para>
10767 <indexterm role="concept">
10768 <primary>lookup</primary>
10769 <secondary>temporary error in</secondary>
10770 </indexterm>
10771 Lookup functions can return temporary error codes if the lookup cannot be
10772 completed. For example, an SQL or LDAP database might be unavailable. For this
10773 reason, it is not advisable to use a lookup that might do this for critical
10774 options such as a list of local domains.
10775 </para>
10776 <para>
10777 When a lookup cannot be completed in a router or transport, delivery
10778 of the message (to the relevant address) is deferred, as for any other
10779 temporary error. In other circumstances Exim may assume the lookup has failed,
10780 or may give up altogether.
10781 </para>
10782 </section>
10783 <section id="SECTdefaultvaluelookups">
10784 <title>Default values in single-key lookups</title>
10785 <para>
10786 <indexterm role="concept">
10787 <primary>wildcard lookups</primary>
10788 </indexterm>
10789 <indexterm role="concept">
10790 <primary>lookup</primary>
10791 <secondary>default values</secondary>
10792 </indexterm>
10793 <indexterm role="concept">
10794 <primary>lookup</primary>
10795 <secondary>wildcard</secondary>
10796 </indexterm>
10797 <indexterm role="concept">
10798 <primary>lookup</primary>
10799 <secondary>* added to type</secondary>
10800 </indexterm>
10801 <indexterm role="concept">
10802 <primary>default</primary>
10803 <secondary>in single-key lookups</secondary>
10804 </indexterm>
10805 In this context, a <quote>default value</quote> is a value specified by the administrator
10806 that is to be used if a lookup fails.
10807 </para>
10808 <para>
10809 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
10810 lookups, the facilities of the query language must be used. An attempt to
10811 specify a default for a query-style lookup provokes an error.
10812 </para>
10813 <para>
10814 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
10815 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
10816 provide a default value. See also the section on partial matching below.
10817 </para>
10818 <para>
10819 <indexterm role="concept">
10820 <primary>*@ with single-key lookup</primary>
10821 </indexterm>
10822 <indexterm role="concept">
10823 <primary>lookup</primary>
10824 <secondary>*@ added to type</secondary>
10825 </indexterm>
10826 <indexterm role="concept">
10827 <primary>alias file</primary>
10828 <secondary>per-domain default</secondary>
10829 </indexterm>
10830 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
10831 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
10832 character, a second lookup is done with everything before the last @ replaced
10833 by *. This makes it possible to provide per-domain defaults in alias files
10834 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
10835 take place because there is no @ in the key), <quote>*</quote> is looked up.
10836 For example, a <command>redirect</command> router might contain:
10837 </para>
10838 <literallayout class="monospaced">
10839 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
10840 </literallayout>
10841 <para>
10842 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
10843 looks up these keys, in this order:
10844 </para>
10845 <literallayout class="monospaced">
10846 jane@eyre.example
10847 *@eyre.example
10848 *
10849 </literallayout>
10850 <para>
10851 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
10852 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
10853 complete scan is done for each key, and only if it is not found at all does
10854 Exim move on to try the next key.
10855 </para>
10856 </section>
10857 <section id="SECTpartiallookup">
10858 <title>Partial matching in single-key lookups</title>
10859 <para>
10860 <indexterm role="concept">
10861 <primary>partial matching</primary>
10862 </indexterm>
10863 <indexterm role="concept">
10864 <primary>wildcard lookups</primary>
10865 </indexterm>
10866 <indexterm role="concept">
10867 <primary>lookup</primary>
10868 <secondary>partial matching</secondary>
10869 </indexterm>
10870 <indexterm role="concept">
10871 <primary>lookup</primary>
10872 <secondary>wildcard</secondary>
10873 </indexterm>
10874 <indexterm role="concept">
10875 <primary>asterisk</primary>
10876 <secondary>in search type</secondary>
10877 </indexterm>
10878 The normal operation of a single-key lookup is to search the file for an exact
10879 match with the given key. However, in a number of situations where domains are
10880 being looked up, it is useful to be able to do partial matching. In this case,
10881 information in the file that has a key starting with <quote>*.</quote> is matched by any
10882 domain that ends with the components that follow the full stop. For example, if
10883 a key in a DBM file is
10884 </para>
10885 <literallayout class="monospaced">
10886 *.dates.fict.example
10887 </literallayout>
10888 <para>
10889 then when partial matching is enabled this is matched by (amongst others)
10890 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
10891 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
10892 file.
10893 </para>
10894 <para>
10895 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
10896 also not available for any lookup items in address lists (see section
10897 <xref linkend="SECTaddresslist"/>).
10898 </para>
10899 <para>
10900 Partial matching is implemented by doing a series of separate lookups using
10901 keys constructed by modifying the original subject key. This means that it can
10902 be used with any of the single-key lookup types, provided that
10903 partial matching keys
10904 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
10905 Keys in the file that do not begin with the prefix are matched only by
10906 unmodified subject keys when partial matching is in use.
10907 </para>
10908 <para>
10909 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
10910 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
10911 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
10912 is added at the start of the subject key, and it is looked up again. If that
10913 fails, further lookups are tried with dot-separated components removed from the
10914 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
10915 remains.
10916 </para>
10917 <para>
10918 A minimum number of two non-* components are required. This can be adjusted
10919 by including a number before the hyphen in the search type. For example,
10920 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
10921 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
10922 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
10923 up when the minimum number of non-* components is two:
10924 </para>
10925 <literallayout class="monospaced">
10926 2250.dates.fict.example
10927 *.2250.dates.fict.example
10928 *.dates.fict.example
10929 *.fict.example
10930 </literallayout>
10931 <para>
10932 As soon as one key in the sequence is successfully looked up, the lookup
10933 finishes.
10934 </para>
10935 <para>
10936 <indexterm role="concept">
10937 <primary>lookup</primary>
10938 <secondary>partial matching &ndash; changing prefix</secondary>
10939 </indexterm>
10940 <indexterm role="concept">
10941 <primary>prefix</primary>
10942 <secondary>for partial matching</secondary>
10943 </indexterm>
10944 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
10945 changed. The motivation for this feature is to allow Exim to operate with file
10946 formats that are used by other MTAs. A different prefix can be supplied in
10947 parentheses instead of the hyphen after <quote>partial</quote>. For example:
10948 </para>
10949 <literallayout class="monospaced">
10950 domains = partial(.)lsearch;/some/file
10951 </literallayout>
10952 <para>
10953 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10954 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
10955 components is unchanged). The prefix may consist of any punctuation characters
10956 other than a closing parenthesis. It may be empty, for example:
10957 </para>
10958 <literallayout class="monospaced">
10959 domains = partial1()cdb;/some/file
10960 </literallayout>
10961 <para>
10962 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
10963 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
10964 </para>
10965 <para>
10966 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
10967 just one non-wild component has failed, and the original key is shortened right
10968 down to the null string) depends on the prefix:
10969 </para>
10970 <itemizedlist>
10971 <listitem>
10972 <para>
10973 If the prefix has zero length, the whole lookup fails.
10974 </para>
10975 </listitem>
10976 <listitem>
10977 <para>
10978 If the prefix has length 1, a lookup for just the prefix is done. For
10979 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
10980 </para>
10981 </listitem>
10982 <listitem>
10983 <para>
10984 Otherwise, if the prefix ends in a dot, the dot is removed, and the
10985 remainder is looked up. With the default prefix, therefore, the final lookup is
10986 for <quote>*</quote> on its own.
10987 </para>
10988 </listitem>
10989 <listitem>
10990 <para>
10991 Otherwise, the whole prefix is looked up.
10992 </para>
10993 </listitem>
10994 </itemizedlist>
10995 <para>
10996 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
10997 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
10998 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
10999 specified, adding <quote>*</quote> to the search type has no effect with the default
11000 prefix, because the <quote>*</quote> key is already included in the sequence of partial
11001 lookups. However, there might be a use for lookup types such as
11002 <quote>partial0(.)lsearch*</quote>.
11003 </para>
11004 <para>
11005 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
11006 in domain lists and the like. Partial matching works only in terms of
11007 dot-separated components; a key such as <literal>*fict.example</literal>
11008 in a database file is useless, because the asterisk in a partial matching
11009 subject key is always followed by a dot.
11010 </para>
11011 </section>
11012 <section id="SECID64">
11013 <title>Lookup caching</title>
11014 <para>
11015 <indexterm role="concept">
11016 <primary>lookup</primary>
11017 <secondary>caching</secondary>
11018 </indexterm>
11019 <indexterm role="concept">
11020 <primary>caching</primary>
11021 <secondary>lookup data</secondary>
11022 </indexterm>
11023 Exim caches all lookup results in order to avoid needless repetition of
11024 lookups. However, because (apart from the daemon) Exim operates as a collection
11025 of independent, short-lived processes, this caching applies only within a
11026 single Exim process. There is no inter-process lookup caching facility.
11027 </para>
11028 <para>
11029 For single-key lookups, Exim keeps the relevant files open in case there is
11030 another lookup that needs them. In some types of configuration this can lead to
11031 many files being kept open for messages with many recipients. To avoid hitting
11032 the operating system limit on the number of simultaneously open files, Exim
11033 closes the least recently used file when it needs to open more files than its
11034 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
11035 </para>
11036 <para>
11037 The single-key lookup files are closed and the lookup caches are flushed at
11038 strategic points during delivery &ndash; for example, after all routing is
11039 complete.
11040 </para>
11041 </section>
11042 <section id="SECID65">
11043 <title>Quoting lookup data</title>
11044 <para>
11045 <indexterm role="concept">
11046 <primary>lookup</primary>
11047 <secondary>quoting</secondary>
11048 </indexterm>
11049 <indexterm role="concept">
11050 <primary>quoting</primary>
11051 <secondary>in lookups</secondary>
11052 </indexterm>
11053 When data from an incoming message is included in a query-style lookup, there
11054 is the possibility of special characters in the data messing up the syntax of
11055 the query. For example, a NIS+ query that contains
11056 </para>
11057 <literallayout class="monospaced">
11058 [name=$local_part]
11059 </literallayout>
11060 <para>
11061 will be broken if the local part happens to contain a closing square bracket.
11062 For NIS+, data can be enclosed in double quotes like this:
11063 </para>
11064 <literallayout class="monospaced">
11065 [name="$local_part"]
11066 </literallayout>
11067 <para>
11068 but this still leaves the problem of a double quote in the data. The rule for
11069 NIS+ is that double quotes must be doubled. Other lookup types have different
11070 rules, and to cope with the differing requirements, an expansion operator
11071 of the following form is provided:
11072 </para>
11073 <literallayout class="monospaced">
11074 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
11075 </literallayout>
11076 <para>
11077 For example, the safest way to write the NIS+ query is
11078 </para>
11079 <literallayout class="monospaced">
11080 [name="${quote_nisplus:$local_part}"]
11081 </literallayout>
11082 <para>
11083 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
11084 operator can be used for all lookup types, but has no effect for single-key
11085 lookups, since no quoting is ever needed in their key strings.
11086 </para>
11087 </section>
11088 <section id="SECTdnsdb">
11089 <title>More about dnsdb</title>
11090 <para>
11091 <indexterm role="concept">
11092 <primary>dnsdb lookup</primary>
11093 </indexterm>
11094 <indexterm role="concept">
11095 <primary>lookup</primary>
11096 <secondary>dnsdb</secondary>
11097 </indexterm>
11098 <indexterm role="concept">
11099 <primary>DNS</primary>
11100 <secondary>as a lookup type</secondary>
11101 </indexterm>
11102 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
11103 of a record type and a domain name, separated by an equals sign. For example,
11104 an expansion string could contain:
11105 </para>
11106 <literallayout class="monospaced">
11107 ${lookup dnsdb{mx=a.b.example}{$value}fail}
11108 </literallayout>
11109 <para>
11110 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
11111 is used on its own as the result. If the lookup does not succeed, the
11112 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
11113 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
11114 </para>
11115 <para>
11116 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
11117 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
11118 If no type is given, TXT is assumed.
11119 </para>
11120 <para>
11121 For any record type, if multiple records are found, the data is returned as a
11122 concatenation, with newline as the default separator. The order, of course,
11123 depends on the DNS resolver. You can specify a different separator character
11124 between multiple records by putting a right angle-bracket followed immediately
11125 by the new separator at the start of the query. For example:
11126 </para>
11127 <literallayout class="monospaced">
11128 ${lookup dnsdb{&gt;: a=host1.example}}
11129 </literallayout>
11130 <para>
11131 It is permitted to specify a space as the separator character. Further
11132 white space is ignored.
11133 For lookup types that return multiple fields per record,
11134 an alternate field separator can be specified using a comma after the main
11135 separator character, followed immediately by the field separator.
11136 </para>
11137 <para>
11138 <indexterm role="concept">
11139 <primary>PTR record</primary>
11140 <secondary>in <command>dnsdb</command> lookup</secondary>
11141 </indexterm>
11142 When the type is PTR,
11143 the data can be an IP address, written as normal; inversion and the addition of
11144 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
11145 </para>
11146 <literallayout class="monospaced">
11147 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
11148 </literallayout>
11149 <para>
11150 If the data for a PTR record is not a syntactically valid IP address, it is not
11151 altered and nothing is added.
11152 </para>
11153 <para>
11154 <indexterm role="concept">
11155 <primary>MX record</primary>
11156 <secondary>in <command>dnsdb</command> lookup</secondary>
11157 </indexterm>
11158 <indexterm role="concept">
11159 <primary>SRV record</primary>
11160 <secondary>in <command>dnsdb</command> lookup</secondary>
11161 </indexterm>
11162 For an MX lookup, both the preference value and the host name are returned for
11163 each record, separated by a space. For an SRV lookup, the priority, weight,
11164 port, and host name are returned for each record, separated by spaces.
11165 The field separator can be modified as above.
11166 </para>
11167 <para>
11168 <indexterm role="concept">
11169 <primary>TXT record</primary>
11170 <secondary>in <command>dnsdb</command> lookup</secondary>
11171 </indexterm>
11172 <indexterm role="concept">
11173 <primary>SPF record</primary>
11174 <secondary>in <command>dnsdb</command> lookup</secondary>
11175 </indexterm>
11176 For TXT records with multiple items of data, only the first item is returned,
11177 unless a field separator is specified.
11178 To concatenate items without a separator, use a semicolon instead.
11179 For SPF records the
11180 default behaviour is to concatenate multiple items without using a separator.
11181 </para>
11182 <literallayout class="monospaced">
11183 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
11184 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
11185 ${lookup dnsdb{spf=example.org}}
11186 </literallayout>
11187 <para>
11188 It is permitted to specify a space as the separator character. Further
11189 white space is ignored.
11190 </para>
11191 <para>
11192 <indexterm role="concept">
11193 <primary>SOA record</primary>
11194 <secondary>in <command>dnsdb</command> lookup</secondary>
11195 </indexterm>
11196 For an SOA lookup, while no result is obtained the lookup is redone with
11197 successively more leading components dropped from the given domain.
11198 Only the primary-nameserver field is returned unless a field separator is
11199 specified.
11200 </para>
11201 <literallayout class="monospaced">
11202 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
11203 </literallayout>
11204 </section>
11205 <section id="SECTdnsdb_mod">
11206 <title>Dnsdb lookup modifiers</title>
11207 <para>
11208 <indexterm role="concept">
11209 <primary>dnsdb modifiers</primary>
11210 </indexterm>
11211 <indexterm role="concept">
11212 <primary>modifiers</primary>
11213 <secondary>dnsdb</secondary>
11214 </indexterm>
11215 <indexterm role="concept">
11216 <primary>options</primary>
11217 <secondary>dnsdb</secondary>
11218 </indexterm>
11219 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
11220 each followed by a comma,
11221 that may appear before the record type.
11222 </para>
11223 <para>
11224 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
11225 temporary DNS error for any of them, the behaviour is controlled by
11226 a defer-option modifier.
11227 The possible keywords are
11228 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
11229 With <quote>strict</quote> behaviour, any temporary DNS error causes the
11230 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
11231 ignored, and the behaviour is as if the DNS lookup failed to find anything.
11232 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
11233 error causes the whole lookup to defer only if none of the other lookups
11234 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
11235 </para>
11236 <literallayout class="monospaced">
11237 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
11238 ${lookup dnsdb{a=one.host.com:two.host.com}}
11239 </literallayout>
11240 <para>
11241 Thus, in the default case, as long as at least one of the DNS lookups
11242 yields some data, the lookup succeeds.
11243 </para>
11244 <para>
11245 <indexterm role="concept">
11246 <primary>DNSSEC</primary>
11247 <secondary>dns lookup</secondary>
11248 </indexterm>
11249 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
11250 The possible keywords are
11251 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
11252 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
11253 with the lookup.
11254 With <quote>strict</quote> a response from the DNS resolver that
11255 is not labelled as authenticated data
11256 is treated as equivalent to a temporary DNS error.
11257 The default is <quote>lax</quote>.
11258 </para>
11259 <para>
11260 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
11261 </para>
11262 <para>
11263 <indexterm role="concept">
11264 <primary>timeout</primary>
11265 <secondary>dns lookup</secondary>
11266 </indexterm>
11267 <indexterm role="concept">
11268 <primary>DNS</primary>
11269 <secondary>timeout</secondary>
11270 </indexterm>
11271 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
11272 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
11273 (e.g. <quote>5s</quote>).
11274 The default value is set by the main configuration option <option>dns_retrans</option>.
11275 </para>
11276 <para>
11277 Retries for the dnsdb lookup can be controlled by a retry modifier.
11278 The form if <quote>retry_VAL</quote> where VAL is an integer.
11279 The default count is set by the main configuration option <option>dns_retry</option>.
11280 </para>
11281 <para>
11282 <indexterm role="concept">
11283 <primary>caching</primary>
11284 <secondary>of dns lookup</secondary>
11285 </indexterm>
11286 <indexterm role="concept">
11287 <primary>TTL</primary>
11288 <secondary>of dns lookup</secondary>
11289 </indexterm>
11290 <indexterm role="concept">
11291 <primary>DNS</primary>
11292 <secondary>TTL</secondary>
11293 </indexterm>
11294 Dnsdb lookup results are cached within a single process (and its children).
11295 The cache entry lifetime is limited to the smallest time-to-live (TTL)
11296 value of the set of returned DNS records.
11297 </para>
11298 </section>
11299 <section id="SECID66">
11300 <title>Pseudo dnsdb record types</title>
11301 <para>
11302 <indexterm role="concept">
11303 <primary>MX record</primary>
11304 <secondary>in <command>dnsdb</command> lookup</secondary>
11305 </indexterm>
11306 By default, both the preference value and the host name are returned for
11307 each MX record, separated by a space. If you want only host names, you can use
11308 the pseudo-type MXH:
11309 </para>
11310 <literallayout class="monospaced">
11311 ${lookup dnsdb{mxh=a.b.example}}
11312 </literallayout>
11313 <para>
11314 In this case, the preference values are omitted, and just the host names are
11315 returned.
11316 </para>
11317 <para>
11318 <indexterm role="concept">
11319 <primary>name server for enclosing domain</primary>
11320 </indexterm>
11321 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
11322 records on the given domain, but if none are found, it removes the first
11323 component of the domain name, and tries again. This process continues until NS
11324 records are found or there are no more components left (or there is a DNS
11325 error). In other words, it may return the name servers for a top-level domain,
11326 but it never returns the root name servers. If there are no NS records for the
11327 top-level domain, the lookup fails. Consider these examples:
11328 </para>
11329 <literallayout class="monospaced">
11330 ${lookup dnsdb{zns=xxx.quercite.com}}
11331 ${lookup dnsdb{zns=xxx.edu}}
11332 </literallayout>
11333 <para>
11334 Assuming that in each case there are no NS records for the full domain name,
11335 the first returns the name servers for <option>quercite.com</option>, and the second returns
11336 the name servers for <option>edu</option>.
11337 </para>
11338 <para>
11339 You should be careful about how you use this lookup because, unless the
11340 top-level domain does not exist, the lookup always returns some host names. The
11341 sort of use to which this might be put is for seeing if the name servers for a
11342 given domain are on a blacklist. You can probably assume that the name servers
11343 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
11344 such a list.
11345 </para>
11346 <para>
11347 <indexterm role="concept">
11348 <primary>CSA</primary>
11349 <secondary>in <command>dnsdb</command> lookup</secondary>
11350 </indexterm>
11351 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
11352 records according to the CSA rules, which are described in section
11353 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
11354 not sufficient because of the extra parent domain search behaviour of CSA. The
11355 result of a successful lookup such as:
11356 </para>
11357 <literallayout class="monospaced">
11358 ${lookup dnsdb {csa=$sender_helo_name}}
11359 </literallayout>
11360 <para>
11361 has two space-separated fields: an authorization code and a target host name.
11362 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
11363 authorization required but absent, or <quote>?</quote> for unknown.
11364 </para>
11365 <para>
11366 <indexterm role="concept">
11367 <primary>A+</primary>
11368 <secondary>in <command>dnsdb</command> lookup</secondary>
11369 </indexterm>
11370 The pseudo-type A+ performs an AAAA
11371 and then an A lookup.  All results are returned; defer processing
11372 (see below) is handled separately for each lookup.  Example:
11373 </para>
11374 <literallayout class="monospaced">
11375 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
11376 </literallayout>
11377 </section>
11378 <section id="SECID67">
11379 <title>Multiple dnsdb lookups</title>
11380 <para>
11381 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
11382 However, you can specify a list of domains or IP addresses in a single
11383 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
11384 the default separator, but with the ability to change this. For example:
11385 </para>
11386 <literallayout class="monospaced">
11387 ${lookup dnsdb{one.domain.com:two.domain.com}}
11388 ${lookup dnsdb{a=one.host.com:two.host.com}}
11389 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
11390 </literallayout>
11391 <para>
11392 In order to retain backwards compatibility, there is one special case: if
11393 the lookup type is PTR and no change of separator is specified, Exim looks
11394 to see if the rest of the string is precisely one IPv6 address. In this
11395 case, it does not treat it as a list.
11396 </para>
11397 <para>
11398 The data from each lookup is concatenated, with newline separators by default,
11399 in the same way that multiple DNS records for a single item are handled. A
11400 different separator can be specified, as described above.
11401 </para>
11402 </section>
11403 <section id="SECTldap">
11404 <title>More about LDAP</title>
11405 <para>
11406 <indexterm role="concept">
11407 <primary>LDAP</primary>
11408 <secondary>lookup, more about</secondary>
11409 </indexterm>
11410 <indexterm role="concept">
11411 <primary>lookup</primary>
11412 <secondary>LDAP</secondary>
11413 </indexterm>
11414 <indexterm role="concept">
11415 <primary>Solaris</primary>
11416 <secondary>LDAP</secondary>
11417 </indexterm>
11418 The original LDAP implementation came from the University of Michigan; this has
11419 become <quote>Open LDAP</quote>, and there are now two different releases. Another
11420 implementation comes from Netscape, and Solaris 7 and subsequent releases
11421 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
11422 the lookup function level, their error handling is different. For this reason
11423 it is necessary to set a compile-time variable when building Exim with LDAP, to
11424 indicate which LDAP library is in use. One of the following should appear in
11425 your <filename>Local/Makefile</filename>:
11426 </para>
11427 <literallayout class="monospaced">
11428 LDAP_LIB_TYPE=UMICHIGAN
11429 LDAP_LIB_TYPE=OPENLDAP1
11430 LDAP_LIB_TYPE=OPENLDAP2
11431 LDAP_LIB_TYPE=NETSCAPE
11432 LDAP_LIB_TYPE=SOLARIS
11433 </literallayout>
11434 <para>
11435 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
11436 same interface as the University of Michigan version.
11437 </para>
11438 <para>
11439 There are three LDAP lookup types in Exim. These behave slightly differently in
11440 the way they handle the results of a query:
11441 </para>
11442 <itemizedlist>
11443 <listitem>
11444 <para>
11445 <command>ldap</command> requires the result to contain just one entry; if there are more, it
11446 gives an error.
11447 </para>
11448 </listitem>
11449 <listitem>
11450 <para>
11451 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
11452 Distinguished Name that is returned rather than any attribute values.
11453 </para>
11454 </listitem>
11455 <listitem>
11456 <para>
11457 <command>ldapm</command> permits the result to contain more than one entry; the attributes
11458 from all of them are returned.
11459 </para>
11460 </listitem>
11461 </itemizedlist>
11462 <para>
11463 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
11464 Exim behaves as if the entry did not exist, and the lookup fails. The format of
11465 the data returned by a successful lookup is described in the next section.
11466 First we explain how LDAP queries are coded.
11467 </para>
11468 </section>
11469 <section id="SECTforldaque">
11470 <title>Format of LDAP queries</title>
11471 <para>
11472 <indexterm role="concept">
11473 <primary>LDAP</primary>
11474 <secondary>query format</secondary>
11475 </indexterm>
11476 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
11477 the configuration of a <command>redirect</command> router one might have this setting:
11478 </para>
11479 <literallayout class="monospaced">
11480 data = ${lookup ldap \
11481   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
11482   c=UK?mailbox?base?}}
11483 </literallayout>
11484 <para>
11485 <indexterm role="concept">
11486 <primary>LDAP</primary>
11487 <secondary>with TLS</secondary>
11488 </indexterm>
11489 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
11490 secure (encrypted) LDAP connections. The second of these ensures that an
11491 encrypted TLS connection is used.
11492 </para>
11493 <para>
11494 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
11495 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
11496 See the <option>ldap_start_tls</option> option.
11497 </para>
11498 <para>
11499 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
11500 controlled. Every part of the TLS configuration can be configured by settings in
11501 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
11502 your system, some of the initialization may have required setting options in
11503 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11504 certificates. This revealed a nuance where the current UID that exim was
11505 running as could affect which config files it read. With Exim 4.83, these
11506 methods become optional, only taking effect if not specifically set in
11507 <filename>exim.conf</filename>.
11508 </para>
11509 </section>
11510 <section id="SECID68">
11511 <title>LDAP quoting</title>
11512 <para>
11513 <indexterm role="concept">
11514 <primary>LDAP</primary>
11515 <secondary>quoting</secondary>
11516 </indexterm>
11517 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11518 and the second because the LDAP query is represented as a URL. Furthermore,
11519 within an LDAP query, two different kinds of quoting are required. For this
11520 reason, there are two different LDAP-specific quoting operators.
11521 </para>
11522 <para>
11523 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11524 filter specifications. Conceptually, it first does the following conversions on
11525 the string:
11526 </para>
11527 <literallayout class="monospaced">
11528 *   =&gt;   \2A
11529 (   =&gt;   \28
11530 )   =&gt;   \29
11531 \   =&gt;   \5C
11532 </literallayout>
11533 <para>
11534 in accordance with RFC 2254. The resulting string is then quoted according
11535 to the rules for URLs, that is, all non-alphanumeric characters except
11536 </para>
11537 <literallayout class="monospaced">
11538 ! $ ' - . _ ( ) * +
11539 </literallayout>
11540 <para>
11541 are converted to their hex values, preceded by a percent sign. For example:
11542 </para>
11543 <literallayout class="monospaced">
11544 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11545 </literallayout>
11546 <para>
11547 yields
11548 </para>
11549 <literallayout class="monospaced">
11550 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11551 </literallayout>
11552 <para>
11553 Removing the URL quoting, this is (with a leading and a trailing space):
11554 </para>
11555 <literallayout class="monospaced">
11556 a\28bc\29\2A, a&lt;yz&gt;;
11557 </literallayout>
11558 <para>
11559 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11560 base DN specifications in queries. Conceptually, it first converts the string
11561 by inserting a backslash in front of any of the following characters:
11562 </para>
11563 <literallayout class="monospaced">
11564 , + " \ &lt; &gt; ;
11565 </literallayout>
11566 <para>
11567 It also inserts a backslash before any leading spaces or # characters, and
11568 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11569 is then quoted according to the rules for URLs. For example:
11570 </para>
11571 <literallayout class="monospaced">
11572 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11573 </literallayout>
11574 <para>
11575 yields
11576 </para>
11577 <literallayout class="monospaced">
11578 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11579 </literallayout>
11580 <para>
11581 Removing the URL quoting, this is (with a trailing space):
11582 </para>
11583 <literallayout class="monospaced">
11584 \ a(bc)*\, a\&lt;yz\&gt;\;\
11585 </literallayout>
11586 <para>
11587 There are some further comments about quoting in the section on LDAP
11588 authentication below.
11589 </para>
11590 </section>
11591 <section id="SECID69">
11592 <title>LDAP connections</title>
11593 <para>
11594 <indexterm role="concept">
11595 <primary>LDAP</primary>
11596 <secondary>connections</secondary>
11597 </indexterm>
11598 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11599 is in use, via a Unix domain socket. The example given above does not specify
11600 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11601 by starting it with
11602 </para>
11603 <literallayout class="monospaced">
11604 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11605 </literallayout>
11606 <para>
11607 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11608 used. When no server is specified in a query, a list of default servers is
11609 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11610 colon-separated list of servers which are tried in turn until one successfully
11611 handles a query, or there is a serious error. Successful handling either
11612 returns the requested data, or indicates that it does not exist. Serious errors
11613 are syntactical, or multiple values when only a single value is expected.
11614 Errors which cause the next server to be tried are connection failures, bind
11615 failures, and timeouts.
11616 </para>
11617 <para>
11618 For each server name in the list, a port number can be given. The standard way
11619 of specifying a host and port is to use a colon separator (RFC 1738). Because
11620 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11621 doubled. For example
11622 </para>
11623 <literallayout class="monospaced">
11624 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11625 </literallayout>
11626 <para>
11627 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11628 to the LDAP library with no server name, and the library&#x2019;s default (normally
11629 the local host) is used.
11630 </para>
11631 <para>
11632 If you are using the OpenLDAP library, you can connect to an LDAP server using
11633 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11634 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11635 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11636 not available.
11637 </para>
11638 <para>
11639 For this type of connection, instead of a host name for the server, a pathname
11640 for the socket is required, and the port number is not relevant. The pathname
11641 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11642 the query. In the former case, you can have settings such as
11643 </para>
11644 <literallayout class="monospaced">
11645 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11646 </literallayout>
11647 <para>
11648 When the pathname is given in the query, you have to escape the slashes as
11649 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11650 </para>
11651 <literallayout class="monospaced">
11652 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11653 </literallayout>
11654 <para>
11655 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
11656 a pathname, it uses the Unix domain socket code, even if the query actually
11657 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
11658 socket connection. This behaviour means that you can use a setting of
11659 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
11660 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
11661 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
11662 backup host.
11663 </para>
11664 <para>
11665 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
11666 specified, an error is diagnosed. However, if there are more items in
11667 <option>ldap_default_servers</option>, they are tried. In other words:
11668 </para>
11669 <itemizedlist>
11670 <listitem>
11671 <para>
11672 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
11673 interface.
11674 </para>
11675 </listitem>
11676 <listitem>
11677 <para>
11678 Using <literal>ldapi</literal> with a host name causes an error.
11679 </para>
11680 </listitem>
11681 </itemizedlist>
11682 <para>
11683 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
11684 <option>ldap_default_servers</option>, does whatever the library does by default.
11685 </para>
11686 </section>
11687 <section id="SECID70">
11688 <title>LDAP authentication and control information</title>
11689 <para>
11690 <indexterm role="concept">
11691 <primary>LDAP</primary>
11692 <secondary>authentication</secondary>
11693 </indexterm>
11694 The LDAP URL syntax provides no way of passing authentication and other control
11695 information to the server. To make this possible, the URL in an LDAP query may
11696 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
11697 spaces. If a value contains spaces it must be enclosed in double quotes, and
11698 when double quotes are used, backslash is interpreted in the usual way inside
11699 them. The following names are recognized:
11700 </para>
11701 <literallayout>
11702 <literal>DEREFERENCE</literal>  set the dereferencing parameter
11703 <literal>NETTIME    </literal>  set a timeout for a network operation
11704 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
11705 <literal>PASS       </literal>  set the password, likewise
11706 <literal>REFERRALS  </literal>  set the referrals parameter
11707 <literal>SERVERS    </literal>  set alternate server list for this query only
11708 <literal>SIZE       </literal>  set the limit for the number of entries returned
11709 <literal>TIME       </literal>  set the maximum waiting time for a query
11710 </literallayout>
11711 <para>
11712 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
11713 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
11714 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
11715 library from trying to follow referrals issued by the LDAP server.
11716 </para>
11717 <para>
11718 <indexterm role="concept">
11719 <primary>LDAP</primary>
11720 <secondary>timeout</secondary>
11721 </indexterm>
11722 <indexterm role="concept">
11723 <primary>timeout</primary>
11724 <secondary>LDAP lookup</secondary>
11725 </indexterm>
11726 The name CONNECT is an obsolete name for NETTIME, retained for
11727 backwards compatibility. This timeout (specified as a number of seconds) is
11728 enforced from the client end for operations that can be carried out over a
11729 network. Specifically, it applies to network connections and calls to the
11730 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
11731 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
11732 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
11733 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
11734 Netscape SDK; for OpenLDAP no action is taken.
11735 </para>
11736 <para>
11737 The TIME parameter (also a number of seconds) is passed to the server to
11738 set a server-side limit on the time taken to complete a search.
11739 </para>
11740 <para>
11741 The SERVERS parameter allows you to specify an alternate list of ldap servers
11742 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
11743 default list of ldap servers, and a single lookup can specify a single ldap
11744 server to use.  But when you need to do a lookup with a list of servers that is
11745 different than the default list (maybe different order, maybe a completely
11746 different set of servers), the SERVERS parameter allows you to specify this
11747 alternate list (colon-separated).
11748 </para>
11749 <para>
11750 Here is an example of an LDAP query in an Exim lookup that uses some of these
11751 values. This is a single line, folded to fit on the page:
11752 </para>
11753 <literallayout class="monospaced">
11754 ${lookup ldap
11755   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
11756   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
11757   {$value}fail}
11758 </literallayout>
11759 <para>
11760 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
11761 any of the auxiliary data. Exim configuration settings that include lookups
11762 which contain password information should be preceded by <quote>hide</quote> to prevent
11763 non-admin users from using the <option>-bP</option> option to see their values.
11764 </para>
11765 <para>
11766 The auxiliary data items may be given in any order. The default is no
11767 connection timeout (the system timeout is used), no user or password, no limit
11768 on the number of entries returned, and no time limit on queries.
11769 </para>
11770 <para>
11771 When a DN is quoted in the USER= setting for LDAP authentication, Exim
11772 removes any URL quoting that it may contain before passing it LDAP. Apparently
11773 some libraries do this for themselves, but some do not. Removing the URL
11774 quoting has two advantages:
11775 </para>
11776 <itemizedlist>
11777 <listitem>
11778 <para>
11779 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
11780 DNs as with DNs inside actual queries.
11781 </para>
11782 </listitem>
11783 <listitem>
11784 <para>
11785 It permits spaces inside USER= DNs.
11786 </para>
11787 </listitem>
11788 </itemizedlist>
11789 <para>
11790 For example, a setting such as
11791 </para>
11792 <literallayout class="monospaced">
11793 USER=cn=${quote_ldap_dn:$1}
11794 </literallayout>
11795 <para>
11796 should work even if <varname>$1</varname> contains spaces.
11797 </para>
11798 <para>
11799 Expanded data for the PASS= value should be quoted using the <option>quote</option>
11800 expansion operator, rather than the LDAP quote operators. The only reason this
11801 field needs quoting is to ensure that it conforms to the Exim syntax, which
11802 does not allow unquoted spaces. For example:
11803 </para>
11804 <literallayout class="monospaced">
11805 PASS=${quote:$3}
11806 </literallayout>
11807 <para>
11808 The LDAP authentication mechanism can be used to check passwords as part of
11809 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
11810 <xref linkend="CHAPexpand"/>.
11811 </para>
11812 </section>
11813 <section id="SECID71">
11814 <title>Format of data returned by LDAP</title>
11815 <para>
11816 <indexterm role="concept">
11817 <primary>LDAP</primary>
11818 <secondary>returned data formats</secondary>
11819 </indexterm>
11820 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
11821 as a sequence of values, for example
11822 </para>
11823 <literallayout class="monospaced">
11824 cn=manager,o=University of Cambridge,c=UK
11825 </literallayout>
11826 <para>
11827 The <command>ldap</command> lookup type generates an error if more than one entry matches the
11828 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
11829 the result between the data from different entries. It is possible for multiple
11830 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
11831 you know that whatever values are returned all came from a single entry in the
11832 directory.
11833 </para>
11834 <para>
11835 In the common case where you specify a single attribute in your LDAP query, the
11836 result is not quoted, and does not contain the attribute name. If the attribute
11837 has multiple values, they are separated by commas. Any comma that is
11838 part of an attribute&#x2019;s value is doubled.
11839 </para>
11840 <para>
11841 If you specify multiple attributes, the result contains space-separated, quoted
11842 strings, each preceded by the attribute name and an equals sign. Within the
11843 quotes, the quote character, backslash, and newline are escaped with
11844 backslashes, and commas are used to separate multiple values for the attribute.
11845 Any commas in attribute values are doubled
11846 (permitting treatment of the values as a comma-separated list).
11847 Apart from the escaping, the string within quotes takes the same form as the
11848 output when a single attribute is requested. Specifying no attributes is the
11849 same as specifying all of an entry&#x2019;s attributes.
11850 </para>
11851 <para>
11852 Here are some examples of the output format. The first line of each pair is an
11853 LDAP query, and the second is the data that is returned. The attribute called
11854 <option>attr1</option> has two values, one of them with an embedded comma, whereas
11855 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
11856 (they have SUP <option>attr</option> in their schema definitions).
11857 </para>
11858 <literallayout class="monospaced">
11859 ldap:///o=base?attr1?sub?(uid=fred)
11860 value1.1,value1,,2
11861
11862 ldap:///o=base?attr2?sub?(uid=fred)
11863 value two
11864
11865 ldap:///o=base?attr?sub?(uid=fred)
11866 value1.1,value1,,2,value two
11867
11868 ldap:///o=base?attr1,attr2?sub?(uid=fred)
11869 attr1="value1.1,value1,,2" attr2="value two"
11870
11871 ldap:///o=base??sub?(uid=fred)
11872 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
11873 </literallayout>
11874 <para>
11875 You can
11876 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
11877 results of LDAP lookups.
11878 The <option>extract</option> operator in string expansions can be used to pick out
11879 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
11880 The <option>listextract</option> operator should be used to pick out individual values
11881 of attributes, even when only a single value is expected.
11882 The doubling of embedded commas allows you to use the returned data as a
11883 comma separated list (using the "&lt;," syntax for changing the input list separator).
11884 </para>
11885 </section>
11886 <section id="SECTnisplus">
11887 <title>More about NIS+</title>
11888 <para>
11889 <indexterm role="concept">
11890 <primary>NIS+ lookup type</primary>
11891 </indexterm>
11892 <indexterm role="concept">
11893 <primary>lookup</primary>
11894 <secondary>NIS+</secondary>
11895 </indexterm>
11896 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
11897 and field name. If this is given, the result of a successful query is the
11898 contents of the named field; otherwise the result consists of a concatenation
11899 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
11900 values containing spaces are quoted. For example, the query
11901 </para>
11902 <literallayout class="monospaced">
11903 [name=mg1456],passwd.org_dir
11904 </literallayout>
11905 <para>
11906 might return the string
11907 </para>
11908 <literallayout class="monospaced">
11909 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
11910 home=/home/mg1456 shell=/bin/bash shadow=""
11911 </literallayout>
11912 <para>
11913 (split over two lines here to fit on the page), whereas
11914 </para>
11915 <literallayout class="monospaced">
11916 [name=mg1456],passwd.org_dir:gcos
11917 </literallayout>
11918 <para>
11919 would just return
11920 </para>
11921 <literallayout class="monospaced">
11922 Martin Guerre
11923 </literallayout>
11924 <para>
11925 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
11926 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
11927 operator is to double any quote characters within the text.
11928 </para>
11929 </section>
11930 <section id="SECTsql">
11931 <title>SQL lookups</title>
11932 <para>
11933 <indexterm role="concept">
11934 <primary>SQL lookup types</primary>
11935 </indexterm>
11936 <indexterm role="concept">
11937 <primary>MySQL</primary>
11938 <secondary>lookup type</secondary>
11939 </indexterm>
11940 <indexterm role="concept">
11941 <primary>PostgreSQL lookup type</primary>
11942 </indexterm>
11943 <indexterm role="concept">
11944 <primary>lookup</primary>
11945 <secondary>MySQL</secondary>
11946 </indexterm>
11947 <indexterm role="concept">
11948 <primary>lookup</primary>
11949 <secondary>PostgreSQL</secondary>
11950 </indexterm>
11951 <indexterm role="concept">
11952 <primary>Oracle</primary>
11953 <secondary>lookup type</secondary>
11954 </indexterm>
11955 <indexterm role="concept">
11956 <primary>lookup</primary>
11957 <secondary>Oracle</secondary>
11958 </indexterm>
11959 <indexterm role="concept">
11960 <primary>InterBase lookup type</primary>
11961 </indexterm>
11962 <indexterm role="concept">
11963 <primary>lookup</primary>
11964 <secondary>InterBase</secondary>
11965 </indexterm>
11966 <indexterm role="concept">
11967 <primary>Redis lookup type</primary>
11968 </indexterm>
11969 <indexterm role="concept">
11970 <primary>lookup</primary>
11971 <secondary>Redis</secondary>
11972 </indexterm>
11973 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
11974 and SQLite
11975 databases. Queries for these databases contain SQL statements, so an example
11976 might be
11977 </para>
11978 <literallayout class="monospaced">
11979 ${lookup mysql{select mailbox from users where id='userx'}\
11980   {$value}fail}
11981 </literallayout>
11982 <para>
11983 If the result of the query contains more than one field, the data for each
11984 field in the row is returned, preceded by its name, so the result of
11985 </para>
11986 <literallayout class="monospaced">
11987 ${lookup pgsql{select home,name from users where id='userx'}\
11988   {$value}}
11989 </literallayout>
11990 <para>
11991 might be
11992 </para>
11993 <literallayout class="monospaced">
11994 home=/home/userx name="Mister X"
11995 </literallayout>
11996 <para>
11997 Empty values and values containing spaces are double quoted, with embedded
11998 quotes escaped by a backslash. If the result of the query contains just one
11999 field, the value is passed back verbatim, without a field name, for example:
12000 </para>
12001 <literallayout class="monospaced">
12002 Mister X
12003 </literallayout>
12004 <para>
12005 If the result of the query yields more than one row, it is all concatenated,
12006 with a newline between the data for each row.
12007 </para>
12008 </section>
12009 <section id="SECID72">
12010 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
12011 <para>
12012 <indexterm role="concept">
12013 <primary>MySQL</primary>
12014 <secondary>lookup type</secondary>
12015 </indexterm>
12016 <indexterm role="concept">
12017 <primary>PostgreSQL lookup type</primary>
12018 </indexterm>
12019 <indexterm role="concept">
12020 <primary>lookup</primary>
12021 <secondary>MySQL</secondary>
12022 </indexterm>
12023 <indexterm role="concept">
12024 <primary>lookup</primary>
12025 <secondary>PostgreSQL</secondary>
12026 </indexterm>
12027 <indexterm role="concept">
12028 <primary>Oracle</primary>
12029 <secondary>lookup type</secondary>
12030 </indexterm>
12031 <indexterm role="concept">
12032 <primary>lookup</primary>
12033 <secondary>Oracle</secondary>
12034 </indexterm>
12035 <indexterm role="concept">
12036 <primary>InterBase lookup type</primary>
12037 </indexterm>
12038 <indexterm role="concept">
12039 <primary>lookup</primary>
12040 <secondary>InterBase</secondary>
12041 </indexterm>
12042 <indexterm role="concept">
12043 <primary>Redis lookup type</primary>
12044 </indexterm>
12045 <indexterm role="concept">
12046 <primary>lookup</primary>
12047 <secondary>Redis</secondary>
12048 </indexterm>
12049 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
12050 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
12051 or <option>redis_servers</option>
12052 option (as appropriate) must be set to a colon-separated list of server
12053 information.
12054 <indexterm role="option">
12055 <primary><option>mysql_servers</option></primary>
12056 </indexterm>
12057 <indexterm role="option">
12058 <primary><option>pgsql_servers</option></primary>
12059 </indexterm>
12060 <indexterm role="option">
12061 <primary><option>oracle_servers</option></primary>
12062 </indexterm>
12063 <indexterm role="option">
12064 <primary><option>ibase_servers</option></primary>
12065 </indexterm>
12066 <indexterm role="option">
12067 <primary><option>redis_servers</option></primary>
12068 </indexterm>
12069 (For MySQL and PostgreSQL, the global option need not be set if all
12070 queries contain their own server information &ndash; see section
12071 <xref linkend="SECTspeserque"/>.)
12072 For all but Redis
12073 each item in the list is a slash-separated list of four
12074 items: host name, database name, user name, and password. In the case of
12075 Oracle, the host name field is used for the <quote>service name</quote>, and the database
12076 name field is not used and should be empty. For example:
12077 </para>
12078 <literallayout class="monospaced">
12079 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
12080 </literallayout>
12081 <para>
12082 Because password data is sensitive, you should always precede the setting with
12083 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
12084 option. Here is an example where two MySQL servers are listed:
12085 </para>
12086 <literallayout class="monospaced">
12087 hide mysql_servers = localhost/users/root/secret:\
12088                      otherhost/users/root/othersecret
12089 </literallayout>
12090 <para>
12091 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
12092 because this is a colon-separated list, the colon has to be doubled. For each
12093 query, these parameter groups are tried in order until a connection is made and
12094 a query is successfully processed. The result of a query may be that no data is
12095 found, but that is still a successful query. In other words, the list of
12096 servers provides a backup facility, not a list of different places to look.
12097 </para>
12098 <para>
12099 For Redis the global option need not be specified if all queries contain their
12100 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
12101 If specified, the option must be set to a colon-separated list of server
12102 information.
12103 Each item in the list is a slash-separated list of three items:
12104 host, database number, and password.
12105 </para>
12106 <orderedlist numeration="arabic">
12107 <listitem>
12108 <para>
12109 The host is required and may be either an IPv4 address and optional
12110 port number (separated by a colon, which needs doubling due to the
12111 higher-level list), or a Unix socket pathname enclosed in parentheses
12112 </para>
12113 </listitem>
12114 <listitem>
12115 <para>
12116 The database number is optional; if present that number is selected in the backend
12117 </para>
12118 </listitem>
12119 <listitem>
12120 <para>
12121 The password is optional; if present it is used to authenticate to the backend
12122 </para>
12123 </listitem>
12124 </orderedlist>
12125 <para>
12126 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
12127 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
12128 respectively, and the characters single-quote, double-quote, and backslash
12129 itself are escaped with backslashes.
12130 </para>
12131 <para>
12132 The <option>quote_redis</option> expansion operator
12133 escapes whitespace and backslash characters with a backslash.
12134 </para>
12135 </section>
12136 <section id="SECTspeserque">
12137 <title>Specifying the server in the query</title>
12138 <para revisionflag="changed">
12139 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
12140 it is possible to specify a list of servers with an individual query. This is
12141 done by appending a comma-separated option to the query type:
12142 </para>
12143 <literallayout revisionflag="changed">
12144 <literal>,servers=</literal><emphasis>server1:server2:server3:...</emphasis>
12145 </literallayout>
12146 <para>
12147 Each item in the list may take one of two forms:
12148 </para>
12149 <orderedlist numeration="arabic">
12150 <listitem>
12151 <para>
12152 If it contains no slashes it is assumed to be just a host name. The appropriate
12153 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
12154 of the same name, and the remaining parameters (database, user, password) are
12155 taken from there.
12156 </para>
12157 </listitem>
12158 <listitem>
12159 <para>
12160 If it contains any slashes, it is taken as a complete parameter set.
12161 </para>
12162 </listitem>
12163 </orderedlist>
12164 <para>
12165 The list of servers is used in exactly the same way as the global list.
12166 Once a connection to a server has happened and a query has been
12167 successfully executed, processing of the lookup ceases.
12168 </para>
12169 <para>
12170 This feature is intended for use in master/slave situations where updates
12171 are occurring and you want to update the master rather than a slave. If the
12172 master is in the list as a backup for reading, you might have a global setting
12173 like this:
12174 </para>
12175 <literallayout class="monospaced">
12176 mysql_servers = slave1/db/name/pw:\
12177                 slave2/db/name/pw:\
12178                 master/db/name/pw
12179 </literallayout>
12180 <para>
12181 In an updating lookup, you could then write:
12182 </para>
12183 <literallayout class="monospaced">
12184 ${lookup mysql,servers=master {UPDATE ...} }
12185 </literallayout>
12186 <para>
12187 That query would then be sent only to the master server. If, on the other hand,
12188 the master is not to be used for reading, and so is not present in the global
12189 option, you can still update it by a query of this form:
12190 </para>
12191 <literallayout class="monospaced">
12192 ${lookup pgsql,servers=master/db/name/pw {UPDATE ...} }
12193 </literallayout>
12194 <para revisionflag="changed">
12195 An older syntax places the servers speciification before the qury,
12196 semicolon separated:
12197 </para>
12198 <literallayout class="monospaced" revisionflag="changed">
12199 ${lookup mysql{servers=master; UPDATE ...} }
12200 </literallayout>
12201 <para revisionflag="changed">
12202 The new version avoids potential issues with tainted
12203 arguments in the query, for explicit expansion.
12204 <emphasis role="bold">Note</emphasis>: server specifications in list-style lookups are still problematic.
12205 </para>
12206 </section>
12207 <section id="SECID73">
12208 <title>Special MySQL features</title>
12209 <para>
12210 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
12211 causes a connection to the server on the local host by means of a Unix domain
12212 socket. An alternate socket can be specified in parentheses.
12213 An option group name for MySQL option files can be specified in square brackets;
12214 the default value is <quote>exim</quote>.
12215 The full syntax of each item in <option>mysql_servers</option> is:
12216 </para>
12217 <literallayout>
12218 &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;
12219 </literallayout>
12220 <para>
12221 Any of the four sub-parts of the first field can be omitted. For normal use on
12222 the local host it can be left blank or set to just <quote>localhost</quote>.
12223 </para>
12224 <para>
12225 No database need be supplied &ndash; but if it is absent here, it must be given in
12226 the queries.
12227 </para>
12228 <para>
12229 If a MySQL query is issued that does not request any data (an insert, update,
12230 or delete command), the result of the lookup is the number of rows affected.
12231 </para>
12232 <para>
12233 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
12234 anything (for example, setting a field to the value it already has), the result
12235 is zero because no rows are affected.
12236 </para>
12237 </section>
12238 <section id="SECID74">
12239 <title>Special PostgreSQL features</title>
12240 <para>
12241 PostgreSQL lookups can also use Unix domain socket connections to the database.
12242 This is usually faster and costs less CPU time than a TCP/IP connection.
12243 However it can be used only if the mail server runs on the same machine as the
12244 database server. A configuration line for PostgreSQL via Unix domain sockets
12245 looks like this:
12246 </para>
12247 <literallayout class="monospaced">
12248 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
12249 </literallayout>
12250 <para>
12251 In other words, instead of supplying a host name, a path to the socket is
12252 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
12253 visually confused with the delimiters for the other server parameters.
12254 </para>
12255 <para>
12256 If a PostgreSQL query is issued that does not request any data (an insert,
12257 update, or delete command), the result of the lookup is the number of rows
12258 affected.
12259 </para>
12260 </section>
12261 <section id="SECTsqlite">
12262 <title>More about SQLite</title>
12263 <para>
12264 <indexterm role="concept">
12265 <primary>lookup</primary>
12266 <secondary>SQLite</secondary>
12267 </indexterm>
12268 <indexterm role="concept">
12269 <primary>sqlite lookup type</primary>
12270 </indexterm>
12271 SQLite is different to the other SQL lookups because a filename is required in
12272 addition to the SQL query. An SQLite database is a single file, and there is no
12273 daemon as in the other SQL databases.
12274 </para>
12275 <para revisionflag="changed">
12276 <indexterm role="option">
12277 <primary><option>sqlite_dbfile</option></primary>
12278 </indexterm>
12279 The preferred way of specifying the file is by using the
12280 <option>sqlite_dbfile</option> option, set to
12281 an absolute path.
12282 </para>
12283 <para>
12284 A deprecated method is available, prefixing the query with the filename
12285 separated by white space.
12286 This means that the path name cannot contain white space.
12287 <indexterm role="concept">
12288 <primary>tainted data</primary>
12289 <secondary>sqlite file</secondary>
12290 </indexterm>
12291 It also means that the query cannot use any tainted values, as that taints
12292 the entire query including the filename - resulting in a refusal to open
12293 the file.
12294 </para>
12295 <para revisionflag="changed">
12296 Here is a lookup expansion example:
12297 </para>
12298 <literallayout class="monospaced" revisionflag="changed">
12299 sqlite_dbfile = /some/thing/sqlitedb
12300 ...
12301 ${lookup sqlite {select name from aliases where id='userx';}}
12302 </literallayout>
12303 <para revisionflag="changed">
12304 In a list, the syntax is similar. For example:
12305 </para>
12306 <literallayout class="monospaced" revisionflag="changed">
12307 domainlist relay_to_domains = sqlite;\
12308    select * from relays where ip='$sender_host_address';
12309 </literallayout>
12310 <para>
12311 The only character affected by the <option>quote_sqlite</option> operator is a single
12312 quote, which it doubles.
12313 </para>
12314 <para>
12315 <indexterm role="concept">
12316 <primary>timeout</primary>
12317 <secondary>SQLite</secondary>
12318 </indexterm>
12319 <indexterm role="concept">
12320 <primary>sqlite</primary>
12321 <secondary>lookup timeout</secondary>
12322 </indexterm>
12323 The SQLite library handles multiple simultaneous accesses to the database
12324 internally. Multiple readers are permitted, but only one process can
12325 update at once. Attempts to access the database while it is being updated
12326 are rejected after a timeout period, during which the SQLite library
12327 waits for the lock to be released. In Exim, the default timeout is set
12328 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
12329 option.
12330 </para>
12331 </section>
12332 <section id="SECTredis">
12333 <title>More about Redis</title>
12334 <para>
12335 <indexterm role="concept">
12336 <primary>lookup</primary>
12337 <secondary>Redis</secondary>
12338 </indexterm>
12339 <indexterm role="concept">
12340 <primary>redis lookup type</primary>
12341 </indexterm>
12342 Redis is a non-SQL database. Commands are simple get and set.
12343 Examples:
12344 </para>
12345 <literallayout class="monospaced">
12346 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
12347 ${lookup redis{get keyname}}
12348 </literallayout>
12349 <para>
12350 As of release 4.91, "lightweight" support for Redis Cluster is available.
12351 Requires <option>redis_servers</option> list to contain all the servers in the cluster, all
12352 of which must be reachable from the running exim instance. If the cluster has
12353 master/slave replication, the list must contain all the master and slave
12354 servers.
12355 </para>
12356 <para>
12357 When the Redis Cluster returns a "MOVED" response to a query, Exim does not
12358 immediately follow the redirection but treats the response as a DEFER, moving on
12359 to the next server in the <option>redis_servers</option> list until the correct server is
12360 reached.
12361 </para>
12362 <para>
12363 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
12364 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
12365 </para>
12366 </section>
12367 </chapter>
12368
12369 <chapter id="CHAPdomhosaddlists">
12370 <title>Domain, host, address, and local part lists</title>
12371 <titleabbrev>Domain, host, and address lists</titleabbrev>
12372 <para>
12373 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
12374 <primary>lists of domains; hosts; etc.</primary>
12375 </indexterm>
12376 A number of Exim configuration options contain lists of domains, hosts,
12377 email addresses, or local parts. For example, the <option>hold_domains</option> option
12378 contains a list of domains whose delivery is currently suspended. These lists
12379 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
12380 arguments to expansion conditions such as <option>match_domain</option>.
12381 </para>
12382 <para>
12383 Each item in one of these lists is a pattern to be matched against a domain,
12384 host, email address, or local part, respectively. In the sections below, the
12385 different types of pattern for each case are described, but first we cover some
12386 general facilities that apply to all four kinds of list.
12387 </para>
12388 <para>
12389 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
12390 support all the complexity available in
12391 domain, host, address and local part lists.
12392 </para>
12393 <section id="SECTlistexpand">
12394 <title>Expansion of lists</title>
12395 <para>
12396 <indexterm role="concept">
12397 <primary>expansion</primary>
12398 <secondary>of lists</secondary>
12399 </indexterm>
12400 Each list is expanded as a single string before it is used.
12401 </para>
12402 <para>
12403 <emphasis>Exception: the router headers_remove option, where list-item
12404 splitting is done before string-expansion.</emphasis>
12405 </para>
12406 <para>
12407 The result of
12408 expansion must be a list, possibly containing empty items, which is split up
12409 into separate items for matching. By default, colon is the separator character,
12410 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
12411 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
12412 discusses the way to specify empty list items.
12413 </para>
12414 <para>
12415 If the string expansion is forced to fail, Exim behaves as if the item it is
12416 testing (domain, host, address, or local part) is not in the list. Other
12417 expansion failures cause temporary errors.
12418 </para>
12419 <para>
12420 If an item in a list is a regular expression, backslashes, dollars and possibly
12421 other special characters in the expression must be protected against
12422 misinterpretation by the string expander. The easiest way to do this is to use
12423 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
12424 expression should not be expanded. For example, in an ACL you might have:
12425 </para>
12426 <literallayout class="monospaced">
12427 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
12428                ${lookup{$domain}lsearch{/badsenders/bydomain}}
12429 </literallayout>
12430 <para>
12431 The first item is a regular expression that is protected from expansion by
12432 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
12433 senders based on the receiving domain.
12434 </para>
12435 </section>
12436 <section id="SECID76">
12437 <title>Negated items in lists</title>
12438 <para>
12439 <indexterm role="concept">
12440 <primary>list</primary>
12441 <secondary>negation</secondary>
12442 </indexterm>
12443 <indexterm role="concept">
12444 <primary>negation</primary>
12445 <secondary>in lists</secondary>
12446 </indexterm>
12447 Items in a list may be positive or negative. Negative items are indicated by a
12448 leading exclamation mark, which may be followed by optional white space. A list
12449 defines a set of items (domains, etc). When Exim processes one of these lists,
12450 it is trying to find out whether a domain, host, address, or local part
12451 (respectively) is in the set that is defined by the list. It works like this:
12452 </para>
12453 <para>
12454 The list is scanned from left to right. If a positive item is matched, the
12455 subject that is being checked is in the set; if a negative item is matched, the
12456 subject is not in the set. If the end of the list is reached without the
12457 subject having matched any of the patterns, it is in the set if the last item
12458 was a negative one, but not if it was a positive one. For example, the list in
12459 </para>
12460 <literallayout class="monospaced">
12461 domainlist relay_to_domains = !a.b.c : *.b.c
12462 </literallayout>
12463 <para>
12464 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
12465 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
12466 list is positive. However, if the setting were
12467 </para>
12468 <literallayout class="monospaced">
12469 domainlist relay_to_domains = !a.b.c
12470 </literallayout>
12471 <para>
12472 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
12473 list is negative. In other words, a list that ends with a negative item behaves
12474 as if it had an extra item <literal>:*</literal> on the end.
12475 </para>
12476 <para>
12477 Another way of thinking about positive and negative items in lists is to read
12478 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
12479 item.
12480 </para>
12481 </section>
12482 <section id="SECTfilnamlis">
12483 <title>File names in lists</title>
12484 <para>
12485 <indexterm role="concept">
12486 <primary>list</primary>
12487 <secondary>filename in</secondary>
12488 </indexterm>
12489 If an item in a domain, host, address, or local part list is an absolute
12490 filename (beginning with a slash character), each line of the file is read and
12491 processed as if it were an independent item in the list, except that further
12492 filenames are not allowed,
12493 and no expansion of the data from the file takes place.
12494 Empty lines in the file are ignored, and the file may also contain comment
12495 lines:
12496 </para>
12497 <itemizedlist>
12498 <listitem>
12499 <para>
12500 For domain and host lists, if a # character appears anywhere in a line of the
12501 file, it and all following characters are ignored.
12502 </para>
12503 </listitem>
12504 <listitem>
12505 <para>
12506 Because local parts may legitimately contain # characters, a comment in an
12507 address list or local part list file is recognized only if # is preceded by
12508 white space or the start of the line. For example:
12509 </para>
12510 <literallayout class="monospaced">
12511 not#comment@x.y.z   # but this is a comment
12512 </literallayout>
12513 </listitem>
12514 </itemizedlist>
12515 <para>
12516 Putting a filename in a list has the same effect as inserting each line of the
12517 file as an item in the list (blank lines and comments excepted). However, there
12518 is one important difference: the file is read each time the list is processed,
12519 so if its contents vary over time, Exim&#x2019;s behaviour changes.
12520 </para>
12521 <para>
12522 If a filename is preceded by an exclamation mark, the sense of any match
12523 within the file is inverted. For example, if
12524 </para>
12525 <literallayout class="monospaced">
12526 hold_domains = !/etc/nohold-domains
12527 </literallayout>
12528 <para>
12529 and the file contains the lines
12530 </para>
12531 <literallayout class="monospaced">
12532 !a.b.c
12533 *.b.c
12534 </literallayout>
12535 <para>
12536 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
12537 any domain matching <literal>*.b.c</literal> is not.
12538 </para>
12539 </section>
12540 <section id="SECID77">
12541 <title>An lsearch file is not an out-of-line list</title>
12542 <para>
12543 As will be described in the sections that follow, lookups can be used in lists
12544 to provide indexed methods of checking list membership. There has been some
12545 confusion about the way <command>lsearch</command> lookups work in lists. Because
12546 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
12547 sometimes thought that it is allowed to contain wild cards and other kinds of
12548 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
12549 always fixed strings, just as for any other single-key lookup type.
12550 </para>
12551 <para>
12552 If you want to use a file to contain wild-card patterns that form part of a
12553 list, just give the filename on its own, without a search type, as described
12554 in the previous section. You could also use the <command>wildlsearch</command> or
12555 <command>nwildlsearch</command>, but there is no advantage in doing this.
12556 </para>
12557 </section>
12558 <section id="SECTlistresults" revisionflag="changed">
12559 <title>Results of list checking</title>
12560 <para revisionflag="changed">
12561 The primary result of doing a list check is a truth value.
12562 In some contexts additional information is stored
12563 about the list element that matched:
12564 </para>
12565 <variablelist revisionflag="changed">
12566 <varlistentry revisionflag="changed">
12567 <term>hosts</term>
12568 <listitem>
12569 <para revisionflag="changed">
12570 A <option>hosts</option> ACL condition
12571 will store a result in the <varname>$host_data</varname> variable.
12572 </para>
12573 </listitem></varlistentry>
12574 <varlistentry revisionflag="changed">
12575 <term>local_parts</term>
12576 <listitem>
12577 <para revisionflag="changed">
12578 A <option>local_parts</option> router option or <option>local_parts</option> ACL condition
12579 will store a result in the <varname>$local_part_data</varname> variable.
12580 </para>
12581 </listitem></varlistentry>
12582 <varlistentry revisionflag="changed">
12583 <term>domains</term>
12584 <listitem>
12585 <para revisionflag="changed">
12586 A <option>domains</option> router option or <option>domains</option> ACL condition
12587 </para>
12588 </listitem></varlistentry>
12589 <varlistentry revisionflag="changed">
12590 <term>senders</term>
12591 <listitem>
12592 <para revisionflag="changed">
12593 A <option>senders</option> router option or <option>senders</option> ACL condition
12594 will store a result in the <varname>$sender_data</varname> variable.
12595 </para>
12596 </listitem></varlistentry>
12597 <varlistentry revisionflag="changed">
12598 <term>recipients</term>
12599 <listitem>
12600 <para revisionflag="changed">
12601 A <option>recipients</option> ACL condition
12602 will store a result in the <varname>$recipient_data</varname> variable.
12603 </para>
12604 </listitem></varlistentry>
12605 </variablelist>
12606 <para revisionflag="changed">
12607 The detail of the additional information depends on the
12608 type of match and is given below as the <emphasis role="bold">value</emphasis> information.
12609 </para>
12610 </section>
12611 <section id="SECTnamedlists">
12612 <title>Named lists</title>
12613 <para>
12614 <indexterm role="concept">
12615 <primary>named lists</primary>
12616 </indexterm>
12617 <indexterm role="concept">
12618 <primary>list</primary>
12619 <secondary>named</secondary>
12620 </indexterm>
12621 A list of domains, hosts, email addresses, or local parts can be given a name
12622 which is then used to refer to the list elsewhere in the configuration. This is
12623 particularly convenient if the same list is required in several different
12624 places. It also allows lists to be given meaningful names, which can improve
12625 the readability of the configuration. For example, it is conventional to define
12626 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
12627 locally on a host, using a configuration line such as
12628 </para>
12629 <literallayout class="monospaced">
12630 domainlist local_domains = localhost:my.dom.example
12631 </literallayout>
12632 <para>
12633 Named lists are referenced by giving their name preceded by a plus sign, so,
12634 for example, a router that is intended to handle local domains would be
12635 configured with the line
12636 </para>
12637 <literallayout class="monospaced">
12638 domains = +local_domains
12639 </literallayout>
12640 <para>
12641 The first router in a configuration is often one that handles all domains
12642 except the local ones, using a configuration with a negated item like this:
12643 </para>
12644 <literallayout class="monospaced">
12645 dnslookup:
12646   driver = dnslookup
12647   domains = ! +local_domains
12648   transport = remote_smtp
12649   no_more
12650 </literallayout>
12651 <para>
12652 The four kinds of named list are created by configuration lines starting with
12653 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
12654 respectively. Then there follows the name that you are defining, followed by an
12655 equals sign and the list itself. For example:
12656 </para>
12657 <literallayout class="monospaced">
12658 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
12659 addresslist bad_senders = cdb;/etc/badsenders
12660 </literallayout>
12661 <para>
12662 A named list may refer to other named lists:
12663 </para>
12664 <literallayout class="monospaced">
12665 domainlist  dom1 = first.example : second.example
12666 domainlist  dom2 = +dom1 : third.example
12667 domainlist  dom3 = fourth.example : +dom2 : fifth.example
12668 </literallayout>
12669 <para>
12670 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
12671 effect may not be what you intended, because the negation does not propagate
12672 out to the higher level. For example, consider:
12673 </para>
12674 <literallayout class="monospaced">
12675 domainlist  dom1 = !a.b
12676 domainlist  dom2 = +dom1 : *.b
12677 </literallayout>
12678 <para>
12679 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
12680 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
12681 means it matches the second list as well. The effect is not the same as
12682 </para>
12683 <literallayout class="monospaced">
12684 domainlist  dom2 = !a.b : *.b
12685 </literallayout>
12686 <para>
12687 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
12688 referenced lists if you can.
12689 </para>
12690 <para revisionflag="changed">
12691 <indexterm role="concept">
12692 <primary>hiding named list values</primary>
12693 </indexterm>
12694 <indexterm role="concept">
12695 <primary>named lists</primary>
12696 <secondary>hiding value of</secondary>
12697 </indexterm>
12698 Some named list definitions may contain sensitive data, for example, passwords for
12699 accessing databases. To stop non-admin users from using the <option>-bP</option> command
12700 line option to read these values, you can precede the definition with the
12701 word <quote>hide</quote>. For example:
12702 </para>
12703 <literallayout class="monospaced" revisionflag="changed">
12704 hide domainlist filter_for_domains = ldap;PASS=secret ldap::/// ...
12705 </literallayout>
12706 <para>
12707 Named lists may have a performance advantage. When Exim is routing an
12708 address or checking an incoming message, it caches the result of tests on named
12709 lists. So, if you have a setting such as
12710 </para>
12711 <literallayout class="monospaced">
12712 domains = +local_domains
12713 </literallayout>
12714 <para>
12715 on several of your routers
12716 or in several ACL statements,
12717 the actual test is done only for the first one. However, the caching works only
12718 if there are no expansions within the list itself or any sublists that it
12719 references. In other words, caching happens only for lists that are known to be
12720 the same each time they are referenced.
12721 </para>
12722 <para>
12723 By default, there may be up to 16 named lists of each type. This limit can be
12724 extended by changing a compile-time variable. The use of domain and host lists
12725 is recommended for concepts such as local domains, relay domains, and relay
12726 hosts. The default configuration is set up like this.
12727 </para>
12728 </section>
12729 <section id="SECID78">
12730 <title>Named lists compared with macros</title>
12731 <para>
12732 <indexterm role="concept">
12733 <primary>list</primary>
12734 <secondary>named compared with macro</secondary>
12735 </indexterm>
12736 <indexterm role="concept">
12737 <primary>macro</primary>
12738 <secondary>compared with named list</secondary>
12739 </indexterm>
12740 At first sight, named lists might seem to be no different from macros in the
12741 configuration file. However, macros are just textual substitutions. If you
12742 write
12743 </para>
12744 <literallayout class="monospaced">
12745 ALIST = host1 : host2
12746 auth_advertise_hosts = !ALIST
12747 </literallayout>
12748 <para>
12749 it probably won&#x2019;t do what you want, because that is exactly the same as
12750 </para>
12751 <literallayout class="monospaced">
12752 auth_advertise_hosts = !host1 : host2
12753 </literallayout>
12754 <para>
12755 Notice that the second host name is not negated. However, if you use a host
12756 list, and write
12757 </para>
12758 <literallayout class="monospaced">
12759 hostlist alist = host1 : host2
12760 auth_advertise_hosts = ! +alist
12761 </literallayout>
12762 <para>
12763 the negation applies to the whole list, and so that is equivalent to
12764 </para>
12765 <literallayout class="monospaced">
12766 auth_advertise_hosts = !host1 : !host2
12767 </literallayout>
12768 </section>
12769 <section id="SECID79">
12770 <title>Named list caching</title>
12771 <para>
12772 <indexterm role="concept">
12773 <primary>list</primary>
12774 <secondary>caching of named</secondary>
12775 </indexterm>
12776 <indexterm role="concept">
12777 <primary>caching</primary>
12778 <secondary>named lists</secondary>
12779 </indexterm>
12780 While processing a message, Exim caches the result of checking a named list if
12781 it is sure that the list is the same each time. In practice, this means that
12782 the cache operates only if the list contains no $ characters, which guarantees
12783 that it will not change when it is expanded. Sometimes, however, you may have
12784 an expanded list that you know will be the same each time within a given
12785 message. For example:
12786 </para>
12787 <literallayout class="monospaced">
12788 domainlist special_domains = \
12789            ${lookup{$sender_host_address}cdb{/some/file}}
12790 </literallayout>
12791 <para>
12792 This provides a list of domains that depends only on the sending host&#x2019;s IP
12793 address. If this domain list is referenced a number of times (for example,
12794 in several ACL lines, or in several routers) the result of the check is not
12795 cached by default, because Exim does not know that it is going to be the
12796 same list each time.
12797 </para>
12798 <para>
12799 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
12800 cache the result anyway. For example:
12801 </para>
12802 <literallayout class="monospaced">
12803 domainlist_cache special_domains = ${lookup{...
12804 </literallayout>
12805 <para>
12806 If you do this, you should be absolutely sure that caching is going to do
12807 the right thing in all cases. When in doubt, leave it out.
12808 </para>
12809 </section>
12810 <section id="SECTdomainlist">
12811 <title>Domain lists</title>
12812 <para>
12813 <indexterm role="concept">
12814 <primary>domain list</primary>
12815 <secondary>patterns for</secondary>
12816 </indexterm>
12817 <indexterm role="concept">
12818 <primary>list</primary>
12819 <secondary>domain list</secondary>
12820 </indexterm>
12821 Domain lists contain patterns that are to be matched against a mail domain.
12822 The following types of item may appear in domain lists:
12823 </para>
12824 <itemizedlist>
12825 <listitem>
12826 <para>
12827 <indexterm role="concept">
12828 <primary>primary host name</primary>
12829 </indexterm>
12830 <indexterm role="concept">
12831 <primary>host name</primary>
12832 <secondary>matched in domain list</secondary>
12833 </indexterm>
12834 <indexterm role="option">
12835 <primary><option>primary_hostname</option></primary>
12836 </indexterm>
12837 <indexterm role="concept">
12838 <primary>domain list</primary>
12839 <secondary>matching primary host name</secondary>
12840 </indexterm>
12841 <indexterm role="concept">
12842 <primary>@ in a domain list</primary>
12843 </indexterm>
12844 If a pattern consists of a single @ character, it matches the local host name,
12845 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
12846 possible to use the same configuration file on several different hosts that
12847 differ only in their names.
12848 </para>
12849 <para revisionflag="changed">
12850 The value for a match will be the primary host name.
12851 </para>
12852 </listitem>
12853 <listitem>
12854 <para>
12855 <indexterm role="concept">
12856 <primary>@[] in a domain list</primary>
12857 </indexterm>
12858 <indexterm role="concept">
12859 <primary>domain list</primary>
12860 <secondary>matching local IP interfaces</secondary>
12861 </indexterm>
12862 <indexterm role="concept">
12863 <primary>domain literal</primary>
12864 </indexterm>
12865 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
12866 in square brackets (as in an email address that contains a domain literal), but
12867 only if that IP address is recognized as local for email routing purposes. The
12868 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
12869 control which of a host&#x2019;s several IP addresses are treated as local.
12870 In today&#x2019;s Internet, the use of domain literals is controversial;
12871 see the <option>allow_domain_literals</option> main option.
12872 </para>
12873 <para revisionflag="changed">
12874 The value for a match will be the string <literal>@[]</literal>.
12875 </para>
12876 </listitem>
12877 <listitem>
12878 <para>
12879 <indexterm role="concept">
12880 <primary>@mx_any</primary>
12881 </indexterm>
12882 <indexterm role="concept">
12883 <primary>@mx_primary</primary>
12884 </indexterm>
12885 <indexterm role="concept">
12886 <primary>@mx_secondary</primary>
12887 </indexterm>
12888 <indexterm role="concept">
12889 <primary>domain list</primary>
12890 <secondary>matching MX pointers to local host</secondary>
12891 </indexterm>
12892 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
12893 has an MX record pointing to the local host or to any host that is listed in
12894 <indexterm role="option">
12895 <primary><option>hosts_treat_as_local</option></primary>
12896 </indexterm>
12897 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
12898 are similar, except that the first matches only when a primary MX target is the
12899 local host, and the second only when no primary MX target is the local host,
12900 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
12901 preference value &ndash; there may of course be more than one of them.
12902 </para>
12903 <para>
12904 The MX lookup that takes place when matching a pattern of this type is
12905 performed with the resolver options for widening names turned off. Thus, for
12906 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
12907 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
12908 options of the <command>dnslookup</command> router for a discussion of domain widening.
12909 </para>
12910 <para>
12911 Sometimes you may want to ignore certain IP addresses when using one of these
12912 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
12913 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
12914 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
12915 on a router). For example:
12916 </para>
12917 <literallayout class="monospaced">
12918 domains = @mx_any/ignore=127.0.0.1
12919 </literallayout>
12920 <para>
12921 This example matches any domain that has an MX record pointing to one of
12922 the local host&#x2019;s IP addresses other than 127.0.0.1.
12923 </para>
12924 <para>
12925 The list of IP addresses is in fact processed by the same code that processes
12926 host lists, so it may contain CIDR-coded network specifications and it may also
12927 contain negative items.
12928 </para>
12929 <para>
12930 Because the list of IP addresses is a sublist within a domain list, you have to
12931 be careful about delimiters if there is more than one address. Like any other
12932 list, the default delimiter can be changed. Thus, you might have:
12933 </para>
12934 <literallayout class="monospaced">
12935 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
12936           an.other.domain : ...
12937 </literallayout>
12938 <para>
12939 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
12940 involved, it is easiest to change the delimiter for the main list as well:
12941 </para>
12942 <literallayout class="monospaced">
12943 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
12944           an.other.domain ? ...
12945 </literallayout>
12946 <para revisionflag="changed">
12947 The value for a match will be the list element string (starting <literal>@mx_</literal>).
12948 </para>
12949 </listitem>
12950 <listitem>
12951 <para>
12952 <indexterm role="concept">
12953 <primary>asterisk</primary>
12954 <secondary>in domain list</secondary>
12955 </indexterm>
12956 <indexterm role="concept">
12957 <primary>domain list</primary>
12958 <secondary>asterisk in</secondary>
12959 </indexterm>
12960 <indexterm role="concept">
12961 <primary>domain list</primary>
12962 <secondary>matching <quote>ends with</quote></secondary>
12963 </indexterm>
12964 If a pattern starts with an asterisk, the remaining characters of the pattern
12965 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
12966 domain lists differs from its use in partial matching lookups. In a domain
12967 list, the character following the asterisk need not be a dot, whereas partial
12968 matching works only in terms of dot-separated components. For example, a domain
12969 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
12970 <emphasis>cipher.key.ex</emphasis>.
12971 </para>
12972 <para revisionflag="changed">
12973 The value for a match will be the list element string (starting with the asterisk).
12974 Additionally, <varname>$0</varname> will be set to the matched string
12975 and <varname>$1</varname> to the variable portion which the asterisk matched.
12976 </para>
12977 </listitem>
12978 <listitem>
12979 <para>
12980 <indexterm role="concept">
12981 <primary>regular expressions</primary>
12982 <secondary>in domain list</secondary>
12983 </indexterm>
12984 <indexterm role="concept">
12985 <primary>domain list</primary>
12986 <secondary>matching regular expression</secondary>
12987 </indexterm>
12988 If a pattern starts with a circumflex character, it is treated as a regular
12989 expression, and matched against the domain using a regular expression matching
12990 function. The circumflex is treated as part of the regular expression.
12991 Email domains are case-independent, so this regular expression match is by
12992 default case-independent, but you can make it case-dependent by starting it
12993 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
12994 are given in chapter <xref linkend="CHAPregexp"/>.
12995 </para>
12996 <para>
12997 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
12998 must escape any backslash and dollar characters in the regular expression, or
12999 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
13000 it is not to be expanded (unless you really do want to build a regular
13001 expression by expansion, of course).
13002 </para>
13003 <para revisionflag="changed">
13004 The value for a match will be the list element string (starting with the circumflex).
13005 Additionally, <varname>$0</varname> will be set to the string matching the regular expression,
13006 and <varname>$1</varname> (onwards) to any submatches identified by parentheses.
13007 </para>
13008 </listitem>
13009 <listitem>
13010 <para>
13011 <indexterm role="concept">
13012 <primary>lookup</primary>
13013 <secondary>in domain list</secondary>
13014 </indexterm>
13015 <indexterm role="concept">
13016 <primary>domain list</primary>
13017 <secondary>matching by lookup</secondary>
13018 </indexterm>
13019 If a pattern starts with the name of a single-key lookup type followed by a
13020 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
13021 must be a filename in a suitable format for the lookup type. For example, for
13022 <quote>cdb;</quote> it must be an absolute path:
13023 </para>
13024 <literallayout class="monospaced">
13025 domains = cdb;/etc/mail/local_domains.cdb
13026 </literallayout>
13027 <para>
13028 The appropriate type of lookup is done on the file using the domain name as the
13029 key. In most cases, the value resulting from the lookup is not used; Exim is interested
13030 only in whether or not the key is present in the file. However, when a lookup
13031 is used for the <option>domains</option> option on a router
13032 or a <option>domains</option> condition in an ACL statement, the value is preserved in the
13033 <varname>$domain_data</varname> variable and can be referred to in other router options or
13034 other statements in the same ACL.
13035 <indexterm role="concept">
13036 <primary>tainted data</primary>
13037 <secondary>de-tainting</secondary>
13038 </indexterm>
13039 The value will be untainted.
13040 </para>
13041 </listitem>
13042 <listitem>
13043 <para>
13044 Any of the single-key lookup type names may be preceded by
13045 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
13046 </para>
13047 <literallayout class="monospaced">
13048 domains = partial-dbm;/partial/domains
13049 </literallayout>
13050 <para>
13051 This causes partial matching logic to be invoked; a description of how this
13052 works is given in section <xref linkend="SECTpartiallookup"/>.
13053 </para>
13054 </listitem>
13055 <listitem>
13056 <para>
13057 <indexterm role="concept">
13058 <primary>asterisk</primary>
13059 <secondary>in lookup type</secondary>
13060 </indexterm>
13061 Any of the single-key lookup types may be followed by an asterisk. This causes
13062 a default lookup for a key consisting of a single asterisk to be done if the
13063 original lookup fails. This is not a useful feature when using a domain list to
13064 select particular domains (because any domain would match), but it might have
13065 value if the result of the lookup is being used via the <varname>$domain_data</varname>
13066 expansion variable.
13067 </para>
13068 </listitem>
13069 <listitem>
13070 <para>
13071 If the pattern starts with the name of a query-style lookup type followed by a
13072 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
13073 pattern must be an appropriate query for the lookup type, as described in
13074 chapter <xref linkend="CHAPfdlookup"/>. For example:
13075 </para>
13076 <literallayout class="monospaced">
13077 hold_domains = mysql;select domain from holdlist \
13078   where domain = '${quote_mysql:$domain}';
13079 </literallayout>
13080 <para>
13081 In most cases, the value resulting from the lookup is not used (so for an SQL query, for
13082 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
13083 whether or not the query succeeds. However, when a lookup is used for the
13084 <option>domains</option> option on a router, the value is preserved in the <varname>$domain_data</varname>
13085 variable and can be referred to in other options.
13086 <indexterm role="concept">
13087 <primary>tainted data</primary>
13088 <secondary>de-tainting</secondary>
13089 </indexterm>
13090 The value will be untainted.
13091 </para>
13092 </listitem>
13093 <listitem>
13094 <para revisionflag="changed">
13095 If the pattern starts with the name of a lookup type
13096 of either kind (single-key or query-style) it may be
13097 followed by a comma and options,
13098 The options are lookup-type specific and consist of a comma-separated list.
13099 Each item starts with a tag and and equals "=".
13100 </para>
13101 </listitem>
13102 <listitem>
13103 <para>
13104 <indexterm role="concept">
13105 <primary>domain list</primary>
13106 <secondary>matching literal domain name</secondary>
13107 </indexterm>
13108 If none of the above cases apply, a caseless textual comparison is made
13109 between the pattern and the domain.
13110 </para>
13111 <para>
13112 The value for a match will be the list element string.
13113 <indexterm role="concept">
13114 <primary>tainted data</primary>
13115 <secondary>de-tainting</secondary>
13116 </indexterm>
13117 Note that this is commonly untainted
13118 (depending on the way the list was created).
13119 Specifically, explicit text in the configuration file in not tainted.
13120 This is a useful way of obtaining an untainted equivalent to
13121 the domain, for later operations.
13122 </para>
13123 <para>
13124 However if the list (including one-element lists)
13125 is created by expanding a variable containing tainted data,
13126 it is tainted and so will the match value be.
13127 </para>
13128 </listitem>
13129 </itemizedlist>
13130 <para>
13131 Here is an example that uses several different kinds of pattern:
13132 </para>
13133 <literallayout class="monospaced">
13134 domainlist funny_domains = \
13135   @ : \
13136   lib.unseen.edu : \
13137   *.foundation.fict.example : \
13138   \N^[1-2]\d{3}\.fict\.example$\N : \
13139   partial-dbm;/opt/data/penguin/book : \
13140   nis;domains.byname : \
13141   nisplus;[name=$domain,status=local],domains.org_dir
13142 </literallayout>
13143 <para>
13144 There are obvious processing trade-offs among the various matching modes. Using
13145 an asterisk is faster than a regular expression, and listing a few names
13146 explicitly probably is too. The use of a file or database lookup is expensive,
13147 but may be the only option if hundreds of names are required. Because the
13148 patterns are tested in order, it makes sense to put the most commonly matched
13149 patterns earlier.
13150 </para>
13151 </section>
13152 <section id="SECThostlist">
13153 <title>Host lists</title>
13154 <para>
13155 <indexterm role="concept">
13156 <primary>host list</primary>
13157 <secondary>patterns in</secondary>
13158 </indexterm>
13159 <indexterm role="concept">
13160 <primary>list</primary>
13161 <secondary>host list</secondary>
13162 </indexterm>
13163 Host lists are used to control what remote hosts are allowed to do. For
13164 example, some hosts may be allowed to use the local host as a relay, and some
13165 may be permitted to use the SMTP ETRN command. Hosts can be identified in
13166 two different ways, by name or by IP address. In a host list, some types of
13167 pattern are matched to a host name, and some are matched to an IP address.
13168 You need to be particularly careful with this when single-key lookups are
13169 involved, to ensure that the right value is being used as the key.
13170 </para>
13171 </section>
13172 <section id="SECID80">
13173 <title>Special host list patterns</title>
13174 <para>
13175 <indexterm role="concept">
13176 <primary>empty item in hosts list</primary>
13177 </indexterm>
13178 <indexterm role="concept">
13179 <primary>host list</primary>
13180 <secondary>empty string in</secondary>
13181 </indexterm>
13182 If a host list item is the empty string, it matches only when no remote host is
13183 involved. This is the case when a message is being received from a local
13184 process using SMTP on the standard input, that is, when a TCP/IP connection is
13185 not used.
13186 </para>
13187 <para>
13188 <indexterm role="concept">
13189 <primary>asterisk</primary>
13190 <secondary>in host list</secondary>
13191 </indexterm>
13192 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
13193 the IP address nor the name is actually inspected.
13194 </para>
13195 </section>
13196 <section id="SECThoslispatip">
13197 <title>Host list patterns that match by IP address</title>
13198 <para>
13199 <indexterm role="concept">
13200 <primary>host list</primary>
13201 <secondary>matching IP addresses</secondary>
13202 </indexterm>
13203 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
13204 the incoming address actually appears in the IPv6 host as
13205 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
13206 list, it is converted into a traditional IPv4 address first. (Not all operating
13207 systems accept IPv4 calls on IPv6 sockets, as there have been some security
13208 concerns.)
13209 </para>
13210 <para>
13211 The following types of pattern in a host list check the remote host by
13212 inspecting its IP address:
13213 </para>
13214 <itemizedlist>
13215 <listitem>
13216 <para>
13217 If the pattern is a plain domain name (not a regular expression, not starting
13218 with *, not a lookup of any kind), Exim calls the operating system function
13219 to find the associated IP address(es). Exim uses the newer
13220 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
13221 This typically causes a forward DNS lookup of the name. The result is compared
13222 with the IP address of the subject host.
13223 </para>
13224 <para>
13225 If there is a temporary problem (such as a DNS timeout) with the host name
13226 lookup, a temporary error occurs. For example, if the list is being used in an
13227 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
13228 temporary SMTP error code. If no IP address can be found for the host name,
13229 what happens is described in section <xref linkend="SECTbehipnot"/> below.
13230 </para>
13231 </listitem>
13232 <listitem>
13233 <para>
13234 <indexterm role="concept">
13235 <primary>@ in a host list</primary>
13236 </indexterm>
13237 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
13238 domain name, as just described.
13239 </para>
13240 </listitem>
13241 <listitem>
13242 <para>
13243 If the pattern is an IP address, it is matched against the IP address of the
13244 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
13245 IPv6 addresses can be given in colon-separated format, but the colons have to
13246 be doubled so as not to be taken as item separators when the default list
13247 separator is used. IPv6 addresses are recognized even when Exim is compiled
13248 without IPv6 support. This means that if they appear in a host list on an
13249 IPv4-only host, Exim will not treat them as host names. They are just addresses
13250 that can never match a client host.
13251 </para>
13252 </listitem>
13253 <listitem>
13254 <para>
13255 <indexterm role="concept">
13256 <primary>@[] in a host list</primary>
13257 </indexterm>
13258 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
13259 the local host. For example, if the local host is an IPv4 host with one
13260 interface address 10.45.23.56, these two ACL statements have the same effect:
13261 </para>
13262 <literallayout class="monospaced">
13263 accept hosts = 127.0.0.1 : 10.45.23.56
13264 accept hosts = @[]
13265 </literallayout>
13266 </listitem>
13267 <listitem>
13268 <para>
13269 <indexterm role="concept">
13270 <primary>CIDR notation</primary>
13271 </indexterm>
13272 If the pattern is an IP address followed by a slash and a mask length (for
13273 example 10.11.42.0/24), it is matched against the IP address of the subject
13274 host under the given mask. This allows, an entire network of hosts to be
13275 included (or excluded) by a single item. The mask uses CIDR notation; it
13276 specifies the number of address bits that must match, starting from the most
13277 significant end of the address.
13278 </para>
13279 <para>
13280 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
13281 of a range of addresses. It is the number of bits in the network portion of the
13282 address. The above example specifies a 24-bit netmask, so it matches all 256
13283 addresses in the 10.11.42.0 network. An item such as
13284 </para>
13285 <literallayout class="monospaced">
13286 192.168.23.236/31
13287 </literallayout>
13288 <para>
13289 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
13290 32 for an IPv4 address is the same as no mask at all; just a single address
13291 matches.
13292 </para>
13293 <para>
13294 Here is another example which shows an IPv4 and an IPv6 network:
13295 </para>
13296 <literallayout class="monospaced">
13297 recipient_unqualified_hosts = 192.168.0.0/16: \
13298                               3ffe::ffff::836f::::/48
13299 </literallayout>
13300 <para>
13301 The doubling of list separator characters applies only when these items
13302 appear inline in a host list. It is not required when indirecting via a file.
13303 For example:
13304 </para>
13305 <literallayout class="monospaced">
13306 recipient_unqualified_hosts = /opt/exim/unqualnets
13307 </literallayout>
13308 <para>
13309 could make use of a file containing
13310 </para>
13311 <literallayout class="monospaced">
13312 172.16.0.0/12
13313 3ffe:ffff:836f::/48
13314 </literallayout>
13315 <para>
13316 to have exactly the same effect as the previous example. When listing IPv6
13317 addresses inline, it is usually more convenient to use the facility for
13318 changing separator characters. This list contains the same two networks:
13319 </para>
13320 <literallayout class="monospaced">
13321 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
13322                                  3ffe:ffff:836f::/48
13323 </literallayout>
13324 <para>
13325 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
13326 list.
13327 </para>
13328 </listitem>
13329 </itemizedlist>
13330 </section>
13331 <section id="SECThoslispatsikey">
13332 <title>Host list patterns for single-key lookups by host address</title>
13333 <para>
13334 <indexterm role="concept">
13335 <primary>host list</primary>
13336 <secondary>lookup of IP address</secondary>
13337 </indexterm>
13338 When a host is to be identified by a single-key lookup of its complete IP
13339 address, the pattern takes this form:
13340 </para>
13341 <literallayout>
13342 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
13343 </literallayout>
13344 <para>
13345 For example:
13346 </para>
13347 <literallayout class="monospaced">
13348 hosts_lookup = net-cdb;/hosts-by-ip.db
13349 </literallayout>
13350 <para>
13351 The text form of the IP address of the subject host is used as the lookup key.
13352 IPv6 addresses are converted to an unabbreviated form, using lower case
13353 letters, with dots as separators because colon is the key terminator in
13354 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
13355 quoting the keys, but this is a facility that was added later.] The data
13356 returned by the lookup is not used.
13357 </para>
13358 <para>
13359 <indexterm role="concept">
13360 <primary>IP address</primary>
13361 <secondary>masking</secondary>
13362 </indexterm>
13363 <indexterm role="concept">
13364 <primary>host list</primary>
13365 <secondary>masked IP address</secondary>
13366 </indexterm>
13367 Single-key lookups can also be performed using masked IP addresses, using
13368 patterns of this form:
13369 </para>
13370 <literallayout>
13371 <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>
13372 </literallayout>
13373 <para>
13374 For example:
13375 </para>
13376 <literallayout class="monospaced">
13377 net24-dbm;/networks.db
13378 </literallayout>
13379 <para>
13380 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
13381 length. A textual string is constructed from the masked value, followed by the
13382 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
13383 is 192.168.34.6, the key that is looked up for the above example is
13384 <quote>192.168.34.0/24</quote>.
13385 </para>
13386 <para>
13387 When an IPv6 address is converted to a string, dots are normally used instead
13388 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
13389 terminate <command>lsearch</command> keys). This was implemented some time before the ability
13390 to quote keys was made available in <command>lsearch</command> files. However, the more
13391 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
13392 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
13393 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
13394 converted using colons and not dots.
13395 In all cases except IPv4-mapped IPv6, full, unabbreviated IPv6
13396 addresses are always used.
13397 The latter are converted to IPv4 addresses, in dotted-quad form.
13398 </para>
13399 <para>
13400 Ideally, it would be nice to tidy up this anomalous situation by changing to
13401 colons in all cases, given that quoting is now available for <command>lsearch</command>.
13402 However, this would be an incompatible change that might break some existing
13403 configurations.
13404 </para>
13405 <para>
13406 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
13407 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
13408 the former case the key strings include the mask value, whereas in the latter
13409 case the IP address is used on its own.
13410 </para>
13411 </section>
13412 <section id="SECThoslispatnam">
13413 <title>Host list patterns that match by host name</title>
13414 <para>
13415 <indexterm role="concept">
13416 <primary>host</primary>
13417 <secondary>lookup failures</secondary>
13418 </indexterm>
13419 <indexterm role="concept">
13420 <primary>unknown host name</primary>
13421 </indexterm>
13422 <indexterm role="concept">
13423 <primary>host list</primary>
13424 <secondary>matching host name</secondary>
13425 </indexterm>
13426 There are several types of pattern that require Exim to know the name of the
13427 remote host. These are either wildcard patterns or lookups by name. (If a
13428 complete hostname is given without any wildcarding, it is used to find an IP
13429 address to match against, as described in section <xref linkend="SECThoslispatip"/>
13430 above.)
13431 </para>
13432 <para>
13433 If the remote host name is not already known when Exim encounters one of these
13434 patterns, it has to be found from the IP address.
13435 Although many sites on the Internet are conscientious about maintaining reverse
13436 DNS data for their hosts, there are also many that do not do this.
13437 Consequently, a name cannot always be found, and this may lead to unwanted
13438 effects. Take care when configuring host lists with wildcarded name patterns.
13439 Consider what will happen if a name cannot be found.
13440 </para>
13441 <para>
13442 Because of the problems of determining host names from IP addresses, matching
13443 against host names is not as common as matching against IP addresses.
13444 </para>
13445 <para>
13446 By default, in order to find a host name, Exim first does a reverse DNS lookup;
13447 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
13448 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
13449 are done can be changed by setting the <option>host_lookup_order</option> option. For
13450 security, once Exim has found one or more names, it looks up the IP addresses
13451 for these names and compares them with the IP address that it started with.
13452 Only those names whose IP addresses match are accepted. Any other names are
13453 discarded. If no names are left, Exim behaves as if the host name cannot be
13454 found. In the most common case there is only one name and one IP address.
13455 </para>
13456 <para>
13457 There are some options that control what happens if a host name cannot be
13458 found. These are described in section <xref linkend="SECTbehipnot"/> below.
13459 </para>
13460 <para>
13461 <indexterm role="concept">
13462 <primary>host</primary>
13463 <secondary>alias for</secondary>
13464 </indexterm>
13465 <indexterm role="concept">
13466 <primary>alias for host</primary>
13467 </indexterm>
13468 As a result of aliasing, hosts may have more than one name. When processing any
13469 of the following types of pattern, all the host&#x2019;s names are checked:
13470 </para>
13471 <itemizedlist>
13472 <listitem>
13473 <para>
13474 <indexterm role="concept">
13475 <primary>asterisk</primary>
13476 <secondary>in host list</secondary>
13477 </indexterm>
13478 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
13479 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
13480 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
13481 requirement. Other kinds of wildcarding require the use of a regular
13482 expression.
13483 </para>
13484 </listitem>
13485 <listitem>
13486 <para>
13487 <indexterm role="concept">
13488 <primary>regular expressions</primary>
13489 <secondary>in host list</secondary>
13490 </indexterm>
13491 <indexterm role="concept">
13492 <primary>host list</primary>
13493 <secondary>regular expression in</secondary>
13494 </indexterm>
13495 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
13496 matched against the host name. Host names are case-independent, so this regular
13497 expression match is by default case-independent, but you can make it
13498 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
13499 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
13500 example,
13501 </para>
13502 <literallayout class="monospaced">
13503 ^(a|b)\.c\.d$
13504 </literallayout>
13505 <para>
13506 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
13507 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
13508 that backslash and dollar characters are not misinterpreted as part of the
13509 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
13510 part of the string as non-expandable. For example:
13511 </para>
13512 <literallayout class="monospaced">
13513 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
13514 </literallayout>
13515 <para>
13516 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
13517 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
13518 example. Without it, a match at the start of the host name is all that is
13519 required.
13520 </para>
13521 </listitem>
13522 </itemizedlist>
13523 </section>
13524 <section id="SECTbehipnot">
13525 <title>Behaviour when an IP address or name cannot be found</title>
13526 <para>
13527 <indexterm role="concept">
13528 <primary>host</primary>
13529 <secondary>lookup failures, permanent</secondary>
13530 </indexterm>
13531 While processing a host list, Exim may need to look up an IP address from a
13532 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
13533 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
13534 behaviour when it fails to find the information it is seeking is the same.
13535 </para>
13536 <para>
13537 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
13538 apply to temporary DNS errors, whose handling is described in the next section.
13539 </para>
13540 <para>
13541 <indexterm role="concept">
13542 <primary><literal>+include_unknown</literal></primary>
13543 </indexterm>
13544 <indexterm role="concept">
13545 <primary><literal>+ignore_unknown</literal></primary>
13546 </indexterm>
13547 Exim parses a host list from left to right. If it encounters a permanent
13548 lookup failure in any item in the host list before it has found a match,
13549 Exim treats it as a failure and the default behavior is as if the host
13550 does not match the list. This may not always be what you want to happen.
13551 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
13552 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
13553 not recognized in an indirected file).
13554 </para>
13555 <itemizedlist>
13556 <listitem>
13557 <para>
13558 If any item that follows <literal>+include_unknown</literal> requires information that
13559 cannot found, Exim behaves as if the host does match the list. For example,
13560 </para>
13561 <literallayout class="monospaced">
13562 host_reject_connection = +include_unknown:*.enemy.ex
13563 </literallayout>
13564 <para>
13565 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
13566 any hosts whose name it cannot find.
13567 </para>
13568 </listitem>
13569 <listitem>
13570 <para>
13571 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
13572 be found, Exim ignores that item and proceeds to the rest of the list. For
13573 example:
13574 </para>
13575 <literallayout class="monospaced">
13576 accept hosts = +ignore_unknown : friend.example : \
13577                192.168.4.5
13578 </literallayout>
13579 <para>
13580 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
13581 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
13582 name can be found for 192.168.4.5, it is rejected.
13583 </para>
13584 </listitem>
13585 </itemizedlist>
13586 <para>
13587 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
13588 list. The effect of each one lasts until the next, or until the end of the
13589 list.
13590 </para>
13591 </section>
13592 <section id="SECTmixwilhos">
13593 <title>Mixing wildcarded host names and addresses in host lists</title>
13594 <para>
13595 <indexterm role="concept">
13596 <primary>host list</primary>
13597 <secondary>mixing names and addresses in</secondary>
13598 </indexterm>
13599 </para>
13600 <para>
13601 This section explains the host/ip processing logic with the same concepts
13602 as the previous section, but specifically addresses what happens when a
13603 wildcarded hostname is one of the items in the hostlist.
13604 </para>
13605 <itemizedlist>
13606 <listitem>
13607 <para>
13608 If you have name lookups or wildcarded host names and
13609 IP addresses in the same host list, you should normally put the IP
13610 addresses first. For example, in an ACL you could have:
13611 </para>
13612 <literallayout class="monospaced">
13613 accept hosts = 10.9.8.7 : *.friend.example
13614 </literallayout>
13615 <para>
13616 The reason you normally would order it this way lies in the
13617 left-to-right way that Exim processes lists.  It can test IP addresses
13618 without doing any DNS lookups, but when it reaches an item that requires
13619 a host name, it fails if it cannot find a host name to compare with the
13620 pattern. If the above list is given in the opposite order, the
13621 <option>accept</option> statement fails for a host whose name cannot be found, even
13622 if its IP address is 10.9.8.7.
13623 </para>
13624 </listitem>
13625 <listitem>
13626 <para>
13627 If you really do want to do the name check first, and still recognize the IP
13628 address, you can rewrite the ACL like this:
13629 </para>
13630 <literallayout class="monospaced">
13631 accept hosts = *.friend.example
13632 accept hosts = 10.9.8.7
13633 </literallayout>
13634 <para>
13635 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
13636 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
13637 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
13638 this section.
13639 </para>
13640 </listitem>
13641 </itemizedlist>
13642 </section>
13643 <section id="SECTtemdnserr">
13644 <title>Temporary DNS errors when looking up host information</title>
13645 <para>
13646 <indexterm role="concept">
13647 <primary>host</primary>
13648 <secondary>lookup failures, temporary</secondary>
13649 </indexterm>
13650 <indexterm role="concept">
13651 <primary><literal>+include_defer</literal></primary>
13652 </indexterm>
13653 <indexterm role="concept">
13654 <primary><literal>+ignore_defer</literal></primary>
13655 </indexterm>
13656 A temporary DNS lookup failure normally causes a defer action (except when
13657 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
13658 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
13659 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
13660 section. These options should be used with care, probably only in non-critical
13661 host lists such as whitelists.
13662 </para>
13663 </section>
13664 <section id="SECThoslispatnamsk">
13665 <title>Host list patterns for single-key lookups by host name</title>
13666 <para>
13667 <indexterm role="concept">
13668 <primary>unknown host name</primary>
13669 </indexterm>
13670 <indexterm role="concept">
13671 <primary>host list</primary>
13672 <secondary>matching host name</secondary>
13673 </indexterm>
13674 If a pattern is of the form
13675 </para>
13676 <literallayout>
13677 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
13678 </literallayout>
13679 <para>
13680 for example
13681 </para>
13682 <literallayout class="monospaced">
13683 dbm;/host/accept/list
13684 </literallayout>
13685 <para>
13686 a single-key lookup is performed, using the host name as its key. If the
13687 lookup succeeds, the host matches the item. The actual data that is looked up
13688 is not used.
13689 </para>
13690 <para>
13691 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
13692 keys in the file, not IP addresses. If you want to do lookups based on IP
13693 addresses, you must precede the search type with <quote>net-</quote> (see section
13694 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
13695 two items in the same list, one doing an address lookup and one doing a name
13696 lookup, both using the same file.
13697 </para>
13698 </section>
13699 <section id="SECID81">
13700 <title>Host list patterns for query-style lookups</title>
13701 <para>
13702 If a pattern is of the form
13703 </para>
13704 <literallayout>
13705 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
13706 </literallayout>
13707 <para>
13708 the query is obeyed, and if it succeeds, the host matches the item. The actual
13709 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
13710 <varname>$sender_host_name</varname> can be used in the query. For example:
13711 </para>
13712 <literallayout class="monospaced">
13713 hosts_lookup = pgsql;\
13714   select ip from hostlist where ip='$sender_host_address'
13715 </literallayout>
13716 <para>
13717 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
13718 can use the <option>sg</option> expansion item to change this if you need to. If you want to
13719 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
13720 operator.
13721 </para>
13722 <para>
13723 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
13724 looks up the host name if it has not already done so. (See section
13725 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
13726 </para>
13727 <para>
13728 Historical note: prior to release 4.30, Exim would always attempt to find a
13729 host name before running the query, unless the search type was preceded by
13730 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
13731 still recognized for query-style lookups, but its presence or absence has no
13732 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
13733 See section <xref linkend="SECThoslispatsikey"/>.)
13734 </para>
13735 </section>
13736 <section id="SECTaddresslist">
13737 <title>Address lists</title>
13738 <para>
13739 <indexterm role="concept">
13740 <primary>list</primary>
13741 <secondary>address list</secondary>
13742 </indexterm>
13743 <indexterm role="concept">
13744 <primary>address list</primary>
13745 <secondary>empty item</secondary>
13746 </indexterm>
13747 <indexterm role="concept">
13748 <primary>address list</primary>
13749 <secondary>patterns</secondary>
13750 </indexterm>
13751 Address lists contain patterns that are matched against mail addresses. There
13752 is one special case to be considered: the sender address of a bounce message is
13753 always empty. You can test for this by providing an empty item in an address
13754 list. For example, you can set up a router to process bounce messages by
13755 using this option setting:
13756 </para>
13757 <literallayout class="monospaced">
13758 senders = :
13759 </literallayout>
13760 <para>
13761 The presence of the colon creates an empty item. If you do not provide any
13762 data, the list is empty and matches nothing. The empty sender can also be
13763 detected by a regular expression that matches an empty string,
13764 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
13765 </para>
13766 <para>
13767 Non-empty items in an address list can be straightforward email addresses. For
13768 example:
13769 </para>
13770 <literallayout class="monospaced">
13771 senders = jbc@askone.example : hs@anacreon.example
13772 </literallayout>
13773 <para>
13774 A certain amount of wildcarding is permitted. If a pattern contains an @
13775 character, but is not a regular expression and does not begin with a
13776 semicolon-terminated lookup type (described below), the local part of the
13777 subject address is compared with the local part of the pattern, which may start
13778 with an asterisk. If the local parts match, the domain is checked in exactly
13779 the same way as for a pattern in a domain list. For example, the domain can be
13780 wildcarded, refer to a named list, or be a lookup:
13781 </para>
13782 <literallayout class="monospaced">
13783 deny senders = *@*.spamming.site:\
13784                *@+hostile_domains:\
13785                bozo@partial-lsearch;/list/of/dodgy/sites:\
13786                *@dbm;/bad/domains.db
13787 </literallayout>
13788 <para>
13789 <indexterm role="concept">
13790 <primary>local part</primary>
13791 <secondary>starting with !</secondary>
13792 </indexterm>
13793 <indexterm role="concept">
13794 <primary>address list</primary>
13795 <secondary>local part starting with !</secondary>
13796 </indexterm>
13797 If a local part that begins with an exclamation mark is required, it has to be
13798 specified using a regular expression, because otherwise the exclamation mark is
13799 treated as a sign of negation, as is standard in lists.
13800 </para>
13801 <para>
13802 If a non-empty pattern that is not a regular expression or a lookup does not
13803 contain an @ character, it is matched against the domain part of the subject
13804 address. The only two formats that are recognized this way are a literal
13805 domain, or a domain pattern that starts with *. In both these cases, the effect
13806 is the same as if <literal>*@</literal> preceded the pattern. For example:
13807 </para>
13808 <literallayout class="monospaced">
13809 deny senders = enemy.domain : *.enemy.domain
13810 </literallayout>
13811 <para>
13812 The following kinds of more complicated address list pattern can match any
13813 address, including the empty address that is characteristic of bounce message
13814 senders:
13815 </para>
13816 <itemizedlist>
13817 <listitem>
13818 <para>
13819 <indexterm role="concept">
13820 <primary>regular expressions</primary>
13821 <secondary>in address list</secondary>
13822 </indexterm>
13823 <indexterm role="concept">
13824 <primary>address list</primary>
13825 <secondary>regular expression in</secondary>
13826 </indexterm>
13827 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
13828 done against the complete address, with the pattern as the regular expression.
13829 You must take care that backslash and dollar characters are not misinterpreted
13830 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
13831 to mark that part of the string as non-expandable. For example:
13832 </para>
13833 <literallayout class="monospaced">
13834 deny senders = \N^.*this.*@example\.com$\N : \
13835                \N^\d{8}.+@spamhaus.example$\N : ...
13836 </literallayout>
13837 <para>
13838 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
13839 start with <quote>^</quote> by the time they are being interpreted as address patterns.
13840 </para>
13841 </listitem>
13842 <listitem>
13843 <para>
13844 <indexterm role="concept">
13845 <primary>address list</primary>
13846 <secondary>lookup for complete address</secondary>
13847 </indexterm>
13848 Complete addresses can be looked up by using a pattern that starts with a
13849 lookup type terminated by a semicolon, followed by the data for the lookup. For
13850 example:
13851 </para>
13852 <literallayout class="monospaced">
13853 deny senders = cdb;/etc/blocked.senders : \
13854   mysql;select address from blocked where \
13855   address='${quote_mysql:$sender_address}'
13856 </literallayout>
13857 <para>
13858 Both query-style and single-key lookup types can be used. For a single-key
13859 lookup type, Exim uses the complete address as the key. However, empty keys are
13860 not supported for single-key lookups, so a match against the empty address
13861 always fails. This restriction does not apply to query-style lookups.
13862 </para>
13863 <para>
13864 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
13865 cannot be used, and is ignored if specified, with an entry being written to the
13866 panic log.
13867 <indexterm role="concept">
13868 <primary>*@ with single-key lookup</primary>
13869 </indexterm>
13870 However, you can configure lookup defaults, as described in section
13871 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
13872 default. For example, with this lookup:
13873 </para>
13874 <literallayout class="monospaced">
13875 accept senders = lsearch*@;/some/file
13876 </literallayout>
13877 <para>
13878 the file could contains lines like this:
13879 </para>
13880 <literallayout class="monospaced">
13881 user1@domain1.example
13882 *@domain2.example
13883 </literallayout>
13884 <para>
13885 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
13886 that are tried is:
13887 </para>
13888 <literallayout class="monospaced">
13889 nimrod@jaeger.example
13890 *@jaeger.example
13891 *
13892 </literallayout>
13893 <para>
13894 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
13895 would mean that every address matches, thus rendering the test useless.
13896 </para>
13897 <para>
13898 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
13899 </para>
13900 <literallayout class="monospaced">
13901 deny recipients = dbm*@;/some/file
13902 deny recipients = *@dbm;/some/file
13903 </literallayout>
13904 <para>
13905 The first does a whole address lookup, with defaulting, as just described,
13906 because it starts with a lookup type. The second matches the local part and
13907 domain independently, as described in a bullet point below.
13908 </para>
13909 </listitem>
13910 </itemizedlist>
13911 <para>
13912 The following kinds of address list pattern can match only non-empty addresses.
13913 If the subject address is empty, a match against any of these pattern types
13914 always fails.
13915 </para>
13916 <itemizedlist>
13917 <listitem>
13918 <para>
13919 <indexterm role="concept">
13920 <primary>@@ with single-key lookup</primary>
13921 </indexterm>
13922 <indexterm role="concept">
13923 <primary>address list</primary>
13924 <secondary>@@ lookup type</secondary>
13925 </indexterm>
13926 <indexterm role="concept">
13927 <primary>address list</primary>
13928 <secondary>split local part and domain</secondary>
13929 </indexterm>
13930 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
13931 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
13932 split into a local part and a domain. The domain is looked up in the file. If
13933 it is not found, there is no match. If it is found, the data that is looked up
13934 from the file is treated as a colon-separated list of local part patterns, each
13935 of which is matched against the subject local part in turn.
13936 </para>
13937 <para>
13938 <indexterm role="concept">
13939 <primary>asterisk</primary>
13940 <secondary>in address list</secondary>
13941 </indexterm>
13942 The lookup may be a partial one, and/or one involving a search for a default
13943 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
13944 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
13945 even be further lookups. They may also be independently negated. For example,
13946 with
13947 </para>
13948 <literallayout class="monospaced">
13949 deny senders = @@dbm;/etc/reject-by-domain
13950 </literallayout>
13951 <para>
13952 the data from which the DBM file is built could contain lines like
13953 </para>
13954 <literallayout class="monospaced">
13955 baddomain.com:  !postmaster : *
13956 </literallayout>
13957 <para>
13958 to reject all senders except <option>postmaster</option> from that domain.
13959 </para>
13960 <para>
13961 <indexterm role="concept">
13962 <primary>local part</primary>
13963 <secondary>starting with !</secondary>
13964 </indexterm>
13965 If a local part that actually begins with an exclamation mark is required, it
13966 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
13967 may be split over several lines by indenting the second and subsequent lines,
13968 but the separating colon must still be included at line breaks. White space
13969 surrounding the colons is ignored. For example:
13970 </para>
13971 <literallayout class="monospaced">
13972 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
13973   spammer3 : spammer4
13974 </literallayout>
13975 <para>
13976 As in all colon-separated lists in Exim, a colon can be included in an item by
13977 doubling.
13978 </para>
13979 <para>
13980 If the last item in the list starts with a right angle-bracket, the remainder
13981 of the item is taken as a new key to look up in order to obtain a continuation
13982 list of local parts. The new key can be any sequence of characters. Thus one
13983 might have entries like
13984 </para>
13985 <literallayout class="monospaced">
13986 aol.com: spammer1 : spammer 2 : &gt;*
13987 xyz.com: spammer3 : &gt;*
13988 *:       ^\d{8}$
13989 </literallayout>
13990 <para>
13991 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
13992 local parts for all domains, in addition to the specific local parts listed for
13993 each domain. Of course, using this feature costs another lookup each time a
13994 chain is followed, but the effort needed to maintain the data is reduced.
13995 </para>
13996 <para>
13997 <indexterm role="concept">
13998 <primary>loop</primary>
13999 <secondary>in lookups</secondary>
14000 </indexterm>
14001 It is possible to construct loops using this facility, and in order to catch
14002 them, the chains may be no more than fifty items long.
14003 </para>
14004 </listitem>
14005 <listitem>
14006 <para>
14007 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
14008 lookup, but in this case, the chaining facility is not available. The lookup
14009 can only return a single list of local parts.
14010 </para>
14011 </listitem>
14012 </itemizedlist>
14013 <para>
14014 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
14015 in these two examples:
14016 </para>
14017 <literallayout class="monospaced">
14018 senders = +my_list
14019 senders = *@+my_list
14020 </literallayout>
14021 <para>
14022 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
14023 example it is a named domain list.
14024 </para>
14025 </section>
14026 <section id="SECTcasletadd">
14027 <title>Case of letters in address lists</title>
14028 <para>
14029 <indexterm role="concept">
14030 <primary>case of local parts</primary>
14031 </indexterm>
14032 <indexterm role="concept">
14033 <primary>address list</primary>
14034 <secondary>case forcing</secondary>
14035 </indexterm>
14036 <indexterm role="concept">
14037 <primary>case forcing in address lists</primary>
14038 </indexterm>
14039 Domains in email addresses are always handled caselessly, but for local parts
14040 case may be significant on some systems (see <option>caseful_local_part</option> for how
14041 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
14042 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
14043 blocking lists should be done in a case-independent manner. Since most address
14044 lists in Exim are used for this kind of control, Exim attempts to do this by
14045 default.
14046 </para>
14047 <para>
14048 The domain portion of an address is always lowercased before matching it to an
14049 address list. The local part is lowercased by default, and any string
14050 comparisons that take place are done caselessly. This means that the data in
14051 the address list itself, in files included as plain filenames, and in any file
14052 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
14053 keys in files that are looked up by a search type other than <command>lsearch</command> (which
14054 works caselessly) must be in lower case, because these lookups are not
14055 case-independent.
14056 </para>
14057 <para>
14058 <indexterm role="concept">
14059 <primary><literal>+caseful</literal></primary>
14060 </indexterm>
14061 To allow for the possibility of caseful address list matching, if an item in
14062 an address list is the string <quote>+caseful</quote>, the original case of the local
14063 part is restored for any comparisons that follow, and string comparisons are no
14064 longer case-independent. This does not affect the domain, which remains in
14065 lower case. However, although independent matches on the domain alone are still
14066 performed caselessly, regular expressions that match against an entire address
14067 become case-sensitive after <quote>+caseful</quote> has been seen.
14068 </para>
14069 </section>
14070 <section id="SECTlocparlis">
14071 <title>Local part lists</title>
14072 <para>
14073 <indexterm role="concept">
14074 <primary>list</primary>
14075 <secondary>local part list</secondary>
14076 </indexterm>
14077 <indexterm role="concept">
14078 <primary>local part</primary>
14079 <secondary>list</secondary>
14080 </indexterm>
14081 Case-sensitivity in local part lists is handled in the same way as for address
14082 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
14083 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
14084 set false, the subject is lowercased and the matching is initially
14085 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
14086 matching in the local part list, but not elsewhere in the router. If
14087 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
14088 option is case-sensitive from the start.
14089 </para>
14090 <para>
14091 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
14092 comments are handled in the same way as address lists &ndash; they are recognized
14093 only if the # is preceded by white space or the start of the line.
14094 Otherwise, local part lists are matched in the same way as domain lists, except
14095 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
14096 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
14097 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
14098 types.
14099 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
14100 </para>
14101 </section>
14102 </chapter>
14103
14104 <chapter id="CHAPexpand">
14105 <title>String expansions</title>
14106 <para>
14107 <indexterm role="concept" id="IIDstrexp" class="startofrange">
14108 <primary>expansion</primary>
14109 <secondary>of strings</secondary>
14110 </indexterm>
14111 Many strings in Exim&#x2019;s runtime configuration are expanded before use. Some of
14112 them are expanded every time they are used; others are expanded only once.
14113 </para>
14114 <para>
14115 When a string is being expanded it is copied verbatim from left to right except
14116 <indexterm role="concept">
14117 <primary>expansion</primary>
14118 <secondary>string concatenation</secondary>
14119 </indexterm>
14120 when a dollar or backslash character is encountered. A dollar specifies the
14121 start of a portion of the string that is interpreted and replaced as described
14122 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
14123 escape character, as described in the following section.
14124 </para>
14125 <para>
14126 Whether a string is expanded depends upon the context.  Usually this is solely
14127 dependent upon the option for which a value is sought; in this documentation,
14128 options for which string expansion is performed are marked with &dagger; after
14129 the data type.  ACL rules always expand strings.  A couple of expansion
14130 conditions do not expand some of the brace-delimited branches, for security
14131 reasons,
14132 <indexterm role="concept">
14133 <primary>tainted data</primary>
14134 <secondary>expansion</secondary>
14135 </indexterm>
14136 <indexterm role="concept">
14137 <primary>expansion</primary>
14138 <secondary>tainted data</secondary>
14139 </indexterm>
14140 and expansion of data deriving from the sender (<quote>tainted data</quote>)
14141 is not permitted.
14142 </para>
14143 <section id="SECTlittext">
14144 <title>Literal text in expanded strings</title>
14145 <para>
14146 <indexterm role="concept">
14147 <primary>expansion</primary>
14148 <secondary>including literal text</secondary>
14149 </indexterm>
14150 An uninterpreted dollar can be included in an expanded string by putting a
14151 backslash in front of it. A backslash can be used to prevent any special
14152 character being treated specially in an expansion, including backslash itself.
14153 If the string appears in quotes in the configuration file, two backslashes are
14154 required because the quotes themselves cause interpretation of backslashes when
14155 the string is read in (see section <xref linkend="SECTstrings"/>).
14156 </para>
14157 <para>
14158 <indexterm role="concept">
14159 <primary>expansion</primary>
14160 <secondary>non-expandable substrings</secondary>
14161 </indexterm>
14162 A portion of the string can specified as non-expandable by placing it between
14163 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
14164 expressions, which often contain backslashes and dollar signs. For example:
14165 </para>
14166 <literallayout class="monospaced">
14167 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
14168 </literallayout>
14169 <para>
14170 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
14171 without interpretation until it reaches the next <literal>\N</literal> or the end of the
14172 string.
14173 </para>
14174 </section>
14175 <section id="SECID82">
14176 <title>Character escape sequences in expanded strings</title>
14177 <para>
14178 <indexterm role="concept">
14179 <primary>expansion</primary>
14180 <secondary>escape sequences</secondary>
14181 </indexterm>
14182 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
14183 expanded string is recognized as an escape sequence for the character newline,
14184 carriage return, or tab, respectively. A backslash followed by up to three
14185 octal digits is recognized as an octal encoding for a single character, and a
14186 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
14187 encoding.
14188 </para>
14189 <para>
14190 These escape sequences are also recognized in quoted strings when they are read
14191 in. Their interpretation in expansions as well is useful for unquoted strings,
14192 and for other cases such as looked-up strings that are then expanded.
14193 </para>
14194 </section>
14195 <section id="SECID83">
14196 <title>Testing string expansions</title>
14197 <para>
14198 <indexterm role="concept">
14199 <primary>expansion</primary>
14200 <secondary>testing</secondary>
14201 </indexterm>
14202 <indexterm role="concept">
14203 <primary>testing</primary>
14204 <secondary>string expansion</secondary>
14205 </indexterm>
14206 <indexterm role="option">
14207 <primary><option>-be</option></primary>
14208 </indexterm>
14209 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
14210 takes the command arguments, or lines from the standard input if there are no
14211 arguments, runs them through the string expansion code, and writes the results
14212 to the standard output. Variables based on configuration values are set up, but
14213 since no message is being processed, variables such as <varname>$local_part</varname> have no
14214 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
14215 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
14216 and <option>nhash</option>.
14217 </para>
14218 <para>
14219 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
14220 instead runs under the uid and gid it was called with, to prevent users from
14221 using <option>-be</option> for reading files to which they do not have access.
14222 </para>
14223 <para>
14224 <indexterm role="option">
14225 <primary><option>-bem</option></primary>
14226 </indexterm>
14227 If you want to test expansions that include variables whose values are taken
14228 from a message, there are two other options that can be used. The <option>-bem</option>
14229 option is like <option>-be</option> except that it is followed by a filename. The file is
14230 read as a message before doing the test expansions. For example:
14231 </para>
14232 <literallayout class="monospaced">
14233 exim -bem /tmp/test.message '$h_subject:'
14234 </literallayout>
14235 <para>
14236 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
14237 Exim message identifier. For example:
14238 </para>
14239 <literallayout class="monospaced">
14240 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
14241 </literallayout>
14242 <para>
14243 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
14244 is therefore restricted to admin users.
14245 </para>
14246 </section>
14247 <section id="SECTforexpfai">
14248 <title>Forced expansion failure</title>
14249 <para>
14250 <indexterm role="concept">
14251 <primary>expansion</primary>
14252 <secondary>forced failure</secondary>
14253 </indexterm>
14254 A number of expansions that are described in the following section have
14255 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
14256 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
14257 used depends on some condition that is evaluated as part of the expansion. If,
14258 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
14259 the entire string expansion fails in a way that can be detected by the code
14260 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
14261 its consequences depend on the circumstances. In some cases it is no different
14262 from any other expansion failure, but in others a different action may be
14263 taken. Such variations are mentioned in the documentation of the option that is
14264 being expanded.
14265 </para>
14266 </section>
14267 <section id="SECTexpansionitems">
14268 <title>Expansion items</title>
14269 <para>
14270 The following items are recognized in expanded strings. White space may be used
14271 between sub-items that are keywords or substrings enclosed in braces inside an
14272 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
14273 white space is significant.
14274 </para>
14275 <variablelist>
14276 <varlistentry>
14277 <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>
14278 <listitem>
14279 <para>
14280 <indexterm role="concept">
14281 <primary>expansion</primary>
14282 <secondary>variables</secondary>
14283 </indexterm>
14284 Substitute the contents of the named variable, for example:
14285 </para>
14286 <literallayout class="monospaced">
14287 $local_part
14288 ${domain}
14289 </literallayout>
14290 <para>
14291 The second form can be used to separate the name from subsequent alphanumeric
14292 characters. This form (using braces) is available only for variables; it does
14293 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
14294 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
14295 given, the expansion fails.
14296 </para>
14297 </listitem></varlistentry>
14298 <varlistentry>
14299 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14300 <listitem>
14301 <para>
14302 <indexterm role="concept">
14303 <primary>expansion</primary>
14304 <secondary>operators</secondary>
14305 </indexterm>
14306 The string is first itself expanded, and then the operation specified by
14307 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
14308 </para>
14309 <literallayout class="monospaced">
14310 ${lc:$local_part}
14311 </literallayout>
14312 <para>
14313 The string starts with the first character after the colon, which may be
14314 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
14315 below. The operator notation is used for simple expansion items that have just
14316 one argument, because it reduces the number of braces and therefore makes the
14317 string easier to understand.
14318 </para>
14319 </listitem></varlistentry>
14320 <varlistentry>
14321 <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>
14322 <listitem>
14323 <para>
14324 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
14325 expansion item below.
14326 </para>
14327 </listitem></varlistentry>
14328 <varlistentry>
14329 <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>
14330 <listitem>
14331 <para>
14332 <indexterm role="concept">
14333 <primary>expansion</primary>
14334 <secondary>calling an acl</secondary>
14335 </indexterm>
14336 <indexterm role="concept">
14337 <primary><option>acl</option></primary>
14338 <secondary>call from expansion</secondary>
14339 </indexterm>
14340 The name and zero to nine argument strings are first expanded separately.  The expanded
14341 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
14342 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
14343 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
14344 and may use the variables; if another acl expansion is used the values
14345 are restored after it returns.  If the ACL sets
14346 a value using a "message =" modifier and returns accept or deny, the value becomes
14347 the result of the expansion.
14348 If no message is set and the ACL returns accept or deny
14349 the expansion result is an empty string.
14350 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
14351 </para>
14352 </listitem></varlistentry>
14353 <varlistentry>
14354 <term><emphasis role="bold">${authresults{</emphasis>&lt;<emphasis>authserv-id</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14355 <listitem>
14356 <para>
14357 <indexterm role="concept">
14358 <primary>authentication</primary>
14359 <secondary>results header</secondary>
14360 </indexterm>
14361 <indexterm role="concept">
14362 <primary>headers</primary>
14363 <secondary>authentication-results:</secondary>
14364 </indexterm>
14365 <indexterm role="concept">
14366 <primary>authentication</primary>
14367 <secondary>expansion item</secondary>
14368 </indexterm>
14369 This item returns a string suitable for insertion as an
14370 <emphasis>Authentication-Results:</emphasis>
14371 header line.
14372 The given &lt;<emphasis>authserv-id</emphasis>&gt; is included in the result; typically this
14373 will be a domain name identifying the system performing the authentications.
14374 Methods that might be present in the result include:
14375 </para>
14376 <literallayout class="monospaced">
14377 none
14378 iprev
14379 auth
14380 spf
14381 dkim
14382 </literallayout>
14383 <para>
14384 Example use (as an ACL modifier):
14385 </para>
14386 <literallayout class="monospaced">
14387       add_header = :at_start:${authresults {$primary_hostname}}
14388 </literallayout>
14389 <para>
14390 This is safe even if no authentication results are available.
14391 </para>
14392 </listitem></varlistentry>
14393 <varlistentry>
14394 <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>
14395 <listitem>
14396 <para>
14397 <indexterm role="concept">
14398 <primary>expansion</primary>
14399 <secondary>extracting certificate fields</secondary>
14400 </indexterm>
14401 <indexterm role="concept">
14402 <primary><option>certextract</option></primary>
14403 <secondary>certificate fields</secondary>
14404 </indexterm>
14405 <indexterm role="concept">
14406 <primary>certificate</primary>
14407 <secondary>extracting fields</secondary>
14408 </indexterm>
14409 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
14410 The field name is expanded and used to retrieve the relevant field from
14411 the certificate.  Supported fields are:
14412 </para>
14413 <literallayout>
14414 <literal>version        </literal>
14415 <literal>serial_number  </literal>
14416 <literal>subject        </literal> RFC4514 DN
14417 <literal>issuer         </literal> RFC4514 DN
14418 <literal>notbefore      </literal> time
14419 <literal>notafter       </literal> time
14420 <literal>sig_algorithm  </literal>
14421 <literal>signature      </literal>
14422 <literal>subj_altname   </literal> tagged list
14423 <literal>ocsp_uri       </literal> list
14424 <literal>crl_uri        </literal> list
14425 </literallayout>
14426 <para>
14427 If the field is found,
14428 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
14429 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
14430 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
14431 is restored to any previous value it might have had.
14432 </para>
14433 <para>
14434 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
14435 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14436 extracted is used.
14437 </para>
14438 <para>
14439 Some field names take optional modifiers, appended and separated by commas.
14440 </para>
14441 <para>
14442 The field selectors marked as "RFC4514" above
14443 output a Distinguished Name string which is
14444 not quite
14445 parseable by Exim as a comma-separated tagged list
14446 (the exceptions being elements containing commas).
14447 RDN elements of a single type may be selected by
14448 a modifier of the type label; if so the expansion
14449 result is a list (newline-separated by default).
14450 The separator may be changed by another modifier of
14451 a right angle-bracket followed immediately by the new separator.
14452 Recognised RDN type labels include "CN", "O", "OU" and "DC".
14453 </para>
14454 <para>
14455 The field selectors marked as "time" above
14456 take an optional modifier of "int"
14457 for which the result is the number of seconds since epoch.
14458 Otherwise the result is a human-readable string
14459 in the timezone selected by the main "timezone" option.
14460 </para>
14461 <para>
14462 The field selectors marked as "list" above return a list,
14463 newline-separated by default,
14464 (embedded separator characters in elements are doubled).
14465 The separator may be changed by a modifier of
14466 a right angle-bracket followed immediately by the new separator.
14467 </para>
14468 <para>
14469 The field selectors marked as "tagged" above
14470 prefix each list element with a type string and an equals sign.
14471 Elements of only one type may be selected by a modifier
14472 which is one of "dns", "uri" or "mail";
14473 if so the element tags are omitted.
14474 </para>
14475 <para>
14476 If not otherwise noted field values are presented in human-readable form.
14477 </para>
14478 </listitem></varlistentry>
14479 <varlistentry>
14480 <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>
14481 <listitem>
14482 <para>
14483 <indexterm role="concept">
14484 <primary><option>dlfunc</option></primary>
14485 </indexterm>
14486 This expansion dynamically loads and then calls a locally-written C function.
14487 This functionality is available only if Exim is compiled with
14488 </para>
14489 <literallayout class="monospaced">
14490 EXPAND_DLFUNC=yes
14491 </literallayout>
14492 <para>
14493 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
14494 object so that it doesn&#x2019;t reload the same object file in the same Exim process
14495 (but of course Exim does start new processes frequently).
14496 </para>
14497 <para>
14498 There may be from zero to eight arguments to the function.
14499 </para>
14500 <para>
14501 When compiling
14502 a local function that is to be called in this way,
14503 first <filename>DLFUNC_IMPL</filename> should be defined,
14504 and second <filename>local_scan.h</filename> should be included.
14505 The Exim variables and functions that are defined by that API
14506 are also available for dynamically loaded functions. The function itself
14507 must have the following type:
14508 </para>
14509 <literallayout class="monospaced">
14510 int dlfunction(uschar **yield, int argc, uschar *argv[])
14511 </literallayout>
14512 <para>
14513 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
14514 function should return one of the following values:
14515 </para>
14516 <para>
14517 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
14518 into the expanded string that is being built.
14519 </para>
14520 <para>
14521 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
14522 from <emphasis>yield</emphasis>, if it is set.
14523 </para>
14524 <para>
14525 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
14526 taken from <emphasis>yield</emphasis> if it is set.
14527 </para>
14528 <para>
14529 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
14530 </para>
14531 <para>
14532 When compiling a function that is to be used in this way with gcc,
14533 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
14534 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
14535 </para>
14536 </listitem></varlistentry>
14537 <varlistentry>
14538 <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>
14539 <listitem>
14540 <para>
14541 <indexterm role="concept">
14542 <primary>expansion</primary>
14543 <secondary>extracting value from environment</secondary>
14544 </indexterm>
14545 <indexterm role="concept">
14546 <primary>environment</primary>
14547 <secondary>values from</secondary>
14548 </indexterm>
14549 The key is first expanded separately, and leading and trailing white space
14550 removed.
14551 This is then searched for as a name in the environment.
14552 If a variable is found then its value is placed in <varname>$value</varname>
14553 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
14554 </para>
14555 <para>
14556 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
14557 appear, for example:
14558 </para>
14559 <literallayout class="monospaced">
14560 ${env{USER}{$value} fail }
14561 </literallayout>
14562 <para>
14563 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
14564 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14565 </para>
14566 <para>
14567 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
14568 search failure.
14569 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
14570 search success.
14571 </para>
14572 <para>
14573 The environment is adjusted by the <option>keep_environment</option> and
14574 <option>add_environment</option> main section options.
14575 </para>
14576 </listitem></varlistentry>
14577 <varlistentry>
14578 <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>
14579 <listitem>
14580 <para>
14581 <indexterm role="concept">
14582 <primary>expansion</primary>
14583 <secondary>extracting substrings by key</secondary>
14584 </indexterm>
14585 <indexterm role="concept">
14586 <primary><option>extract</option></primary>
14587 <secondary>substrings by key</secondary>
14588 </indexterm>
14589 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
14590 white space is removed from the key (but not from any of the strings). The key
14591 must not be empty and must not consist entirely of digits.
14592 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
14593 </para>
14594 <literallayout>
14595 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
14596 </literallayout>
14597 <para>
14598 <indexterm role="variable">
14599 <primary><varname>$value</varname></primary>
14600 </indexterm>
14601 where the equals signs and spaces (but not both) are optional. If any of the
14602 values contain white space, they must be enclosed in double quotes, and any
14603 values that are enclosed in double quotes are subject to escape processing as
14604 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
14605 for the value that corresponds to the key. The search is case-insensitive. If
14606 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
14607 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
14608 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
14609 is restored to any previous value it might have had.
14610 </para>
14611 <para>
14612 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
14613 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14614 extracted is used. Thus, for example, these two expansions are identical, and
14615 yield <quote>2001</quote>:
14616 </para>
14617 <literallayout class="monospaced">
14618 ${extract{gid}{uid=1984 gid=2001}}
14619 ${extract{gid}{uid=1984 gid=2001}{$value}}
14620 </literallayout>
14621 <para>
14622 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
14623 appear, for example:
14624 </para>
14625 <literallayout class="monospaced">
14626 ${extract{Z}{A=... B=...}{$value} fail }
14627 </literallayout>
14628 <para>
14629 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
14630 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14631 </para>
14632 </listitem></varlistentry>
14633 <varlistentry>
14634 <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>
14635 <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>
14636 <listitem>
14637 <para>
14638 <indexterm role="concept">
14639 <primary>expansion</primary>
14640 <secondary>extracting from JSON object</secondary>
14641 </indexterm>
14642 <indexterm role="concept">
14643 <primary>JSON</primary>
14644 <secondary>expansions</secondary>
14645 </indexterm>
14646 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
14647 white space is removed from the key (but not from any of the strings). The key
14648 must not be empty and must not consist entirely of digits.
14649 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
14650 </para>
14651 <literallayout>
14652 { &lt;<emphasis>"key1"</emphasis>&gt; : &lt;<emphasis>value1</emphasis>&gt; ,  &lt;<emphasis>"key2"</emphasis>&gt; , &lt;<emphasis>value2</emphasis>&gt; ... }
14653 </literallayout>
14654 <para>
14655 <indexterm role="variable">
14656 <primary><varname>$value</varname></primary>
14657 </indexterm>
14658 The braces, commas and colons, and the quoting of the member name are required;
14659 the spaces are optional.
14660 Matching of the key against the member names is done case-sensitively.
14661 For the <quote>json</quote> variant,
14662 if a returned value is a JSON string, it retains its leading and
14663 trailing quotes.
14664 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
14665 leading and trailing quotes are removed from the returned value.
14666 </para>
14667 <para>
14668 The results of matching are handled as above.
14669 </para>
14670 </listitem></varlistentry>
14671 <varlistentry>
14672 <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>
14673 <listitem>
14674 <para>
14675 <indexterm role="concept">
14676 <primary>expansion</primary>
14677 <secondary>extracting substrings by number</secondary>
14678 </indexterm>
14679 <indexterm role="concept">
14680 <primary><option>extract</option></primary>
14681 <secondary>substrings by number</secondary>
14682 </indexterm>
14683 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14684 apart from leading and trailing white space, which is ignored.
14685 This is what distinguishes this form of <option>extract</option> from the previous kind. It
14686 behaves in the same way, except that, instead of extracting a named field, it
14687 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
14688 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
14689 &lt;<emphasis>string3</emphasis>&gt; as before.
14690 </para>
14691 <para>
14692 The fields in the string are separated by any one of the characters in the
14693 separator string. These may include space or tab characters.
14694 The first field is numbered one. If the number is negative, the fields are
14695 counted from the end of the string, with the rightmost one numbered -1. If the
14696 number given is zero, the entire string is returned. If the modulus of the
14697 number is greater than the number of fields in the string, the result is the
14698 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
14699 provided. For example:
14700 </para>
14701 <literallayout class="monospaced">
14702 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14703 </literallayout>
14704 <para>
14705 yields <quote>42</quote>, and
14706 </para>
14707 <literallayout class="monospaced">
14708 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
14709 </literallayout>
14710 <para>
14711 yields <quote>99</quote>. Two successive separators mean that the field between them is
14712 empty (for example, the fifth field above).
14713 </para>
14714 </listitem></varlistentry>
14715 <varlistentry>
14716 <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>
14717 <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>
14718 <listitem>
14719 <para>
14720 <indexterm role="concept">
14721 <primary>expansion</primary>
14722 <secondary>extracting from JSON array</secondary>
14723 </indexterm>
14724 <indexterm role="concept">
14725 <primary>JSON</primary>
14726 <secondary>expansions</secondary>
14727 </indexterm>
14728 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
14729 apart from leading and trailing white space, which is ignored.
14730 </para>
14731 <para>
14732 Field selection and result handling is as above;
14733 there is no choice of field separator.
14734 For the <quote>json</quote> variant,
14735 if a returned value is a JSON string, it retains its leading and
14736 trailing quotes.
14737 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
14738 leading and trailing quotes are removed from the returned value.
14739 </para>
14740 </listitem></varlistentry>
14741 <varlistentry>
14742 <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>
14743 <listitem>
14744 <para>
14745 <indexterm role="concept">
14746 <primary>list</primary>
14747 <secondary>selecting by condition</secondary>
14748 </indexterm>
14749 <indexterm role="concept">
14750 <primary>expansion</primary>
14751 <secondary>selecting from list by condition</secondary>
14752 </indexterm>
14753 <indexterm role="variable">
14754 <primary><varname>$item</varname></primary>
14755 </indexterm>
14756 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
14757 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
14758 For each item
14759 in this list, its value is place in <varname>$item</varname>, and then the condition is
14760 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
14761 item in a new list; if the condition is false, the item is discarded. The
14762 separator used for the output list is the same as the one used for the
14763 input, but a separator setting is not included in the output. For example:
14764 </para>
14765 <literallayout class="monospaced">
14766 ${filter{a:b:c}{!eq{$item}{b}}}
14767 </literallayout>
14768 <para>
14769 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
14770 to what it was before. See also the <option>map</option> and <option>reduce</option> expansion items.
14771 </para>
14772 </listitem></varlistentry>
14773 <varlistentry>
14774 <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>
14775 <listitem>
14776 <para>
14777 <indexterm role="concept">
14778 <primary>hash function</primary>
14779 <secondary>textual</secondary>
14780 </indexterm>
14781 <indexterm role="concept">
14782 <primary>expansion</primary>
14783 <secondary>textual hash</secondary>
14784 </indexterm>
14785 This is a textual hashing function, and was the first to be implemented in
14786 early versions of Exim. In current releases, there are other hashing functions
14787 (numeric, MD5, and SHA-1), which are described below.
14788 </para>
14789 <para>
14790 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
14791 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
14792 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
14793 use the simpler operator notation that avoids some of the braces:
14794 </para>
14795 <literallayout class="monospaced">
14796 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
14797 </literallayout>
14798 <para>
14799 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
14800 or equal to the length of the string, the expansion item returns the string.
14801 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
14802 function to the string. The new string consists of characters taken from the
14803 first &lt;<emphasis>m</emphasis>&gt; characters of the string
14804 </para>
14805 <literallayout class="monospaced">
14806 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
14807 </literallayout>
14808 <para>
14809 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
14810 letters appear. For example:
14811 </para>
14812 <literallayout>
14813 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
14814 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
14815 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
14816 </literallayout>
14817 </listitem></varlistentry>
14818 <varlistentry>
14819 <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>
14820 <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>
14821 <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>
14822 <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>
14823 <listitem>
14824 <para>
14825 <indexterm role="concept">
14826 <primary>expansion</primary>
14827 <secondary>header insertion</secondary>
14828 </indexterm>
14829 <indexterm role="variable">
14830 <primary><varname>$header_</varname></primary>
14831 </indexterm>
14832 <indexterm role="variable">
14833 <primary><varname>$bheader_</varname></primary>
14834 </indexterm>
14835 <indexterm role="variable">
14836 <primary><varname>$lheader_</varname></primary>
14837 </indexterm>
14838 <indexterm role="variable">
14839 <primary><varname>$rheader_</varname></primary>
14840 </indexterm>
14841 <indexterm role="concept">
14842 <primary>header lines</primary>
14843 <secondary>in expansion strings</secondary>
14844 </indexterm>
14845 <indexterm role="concept">
14846 <primary>header lines</primary>
14847 <secondary>character sets</secondary>
14848 </indexterm>
14849 <indexterm role="concept">
14850 <primary>header lines</primary>
14851 <secondary>decoding</secondary>
14852 </indexterm>
14853 Substitute the contents of the named message header line, for example
14854 </para>
14855 <literallayout class="monospaced">
14856 $header_reply-to:
14857 </literallayout>
14858 <para>
14859 The newline that terminates a header line is not included in the expansion, but
14860 internal newlines (caused by splitting the header line over several physical
14861 lines) may be present.
14862 </para>
14863 <para>
14864 The difference between the four pairs of expansions is in the way
14865 the data in the header line is interpreted.
14866 </para>
14867 <itemizedlist>
14868 <listitem>
14869 <para>
14870 <indexterm role="concept">
14871 <primary>white space</primary>
14872 <secondary>in header lines</secondary>
14873 </indexterm>
14874 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
14875 processing at all, and without the removal of leading and trailing white space.
14876 </para>
14877 </listitem>
14878 <listitem>
14879 <para>
14880 <indexterm role="concept">
14881 <primary>list</primary>
14882 <secondary>of header lines</secondary>
14883 </indexterm>
14884 <option>lheader</option> gives a colon-separated list, one element per header when there
14885 are multiple headers with a given name.
14886 Any embedded colon characters within an element are doubled, so normal Exim
14887 list-processing facilities can be used.
14888 The terminating newline of each element is removed; in other respects
14889 the content is <quote>raw</quote>.
14890 </para>
14891 </listitem>
14892 <listitem>
14893 <para>
14894 <indexterm role="concept">
14895 <primary>base64 encoding</primary>
14896 <secondary>in header lines</secondary>
14897 </indexterm>
14898 <option>bheader</option> removes leading and trailing white space, and then decodes base64
14899 or quoted-printable MIME <quote>words</quote> within the header text, but does no
14900 character set translation. If decoding of what looks superficially like a MIME
14901 <quote>word</quote> fails, the raw string is returned. If decoding
14902 <indexterm role="concept">
14903 <primary>binary zero</primary>
14904 <secondary>in header line</secondary>
14905 </indexterm>
14906 produces a binary zero character, it is replaced by a question mark &ndash; this is
14907 what Exim does for binary zeros that are actually received in header lines.
14908 </para>
14909 </listitem>
14910 <listitem>
14911 <para>
14912 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
14913 standard character set. This is an attempt to produce the same string as would
14914 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
14915 returned. Translation is attempted only on operating systems that support the
14916 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
14917 a system Makefile or in <filename>Local/Makefile</filename>.
14918 </para>
14919 </listitem>
14920 </itemizedlist>
14921 <para>
14922 In a filter file, the target character set for <option>header</option> can be specified by a
14923 command of the following form:
14924 </para>
14925 <literallayout class="monospaced">
14926 headers charset "UTF-8"
14927 </literallayout>
14928 <para>
14929 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
14930 subsequently obeyed filter commands. In the absence of this command, the target
14931 character set in a filter is taken from the setting of the <option>headers_charset</option>
14932 option in the runtime configuration. The value of this option defaults to the
14933 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
14934 ISO-8859-1.
14935 </para>
14936 <para>
14937 Header names follow the syntax of RFC 2822, which states that they may contain
14938 any printing characters except space and colon. Consequently, curly brackets
14939 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
14940 if they were variables. Attempting to do so causes a syntax error.
14941 </para>
14942 <para>
14943 Only header lines that are common to all copies of a message are visible to
14944 this mechanism. These are the original header lines that are received with the
14945 message, and any that are added by an ACL statement or by a system
14946 filter. Header lines that are added to a particular copy of a message by a
14947 router or transport are not accessible.
14948 </para>
14949 <para>
14950 For incoming SMTP messages, no header lines are visible in
14951 ACLs that are obeyed before the data phase completes,
14952 because the header structure is not set up until the message is received.
14953 They are visible in DKIM, PRDR and DATA ACLs.
14954 Header lines that are added in a RCPT ACL (for example)
14955 are saved until the message&#x2019;s incoming header lines are available, at which
14956 point they are added.
14957 When any of the above ACLs ar
14958 running, however, header lines added by earlier ACLs are visible.
14959 </para>
14960 <para>
14961 Upper case and lower case letters are synonymous in header names. If the
14962 following character is white space, the terminating colon may be omitted, but
14963 this is not recommended, because you may then forget it when it is needed. When
14964 white space terminates the header name, this white space is included in the
14965 expanded string.  If the message does not contain the given header, the
14966 expansion item is replaced by an empty string. (See the <option>def</option> condition in
14967 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
14968 header.)
14969 </para>
14970 <para>
14971 If there is more than one header with the same name, they are all concatenated
14972 to form the substitution string, up to a maximum length of 64K. Unless
14973 <option>rheader</option> is being used, leading and trailing white space is removed from
14974 each header before concatenation, and a completely empty header is ignored. A
14975 newline character is then inserted between non-empty headers, but there is no
14976 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
14977 those headers that contain lists of addresses, a comma is also inserted at the
14978 junctions between headers. This does not happen for the <option>rheader</option> expansion.
14979 </para>
14980 <para revisionflag="changed">
14981 <indexterm role="concept">
14982 <primary>tainted data</primary>
14983 </indexterm>
14984 When the headers are from an incoming message,
14985 the result of expanding any of these variables is tainted.
14986 </para>
14987 </listitem></varlistentry>
14988 <varlistentry>
14989 <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>
14990 <listitem>
14991 <para>
14992 <indexterm role="concept">
14993 <primary>expansion</primary>
14994 <secondary>hmac hashing</secondary>
14995 </indexterm>
14996 <indexterm role="concept">
14997 <primary><option>hmac</option></primary>
14998 </indexterm>
14999 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
15000 shared secret and some text into a message authentication code, as specified in
15001 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
15002 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
15003 cryptographic hash, allowing for authentication that is not possible with MD5
15004 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
15005 present. For example:
15006 </para>
15007 <literallayout class="monospaced">
15008 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
15009 </literallayout>
15010 <para>
15011 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
15012 produces:
15013 </para>
15014 <literallayout class="monospaced">
15015 dd97e3ba5d1a61b5006108f8c8252953
15016 </literallayout>
15017 <para>
15018 As an example of how this might be used, you might put in the main part of
15019 an Exim configuration:
15020 </para>
15021 <literallayout class="monospaced">
15022 SPAMSCAN_SECRET=cohgheeLei2thahw
15023 </literallayout>
15024 <para>
15025 In a router or a transport you could then have:
15026 </para>
15027 <literallayout class="monospaced">
15028 headers_add = \
15029   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
15030   ${hmac{md5}{SPAMSCAN_SECRET}\
15031   {${primary_hostname},${message_exim_id},$h_message-id:}}
15032 </literallayout>
15033 <para>
15034 Then given a message, you can check where it was scanned by looking at the
15035 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
15036 this header line is authentic by recomputing the authentication code from the
15037 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
15038 using Exim&#x2019;s <option>-be</option> option, or by other means, for example, by using the
15039 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
15040 </para>
15041 </listitem></varlistentry>
15042 <varlistentry>
15043 <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>
15044 <listitem>
15045 <para>
15046 <indexterm role="concept">
15047 <primary>expansion</primary>
15048 <secondary>conditional</secondary>
15049 </indexterm>
15050 <indexterm role="concept">
15051 <primary><option>if</option>, expansion item</primary>
15052 </indexterm>
15053 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
15054 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
15055 in section <xref linkend="SECTexpcond"/> below. For example:
15056 </para>
15057 <literallayout class="monospaced">
15058 ${if eq {$local_part}{postmaster} {yes}{no} }
15059 </literallayout>
15060 <para>
15061 The second string need not be present; if it is not and the condition is not
15062 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
15063 be present instead of the second string (without any curly brackets). In this
15064 case, the expansion is forced to fail if the condition is not true (see section
15065 <xref linkend="SECTforexpfai"/>).
15066 </para>
15067 <para>
15068 If both strings are omitted, the result is the string <literal>true</literal> if the condition
15069 is true, and the empty string if the condition is false. This makes it less
15070 cumbersome to write custom ACL and router conditions. For example, instead of
15071 </para>
15072 <literallayout class="monospaced">
15073 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
15074 </literallayout>
15075 <para>
15076 you can use
15077 </para>
15078 <literallayout class="monospaced">
15079 condition = ${if &gt;{$acl_m4}{3}}
15080 </literallayout>
15081 </listitem></varlistentry>
15082 <varlistentry>
15083 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15084 <listitem>
15085 <para>
15086 <indexterm role="concept">
15087 <primary>expansion</primary>
15088 <secondary>imap folder</secondary>
15089 </indexterm>
15090 <indexterm role="concept">
15091 <primary><option>imapfolder</option> expansion item</primary>
15092 </indexterm>
15093 This item converts a (possibly multilevel, or with non-ASCII characters)
15094 folder specification to a Maildir name for filesystem use.
15095 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
15096 </para>
15097 </listitem></varlistentry>
15098 <varlistentry>
15099 <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>
15100 <listitem>
15101 <para>
15102 <indexterm role="concept">
15103 <primary>expansion</primary>
15104 <secondary>string truncation</secondary>
15105 </indexterm>
15106 <indexterm role="concept">
15107 <primary><option>length</option> expansion item</primary>
15108 </indexterm>
15109 The <option>length</option> item is used to extract the initial portion of a string. Both
15110 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
15111 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
15112 change when expanded, you can use the simpler operator notation that avoids
15113 some of the braces:
15114 </para>
15115 <literallayout class="monospaced">
15116 ${length_&lt;n&gt;:&lt;string&gt;}
15117 </literallayout>
15118 <para>
15119 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; bytes or the whole
15120 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
15121 <option>strlen</option>, which gives the length of a string.
15122 All measurement is done in bytes and is not UTF-8 aware.
15123 </para>
15124 </listitem></varlistentry>
15125 <varlistentry>
15126 <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>
15127 <listitem>
15128 <para>
15129 <indexterm role="concept">
15130 <primary>expansion</primary>
15131 <secondary>extracting list elements by number</secondary>
15132 </indexterm>
15133 <indexterm role="concept">
15134 <primary><option>listextract</option></primary>
15135 <secondary>extract list elements by number</secondary>
15136 </indexterm>
15137 <indexterm role="concept">
15138 <primary>list</primary>
15139 <secondary>extracting elements by number</secondary>
15140 </indexterm>
15141 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15142 apart from an optional leading minus,
15143 and leading and trailing white space (which is ignored).
15144 </para>
15145 <para>
15146 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15147 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15148 </para>
15149 <para>
15150 The first field of the list is numbered one.
15151 If the number is negative, the fields are
15152 counted from the end of the list, with the rightmost one numbered -1.
15153 The numbered element of the list is extracted and placed in <varname>$value</varname>,
15154 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
15155 </para>
15156 <para>
15157 If the modulus of the
15158 number is zero or greater than the number of fields in the string,
15159 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
15160 </para>
15161 <para>
15162 For example:
15163 </para>
15164 <literallayout class="monospaced">
15165 ${listextract{2}{x:42:99}}
15166 </literallayout>
15167 <para>
15168 yields <quote>42</quote>, and
15169 </para>
15170 <literallayout class="monospaced">
15171 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
15172 </literallayout>
15173 <para>
15174 yields <quote>result: 42</quote>.
15175 </para>
15176 <para>
15177 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
15178 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
15179 extracted is used.
15180 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
15181 </para>
15182 </listitem></varlistentry>
15183 <varlistentry revisionflag="changed">
15184 <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>
15185 <listitem>
15186 <para revisionflag="changed">
15187 <indexterm role="concept">
15188 <primary>quoting</primary>
15189 <secondary>for list</secondary>
15190 </indexterm>
15191 <indexterm role="concept">
15192 <primary>list</primary>
15193 <secondary>quoting</secondary>
15194 </indexterm>
15195 This item doubles any occurrence of the separator character
15196 in the given string.
15197 An empty string is replaced with a single space.
15198 This converts the string into a safe form for use as a list element,
15199 in a list using the given separator.
15200 </para>
15201 </listitem></varlistentry>
15202 <varlistentry>
15203 <term><emphasis role="bold">${lookup{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}&nbsp;</emphasis>&lt;<emphasis>search&nbsp;type</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>file</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15204 <listitem>
15205 <para>
15206 This is the first of one of two different types of lookup item, which are both
15207 described in the next item.
15208 </para>
15209 </listitem></varlistentry>
15210 <varlistentry>
15211 <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>
15212 <listitem>
15213 <para>
15214 <indexterm role="concept">
15215 <primary>expansion</primary>
15216 <secondary>lookup in</secondary>
15217 </indexterm>
15218 <indexterm role="concept">
15219 <primary>file</primary>
15220 <secondary>lookups</secondary>
15221 </indexterm>
15222 <indexterm role="concept">
15223 <primary>lookup</primary>
15224 <secondary>in expanded string</secondary>
15225 </indexterm>
15226 The two forms of lookup item specify data lookups in files and databases, as
15227 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
15228 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
15229 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
15230 </para>
15231 <para>
15232 If there is any white space in a lookup item which is part of a filter command,
15233 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
15234 other place where white space is significant, the lookup item must be enclosed
15235 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
15236 out by the system administrator.
15237 </para>
15238 <para>
15239 <indexterm role="variable">
15240 <primary><varname>$value</varname></primary>
15241 </indexterm>
15242 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
15243 During its expansion, the variable <varname>$value</varname> contains the data returned by the
15244 lookup. Afterwards it reverts to the value it had previously (at the outer
15245 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
15246 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
15247 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
15248 lookup, thus providing a mechanism for looking up a default value when the
15249 original lookup fails.
15250 </para>
15251 <para>
15252 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
15253 data for the outer lookup while the parameters of the second lookup are
15254 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
15255 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
15256 appear, and in this case, if the lookup fails, the entire expansion is forced
15257 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
15258 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
15259 successful lookup, and nothing in the case of failure.
15260 </para>
15261 <para>
15262 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
15263 search type in order to do partial matching, and * or *@ may follow a search
15264 type to request default lookups if the key does not match (see sections
15265 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
15266 </para>
15267 <para>
15268 <indexterm role="concept">
15269 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15270 <secondary>in lookup expansion</secondary>
15271 </indexterm>
15272 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
15273 and non-wild parts of the key during the expansion of the replacement text.
15274 They return to their previous values at the end of the lookup item.
15275 </para>
15276 <para>
15277 This example looks up the postmaster alias in the conventional alias file:
15278 </para>
15279 <literallayout class="monospaced">
15280 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
15281 </literallayout>
15282 <para>
15283 This example uses NIS+ to look up the full name of the user corresponding to
15284 the local part of an address, forcing the expansion to fail if it is not found:
15285 </para>
15286 <literallayout class="monospaced">
15287 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
15288   {$value}fail}
15289 </literallayout>
15290 </listitem></varlistentry>
15291 <varlistentry>
15292 <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>
15293 <listitem>
15294 <para>
15295 <indexterm role="concept">
15296 <primary>expansion</primary>
15297 <secondary>list creation</secondary>
15298 </indexterm>
15299 <indexterm role="variable">
15300 <primary><varname>$item</varname></primary>
15301 </indexterm>
15302 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15303 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15304 For each item
15305 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
15306 expanded and added to the output as an item in a new list. The separator used
15307 for the output list is the same as the one used for the input, but a separator
15308 setting is not included in the output. For example:
15309 </para>
15310 <literallayout class="monospaced">
15311 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
15312 </literallayout>
15313 <para>
15314 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
15315 value of <varname>$item</varname> is restored to what it was before. See also the <option>filter</option>
15316 and <option>reduce</option> expansion items.
15317 </para>
15318 </listitem></varlistentry>
15319 <varlistentry>
15320 <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>
15321 <listitem>
15322 <para>
15323 <indexterm role="concept">
15324 <primary>expansion</primary>
15325 <secondary>numeric hash</secondary>
15326 </indexterm>
15327 <indexterm role="concept">
15328 <primary>hash function</primary>
15329 <secondary>numeric</secondary>
15330 </indexterm>
15331 The three strings are expanded; the first two must yield numbers. Call them
15332 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15333 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15334 can use the simpler operator notation that avoids some of the braces:
15335 </para>
15336 <literallayout class="monospaced">
15337 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15338 </literallayout>
15339 <para>
15340 The second number is optional (in both notations). If there is only one number,
15341 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
15342 processed by a div/mod hash function that returns two numbers, separated by a
15343 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
15344 example,
15345 </para>
15346 <literallayout class="monospaced">
15347 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
15348 </literallayout>
15349 <para>
15350 returns the string <quote>6/33</quote>.
15351 </para>
15352 </listitem></varlistentry>
15353 <varlistentry>
15354 <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>
15355 <listitem>
15356 <para>
15357 <indexterm role="concept">
15358 <primary>Perl</primary>
15359 <secondary>use in expanded string</secondary>
15360 </indexterm>
15361 <indexterm role="concept">
15362 <primary>expansion</primary>
15363 <secondary>calling Perl from</secondary>
15364 </indexterm>
15365 This item is available only if Exim has been built to include an embedded Perl
15366 interpreter. The subroutine name and the arguments are first separately
15367 expanded, and then the Perl subroutine is called with those arguments. No
15368 additional arguments need be given; the maximum number permitted, including the
15369 name of the subroutine, is nine.
15370 </para>
15371 <para>
15372 The return value of the subroutine is inserted into the expanded string, unless
15373 the return value is <option>undef</option>. In that case, the expansion fails in the same
15374 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
15375 Whatever you return is evaluated in a scalar context. For example, if you
15376 return the name of a Perl vector, the return value is the size of the vector,
15377 not its contents.
15378 </para>
15379 <para>
15380 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
15381 with the error message that was passed to <option>die</option>. More details of the embedded
15382 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
15383 </para>
15384 <para>
15385 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
15386 out the use of this expansion item in filter files.
15387 </para>
15388 </listitem></varlistentry>
15389 <varlistentry>
15390 <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>
15391 <listitem>
15392 <para>
15393 <indexterm role="concept">
15394 <primary><option>prvs</option> expansion item</primary>
15395 </indexterm>
15396 The first argument is a complete email address and the second is secret
15397 keystring. The third argument, specifying a key number, is optional. If absent,
15398 it defaults to 0. The result of the expansion is a prvs-signed email address,
15399 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
15400 as part of a bounce address tag validation (BATV) scheme. For more discussion
15401 and an example, see section <xref linkend="SECTverifyPRVS"/>.
15402 </para>
15403 </listitem></varlistentry>
15404 <varlistentry>
15405 <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>
15406 <listitem>
15407 <para>
15408 <indexterm role="concept">
15409 <primary><option>prvscheck</option> expansion item</primary>
15410 </indexterm>
15411 This expansion item is the complement of the <option>prvs</option> item. It is used for
15412 checking prvs-signed addresses. If the expansion of the first argument does not
15413 yield a syntactically valid prvs-signed address, the whole item expands to the
15414 empty string. When the first argument does expand to a syntactically valid
15415 prvs-signed address, the second argument is expanded, with the prvs-decoded
15416 version of the address and the key number extracted from the address in the
15417 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
15418 </para>
15419 <para>
15420 These two variables can be used in the expansion of the second argument to
15421 retrieve the secret. The validity of the prvs-signed address is then checked
15422 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
15423 which is empty for failure or <quote>1</quote> for success.
15424 </para>
15425 <para>
15426 The third argument is optional; if it is missing, it defaults to an empty
15427 string. This argument is now expanded. If the result is an empty string, the
15428 result of the expansion is the decoded version of the address. This is the case
15429 whether or not the signature was valid. Otherwise, the result of the expansion
15430 is the expansion of the third argument.
15431 </para>
15432 <para>
15433 All three variables can be used in the expansion of the third argument.
15434 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
15435 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
15436 </para>
15437 </listitem></varlistentry>
15438 <varlistentry>
15439 <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>
15440 <listitem>
15441 <para>
15442 <indexterm role="concept">
15443 <primary>expansion</primary>
15444 <secondary>inserting an entire file</secondary>
15445 </indexterm>
15446 <indexterm role="concept">
15447 <primary>file</primary>
15448 <secondary>inserting into expansion</secondary>
15449 </indexterm>
15450 <indexterm role="concept">
15451 <primary><option>readfile</option> expansion item</primary>
15452 </indexterm>
15453 The filename and end-of-line string are first expanded separately. The file is
15454 then read, and its contents replace the entire item. All newline characters in
15455 the file are replaced by the end-of-line string if it is present. Otherwise,
15456 newlines are left in the string.
15457 String expansion is not applied to the contents of the file. If you want this,
15458 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
15459 the string expansion fails.
15460 </para>
15461 <para>
15462 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
15463 locks out the use of this expansion item in filter files.
15464 </para>
15465 </listitem></varlistentry>
15466 <varlistentry>
15467 <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>
15468 <listitem>
15469 <para>
15470 <indexterm role="concept">
15471 <primary>expansion</primary>
15472 <secondary>inserting from a socket</secondary>
15473 </indexterm>
15474 <indexterm role="concept">
15475 <primary>socket, use of in expansion</primary>
15476 </indexterm>
15477 <indexterm role="concept">
15478 <primary><option>readsocket</option> expansion item</primary>
15479 </indexterm>
15480 This item inserts data from a Unix domain or TCP socket into the expanded
15481 string. The minimal way of using it uses just two arguments, as in these
15482 examples:
15483 </para>
15484 <literallayout class="monospaced">
15485 ${readsocket{/socket/name}{request string}}
15486 ${readsocket{inet:some.host:1234}{request string}}
15487 </literallayout>
15488 <para>
15489 For a Unix domain socket, the first substring must be the path to the socket.
15490 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
15491 a host name or IP address, followed by a colon and a port, which can be a
15492 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
15493 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
15494 example:
15495 </para>
15496 <literallayout class="monospaced">
15497 ${readsocket{inet:[::1]:1234}{request string}}
15498 </literallayout>
15499 <para>
15500 Only a single host name may be given, but if looking it up yields more than
15501 one IP address, they are each tried in turn until a connection is made. For
15502 both kinds of socket, Exim makes a connection, writes the request string
15503 unless it is an empty string; and no terminating NUL is ever sent)
15504 and reads from the socket until an end-of-file
15505 is read. A timeout of 5 seconds is applied. Additional, optional arguments
15506 extend what can be done. Firstly, you can vary the timeout. For example:
15507 </para>
15508 <literallayout class="monospaced">
15509 ${readsocket{/socket/name}{request string}{3s}}
15510 </literallayout>
15511 <para>
15512 The third argument is a list of options, of which the first element is the timeout
15513 and must be present if any options are given.
15514 Further elements are options of form <emphasis>name=value</emphasis>.
15515 Example:
15516 </para>
15517 <literallayout class="monospaced">
15518 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
15519 </literallayout>
15520 <para revisionflag="changed">
15521 The following option names are recognised:
15522 </para>
15523 <itemizedlist revisionflag="changed">
15524 <listitem>
15525 <para revisionflag="changed">
15526 <emphasis role="bold">cache</emphasis>
15527 Defines if the result data can be cached for use by a later identical
15528 request in the same process.
15529 Values are <quote>yes</quote> or <quote>no</quote> (the default).
15530 If not, all cached results for this connection specification
15531 will be invalidated.
15532 </para>
15533 </listitem>
15534 <listitem>
15535 <para revisionflag="changed">
15536 <emphasis role="bold">shutdown</emphasis>
15537 Defines whether or not a write-shutdown is done on the connection after
15538 sending the request. Values are <quote>yes</quote> (the default) or <quote>no</quote>
15539 (preferred, eg. by some webservers).
15540 </para>
15541 </listitem>
15542 <listitem>
15543 <para revisionflag="changed">
15544 <emphasis role="bold">tls</emphasis>
15545 Controls the use of TLS on the connection.
15546 Values are <quote>yes</quote> or <quote>no</quote> (the default).
15547 If it is enabled, a shutdown as descripbed above is never done.
15548 </para>
15549 </listitem>
15550 </itemizedlist>
15551 <para>
15552 A fourth argument allows you to change any newlines that are in the data
15553 that is read, in the same way as for <option>readfile</option> (see above). This example
15554 turns them into spaces:
15555 </para>
15556 <literallayout class="monospaced">
15557 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
15558 </literallayout>
15559 <para>
15560 As with all expansions, the substrings are expanded before the processing
15561 happens. Errors in these sub-expansions cause the expansion to fail. In
15562 addition, the following errors can occur:
15563 </para>
15564 <itemizedlist>
15565 <listitem>
15566 <para>
15567 Failure to create a socket file descriptor;
15568 </para>
15569 </listitem>
15570 <listitem>
15571 <para>
15572 Failure to connect the socket;
15573 </para>
15574 </listitem>
15575 <listitem>
15576 <para>
15577 Failure to write the request string;
15578 </para>
15579 </listitem>
15580 <listitem>
15581 <para>
15582 Timeout on reading from the socket.
15583 </para>
15584 </listitem>
15585 </itemizedlist>
15586 <para>
15587 By default, any of these errors causes the expansion to fail. However, if
15588 you supply a fifth substring, it is expanded and used when any of the above
15589 errors occurs. For example:
15590 </para>
15591 <literallayout class="monospaced">
15592 ${readsocket{/socket/name}{request string}{3s}{\n}\
15593   {socket failure}}
15594 </literallayout>
15595 <para>
15596 You can test for the existence of a Unix domain socket by wrapping this
15597 expansion in <literal>${if exists</literal>, but there is a race condition between that test
15598 and the actual opening of the socket, so it is safer to use the fifth argument
15599 if you want to be absolutely sure of avoiding an expansion error for a
15600 non-existent Unix domain socket, or a failure to connect to an Internet socket.
15601 </para>
15602 <para>
15603 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
15604 locks out the use of this expansion item in filter files.
15605 </para>
15606 </listitem></varlistentry>
15607 <varlistentry>
15608 <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>
15609 <listitem>
15610 <para>
15611 <indexterm role="concept">
15612 <primary>expansion</primary>
15613 <secondary>reducing a list to a scalar</secondary>
15614 </indexterm>
15615 <indexterm role="concept">
15616 <primary>list</primary>
15617 <secondary>reducing to a scalar</secondary>
15618 </indexterm>
15619 <indexterm role="variable">
15620 <primary><varname>$value</varname></primary>
15621 </indexterm>
15622 <indexterm role="variable">
15623 <primary><varname>$item</varname></primary>
15624 </indexterm>
15625 This operation reduces a list to a single, scalar string. After expansion,
15626 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
15627 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15628 Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
15629 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
15630 list is assigned to <varname>$item</varname>, in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
15631 them. The result of that expansion is assigned to <varname>$value</varname> before the next
15632 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
15633 added to the expansion output. The <option>reduce</option> expansion item can be used in a
15634 number of ways. For example, to add up a list of numbers:
15635 </para>
15636 <literallayout class="monospaced">
15637 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
15638 </literallayout>
15639 <para>
15640 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
15641 can be found:
15642 </para>
15643 <literallayout class="monospaced">
15644 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
15645 </literallayout>
15646 <para>
15647 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
15648 restored to what they were before. See also the <option>filter</option> and <option>map</option>
15649 expansion items.
15650 </para>
15651 </listitem></varlistentry>
15652 <varlistentry>
15653 <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>
15654 <listitem>
15655 <para>
15656 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
15657 expansion item in section <xref linkend="SECTexpansionitems"/> above.
15658 </para>
15659 </listitem></varlistentry>
15660 <varlistentry>
15661 <term><emphasis role="bold">${run{</emphasis>&lt;<emphasis>command</emphasis>&gt;<emphasis role="bold">&nbsp;</emphasis>&lt;<emphasis>args</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15662 <listitem>
15663 <para>
15664 <indexterm role="concept">
15665 <primary>expansion</primary>
15666 <secondary>running a command</secondary>
15667 </indexterm>
15668 <indexterm role="concept">
15669 <primary><option>run</option> expansion item</primary>
15670 </indexterm>
15671 The command and its arguments are first expanded as one string. The string is
15672 split apart into individual arguments by spaces, and then the command is run
15673 in a separate process, but under the same uid and gid.  As in other command
15674 executions from Exim, a shell is not used by default. If the command requires
15675 a shell, you must explicitly code it.
15676 </para>
15677 <para>
15678 Since the arguments are split by spaces, when there is a variable expansion
15679 which has an empty result, it will cause the situation that the argument will
15680 simply be omitted when the program is actually executed by Exim. If the
15681 script/program requires a specific number of arguments and the expanded
15682 variable could possibly result in this empty expansion, the variable must be
15683 quoted. This is more difficult if the expanded variable itself could result
15684 in a string containing quotes, because it would interfere with the quotes
15685 around the command arguments. A possible guard against this is to wrap the
15686 variable in the <option>sg</option> operator to change any quote marks to some other
15687 character.
15688 </para>
15689 <para>
15690 The standard input for the command exists, but is empty. The standard output
15691 and standard error are set to the same file descriptor.
15692 <indexterm role="concept">
15693 <primary>return code</primary>
15694 <secondary>from <option>run</option> expansion</secondary>
15695 </indexterm>
15696 <indexterm role="variable">
15697 <primary><varname>$value</varname></primary>
15698 </indexterm>
15699 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
15700 and replaces the entire item; during this expansion, the standard output/error
15701 from the command is in the variable <varname>$value</varname>. If the command fails,
15702 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
15703 expansion, the standard output/error from the command is in the variable
15704 <varname>$value</varname>.
15705 </para>
15706 <para>
15707 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
15708 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
15709 command does not succeed. If both strings are omitted, the result is contents
15710 of the standard output/error on success, and nothing on failure.
15711 </para>
15712 <para>
15713 <indexterm role="variable">
15714 <primary><varname>$run_in_acl</varname></primary>
15715 </indexterm>
15716 The standard output/error of the command is put in the variable <varname>$value</varname>.
15717 In this ACL example, the output of a command is logged for the admin to
15718 troubleshoot:
15719 </para>
15720 <literallayout class="monospaced">
15721 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
15722       log_message  = Output of id: $value
15723 </literallayout>
15724 <para>
15725 If the command requires shell idioms, such as the &gt; redirect operator, the
15726 shell must be invoked directly, such as with:
15727 </para>
15728 <literallayout class="monospaced">
15729 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
15730 </literallayout>
15731 <para>
15732 <indexterm role="variable">
15733 <primary><varname>$runrc</varname></primary>
15734 </indexterm>
15735 The return code from the command is put in the variable <varname>$runrc</varname>, and this
15736 remains set afterwards, so in a filter file you can do things like this:
15737 </para>
15738 <literallayout class="monospaced">
15739 if "${run{x y z}{}}$runrc" is 1 then ...
15740   elif $runrc is 2 then ...
15741   ...
15742 endif
15743 </literallayout>
15744 <para>
15745 If execution of the command fails (for example, the command does not exist),
15746 the return code is 127 &ndash; the same code that shells use for non-existent
15747 commands.
15748 </para>
15749 <para>
15750 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
15751 option values are expanded, except for those preconditions whose order of
15752 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
15753 by the expansion of one option, and use it in another.
15754 </para>
15755 <para>
15756 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
15757 out the use of this expansion item in filter files.
15758 </para>
15759 </listitem></varlistentry>
15760 <varlistentry>
15761 <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>
15762 <listitem>
15763 <para>
15764 <indexterm role="concept">
15765 <primary>expansion</primary>
15766 <secondary>string substitution</secondary>
15767 </indexterm>
15768 <indexterm role="concept">
15769 <primary><option>sg</option> expansion item</primary>
15770 </indexterm>
15771 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
15772 option; hence its name. However, unlike the Perl equivalent, Exim does not
15773 modify the subject string; instead it returns the modified string for insertion
15774 into the overall expansion. The item takes three arguments: the subject string,
15775 a regular expression, and a substitution string. For example:
15776 </para>
15777 <literallayout class="monospaced">
15778 ${sg{abcdefabcdef}{abc}{xyz}}
15779 </literallayout>
15780 <para>
15781 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
15782 if any $, } or \ characters are required in the regular expression or in the
15783 substitution string, they have to be escaped. For example:
15784 </para>
15785 <literallayout class="monospaced">
15786 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
15787 </literallayout>
15788 <para>
15789 yields <quote>defabc</quote>, and
15790 </para>
15791 <literallayout class="monospaced">
15792 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
15793 </literallayout>
15794 <para>
15795 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
15796 the regular expression from string expansion.
15797 </para>
15798 <para>
15799 The regular expression is compiled in 8-bit mode, working against bytes
15800 rather than any Unicode-aware character handling.
15801 </para>
15802 </listitem></varlistentry>
15803 <varlistentry>
15804 <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>
15805 <listitem>
15806 <para>
15807 <indexterm role="concept">
15808 <primary>sorting</primary>
15809 <secondary>a list</secondary>
15810 </indexterm>
15811 <indexterm role="concept">
15812 <primary>list</primary>
15813 <secondary>sorting</secondary>
15814 </indexterm>
15815 <indexterm role="concept">
15816 <primary>expansion</primary>
15817 <secondary>list sorting</secondary>
15818 </indexterm>
15819 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
15820 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15821 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
15822 of a two-argument expansion condition.
15823 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
15824 The comparison should return true when applied to two values
15825 if the first value should sort before the second value.
15826 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
15827 the element being placed in <varname>$item</varname>,
15828 to give values for comparison.
15829 </para>
15830 <para>
15831 The item result is a sorted list,
15832 with the original list separator,
15833 of the list elements (in full) of the original.
15834 </para>
15835 <para>
15836 Examples:
15837 </para>
15838 <literallayout class="monospaced">
15839 ${sort{3:2:1:4}{&lt;}{$item}}
15840 </literallayout>
15841 <para>
15842 sorts a list of numbers, and
15843 </para>
15844 <literallayout class="monospaced">
15845 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
15846 </literallayout>
15847 <para>
15848 will sort an MX lookup into priority order.
15849 </para>
15850 </listitem></varlistentry>
15851 <varlistentry>
15852 <term><emphasis role="bold">${substr{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15853 <listitem>
15854 <para>
15855 <indexterm role="concept">
15856 <primary><option>substr</option> expansion item</primary>
15857 </indexterm>
15858 <indexterm role="concept">
15859 <primary>substring extraction</primary>
15860 </indexterm>
15861 <indexterm role="concept">
15862 <primary>expansion</primary>
15863 <secondary>substring extraction</secondary>
15864 </indexterm>
15865 The three strings are expanded; the first two must yield numbers. Call them
15866 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15867 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15868 can use the simpler operator notation that avoids some of the braces:
15869 </para>
15870 <literallayout class="monospaced">
15871 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15872 </literallayout>
15873 <para>
15874 The second number is optional (in both notations).
15875 If it is absent in the simpler format, the preceding underscore must also be
15876 omitted.
15877 </para>
15878 <para>
15879 The <option>substr</option> item can be used to extract more general substrings than
15880 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
15881 length required. For example
15882 </para>
15883 <literallayout class="monospaced">
15884 ${substr{3}{2}{$local_part}}
15885 </literallayout>
15886 <para>
15887 If the starting offset is greater than the string length the result is the
15888 null string; if the length plus starting offset is greater than the string
15889 length, the result is the right-hand part of the string, starting from the
15890 given offset. The first byte (character) in the string has offset zero.
15891 </para>
15892 <para>
15893 The <option>substr</option> expansion item can take negative offset values to count
15894 from the right-hand end of its operand. The last byte (character) is offset -1,
15895 the second-last is offset -2, and so on. Thus, for example,
15896 </para>
15897 <literallayout class="monospaced">
15898 ${substr{-5}{2}{1234567}}
15899 </literallayout>
15900 <para>
15901 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
15902 length of the string, the substring starts at the beginning of the string, and
15903 the length is reduced by the amount of overshoot. Thus, for example,
15904 </para>
15905 <literallayout class="monospaced">
15906 ${substr{-5}{2}{12}}
15907 </literallayout>
15908 <para>
15909 yields an empty string, but
15910 </para>
15911 <literallayout class="monospaced">
15912 ${substr{-3}{2}{12}}
15913 </literallayout>
15914 <para>
15915 yields <quote>1</quote>.
15916 </para>
15917 <para>
15918 When the second number is omitted from <option>substr</option>, the remainder of the string
15919 is taken if the offset is positive. If it is negative, all bytes (characters) in the
15920 string preceding the offset point are taken. For example, an offset of -1 and
15921 no length, as in these semantically identical examples:
15922 </para>
15923 <literallayout class="monospaced">
15924 ${substr_-1:abcde}
15925 ${substr{-1}{abcde}}
15926 </literallayout>
15927 <para>
15928 yields all but the last character of the string, that is, <quote>abcd</quote>.
15929 </para>
15930 <para>
15931 All measurement is done in bytes and is not UTF-8 aware.
15932 </para>
15933 </listitem></varlistentry>
15934 <varlistentry>
15935 <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>
15936 <listitem>
15937 <para>
15938 <indexterm role="concept">
15939 <primary>expansion</primary>
15940 <secondary>character translation</secondary>
15941 </indexterm>
15942 <indexterm role="concept">
15943 <primary><option>tr</option> expansion item</primary>
15944 </indexterm>
15945 This item does single-character (in bytes) translation on its subject string. The second
15946 argument is a list of characters to be translated in the subject string. Each
15947 matching character is replaced by the corresponding character from the
15948 replacement list. For example
15949 </para>
15950 <literallayout class="monospaced">
15951 ${tr{abcdea}{ac}{13}}
15952 </literallayout>
15953 <para>
15954 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
15955 last occurrence is used. If the third string is shorter than the second, its
15956 last character is replicated. However, if it is empty, no translation takes
15957 place.
15958 </para>
15959 <para>
15960 All character handling is done in bytes and is not UTF-8 aware.
15961 </para>
15962 </listitem></varlistentry>
15963 </variablelist>
15964 </section>
15965 <section id="SECTexpop">
15966 <title>Expansion operators</title>
15967 <para>
15968 <indexterm role="concept">
15969 <primary>expansion</primary>
15970 <secondary>operators</secondary>
15971 </indexterm>
15972 For expansion items that perform transformations on a single argument string,
15973 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
15974 The substring is first expanded before the operation is applied to it. The
15975 following operations can be performed:
15976 </para>
15977 <variablelist>
15978 <varlistentry>
15979 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15980 <listitem>
15981 <para>
15982 <indexterm role="concept">
15983 <primary>expansion</primary>
15984 <secondary>RFC 2822 address handling</secondary>
15985 </indexterm>
15986 <indexterm role="concept">
15987 <primary><option>address</option> expansion item</primary>
15988 </indexterm>
15989 The string is interpreted as an RFC 2822 address, as it might appear in a
15990 header line, and the effective address is extracted from it. If the string does
15991 not parse successfully, the result is empty.
15992 </para>
15993 <para>
15994 The parsing correctly handles SMTPUTF8 Unicode in the string.
15995 </para>
15996 </listitem></varlistentry>
15997 <varlistentry>
15998 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15999 <listitem>
16000 <para>
16001 <indexterm role="concept">
16002 <primary>expansion</primary>
16003 <secondary>RFC 2822 address handling</secondary>
16004 </indexterm>
16005 <indexterm role="concept">
16006 <primary><option>addresses</option> expansion item</primary>
16007 </indexterm>
16008 The string (after expansion) is interpreted as a list of addresses in RFC
16009 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
16010 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
16011 result of the expansion is a colon-separated list, with appropriate
16012 doubling of colons should any happen to be present in the email addresses.
16013 Syntactically invalid RFC2822 address items are omitted from the output.
16014 </para>
16015 <para>
16016 It is possible to specify a character other than colon for the output
16017 separator by starting the string with &gt; followed by the new separator
16018 character. For example:
16019 </para>
16020 <literallayout class="monospaced">
16021 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
16022 </literallayout>
16023 <para>
16024 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. The string is expanded
16025 first, so if the expanded string starts with &gt;, it may change the output
16026 separator unintentionally. This can be avoided by setting the output
16027 separator explicitly:
16028 </para>
16029 <literallayout class="monospaced">
16030 ${addresses:&gt;:$h_from:}
16031 </literallayout>
16032 <para>
16033 Compare the <option>address</option> (singular)
16034 expansion item, which extracts the working address from a single RFC2822
16035 address. See the <option>filter</option>, <option>map</option>, and <option>reduce</option> items for ways of
16036 processing lists.
16037 </para>
16038 <para>
16039 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
16040 a strict interpretation of header line formatting.  Exim parses the bare,
16041 unquoted portion of an email address and if it finds a comma, treats it as an
16042 email address separator. For the example header line:
16043 </para>
16044 <literallayout class="monospaced">
16045 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
16046 </literallayout>
16047 <para>
16048 The first example below demonstrates that Q-encoded email addresses are parsed
16049 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
16050 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
16051 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
16052 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
16053 The third example shows that the presence of a comma is skipped when it is
16054 quoted.  The fourth example shows SMTPUTF8 handling.
16055 </para>
16056 <literallayout class="monospaced">
16057 # exim -be '${addresses:From: \
16058 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
16059 user@example.com
16060 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
16061 Last:user@example.com
16062 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
16063 user@example.com
16064 # exim -be '${addresses:フィル &lt;フィリップ@example.jp&gt;}'
16065 フィリップ@example.jp
16066 </literallayout>
16067 </listitem></varlistentry>
16068 <varlistentry>
16069 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16070 <listitem>
16071 <para>
16072 <indexterm role="concept">
16073 <primary><option>base32</option> expansion item</primary>
16074 </indexterm>
16075 <indexterm role="concept">
16076 <primary>expansion</primary>
16077 <secondary>conversion to base 32</secondary>
16078 </indexterm>
16079 The string must consist entirely of decimal digits. The number is converted to
16080 base 32 and output as a (empty, for zero) string of characters.
16081 Only lowercase letters are used.
16082 </para>
16083 </listitem></varlistentry>
16084 <varlistentry>
16085 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16086 <listitem>
16087 <para>
16088 <indexterm role="concept">
16089 <primary><option>base32d</option> expansion item</primary>
16090 </indexterm>
16091 <indexterm role="concept">
16092 <primary>expansion</primary>
16093 <secondary>conversion to base 32</secondary>
16094 </indexterm>
16095 The string must consist entirely of base-32 digits.
16096 The number is converted to decimal and output as a string.
16097 </para>
16098 </listitem></varlistentry>
16099 <varlistentry>
16100 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16101 <listitem>
16102 <para>
16103 <indexterm role="concept">
16104 <primary><option>base62</option> expansion item</primary>
16105 </indexterm>
16106 <indexterm role="concept">
16107 <primary>expansion</primary>
16108 <secondary>conversion to base 62</secondary>
16109 </indexterm>
16110 The string must consist entirely of decimal digits. The number is converted to
16111 base 62 and output as a string of six characters, including leading zeros. In
16112 the few operating environments where Exim uses base 36 instead of base 62 for
16113 its message identifiers (because those systems do not have case-sensitive
16114 filenames), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just
16115 to be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
16116 </para>
16117 </listitem></varlistentry>
16118 <varlistentry>
16119 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16120 <listitem>
16121 <para>
16122 <indexterm role="concept">
16123 <primary><option>base62d</option> expansion item</primary>
16124 </indexterm>
16125 <indexterm role="concept">
16126 <primary>expansion</primary>
16127 <secondary>conversion to base 62</secondary>
16128 </indexterm>
16129 The string must consist entirely of base-62 digits, or, in operating
16130 environments where Exim uses base 36 instead of base 62 for its message
16131 identifiers, base-36 digits. The number is converted to decimal and output as a
16132 string.
16133 </para>
16134 </listitem></varlistentry>
16135 <varlistentry>
16136 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16137 <listitem>
16138 <para>
16139 <indexterm role="concept">
16140 <primary>expansion</primary>
16141 <secondary>base64 encoding</secondary>
16142 </indexterm>
16143 <indexterm role="concept">
16144 <primary>base64 encoding</primary>
16145 <secondary>in string expansion</secondary>
16146 </indexterm>
16147 <indexterm role="concept">
16148 <primary><option>base64</option> expansion item</primary>
16149 </indexterm>
16150 <indexterm role="concept">
16151 <primary>certificate</primary>
16152 <secondary>base64 of DER</secondary>
16153 </indexterm>
16154 This operator converts a string into one that is base64 encoded.
16155 </para>
16156 <para>
16157 If the string is a single variable of type certificate,
16158 returns the base64 encoding of the DER form of the certificate.
16159 </para>
16160 </listitem></varlistentry>
16161 <varlistentry>
16162 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16163 <listitem>
16164 <para>
16165 <indexterm role="concept">
16166 <primary>expansion</primary>
16167 <secondary>base64 decoding</secondary>
16168 </indexterm>
16169 <indexterm role="concept">
16170 <primary>base64 decoding</primary>
16171 <secondary>in string expansion</secondary>
16172 </indexterm>
16173 <indexterm role="concept">
16174 <primary><option>base64d</option> expansion item</primary>
16175 </indexterm>
16176 This operator converts a base64-encoded string into the un-coded form.
16177 </para>
16178 </listitem></varlistentry>
16179 <varlistentry>
16180 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16181 <listitem>
16182 <para>
16183 <indexterm role="concept">
16184 <primary>domain</primary>
16185 <secondary>extraction</secondary>
16186 </indexterm>
16187 <indexterm role="concept">
16188 <primary>expansion</primary>
16189 <secondary>domain extraction</secondary>
16190 </indexterm>
16191 The string is interpreted as an RFC 2822 address and the domain is extracted
16192 from it. If the string does not parse successfully, the result is empty.
16193 </para>
16194 </listitem></varlistentry>
16195 <varlistentry>
16196 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16197 <listitem>
16198 <para>
16199 <indexterm role="concept">
16200 <primary>expansion</primary>
16201 <secondary>escaping non-printing characters</secondary>
16202 </indexterm>
16203 <indexterm role="concept">
16204 <primary><option>escape</option> expansion item</primary>
16205 </indexterm>
16206 If the string contains any non-printing characters, they are converted to
16207 escape sequences starting with a backslash. Whether characters with the most
16208 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
16209 is controlled by the <option>print_topbitchars</option> option.
16210 </para>
16211 </listitem></varlistentry>
16212 <varlistentry>
16213 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16214 <listitem>
16215 <para>
16216 <indexterm role="concept">
16217 <primary>expansion</primary>
16218 <secondary>escaping 8-bit characters</secondary>
16219 </indexterm>
16220 <indexterm role="concept">
16221 <primary><option>escape8bit</option> expansion item</primary>
16222 </indexterm>
16223 If the string contains and characters with the most significant bit set,
16224 they are converted to escape sequences starting with a backslash.
16225 Backslashes and DEL characters are also converted.
16226 </para>
16227 </listitem></varlistentry>
16228 <varlistentry>
16229 <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>
16230 <listitem>
16231 <para>
16232 <indexterm role="concept">
16233 <primary>expansion</primary>
16234 <secondary>expression evaluation</secondary>
16235 </indexterm>
16236 <indexterm role="concept">
16237 <primary>expansion</primary>
16238 <secondary>arithmetic expression</secondary>
16239 </indexterm>
16240 <indexterm role="concept">
16241 <primary><option>eval</option> expansion item</primary>
16242 </indexterm>
16243 These items supports simple arithmetic and bitwise logical operations in
16244 expansion strings. The string (after expansion) must be a conventional
16245 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
16246 logical operators, and parentheses. All operations are carried out using
16247 integer arithmetic. The operator priorities are as follows (the same as in the
16248 C programming language):
16249 </para>
16250 <informaltable frame="none">
16251 <tgroup cols="2" colsep="0" rowsep="0">
16252 <colspec colwidth="70pt" align="left"/>
16253 <colspec colwidth="300pt" align="left"/>
16254 <tbody>
16255 <row>
16256 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
16257 <entry>not (~), negate (-)</entry>
16258 </row>
16259 <row>
16260 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16261 <entry>multiply (*), divide (/), remainder (%)</entry>
16262 </row>
16263 <row>
16264 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16265 <entry>plus (+), minus (-)</entry>
16266 </row>
16267 <row>
16268 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16269 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
16270 </row>
16271 <row>
16272 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16273 <entry>and (&amp;)</entry>
16274 </row>
16275 <row>
16276 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16277 <entry>xor (^)</entry>
16278 </row>
16279 <row>
16280 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
16281 <entry>or (|)</entry>
16282 </row>
16283 </tbody>
16284 </tgroup>
16285 </informaltable>
16286 <para>
16287 Binary operators with the same priority are evaluated from left to right. White
16288 space is permitted before or after operators.
16289 </para>
16290 <para>
16291 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
16292 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
16293 decimal, even if they start with a leading zero; hexadecimal numbers are not
16294 permitted. This can be useful when processing numbers extracted from dates or
16295 times, which often do have leading zeros.
16296 </para>
16297 <para>
16298 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
16299 or 1024*1024*1024,
16300 respectively. Negative numbers are supported. The result of the computation is
16301 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
16302 </para>
16303 <literallayout>
16304 <literal>${eval:1+1}            </literal>  yields 2
16305 <literal>${eval:1+2*3}          </literal>  yields 7
16306 <literal>${eval:(1+2)*3}        </literal>  yields 9
16307 <literal>${eval:2+42%5}         </literal>  yields 4
16308 <literal>${eval:0xc&amp;5}          </literal>  yields 4
16309 <literal>${eval:0xc|5}          </literal>  yields 13
16310 <literal>${eval:0xc^5}          </literal>  yields 9
16311 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
16312 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
16313 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
16314 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
16315 </literallayout>
16316 <para>
16317 As a more realistic example, in an ACL you might have
16318 </para>
16319 <literallayout class="monospaced">
16320 deny   condition =                    \
16321          ${if and {                   \
16322            {&gt;{$rcpt_count}{10}}       \
16323            {                          \
16324            &lt;                          \
16325              {$recipients_count}      \
16326              {${eval:$rcpt_count/2}}  \
16327            }                          \
16328          }{yes}{no}}
16329        message = Too many bad recipients
16330 </literallayout>
16331 <para>
16332 The condition is true if there have been more than 10 RCPT commands and
16333 fewer than half of them have resulted in a valid recipient.
16334 </para>
16335 </listitem></varlistentry>
16336 <varlistentry>
16337 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16338 <listitem>
16339 <para>
16340 <indexterm role="concept">
16341 <primary>expansion</primary>
16342 <secondary>re-expansion of substring</secondary>
16343 </indexterm>
16344 The <option>expand</option> operator causes a string to be expanded for a second time. For
16345 example,
16346 </para>
16347 <literallayout class="monospaced">
16348 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
16349 </literallayout>
16350 <para>
16351 first looks up a string in a file while expanding the operand for <option>expand</option>,
16352 and then re-expands what it has found.
16353 </para>
16354 </listitem></varlistentry>
16355 <varlistentry>
16356 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16357 <listitem>
16358 <para>
16359 <indexterm role="concept">
16360 <primary>Unicode</primary>
16361 </indexterm>
16362 <indexterm role="concept">
16363 <primary>UTF-8</primary>
16364 <secondary>conversion from</secondary>
16365 </indexterm>
16366 <indexterm role="concept">
16367 <primary>expansion</primary>
16368 <secondary>UTF-8 conversion</secondary>
16369 </indexterm>
16370 <indexterm role="concept">
16371 <primary><option>from_utf8</option> expansion item</primary>
16372 </indexterm>
16373 The world is slowly moving towards Unicode, although there are no standards for
16374 email yet. However, other applications (including some databases) are starting
16375 to store data in Unicode, using UTF-8 encoding. This operator converts from a
16376 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
16377 converted to underscores. The input must be a valid UTF-8 string. If it is not,
16378 the result is an undefined sequence of bytes.
16379 </para>
16380 <para>
16381 Unicode code points with values less than 256 are compatible with ASCII and
16382 ISO-8859-1 (also known as Latin-1).
16383 For example, character 169 is the copyright symbol in both cases, though the
16384 way it is encoded is different. In UTF-8, more than one byte is needed for
16385 characters with code values greater than 127, whereas ISO-8859-1 is a
16386 single-byte encoding (but thereby limited to 256 characters). This makes
16387 translation from UTF-8 to ISO-8859-1 straightforward.
16388 </para>
16389 </listitem></varlistentry>
16390 <varlistentry>
16391 <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>
16392 <listitem>
16393 <para>
16394 <indexterm role="concept">
16395 <primary>hash function</primary>
16396 <secondary>textual</secondary>
16397 </indexterm>
16398 <indexterm role="concept">
16399 <primary>expansion</primary>
16400 <secondary>textual hash</secondary>
16401 </indexterm>
16402 The <option>hash</option> operator is a simpler interface to the hashing function that can
16403 be used when the two parameters are fixed numbers (as opposed to strings that
16404 change when expanded). The effect is the same as
16405 </para>
16406 <literallayout class="monospaced">
16407 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
16408 </literallayout>
16409 <para>
16410 See the description of the general <option>hash</option> item above for details. The
16411 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
16412 </para>
16413 </listitem></varlistentry>
16414 <varlistentry>
16415 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16416 <listitem>
16417 <para>
16418 <indexterm role="concept">
16419 <primary>base64 encoding</primary>
16420 <secondary>conversion from hex</secondary>
16421 </indexterm>
16422 <indexterm role="concept">
16423 <primary>expansion</primary>
16424 <secondary>hex to base64</secondary>
16425 </indexterm>
16426 <indexterm role="concept">
16427 <primary><option>hex2b64</option> expansion item</primary>
16428 </indexterm>
16429 This operator converts a hex string into one that is base64 encoded. This can
16430 be useful for processing the output of the various hashing functions.
16431 </para>
16432 </listitem></varlistentry>
16433 <varlistentry>
16434 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16435 <listitem>
16436 <para>
16437 <indexterm role="concept">
16438 <primary>quoting</primary>
16439 <secondary>hex-encoded unprintable characters</secondary>
16440 </indexterm>
16441 <indexterm role="concept">
16442 <primary><option>hexquote</option> expansion item</primary>
16443 </indexterm>
16444 This operator converts non-printable characters in a string into a hex
16445 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
16446 as is, and other byte values are converted to <literal>\xNN</literal>, for example, a
16447 byte value 127 is converted to <literal>\x7f</literal>.
16448 </para>
16449 </listitem></varlistentry>
16450 <varlistentry>
16451 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16452 <listitem>
16453 <para>
16454 <indexterm role="concept">
16455 <primary><option>ipv6denorm</option> expansion item</primary>
16456 </indexterm>
16457 <indexterm role="concept">
16458 <primary>IP address</primary>
16459 <secondary>normalisation</secondary>
16460 </indexterm>
16461 This expands an IPv6 address to a full eight-element colon-separated set
16462 of hex digits including leading zeroes.
16463 A trailing ipv4-style dotted-decimal set is converted to hex.
16464 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
16465 </para>
16466 </listitem></varlistentry>
16467 <varlistentry>
16468 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16469 <listitem>
16470 <para>
16471 <indexterm role="concept">
16472 <primary><option>ipv6norm</option> expansion item</primary>
16473 </indexterm>
16474 <indexterm role="concept">
16475 <primary>IP address</primary>
16476 <secondary>normalisation</secondary>
16477 </indexterm>
16478 <indexterm role="concept">
16479 <primary>IP address</primary>
16480 <secondary>canonical form</secondary>
16481 </indexterm>
16482 This converts an IPv6 address to canonical form.
16483 Leading zeroes of groups are omitted, and the longest
16484 set of zero-valued groups is replaced with a double colon.
16485 A trailing ipv4-style dotted-decimal set is converted to hex.
16486 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
16487 </para>
16488 </listitem></varlistentry>
16489 <varlistentry>
16490 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16491 <listitem>
16492 <para>
16493 <indexterm role="concept">
16494 <primary>case forcing in strings</primary>
16495 </indexterm>
16496 <indexterm role="concept">
16497 <primary>string</primary>
16498 <secondary>case forcing</secondary>
16499 </indexterm>
16500 <indexterm role="concept">
16501 <primary>lower casing</primary>
16502 </indexterm>
16503 <indexterm role="concept">
16504 <primary>expansion</primary>
16505 <secondary>case forcing</secondary>
16506 </indexterm>
16507 <indexterm role="concept">
16508 <primary><option>lc</option> expansion item</primary>
16509 </indexterm>
16510 This forces the letters in the string into lower-case, for example:
16511 </para>
16512 <literallayout class="monospaced">
16513 ${lc:$local_part}
16514 </literallayout>
16515 <para>
16516 Case is defined per the system C locale.
16517 </para>
16518 </listitem></varlistentry>
16519 <varlistentry>
16520 <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>
16521 <listitem>
16522 <para>
16523 <indexterm role="concept">
16524 <primary>expansion</primary>
16525 <secondary>string truncation</secondary>
16526 </indexterm>
16527 <indexterm role="concept">
16528 <primary><option>length</option> expansion item</primary>
16529 </indexterm>
16530 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
16531 can be used when the parameter is a fixed number (as opposed to a string that
16532 changes when expanded). The effect is the same as
16533 </para>
16534 <literallayout class="monospaced">
16535 ${length{&lt;number&gt;}{&lt;string&gt;}}
16536 </literallayout>
16537 <para>
16538 See the description of the general <option>length</option> item above for details. Note that
16539 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
16540 when <option>length</option> is used as an operator.
16541 All measurement is done in bytes and is not UTF-8 aware.
16542 </para>
16543 </listitem></varlistentry>
16544 <varlistentry>
16545 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16546 <listitem>
16547 <para>
16548 <indexterm role="concept">
16549 <primary>expansion</primary>
16550 <secondary>list item count</secondary>
16551 </indexterm>
16552 <indexterm role="concept">
16553 <primary>list</primary>
16554 <secondary>item count</secondary>
16555 </indexterm>
16556 <indexterm role="concept">
16557 <primary>list</primary>
16558 <secondary>count of items</secondary>
16559 </indexterm>
16560 <indexterm role="concept">
16561 <primary><option>listcount</option> expansion item</primary>
16562 </indexterm>
16563 The string is interpreted as a list and the number of items is returned.
16564 </para>
16565 </listitem></varlistentry>
16566 <varlistentry>
16567 <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>
16568 <listitem>
16569 <para>
16570 <indexterm role="concept">
16571 <primary>expansion</primary>
16572 <secondary>named list</secondary>
16573 </indexterm>
16574 <indexterm role="concept">
16575 <primary><option>listnamed</option> expansion item</primary>
16576 </indexterm>
16577 The name is interpreted as a named list and the content of the list is returned,
16578 expanding any referenced lists, re-quoting as needed for colon-separation.
16579 If the optional type is given it must be one of "a", "d", "h" or "l"
16580 and selects address-, domain-, host- or localpart- lists to search among respectively.
16581 Otherwise all types are searched in an undefined order and the first
16582 matching list is returned.
16583 </para>
16584 </listitem></varlistentry>
16585 <varlistentry>
16586 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16587 <listitem>
16588 <para>
16589 <indexterm role="concept">
16590 <primary>expansion</primary>
16591 <secondary>local part extraction</secondary>
16592 </indexterm>
16593 <indexterm role="concept">
16594 <primary><option>local_part</option> expansion item</primary>
16595 </indexterm>
16596 The string is interpreted as an RFC 2822 address and the local part is
16597 extracted from it. If the string does not parse successfully, the result is
16598 empty.
16599 The parsing correctly handles SMTPUTF8 Unicode in the string.
16600 </para>
16601 </listitem></varlistentry>
16602 <varlistentry>
16603 <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>
16604 <listitem>
16605 <para>
16606 <indexterm role="concept">
16607 <primary>masked IP address</primary>
16608 </indexterm>
16609 <indexterm role="concept">
16610 <primary>IP address</primary>
16611 <secondary>masking</secondary>
16612 </indexterm>
16613 <indexterm role="concept">
16614 <primary>CIDR notation</primary>
16615 </indexterm>
16616 <indexterm role="concept">
16617 <primary>expansion</primary>
16618 <secondary>IP address masking</secondary>
16619 </indexterm>
16620 <indexterm role="concept">
16621 <primary><option>mask</option> expansion item</primary>
16622 </indexterm>
16623 If the form of the string to be operated on is not an IP address followed by a
16624 slash and an integer (that is, a network address in CIDR notation), the
16625 expansion fails. Otherwise, this operator converts the IP address to binary,
16626 masks off the least significant bits according to the bit count, and converts
16627 the result back to text, with mask appended. For example,
16628 </para>
16629 <literallayout class="monospaced">
16630 ${mask:10.111.131.206/28}
16631 </literallayout>
16632 <para>
16633 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
16634 be mostly used for looking up masked addresses in files, the result for an IPv6
16635 address uses dots to separate components instead of colons, because colon
16636 terminates a key string in lsearch files. So, for example,
16637 </para>
16638 <literallayout class="monospaced">
16639 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
16640 </literallayout>
16641 <para>
16642 returns the string
16643 </para>
16644 <literallayout class="monospaced">
16645 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
16646 </literallayout>
16647 <para>
16648 Letters in IPv6 addresses are always output in lower case.
16649 </para>
16650 </listitem></varlistentry>
16651 <varlistentry>
16652 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16653 <listitem>
16654 <para>
16655 <indexterm role="concept">
16656 <primary>MD5 hash</primary>
16657 </indexterm>
16658 <indexterm role="concept">
16659 <primary>expansion</primary>
16660 <secondary>MD5 hash</secondary>
16661 </indexterm>
16662 <indexterm role="concept">
16663 <primary>certificate</primary>
16664 <secondary>fingerprint</secondary>
16665 </indexterm>
16666 <indexterm role="concept">
16667 <primary><option>md5</option> expansion item</primary>
16668 </indexterm>
16669 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
16670 as a 32-digit hexadecimal number, in which any letters are in lower case.
16671 </para>
16672 <para>
16673 If the string is a single variable of type certificate,
16674 returns the MD5 hash fingerprint of the certificate.
16675 </para>
16676 </listitem></varlistentry>
16677 <varlistentry>
16678 <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>
16679 <listitem>
16680 <para>
16681 <indexterm role="concept">
16682 <primary>expansion</primary>
16683 <secondary>numeric hash</secondary>
16684 </indexterm>
16685 <indexterm role="concept">
16686 <primary>hash function</primary>
16687 <secondary>numeric</secondary>
16688 </indexterm>
16689 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
16690 that can be used when the two parameters are fixed numbers (as opposed to
16691 strings that change when expanded). The effect is the same as
16692 </para>
16693 <literallayout class="monospaced">
16694 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
16695 </literallayout>
16696 <para>
16697 See the description of the general <option>nhash</option> item above for details.
16698 </para>
16699 </listitem></varlistentry>
16700 <varlistentry>
16701 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16702 <listitem>
16703 <para>
16704 <indexterm role="concept">
16705 <primary>quoting</primary>
16706 <secondary>in string expansions</secondary>
16707 </indexterm>
16708 <indexterm role="concept">
16709 <primary>expansion</primary>
16710 <secondary>quoting</secondary>
16711 </indexterm>
16712 <indexterm role="concept">
16713 <primary><option>quote</option> expansion item</primary>
16714 </indexterm>
16715 The <option>quote</option> operator puts its argument into double quotes if it
16716 is an empty string or
16717 contains anything other than letters, digits, underscores, dots, and hyphens.
16718 Any occurrences of double quotes and backslashes are escaped with a backslash.
16719 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
16720 respectively For example,
16721 </para>
16722 <literallayout class="monospaced">
16723 ${quote:ab"*"cd}
16724 </literallayout>
16725 <para>
16726 becomes
16727 </para>
16728 <literallayout class="monospaced">
16729 "ab\"*\"cd"
16730 </literallayout>
16731 <para>
16732 The place where this is useful is when the argument is a substitution from a
16733 variable or a message header.
16734 </para>
16735 </listitem></varlistentry>
16736 <varlistentry>
16737 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16738 <listitem>
16739 <para>
16740 <indexterm role="concept">
16741 <primary><option>quote_local_part</option> expansion item</primary>
16742 </indexterm>
16743 This operator is like <option>quote</option>, except that it quotes the string only if
16744 required to do so by the rules of RFC 2822 for quoting local parts. For
16745 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
16746 If you are creating a new email address from the contents of <varname>$local_part</varname>
16747 (or any other unknown data), you should always use this operator.
16748 </para>
16749 <para>
16750 This quoting determination is not SMTPUTF8-aware, thus quoting non-ASCII data
16751 will likely use the quoting form.
16752 Thus <emphasis>${quote_local_part:フィル}</emphasis> will always become <emphasis>"フィル"</emphasis>.
16753 </para>
16754 </listitem></varlistentry>
16755 <varlistentry>
16756 <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>
16757 <listitem>
16758 <para>
16759 <indexterm role="concept">
16760 <primary>quoting</primary>
16761 <secondary>lookup-specific</secondary>
16762 </indexterm>
16763 This operator applies lookup-specific quoting rules to the string. Each
16764 query-style lookup type has its own quoting rules which are described with
16765 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
16766 </para>
16767 <literallayout class="monospaced">
16768 ${quote_ldap:two * two}
16769 </literallayout>
16770 <para>
16771 returns
16772 </para>
16773 <literallayout class="monospaced">
16774 two%20%5C2A%20two
16775 </literallayout>
16776 <para>
16777 For single-key lookup types, no quoting is ever necessary and this operator
16778 yields an unchanged string.
16779 </para>
16780 </listitem></varlistentry>
16781 <varlistentry>
16782 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16783 <listitem>
16784 <para>
16785 <indexterm role="concept">
16786 <primary>random number</primary>
16787 </indexterm>
16788 This operator returns a somewhat random number which is less than the
16789 supplied number and is at least 0.  The quality of this randomness depends
16790 on how Exim was built; the values are not suitable for keying material.
16791 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
16792 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
16793 for versions of GnuTLS with that function.
16794 Otherwise, the implementation may be arc4random(), random() seeded by
16795 srandomdev() or srandom(), or a custom implementation even weaker than
16796 random().
16797 </para>
16798 </listitem></varlistentry>
16799 <varlistentry>
16800 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16801 <listitem>
16802 <para>
16803 <indexterm role="concept">
16804 <primary>expansion</primary>
16805 <secondary>IP address</secondary>
16806 </indexterm>
16807 This operator reverses an IP address; for IPv4 addresses, the result is in
16808 dotted-quad decimal form, while for IPv6 addresses the result is in
16809 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
16810 for DNS.  For example,
16811 </para>
16812 <literallayout class="monospaced">
16813 ${reverse_ip:192.0.2.4}
16814 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
16815 </literallayout>
16816 <para>
16817 returns
16818 </para>
16819 <literallayout class="monospaced">
16820 4.2.0.192
16821 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
16822 </literallayout>
16823 </listitem></varlistentry>
16824 <varlistentry>
16825 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16826 <listitem>
16827 <para>
16828 <indexterm role="concept">
16829 <primary>expansion</primary>
16830 <secondary>RFC 2047</secondary>
16831 </indexterm>
16832 <indexterm role="concept">
16833 <primary>RFC 2047</primary>
16834 <secondary>expansion operator</secondary>
16835 </indexterm>
16836 <indexterm role="concept">
16837 <primary><option>rfc2047</option> expansion item</primary>
16838 </indexterm>
16839 This operator encodes text according to the rules of RFC 2047. This is an
16840 encoding that is used in header lines to encode non-ASCII characters. It is
16841 assumed that the input string is in the encoding specified by the
16842 <option>headers_charset</option> option, which gets its default at build time. If the string
16843 contains only characters in the range 33&ndash;126, and no instances of the
16844 characters
16845 </para>
16846 <literallayout class="monospaced">
16847 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
16848 </literallayout>
16849 <para>
16850 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
16851 string, using as many <quote>encoded words</quote> as necessary to encode all the
16852 characters.
16853 </para>
16854 </listitem></varlistentry>
16855 <varlistentry>
16856 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16857 <listitem>
16858 <para>
16859 <indexterm role="concept">
16860 <primary>expansion</primary>
16861 <secondary>RFC 2047</secondary>
16862 </indexterm>
16863 <indexterm role="concept">
16864 <primary>RFC 2047</primary>
16865 <secondary>decoding</secondary>
16866 </indexterm>
16867 <indexterm role="concept">
16868 <primary><option>rfc2047d</option> expansion item</primary>
16869 </indexterm>
16870 This operator decodes strings that are encoded as per RFC 2047. Binary zero
16871 bytes are replaced by question marks. Characters are converted into the
16872 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
16873 not recognized unless <option>check_rfc2047_length</option> is set false.
16874 </para>
16875 <para>
16876 <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
16877 access a header line, RFC 2047 decoding is done automatically. You do not need
16878 to use this operator as well.
16879 </para>
16880 </listitem></varlistentry>
16881 <varlistentry>
16882 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16883 <listitem>
16884 <para>
16885 <indexterm role="concept">
16886 <primary>quoting</primary>
16887 <secondary>in regular expressions</secondary>
16888 </indexterm>
16889 <indexterm role="concept">
16890 <primary>regular expressions</primary>
16891 <secondary>quoting</secondary>
16892 </indexterm>
16893 <indexterm role="concept">
16894 <primary><option>rxquote</option> expansion item</primary>
16895 </indexterm>
16896 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
16897 characters in its argument. This is useful when substituting the values of
16898 variables or headers inside regular expressions.
16899 </para>
16900 </listitem></varlistentry>
16901 <varlistentry>
16902 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16903 <listitem>
16904 <para>
16905 <indexterm role="concept">
16906 <primary>SHA-1 hash</primary>
16907 </indexterm>
16908 <indexterm role="concept">
16909 <primary>expansion</primary>
16910 <secondary>SHA-1 hashing</secondary>
16911 </indexterm>
16912 <indexterm role="concept">
16913 <primary>certificate</primary>
16914 <secondary>fingerprint</secondary>
16915 </indexterm>
16916 <indexterm role="concept">
16917 <primary><option>sha1</option> expansion item</primary>
16918 </indexterm>
16919 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
16920 it as a 40-digit hexadecimal number, in which any letters are in upper case.
16921 </para>
16922 <para>
16923 If the string is a single variable of type certificate,
16924 returns the SHA-1 hash fingerprint of the certificate.
16925 </para>
16926 </listitem></varlistentry>
16927 <varlistentry>
16928 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16929 <term><emphasis role="bold">${sha2:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16930 <term><emphasis role="bold">${sha2_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16931 <listitem>
16932 <para>
16933 <indexterm role="concept">
16934 <primary>SHA-256 hash</primary>
16935 </indexterm>
16936 <indexterm role="concept">
16937 <primary>SHA-2 hash</primary>
16938 </indexterm>
16939 <indexterm role="concept">
16940 <primary>certificate</primary>
16941 <secondary>fingerprint</secondary>
16942 </indexterm>
16943 <indexterm role="concept">
16944 <primary>expansion</primary>
16945 <secondary>SHA-256 hashing</secondary>
16946 </indexterm>
16947 <indexterm role="concept">
16948 <primary><option>sha256</option> expansion item</primary>
16949 </indexterm>
16950 <indexterm role="concept">
16951 <primary><option>sha2</option> expansion item</primary>
16952 </indexterm>
16953 The <option>sha256</option> operator computes the SHA-256 hash value of the string
16954 and returns
16955 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16956 </para>
16957 <para>
16958 If the string is a single variable of type certificate,
16959 returns the SHA-256 hash fingerprint of the certificate.
16960 </para>
16961 <para>
16962 The operator can also be spelled <option>sha2</option> and does the same as <option>sha256</option>
16963 (except for certificates, which are not supported).
16964 Finally, if an underbar
16965 and a number is appended it specifies the output length, selecting a
16966 member of the SHA-2 family of hash functions.
16967 Values of 256, 384 and 512 are accepted, with 256 being the default.
16968 </para>
16969 </listitem></varlistentry>
16970 <varlistentry>
16971 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16972 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16973 <listitem>
16974 <para>
16975 <indexterm role="concept">
16976 <primary>SHA3 hash</primary>
16977 </indexterm>
16978 <indexterm role="concept">
16979 <primary>expansion</primary>
16980 <secondary>SHA3 hashing</secondary>
16981 </indexterm>
16982 <indexterm role="concept">
16983 <primary><option>sha3</option> expansion item</primary>
16984 </indexterm>
16985 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
16986 and returns
16987 it as a 64-digit hexadecimal number, in which any letters are in upper case.
16988 </para>
16989 <para>
16990 If a number is appended, separated by an underbar, it specifies
16991 the output length.  Values of 224, 256, 384 and 512 are accepted;
16992 with 256 being the default.
16993 </para>
16994 <para>
16995 The <option>sha3</option> expansion item is only supported if Exim has been
16996 compiled with GnuTLS 3.5.0 or later,
16997 or OpenSSL 1.1.1 or later.
16998 The macro "_CRYPTO_HASH_SHA3" will be defined if it is supported.
16999 </para>
17000 </listitem></varlistentry>
17001 <varlistentry>
17002 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17003 <listitem>
17004 <para>
17005 <indexterm role="concept">
17006 <primary>expansion</primary>
17007 <secondary>statting a file</secondary>
17008 </indexterm>
17009 <indexterm role="concept">
17010 <primary>file</primary>
17011 <secondary>extracting characteristics</secondary>
17012 </indexterm>
17013 <indexterm role="concept">
17014 <primary><option>stat</option> expansion item</primary>
17015 </indexterm>
17016 The string, after expansion, must be a file path. A call to the <function>stat()</function>
17017 function is made for this path. If <function>stat()</function> fails, an error occurs and the
17018 expansion fails. If it succeeds, the data from the stat replaces the item, as a
17019 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
17020 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
17021 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
17022 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
17023 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
17024 can extract individual fields using the <option>extract</option> expansion item.
17025 </para>
17026 <para>
17027 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
17028 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
17029 systems for files larger than 2GB.
17030 </para>
17031 </listitem></varlistentry>
17032 <varlistentry>
17033 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17034 <listitem>
17035 <para>
17036 <indexterm role="concept">
17037 <primary><option>str2b64</option> expansion item</primary>
17038 </indexterm>
17039 Now deprecated, a synonym for the <option>base64</option> expansion operator.
17040 </para>
17041 </listitem></varlistentry>
17042 <varlistentry>
17043 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17044 <listitem>
17045 <para>
17046 <indexterm role="concept">
17047 <primary>expansion</primary>
17048 <secondary>string length</secondary>
17049 </indexterm>
17050 <indexterm role="concept">
17051 <primary>string</primary>
17052 <secondary>length in expansion</secondary>
17053 </indexterm>
17054 <indexterm role="concept">
17055 <primary><option>strlen</option> expansion item</primary>
17056 </indexterm>
17057 The item is replace by the length of the expanded string, expressed as a
17058 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
17059 All measurement is done in bytes and is not UTF-8 aware.
17060 </para>
17061 </listitem></varlistentry>
17062 <varlistentry>
17063 <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>
17064 <listitem>
17065 <para>
17066 <indexterm role="concept">
17067 <primary><option>substr</option> expansion item</primary>
17068 </indexterm>
17069 <indexterm role="concept">
17070 <primary>substring extraction</primary>
17071 </indexterm>
17072 <indexterm role="concept">
17073 <primary>expansion</primary>
17074 <secondary>substring expansion</secondary>
17075 </indexterm>
17076 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
17077 can be used when the two parameters are fixed numbers (as opposed to strings
17078 that change when expanded). The effect is the same as
17079 </para>
17080 <literallayout class="monospaced">
17081 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
17082 </literallayout>
17083 <para>
17084 See the description of the general <option>substr</option> item above for details. The
17085 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
17086 All measurement is done in bytes and is not UTF-8 aware.
17087 </para>
17088 </listitem></varlistentry>
17089 <varlistentry>
17090 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17091 <listitem>
17092 <para>
17093 <indexterm role="concept">
17094 <primary><option>time_eval</option> expansion item</primary>
17095 </indexterm>
17096 <indexterm role="concept">
17097 <primary>time interval</primary>
17098 <secondary>decoding</secondary>
17099 </indexterm>
17100 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
17101 seconds.
17102 </para>
17103 </listitem></varlistentry>
17104 <varlistentry>
17105 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17106 <listitem>
17107 <para>
17108 <indexterm role="concept">
17109 <primary><option>time_interval</option> expansion item</primary>
17110 </indexterm>
17111 <indexterm role="concept">
17112 <primary>time interval</primary>
17113 <secondary>formatting</secondary>
17114 </indexterm>
17115 The argument (after sub-expansion) must be a sequence of decimal digits that
17116 represents an interval of time as a number of seconds. It is converted into a
17117 number of larger units and output in Exim&#x2019;s normal time format, for example,
17118 <literal>1w3d4h2m6s</literal>.
17119 </para>
17120 </listitem></varlistentry>
17121 <varlistentry>
17122 <term><emphasis role="bold">${uc:</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>upper 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>uc</option> expansion item</primary>
17141 </indexterm>
17142 This forces the letters in the string into upper-case.
17143 Case is defined per the system C locale.
17144 </para>
17145 </listitem></varlistentry>
17146 <varlistentry>
17147 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17148 <listitem>
17149 <para>
17150 <indexterm role="concept">
17151 <primary>correction of invalid utf-8 sequences in strings</primary>
17152 </indexterm>
17153 <indexterm role="concept">
17154 <primary>utf-8</primary>
17155 <secondary>utf-8 sequences</secondary>
17156 </indexterm>
17157 <indexterm role="concept">
17158 <primary>incorrect utf-8</primary>
17159 </indexterm>
17160 <indexterm role="concept">
17161 <primary>expansion</primary>
17162 <secondary>utf-8 forcing</secondary>
17163 </indexterm>
17164 <indexterm role="concept">
17165 <primary><option>utf8clean</option> expansion item</primary>
17166 </indexterm>
17167 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
17168 In versions of Exim before 4.92, this did not correctly do so for a truncated
17169 final codepoint&#x2019;s encoding, and the character would be silently dropped.
17170 If you must handle detection of this scenario across both sets of Exim behavior,
17171 the complexity will depend upon the task.
17172 For instance, to detect if the first character is multibyte and a 1-byte
17173 extraction can be successfully used as a path component (as is common for
17174 dividing up delivery folders), you might use:
17175 </para>
17176 <literallayout class="monospaced">
17177 condition = ${if inlist{${utf8clean:${length_1:$local_part}}}{:?}{yes}{no}}
17178 </literallayout>
17179 <para>
17180 (which will false-positive if the first character of the local part is a
17181 literal question mark).
17182 </para>
17183 </listitem></varlistentry>
17184 <varlistentry>
17185 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17186 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17187 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17188 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17189 <listitem>
17190 <para>
17191 <indexterm role="concept">
17192 <primary>expansion</primary>
17193 <secondary>UTF-8</secondary>
17194 </indexterm>
17195 <indexterm role="concept">
17196 <primary>UTF-8</primary>
17197 <secondary>expansion</secondary>
17198 </indexterm>
17199 <indexterm role="concept">
17200 <primary>EAI</primary>
17201 </indexterm>
17202 <indexterm role="concept">
17203 <primary>internationalisation</primary>
17204 </indexterm>
17205 <indexterm role="concept">
17206 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
17207 </indexterm>
17208 <indexterm role="concept">
17209 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
17210 </indexterm>
17211 <indexterm role="concept">
17212 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
17213 </indexterm>
17214 <indexterm role="concept">
17215 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
17216 </indexterm>
17217 These convert EAI mail name components between UTF-8 and a-label forms.
17218 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
17219 </para>
17220 </listitem></varlistentry>
17221 </variablelist>
17222 </section>
17223 <section id="SECTexpcond">
17224 <title>Expansion conditions</title>
17225 <para>
17226 <indexterm role="concept" id="IIDexpcond" class="startofrange">
17227 <primary>expansion</primary>
17228 <secondary>conditions</secondary>
17229 </indexterm>
17230 The following conditions are available for testing by the <option>${if</option> construct
17231 while expanding strings:
17232 </para>
17233 <variablelist>
17234 <varlistentry>
17235 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
17236 <listitem>
17237 <para>
17238 <indexterm role="concept">
17239 <primary>expansion</primary>
17240 <secondary>negating a condition</secondary>
17241 </indexterm>
17242 <indexterm role="concept">
17243 <primary>negation</primary>
17244 <secondary>in expansion condition</secondary>
17245 </indexterm>
17246 Preceding any condition with an exclamation mark negates the result of the
17247 condition.
17248 </para>
17249 </listitem></varlistentry>
17250 <varlistentry>
17251 <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>
17252 <listitem>
17253 <para>
17254 <indexterm role="concept">
17255 <primary>numeric comparison</primary>
17256 </indexterm>
17257 <indexterm role="concept">
17258 <primary>expansion</primary>
17259 <secondary>numeric comparison</secondary>
17260 </indexterm>
17261 There are a number of symbolic operators for doing numeric comparisons. They
17262 are:
17263 </para>
17264 <literallayout>
17265 <literal>=   </literal>   equal
17266 <literal>==  </literal>   equal
17267 <literal>&gt;   </literal>   greater
17268 <literal>&gt;=  </literal>   greater or equal
17269 <literal>&lt;   </literal>   less
17270 <literal>&lt;=  </literal>   less or equal
17271 </literallayout>
17272 <para>
17273 For example:
17274 </para>
17275 <literallayout class="monospaced">
17276 ${if &gt;{$message_size}{10M} ...
17277 </literallayout>
17278 <para>
17279 Note that the general negation operator provides for inequality testing. The
17280 two strings must take the form of optionally signed decimal integers,
17281 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
17282 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
17283 As a special case, the numerical value of an empty string is taken as
17284 zero.
17285 </para>
17286 <para>
17287 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
17288 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
17289 10M, not if 10M is larger than <varname>$message_size</varname>.
17290 </para>
17291 </listitem></varlistentry>
17292 <varlistentry>
17293 <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>
17294 <listitem>
17295 <para>
17296 <indexterm role="concept">
17297 <primary>expansion</primary>
17298 <secondary>calling an acl</secondary>
17299 </indexterm>
17300 <indexterm role="concept">
17301 <primary><option>acl</option></primary>
17302 <secondary>expansion condition</secondary>
17303 </indexterm>
17304 The name and zero to nine argument strings are first expanded separately.  The expanded
17305 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
17306 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
17307 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
17308 and may use the variables; if another acl expansion is used the values
17309 are restored after it returns.  If the ACL sets
17310 a value using a "message =" modifier the variable $value becomes
17311 the result of the expansion, otherwise it is empty.
17312 If the ACL returns accept the condition is true; if deny, false.
17313 If the ACL returns defer the result is a forced-fail.
17314 </para>
17315 </listitem></varlistentry>
17316 <varlistentry>
17317 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17318 <listitem>
17319 <para>
17320 <indexterm role="concept">
17321 <primary>expansion</primary>
17322 <secondary>boolean parsing</secondary>
17323 </indexterm>
17324 <indexterm role="concept">
17325 <primary><option>bool</option> expansion condition</primary>
17326 </indexterm>
17327 This condition turns a string holding a true or false representation into
17328 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
17329 (case-insensitively); also integer numbers map to true if non-zero,
17330 false if zero.
17331 An empty string is treated as false.
17332 Leading and trailing whitespace is ignored;
17333 thus a string consisting only of whitespace is false.
17334 All other string values will result in expansion failure.
17335 </para>
17336 <para>
17337 When combined with ACL variables, this expansion condition will let you
17338 make decisions in one place and act on those decisions in another place.
17339 For example:
17340 </para>
17341 <literallayout class="monospaced">
17342 ${if bool{$acl_m_privileged_sender} ...
17343 </literallayout>
17344 </listitem></varlistentry>
17345 <varlistentry>
17346 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17347 <listitem>
17348 <para>
17349 <indexterm role="concept">
17350 <primary>expansion</primary>
17351 <secondary>boolean parsing</secondary>
17352 </indexterm>
17353 <indexterm role="concept">
17354 <primary><option>bool_lax</option> expansion condition</primary>
17355 </indexterm>
17356 Like <option>bool</option>, this condition turns a string into a boolean state.  But
17357 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
17358 loose definition that the Router <option>condition</option> option uses.  The empty string
17359 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
17360 true.  Leading and trailing whitespace is ignored.
17361 </para>
17362 <para>
17363 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
17364 </para>
17365 </listitem></varlistentry>
17366 <varlistentry>
17367 <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>
17368 <listitem>
17369 <para>
17370 <indexterm role="concept">
17371 <primary>expansion</primary>
17372 <secondary>encrypted comparison</secondary>
17373 </indexterm>
17374 <indexterm role="concept">
17375 <primary>encrypted strings, comparing</primary>
17376 </indexterm>
17377 <indexterm role="concept">
17378 <primary><option>crypteq</option> expansion condition</primary>
17379 </indexterm>
17380 This condition is included in the Exim binary if it is built to support any
17381 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
17382 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
17383 included in the binary.
17384 </para>
17385 <para>
17386 The <option>crypteq</option> condition has two arguments. The first is encrypted and
17387 compared against the second, which is already encrypted. The second string may
17388 be in the LDAP form for storing encrypted strings, which starts with the
17389 encryption type in curly brackets, followed by the data. If the second string
17390 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
17391 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
17392 Typically this will be a field from a password file. An example of an encrypted
17393 string in LDAP form is:
17394 </para>
17395 <literallayout class="monospaced">
17396 {md5}CY9rzUYh03PK3k6DJie09g==
17397 </literallayout>
17398 <para>
17399 If such a string appears directly in an expansion, the curly brackets have to
17400 be quoted, because they are part of the expansion syntax. For example:
17401 </para>
17402 <literallayout class="monospaced">
17403 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
17404 </literallayout>
17405 <para>
17406 The following encryption types (whose names are matched case-independently) are
17407 supported:
17408 </para>
17409 <itemizedlist>
17410 <listitem>
17411 <para>
17412 <indexterm role="concept">
17413 <primary>MD5 hash</primary>
17414 </indexterm>
17415 <indexterm role="concept">
17416 <primary>base64 encoding</primary>
17417 <secondary>in encrypted password</secondary>
17418 </indexterm>
17419 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
17420 printable characters to compare with the remainder of the second string. If the
17421 length of the comparison string is 24, Exim assumes that it is base64 encoded
17422 (as in the above example). If the length is 32, Exim assumes that it is a
17423 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
17424 comparison fails.
17425 </para>
17426 </listitem>
17427 <listitem>
17428 <para>
17429 <indexterm role="concept">
17430 <primary>SHA-1 hash</primary>
17431 </indexterm>
17432 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
17433 printable characters to compare with the remainder of the second string. If the
17434 length of the comparison string is 28, Exim assumes that it is base64 encoded.
17435 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
17436 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
17437 </para>
17438 </listitem>
17439 <listitem>
17440 <para>
17441 <indexterm role="concept">
17442 <primary><function>crypt()</function></primary>
17443 </indexterm>
17444 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
17445 only the first eight characters of the password. However, in modern operating
17446 systems this is no longer true, and in many cases the entire password is used,
17447 whatever its length.
17448 </para>
17449 </listitem>
17450 <listitem>
17451 <para>
17452 <indexterm role="concept">
17453 <primary><function>crypt16()</function></primary>
17454 </indexterm>
17455 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
17456 use up to 16 characters of the password in some operating systems. Again, in
17457 modern operating systems, more characters may be used.
17458 </para>
17459 </listitem>
17460 </itemizedlist>
17461 <para>
17462 Exim has its own version of <function>crypt16()</function>, which is just a double call to
17463 <function>crypt()</function>. For operating systems that have their own version, setting
17464 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
17465 operating system version instead of its own. This option is set by default in
17466 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
17467 support <function>crypt16()</function>.
17468 </para>
17469 <para>
17470 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
17471 it was not using the same algorithm as some operating systems&#x2019; versions. It
17472 turns out that as well as <function>crypt16()</function> there is a function called
17473 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
17474 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
17475 </para>
17476 <para>
17477 However, since there is now a move away from the traditional <function>crypt()</function>
17478 functions towards using SHA1 and other algorithms, tidying up this area of
17479 Exim is seen as very low priority.
17480 </para>
17481 <para>
17482 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
17483 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
17484 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
17485 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
17486 function by specifying it explicitly in curly brackets.
17487 </para>
17488 </listitem></varlistentry>
17489 <varlistentry>
17490 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
17491 <listitem>
17492 <para>
17493 <indexterm role="concept">
17494 <primary>expansion</primary>
17495 <secondary>checking for empty variable</secondary>
17496 </indexterm>
17497 <indexterm role="concept">
17498 <primary><option>def</option> expansion condition</primary>
17499 </indexterm>
17500 The <option>def</option> condition must be followed by the name of one of the expansion
17501 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
17502 variable does not contain the empty string. For example:
17503 </para>
17504 <literallayout class="monospaced">
17505 ${if def:sender_ident {from $sender_ident}}
17506 </literallayout>
17507 <para>
17508 Note that the variable name is given without a leading <option>$</option> character. If the
17509 variable does not exist, the expansion fails.
17510 </para>
17511 </listitem></varlistentry>
17512 <varlistentry>
17513 <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>
17514 <listitem>
17515 <para>
17516 <indexterm role="concept">
17517 <primary>expansion</primary>
17518 <secondary>checking header line existence</secondary>
17519 </indexterm>
17520 This condition is true if a message is being processed and the named header
17521 exists in the message. For example,
17522 </para>
17523 <literallayout class="monospaced">
17524 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
17525 </literallayout>
17526 <para>
17527 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
17528 the header name must be terminated by a colon if white space does not follow.
17529 </para>
17530 </listitem></varlistentry>
17531 <varlistentry>
17532 <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>
17533 <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>
17534 <listitem>
17535 <para>
17536 <indexterm role="concept">
17537 <primary>string</primary>
17538 <secondary>comparison</secondary>
17539 </indexterm>
17540 <indexterm role="concept">
17541 <primary>expansion</primary>
17542 <secondary>string comparison</secondary>
17543 </indexterm>
17544 <indexterm role="concept">
17545 <primary><option>eq</option> expansion condition</primary>
17546 </indexterm>
17547 <indexterm role="concept">
17548 <primary><option>eqi</option> expansion condition</primary>
17549 </indexterm>
17550 The two substrings are first expanded. The condition is true if the two
17551 resulting strings are identical. For <option>eq</option> the comparison includes the case of
17552 letters, whereas for <option>eqi</option> the comparison is case-independent, where
17553 case is defined per the system C locale.
17554 </para>
17555 </listitem></varlistentry>
17556 <varlistentry>
17557 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17558 <listitem>
17559 <para>
17560 <indexterm role="concept">
17561 <primary>expansion</primary>
17562 <secondary>file existence test</secondary>
17563 </indexterm>
17564 <indexterm role="concept">
17565 <primary>file</primary>
17566 <secondary>existence test</secondary>
17567 </indexterm>
17568 <indexterm role="concept">
17569 <primary><option>exists</option>, expansion condition</primary>
17570 </indexterm>
17571 The substring is first expanded and then interpreted as an absolute path. The
17572 condition is true if the named file (or directory) exists. The existence test
17573 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
17574 users&#x2019; filter files may be locked out by the system administrator.
17575 </para>
17576 </listitem></varlistentry>
17577 <varlistentry>
17578 <term><emphasis role="bold">first_delivery</emphasis></term>
17579 <listitem>
17580 <para>
17581 <indexterm role="concept">
17582 <primary>delivery</primary>
17583 <secondary>first</secondary>
17584 </indexterm>
17585 <indexterm role="concept">
17586 <primary>first delivery</primary>
17587 </indexterm>
17588 <indexterm role="concept">
17589 <primary>expansion</primary>
17590 <secondary>first delivery test</secondary>
17591 </indexterm>
17592 <indexterm role="concept">
17593 <primary><option>first_delivery</option> expansion condition</primary>
17594 </indexterm>
17595 This condition, which has no data, is true during a message&#x2019;s first delivery
17596 attempt. It is false during any subsequent delivery attempts.
17597 </para>
17598 </listitem></varlistentry>
17599 <varlistentry>
17600 <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>
17601 <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>
17602 <listitem>
17603 <para>
17604 <indexterm role="concept">
17605 <primary>list</primary>
17606 <secondary>iterative conditions</secondary>
17607 </indexterm>
17608 <indexterm role="concept">
17609 <primary>expansion</primary>
17610 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
17611 </indexterm>
17612 <indexterm role="concept">
17613 <primary>expansion</primary>
17614 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
17615 </indexterm>
17616 <indexterm role="variable">
17617 <primary><varname>$item</varname></primary>
17618 </indexterm>
17619 These conditions iterate over a list. The first argument is expanded to form
17620 the list. By default, the list separator is a colon, but it can be changed by
17621 the normal method (<xref linkend="SECTlistsepchange"/>).
17622 The second argument is interpreted as a condition that is to
17623 be applied to each item in the list in turn. During the interpretation of the
17624 condition, the current list item is placed in a variable called <varname>$item</varname>.
17625 </para>
17626 <itemizedlist>
17627 <listitem>
17628 <para>
17629 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
17630 the result of the whole condition is true. If the condition is false for all
17631 items in the list, the overall condition is false.
17632 </para>
17633 </listitem>
17634 <listitem>
17635 <para>
17636 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
17637 and the result of the whole condition is false. If the condition is true for
17638 all items in the list, the overall condition is true.
17639 </para>
17640 </listitem>
17641 </itemizedlist>
17642 <para>
17643 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
17644 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
17645 that the condition must be false for at least one item. In this example, the
17646 list separator is changed to a comma:
17647 </para>
17648 <literallayout class="monospaced">
17649 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
17650 </literallayout>
17651 <para>
17652 The value of <varname>$item</varname> is saved and restored while <option>forany</option> or <option>forall</option> is
17653 being processed, to enable these expansion items to be nested.
17654 </para>
17655 <para>
17656 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
17657 </para>
17658 </listitem></varlistentry>
17659 <varlistentry>
17660 <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>
17661 <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>
17662 <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>
17663 <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>
17664 <listitem>
17665 <para>
17666 <indexterm role="concept">
17667 <primary>JSON</primary>
17668 <secondary>iterative conditions</secondary>
17669 </indexterm>
17670 <indexterm role="concept">
17671 <primary>JSON</primary>
17672 <secondary>expansions</secondary>
17673 </indexterm>
17674 <indexterm role="concept">
17675 <primary>expansion</primary>
17676 <secondary><emphasis role="bold">forall_json</emphasis> condition</secondary>
17677 </indexterm>
17678 <indexterm role="concept">
17679 <primary>expansion</primary>
17680 <secondary><emphasis role="bold">forany_json</emphasis> condition</secondary>
17681 </indexterm>
17682 <indexterm role="concept">
17683 <primary>expansion</primary>
17684 <secondary><emphasis role="bold">forall_jsons</emphasis> condition</secondary>
17685 </indexterm>
17686 <indexterm role="concept">
17687 <primary>expansion</primary>
17688 <secondary><emphasis role="bold">forany_jsons</emphasis> condition</secondary>
17689 </indexterm>
17690 As for the above, except that the first argument must, after expansion,
17691 be a JSON array.
17692 The array separator is not changeable.
17693 For the <quote>jsons</quote> variants the elements are expected to be JSON strings
17694 and have their quotes removed before the evaluation of the condition.
17695 </para>
17696 </listitem></varlistentry>
17697 <varlistentry>
17698 <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>
17699 <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>
17700 <listitem>
17701 <para>
17702 <indexterm role="concept">
17703 <primary>string</primary>
17704 <secondary>comparison</secondary>
17705 </indexterm>
17706 <indexterm role="concept">
17707 <primary>expansion</primary>
17708 <secondary>string comparison</secondary>
17709 </indexterm>
17710 <indexterm role="concept">
17711 <primary><option>ge</option> expansion condition</primary>
17712 </indexterm>
17713 <indexterm role="concept">
17714 <primary><option>gei</option> expansion condition</primary>
17715 </indexterm>
17716 The two substrings are first expanded. The condition is true if the first
17717 string is lexically greater than or equal to the second string. For <option>ge</option> the
17718 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
17719 case-independent.
17720 Case and collation order are defined per the system C locale.
17721 </para>
17722 </listitem></varlistentry>
17723 <varlistentry>
17724 <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>
17725 <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>
17726 <listitem>
17727 <para>
17728 <indexterm role="concept">
17729 <primary>string</primary>
17730 <secondary>comparison</secondary>
17731 </indexterm>
17732 <indexterm role="concept">
17733 <primary>expansion</primary>
17734 <secondary>string comparison</secondary>
17735 </indexterm>
17736 <indexterm role="concept">
17737 <primary><option>gt</option> expansion condition</primary>
17738 </indexterm>
17739 <indexterm role="concept">
17740 <primary><option>gti</option> expansion condition</primary>
17741 </indexterm>
17742 The two substrings are first expanded. The condition is true if the first
17743 string is lexically greater than the second string. For <option>gt</option> the comparison
17744 includes the case of letters, whereas for <option>gti</option> the comparison is
17745 case-independent.
17746 Case and collation order are defined per the system C locale.
17747 </para>
17748 </listitem></varlistentry>
17749 <varlistentry>
17750 <term><emphasis role="bold">inlist&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17751 <term><emphasis role="bold">inlisti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17752 <listitem>
17753 <para>
17754 <indexterm role="concept">
17755 <primary>string</primary>
17756 <secondary>comparison</secondary>
17757 </indexterm>
17758 <indexterm role="concept">
17759 <primary>list</primary>
17760 <secondary>iterative conditions</secondary>
17761 </indexterm>
17762 Both strings are expanded; the second string is treated as a list of simple
17763 strings; if the first string is a member of the second, then the condition
17764 is true.
17765 For the case-independent <option>inlisti</option> condition, case is defined per the system C locale.
17766 </para>
17767 <para>
17768 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
17769 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
17770 </para>
17771 <literallayout class="monospaced">
17772 ${if inlist{needle}{foo:needle:bar}}
17773   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
17774 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
17775   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
17776 </literallayout>
17777 </listitem></varlistentry>
17778 <varlistentry>
17779 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17780 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17781 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17782 <listitem>
17783 <para>
17784 <indexterm role="concept">
17785 <primary>IP address</primary>
17786 <secondary>testing string format</secondary>
17787 </indexterm>
17788 <indexterm role="concept">
17789 <primary>string</primary>
17790 <secondary>testing for IP address</secondary>
17791 </indexterm>
17792 <indexterm role="concept">
17793 <primary><option>isip</option> expansion condition</primary>
17794 </indexterm>
17795 <indexterm role="concept">
17796 <primary><option>isip4</option> expansion condition</primary>
17797 </indexterm>
17798 <indexterm role="concept">
17799 <primary><option>isip6</option> expansion condition</primary>
17800 </indexterm>
17801 The substring is first expanded, and then tested to see if it has the form of
17802 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
17803 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
17804 </para>
17805 <para>
17806 For an IPv4 address, the test is for four dot-separated components, each of
17807 which consists of from one to three digits. For an IPv6 address, up to eight
17808 colon-separated components are permitted, each containing from one to four
17809 hexadecimal digits. There may be fewer than eight components if an empty
17810 component (adjacent colons) is present. Only one empty component is permitted.
17811 </para>
17812 <para>
17813 <emphasis role="bold">Note</emphasis>: The checks used to be just on the form of the address; actual numerical
17814 values were not considered. Thus, for example, 999.999.999.999 passed the IPv4
17815 check.
17816 This is no longer the case.
17817 </para>
17818 <para>
17819 The main use of these tests is to distinguish between IP addresses and
17820 host names, or between IPv4 and IPv6 addresses. For example, you could use
17821 </para>
17822 <literallayout class="monospaced">
17823 ${if isip4{$sender_host_address}...
17824 </literallayout>
17825 <para>
17826 to test which IP version an incoming SMTP connection is using.
17827 </para>
17828 </listitem></varlistentry>
17829 <varlistentry>
17830 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17831 <listitem>
17832 <para>
17833 <indexterm role="concept">
17834 <primary>LDAP</primary>
17835 <secondary>use for authentication</secondary>
17836 </indexterm>
17837 <indexterm role="concept">
17838 <primary>expansion</primary>
17839 <secondary>LDAP authentication test</secondary>
17840 </indexterm>
17841 <indexterm role="concept">
17842 <primary><option>ldapauth</option> expansion condition</primary>
17843 </indexterm>
17844 This condition supports user authentication using LDAP. See section
17845 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
17846 queries. For this use, the query must contain a user name and password. The
17847 query itself is not used, and can be empty. The condition is true if the
17848 password is not empty, and the user name and password are accepted by the LDAP
17849 server. An empty password is rejected without calling LDAP because LDAP binds
17850 with an empty password are considered anonymous regardless of the username, and
17851 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
17852 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
17853 this can be used.
17854 </para>
17855 </listitem></varlistentry>
17856 <varlistentry>
17857 <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>
17858 <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>
17859 <listitem>
17860 <para>
17861 <indexterm role="concept">
17862 <primary>string</primary>
17863 <secondary>comparison</secondary>
17864 </indexterm>
17865 <indexterm role="concept">
17866 <primary>expansion</primary>
17867 <secondary>string comparison</secondary>
17868 </indexterm>
17869 <indexterm role="concept">
17870 <primary><option>le</option> expansion condition</primary>
17871 </indexterm>
17872 <indexterm role="concept">
17873 <primary><option>lei</option> expansion condition</primary>
17874 </indexterm>
17875 The two substrings are first expanded. The condition is true if the first
17876 string is lexically less than or equal to the second string. For <option>le</option> the
17877 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
17878 case-independent.
17879 Case and collation order are defined per the system C locale.
17880 </para>
17881 </listitem></varlistentry>
17882 <varlistentry>
17883 <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>
17884 <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>
17885 <listitem>
17886 <para>
17887 <indexterm role="concept">
17888 <primary>string</primary>
17889 <secondary>comparison</secondary>
17890 </indexterm>
17891 <indexterm role="concept">
17892 <primary>expansion</primary>
17893 <secondary>string comparison</secondary>
17894 </indexterm>
17895 <indexterm role="concept">
17896 <primary><option>lt</option> expansion condition</primary>
17897 </indexterm>
17898 <indexterm role="concept">
17899 <primary><option>lti</option> expansion condition</primary>
17900 </indexterm>
17901 The two substrings are first expanded. The condition is true if the first
17902 string is lexically less than the second string. For <option>lt</option> the comparison
17903 includes the case of letters, whereas for <option>lti</option> the comparison is
17904 case-independent.
17905 Case and collation order are defined per the system C locale.
17906 </para>
17907 </listitem></varlistentry>
17908 <varlistentry>
17909 <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>
17910 <listitem>
17911 <para>
17912 <indexterm role="concept">
17913 <primary>expansion</primary>
17914 <secondary>regular expression comparison</secondary>
17915 </indexterm>
17916 <indexterm role="concept">
17917 <primary>regular expressions</primary>
17918 <secondary>match in expanded string</secondary>
17919 </indexterm>
17920 <indexterm role="concept">
17921 <primary><option>match</option> expansion condition</primary>
17922 </indexterm>
17923 The two substrings are first expanded. The second is then treated as a regular
17924 expression and applied to the first. Because of the pre-expansion, if the
17925 regular expression contains dollar, or backslash characters, they must be
17926 escaped. Care must also be taken if the regular expression contains braces
17927 (curly brackets). A closing brace must be escaped so that it is not taken as a
17928 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
17929 <literal>\N</literal> feature to disable expansion of the regular expression.
17930 For example,
17931 </para>
17932 <literallayout class="monospaced">
17933 ${if match {$local_part}{\N^\d{3}\N} ...
17934 </literallayout>
17935 <para>
17936 If the whole expansion string is in double quotes, further escaping of
17937 backslashes is also required.
17938 </para>
17939 <para>
17940 The condition is true if the regular expression match succeeds.
17941 The regular expression is not required to begin with a circumflex
17942 metacharacter, but if there is no circumflex, the expression is not anchored,
17943 and it may match anywhere in the subject, not just at the start. If you want
17944 the pattern to match at the end of the subject, you must include the <literal>$</literal>
17945 metacharacter at an appropriate point.
17946 All character handling is done in bytes and is not UTF-8 aware,
17947 but we might change this in a future Exim release.
17948 </para>
17949 <para>
17950 <indexterm role="concept">
17951 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
17952 <secondary>in <option>if</option> expansion</secondary>
17953 </indexterm>
17954 At the start of an <option>if</option> expansion the values of the numeric variable
17955 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
17956 succeeds causes them to be reset to the substrings of that condition and they
17957 will have these values during the expansion of the success string. At the end
17958 of the <option>if</option> expansion, the previous values are restored. After testing a
17959 combination of conditions using <option>or</option>, the subsequent values of the numeric
17960 variables are those of the condition that succeeded.
17961 </para>
17962 </listitem></varlistentry>
17963 <varlistentry>
17964 <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>
17965 <listitem>
17966 <para>
17967 <indexterm role="concept">
17968 <primary><option>match_address</option> expansion condition</primary>
17969 </indexterm>
17970 See <emphasis role="bold">match_local_part</emphasis>.
17971 </para>
17972 </listitem></varlistentry>
17973 <varlistentry>
17974 <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>
17975 <listitem>
17976 <para>
17977 <indexterm role="concept">
17978 <primary><option>match_domain</option> expansion condition</primary>
17979 </indexterm>
17980 See <emphasis role="bold">match_local_part</emphasis>.
17981 </para>
17982 </listitem></varlistentry>
17983 <varlistentry>
17984 <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>
17985 <listitem>
17986 <para>
17987 <indexterm role="concept">
17988 <primary><option>match_ip</option> expansion condition</primary>
17989 </indexterm>
17990 This condition matches an IP address to a list of IP address patterns. It must
17991 be followed by two argument strings. The first (after expansion) must be an IP
17992 address or an empty string. The second (not expanded) is a restricted host
17993 list that can match only an IP address, not a host name. For example:
17994 </para>
17995 <literallayout class="monospaced">
17996 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
17997 </literallayout>
17998 <para>
17999 The specific types of host list item that are permitted in the list are:
18000 </para>
18001 <itemizedlist>
18002 <listitem>
18003 <para>
18004 An IP address, optionally with a CIDR mask.
18005 </para>
18006 </listitem>
18007 <listitem>
18008 <para>
18009 A single asterisk, which matches any IP address.
18010 </para>
18011 </listitem>
18012 <listitem>
18013 <para>
18014 An empty item, which matches only if the IP address is empty. This could be
18015 useful for testing for a locally submitted message or one from specific hosts
18016 in a single test such as
18017 </para>
18018 <literallayout class="monospaced">
18019   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
18020 </literallayout>
18021 <para>
18022 where the first item in the list is the empty string.
18023 </para>
18024 </listitem>
18025 <listitem>
18026 <para>
18027 The item @[] matches any of the local host&#x2019;s interface addresses.
18028 </para>
18029 </listitem>
18030 <listitem>
18031 <para>
18032 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
18033 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
18034 address into a host name. The most common type of linear search for
18035 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
18036 masks. For example:
18037 </para>
18038 <literallayout class="monospaced">
18039   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
18040 </literallayout>
18041 <para>
18042 It is of course possible to use other kinds of lookup, and in such a case, you
18043 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
18044 address mask, for example:
18045 </para>
18046 <literallayout class="monospaced">
18047   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
18048 </literallayout>
18049 <para>
18050 However, unless you are combining a <option>match_ip</option> condition with others, it is
18051 just as easy to use the fact that a lookup is itself a condition, and write:
18052 </para>
18053 <literallayout class="monospaced">
18054   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
18055 </literallayout>
18056 </listitem>
18057 </itemizedlist>
18058 <para>
18059 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18060 Exim was built with the EXPAND_LISTMATCH_RHS option.
18061 </para>
18062 <para>
18063 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
18064 </para>
18065 </listitem></varlistentry>
18066 <varlistentry>
18067 <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>
18068 <listitem>
18069 <para>
18070 <indexterm role="concept">
18071 <primary>domain list</primary>
18072 <secondary>in expansion condition</secondary>
18073 </indexterm>
18074 <indexterm role="concept">
18075 <primary>address list</primary>
18076 <secondary>in expansion condition</secondary>
18077 </indexterm>
18078 <indexterm role="concept">
18079 <primary>local part</primary>
18080 <secondary>list, in expansion condition</secondary>
18081 </indexterm>
18082 <indexterm role="concept">
18083 <primary><option>match_local_part</option> expansion condition</primary>
18084 </indexterm>
18085 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
18086 possible to test domain, address, and local part lists within expansions. Each
18087 condition requires two arguments: an item and a list to match. A trivial
18088 example is:
18089 </para>
18090 <literallayout class="monospaced">
18091 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
18092 </literallayout>
18093 <para>
18094 In each case, the second argument may contain any of the allowable items for a
18095 list of the appropriate type. Also, because the second argument
18096 is a standard form of list, it is possible to refer to a named list.
18097 Thus, you can use conditions like this:
18098 </para>
18099 <literallayout class="monospaced">
18100 ${if match_domain{$domain}{+local_domains}{...
18101 </literallayout>
18102 <para>
18103 <indexterm role="concept">
18104 <primary><literal>+caseful</literal></primary>
18105 </indexterm>
18106 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
18107 item can be used, as in all address lists, to cause subsequent items to
18108 have their local parts matched casefully. Domains are always matched
18109 caselessly.
18110 </para>
18111 <para>
18112 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18113 Exim was built with the EXPAND_LISTMATCH_RHS option.
18114 </para>
18115 <para>
18116 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
18117 hosts have two identities: a name and an IP address, and it is not clear
18118 how to specify cleanly how such a test would work. However, IP addresses can be
18119 matched using <option>match_ip</option>.
18120 </para>
18121 </listitem></varlistentry>
18122 <varlistentry>
18123 <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>
18124 <listitem>
18125 <para>
18126 <indexterm role="concept">
18127 <primary>PAM authentication</primary>
18128 </indexterm>
18129 <indexterm role="concept">
18130 <primary>AUTH</primary>
18131 <secondary>with PAM</secondary>
18132 </indexterm>
18133 <indexterm role="concept">
18134 <primary>Solaris</primary>
18135 <secondary>PAM support</secondary>
18136 </indexterm>
18137 <indexterm role="concept">
18138 <primary>expansion</primary>
18139 <secondary>PAM authentication test</secondary>
18140 </indexterm>
18141 <indexterm role="concept">
18142 <primary><option>pam</option> expansion condition</primary>
18143 </indexterm>
18144 <emphasis>Pluggable Authentication Modules</emphasis>
18145 (<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
18146 available in the latest releases of Solaris and in some GNU/Linux
18147 distributions. The Exim support, which is intended for use in conjunction with
18148 the SMTP AUTH command, is available only if Exim is compiled with
18149 </para>
18150 <literallayout class="monospaced">
18151 SUPPORT_PAM=yes
18152 </literallayout>
18153 <para>
18154 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
18155 in some releases of GNU/Linux <option>-ldl</option> is also needed.
18156 </para>
18157 <para>
18158 The argument string is first expanded, and the result must be a
18159 colon-separated list of strings. Leading and trailing white space is ignored.
18160 The PAM module is initialized with the service name <quote>exim</quote> and the user name
18161 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
18162 The remaining items in the data string are passed over in response to requests
18163 from the authentication function. In the simple case there will only be one
18164 request, for a password, so the data consists of just two strings.
18165 </para>
18166 <para>
18167 There can be problems if any of the strings are permitted to contain colon
18168 characters. In the usual way, these have to be doubled to avoid being taken as
18169 separators.
18170 The <option>listquote</option> expansion item can be used for this.
18171 For example, the configuration
18172 of a LOGIN authenticator might contain this setting:
18173 </para>
18174 <literallayout class="monospaced">
18175 server_condition = ${if pam{$auth1:${listquote{:}{$auth2}}}}
18176 </literallayout>
18177 <para>
18178 In some operating systems, PAM authentication can be done only from a process
18179 running as root. Since Exim is running as the Exim user when receiving
18180 messages, this means that PAM cannot be used directly in those systems.
18181 </para>
18182 </listitem></varlistentry>
18183 <varlistentry>
18184 <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>
18185 <listitem>
18186 <para>
18187 <indexterm role="concept">
18188 <primary><emphasis>pwcheck</emphasis> daemon</primary>
18189 </indexterm>
18190 <indexterm role="concept">
18191 <primary>Cyrus</primary>
18192 </indexterm>
18193 <indexterm role="concept">
18194 <primary>expansion</primary>
18195 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
18196 </indexterm>
18197 <indexterm role="concept">
18198 <primary><option>pwcheck</option> expansion condition</primary>
18199 </indexterm>
18200 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
18201 This is one way of making it possible for passwords to be checked by a process
18202 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
18203 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
18204 </para>
18205 <para>
18206 The pwcheck support is not included in Exim by default. You need to specify
18207 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
18208 building Exim. For example:
18209 </para>
18210 <literallayout class="monospaced">
18211 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
18212 </literallayout>
18213 <para>
18214 You do not need to install the full Cyrus software suite in order to use
18215 the pwcheck daemon. You can compile and install just the daemon alone
18216 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
18217 access to the <filename>/var/pwcheck</filename> directory.
18218 </para>
18219 <para>
18220 The <option>pwcheck</option> condition takes one argument, which must be the user name and
18221 password, separated by a colon. For example, in a LOGIN authenticator
18222 configuration, you might have this:
18223 </para>
18224 <literallayout class="monospaced">
18225 server_condition = ${if pwcheck{$auth1:$auth2}}
18226 </literallayout>
18227 <para>
18228 Again, for a PLAIN authenticator configuration, this would be:
18229 </para>
18230 <literallayout class="monospaced">
18231 server_condition = ${if pwcheck{$auth2:$auth3}}
18232 </literallayout>
18233 </listitem></varlistentry>
18234 <varlistentry>
18235 <term><emphasis role="bold">queue_running</emphasis></term>
18236 <listitem>
18237 <para>
18238 <indexterm role="concept">
18239 <primary>queue runner</primary>
18240 <secondary>detecting when delivering from</secondary>
18241 </indexterm>
18242 <indexterm role="concept">
18243 <primary>expansion</primary>
18244 <secondary>queue runner test</secondary>
18245 </indexterm>
18246 <indexterm role="concept">
18247 <primary><option>queue_running</option> expansion condition</primary>
18248 </indexterm>
18249 This condition, which has no data, is true during delivery attempts that are
18250 initiated by queue runner processes, and false otherwise.
18251 </para>
18252 </listitem></varlistentry>
18253 <varlistentry>
18254 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18255 <listitem>
18256 <para>
18257 <indexterm role="concept">
18258 <primary>Radius</primary>
18259 </indexterm>
18260 <indexterm role="concept">
18261 <primary>expansion</primary>
18262 <secondary>Radius authentication</secondary>
18263 </indexterm>
18264 <indexterm role="concept">
18265 <primary><option>radius</option> expansion condition</primary>
18266 </indexterm>
18267 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
18268 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
18269 the Radius client configuration file in order to build Exim with Radius
18270 support.
18271 </para>
18272 <para>
18273 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
18274 library, using the original API. If you are using release 0.4.0 or later of
18275 this library, you need to set
18276 </para>
18277 <literallayout class="monospaced">
18278 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
18279 </literallayout>
18280 <para>
18281 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
18282 <option>libradius</option> library that comes with FreeBSD. To do this, set
18283 </para>
18284 <literallayout class="monospaced">
18285 RADIUS_LIB_TYPE=RADLIB
18286 </literallayout>
18287 <para>
18288 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
18289 You may also have to supply a suitable setting in EXTRALIBS so that the
18290 Radius library can be found when Exim is linked.
18291 </para>
18292 <para>
18293 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
18294 Radius client library, which calls the Radius server. The condition is true if
18295 the authentication is successful. For example:
18296 </para>
18297 <literallayout class="monospaced">
18298 server_condition = ${if radius{&lt;arguments&gt;}}
18299 </literallayout>
18300 </listitem></varlistentry>
18301 <varlistentry>
18302 <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>
18303 <listitem>
18304 <para>
18305 <indexterm role="concept">
18306 <primary><emphasis>saslauthd</emphasis> daemon</primary>
18307 </indexterm>
18308 <indexterm role="concept">
18309 <primary>Cyrus</primary>
18310 </indexterm>
18311 <indexterm role="concept">
18312 <primary>expansion</primary>
18313 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
18314 </indexterm>
18315 <indexterm role="concept">
18316 <primary><option>saslauthd</option> expansion condition</primary>
18317 </indexterm>
18318 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
18319 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
18320 Using this daemon is one way of making it possible for passwords to be checked
18321 by a process that is not running as root.
18322 </para>
18323 <para>
18324 The saslauthd support is not included in Exim by default. You need to specify
18325 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
18326 building Exim. For example:
18327 </para>
18328 <literallayout class="monospaced">
18329 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
18330 </literallayout>
18331 <para>
18332 You do not need to install the full Cyrus software suite in order to use
18333 the saslauthd daemon. You can compile and install just the daemon alone
18334 from the Cyrus SASL library.
18335 </para>
18336 <para>
18337 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
18338 two are mandatory. For example:
18339 </para>
18340 <literallayout class="monospaced">
18341 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
18342 </literallayout>
18343 <para>
18344 The service and the realm are optional (which is why the arguments are enclosed
18345 in their own set of braces). For details of the meaning of the service and
18346 realm, and how to run the daemon, consult the Cyrus documentation.
18347 </para>
18348 </listitem></varlistentry>
18349 </variablelist>
18350 </section>
18351 <section id="SECID84">
18352 <title>Combining expansion conditions</title>
18353 <para>
18354 <indexterm role="concept">
18355 <primary>expansion</primary>
18356 <secondary>combining conditions</secondary>
18357 </indexterm>
18358 Several conditions can be tested at once by combining them using the <option>and</option>
18359 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
18360 conditions on their own, and precede their lists of sub-conditions. Each
18361 sub-condition must be enclosed in braces within the overall braces that contain
18362 the list. No repetition of <option>if</option> is used.
18363 </para>
18364 <variablelist>
18365 <varlistentry>
18366 <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>
18367 <listitem>
18368 <para>
18369 <indexterm role="concept">
18370 <primary><quote>or</quote> expansion condition</primary>
18371 </indexterm>
18372 <indexterm role="concept">
18373 <primary>expansion</primary>
18374 <secondary><quote>or</quote> of conditions</secondary>
18375 </indexterm>
18376 The sub-conditions are evaluated from left to right. The condition is true if
18377 any one of the sub-conditions is true.
18378 For example,
18379 </para>
18380 <literallayout class="monospaced">
18381 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
18382 </literallayout>
18383 <para>
18384 When a true sub-condition is found, the following ones are parsed but not
18385 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
18386 numeric variables afterwards are taken from the first one that succeeds.
18387 </para>
18388 </listitem></varlistentry>
18389 <varlistentry>
18390 <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>
18391 <listitem>
18392 <para>
18393 <indexterm role="concept">
18394 <primary><quote>and</quote> expansion condition</primary>
18395 </indexterm>
18396 <indexterm role="concept">
18397 <primary>expansion</primary>
18398 <secondary><quote>and</quote> of conditions</secondary>
18399 </indexterm>
18400 The sub-conditions are evaluated from left to right. The condition is true if
18401 all of the sub-conditions are true. If there are several <quote>match</quote>
18402 sub-conditions, the values of the numeric variables afterwards are taken from
18403 the last one. When a false sub-condition is found, the following ones are
18404 parsed but not evaluated.
18405 </para>
18406 </listitem></varlistentry>
18407 </variablelist>
18408 <para>
18409 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
18410 </para>
18411 </section>
18412 <section id="SECTexpvar">
18413 <title>Expansion variables</title>
18414 <para>
18415 <indexterm role="concept">
18416 <primary>expansion</primary>
18417 <secondary>variables, list of</secondary>
18418 </indexterm>
18419 This section contains an alphabetical list of all the expansion variables. Some
18420 of them are available only when Exim is compiled with specific options such as
18421 support for TLS or the content scanning extension.
18422 </para>
18423 <variablelist>
18424 <varlistentry>
18425 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
18426 <listitem>
18427 <para>
18428 <indexterm role="concept">
18429 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
18430 </indexterm>
18431 When a <option>match</option> expansion condition succeeds, these variables contain the
18432 captured substrings identified by the regular expression during subsequent
18433 processing of the success string of the containing <option>if</option> expansion item.
18434 In the expansion condition case
18435 they do not retain their values afterwards; in fact, their previous
18436 values are restored at the end of processing an <option>if</option> item. The numerical
18437 variables may also be set externally by some other matching process which
18438 precedes the expansion of the string. For example, the commands available in
18439 Exim filter files include an <option>if</option> command with its own regular expression
18440 matching condition.
18441 </para>
18442 </listitem></varlistentry>
18443 <varlistentry>
18444 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
18445 <listitem>
18446 <para>
18447 Within an acl condition, expansion condition or expansion item
18448 any arguments are copied to these variables,
18449 any unused variables being made empty.
18450 </para>
18451 </listitem></varlistentry>
18452 <varlistentry>
18453 <term><varname>$acl_c...</varname></term>
18454 <listitem>
18455 <para>
18456 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
18457 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
18458 long, but the sixth character must be either a digit or an underscore. For
18459 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
18460 variables persist throughout the lifetime of an SMTP connection. They can be
18461 used to pass information between ACLs and between different invocations of the
18462 same ACL. When a message is received, the values of these variables are saved
18463 with the message, and can be accessed by filters, routers, and transports
18464 during subsequent delivery.
18465 </para>
18466 </listitem></varlistentry>
18467 <varlistentry>
18468 <term><varname>$acl_m...</varname></term>
18469 <listitem>
18470 <para>
18471 These variables are like the <varname>$acl_c...</varname> variables, except that their values
18472 are reset after a message has been received. Thus, if several messages are
18473 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
18474 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
18475 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
18476 message is received, the values of these variables are saved with the message,
18477 and can be accessed by filters, routers, and transports during subsequent
18478 delivery.
18479 </para>
18480 </listitem></varlistentry>
18481 <varlistentry>
18482 <term><varname>$acl_narg</varname></term>
18483 <listitem>
18484 <para>
18485 Within an acl condition, expansion condition or expansion item
18486 this variable has the number of arguments.
18487 </para>
18488 </listitem></varlistentry>
18489 <varlistentry>
18490 <term><varname>$acl_verify_message</varname></term>
18491 <listitem>
18492 <para>
18493 <indexterm role="variable">
18494 <primary><varname>$acl_verify_message</varname></primary>
18495 </indexterm>
18496 After an address verification has failed, this variable contains the failure
18497 message. It retains its value for use in subsequent modifiers. The message can
18498 be preserved by coding like this:
18499 </para>
18500 <literallayout class="monospaced">
18501 warn !verify = sender
18502      set acl_m0 = $acl_verify_message
18503 </literallayout>
18504 <para>
18505 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
18506 <option>log_message</option> modifiers, to include information about the verification
18507 failure.
18508 </para>
18509 </listitem></varlistentry>
18510 <varlistentry>
18511 <term><varname>$address_data</varname></term>
18512 <listitem>
18513 <para>
18514 <indexterm role="variable">
18515 <primary><varname>$address_data</varname></primary>
18516 </indexterm>
18517 This variable is set by means of the <option>address_data</option> option in routers. The
18518 value then remains with the address while it is processed by subsequent routers
18519 and eventually a transport. If the transport is handling multiple addresses,
18520 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
18521 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
18522 user filter files.
18523 </para>
18524 <para>
18525 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
18526 a recipient address, the final value is still in the variable for subsequent
18527 conditions and modifiers of the ACL statement. If routing the address caused it
18528 to be redirected to just one address, the child address is also routed as part
18529 of the verification, and in this case the final value of <varname>$address_data</varname> is
18530 from the child&#x2019;s routing.
18531 </para>
18532 <para>
18533 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
18534 sender address, the final value is also preserved, but this time in
18535 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
18536 address.
18537 </para>
18538 <para>
18539 In both cases (recipient and sender verification), the value does not persist
18540 after the end of the current ACL statement. If you want to preserve
18541 these values for longer, you can save them in ACL variables.
18542 </para>
18543 </listitem></varlistentry>
18544 <varlistentry>
18545 <term><varname>$address_file</varname></term>
18546 <listitem>
18547 <para>
18548 <indexterm role="variable">
18549 <primary><varname>$address_file</varname></primary>
18550 </indexterm>
18551 When, as a result of aliasing, forwarding, or filtering, a message is directed
18552 to a specific file, this variable holds the name of the file when the transport
18553 is running. At other times, the variable is empty. For example, using the
18554 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
18555 </para>
18556 <literallayout class="monospaced">
18557 /home/r2d2/savemail
18558 </literallayout>
18559 <para>
18560 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
18561 contains the text string <literal>/home/r2d2/savemail</literal>.
18562 <indexterm role="concept">
18563 <primary>Sieve filter</primary>
18564 <secondary>value of <varname>$address_file</varname></secondary>
18565 </indexterm>
18566 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
18567 then up to the transport configuration to generate an appropriate absolute path
18568 to the relevant file.
18569 </para>
18570 </listitem></varlistentry>
18571 <varlistentry>
18572 <term><varname>$address_pipe</varname></term>
18573 <listitem>
18574 <para>
18575 <indexterm role="variable">
18576 <primary><varname>$address_pipe</varname></primary>
18577 </indexterm>
18578 When, as a result of aliasing or forwarding, a message is directed to a pipe,
18579 this variable holds the pipe command when the transport is running.
18580 </para>
18581 </listitem></varlistentry>
18582 <varlistentry>
18583 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
18584 <listitem>
18585 <para>
18586 <indexterm role="variable">
18587 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
18588 </indexterm>
18589 These variables are used in SMTP authenticators (see chapters
18590 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
18591 </para>
18592 </listitem></varlistentry>
18593 <varlistentry>
18594 <term><varname>$authenticated_id</varname></term>
18595 <listitem>
18596 <para>
18597 <indexterm role="concept">
18598 <primary>authentication</primary>
18599 <secondary>id</secondary>
18600 </indexterm>
18601 <indexterm role="variable">
18602 <primary><varname>$authenticated_id</varname></primary>
18603 </indexterm>
18604 When a server successfully authenticates a client it may be configured to
18605 preserve some of the authentication information in the variable
18606 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
18607 user/password authenticator configuration might preserve the user name for use
18608 in the routers. Note that this is not the same information that is saved in
18609 <varname>$sender_host_authenticated</varname>.
18610 </para>
18611 <para>
18612 When a message is submitted locally (that is, not over a TCP connection)
18613 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
18614 process. However, a trusted user can override this by means of the <option>-oMai</option>
18615 command line option.
18616 This second case also sets up information used by the
18617 <varname>$authresults</varname> expansion item.
18618 </para>
18619 </listitem></varlistentry>
18620 <varlistentry>
18621 <term><varname>$authenticated_fail_id</varname></term>
18622 <listitem>
18623 <para>
18624 <indexterm role="concept">
18625 <primary>authentication</primary>
18626 <secondary>fail</secondary>
18627 </indexterm>
18628 <indexterm role="variable">
18629 <primary><varname>$authenticated_fail_id</varname></primary>
18630 </indexterm>
18631 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
18632 will contain the failed authentication id. If more than one authentication
18633 id is attempted, it will contain only the last one. The variable is
18634 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
18635 A message to a local recipient could still be accepted without requiring
18636 authentication, which means this variable could also be visible in all of
18637 the ACL&#x2019;s as well.
18638 </para>
18639 </listitem></varlistentry>
18640 <varlistentry>
18641 <term><varname>$authenticated_sender</varname></term>
18642 <listitem>
18643 <para>
18644 <indexterm role="concept">
18645 <primary>sender</primary>
18646 <secondary>authenticated</secondary>
18647 </indexterm>
18648 <indexterm role="concept">
18649 <primary>authentication</primary>
18650 <secondary>sender</secondary>
18651 </indexterm>
18652 <indexterm role="concept">
18653 <primary>AUTH</primary>
18654 <secondary>on MAIL command</secondary>
18655 </indexterm>
18656 <indexterm role="variable">
18657 <primary><varname>$authenticated_sender</varname></primary>
18658 </indexterm>
18659 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
18660 SMTP MAIL command if it believes the sender is sufficiently trusted, as
18661 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
18662 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
18663 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
18664 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
18665 </para>
18666 <para>
18667 <indexterm role="variable">
18668 <primary><varname>$qualify_domain</varname></primary>
18669 </indexterm>
18670 When a message is submitted locally (that is, not over a TCP connection), the
18671 value of <varname>$authenticated_sender</varname> is an address constructed from the login
18672 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
18673 can override this by means of the <option>-oMas</option> command line option.
18674 </para>
18675 </listitem></varlistentry>
18676 <varlistentry>
18677 <term><varname>$authentication_failed</varname></term>
18678 <listitem>
18679 <para>
18680 <indexterm role="concept">
18681 <primary>authentication</primary>
18682 <secondary>failure</secondary>
18683 </indexterm>
18684 <indexterm role="variable">
18685 <primary><varname>$authentication_failed</varname></primary>
18686 </indexterm>
18687 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
18688 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
18689 possible to distinguish between <quote>did not try to authenticate</quote>
18690 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
18691 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
18692 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
18693 negative response to an AUTH command, including (for example) an attempt to use
18694 an undefined mechanism.
18695 </para>
18696 </listitem></varlistentry>
18697 <varlistentry>
18698 <term><varname>$av_failed</varname></term>
18699 <listitem>
18700 <para>
18701 <indexterm role="concept">
18702 <primary>content scanning</primary>
18703 <secondary>AV scanner failure</secondary>
18704 </indexterm>
18705 This variable is available when Exim is compiled with the content-scanning
18706 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
18707 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
18708 the ACL malware condition.
18709 </para>
18710 </listitem></varlistentry>
18711 <varlistentry>
18712 <term><varname>$body_linecount</varname></term>
18713 <listitem>
18714 <para>
18715 <indexterm role="concept">
18716 <primary>message body</primary>
18717 <secondary>line count</secondary>
18718 </indexterm>
18719 <indexterm role="concept">
18720 <primary>body of message</primary>
18721 <secondary>line count</secondary>
18722 </indexterm>
18723 <indexterm role="variable">
18724 <primary><varname>$body_linecount</varname></primary>
18725 </indexterm>
18726 When a message is being received or delivered, this variable contains the
18727 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
18728 </para>
18729 </listitem></varlistentry>
18730 <varlistentry>
18731 <term><varname>$body_zerocount</varname></term>
18732 <listitem>
18733 <para>
18734 <indexterm role="concept">
18735 <primary>message body</primary>
18736 <secondary>binary zero count</secondary>
18737 </indexterm>
18738 <indexterm role="concept">
18739 <primary>body of message</primary>
18740 <secondary>binary zero count</secondary>
18741 </indexterm>
18742 <indexterm role="concept">
18743 <primary>binary zero</primary>
18744 <secondary>in message body</secondary>
18745 </indexterm>
18746 <indexterm role="variable">
18747 <primary><varname>$body_zerocount</varname></primary>
18748 </indexterm>
18749 When a message is being received or delivered, this variable contains the
18750 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
18751 </para>
18752 </listitem></varlistentry>
18753 <varlistentry>
18754 <term><varname>$bounce_recipient</varname></term>
18755 <listitem>
18756 <para>
18757 <indexterm role="variable">
18758 <primary><varname>$bounce_recipient</varname></primary>
18759 </indexterm>
18760 This is set to the recipient address of a bounce message while Exim is creating
18761 it. It is useful if a customized bounce message text file is in use (see
18762 chapter <xref linkend="CHAPemsgcust"/>).
18763 </para>
18764 </listitem></varlistentry>
18765 <varlistentry>
18766 <term><varname>$bounce_return_size_limit</varname></term>
18767 <listitem>
18768 <para>
18769 <indexterm role="variable">
18770 <primary><varname>$bounce_return_size_limit</varname></primary>
18771 </indexterm>
18772 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
18773 up to a multiple of 1000. It is useful when a customized error message text
18774 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
18775 </para>
18776 </listitem></varlistentry>
18777 <varlistentry>
18778 <term><varname>$caller_gid</varname></term>
18779 <listitem>
18780 <para>
18781 <indexterm role="concept">
18782 <primary>gid (group id)</primary>
18783 <secondary>caller</secondary>
18784 </indexterm>
18785 <indexterm role="variable">
18786 <primary><varname>$caller_gid</varname></primary>
18787 </indexterm>
18788 The real group id under which the process that called Exim was running. This is
18789 not the same as the group id of the originator of a message (see
18790 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
18791 incarnation normally contains the Exim gid.
18792 </para>
18793 </listitem></varlistentry>
18794 <varlistentry>
18795 <term><varname>$caller_uid</varname></term>
18796 <listitem>
18797 <para>
18798 <indexterm role="concept">
18799 <primary>uid (user id)</primary>
18800 <secondary>caller</secondary>
18801 </indexterm>
18802 <indexterm role="variable">
18803 <primary><varname>$caller_uid</varname></primary>
18804 </indexterm>
18805 The real user id under which the process that called Exim was running. This is
18806 not the same as the user id of the originator of a message (see
18807 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
18808 incarnation normally contains the Exim uid.
18809 </para>
18810 </listitem></varlistentry>
18811 <varlistentry>
18812 <term><varname>$callout_address</varname></term>
18813 <listitem>
18814 <para>
18815 <indexterm role="variable">
18816 <primary><varname>$callout_address</varname></primary>
18817 </indexterm>
18818 After a callout for verification, spamd or malware daemon service, the
18819 address that was connected to.
18820 </para>
18821 </listitem></varlistentry>
18822 <varlistentry>
18823 <term><varname>$compile_number</varname></term>
18824 <listitem>
18825 <para>
18826 <indexterm role="variable">
18827 <primary><varname>$compile_number</varname></primary>
18828 </indexterm>
18829 The building process for Exim keeps a count of the number
18830 of times it has been compiled. This serves to distinguish different
18831 compilations of the same version of Exim.
18832 </para>
18833 </listitem></varlistentry>
18834 <varlistentry>
18835 <term><varname>$config_dir</varname></term>
18836 <listitem>
18837 <para>
18838 <indexterm role="variable">
18839 <primary><varname>$config_dir</varname></primary>
18840 </indexterm>
18841 The directory name of the main configuration file. That is, the content of
18842 <varname>$config_file</varname> with the last component stripped. The value does not
18843 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
18844 <varname>$config_dir</varname> is ".".
18845 </para>
18846 </listitem></varlistentry>
18847 <varlistentry>
18848 <term><varname>$config_file</varname></term>
18849 <listitem>
18850 <para>
18851 <indexterm role="variable">
18852 <primary><varname>$config_file</varname></primary>
18853 </indexterm>
18854 The name of the main configuration file Exim is using.
18855 </para>
18856 </listitem></varlistentry>
18857 <varlistentry>
18858 <term><varname>$dkim_verify_status</varname></term>
18859 <listitem>
18860 <para>
18861 Results of DKIM verification.
18862 For details see section <xref linkend="SECDKIMVFY"/>.
18863 </para>
18864 </listitem></varlistentry>
18865 <varlistentry>
18866 <term><varname>$dkim_cur_signer</varname></term>
18867 <term><varname>$dkim_verify_reason</varname></term>
18868 <term><varname>$dkim_domain</varname></term>
18869 <term><varname>$dkim_identity</varname></term>
18870 <term><varname>$dkim_selector</varname></term>
18871 <term><varname>$dkim_algo</varname></term>
18872 <term><varname>$dkim_canon_body</varname></term>
18873 <term><varname>$dkim_canon_headers</varname></term>
18874 <term><varname>$dkim_copiedheaders</varname></term>
18875 <term><varname>$dkim_bodylength</varname></term>
18876 <term><varname>$dkim_created</varname></term>
18877 <term><varname>$dkim_expires</varname></term>
18878 <term><varname>$dkim_headernames</varname></term>
18879 <term><varname>$dkim_key_testing</varname></term>
18880 <term><varname>$dkim_key_nosubdomains</varname></term>
18881 <term><varname>$dkim_key_srvtype</varname></term>
18882 <term><varname>$dkim_key_granularity</varname></term>
18883 <term><varname>$dkim_key_notes</varname></term>
18884 <term><varname>$dkim_key_length</varname></term>
18885 <listitem>
18886 <para>
18887 These variables are only available within the DKIM ACL.
18888 For details see section <xref linkend="SECDKIMVFY"/>.
18889 </para>
18890 </listitem></varlistentry>
18891 <varlistentry>
18892 <term><varname>$dkim_signers</varname></term>
18893 <listitem>
18894 <para>
18895 <indexterm role="variable">
18896 <primary><varname>$dkim_signers</varname></primary>
18897 </indexterm>
18898 When a message has been received this variable contains
18899 a colon-separated list of signer domains and identities for the message.
18900 For details see section <xref linkend="SECDKIMVFY"/>.
18901 </para>
18902 </listitem></varlistentry>
18903 <varlistentry>
18904 <term><varname>$dmarc_domain_policy</varname></term>
18905 <term><varname>$dmarc_status</varname></term>
18906 <term><varname>$dmarc_status_text</varname></term>
18907 <term><varname>$dmarc_used_domains</varname></term>
18908 <listitem>
18909 <para>
18910 Results of DMARC verification.
18911 For details see section <xref linkend="SECDMARC"/>.
18912 </para>
18913 </listitem></varlistentry>
18914 <varlistentry>
18915 <term><varname>$dnslist_domain</varname></term>
18916 <term><varname>$dnslist_matched</varname></term>
18917 <term><varname>$dnslist_text</varname></term>
18918 <term><varname>$dnslist_value</varname></term>
18919 <listitem>
18920 <para>
18921 <indexterm role="variable">
18922 <primary><varname>$dnslist_domain</varname></primary>
18923 </indexterm>
18924 <indexterm role="variable">
18925 <primary><varname>$dnslist_matched</varname></primary>
18926 </indexterm>
18927 <indexterm role="variable">
18928 <primary><varname>$dnslist_text</varname></primary>
18929 </indexterm>
18930 <indexterm role="variable">
18931 <primary><varname>$dnslist_value</varname></primary>
18932 </indexterm>
18933 <indexterm role="concept">
18934 <primary>black list (DNS)</primary>
18935 </indexterm>
18936 When a DNS (black) list lookup succeeds, these variables are set to contain
18937 the following data from the lookup: the list&#x2019;s domain name, the key that was
18938 looked up, the contents of any associated TXT record, and the value from the
18939 main A record. See section <xref linkend="SECID204"/> for more details.
18940 </para>
18941 </listitem></varlistentry>
18942 <varlistentry>
18943 <term><varname>$domain</varname></term>
18944 <listitem>
18945 <para>
18946 <indexterm role="variable">
18947 <primary><varname>$domain</varname></primary>
18948 </indexterm>
18949 When an address is being routed, or delivered on its own, this variable
18950 contains the domain. Uppercase letters in the domain are converted into lower
18951 case for <varname>$domain</varname>.
18952 </para>
18953 <para>
18954 Global address rewriting happens when a message is received, so the value of
18955 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
18956 is set during user filtering, but not during system filtering, because a
18957 message may have many recipients and the system filter is called just once.
18958 </para>
18959 <para>
18960 When more than one address is being delivered at once (for example, several
18961 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
18962 have the same domain. Transports can be restricted to handling only one domain
18963 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
18964 the default for local transports. For further details of the environment in
18965 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
18966 </para>
18967 <para>
18968 <indexterm role="option">
18969 <primary><option>delay_warning_condition</option></primary>
18970 </indexterm>
18971 At the end of a delivery, if all deferred addresses have the same domain, it is
18972 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
18973 </para>
18974 <para>
18975 The <varname>$domain</varname> variable is also used in some other circumstances:
18976 </para>
18977 <itemizedlist>
18978 <listitem>
18979 <para>
18980 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
18981 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
18982 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
18983 normally set during the running of the MAIL ACL. However, if the sender address
18984 is verified with a callout during the MAIL ACL, the sender domain is placed in
18985 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
18986 the <command>smtp</command> transport.
18987 </para>
18988 </listitem>
18989 <listitem>
18990 <para>
18991 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
18992 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
18993 it can be used in the expansion of the replacement address, for example, to
18994 rewrite domains by file lookup.
18995 </para>
18996 </listitem>
18997 <listitem>
18998 <para>
18999 With one important exception, whenever a domain list is being scanned,
19000 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
19001 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
19002 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
19003 that, in a RCPT ACL, the sender domain list can be dependent on the
19004 recipient domain (which is what is in <varname>$domain</varname> at this time).
19005 </para>
19006 </listitem>
19007 <listitem>
19008 <para>
19009 <indexterm role="concept">
19010 <primary>ETRN</primary>
19011 <secondary>value of <varname>$domain</varname></secondary>
19012 </indexterm>
19013 <indexterm role="option">
19014 <primary><option>smtp_etrn_command</option></primary>
19015 </indexterm>
19016 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
19017 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
19018 </para>
19019 </listitem>
19020 </itemizedlist>
19021 <para revisionflag="changed">
19022 <indexterm role="concept">
19023 <primary>tainted data</primary>
19024 </indexterm>
19025 If the origin of the data is an incoming message,
19026 the result of expanding this variable is tainted.
19027 When un untainted version is needed, one should be obtained from
19028 looking up the value in a local (therefore trusted) database.
19029 Often <varname>$domain_data</varname> is usable in this role.
19030 </para>
19031 </listitem></varlistentry>
19032 <varlistentry>
19033 <term><varname>$domain_data</varname></term>
19034 <listitem>
19035 <para>
19036 <indexterm role="variable">
19037 <primary><varname>$domain_data</varname></primary>
19038 </indexterm>
19039 When the <option>domains</option> condition on a router
19040 </para>
19041 <para revisionflag="changed">
19042 or an ACL
19043 matches a domain
19044 against a list, the match value is copied to <varname>$domain_data</varname>.
19045 This is an enhancement over previous versions of Exim, when it only
19046 applied to the data read by a lookup.
19047 For details on match values see section <xref linkend="SECTlistresults"/> et. al.
19048 </para>
19049 <para>
19050 If the router routes the
19051 address to a transport, the value is available in that transport. If the
19052 transport is handling multiple addresses, the value from the first address is
19053 used.
19054 </para>
19055 <para>
19056 <varname>$domain_data</varname> set in an ACL is available during
19057 the rest of the ACL statement.
19058 </para>
19059 </listitem></varlistentry>
19060 <varlistentry>
19061 <term><varname>$exim_gid</varname></term>
19062 <listitem>
19063 <para>
19064 <indexterm role="variable">
19065 <primary><varname>$exim_gid</varname></primary>
19066 </indexterm>
19067 This variable contains the numerical value of the Exim group id.
19068 </para>
19069 </listitem></varlistentry>
19070 <varlistentry>
19071 <term><varname>$exim_path</varname></term>
19072 <listitem>
19073 <para>
19074 <indexterm role="variable">
19075 <primary><varname>$exim_path</varname></primary>
19076 </indexterm>
19077 This variable contains the path to the Exim binary.
19078 </para>
19079 </listitem></varlistentry>
19080 <varlistentry>
19081 <term><varname>$exim_uid</varname></term>
19082 <listitem>
19083 <para>
19084 <indexterm role="variable">
19085 <primary><varname>$exim_uid</varname></primary>
19086 </indexterm>
19087 This variable contains the numerical value of the Exim user id.
19088 </para>
19089 </listitem></varlistentry>
19090 <varlistentry>
19091 <term><varname>$exim_version</varname></term>
19092 <listitem>
19093 <para>
19094 <indexterm role="variable">
19095 <primary><varname>$exim_version</varname></primary>
19096 </indexterm>
19097 This variable contains the version string of the Exim build.
19098 The first character is a major version number, currently 4.
19099 Then after a dot, the next group of digits is a minor version number.
19100 There may be other characters following the minor version.
19101 This value may be overridden by the <option>exim_version</option> main config option.
19102 </para>
19103 </listitem></varlistentry>
19104 <varlistentry>
19105 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
19106 <listitem>
19107 <para>
19108 This is not strictly an expansion variable. It is expansion syntax for
19109 inserting the message header line with the given name. Note that the name must
19110 be terminated by colon or white space, because it may contain a wide variety of
19111 characters. Note also that braces must <emphasis>not</emphasis> be used.
19112 See the full description in section <xref linkend="SECTexpansionitems"/> above.
19113 </para>
19114 </listitem></varlistentry>
19115 <varlistentry>
19116 <term><varname>$headers_added</varname></term>
19117 <listitem>
19118 <para>
19119 <indexterm role="variable">
19120 <primary><varname>$headers_added</varname></primary>
19121 </indexterm>
19122 Within an ACL this variable contains the headers added so far by
19123 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
19124 The headers are a newline-separated list.
19125 </para>
19126 </listitem></varlistentry>
19127 <varlistentry>
19128 <term><varname>$home</varname></term>
19129 <listitem>
19130 <para>
19131 <indexterm role="variable">
19132 <primary><varname>$home</varname></primary>
19133 </indexterm>
19134 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
19135 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
19136 means it is set during the running of users&#x2019; filter files. A router may also
19137 explicitly set a home directory for use by a transport; this can be overridden
19138 by a setting on the transport itself.
19139 </para>
19140 <para>
19141 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
19142 of the environment variable HOME, which is subject to the
19143 <option>keep_environment</option> and <option>add_environment</option> main config options.
19144 </para>
19145 </listitem></varlistentry>
19146 <varlistentry>
19147 <term><varname>$host</varname></term>
19148 <listitem>
19149 <para>
19150 <indexterm role="variable">
19151 <primary><varname>$host</varname></primary>
19152 </indexterm>
19153 If a router assigns an address to a transport (any transport), and passes a
19154 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
19155 to run is the name of the first host on the list. Note that this applies both
19156 to local and remote transports.
19157 </para>
19158 <para>
19159 <indexterm role="concept">
19160 <primary>transport</primary>
19161 <secondary>filter</secondary>
19162 </indexterm>
19163 <indexterm role="concept">
19164 <primary>filter</primary>
19165 <secondary>transport filter</secondary>
19166 </indexterm>
19167 For the <command>smtp</command> transport, if there is more than one host, the value of
19168 <varname>$host</varname> changes as the transport works its way through the list. In
19169 particular, when the <command>smtp</command> transport is expanding its options for encryption
19170 using TLS, or for specifying a transport filter (see chapter
19171 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
19172 is connected.
19173 </para>
19174 <para>
19175 When used in the client part of an authenticator configuration (see chapter
19176 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
19177 client is connected.
19178 </para>
19179 </listitem></varlistentry>
19180 <varlistentry>
19181 <term><varname>$host_address</varname></term>
19182 <listitem>
19183 <para>
19184 <indexterm role="variable">
19185 <primary><varname>$host_address</varname></primary>
19186 </indexterm>
19187 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
19188 for a remote connection. It is also set to the IP address that is being checked
19189 when the <option>ignore_target_hosts</option> option is being processed.
19190 </para>
19191 </listitem></varlistentry>
19192 <varlistentry>
19193 <term><varname>$host_data</varname></term>
19194 <listitem>
19195 <para>
19196 <indexterm role="variable">
19197 <primary><varname>$host_data</varname></primary>
19198 </indexterm>
19199 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
19200 result of the lookup is made available in the <varname>$host_data</varname> variable. This
19201 allows you, for example, to do things like this:
19202 </para>
19203 <literallayout class="monospaced">
19204 deny  hosts = net-lsearch;/some/file
19205       message = $host_data
19206 </literallayout>
19207 </listitem></varlistentry>
19208 <varlistentry>
19209 <term><varname>$host_lookup_deferred</varname></term>
19210 <listitem>
19211 <para>
19212 <indexterm role="concept">
19213 <primary>host name</primary>
19214 <secondary>lookup, failure of</secondary>
19215 </indexterm>
19216 <indexterm role="variable">
19217 <primary><varname>$host_lookup_deferred</varname></primary>
19218 </indexterm>
19219 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
19220 message comes from a remote host and there is an attempt to look up the host&#x2019;s
19221 name from its IP address, and the attempt is not successful, one of these
19222 variables is set to <quote>1</quote>.
19223 </para>
19224 <itemizedlist>
19225 <listitem>
19226 <para>
19227 If the lookup receives a definite negative response (for example, a DNS lookup
19228 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19229 </para>
19230 </listitem>
19231 <listitem>
19232 <para>
19233 If there is any kind of problem during the lookup, such that Exim cannot
19234 tell whether or not the host name is defined (for example, a timeout for a DNS
19235 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
19236 </para>
19237 </listitem>
19238 </itemizedlist>
19239 <para>
19240 Looking up a host&#x2019;s name from its IP address consists of more than just a
19241 single reverse lookup. Exim checks that a forward lookup of at least one of the
19242 names it receives from a reverse lookup yields the original IP address. If this
19243 is not the case, Exim does not accept the looked up name(s), and
19244 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
19245 IP address (for example, the existence of a PTR record in the DNS) is not
19246 sufficient on its own for the success of a host name lookup. If the reverse
19247 lookup succeeds, but there is a lookup problem such as a timeout when checking
19248 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
19249 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
19250 </para>
19251 <para>
19252 <indexterm role="concept">
19253 <primary>authentication</primary>
19254 <secondary>expansion item</secondary>
19255 </indexterm>
19256 Performing these checks sets up information used by the
19257 <option>authresults</option> expansion item.
19258 </para>
19259 </listitem></varlistentry>
19260 <varlistentry>
19261 <term><varname>$host_lookup_failed</varname></term>
19262 <listitem>
19263 <para>
19264 <indexterm role="variable">
19265 <primary><varname>$host_lookup_failed</varname></primary>
19266 </indexterm>
19267 See <varname>$host_lookup_deferred</varname>.
19268 </para>
19269 </listitem></varlistentry>
19270 <varlistentry>
19271 <term><varname>$host_port</varname></term>
19272 <listitem>
19273 <para>
19274 <indexterm role="variable">
19275 <primary><varname>$host_port</varname></primary>
19276 </indexterm>
19277 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
19278 for an outbound connection.
19279 </para>
19280 </listitem></varlistentry>
19281 <varlistentry>
19282 <term><varname>$initial_cwd</varname></term>
19283 <listitem>
19284 <para>
19285 <indexterm role="variable">
19286 <primary><varname>$initial_cwd</varname></primary>
19287 </indexterm>
19288 This variable contains the full path name of the initial working
19289 directory of the current Exim process. This may differ from the current
19290 working directory, as Exim changes this to "/" during early startup, and
19291 to <varname>$spool_directory</varname> later.
19292 </para>
19293 </listitem></varlistentry>
19294 <varlistentry>
19295 <term><varname>$inode</varname></term>
19296 <listitem>
19297 <para>
19298 <indexterm role="variable">
19299 <primary><varname>$inode</varname></primary>
19300 </indexterm>
19301 The only time this variable is set is while expanding the <option>directory_file</option>
19302 option in the <command>appendfile</command> transport. The variable contains the inode number
19303 of the temporary file which is about to be renamed. It can be used to construct
19304 a unique name for the file.
19305 </para>
19306 </listitem></varlistentry>
19307 <varlistentry>
19308 <term><varname>$interface_address</varname></term>
19309 <listitem>
19310 <para>
19311 <indexterm role="variable">
19312 <primary><varname>$interface_address</varname></primary>
19313 </indexterm>
19314 This is an obsolete name for <varname>$received_ip_address</varname>.
19315 </para>
19316 </listitem></varlistentry>
19317 <varlistentry>
19318 <term><varname>$interface_port</varname></term>
19319 <listitem>
19320 <para>
19321 <indexterm role="variable">
19322 <primary><varname>$interface_port</varname></primary>
19323 </indexterm>
19324 This is an obsolete name for <varname>$received_port</varname>.
19325 </para>
19326 </listitem></varlistentry>
19327 <varlistentry>
19328 <term><varname>$item</varname></term>
19329 <listitem>
19330 <para>
19331 <indexterm role="variable">
19332 <primary><varname>$item</varname></primary>
19333 </indexterm>
19334 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
19335 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
19336 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
19337 empty.
19338 </para>
19339 </listitem></varlistentry>
19340 <varlistentry>
19341 <term><varname>$ldap_dn</varname></term>
19342 <listitem>
19343 <para>
19344 <indexterm role="variable">
19345 <primary><varname>$ldap_dn</varname></primary>
19346 </indexterm>
19347 This variable, which is available only when Exim is compiled with LDAP support,
19348 contains the DN from the last entry in the most recently successful LDAP
19349 lookup.
19350 </para>
19351 </listitem></varlistentry>
19352 <varlistentry>
19353 <term><varname>$load_average</varname></term>
19354 <listitem>
19355 <para>
19356 <indexterm role="variable">
19357 <primary><varname>$load_average</varname></primary>
19358 </indexterm>
19359 This variable contains the system load average, multiplied by 1000 so that it
19360 is an integer. For example, if the load average is 0.21, the value of the
19361 variable is 210. The value is recomputed every time the variable is referenced.
19362 </para>
19363 </listitem></varlistentry>
19364 <varlistentry>
19365 <term><varname>$local_part</varname></term>
19366 <listitem>
19367 <para>
19368 <indexterm role="variable">
19369 <primary><varname>$local_part</varname></primary>
19370 </indexterm>
19371 When an address is being routed, or delivered on its own, this
19372 variable contains the local part. When a number of addresses are being
19373 delivered together (for example, multiple RCPT commands in an SMTP
19374 session), <varname>$local_part</varname> is not set.
19375 </para>
19376 <para>
19377 Global address rewriting happens when a message is received, so the value of
19378 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
19379 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
19380 because a message may have many recipients and the system filter is called just
19381 once.
19382 </para>
19383 <para revisionflag="changed">
19384 <indexterm role="concept">
19385 <primary>tainted data</primary>
19386 </indexterm>
19387 If the origin of the data is an incoming message,
19388 the result of expanding this variable is tainted.
19389 </para>
19390 <para revisionflag="changed">
19391 <emphasis role="bold">Warning</emphasis>: the content of this variable is usually provided by a potential
19392 attacker.
19393 Consider carefully the implications of using it unvalidated as a name
19394 for file access.
19395 This presents issues for users&#x2019; <filename>.forward</filename> and filter files.
19396 For traditional full user accounts, use <option>check_local_users</option> and the
19397 <varname>$local_part_data</varname> variable rather than this one.
19398 For virtual users, store a suitable pathname component in the database
19399 which is used for account name validation, and use that retrieved value
19400 rather than this variable.
19401 Often <varname>$local_part_data</varname> is usable in this role.
19402 If needed, use a router <option>address_data</option> or <option>set</option> option for
19403 the retrieved data.
19404 </para>
19405 <para>
19406 When a message is being delivered to a file, pipe, or autoreply transport as a
19407 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
19408 the parent address, not to the filename or command (see <varname>$address_file</varname> and
19409 <varname>$address_pipe</varname>).
19410 </para>
19411 <para>
19412 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
19413 local part of the recipient address.
19414 </para>
19415 <para>
19416 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
19417 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
19418 it can be used in the expansion of the replacement address, for example.
19419 </para>
19420 <para>
19421 In all cases, all quoting is removed from the local part. For example, for both
19422 the addresses
19423 </para>
19424 <literallayout class="monospaced">
19425 "abc:xyz"@test.example
19426 abc\:xyz@test.example
19427 </literallayout>
19428 <para>
19429 the value of <varname>$local_part</varname> is
19430 </para>
19431 <literallayout class="monospaced">
19432 abc:xyz
19433 </literallayout>
19434 <para>
19435 If you use <varname>$local_part</varname> to create another address, you should always wrap it
19436 inside a quoting operator. For example, in a <command>redirect</command> router you could
19437 have:
19438 </para>
19439 <literallayout class="monospaced">
19440 data = ${quote_local_part:$local_part}@new.domain.example
19441 </literallayout>
19442 <para>
19443 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
19444 to process local parts in a case-dependent manner in a router, you can set the
19445 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
19446 </para>
19447 </listitem></varlistentry>
19448 <varlistentry>
19449 <term><varname>$local_part_data</varname></term>
19450 <listitem>
19451 <para>
19452 <indexterm role="variable">
19453 <primary><varname>$local_part_data</varname></primary>
19454 </indexterm>
19455 When the <option>local_parts</option> condition on a router or ACL
19456 matches a local part list
19457 </para>
19458 <para revisionflag="changed">
19459 the match value is copied to <varname>$local_part_data</varname>.
19460 This is an enhancement over previous versions of Exim, when it only
19461 applied to the data read by a lookup.
19462 For details on match values see section <xref linkend="SECTlistresults"/> et. al.
19463 </para>
19464 <para revisionflag="changed">
19465 The <option>check_local_user</option> router option also sets this variable.
19466 </para>
19467 <para>
19468 <indexterm role="variable">
19469 <primary><varname>$local_part_prefix</varname></primary>
19470 <secondary><varname>$local_part_prefix_v</varname></secondary>
19471 </indexterm>
19472 <indexterm role="concept">
19473 <primary>affix</primary>
19474 <secondary>variables</secondary>
19475 </indexterm>
19476 If a local part prefix or suffix has been recognized, it is not included in the
19477 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
19478 any prefix or suffix are in <varname>$local_part_prefix</varname> and
19479 <varname>$local_part_suffix</varname>, respectively.
19480 </para>
19481 <para revisionflag="changed">
19482 <indexterm role="concept">
19483 <primary>tainted data</primary>
19484 </indexterm>
19485 If the specification did not include a wildcard then
19486 the affix variable value is not tainted.
19487 </para>
19488 <para revisionflag="changed">
19489 If the affix specification included a wildcard then the portion of
19490 the affix matched by the wildcard is in
19491 <varname>$local_part_prefix_v</varname> or <varname>$local_part_suffix_v</varname> as appropriate,
19492 and both the whole and varying values are tainted.
19493 </para>
19494 </listitem></varlistentry>
19495 <varlistentry>
19496 <term><varname>$local_scan_data</varname></term>
19497 <listitem>
19498 <para>
19499 <indexterm role="variable">
19500 <primary><varname>$local_scan_data</varname></primary>
19501 </indexterm>
19502 This variable contains the text returned by the <function>local_scan()</function> function when
19503 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
19504 </para>
19505 </listitem></varlistentry>
19506 <varlistentry>
19507 <term><varname>$local_user_gid</varname></term>
19508 <listitem>
19509 <para>
19510 <indexterm role="variable">
19511 <primary><varname>$local_user_gid</varname></primary>
19512 </indexterm>
19513 See <varname>$local_user_uid</varname>.
19514 </para>
19515 </listitem></varlistentry>
19516 <varlistentry>
19517 <term><varname>$local_user_uid</varname></term>
19518 <listitem>
19519 <para>
19520 <indexterm role="variable">
19521 <primary><varname>$local_user_uid</varname></primary>
19522 </indexterm>
19523 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
19524 <option>check_local_user</option> router precondition succeeds. This means that their values
19525 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
19526 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
19527 router-specific expansions. At all other times, the values in these variables
19528 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
19529 </para>
19530 </listitem></varlistentry>
19531 <varlistentry>
19532 <term><varname>$localhost_number</varname></term>
19533 <listitem>
19534 <para>
19535 <indexterm role="variable">
19536 <primary><varname>$localhost_number</varname></primary>
19537 </indexterm>
19538 This contains the expanded value of the
19539 <option>localhost_number</option> option. The expansion happens after the main options have
19540 been read.
19541 </para>
19542 </listitem></varlistentry>
19543 <varlistentry>
19544 <term><varname>$log_inodes</varname></term>
19545 <listitem>
19546 <para>
19547 <indexterm role="variable">
19548 <primary><varname>$log_inodes</varname></primary>
19549 </indexterm>
19550 The number of free inodes in the disk partition where Exim&#x2019;s
19551 log files are being written. The value is recalculated whenever the variable is
19552 referenced. If the relevant file system does not have the concept of inodes,
19553 the value of is -1. See also the <option>check_log_inodes</option> option.
19554 </para>
19555 </listitem></varlistentry>
19556 <varlistentry>
19557 <term><varname>$log_space</varname></term>
19558 <listitem>
19559 <para>
19560 <indexterm role="variable">
19561 <primary><varname>$log_space</varname></primary>
19562 </indexterm>
19563 The amount of free space (as a number of kilobytes) in the disk
19564 partition where Exim&#x2019;s log files are being written. The value is recalculated
19565 whenever the variable is referenced. If the operating system does not have the
19566 ability to find the amount of free space (only true for experimental systems),
19567 the space value is -1. See also the <option>check_log_space</option> option.
19568 </para>
19569 </listitem></varlistentry>
19570 <varlistentry>
19571 <term><varname>$lookup_dnssec_authenticated</varname></term>
19572 <listitem>
19573 <para>
19574 <indexterm role="variable">
19575 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
19576 </indexterm>
19577 This variable is set after a DNS lookup done by
19578 a dnsdb lookup expansion, dnslookup router or smtp transport.
19579 <indexterm role="concept">
19580 <primary>DNS</primary>
19581 <secondary>DNSSEC</secondary>
19582 </indexterm>
19583 It will be empty if <command>DNSSEC</command> was not requested,
19584 <quote>no</quote> if the result was not labelled as authenticated data
19585 and <quote>yes</quote> if it was.
19586 Results that are labelled as authoritative answer that match
19587 the <option>dns_trust_aa</option> configuration variable count also
19588 as authenticated data.
19589 </para>
19590 </listitem></varlistentry>
19591 <varlistentry>
19592 <term><varname>$mailstore_basename</varname></term>
19593 <listitem>
19594 <para>
19595 <indexterm role="variable">
19596 <primary><varname>$mailstore_basename</varname></primary>
19597 </indexterm>
19598 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
19599 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
19600 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
19601 contains the basename of the files that are being written, that is, the name
19602 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
19603 variable is empty.
19604 </para>
19605 </listitem></varlistentry>
19606 <varlistentry>
19607 <term><varname>$malware_name</varname></term>
19608 <listitem>
19609 <para>
19610 <indexterm role="variable">
19611 <primary><varname>$malware_name</varname></primary>
19612 </indexterm>
19613 This variable is available when Exim is compiled with the
19614 content-scanning extension. It is set to the name of the virus that was found
19615 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
19616 </para>
19617 </listitem></varlistentry>
19618 <varlistentry>
19619 <term><varname>$max_received_linelength</varname></term>
19620 <listitem>
19621 <para>
19622 <indexterm role="variable">
19623 <primary><varname>$max_received_linelength</varname></primary>
19624 </indexterm>
19625 <indexterm role="concept">
19626 <primary>maximum</primary>
19627 <secondary>line length</secondary>
19628 </indexterm>
19629 <indexterm role="concept">
19630 <primary>line length</primary>
19631 <secondary>maximum</secondary>
19632 </indexterm>
19633 This variable contains the number of bytes in the longest line that was
19634 received as part of the message, not counting the line termination
19635 character(s).
19636 It is not valid if the <option>spool_files_wireformat</option> option is used.
19637 </para>
19638 </listitem></varlistentry>
19639 <varlistentry>
19640 <term><varname>$message_age</varname></term>
19641 <listitem>
19642 <para>
19643 <indexterm role="concept">
19644 <primary>message</primary>
19645 <secondary>age of</secondary>
19646 </indexterm>
19647 <indexterm role="variable">
19648 <primary><varname>$message_age</varname></primary>
19649 </indexterm>
19650 This variable is set at the start of a delivery attempt to contain the number
19651 of seconds since the message was received. It does not change during a single
19652 delivery attempt.
19653 </para>
19654 </listitem></varlistentry>
19655 <varlistentry>
19656 <term><varname>$message_body</varname></term>
19657 <listitem>
19658 <para>
19659 <indexterm role="concept">
19660 <primary>body of message</primary>
19661 <secondary>expansion variable</secondary>
19662 </indexterm>
19663 <indexterm role="concept">
19664 <primary>message body</primary>
19665 <secondary>in expansion</secondary>
19666 </indexterm>
19667 <indexterm role="concept">
19668 <primary>binary zero</primary>
19669 <secondary>in message body</secondary>
19670 </indexterm>
19671 <indexterm role="variable">
19672 <primary><varname>$message_body</varname></primary>
19673 </indexterm>
19674 <indexterm role="option">
19675 <primary><option>message_body_visible</option></primary>
19676 </indexterm>
19677 This variable contains the initial portion of a message&#x2019;s body while it is
19678 being delivered, and is intended mainly for use in filter files. The maximum
19679 number of characters of the body that are put into the variable is set by the
19680 <option>message_body_visible</option> configuration option; the default is 500.
19681 </para>
19682 <para>
19683 <indexterm role="option">
19684 <primary><option>message_body_newlines</option></primary>
19685 </indexterm>
19686 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
19687 easier to search for phrases that might be split over a line break. However,
19688 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
19689 zeros are always converted into spaces.
19690 </para>
19691 </listitem></varlistentry>
19692 <varlistentry>
19693 <term><varname>$message_body_end</varname></term>
19694 <listitem>
19695 <para>
19696 <indexterm role="concept">
19697 <primary>body of message</primary>
19698 <secondary>expansion variable</secondary>
19699 </indexterm>
19700 <indexterm role="concept">
19701 <primary>message body</primary>
19702 <secondary>in expansion</secondary>
19703 </indexterm>
19704 <indexterm role="variable">
19705 <primary><varname>$message_body_end</varname></primary>
19706 </indexterm>
19707 This variable contains the final portion of a message&#x2019;s
19708 body while it is being delivered. The format and maximum size are as for
19709 <varname>$message_body</varname>.
19710 </para>
19711 </listitem></varlistentry>
19712 <varlistentry>
19713 <term><varname>$message_body_size</varname></term>
19714 <listitem>
19715 <para>
19716 <indexterm role="concept">
19717 <primary>body of message</primary>
19718 <secondary>size</secondary>
19719 </indexterm>
19720 <indexterm role="concept">
19721 <primary>message body</primary>
19722 <secondary>size</secondary>
19723 </indexterm>
19724 <indexterm role="variable">
19725 <primary><varname>$message_body_size</varname></primary>
19726 </indexterm>
19727 When a message is being delivered, this variable contains the size of the body
19728 in bytes. The count starts from the character after the blank line that
19729 separates the body from the header. Newlines are included in the count. See
19730 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
19731 </para>
19732 <para>
19733 If the spool file is wireformat
19734 (see the <option>spool_files_wireformat</option> main option)
19735 the CRLF line-terminators are included in the count.
19736 </para>
19737 </listitem></varlistentry>
19738 <varlistentry>
19739 <term><varname>$message_exim_id</varname></term>
19740 <listitem>
19741 <para>
19742 <indexterm role="variable">
19743 <primary><varname>$message_exim_id</varname></primary>
19744 </indexterm>
19745 When a message is being received or delivered, this variable contains the
19746 unique message id that is generated and used by Exim to identify the message.
19747 An id is not created for a message until after its header has been successfully
19748 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
19749 line; it is the local id that Exim assigns to the message, for example:
19750 <literal>1BXTIK-0001yO-VA</literal>.
19751 </para>
19752 </listitem></varlistentry>
19753 <varlistentry>
19754 <term><varname>$message_headers</varname></term>
19755 <listitem>
19756 <para>
19757 <indexterm role="variable">
19758 <primary><varname>$message_headers</varname></primary>
19759 </indexterm>
19760 This variable contains a concatenation of all the header lines when a message
19761 is being processed, except for lines added by routers or transports. The header
19762 lines are separated by newline characters. Their contents are decoded in the
19763 same way as a header line that is inserted by <option>bheader</option>.
19764 </para>
19765 </listitem></varlistentry>
19766 <varlistentry>
19767 <term><varname>$message_headers_raw</varname></term>
19768 <listitem>
19769 <para>
19770 <indexterm role="variable">
19771 <primary><varname>$message_headers_raw</varname></primary>
19772 </indexterm>
19773 This variable is like <varname>$message_headers</varname> except that no processing of the
19774 contents of header lines is done.
19775 </para>
19776 </listitem></varlistentry>
19777 <varlistentry>
19778 <term><varname>$message_id</varname></term>
19779 <listitem>
19780 <para>
19781 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
19782 </para>
19783 </listitem></varlistentry>
19784 <varlistentry>
19785 <term><varname>$message_linecount</varname></term>
19786 <listitem>
19787 <para>
19788 <indexterm role="variable">
19789 <primary><varname>$message_linecount</varname></primary>
19790 </indexterm>
19791 This variable contains the total number of lines in the header and body of the
19792 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
19793 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
19794 number of lines received. Before delivery happens (that is, before filters,
19795 routers, and transports run) the count is increased to include the
19796 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
19797 lines that are added by ACLs. The blank line that separates the message header
19798 from the body is not counted.
19799 </para>
19800 <para>
19801 As with the special case of <varname>$message_size</varname>, during the expansion of the
19802 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
19803 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
19804 file that has been written (minus one for the blank line between the
19805 header and the body).
19806 </para>
19807 <para>
19808 Here is an example of the use of this variable in a DATA ACL:
19809 </para>
19810 <literallayout class="monospaced">
19811 deny condition = \
19812       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
19813      message   = Too many lines in message header
19814 </literallayout>
19815 <para>
19816 In the MAIL and RCPT ACLs, the value is zero because at that stage the
19817 message has not yet been received.
19818 </para>
19819 <para>
19820 This variable is not valid if the <option>spool_files_wireformat</option> option is used.
19821 </para>
19822 </listitem></varlistentry>
19823 <varlistentry>
19824 <term><varname>$message_size</varname></term>
19825 <listitem>
19826 <para>
19827 <indexterm role="concept">
19828 <primary>size</primary>
19829 <secondary>of message</secondary>
19830 </indexterm>
19831 <indexterm role="concept">
19832 <primary>message</primary>
19833 <secondary>size</secondary>
19834 </indexterm>
19835 <indexterm role="variable">
19836 <primary><varname>$message_size</varname></primary>
19837 </indexterm>
19838 When a message is being processed, this variable contains its size in bytes. In
19839 most cases, the size includes those headers that were received with the
19840 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
19841 deliveries as they are written. However, there is one special case: during the
19842 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
19843 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
19844 precise size of the file that has been written. See also
19845 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
19846 </para>
19847 <para>
19848 <indexterm role="concept">
19849 <primary>RCPT</primary>
19850 <secondary>value of <varname>$message_size</varname></secondary>
19851 </indexterm>
19852 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
19853 contains the size supplied on the MAIL command, or -1 if no size was given. The
19854 value may not, of course, be truthful.
19855 </para>
19856 </listitem></varlistentry>
19857 <varlistentry>
19858 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
19859 <listitem>
19860 <para>
19861 A number of variables whose names start with <varname>$mime</varname> are
19862 available when Exim is compiled with the content-scanning extension. For
19863 details, see section <xref linkend="SECTscanmimepart"/>.
19864 </para>
19865 </listitem></varlistentry>
19866 <varlistentry>
19867 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
19868 <listitem>
19869 <para>
19870 These variables are counters that can be incremented by means
19871 of the <option>add</option> command in filter files.
19872 </para>
19873 </listitem></varlistentry>
19874 <varlistentry>
19875 <term><varname>$original_domain</varname></term>
19876 <listitem>
19877 <para>
19878 <indexterm role="variable">
19879 <primary><varname>$domain</varname></primary>
19880 </indexterm>
19881 <indexterm role="variable">
19882 <primary><varname>$original_domain</varname></primary>
19883 </indexterm>
19884 When a top-level address is being processed for delivery, this contains the
19885 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
19886 generated by an alias, forward, or filter file) is being processed, this
19887 variable contains the domain of the original address (lower cased). This
19888 differs from <varname>$parent_domain</varname> only when there is more than one level of
19889 aliasing or forwarding. When more than one address is being delivered in a
19890 single transport run, <varname>$original_domain</varname> is not set.
19891 </para>
19892 <para>
19893 If a new address is created by means of a <option>deliver</option> command in a system
19894 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
19895 part <emphasis>system-filter</emphasis> and the default qualify domain.
19896 </para>
19897 </listitem></varlistentry>
19898 <varlistentry>
19899 <term><varname>$original_local_part</varname></term>
19900 <listitem>
19901 <para>
19902 <indexterm role="variable">
19903 <primary><varname>$local_part</varname></primary>
19904 </indexterm>
19905 <indexterm role="variable">
19906 <primary><varname>$original_local_part</varname></primary>
19907 </indexterm>
19908 When a top-level address is being processed for delivery, this contains the
19909 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
19910 local part, because <varname>$original_local_part</varname> always contains the full local
19911 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
19912 filter file) is being processed, this variable contains the full local part of
19913 the original address.
19914 </para>
19915 <para>
19916 If the router that did the redirection processed the local part
19917 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
19918 This variable differs from <varname>$parent_local_part</varname> only when there is more than
19919 one level of aliasing or forwarding. When more than one address is being
19920 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
19921 </para>
19922 <para>
19923 If a new address is created by means of a <option>deliver</option> command in a system
19924 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
19925 part <emphasis>system-filter</emphasis> and the default qualify domain.
19926 </para>
19927 </listitem></varlistentry>
19928 <varlistentry>
19929 <term><varname>$originator_gid</varname></term>
19930 <listitem>
19931 <para>
19932 <indexterm role="concept">
19933 <primary>gid (group id)</primary>
19934 <secondary>of originating user</secondary>
19935 </indexterm>
19936 <indexterm role="concept">
19937 <primary>sender</primary>
19938 <secondary>gid</secondary>
19939 </indexterm>
19940 <indexterm role="variable">
19941 <primary><varname>$caller_gid</varname></primary>
19942 </indexterm>
19943 <indexterm role="variable">
19944 <primary><varname>$originator_gid</varname></primary>
19945 </indexterm>
19946 This variable contains the value of <varname>$caller_gid</varname> that was set when the
19947 message was received. For messages received via the command line, this is the
19948 gid of the sending user. For messages received by SMTP over TCP/IP, this is
19949 normally the gid of the Exim user.
19950 </para>
19951 </listitem></varlistentry>
19952 <varlistentry>
19953 <term><varname>$originator_uid</varname></term>
19954 <listitem>
19955 <para>
19956 <indexterm role="concept">
19957 <primary>uid (user id)</primary>
19958 <secondary>of originating user</secondary>
19959 </indexterm>
19960 <indexterm role="concept">
19961 <primary>sender</primary>
19962 <secondary>uid</secondary>
19963 </indexterm>
19964 <indexterm role="variable">
19965 <primary><varname>$caller_uid</varname></primary>
19966 </indexterm>
19967 <indexterm role="variable">
19968 <primary><varname>$originator_uid</varname></primary>
19969 </indexterm>
19970 The value of <varname>$caller_uid</varname> that was set when the message was received. For
19971 messages received via the command line, this is the uid of the sending user.
19972 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
19973 user.
19974 </para>
19975 </listitem></varlistentry>
19976 <varlistentry>
19977 <term><varname>$parent_domain</varname></term>
19978 <listitem>
19979 <para>
19980 <indexterm role="variable">
19981 <primary><varname>$parent_domain</varname></primary>
19982 </indexterm>
19983 This variable is similar to <varname>$original_domain</varname> (see
19984 above), except that it refers to the immediately preceding parent address.
19985 </para>
19986 </listitem></varlistentry>
19987 <varlistentry>
19988 <term><varname>$parent_local_part</varname></term>
19989 <listitem>
19990 <para>
19991 <indexterm role="variable">
19992 <primary><varname>$parent_local_part</varname></primary>
19993 </indexterm>
19994 This variable is similar to <varname>$original_local_part</varname>
19995 (see above), except that it refers to the immediately preceding parent address.
19996 </para>
19997 </listitem></varlistentry>
19998 <varlistentry>
19999 <term><varname>$pid</varname></term>
20000 <listitem>
20001 <para>
20002 <indexterm role="concept">
20003 <primary>pid (process id)</primary>
20004 <secondary>of current process</secondary>
20005 </indexterm>
20006 <indexterm role="variable">
20007 <primary><varname>$pid</varname></primary>
20008 </indexterm>
20009 This variable contains the current process id.
20010 </para>
20011 </listitem></varlistentry>
20012 <varlistentry>
20013 <term><varname>$pipe_addresses</varname></term>
20014 <listitem>
20015 <para>
20016 <indexterm role="concept">
20017 <primary>filter</primary>
20018 <secondary>transport filter</secondary>
20019 </indexterm>
20020 <indexterm role="concept">
20021 <primary>transport</primary>
20022 <secondary>filter</secondary>
20023 </indexterm>
20024 <indexterm role="variable">
20025 <primary><varname>$pipe_addresses</varname></primary>
20026 </indexterm>
20027 This is not an expansion variable, but is mentioned here because the string
20028 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
20029 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
20030 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
20031 It cannot be used in general expansion strings, and provokes an <quote>unknown
20032 variable</quote> error if encountered.
20033 </para>
20034 </listitem></varlistentry>
20035 <varlistentry>
20036 <term><varname>$primary_hostname</varname></term>
20037 <listitem>
20038 <para>
20039 <indexterm role="variable">
20040 <primary><varname>$primary_hostname</varname></primary>
20041 </indexterm>
20042 This variable contains the value set by <option>primary_hostname</option> in the
20043 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
20044 a single-component name, Exim calls <function>gethostbyname()</function> (or
20045 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
20046 qualified host name. See also <varname>$smtp_active_hostname</varname>.
20047 </para>
20048 </listitem></varlistentry>
20049 <varlistentry>
20050 <term><varname>$proxy_external_address</varname></term>
20051 <term><varname>$proxy_external_port</varname></term>
20052 <term><varname>$proxy_local_address</varname></term>
20053 <term><varname>$proxy_local_port</varname></term>
20054 <term><varname>$proxy_session</varname></term>
20055 <listitem>
20056 <para>
20057 These variables are only available when built with Proxy Protocol
20058 or SOCKS5 support.
20059 For details see chapter <xref linkend="SECTproxyInbound"/>.
20060 </para>
20061 </listitem></varlistentry>
20062 <varlistentry>
20063 <term><varname>$prdr_requested</varname></term>
20064 <listitem>
20065 <para>
20066 <indexterm role="concept">
20067 <primary>PRDR</primary>
20068 <secondary>variable for</secondary>
20069 </indexterm>
20070 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
20071 current message, otherwise <quote>no</quote>.
20072 </para>
20073 </listitem></varlistentry>
20074 <varlistentry>
20075 <term><varname>$prvscheck_address</varname></term>
20076 <listitem>
20077 <para>
20078 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
20079 which is described in sections <xref linkend="SECTexpansionitems"/> and
20080 <xref linkend="SECTverifyPRVS"/>.
20081 </para>
20082 </listitem></varlistentry>
20083 <varlistentry>
20084 <term><varname>$prvscheck_keynum</varname></term>
20085 <listitem>
20086 <para>
20087 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
20088 which is described in sections <xref linkend="SECTexpansionitems"/> and
20089 <xref linkend="SECTverifyPRVS"/>.
20090 </para>
20091 </listitem></varlistentry>
20092 <varlistentry>
20093 <term><varname>$prvscheck_result</varname></term>
20094 <listitem>
20095 <para>
20096 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
20097 which is described in sections <xref linkend="SECTexpansionitems"/> and
20098 <xref linkend="SECTverifyPRVS"/>.
20099 </para>
20100 </listitem></varlistentry>
20101 <varlistentry>
20102 <term><varname>$qualify_domain</varname></term>
20103 <listitem>
20104 <para>
20105 <indexterm role="variable">
20106 <primary><varname>$qualify_domain</varname></primary>
20107 </indexterm>
20108 The value set for the <option>qualify_domain</option> option in the configuration file.
20109 </para>
20110 </listitem></varlistentry>
20111 <varlistentry>
20112 <term><varname>$qualify_recipient</varname></term>
20113 <listitem>
20114 <para>
20115 <indexterm role="variable">
20116 <primary><varname>$qualify_recipient</varname></primary>
20117 </indexterm>
20118 The value set for the <option>qualify_recipient</option> option in the configuration file,
20119 or if not set, the value of <varname>$qualify_domain</varname>.
20120 </para>
20121 </listitem></varlistentry>
20122 <varlistentry>
20123 <term><varname>$queue_name</varname></term>
20124 <listitem>
20125 <para>
20126 <indexterm role="variable">
20127 <primary><varname>$queue_name</varname></primary>
20128 </indexterm>
20129 <indexterm role="concept">
20130 <primary>named queues</primary>
20131 <secondary>variable</secondary>
20132 </indexterm>
20133 <indexterm role="concept">
20134 <primary>queues</primary>
20135 <secondary>named</secondary>
20136 </indexterm>
20137 The name of the spool queue in use; empty for the default queue.
20138 </para>
20139 </listitem></varlistentry>
20140 <varlistentry>
20141 <term><varname>$queue_size</varname></term>
20142 <listitem>
20143 <para>
20144 <indexterm role="variable">
20145 <primary><varname>$queue_size</varname></primary>
20146 </indexterm>
20147 <indexterm role="concept">
20148 <primary>queue</primary>
20149 <secondary>size of</secondary>
20150 </indexterm>
20151 <indexterm role="concept">
20152 <primary>spool</primary>
20153 <secondary>number of messages</secondary>
20154 </indexterm>
20155 This variable contains the number of messages queued.
20156 It is evaluated on demand, but no more often than once every minute.
20157 </para>
20158 </listitem></varlistentry>
20159 <varlistentry>
20160 <term><varname>$r_...</varname></term>
20161 <listitem>
20162 <para>
20163 <indexterm role="variable">
20164 <primary><varname>$r_...</varname></primary>
20165 </indexterm>
20166 <indexterm role="concept">
20167 <primary>router</primary>
20168 <secondary>variables</secondary>
20169 </indexterm>
20170 Values can be placed in these variables by the <option>set</option> option of a router.
20171 They can be given any name that starts with <varname>$r_</varname>.
20172 The values persist for the address being handled through subsequent routers
20173 and the eventual transport.
20174 </para>
20175 </listitem></varlistentry>
20176 <varlistentry>
20177 <term><varname>$rcpt_count</varname></term>
20178 <listitem>
20179 <para>
20180 <indexterm role="variable">
20181 <primary><varname>$rcpt_count</varname></primary>
20182 </indexterm>
20183 When a message is being received by SMTP, this variable contains the number of
20184 RCPT commands received for the current message. If this variable is used in a
20185 RCPT ACL, its value includes the current command.
20186 </para>
20187 </listitem></varlistentry>
20188 <varlistentry>
20189 <term><varname>$rcpt_defer_count</varname></term>
20190 <listitem>
20191 <para>
20192 <indexterm role="variable">
20193 <primary><varname>$rcpt_defer_count</varname></primary>
20194 </indexterm>
20195 <indexterm role="concept">
20196 <primary>4<emphasis>xx</emphasis> responses</primary>
20197 <secondary>count of</secondary>
20198 </indexterm>
20199 When a message is being received by SMTP, this variable contains the number of
20200 RCPT commands in the current message that have previously been rejected with a
20201 temporary (4<emphasis>xx</emphasis>) response.
20202 </para>
20203 </listitem></varlistentry>
20204 <varlistentry>
20205 <term><varname>$rcpt_fail_count</varname></term>
20206 <listitem>
20207 <para>
20208 <indexterm role="variable">
20209 <primary><varname>$rcpt_fail_count</varname></primary>
20210 </indexterm>
20211 When a message is being received by SMTP, this variable contains the number of
20212 RCPT commands in the current message that have previously been rejected with a
20213 permanent (5<emphasis>xx</emphasis>) response.
20214 </para>
20215 </listitem></varlistentry>
20216 <varlistentry>
20217 <term><varname>$received_count</varname></term>
20218 <listitem>
20219 <para>
20220 <indexterm role="variable">
20221 <primary><varname>$received_count</varname></primary>
20222 </indexterm>
20223 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
20224 including the one added by Exim (so its value is always greater than zero). It
20225 is available in the DATA ACL, the non-SMTP ACL, and while routing and
20226 delivering.
20227 </para>
20228 </listitem></varlistentry>
20229 <varlistentry>
20230 <term><varname>$received_for</varname></term>
20231 <listitem>
20232 <para>
20233 <indexterm role="variable">
20234 <primary><varname>$received_for</varname></primary>
20235 </indexterm>
20236 If there is only a single recipient address in an incoming message, this
20237 variable contains that address when the <emphasis>Received:</emphasis> header line is being
20238 built. The value is copied after recipient rewriting has happened, but before
20239 the <function>local_scan()</function> function is run.
20240 </para>
20241 </listitem></varlistentry>
20242 <varlistentry>
20243 <term><varname>$received_ip_address</varname></term>
20244 <listitem>
20245 <para>
20246 <indexterm role="variable">
20247 <primary><varname>$received_ip_address</varname></primary>
20248 </indexterm>
20249 As soon as an Exim server starts processing an incoming TCP/IP connection, this
20250 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
20251 is set to the local port number. (The remote IP address and port are in
20252 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
20253 the port value is -1 unless it has been set using the <option>-oMi</option> command line
20254 option.
20255 </para>
20256 <para>
20257 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
20258 could be used, for example, to make the filename for a TLS certificate depend
20259 on which interface and/or port is being used for the incoming connection. The
20260 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
20261 messages that are received, thus making these variables available at delivery
20262 time.
20263 For outbound connections see <varname>$sending_ip_address</varname>.
20264 </para>
20265 </listitem></varlistentry>
20266 <varlistentry>
20267 <term><varname>$received_port</varname></term>
20268 <listitem>
20269 <para>
20270 <indexterm role="variable">
20271 <primary><varname>$received_port</varname></primary>
20272 </indexterm>
20273 See <varname>$received_ip_address</varname>.
20274 </para>
20275 </listitem></varlistentry>
20276 <varlistentry>
20277 <term><varname>$received_protocol</varname></term>
20278 <listitem>
20279 <para>
20280 <indexterm role="variable">
20281 <primary><varname>$received_protocol</varname></primary>
20282 </indexterm>
20283 When a message is being processed, this variable contains the name of the
20284 protocol by which it was received. Most of the names used by Exim are defined
20285 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
20286 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
20287 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
20288 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
20289 connection and the client was successfully authenticated.
20290 </para>
20291 <para>
20292 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
20293 automatically set up on connection without the use of STARTTLS (see
20294 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
20295 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
20296 where the client initially uses EHLO, sets up an encrypted connection using
20297 STARTTLS, and then uses HELO afterwards.
20298 </para>
20299 <para>
20300 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
20301 messages that are injected locally by trusted callers. This is commonly used to
20302 identify messages that are being re-injected after some kind of scanning.
20303 </para>
20304 </listitem></varlistentry>
20305 <varlistentry>
20306 <term><varname>$received_time</varname></term>
20307 <listitem>
20308 <para>
20309 <indexterm role="variable">
20310 <primary><varname>$received_time</varname></primary>
20311 </indexterm>
20312 This variable contains the date and time when the current message was received,
20313 as a number of seconds since the start of the Unix epoch.
20314 </para>
20315 </listitem></varlistentry>
20316 <varlistentry>
20317 <term><varname>$recipient_data</varname></term>
20318 <listitem>
20319 <para>
20320 <indexterm role="variable">
20321 <primary><varname>$recipient_data</varname></primary>
20322 </indexterm>
20323 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
20324 condition. It contains the data from the lookup, and the value remains set
20325 until the next <option>recipients</option> test. Thus, you can do things like this:
20326 </para>
20327 <literallayout>
20328 <literal>require recipients  = cdb*@;/some/file</literal>
20329 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
20330 </literallayout>
20331 <para>
20332 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
20333 method in the address list, using the semicolon syntax as in the example above.
20334 The variable is not set for a lookup that is used as part of the string
20335 expansion that all such lists undergo before being interpreted.
20336 </para>
20337 </listitem></varlistentry>
20338 <varlistentry>
20339 <term><varname>$recipient_verify_failure</varname></term>
20340 <listitem>
20341 <para>
20342 <indexterm role="variable">
20343 <primary><varname>$recipient_verify_failure</varname></primary>
20344 </indexterm>
20345 In an ACL, when a recipient verification fails, this variable contains
20346 information about the failure. It is set to one of the following words:
20347 </para>
20348 <itemizedlist>
20349 <listitem>
20350 <para>
20351 <quote>qualify</quote>: The address was unqualified (no domain), and the message
20352 was neither local nor came from an exempted host.
20353 </para>
20354 </listitem>
20355 <listitem>
20356 <para>
20357 <quote>route</quote>: Routing failed.
20358 </para>
20359 </listitem>
20360 <listitem>
20361 <para>
20362 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
20363 or before the MAIL command (that is, on initial connection, HELO, or
20364 MAIL).
20365 </para>
20366 </listitem>
20367 <listitem>
20368 <para>
20369 <quote>recipient</quote>: The RCPT command in a callout was rejected.
20370 </para>
20371 </listitem>
20372 <listitem>
20373 <para>
20374 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
20375 </para>
20376 </listitem>
20377 </itemizedlist>
20378 <para>
20379 The main use of this variable is expected to be to distinguish between
20380 rejections of MAIL and rejections of RCPT.
20381 </para>
20382 </listitem></varlistentry>
20383 <varlistentry>
20384 <term><varname>$recipients</varname></term>
20385 <listitem>
20386 <para>
20387 <indexterm role="variable">
20388 <primary><varname>$recipients</varname></primary>
20389 </indexterm>
20390 This variable contains a list of envelope recipients for a message. A comma and
20391 a space separate the addresses in the replacement text. However, the variable
20392 is not generally available, to prevent exposure of Bcc recipients in
20393 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
20394 cases:
20395 </para>
20396 <orderedlist numeration="arabic">
20397 <listitem>
20398 <para>
20399 In a system filter file.
20400 </para>
20401 </listitem>
20402 <listitem>
20403 <para>
20404 In the ACLs associated with the DATA command and with non-SMTP messages, that
20405 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
20406 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
20407 <option>acl_not_smtp_mime</option>.
20408 </para>
20409 </listitem>
20410 <listitem>
20411 <para>
20412 From within a <function>local_scan()</function> function.
20413 </para>
20414 </listitem>
20415 </orderedlist>
20416 </listitem></varlistentry>
20417 <varlistentry>
20418 <term><varname>$recipients_count</varname></term>
20419 <listitem>
20420 <para>
20421 <indexterm role="variable">
20422 <primary><varname>$recipients_count</varname></primary>
20423 </indexterm>
20424 When a message is being processed, this variable contains the number of
20425 envelope recipients that came with the message. Duplicates are not excluded
20426 from the count. While a message is being received over SMTP, the number
20427 increases for each accepted recipient. It can be referenced in an ACL.
20428 </para>
20429 </listitem></varlistentry>
20430 <varlistentry>
20431 <term><varname>$regex_match_string</varname></term>
20432 <listitem>
20433 <para>
20434 <indexterm role="variable">
20435 <primary><varname>$regex_match_string</varname></primary>
20436 </indexterm>
20437 This variable is set to contain the matching regular expression after a
20438 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
20439 </para>
20440 </listitem></varlistentry>
20441 <varlistentry>
20442 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
20443 <listitem>
20444 <para>
20445 <indexterm role="concept">
20446 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
20447 </indexterm>
20448 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
20449 these variables contain the
20450 captured substrings identified by the regular expression.
20451 </para>
20452 </listitem></varlistentry>
20453 <varlistentry>
20454 <term><varname>$reply_address</varname></term>
20455 <listitem>
20456 <para>
20457 <indexterm role="variable">
20458 <primary><varname>$reply_address</varname></primary>
20459 </indexterm>
20460 When a message is being processed, this variable contains the contents of the
20461 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
20462 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
20463 white space, the value is not processed in any way. In particular, no RFC 2047
20464 decoding or character code translation takes place.
20465 </para>
20466 </listitem></varlistentry>
20467 <varlistentry>
20468 <term><varname>$return_path</varname></term>
20469 <listitem>
20470 <para>
20471 <indexterm role="variable">
20472 <primary><varname>$return_path</varname></primary>
20473 </indexterm>
20474 When a message is being delivered, this variable contains the return path &ndash;
20475 the sender field that will be sent as part of the envelope. It is not enclosed
20476 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
20477 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
20478 mailing list has been expanded by a router which specifies a different address
20479 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
20480 address, whereas <varname>$sender_address</varname> always contains the original sender address
20481 that was received with the message. In other words, <varname>$sender_address</varname> contains
20482 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
20483 envelope sender.
20484 </para>
20485 </listitem></varlistentry>
20486 <varlistentry>
20487 <term><varname>$return_size_limit</varname></term>
20488 <listitem>
20489 <para>
20490 <indexterm role="variable">
20491 <primary><varname>$return_size_limit</varname></primary>
20492 </indexterm>
20493 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
20494 </para>
20495 </listitem></varlistentry>
20496 <varlistentry>
20497 <term><varname>$router_name</varname></term>
20498 <listitem>
20499 <para>
20500 <indexterm role="concept">
20501 <primary>router</primary>
20502 <secondary>name</secondary>
20503 </indexterm>
20504 <indexterm role="concept">
20505 <primary>name</primary>
20506 <secondary>of router</secondary>
20507 </indexterm>
20508 <indexterm role="variable">
20509 <primary><varname>$router_name</varname></primary>
20510 </indexterm>
20511 During the running of a router this variable contains its name.
20512 </para>
20513 </listitem></varlistentry>
20514 <varlistentry>
20515 <term><varname>$runrc</varname></term>
20516 <listitem>
20517 <para>
20518 <indexterm role="concept">
20519 <primary>return code</primary>
20520 <secondary>from <option>run</option> expansion</secondary>
20521 </indexterm>
20522 <indexterm role="variable">
20523 <primary><varname>$runrc</varname></primary>
20524 </indexterm>
20525 This variable contains the return code from a command that is run by the
20526 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
20527 assume the order in which option values are expanded, except for those
20528 preconditions whose order of testing is documented. Therefore, you cannot
20529 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
20530 another.
20531 </para>
20532 </listitem></varlistentry>
20533 <varlistentry>
20534 <term><varname>$self_hostname</varname></term>
20535 <listitem>
20536 <para>
20537 <indexterm role="option">
20538 <primary><option>self</option></primary>
20539 <secondary>value of host name</secondary>
20540 </indexterm>
20541 <indexterm role="variable">
20542 <primary><varname>$self_hostname</varname></primary>
20543 </indexterm>
20544 When an address is routed to a supposedly remote host that turns out to be the
20545 local host, what happens is controlled by the <option>self</option> generic router option.
20546 One of its values causes the address to be passed to another router. When this
20547 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
20548 original router encountered. In other circumstances its contents are null.
20549 </para>
20550 </listitem></varlistentry>
20551 <varlistentry>
20552 <term><varname>$sender_address</varname></term>
20553 <listitem>
20554 <para>
20555 <indexterm role="variable">
20556 <primary><varname>$sender_address</varname></primary>
20557 </indexterm>
20558 When a message is being processed, this variable contains the sender&#x2019;s address
20559 that was received in the message&#x2019;s envelope. The case of letters in the address
20560 is retained, in both the local part and the domain. For bounce messages, the
20561 value of this variable is the empty string. See also <varname>$return_path</varname>.
20562 </para>
20563 </listitem></varlistentry>
20564 <varlistentry>
20565 <term><varname>$sender_address_data</varname></term>
20566 <listitem>
20567 <para>
20568 <indexterm role="variable">
20569 <primary><varname>$address_data</varname></primary>
20570 </indexterm>
20571 <indexterm role="variable">
20572 <primary><varname>$sender_address_data</varname></primary>
20573 </indexterm>
20574 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
20575 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
20576 distinguish it from data from a recipient address. The value does not persist
20577 after the end of the current ACL statement. If you want to preserve it for
20578 longer, you can save it in an ACL variable.
20579 </para>
20580 </listitem></varlistentry>
20581 <varlistentry>
20582 <term><varname>$sender_address_domain</varname></term>
20583 <listitem>
20584 <para>
20585 <indexterm role="variable">
20586 <primary><varname>$sender_address_domain</varname></primary>
20587 </indexterm>
20588 The domain portion of <varname>$sender_address</varname>.
20589 </para>
20590 </listitem></varlistentry>
20591 <varlistentry>
20592 <term><varname>$sender_address_local_part</varname></term>
20593 <listitem>
20594 <para>
20595 <indexterm role="variable">
20596 <primary><varname>$sender_address_local_part</varname></primary>
20597 </indexterm>
20598 The local part portion of <varname>$sender_address</varname>.
20599 </para>
20600 </listitem></varlistentry>
20601 <varlistentry>
20602 <term><varname>$sender_data</varname></term>
20603 <listitem>
20604 <para>
20605 <indexterm role="variable">
20606 <primary><varname>$sender_data</varname></primary>
20607 </indexterm>
20608 This variable is set after a lookup success in an ACL <option>senders</option> condition or
20609 in a router <option>senders</option> option. It contains the data from the lookup, and the
20610 value remains set until the next <option>senders</option> test. Thus, you can do things like
20611 this:
20612 </para>
20613 <literallayout>
20614 <literal>require senders      = cdb*@;/some/file</literal>
20615 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
20616 </literallayout>
20617 <para>
20618 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
20619 method in the address list, using the semicolon syntax as in the example above.
20620 The variable is not set for a lookup that is used as part of the string
20621 expansion that all such lists undergo before being interpreted.
20622 </para>
20623 </listitem></varlistentry>
20624 <varlistentry>
20625 <term><varname>$sender_fullhost</varname></term>
20626 <listitem>
20627 <para>
20628 <indexterm role="variable">
20629 <primary><varname>$sender_fullhost</varname></primary>
20630 </indexterm>
20631 When a message is received from a remote host, this variable contains the host
20632 name and IP address in a single string. It ends with the IP address in square
20633 brackets, followed by a colon and a port number if the logging of ports is
20634 enabled. The format of the rest of the string depends on whether the host
20635 issued a HELO or EHLO SMTP command, and whether the host name was verified by
20636 looking up its IP address. (Looking up the IP address can be forced by the
20637 <option>host_lookup</option> option, independent of verification.) A plain host name at the
20638 start of the string is a verified host name; if this is not present,
20639 verification either failed or was not requested. A host name in parentheses is
20640 the argument of a HELO or EHLO command. This is omitted if it is identical to
20641 the verified host name or to the host&#x2019;s IP address in square brackets.
20642 </para>
20643 </listitem></varlistentry>
20644 <varlistentry>
20645 <term><varname>$sender_helo_dnssec</varname></term>
20646 <listitem>
20647 <para>
20648 <indexterm role="variable">
20649 <primary><varname>$sender_helo_dnssec</varname></primary>
20650 </indexterm>
20651 This boolean variable is true if a successful HELO verification was
20652 <indexterm role="concept">
20653 <primary>DNS</primary>
20654 <secondary>DNSSEC</secondary>
20655 </indexterm>
20656 done using DNS information the resolver library stated was authenticated data.
20657 </para>
20658 </listitem></varlistentry>
20659 <varlistentry>
20660 <term><varname>$sender_helo_name</varname></term>
20661 <listitem>
20662 <para>
20663 <indexterm role="variable">
20664 <primary><varname>$sender_helo_name</varname></primary>
20665 </indexterm>
20666 When a message is received from a remote host that has issued a HELO or EHLO
20667 command, the argument of that command is placed in this variable. It is also
20668 set if HELO or EHLO is used when a message is received using SMTP locally via
20669 the <option>-bs</option> or <option>-bS</option> options.
20670 </para>
20671 </listitem></varlistentry>
20672 <varlistentry>
20673 <term><varname>$sender_host_address</varname></term>
20674 <listitem>
20675 <para>
20676 <indexterm role="variable">
20677 <primary><varname>$sender_host_address</varname></primary>
20678 </indexterm>
20679 When a message is received from a remote host using SMTP,
20680 this variable contains that
20681 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
20682 </para>
20683 </listitem></varlistentry>
20684 <varlistentry>
20685 <term><varname>$sender_host_authenticated</varname></term>
20686 <listitem>
20687 <para>
20688 <indexterm role="variable">
20689 <primary><varname>$sender_host_authenticated</varname></primary>
20690 </indexterm>
20691 This variable contains the name (not the public name) of the authenticator
20692 driver that successfully authenticated the client from which the message was
20693 received. It is empty if there was no successful authentication. See also
20694 <varname>$authenticated_id</varname>.
20695 </para>
20696 </listitem></varlistentry>
20697 <varlistentry>
20698 <term><varname>$sender_host_dnssec</varname></term>
20699 <listitem>
20700 <para>
20701 <indexterm role="variable">
20702 <primary><varname>$sender_host_dnssec</varname></primary>
20703 </indexterm>
20704 If an attempt to populate <varname>$sender_host_name</varname> has been made
20705 (by reference, <option>hosts_lookup</option> or
20706 otherwise) then this boolean will have been set true if, and only if, the
20707 resolver library states that both
20708 the reverse and forward DNS were authenticated data.  At all
20709 other times, this variable is false.
20710 </para>
20711 <para>
20712 <indexterm role="concept">
20713 <primary>DNS</primary>
20714 <secondary>DNSSEC</secondary>
20715 </indexterm>
20716 It is likely that you will need to coerce DNSSEC support on in the resolver
20717 library, by setting:
20718 </para>
20719 <literallayout class="monospaced">
20720 dns_dnssec_ok = 1
20721 </literallayout>
20722 <para revisionflag="changed">
20723 In addition, on Linux with glibc 2.31 or newer the resolver library will
20724 default to stripping out a successful validation status.
20725 This will break a previously working Exim installation.
20726 Provided that you do trust the resolver (ie, is on localhost) you can tell
20727 glibc to pass through any successful validation with a new option in
20728 <filename>/etc/resolv.conf</filename>:
20729 </para>
20730 <literallayout class="monospaced" revisionflag="changed">
20731 options trust-ad
20732 </literallayout>
20733 <para>
20734 Exim does not perform DNSSEC validation itself, instead leaving that to a
20735 validating resolver (e.g. unbound, or bind with suitable configuration).
20736 </para>
20737 <para>
20738 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
20739 mechanism in the list, then this variable will be false.
20740 </para>
20741 <para>
20742 This requires that your system resolver library support EDNS0 (and that
20743 DNSSEC flags exist in the system headers).  If the resolver silently drops
20744 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
20745 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
20746 </para>
20747 </listitem></varlistentry>
20748 <varlistentry>
20749 <term><varname>$sender_host_name</varname></term>
20750 <listitem>
20751 <para>
20752 <indexterm role="variable">
20753 <primary><varname>$sender_host_name</varname></primary>
20754 </indexterm>
20755 When a message is received from a remote host, this variable contains the
20756 host&#x2019;s name as obtained by looking up its IP address. For messages received by
20757 other means, this variable is empty.
20758 </para>
20759 <para>
20760 <indexterm role="variable">
20761 <primary><varname>$host_lookup_failed</varname></primary>
20762 </indexterm>
20763 If the host name has not previously been looked up, a reference to
20764 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
20765 A looked up name is accepted only if it leads back to the original IP address
20766 via a forward lookup. If either the reverse or the forward lookup fails to find
20767 any data, or if the forward lookup does not yield the original IP address,
20768 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
20769 </para>
20770 <para>
20771 <indexterm role="variable">
20772 <primary><varname>$host_lookup_deferred</varname></primary>
20773 </indexterm>
20774 However, if either of the lookups cannot be completed (for example, there is a
20775 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
20776 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
20777 </para>
20778 <para>
20779 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
20780 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
20781 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
20782 is set to <quote>1</quote>.
20783 </para>
20784 <para>
20785 Exim does not automatically look up every calling host&#x2019;s name. If you want
20786 maximum efficiency, you should arrange your configuration so that it avoids
20787 these lookups altogether. The lookup happens only if one or more of the
20788 following are true:
20789 </para>
20790 <itemizedlist>
20791 <listitem>
20792 <para>
20793 A string containing <varname>$sender_host_name</varname> is expanded.
20794 </para>
20795 </listitem>
20796 <listitem>
20797 <para>
20798 The calling host matches the list in <option>host_lookup</option>. In the default
20799 configuration, this option is set to *, so it must be changed if lookups are
20800 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
20801 </para>
20802 </listitem>
20803 <listitem>
20804 <para>
20805 Exim needs the host name in order to test an item in a host list. The items
20806 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
20807 <xref linkend="SECThoslispatnamsk"/>.
20808 </para>
20809 </listitem>
20810 <listitem>
20811 <para>
20812 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
20813 In this case, the host name is required to compare with the name quoted in any
20814 EHLO or HELO commands that the client issues.
20815 </para>
20816 </listitem>
20817 <listitem>
20818 <para>
20819 The remote host issues a EHLO or HELO command that quotes one of the
20820 domains in <option>helo_lookup_domains</option>. The default value of this option is
20821 </para>
20822 <literallayout class="monospaced">
20823   helo_lookup_domains = @ : @[]
20824 </literallayout>
20825 <para>
20826 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
20827 IP address in an EHLO or HELO command.
20828 </para>
20829 </listitem>
20830 </itemizedlist>
20831 </listitem></varlistentry>
20832 <varlistentry>
20833 <term><varname>$sender_host_port</varname></term>
20834 <listitem>
20835 <para>
20836 <indexterm role="variable">
20837 <primary><varname>$sender_host_port</varname></primary>
20838 </indexterm>
20839 When a message is received from a remote host, this variable contains the port
20840 number that was used on the remote host.
20841 </para>
20842 </listitem></varlistentry>
20843 <varlistentry>
20844 <term><varname>$sender_ident</varname></term>
20845 <listitem>
20846 <para>
20847 <indexterm role="variable">
20848 <primary><varname>$sender_ident</varname></primary>
20849 </indexterm>
20850 When a message is received from a remote host, this variable contains the
20851 identification received in response to an RFC 1413 request. When a message has
20852 been received locally, this variable contains the login name of the user that
20853 called Exim.
20854 </para>
20855 </listitem></varlistentry>
20856 <varlistentry>
20857 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
20858 <listitem>
20859 <para>
20860 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
20861 <option>ratelimit</option> ACL condition. Details are given in section
20862 <xref linkend="SECTratelimiting"/>.
20863 </para>
20864 </listitem></varlistentry>
20865 <varlistentry>
20866 <term><varname>$sender_rcvhost</varname></term>
20867 <listitem>
20868 <para>
20869 <indexterm role="concept">
20870 <primary>DNS</primary>
20871 <secondary>reverse lookup</secondary>
20872 </indexterm>
20873 <indexterm role="concept">
20874 <primary>reverse DNS lookup</primary>
20875 </indexterm>
20876 <indexterm role="variable">
20877 <primary><varname>$sender_rcvhost</varname></primary>
20878 </indexterm>
20879 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
20880 either the verified host name (as obtained from a reverse DNS lookup) or, if
20881 there is no verified host name, the IP address in square brackets. After that
20882 there may be text in parentheses. When the first item is a verified host name,
20883 the first thing in the parentheses is the IP address in square brackets,
20884 followed by a colon and a port number if port logging is enabled. When the
20885 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
20886 the parentheses.
20887 </para>
20888 <para>
20889 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
20890 was used and its argument was not identical to the real host name or IP
20891 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
20892 all three items are present in the parentheses, a newline and tab are inserted
20893 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
20894 </para>
20895 </listitem></varlistentry>
20896 <varlistentry>
20897 <term><varname>$sender_verify_failure</varname></term>
20898 <listitem>
20899 <para>
20900 <indexterm role="variable">
20901 <primary><varname>$sender_verify_failure</varname></primary>
20902 </indexterm>
20903 In an ACL, when a sender verification fails, this variable contains information
20904 about the failure. The details are the same as for
20905 <varname>$recipient_verify_failure</varname>.
20906 </para>
20907 </listitem></varlistentry>
20908 <varlistentry>
20909 <term><varname>$sending_ip_address</varname></term>
20910 <listitem>
20911 <para>
20912 <indexterm role="variable">
20913 <primary><varname>$sending_ip_address</varname></primary>
20914 </indexterm>
20915 This variable is set whenever an outgoing SMTP connection to another host has
20916 been set up. It contains the IP address of the local interface that is being
20917 used. This is useful if a host that has more than one IP address wants to take
20918 on different personalities depending on which one is being used. For incoming
20919 connections, see <varname>$received_ip_address</varname>.
20920 </para>
20921 </listitem></varlistentry>
20922 <varlistentry>
20923 <term><varname>$sending_port</varname></term>
20924 <listitem>
20925 <para>
20926 <indexterm role="variable">
20927 <primary><varname>$sending_port</varname></primary>
20928 </indexterm>
20929 This variable is set whenever an outgoing SMTP connection to another host has
20930 been set up. It contains the local port that is being used. For incoming
20931 connections, see <varname>$received_port</varname>.
20932 </para>
20933 </listitem></varlistentry>
20934 <varlistentry>
20935 <term><varname>$smtp_active_hostname</varname></term>
20936 <listitem>
20937 <para>
20938 <indexterm role="variable">
20939 <primary><varname>$smtp_active_hostname</varname></primary>
20940 </indexterm>
20941 During an incoming SMTP session, this variable contains the value of the active
20942 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
20943 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
20944 value can be consulted during routing and delivery.
20945 </para>
20946 </listitem></varlistentry>
20947 <varlistentry>
20948 <term><varname>$smtp_command</varname></term>
20949 <listitem>
20950 <para>
20951 <indexterm role="variable">
20952 <primary><varname>$smtp_command</varname></primary>
20953 </indexterm>
20954 During the processing of an incoming SMTP command, this variable contains the
20955 entire command. This makes it possible to distinguish between HELO and EHLO in
20956 the HELO ACL, and also to distinguish between commands such as these:
20957 </para>
20958 <literallayout class="monospaced">
20959 MAIL FROM:&lt;&gt;
20960 MAIL FROM: &lt;&gt;
20961 </literallayout>
20962 <para>
20963 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
20964 command, the address in <varname>$smtp_command</varname> is the original address before any
20965 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
20966 the address after SMTP-time rewriting.
20967 </para>
20968 </listitem></varlistentry>
20969 <varlistentry>
20970 <term><varname>$smtp_command_argument</varname></term>
20971 <listitem>
20972 <para>
20973 <indexterm role="concept">
20974 <primary>SMTP</primary>
20975 <secondary>command, argument for</secondary>
20976 </indexterm>
20977 <indexterm role="variable">
20978 <primary><varname>$smtp_command_argument</varname></primary>
20979 </indexterm>
20980 While an ACL is running to check an SMTP command, this variable contains the
20981 argument, that is, the text that follows the command name, with leading white
20982 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
20983 somewhat redundant, but is retained for backwards compatibility.
20984 </para>
20985 </listitem></varlistentry>
20986 <varlistentry>
20987 <term><varname>$smtp_command_history</varname></term>
20988 <listitem>
20989 <para>
20990 <indexterm role="concept">
20991 <primary>SMTP</primary>
20992 <secondary>command history</secondary>
20993 </indexterm>
20994 <indexterm role="variable">
20995 <primary><varname>$smtp_command_history</varname></primary>
20996 </indexterm>
20997 A comma-separated list (with no whitespace) of the most-recent SMTP commands
20998 received, in time-order left to right.  Only a limited number of commands
20999 are remembered.
21000 </para>
21001 </listitem></varlistentry>
21002 <varlistentry>
21003 <term><varname>$smtp_count_at_connection_start</varname></term>
21004 <listitem>
21005 <para>
21006 <indexterm role="variable">
21007 <primary><varname>$smtp_count_at_connection_start</varname></primary>
21008 </indexterm>
21009 This variable is set greater than zero only in processes spawned by the Exim
21010 daemon for handling incoming SMTP connections. The name is deliberately long,
21011 in order to emphasize what the contents are. When the daemon accepts a new
21012 connection, it increments this variable. A copy of the variable is passed to
21013 the child process that handles the connection, but its value is fixed, and
21014 never changes. It is only an approximation of how many incoming connections
21015 there actually are, because many other connections may come and go while a
21016 single connection is being processed. When a child process terminates, the
21017 daemon decrements its copy of the variable.
21018 </para>
21019 </listitem></varlistentry>
21020 <varlistentry>
21021 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
21022 <listitem>
21023 <para>
21024 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
21025 that were current at the end of the system filter file. This allows a system
21026 filter file to set values that can be tested in users&#x2019; filter files. For
21027 example, a system filter could set a value indicating how likely it is that a
21028 message is junk mail.
21029 </para>
21030 </listitem></varlistentry>
21031 <varlistentry>
21032 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
21033 <listitem>
21034 <para>
21035 A number of variables whose names start with <varname>$spam</varname> are available when Exim
21036 is compiled with the content-scanning extension. For details, see section
21037 <xref linkend="SECTscanspamass"/>.
21038 </para>
21039 </listitem></varlistentry>
21040 <varlistentry>
21041 <term><varname>$spf_header_comment</varname></term>
21042 <term><varname>$spf_received</varname></term>
21043 <term><varname>$spf_result</varname></term>
21044 <term><varname>$spf_result_guessed</varname></term>
21045 <term><varname>$spf_smtp_comment</varname></term>
21046 <listitem>
21047 <para>
21048 These variables are only available if Exim is built with SPF support.
21049 For details see section <xref linkend="SECSPF"/>.
21050 </para>
21051 </listitem></varlistentry>
21052 <varlistentry>
21053 <term><varname>$spool_directory</varname></term>
21054 <listitem>
21055 <para>
21056 <indexterm role="variable">
21057 <primary><varname>$spool_directory</varname></primary>
21058 </indexterm>
21059 The name of Exim&#x2019;s spool directory.
21060 </para>
21061 </listitem></varlistentry>
21062 <varlistentry>
21063 <term><varname>$spool_inodes</varname></term>
21064 <listitem>
21065 <para>
21066 <indexterm role="variable">
21067 <primary><varname>$spool_inodes</varname></primary>
21068 </indexterm>
21069 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
21070 being written. The value is recalculated whenever the variable is referenced.
21071 If the relevant file system does not have the concept of inodes, the value of
21072 is -1. See also the <option>check_spool_inodes</option> option.
21073 </para>
21074 </listitem></varlistentry>
21075 <varlistentry>
21076 <term><varname>$spool_space</varname></term>
21077 <listitem>
21078 <para>
21079 <indexterm role="variable">
21080 <primary><varname>$spool_space</varname></primary>
21081 </indexterm>
21082 The amount of free space (as a number of kilobytes) in the disk partition where
21083 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
21084 variable is referenced. If the operating system does not have the ability to
21085 find the amount of free space (only true for experimental systems), the space
21086 value is -1. For example, to check in an ACL that there is at least 50
21087 megabytes free on the spool, you could write:
21088 </para>
21089 <literallayout class="monospaced">
21090 condition = ${if &gt; {$spool_space}{50000}}
21091 </literallayout>
21092 <para>
21093 See also the <option>check_spool_space</option> option.
21094 </para>
21095 </listitem></varlistentry>
21096 <varlistentry>
21097 <term><varname>$thisaddress</varname></term>
21098 <listitem>
21099 <para>
21100 <indexterm role="variable">
21101 <primary><varname>$thisaddress</varname></primary>
21102 </indexterm>
21103 This variable is set only during the processing of the <option>foranyaddress</option>
21104 command in a filter file. Its use is explained in the description of that
21105 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
21106 interfaces to mail filtering</emphasis>.
21107 </para>
21108 </listitem></varlistentry>
21109 <varlistentry>
21110 <term><varname>$tls_in_bits</varname></term>
21111 <listitem>
21112 <para>
21113 <indexterm role="variable">
21114 <primary><varname>$tls_in_bits</varname></primary>
21115 </indexterm>
21116 Contains an approximation of the TLS cipher&#x2019;s bit-strength
21117 on the inbound connection; the meaning of
21118 this depends upon the TLS implementation used.
21119 If TLS has not been negotiated, the value will be 0.
21120 The value of this is automatically fed into the Cyrus SASL authenticator
21121 when acting as a server, to specify the "external SSF" (a SASL term).
21122 </para>
21123 <para>
21124 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
21125 except when used in the context of an outbound SMTP delivery, when it refers to
21126 the outbound.
21127 </para>
21128 </listitem></varlistentry>
21129 <varlistentry>
21130 <term><varname>$tls_out_bits</varname></term>
21131 <listitem>
21132 <para>
21133 <indexterm role="variable">
21134 <primary><varname>$tls_out_bits</varname></primary>
21135 </indexterm>
21136 Contains an approximation of the TLS cipher&#x2019;s bit-strength
21137 on an outbound SMTP connection; the meaning of
21138 this depends upon the TLS implementation used.
21139 If TLS has not been negotiated, the value will be 0.
21140 </para>
21141 </listitem></varlistentry>
21142 <varlistentry>
21143 <term><varname>$tls_in_ourcert</varname></term>
21144 <listitem>
21145 <para>
21146 <indexterm role="variable">
21147 <primary><varname>$tls_in_ourcert</varname></primary>
21148 </indexterm>
21149 <indexterm role="concept">
21150 <primary>certificate</primary>
21151 <secondary>variables</secondary>
21152 </indexterm>
21153 This variable refers to the certificate presented to the peer of an
21154 inbound connection when the message was received.
21155 It is only useful as the argument of a
21156 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21157 or a <option>def</option> condition.
21158 </para>
21159 <para>
21160 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
21161 when a list of more than one
21162 file is used for <option>tls_certificate</option>, this variable is not reliable.
21163 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
21164 </para>
21165 </listitem></varlistentry>
21166 <varlistentry>
21167 <term><varname>$tls_in_peercert</varname></term>
21168 <listitem>
21169 <para>
21170 <indexterm role="variable">
21171 <primary><varname>$tls_in_peercert</varname></primary>
21172 </indexterm>
21173 This variable refers to the certificate presented by the peer of an
21174 inbound connection when the message was received.
21175 It is only useful as the argument of a
21176 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21177 or a <option>def</option> condition.
21178 If certificate verification fails it may refer to a failing chain element
21179 which is not the leaf.
21180 </para>
21181 </listitem></varlistentry>
21182 <varlistentry>
21183 <term><varname>$tls_out_ourcert</varname></term>
21184 <listitem>
21185 <para>
21186 <indexterm role="variable">
21187 <primary><varname>$tls_out_ourcert</varname></primary>
21188 </indexterm>
21189 This variable refers to the certificate presented to the peer of an
21190 outbound connection.  It is only useful as the argument of a
21191 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21192 or a <option>def</option> condition.
21193 </para>
21194 </listitem></varlistentry>
21195 <varlistentry>
21196 <term><varname>$tls_out_peercert</varname></term>
21197 <listitem>
21198 <para>
21199 <indexterm role="variable">
21200 <primary><varname>$tls_out_peercert</varname></primary>
21201 </indexterm>
21202 This variable refers to the certificate presented by the peer of an
21203 outbound connection.  It is only useful as the argument of a
21204 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21205 or a <option>def</option> condition.
21206 If certificate verification fails it may refer to a failing chain element
21207 which is not the leaf.
21208 </para>
21209 </listitem></varlistentry>
21210 <varlistentry>
21211 <term><varname>$tls_in_certificate_verified</varname></term>
21212 <listitem>
21213 <para>
21214 <indexterm role="variable">
21215 <primary><varname>$tls_in_certificate_verified</varname></primary>
21216 </indexterm>
21217 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
21218 message was received, and <quote>0</quote> otherwise.
21219 </para>
21220 <para>
21221 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
21222 except when used in the context of an outbound SMTP delivery, when it refers to
21223 the outbound.
21224 </para>
21225 </listitem></varlistentry>
21226 <varlistentry>
21227 <term><varname>$tls_out_certificate_verified</varname></term>
21228 <listitem>
21229 <para>
21230 <indexterm role="variable">
21231 <primary><varname>$tls_out_certificate_verified</varname></primary>
21232 </indexterm>
21233 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
21234 outbound SMTP connection was made,
21235 and <quote>0</quote> otherwise.
21236 </para>
21237 </listitem></varlistentry>
21238 <varlistentry>
21239 <term><varname>$tls_in_cipher</varname></term>
21240 <listitem>
21241 <para>
21242 <indexterm role="variable">
21243 <primary><varname>$tls_in_cipher</varname></primary>
21244 </indexterm>
21245 <indexterm role="variable">
21246 <primary><varname>$tls_cipher</varname></primary>
21247 </indexterm>
21248 When a message is received from a remote host over an encrypted SMTP
21249 connection, this variable is set to the cipher suite that was negotiated, for
21250 example DES-CBC3-SHA. In other circumstances, in particular, for message
21251 received over unencrypted connections, the variable is empty. Testing
21252 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
21253 non-encrypted connections during ACL processing.
21254 </para>
21255 <para>
21256 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
21257 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
21258 becomes the same as <varname>$tls_out_cipher</varname>.
21259 </para>
21260 </listitem></varlistentry>
21261 <varlistentry>
21262 <term><varname>$tls_in_cipher_std</varname></term>
21263 <listitem>
21264 <para>
21265 <indexterm role="variable">
21266 <primary><varname>$tls_in_cipher_std</varname></primary>
21267 </indexterm>
21268 As above, but returning the RFC standard name for the cipher suite.
21269 </para>
21270 </listitem></varlistentry>
21271 <varlistentry>
21272 <term><varname>$tls_out_cipher</varname></term>
21273 <listitem>
21274 <para>
21275 <indexterm role="variable">
21276 <primary><varname>$tls_out_cipher</varname></primary>
21277 </indexterm>
21278 This variable is
21279 cleared before any outgoing SMTP connection is made,
21280 and then set to the outgoing cipher suite if one is negotiated. See chapter
21281 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
21282 details of the <command>smtp</command> transport.
21283 </para>
21284 </listitem></varlistentry>
21285 <varlistentry>
21286 <term><varname>$tls_out_cipher_std</varname></term>
21287 <listitem>
21288 <para>
21289 <indexterm role="variable">
21290 <primary><varname>$tls_out_cipher_std</varname></primary>
21291 </indexterm>
21292 As above, but returning the RFC standard name for the cipher suite.
21293 </para>
21294 </listitem></varlistentry>
21295 <varlistentry>
21296 <term><varname>$tls_out_dane</varname></term>
21297 <listitem>
21298 <para>
21299 <indexterm role="variable">
21300 <primary><varname>$tls_out_dane</varname></primary>
21301 </indexterm>
21302 DANE active status.  See section <xref linkend="SECDANE"/>.
21303 </para>
21304 </listitem></varlistentry>
21305 <varlistentry>
21306 <term><varname>$tls_in_ocsp</varname></term>
21307 <listitem>
21308 <para>
21309 <indexterm role="variable">
21310 <primary><varname>$tls_in_ocsp</varname></primary>
21311 </indexterm>
21312 When a message is received from a remote client connection
21313 the result of any OCSP request from the client is encoded in this variable:
21314 </para>
21315 <literallayout class="monospaced">
21316 0 OCSP proof was not requested (default value)
21317 1 No response to request
21318 2 Response not verified
21319 3 Verification failed
21320 4 Verification succeeded
21321 </literallayout>
21322 </listitem></varlistentry>
21323 <varlistentry>
21324 <term><varname>$tls_out_ocsp</varname></term>
21325 <listitem>
21326 <para>
21327 <indexterm role="variable">
21328 <primary><varname>$tls_out_ocsp</varname></primary>
21329 </indexterm>
21330 When a message is sent to a remote host connection
21331 the result of any OCSP request made is encoded in this variable.
21332 See <varname>$tls_in_ocsp</varname> for values.
21333 </para>
21334 </listitem></varlistentry>
21335 <varlistentry>
21336 <term><varname>$tls_in_peerdn</varname></term>
21337 <listitem>
21338 <para>
21339 <indexterm role="variable">
21340 <primary><varname>$tls_in_peerdn</varname></primary>
21341 </indexterm>
21342 <indexterm role="variable">
21343 <primary><varname>$tls_peerdn</varname></primary>
21344 </indexterm>
21345 <indexterm role="concept">
21346 <primary>certificate</primary>
21347 <secondary>extracting fields</secondary>
21348 </indexterm>
21349 When a message is received from a remote host over an encrypted SMTP
21350 connection, and Exim is configured to request a certificate from the client,
21351 the value of the Distinguished Name of the certificate is made available in the
21352 <varname>$tls_in_peerdn</varname> during subsequent processing.
21353 If certificate verification fails it may refer to a failing chain element
21354 which is not the leaf.
21355 </para>
21356 <para>
21357 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
21358 except when used in the context of an outbound SMTP delivery, when it refers to
21359 the outbound.
21360 </para>
21361 </listitem></varlistentry>
21362 <varlistentry>
21363 <term><varname>$tls_out_peerdn</varname></term>
21364 <listitem>
21365 <para>
21366 <indexterm role="variable">
21367 <primary><varname>$tls_out_peerdn</varname></primary>
21368 </indexterm>
21369 When a message is being delivered to a remote host over an encrypted SMTP
21370 connection, and Exim is configured to request a certificate from the server,
21371 the value of the Distinguished Name of the certificate is made available in the
21372 <varname>$tls_out_peerdn</varname> during subsequent processing.
21373 If certificate verification fails it may refer to a failing chain element
21374 which is not the leaf.
21375 </para>
21376 </listitem></varlistentry>
21377 <varlistentry>
21378 <term><varname>$tls_in_sni</varname></term>
21379 <listitem>
21380 <para>
21381 <indexterm role="variable">
21382 <primary><varname>$tls_in_sni</varname></primary>
21383 </indexterm>
21384 <indexterm role="variable">
21385 <primary><varname>$tls_sni</varname></primary>
21386 </indexterm>
21387 <indexterm role="concept">
21388 <primary>TLS</primary>
21389 <secondary>Server Name Indication</secondary>
21390 </indexterm>
21391 When a TLS session is being established, if the client sends the Server
21392 Name Indication extension, the value will be placed in this variable.
21393 If the variable appears in <option>tls_certificate</option> then this option and
21394 some others, described in <xref linkend="SECTtlssni"/>,
21395 will be re-expanded early in the TLS session, to permit
21396 a different certificate to be presented (and optionally a different key to be
21397 used) to the client, based upon the value of the SNI extension.
21398 </para>
21399 <para>
21400 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
21401 except when used in the context of an outbound SMTP delivery, when it refers to
21402 the outbound.
21403 </para>
21404 </listitem></varlistentry>
21405 <varlistentry>
21406 <term><varname>$tls_out_sni</varname></term>
21407 <listitem>
21408 <para>
21409 <indexterm role="variable">
21410 <primary><varname>$tls_out_sni</varname></primary>
21411 </indexterm>
21412 <indexterm role="concept">
21413 <primary>TLS</primary>
21414 <secondary>Server Name Indication</secondary>
21415 </indexterm>
21416 During outbound
21417 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
21418 the transport.
21419 </para>
21420 </listitem></varlistentry>
21421 <varlistentry>
21422 <term><varname>$tls_out_tlsa_usage</varname></term>
21423 <listitem>
21424 <para>
21425 <indexterm role="variable">
21426 <primary><varname>$tls_out_tlsa_usage</varname></primary>
21427 </indexterm>
21428 Bitfield of TLSA record types found.  See section <xref linkend="SECDANE"/>.
21429 </para>
21430 </listitem></varlistentry>
21431 <varlistentry>
21432 <term><varname>$tls_in_ver</varname></term>
21433 <listitem>
21434 <para>
21435 <indexterm role="variable">
21436 <primary><varname>$tls_in_ver</varname></primary>
21437 </indexterm>
21438 When a message is received from a remote host over an encrypted SMTP connection
21439 this variable is set to the protocol version, eg <emphasis>TLS1.2</emphasis>.
21440 </para>
21441 </listitem></varlistentry>
21442 <varlistentry>
21443 <term><varname>$tls_out_ver</varname></term>
21444 <listitem>
21445 <para>
21446 <indexterm role="variable">
21447 <primary><varname>$tls_out_ver</varname></primary>
21448 </indexterm>
21449 When a message is being delivered to a remote host over an encrypted SMTP connection
21450 this variable is set to the protocol version.
21451 </para>
21452 </listitem></varlistentry>
21453 <varlistentry>
21454 <term><varname>$tod_bsdinbox</varname></term>
21455 <listitem>
21456 <para>
21457 <indexterm role="variable">
21458 <primary><varname>$tod_bsdinbox</varname></primary>
21459 </indexterm>
21460 The time of day and the date, in the format required for BSD-style mailbox
21461 files, for example: Thu Oct 17 17:14:09 1995.
21462 </para>
21463 </listitem></varlistentry>
21464 <varlistentry>
21465 <term><varname>$tod_epoch</varname></term>
21466 <listitem>
21467 <para>
21468 <indexterm role="variable">
21469 <primary><varname>$tod_epoch</varname></primary>
21470 </indexterm>
21471 The time and date as a number of seconds since the start of the Unix epoch.
21472 </para>
21473 </listitem></varlistentry>
21474 <varlistentry>
21475 <term><varname>$tod_epoch_l</varname></term>
21476 <listitem>
21477 <para>
21478 <indexterm role="variable">
21479 <primary><varname>$tod_epoch_l</varname></primary>
21480 </indexterm>
21481 The time and date as a number of microseconds since the start of the Unix epoch.
21482 </para>
21483 </listitem></varlistentry>
21484 <varlistentry>
21485 <term><varname>$tod_full</varname></term>
21486 <listitem>
21487 <para>
21488 <indexterm role="variable">
21489 <primary><varname>$tod_full</varname></primary>
21490 </indexterm>
21491 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
21492 +0100. The timezone is always given as a numerical offset from UTC, with
21493 positive values used for timezones that are ahead (east) of UTC, and negative
21494 values for those that are behind (west).
21495 </para>
21496 </listitem></varlistentry>
21497 <varlistentry>
21498 <term><varname>$tod_log</varname></term>
21499 <listitem>
21500 <para>
21501 <indexterm role="variable">
21502 <primary><varname>$tod_log</varname></primary>
21503 </indexterm>
21504 The time and date in the format used for writing Exim&#x2019;s log files, for example:
21505 1995-10-12 15:32:29, but without a timezone.
21506 </para>
21507 </listitem></varlistentry>
21508 <varlistentry>
21509 <term><varname>$tod_logfile</varname></term>
21510 <listitem>
21511 <para>
21512 <indexterm role="variable">
21513 <primary><varname>$tod_logfile</varname></primary>
21514 </indexterm>
21515 This variable contains the date in the format yyyymmdd. This is the format that
21516 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
21517 flag.
21518 </para>
21519 </listitem></varlistentry>
21520 <varlistentry>
21521 <term><varname>$tod_zone</varname></term>
21522 <listitem>
21523 <para>
21524 <indexterm role="variable">
21525 <primary><varname>$tod_zone</varname></primary>
21526 </indexterm>
21527 This variable contains the numerical value of the local timezone, for example:
21528 -0500.
21529 </para>
21530 </listitem></varlistentry>
21531 <varlistentry>
21532 <term><varname>$tod_zulu</varname></term>
21533 <listitem>
21534 <para>
21535 <indexterm role="variable">
21536 <primary><varname>$tod_zulu</varname></primary>
21537 </indexterm>
21538 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
21539 by ISO 8601, for example: 20030221154023Z.
21540 </para>
21541 </listitem></varlistentry>
21542 <varlistentry>
21543 <term><varname>$transport_name</varname></term>
21544 <listitem>
21545 <para>
21546 <indexterm role="concept">
21547 <primary>transport</primary>
21548 <secondary>name</secondary>
21549 </indexterm>
21550 <indexterm role="concept">
21551 <primary>name</primary>
21552 <secondary>of transport</secondary>
21553 </indexterm>
21554 <indexterm role="variable">
21555 <primary><varname>$transport_name</varname></primary>
21556 </indexterm>
21557 During the running of a transport, this variable contains its name.
21558 </para>
21559 </listitem></varlistentry>
21560 <varlistentry>
21561 <term><varname>$value</varname></term>
21562 <listitem>
21563 <para>
21564 <indexterm role="variable">
21565 <primary><varname>$value</varname></primary>
21566 </indexterm>
21567 This variable contains the result of an expansion lookup, extraction operation,
21568 or external command, as described above. It is also used during a
21569 <emphasis role="bold">reduce</emphasis> expansion.
21570 </para>
21571 </listitem></varlistentry>
21572 <varlistentry>
21573 <term><varname>$verify_mode</varname></term>
21574 <listitem>
21575 <para>
21576 <indexterm role="variable">
21577 <primary><varname>$verify_mode</varname></primary>
21578 </indexterm>
21579 While a router or transport is being run in verify mode or for cutthrough delivery,
21580 contains "S" for sender-verification or "R" for recipient-verification.
21581 Otherwise, empty.
21582 </para>
21583 </listitem></varlistentry>
21584 <varlistentry>
21585 <term><varname>$version_number</varname></term>
21586 <listitem>
21587 <para>
21588 <indexterm role="variable">
21589 <primary><varname>$version_number</varname></primary>
21590 </indexterm>
21591 The version number of Exim. Same as <varname>$exim_version</varname>, may be overridden
21592 by the <option>exim_version</option> main config option.
21593 </para>
21594 </listitem></varlistentry>
21595 <varlistentry>
21596 <term><varname>$warn_message_delay</varname></term>
21597 <listitem>
21598 <para>
21599 <indexterm role="variable">
21600 <primary><varname>$warn_message_delay</varname></primary>
21601 </indexterm>
21602 This variable is set only during the creation of a message warning about a
21603 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
21604 </para>
21605 </listitem></varlistentry>
21606 <varlistentry>
21607 <term><varname>$warn_message_recipients</varname></term>
21608 <listitem>
21609 <para>
21610 <indexterm role="variable">
21611 <primary><varname>$warn_message_recipients</varname></primary>
21612 </indexterm>
21613 This variable is set only during the creation of a message warning about a
21614 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
21615 </para>
21616 </listitem></varlistentry>
21617 </variablelist>
21618 <para>
21619 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
21620 </para>
21621 </section>
21622 </chapter>
21623
21624 <chapter id="CHAPperl">
21625 <title>Embedded Perl</title>
21626 <para>
21627 <indexterm role="concept" id="IIDperl" class="startofrange">
21628 <primary>Perl</primary>
21629 <secondary>calling from Exim</secondary>
21630 </indexterm>
21631 Exim can be built to include an embedded Perl interpreter. When this is done,
21632 Perl subroutines can be called as part of the string expansion process. To make
21633 use of the Perl support, you need version 5.004 or later of Perl installed on
21634 your system. To include the embedded interpreter in the Exim binary, include
21635 the line
21636 </para>
21637 <literallayout class="monospaced">
21638 EXIM_PERL = perl.o
21639 </literallayout>
21640 <para>
21641 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
21642 </para>
21643 <section id="SECID85">
21644 <title>Setting up so Perl can be used</title>
21645 <para>
21646 <indexterm role="option">
21647 <primary><option>perl_startup</option></primary>
21648 </indexterm>
21649 Access to Perl subroutines is via a global configuration option called
21650 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
21651 no <option>perl_startup</option> option in the Exim configuration file then no Perl
21652 interpreter is started and there is almost no overhead for Exim (since none of
21653 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
21654 option then the associated value is taken to be Perl code which is executed in
21655 a newly created Perl interpreter.
21656 </para>
21657 <para>
21658 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
21659 need backslashes before any characters to escape special meanings. The option
21660 should usually be something like
21661 </para>
21662 <literallayout class="monospaced">
21663 perl_startup = do '/etc/exim.pl'
21664 </literallayout>
21665 <para>
21666 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
21667 use from Exim. Exim can be configured either to start up a Perl interpreter as
21668 soon as it is entered, or to wait until the first time it is needed. Starting
21669 the interpreter at the beginning ensures that it is done while Exim still has
21670 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
21671 fact used in a particular run. Also, note that this does not mean that Exim is
21672 necessarily running as root when Perl is called at a later time. By default,
21673 the interpreter is started only when it is needed, but this can be changed in
21674 two ways:
21675 </para>
21676 <itemizedlist>
21677 <listitem>
21678 <para>
21679 <indexterm role="option">
21680 <primary><option>perl_at_start</option></primary>
21681 </indexterm>
21682 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
21683 a startup when Exim is entered.
21684 </para>
21685 </listitem>
21686 <listitem>
21687 <para>
21688 The command line option <option>-ps</option> also requests a startup when Exim is entered,
21689 overriding the setting of <option>perl_at_start</option>.
21690 </para>
21691 </listitem>
21692 </itemizedlist>
21693 <para>
21694 There is also a command line option <option>-pd</option> (for delay) which suppresses the
21695 initial startup, even if <option>perl_at_start</option> is set.
21696 </para>
21697 <itemizedlist>
21698 <listitem>
21699 <para>
21700 <indexterm role="option">
21701 <primary><option>perl_taintmode</option></primary>
21702 </indexterm>
21703 <indexterm role="concept">
21704 <primary>Perl</primary>
21705 <secondary>taintmode</secondary>
21706 </indexterm>
21707 To provide more security executing Perl code via the embedded Perl
21708 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
21709 taint mode of the Perl interpreter. You are encouraged to set this
21710 option to a true value. To avoid breaking existing installations, it
21711 defaults to false.
21712 </para>
21713 </listitem>
21714 </itemizedlist>
21715 </section>
21716 <section id="SECID86">
21717 <title>Calling Perl subroutines</title>
21718 <para>
21719 When the configuration file includes a <option>perl_startup</option> option you can make use
21720 of the string expansion item to call the Perl subroutines that are defined
21721 by the <option>perl_startup</option> code. The operator is used in any of the following
21722 forms:
21723 </para>
21724 <literallayout class="monospaced">
21725 ${perl{foo}}
21726 ${perl{foo}{argument}}
21727 ${perl{foo}{argument1}{argument2} ... }
21728 </literallayout>
21729 <para>
21730 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
21731 arguments may be passed. Passing more than this results in an expansion failure
21732 with an error message of the form
21733 </para>
21734 <literallayout class="monospaced">
21735 Too many arguments passed to Perl subroutine "foo" (max is 8)
21736 </literallayout>
21737 <para>
21738 The return value of the Perl subroutine is evaluated in a scalar context before
21739 it is passed back to Exim to be inserted into the expanded string. If the
21740 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
21741 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
21742 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
21743 that was passed to <option>die</option>.
21744 </para>
21745 </section>
21746 <section id="SECID87">
21747 <title>Calling Exim functions from Perl</title>
21748 <para>
21749 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
21750 is available to call back into Exim&#x2019;s string expansion function. For example,
21751 the Perl code
21752 </para>
21753 <literallayout class="monospaced">
21754 my $lp = Exim::expand_string('$local_part');
21755 </literallayout>
21756 <para>
21757 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
21758 Note those are single quotes and not double quotes to protect against
21759 <varname>$local_part</varname> being interpolated as a Perl variable.
21760 </para>
21761 <para>
21762 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
21763 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
21764 expansion string, the Perl call from the original expansion string fails with
21765 an appropriate error message, in the same way as if <option>die</option> were used.
21766 </para>
21767 <para>
21768 <indexterm role="concept">
21769 <primary>debugging</primary>
21770 <secondary>from embedded Perl</secondary>
21771 </indexterm>
21772 <indexterm role="concept">
21773 <primary>log</primary>
21774 <secondary>writing from embedded Perl</secondary>
21775 </indexterm>
21776 Two other Exim functions are available for use from within Perl code.
21777 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
21778 debugging is enabled. If you want a newline at the end, you must supply it.
21779 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
21780 timestamp. In this case, you should not supply a terminating newline.
21781 </para>
21782 </section>
21783 <section id="SECID88">
21784 <title>Use of standard output and error by Perl</title>
21785 <para>
21786 <indexterm role="concept">
21787 <primary>Perl</primary>
21788 <secondary>standard output and error</secondary>
21789 </indexterm>
21790 You should not write to the standard error or output streams from within your
21791 Perl code, as it is not defined how these are set up. In versions of Exim
21792 before 4.50, it is possible for the standard output or error to refer to the
21793 SMTP connection during message reception via the daemon. Writing to this stream
21794 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
21795 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
21796 avoided, but the output is lost.
21797 </para>
21798 <para>
21799 <indexterm role="concept">
21800 <primary>Perl</primary>
21801 <secondary>use of <option>warn</option></secondary>
21802 </indexterm>
21803 The Perl <option>warn</option> statement writes to the standard error stream by default.
21804 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
21805 you have no control. When Exim starts up the Perl interpreter, it arranges for
21806 output from the <option>warn</option> statement to be written to the Exim main log. You can
21807 change this by including appropriate Perl magic somewhere in your Perl code.
21808 For example, to discard <option>warn</option> output completely, you need this:
21809 </para>
21810 <literallayout class="monospaced">
21811 $SIG{__WARN__} = sub { };
21812 </literallayout>
21813 <para>
21814 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
21815 example, the code for the subroutine is empty, so it does nothing, but you can
21816 include any Perl code that you like. The text of the <option>warn</option> message is passed
21817 as the first subroutine argument.
21818 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
21819 </para>
21820 </section>
21821 </chapter>
21822
21823 <chapter id="CHAPinterfaces">
21824 <title>Starting the daemon and the use of network interfaces</title>
21825 <titleabbrev>Starting the daemon</titleabbrev>
21826 <para>
21827 <indexterm role="concept">
21828 <primary>daemon</primary>
21829 <secondary>starting</secondary>
21830 </indexterm>
21831 <indexterm role="concept">
21832 <primary>interface</primary>
21833 <secondary>listening</secondary>
21834 </indexterm>
21835 <indexterm role="concept">
21836 <primary>network interface</primary>
21837 </indexterm>
21838 <indexterm role="concept">
21839 <primary>interface</primary>
21840 <secondary>network</secondary>
21841 </indexterm>
21842 <indexterm role="concept">
21843 <primary>IP address</primary>
21844 <secondary>for listening</secondary>
21845 </indexterm>
21846 <indexterm role="concept">
21847 <primary>daemon</primary>
21848 <secondary>listening IP addresses</secondary>
21849 </indexterm>
21850 <indexterm role="concept">
21851 <primary>TCP/IP</primary>
21852 <secondary>setting listening interfaces</secondary>
21853 </indexterm>
21854 <indexterm role="concept">
21855 <primary>TCP/IP</primary>
21856 <secondary>setting listening ports</secondary>
21857 </indexterm>
21858 A host that is connected to a TCP/IP network may have one or more physical
21859 hardware network interfaces. Each of these interfaces may be configured as one
21860 or more <quote>logical</quote> interfaces, which are the entities that a program actually
21861 works with. Each of these logical interfaces is associated with an IP address.
21862 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
21863 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
21864 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
21865 </para>
21866 <orderedlist numeration="arabic">
21867 <listitem>
21868 <para>
21869 When a listening daemon is started, Exim needs to know which interfaces
21870 and ports to listen on.
21871 </para>
21872 </listitem>
21873 <listitem>
21874 <para>
21875 When Exim is routing an address, it needs to know which IP addresses
21876 are associated with local interfaces. This is required for the correct
21877 processing of MX lists by removing the local host and others with the
21878 same or higher priority values. Also, Exim needs to detect cases
21879 when an address is routed to an IP address that in fact belongs to the
21880 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
21881 option of the smtp transport is set (as appropriate), this is treated
21882 as an error situation.
21883 </para>
21884 </listitem>
21885 <listitem>
21886 <para>
21887 When Exim connects to a remote host, it may need to know which interface to use
21888 for the outgoing connection.
21889 </para>
21890 </listitem>
21891 </orderedlist>
21892 <para>
21893 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
21894 of cases. If your host has only one interface, and you want all its IP
21895 addresses to be treated in the same way, and you are using only the
21896 standard SMTP port, you should not need to take any special action. The
21897 rest of this chapter does not apply to you.
21898 </para>
21899 <para>
21900 In a more complicated situation you may want to listen only on certain
21901 interfaces, or on different ports, and for this reason there are a number of
21902 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
21903 chapter describes how they operate.
21904 </para>
21905 <para>
21906 When a message is received over TCP/IP, the interface and port that were
21907 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
21908 </para>
21909 <section id="SECID89">
21910 <title>Starting a listening daemon</title>
21911 <para>
21912 When a listening daemon is started (by means of the <option>-bd</option> command line
21913 option), the interfaces and ports on which it listens are controlled by the
21914 following options:
21915 </para>
21916 <itemizedlist>
21917 <listitem>
21918 <para>
21919 <option>daemon_smtp_ports</option> contains a list of default ports
21920 or service names.
21921 (For backward compatibility, this option can also be specified in the singular.)
21922 </para>
21923 </listitem>
21924 <listitem>
21925 <para>
21926 <option>local_interfaces</option> contains list of interface IP addresses on which to
21927 listen. Each item may optionally also specify a port.
21928 </para>
21929 </listitem>
21930 </itemizedlist>
21931 <para>
21932 The default list separator in both cases is a colon, but this can be changed as
21933 described in section <xref linkend="SECTlistsepchange"/>. When IPv6 addresses are involved,
21934 it is usually best to change the separator to avoid having to double all the
21935 colons. For example:
21936 </para>
21937 <literallayout class="monospaced">
21938 local_interfaces = &lt;; 127.0.0.1 ; \
21939                       192.168.23.65 ; \
21940                       ::1 ; \
21941                       3ffe:ffff:836f::fe86:a061
21942 </literallayout>
21943 <para>
21944 There are two different formats for specifying a port along with an IP address
21945 in <option>local_interfaces</option>:
21946 </para>
21947 <orderedlist numeration="arabic">
21948 <listitem>
21949 <para>
21950 The port is added onto the address with a dot separator. For example, to listen
21951 on port 1234 on two different IP addresses:
21952 </para>
21953 <literallayout class="monospaced">
21954 local_interfaces = &lt;; 192.168.23.65.1234 ; \
21955                       3ffe:ffff:836f::fe86:a061.1234
21956 </literallayout>
21957 </listitem>
21958 <listitem>
21959 <para>
21960 The IP address is enclosed in square brackets, and the port is added
21961 with a colon separator, for example:
21962 </para>
21963 <literallayout class="monospaced">
21964 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
21965                       [3ffe:ffff:836f::fe86:a061]:1234
21966 </literallayout>
21967 </listitem>
21968 </orderedlist>
21969 <para>
21970 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
21971 default setting contains just one port:
21972 </para>
21973 <literallayout class="monospaced">
21974 daemon_smtp_ports = smtp
21975 </literallayout>
21976 <para>
21977 If more than one port is listed, each interface that does not have its own port
21978 specified listens on all of them. Ports that are listed in
21979 <option>daemon_smtp_ports</option> can be identified either by name (defined in
21980 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
21981 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
21982 </para>
21983 </section>
21984 <section id="SECID90">
21985 <title>Special IP listening addresses</title>
21986 <para>
21987 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
21988 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
21989 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
21990 instead of setting up separate listening sockets for each interface. The
21991 default value of <option>local_interfaces</option> is
21992 </para>
21993 <literallayout class="monospaced">
21994 local_interfaces = 0.0.0.0
21995 </literallayout>
21996 <para>
21997 when Exim is built without IPv6 support; otherwise it is:
21998 </para>
21999 <literallayout class="monospaced">
22000 local_interfaces = &lt;; ::0 ; 0.0.0.0
22001 </literallayout>
22002 <para>
22003 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
22004 </para>
22005 </section>
22006 <section id="SECID91">
22007 <title>Overriding local_interfaces and daemon_smtp_ports</title>
22008 <para>
22009 The <option>-oX</option> command line option can be used to override the values of
22010 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
22011 instance. Another way of doing this would be to use macros and the <option>-D</option>
22012 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
22013 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
22014 exim.
22015 </para>
22016 <para>
22017 The value of <option>-oX</option> is a list of items. The default colon separator can be
22018 changed in the usual way (<xref linkend="SECTlistsepchange"/>) if required.
22019 If there are any items that do not
22020 contain dots or colons (that is, are not IP addresses), the value of
22021 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
22022 items that do contain dots or colons, the value of <option>local_interfaces</option> is
22023 replaced by those items. Thus, for example,
22024 </para>
22025 <literallayout class="monospaced">
22026 -oX 1225
22027 </literallayout>
22028 <para>
22029 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
22030 whereas
22031 </para>
22032 <literallayout class="monospaced">
22033 -oX 192.168.34.5.1125
22034 </literallayout>
22035 <para>
22036 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
22037 (However, since <option>local_interfaces</option> now contains no items without ports, the
22038 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
22039 </para>
22040 </section>
22041 <section id="SECTsupobssmt">
22042 <title>Support for the submissions (aka SSMTP or SMTPS) protocol</title>
22043 <para>
22044 <indexterm role="concept">
22045 <primary>submissions protocol</primary>
22046 </indexterm>
22047 <indexterm role="concept">
22048 <primary>ssmtp protocol</primary>
22049 </indexterm>
22050 <indexterm role="concept">
22051 <primary>smtps protocol</primary>
22052 </indexterm>
22053 <indexterm role="concept">
22054 <primary>SMTP</primary>
22055 <secondary>ssmtp protocol</secondary>
22056 </indexterm>
22057 <indexterm role="concept">
22058 <primary>SMTP</primary>
22059 <secondary>smtps protocol</secondary>
22060 </indexterm>
22061 Exim supports the use of TLS-on-connect, used by mail clients in the
22062 <quote>submissions</quote> protocol, historically also known as SMTPS or SSMTP.
22063 For some years, IETF Standards Track documents only blessed the
22064 STARTTLS-based Submission service (port 587) while common practice was to support
22065 the same feature set on port 465, but using TLS-on-connect.
22066 If your installation needs to provide service to mail clients
22067 (Mail User Agents, MUAs) then you should provide service on both the 587 and
22068 the 465 TCP ports.
22069 </para>
22070 <para>
22071 If the <option>tls_on_connect_ports</option> option is set to a list of port numbers or
22072 service names, connections to those ports must first establish TLS, before
22073 proceeding to the application layer use of the SMTP protocol.
22074 </para>
22075 <para>
22076 The common use of this option is expected to be
22077 </para>
22078 <literallayout class="monospaced">
22079 tls_on_connect_ports = 465
22080 </literallayout>
22081 <para>
22082 per RFC 8314.
22083 There is also a command line option <option>-tls-on-connect</option>, which forces all ports
22084 to behave in this way when a daemon is started.
22085 </para>
22086 <para>
22087 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
22088 daemon to listen on those ports. You must still specify them in
22089 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
22090 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
22091 connections via the daemon.)
22092 </para>
22093 </section>
22094 <section id="SECID92">
22095 <title>IPv6 address scopes</title>
22096 <para>
22097 <indexterm role="concept">
22098 <primary>IPv6</primary>
22099 <secondary>address scopes</secondary>
22100 </indexterm>
22101 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
22102 can, in principle, have the same link-local IPv6 address on different
22103 interfaces. Thus, additional information is needed, over and above the IP
22104 address, to distinguish individual interfaces. A convention of using a
22105 percent sign followed by something (often the interface name) has been
22106 adopted in some cases, leading to addresses like this:
22107 </para>
22108 <literallayout class="monospaced">
22109 fe80::202:b3ff:fe03:45c1%eth0
22110 </literallayout>
22111 <para>
22112 To accommodate this usage, a percent sign followed by an arbitrary string is
22113 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
22114 to convert a textual IPv6 address for actual use. This function recognizes the
22115 percent convention in operating systems that support it, and it processes the
22116 address appropriately. Unfortunately, some older libraries have problems with
22117 <function>getaddrinfo()</function>. If
22118 </para>
22119 <literallayout class="monospaced">
22120 IPV6_USE_INET_PTON=yes
22121 </literallayout>
22122 <para>
22123 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
22124 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
22125 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
22126 function.) Of course, this means that the additional functionality of
22127 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
22128 </para>
22129 </section>
22130 <section id="SECID93">
22131 <title>Disabling IPv6</title>
22132 <para>
22133 <indexterm role="concept">
22134 <primary>IPv6</primary>
22135 <secondary>disabling</secondary>
22136 </indexterm>
22137 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
22138 run on a host whose kernel does not support IPv6. The binary will fall back to
22139 using IPv4, but it may waste resources looking up AAAA records, and trying to
22140 connect to IPv6 addresses, causing delays to mail delivery. If you set the
22141 <indexterm role="option">
22142 <primary><option>disable_ipv6</option></primary>
22143 </indexterm>
22144 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
22145 activities take place. AAAA records are never looked up, and any IPv6 addresses
22146 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
22147 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
22148 to handle IPv6 literal addresses.
22149 </para>
22150 <para>
22151 On the other hand, when IPv6 is in use, there may be times when you want to
22152 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
22153 option to globally suppress the lookup of AAAA records for specified domains,
22154 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
22155 IPv6 addresses in an individual router.
22156 </para>
22157 </section>
22158 <section id="SECID94">
22159 <title>Examples of starting a listening daemon</title>
22160 <para>
22161 The default case in an IPv6 environment is
22162 </para>
22163 <literallayout class="monospaced">
22164 daemon_smtp_ports = smtp
22165 local_interfaces = &lt;; ::0 ; 0.0.0.0
22166 </literallayout>
22167 <para>
22168 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
22169 Either one or two sockets may be used, depending on the characteristics of
22170 the TCP/IP stack. (This is complicated and messy; for more information,
22171 read the comments in the <filename>daemon.c</filename> source file.)
22172 </para>
22173 <para>
22174 To specify listening on ports 25 and 26 on all interfaces:
22175 </para>
22176 <literallayout class="monospaced">
22177 daemon_smtp_ports = 25 : 26
22178 </literallayout>
22179 <para>
22180 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
22181 </para>
22182 <literallayout class="monospaced">
22183 local_interfaces = &lt;; ::0.25     ; ::0.26 \
22184                       0.0.0.0.25 ; 0.0.0.0.26
22185 </literallayout>
22186 <para>
22187 To listen on the default port on all IPv4 interfaces, and on port 26 on the
22188 IPv4 loopback address only:
22189 </para>
22190 <literallayout class="monospaced">
22191 local_interfaces = 0.0.0.0 : 127.0.0.1.26
22192 </literallayout>
22193 <para>
22194 To specify listening on the default port on specific interfaces only:
22195 </para>
22196 <literallayout class="monospaced">
22197 local_interfaces = 10.0.0.67 : 192.168.34.67
22198 </literallayout>
22199 <para>
22200 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
22201 </para>
22202 </section>
22203 <section id="SECTreclocipadd">
22204 <title>Recognizing the local host</title>
22205 <para>
22206 The <option>local_interfaces</option> option is also used when Exim needs to determine
22207 whether or not an IP address refers to the local host. That is, the IP
22208 addresses of all the interfaces on which a daemon is listening are always
22209 treated as local.
22210 </para>
22211 <para>
22212 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
22213 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
22214 available interfaces from the operating system, and extracts the relevant
22215 (that is, IPv4 or IPv6) addresses to use for checking.
22216 </para>
22217 <para>
22218 Some systems set up large numbers of virtual interfaces in order to provide
22219 many virtual web servers. In this situation, you may want to listen for
22220 email on only a few of the available interfaces, but nevertheless treat all
22221 interfaces as local when routing. You can do this by setting
22222 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
22223 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
22224 used for listening. Consider this example:
22225 </para>
22226 <literallayout class="monospaced">
22227 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
22228                       192.168.53.235 ; \
22229                       3ffe:2101:12:1:a00:20ff:fe86:a061
22230
22231 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
22232 </literallayout>
22233 <para>
22234 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
22235 address, but all available interface addresses are treated as local when
22236 Exim is routing.
22237 </para>
22238 <para>
22239 In some environments the local host name may be in an MX list, but with an IP
22240 address that is not assigned to any local interface. In other cases it may be
22241 desirable to treat other host names as if they referred to the local host. Both
22242 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
22243 This contains host names rather than IP addresses. When a host is referenced
22244 during routing, either via an MX record or directly, it is treated as the local
22245 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
22246 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
22247 </para>
22248 </section>
22249 <section id="SECID95">
22250 <title>Delivering to a remote host</title>
22251 <para>
22252 Delivery to a remote host is handled by the smtp transport. By default, it
22253 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
22254 there is more than one) when connecting to a remote host. However, the
22255 <option>interface</option> option can be set to specify which interface is used. See the
22256 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
22257 details.
22258 </para>
22259 </section>
22260 </chapter>
22261
22262 <chapter id="CHAPmainconfig">
22263 <title>Main configuration</title>
22264 <para>
22265 <indexterm role="concept" id="IIDconfima" class="startofrange">
22266 <primary>configuration file</primary>
22267 <secondary>main section</secondary>
22268 </indexterm>
22269 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
22270 <primary>main configuration</primary>
22271 </indexterm>
22272 The first part of the runtime configuration file contains three types of item:
22273 </para>
22274 <itemizedlist>
22275 <listitem>
22276 <para>
22277 Macro definitions: These lines start with an upper case letter. See section
22278 <xref linkend="SECTmacrodefs"/> for details of macro processing.
22279 </para>
22280 </listitem>
22281 <listitem>
22282 <para>
22283 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
22284 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
22285 section <xref linkend="SECTnamedlists"/>.
22286 </para>
22287 </listitem>
22288 <listitem>
22289 <para>
22290 Main configuration settings: Each setting occupies one line of the file
22291 (with possible continuations). If any setting is preceded by the word
22292 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
22293 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
22294 settings.
22295 </para>
22296 </listitem>
22297 </itemizedlist>
22298 <para>
22299 This chapter specifies all the main configuration options, along with their
22300 types and default values. For ease of finding a particular option, they appear
22301 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
22302 are now so many options, they are first listed briefly in functional groups, as
22303 an aid to finding the name of the option you are looking for. Some options are
22304 listed in more than one group.
22305 </para>
22306 <section id="SECID96">
22307 <title>Miscellaneous</title>
22308 <informaltable frame="none">
22309 <tgroup cols="2" colsep="0" rowsep="0">
22310 <colspec colwidth="196pt" align="left"/>
22311 <colspec colwidth="254pt" align="left"/>
22312 <tbody>
22313 <row>
22314 <entry><option>bi_command</option></entry>
22315 <entry>to run for <option>-bi</option> command line option</entry>
22316 </row>
22317 <row>
22318 <entry><option>debug_store</option></entry>
22319 <entry>do extra internal checks</entry>
22320 </row>
22321 <row>
22322 <entry><option>disable_ipv6</option></entry>
22323 <entry>do no IPv6 processing</entry>
22324 </row>
22325 <row>
22326 <entry><option>keep_malformed</option></entry>
22327 <entry>for broken files &ndash; should not happen</entry>
22328 </row>
22329 <row>
22330 <entry><option>localhost_number</option></entry>
22331 <entry>for unique message ids in clusters</entry>
22332 </row>
22333 <row>
22334 <entry><option>message_body_newlines</option></entry>
22335 <entry>retain newlines in <varname>$message_body</varname></entry>
22336 </row>
22337 <row>
22338 <entry><option>message_body_visible</option></entry>
22339 <entry>how much to show in <varname>$message_body</varname></entry>
22340 </row>
22341 <row>
22342 <entry><option>mua_wrapper</option></entry>
22343 <entry>run in <quote>MUA wrapper</quote> mode</entry>
22344 </row>
22345 <row>
22346 <entry><option>print_topbitchars</option></entry>
22347 <entry>top-bit characters are printing</entry>
22348 </row>
22349 <row>
22350 <entry><option>spool_wireformat</option></entry>
22351 <entry>use wire-format spool data files when possible</entry>
22352 </row>
22353 <row>
22354 <entry><option>timezone</option></entry>
22355 <entry>force time zone</entry>
22356 </row>
22357 </tbody>
22358 </tgroup>
22359 </informaltable>
22360 </section>
22361 <section id="SECID97">
22362 <title>Exim parameters</title>
22363 <informaltable frame="none">
22364 <tgroup cols="2" colsep="0" rowsep="0">
22365 <colspec colwidth="196pt" align="left"/>
22366 <colspec colwidth="254pt" align="left"/>
22367 <tbody>
22368 <row>
22369 <entry><option>exim_group</option></entry>
22370 <entry>override compiled-in value</entry>
22371 </row>
22372 <row>
22373 <entry><option>exim_path</option></entry>
22374 <entry>override compiled-in value</entry>
22375 </row>
22376 <row>
22377 <entry><option>exim_user</option></entry>
22378 <entry>override compiled-in value</entry>
22379 </row>
22380 <row>
22381 <entry><option>primary_hostname</option></entry>
22382 <entry>default from <function>uname()</function></entry>
22383 </row>
22384 <row>
22385 <entry><option>split_spool_directory</option></entry>
22386 <entry>use multiple directories</entry>
22387 </row>
22388 <row>
22389 <entry><option>spool_directory</option></entry>
22390 <entry>override compiled-in value</entry>
22391 </row>
22392 </tbody>
22393 </tgroup>
22394 </informaltable>
22395 </section>
22396 <section id="SECID98">
22397 <title>Privilege controls</title>
22398 <informaltable frame="none">
22399 <tgroup cols="2" colsep="0" rowsep="0">
22400 <colspec colwidth="196pt" align="left"/>
22401 <colspec colwidth="254pt" align="left"/>
22402 <tbody>
22403 <row>
22404 <entry><option>admin_groups</option></entry>
22405 <entry>groups that are Exim admin users</entry>
22406 </row>
22407 <row>
22408 <entry><option>commandline_checks_require_admin</option></entry>
22409 <entry>require admin for various checks</entry>
22410 </row>
22411 <row>
22412 <entry><option>deliver_drop_privilege</option></entry>
22413 <entry>drop root for delivery processes</entry>
22414 </row>
22415 <row>
22416 <entry><option>local_from_check</option></entry>
22417 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
22418 </row>
22419 <row>
22420 <entry><option>local_from_prefix</option></entry>
22421 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
22422 </row>
22423 <row>
22424 <entry><option>local_from_suffix</option></entry>
22425 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
22426 </row>
22427 <row>
22428 <entry><option>local_sender_retain</option></entry>
22429 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
22430 </row>
22431 <row>
22432 <entry><option>never_users</option></entry>
22433 <entry>do not run deliveries as these</entry>
22434 </row>
22435 <row>
22436 <entry><option>prod_requires_admin</option></entry>
22437 <entry>forced delivery requires admin user</entry>
22438 </row>
22439 <row>
22440 <entry><option>queue_list_requires_admin</option></entry>
22441 <entry>queue listing requires admin user</entry>
22442 </row>
22443 <row>
22444 <entry><option>trusted_groups</option></entry>
22445 <entry>groups that are trusted</entry>
22446 </row>
22447 <row>
22448 <entry><option>trusted_users</option></entry>
22449 <entry>users that are trusted</entry>
22450 </row>
22451 </tbody>
22452 </tgroup>
22453 </informaltable>
22454 </section>
22455 <section id="SECID99">
22456 <title>Logging</title>
22457 <informaltable frame="none">
22458 <tgroup cols="2" colsep="0" rowsep="0">
22459 <colspec colwidth="196pt" align="left"/>
22460 <colspec colwidth="254pt" align="left"/>
22461 <tbody>
22462 <row>
22463 <entry><option>event_action</option></entry>
22464 <entry>custom logging</entry>
22465 </row>
22466 <row>
22467 <entry><option>hosts_connection_nolog</option></entry>
22468 <entry>exemption from connect logging</entry>
22469 </row>
22470 <row>
22471 <entry><option>log_file_path</option></entry>
22472 <entry>override compiled-in value</entry>
22473 </row>
22474 <row>
22475 <entry><option>log_selector</option></entry>
22476 <entry>set/unset optional logging</entry>
22477 </row>
22478 <row>
22479 <entry><option>log_timezone</option></entry>
22480 <entry>add timezone to log lines</entry>
22481 </row>
22482 <row>
22483 <entry><option>message_logs</option></entry>
22484 <entry>create per-message logs</entry>
22485 </row>
22486 <row>
22487 <entry><option>preserve_message_logs</option></entry>
22488 <entry>after message completion</entry>
22489 </row>
22490 <row>
22491 <entry><option>process_log_path</option></entry>
22492 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
22493 </row>
22494 <row>
22495 <entry><option>slow_lookup_log</option></entry>
22496 <entry>control logging of slow DNS lookups</entry>
22497 </row>
22498 <row>
22499 <entry><option>syslog_duplication</option></entry>
22500 <entry>controls duplicate log lines on syslog</entry>
22501 </row>
22502 <row>
22503 <entry><option>syslog_facility</option></entry>
22504 <entry>set syslog <quote>facility</quote> field</entry>
22505 </row>
22506 <row>
22507 <entry><option>syslog_pid</option></entry>
22508 <entry>pid in syslog lines</entry>
22509 </row>
22510 <row>
22511 <entry><option>syslog_processname</option></entry>
22512 <entry>set syslog <quote>ident</quote> field</entry>
22513 </row>
22514 <row>
22515 <entry><option>syslog_timestamp</option></entry>
22516 <entry>timestamp syslog lines</entry>
22517 </row>
22518 <row>
22519 <entry><option>write_rejectlog</option></entry>
22520 <entry>control use of message log</entry>
22521 </row>
22522 </tbody>
22523 </tgroup>
22524 </informaltable>
22525 </section>
22526 <section id="SECID100">
22527 <title>Frozen messages</title>
22528 <informaltable frame="none">
22529 <tgroup cols="2" colsep="0" rowsep="0">
22530 <colspec colwidth="196pt" align="left"/>
22531 <colspec colwidth="254pt" align="left"/>
22532 <tbody>
22533 <row>
22534 <entry><option>auto_thaw</option></entry>
22535 <entry>sets time for retrying frozen messages</entry>
22536 </row>
22537 <row>
22538 <entry><option>freeze_tell</option></entry>
22539 <entry>send message when freezing</entry>
22540 </row>
22541 <row>
22542 <entry><option>move_frozen_messages</option></entry>
22543 <entry>to another directory</entry>
22544 </row>
22545 <row>
22546 <entry><option>timeout_frozen_after</option></entry>
22547 <entry>keep frozen messages only so long</entry>
22548 </row>
22549 </tbody>
22550 </tgroup>
22551 </informaltable>
22552 </section>
22553 <section id="SECID101">
22554 <title>Data lookups</title>
22555 <informaltable frame="none">
22556 <tgroup cols="2" colsep="0" rowsep="0">
22557 <colspec colwidth="196pt" align="left"/>
22558 <colspec colwidth="254pt" align="left"/>
22559 <tbody>
22560 <row>
22561 <entry><option>ibase_servers</option></entry>
22562 <entry>InterBase servers</entry>
22563 </row>
22564 <row>
22565 <entry><option>ldap_ca_cert_dir</option></entry>
22566 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
22567 </row>
22568 <row>
22569 <entry><option>ldap_ca_cert_file</option></entry>
22570 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
22571 </row>
22572 <row>
22573 <entry><option>ldap_cert_file</option></entry>
22574 <entry>client cert file for LDAP</entry>
22575 </row>
22576 <row>
22577 <entry><option>ldap_cert_key</option></entry>
22578 <entry>client key file for LDAP</entry>
22579 </row>
22580 <row>
22581 <entry><option>ldap_cipher_suite</option></entry>
22582 <entry>TLS negotiation preference control</entry>
22583 </row>
22584 <row>
22585 <entry><option>ldap_default_servers</option></entry>
22586 <entry>used if no server in query</entry>
22587 </row>
22588 <row>
22589 <entry><option>ldap_require_cert</option></entry>
22590 <entry>action to take without LDAP server cert</entry>
22591 </row>
22592 <row>
22593 <entry><option>ldap_start_tls</option></entry>
22594 <entry>require TLS within LDAP</entry>
22595 </row>
22596 <row>
22597 <entry><option>ldap_version</option></entry>
22598 <entry>set protocol version</entry>
22599 </row>
22600 <row>
22601 <entry><option>lookup_open_max</option></entry>
22602 <entry>lookup files held open</entry>
22603 </row>
22604 <row>
22605 <entry><option>mysql_servers</option></entry>
22606 <entry>default MySQL servers</entry>
22607 </row>
22608 <row>
22609 <entry><option>oracle_servers</option></entry>
22610 <entry>Oracle servers</entry>
22611 </row>
22612 <row>
22613 <entry><option>pgsql_servers</option></entry>
22614 <entry>default PostgreSQL servers</entry>
22615 </row>
22616 <row>
22617 <entry><option>sqlite_lock_timeout</option></entry>
22618 <entry>as it says</entry>
22619 </row>
22620 </tbody>
22621 </tgroup>
22622 </informaltable>
22623 </section>
22624 <section id="SECID102">
22625 <title>Message ids</title>
22626 <informaltable frame="none">
22627 <tgroup cols="2" colsep="0" rowsep="0">
22628 <colspec colwidth="196pt" align="left"/>
22629 <colspec colwidth="254pt" align="left"/>
22630 <tbody>
22631 <row>
22632 <entry><option>message_id_header_domain</option></entry>
22633 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
22634 </row>
22635 <row>
22636 <entry><option>message_id_header_text</option></entry>
22637 <entry>ditto</entry>
22638 </row>
22639 </tbody>
22640 </tgroup>
22641 </informaltable>
22642 </section>
22643 <section id="SECID103">
22644 <title>Embedded Perl Startup</title>
22645 <informaltable frame="none">
22646 <tgroup cols="2" colsep="0" rowsep="0">
22647 <colspec colwidth="196pt" align="left"/>
22648 <colspec colwidth="254pt" align="left"/>
22649 <tbody>
22650 <row>
22651 <entry><option>perl_at_start</option></entry>
22652 <entry>always start the interpreter</entry>
22653 </row>
22654 <row>
22655 <entry><option>perl_startup</option></entry>
22656 <entry>code to obey when starting Perl</entry>
22657 </row>
22658 <row>
22659 <entry><option>perl_taintmode</option></entry>
22660 <entry>enable taint mode in Perl</entry>
22661 </row>
22662 </tbody>
22663 </tgroup>
22664 </informaltable>
22665 </section>
22666 <section id="SECID104">
22667 <title>Daemon</title>
22668 <informaltable frame="none">
22669 <tgroup cols="2" colsep="0" rowsep="0">
22670 <colspec colwidth="196pt" align="left"/>
22671 <colspec colwidth="254pt" align="left"/>
22672 <tbody>
22673 <row>
22674 <entry><option>daemon_smtp_ports</option></entry>
22675 <entry>default ports</entry>
22676 </row>
22677 <row>
22678 <entry><option>daemon_startup_retries</option></entry>
22679 <entry>number of times to retry</entry>
22680 </row>
22681 <row>
22682 <entry><option>daemon_startup_sleep</option></entry>
22683 <entry>time to sleep between tries</entry>
22684 </row>
22685 <row>
22686 <entry><option>extra_local_interfaces</option></entry>
22687 <entry>not necessarily listened on</entry>
22688 </row>
22689 <row>
22690 <entry><option>local_interfaces</option></entry>
22691 <entry>on which to listen, with optional ports</entry>
22692 </row>
22693 <row>
22694 <entry><option>notifier_socket</option></entry>
22695 <entry>override compiled-in value</entry>
22696 </row>
22697 <row>
22698 <entry><option>pid_file_path</option></entry>
22699 <entry>override compiled-in value</entry>
22700 </row>
22701 <row>
22702 <entry><option>queue_run_max</option></entry>
22703 <entry>maximum simultaneous queue runners</entry>
22704 </row>
22705 </tbody>
22706 </tgroup>
22707 </informaltable>
22708 </section>
22709 <section id="SECID105">
22710 <title>Resource control</title>
22711 <informaltable frame="none">
22712 <tgroup cols="2" colsep="0" rowsep="0">
22713 <colspec colwidth="196pt" align="left"/>
22714 <colspec colwidth="254pt" align="left"/>
22715 <tbody>
22716 <row>
22717 <entry><option>check_log_inodes</option></entry>
22718 <entry>before accepting a message</entry>
22719 </row>
22720 <row>
22721 <entry><option>check_log_space</option></entry>
22722 <entry>before accepting a message</entry>
22723 </row>
22724 <row>
22725 <entry><option>check_spool_inodes</option></entry>
22726 <entry>before accepting a message</entry>
22727 </row>
22728 <row>
22729 <entry><option>check_spool_space</option></entry>
22730 <entry>before accepting a message</entry>
22731 </row>
22732 <row>
22733 <entry><option>deliver_queue_load_max</option></entry>
22734 <entry>no queue deliveries if load high</entry>
22735 </row>
22736 <row>
22737 <entry><option>queue_only_load</option></entry>
22738 <entry>queue incoming if load high</entry>
22739 </row>
22740 <row>
22741 <entry><option>queue_only_load_latch</option></entry>
22742 <entry>don&#x2019;t re-evaluate load for each message</entry>
22743 </row>
22744 <row>
22745 <entry><option>queue_run_max</option></entry>
22746 <entry>maximum simultaneous queue runners</entry>
22747 </row>
22748 <row>
22749 <entry><option>remote_max_parallel</option></entry>
22750 <entry>parallel SMTP delivery per message</entry>
22751 </row>
22752 <row>
22753 <entry><option>smtp_accept_max</option></entry>
22754 <entry>simultaneous incoming connections</entry>
22755 </row>
22756 <row>
22757 <entry><option>smtp_accept_max_nonmail</option></entry>
22758 <entry>non-mail commands</entry>
22759 </row>
22760 <row>
22761 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
22762 <entry>hosts to which the limit applies</entry>
22763 </row>
22764 <row>
22765 <entry><option>smtp_accept_max_per_connection</option></entry>
22766 <entry>messages per connection</entry>
22767 </row>
22768 <row>
22769 <entry><option>smtp_accept_max_per_host</option></entry>
22770 <entry>connections from one host</entry>
22771 </row>
22772 <row>
22773 <entry><option>smtp_accept_queue</option></entry>
22774 <entry>queue mail if more connections</entry>
22775 </row>
22776 <row>
22777 <entry><option>smtp_accept_queue_per_connection</option></entry>
22778 <entry>queue if more messages per connection</entry>
22779 </row>
22780 <row>
22781 <entry><option>smtp_accept_reserve</option></entry>
22782 <entry>only reserve hosts if more connections</entry>
22783 </row>
22784 <row>
22785 <entry><option>smtp_check_spool_space</option></entry>
22786 <entry>from SIZE on MAIL command</entry>
22787 </row>
22788 <row>
22789 <entry><option>smtp_connect_backlog</option></entry>
22790 <entry>passed to TCP/IP stack</entry>
22791 </row>
22792 <row>
22793 <entry><option>smtp_load_reserve</option></entry>
22794 <entry>SMTP from reserved hosts if load high</entry>
22795 </row>
22796 <row>
22797 <entry><option>smtp_reserve_hosts</option></entry>
22798 <entry>these are the reserve hosts</entry>
22799 </row>
22800 </tbody>
22801 </tgroup>
22802 </informaltable>
22803 </section>
22804 <section id="SECID106">
22805 <title>Policy controls</title>
22806 <informaltable frame="none">
22807 <tgroup cols="2" colsep="0" rowsep="0">
22808 <colspec colwidth="196pt" align="left"/>
22809 <colspec colwidth="254pt" align="left"/>
22810 <tbody>
22811 <row>
22812 <entry><option>acl_not_smtp</option></entry>
22813 <entry>ACL for non-SMTP messages</entry>
22814 </row>
22815 <row>
22816 <entry><option>acl_not_smtp_mime</option></entry>
22817 <entry>ACL for non-SMTP MIME parts</entry>
22818 </row>
22819 <row>
22820 <entry><option>acl_not_smtp_start</option></entry>
22821 <entry>ACL for start of non-SMTP message</entry>
22822 </row>
22823 <row>
22824 <entry><option>acl_smtp_auth</option></entry>
22825 <entry>ACL for AUTH</entry>
22826 </row>
22827 <row>
22828 <entry><option>acl_smtp_connect</option></entry>
22829 <entry>ACL for connection</entry>
22830 </row>
22831 <row>
22832 <entry><option>acl_smtp_data</option></entry>
22833 <entry>ACL for DATA</entry>
22834 </row>
22835 <row>
22836 <entry><option>acl_smtp_data_prdr</option></entry>
22837 <entry>ACL for DATA, per-recipient</entry>
22838 </row>
22839 <row>
22840 <entry><option>acl_smtp_dkim</option></entry>
22841 <entry>ACL for DKIM verification</entry>
22842 </row>
22843 <row>
22844 <entry><option>acl_smtp_etrn</option></entry>
22845 <entry>ACL for ETRN</entry>
22846 </row>
22847 <row>
22848 <entry><option>acl_smtp_expn</option></entry>
22849 <entry>ACL for EXPN</entry>
22850 </row>
22851 <row>
22852 <entry><option>acl_smtp_helo</option></entry>
22853 <entry>ACL for EHLO or HELO</entry>
22854 </row>
22855 <row>
22856 <entry><option>acl_smtp_mail</option></entry>
22857 <entry>ACL for MAIL</entry>
22858 </row>
22859 <row>
22860 <entry><option>acl_smtp_mailauth</option></entry>
22861 <entry>ACL for AUTH on MAIL command</entry>
22862 </row>
22863 <row>
22864 <entry><option>acl_smtp_mime</option></entry>
22865 <entry>ACL for MIME parts</entry>
22866 </row>
22867 <row>
22868 <entry><option>acl_smtp_notquit</option></entry>
22869 <entry>ACL for non-QUIT terminations</entry>
22870 </row>
22871 <row>
22872 <entry><option>acl_smtp_predata</option></entry>
22873 <entry>ACL for start of data</entry>
22874 </row>
22875 <row>
22876 <entry><option>acl_smtp_quit</option></entry>
22877 <entry>ACL for QUIT</entry>
22878 </row>
22879 <row>
22880 <entry><option>acl_smtp_rcpt</option></entry>
22881 <entry>ACL for RCPT</entry>
22882 </row>
22883 <row>
22884 <entry><option>acl_smtp_starttls</option></entry>
22885 <entry>ACL for STARTTLS</entry>
22886 </row>
22887 <row>
22888 <entry><option>acl_smtp_vrfy</option></entry>
22889 <entry>ACL for VRFY</entry>
22890 </row>
22891 <row>
22892 <entry><option>av_scanner</option></entry>
22893 <entry>specify virus scanner</entry>
22894 </row>
22895 <row>
22896 <entry><option>check_rfc2047_length</option></entry>
22897 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
22898 </row>
22899 <row>
22900 <entry><option>dns_cname_loops</option></entry>
22901 <entry>follow CNAMEs returned by resolver</entry>
22902 </row>
22903 <row>
22904 <entry><option>dns_csa_search_limit</option></entry>
22905 <entry>control CSA parent search depth</entry>
22906 </row>
22907 <row>
22908 <entry><option>dns_csa_use_reverse</option></entry>
22909 <entry>en/disable CSA IP reverse search</entry>
22910 </row>
22911 <row>
22912 <entry><option>header_maxsize</option></entry>
22913 <entry>total size of message header</entry>
22914 </row>
22915 <row>
22916 <entry><option>header_line_maxsize</option></entry>
22917 <entry>individual header line limit</entry>
22918 </row>
22919 <row>
22920 <entry><option>helo_accept_junk_hosts</option></entry>
22921 <entry>allow syntactic junk from these hosts</entry>
22922 </row>
22923 <row>
22924 <entry><option>helo_allow_chars</option></entry>
22925 <entry>allow illegal chars in HELO names</entry>
22926 </row>
22927 <row>
22928 <entry><option>helo_lookup_domains</option></entry>
22929 <entry>lookup hostname for these HELO names</entry>
22930 </row>
22931 <row>
22932 <entry><option>helo_try_verify_hosts</option></entry>
22933 <entry>HELO soft-checked for these hosts</entry>
22934 </row>
22935 <row>
22936 <entry><option>helo_verify_hosts</option></entry>
22937 <entry>HELO hard-checked for these hosts</entry>
22938 </row>
22939 <row>
22940 <entry><option>host_lookup</option></entry>
22941 <entry>host name looked up for these hosts</entry>
22942 </row>
22943 <row>
22944 <entry><option>host_lookup_order</option></entry>
22945 <entry>order of DNS and local name lookups</entry>
22946 </row>
22947 <row>
22948 <entry><option>hosts_proxy</option></entry>
22949 <entry>use proxy protocol for these hosts</entry>
22950 </row>
22951 <row>
22952 <entry><option>host_reject_connection</option></entry>
22953 <entry>reject connection from these hosts</entry>
22954 </row>
22955 <row>
22956 <entry><option>hosts_treat_as_local</option></entry>
22957 <entry>useful in some cluster configurations</entry>
22958 </row>
22959 <row>
22960 <entry><option>local_scan_timeout</option></entry>
22961 <entry>timeout for <function>local_scan()</function></entry>
22962 </row>
22963 <row>
22964 <entry><option>message_size_limit</option></entry>
22965 <entry>for all messages</entry>
22966 </row>
22967 <row>
22968 <entry><option>percent_hack_domains</option></entry>
22969 <entry>recognize %-hack for these domains</entry>
22970 </row>
22971 <row>
22972 <entry><option>spamd_address</option></entry>
22973 <entry>set interface to SpamAssassin</entry>
22974 </row>
22975 <row>
22976 <entry><option>strict_acl_vars</option></entry>
22977 <entry>object to unset ACL variables</entry>
22978 </row>
22979 <row>
22980 <entry><option>spf_smtp_comment_template</option></entry>
22981 <entry>template for <varname>$spf_smtp_comment</varname></entry>
22982 </row>
22983 </tbody>
22984 </tgroup>
22985 </informaltable>
22986 </section>
22987 <section id="SECID107">
22988 <title>Callout cache</title>
22989 <informaltable frame="none">
22990 <tgroup cols="2" colsep="0" rowsep="0">
22991 <colspec colwidth="196pt" align="left"/>
22992 <colspec colwidth="254pt" align="left"/>
22993 <tbody>
22994 <row>
22995 <entry><option>callout_domain_negative_expire</option></entry>
22996 <entry>timeout for negative domain cache item</entry>
22997 </row>
22998 <row>
22999 <entry><option>callout_domain_positive_expire</option></entry>
23000 <entry>timeout for positive domain cache item</entry>
23001 </row>
23002 <row>
23003 <entry><option>callout_negative_expire</option></entry>
23004 <entry>timeout for negative address cache item</entry>
23005 </row>
23006 <row>
23007 <entry><option>callout_positive_expire</option></entry>
23008 <entry>timeout for positive address cache item</entry>
23009 </row>
23010 <row>
23011 <entry><option>callout_random_local_part</option></entry>
23012 <entry>string to use for <quote>random</quote> testing</entry>
23013 </row>
23014 </tbody>
23015 </tgroup>
23016 </informaltable>
23017 </section>
23018 <section id="SECID108">
23019 <title>TLS</title>
23020 <informaltable frame="none">
23021 <tgroup cols="2" colsep="0" rowsep="0">
23022 <colspec colwidth="196pt" align="left"/>
23023 <colspec colwidth="254pt" align="left"/>
23024 <tbody>
23025 <row>
23026 <entry><option>gnutls_compat_mode</option></entry>
23027 <entry>use GnuTLS compatibility mode</entry>
23028 </row>
23029 <row>
23030 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
23031 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
23032 </row>
23033 <row>
23034 <entry><option>openssl_options</option></entry>
23035 <entry>adjust OpenSSL compatibility options</entry>
23036 </row>
23037 <row>
23038 <entry><option>tls_advertise_hosts</option></entry>
23039 <entry>advertise TLS to these hosts</entry>
23040 </row>
23041 <row>
23042 <entry><option>tls_certificate</option></entry>
23043 <entry>location of server certificate</entry>
23044 </row>
23045 <row>
23046 <entry><option>tls_crl</option></entry>
23047 <entry>certificate revocation list</entry>
23048 </row>
23049 <row>
23050 <entry><option>tls_dh_max_bits</option></entry>
23051 <entry>clamp D-H bit count suggestion</entry>
23052 </row>
23053 <row>
23054 <entry><option>tls_dhparam</option></entry>
23055 <entry>DH parameters for server</entry>
23056 </row>
23057 <row>
23058 <entry><option>tls_eccurve</option></entry>
23059 <entry>EC curve selection for server</entry>
23060 </row>
23061 <row>
23062 <entry><option>tls_ocsp_file</option></entry>
23063 <entry>location of server certificate status proof</entry>
23064 </row>
23065 <row>
23066 <entry><option>tls_on_connect_ports</option></entry>
23067 <entry>specify SSMTP (SMTPS) ports</entry>
23068 </row>
23069 <row>
23070 <entry><option>tls_privatekey</option></entry>
23071 <entry>location of server private key</entry>
23072 </row>
23073 <row>
23074 <entry><option>tls_remember_esmtp</option></entry>
23075 <entry>don&#x2019;t reset after starting TLS</entry>
23076 </row>
23077 <row>
23078 <entry><option>tls_require_ciphers</option></entry>
23079 <entry>specify acceptable ciphers</entry>
23080 </row>
23081 <row>
23082 <entry><option>tls_try_verify_hosts</option></entry>
23083 <entry>try to verify client certificate</entry>
23084 </row>
23085 <row>
23086 <entry><option>tls_verify_certificates</option></entry>
23087 <entry>expected client certificates</entry>
23088 </row>
23089 <row>
23090 <entry><option>tls_verify_hosts</option></entry>
23091 <entry>insist on client certificate verify</entry>
23092 </row>
23093 </tbody>
23094 </tgroup>
23095 </informaltable>
23096 </section>
23097 <section id="SECID109">
23098 <title>Local user handling</title>
23099 <informaltable frame="none">
23100 <tgroup cols="2" colsep="0" rowsep="0">
23101 <colspec colwidth="196pt" align="left"/>
23102 <colspec colwidth="254pt" align="left"/>
23103 <tbody>
23104 <row>
23105 <entry><option>finduser_retries</option></entry>
23106 <entry>useful in NIS environments</entry>
23107 </row>
23108 <row>
23109 <entry><option>gecos_name</option></entry>
23110 <entry>used when creating <emphasis>Sender:</emphasis></entry>
23111 </row>
23112 <row>
23113 <entry><option>gecos_pattern</option></entry>
23114 <entry>ditto</entry>
23115 </row>
23116 <row>
23117 <entry><option>max_username_length</option></entry>
23118 <entry>for systems that truncate</entry>
23119 </row>
23120 <row>
23121 <entry><option>unknown_login</option></entry>
23122 <entry>used when no login name found</entry>
23123 </row>
23124 <row>
23125 <entry><option>unknown_username</option></entry>
23126 <entry>ditto</entry>
23127 </row>
23128 <row>
23129 <entry><option>uucp_from_pattern</option></entry>
23130 <entry>for recognizing <quote>From </quote> lines</entry>
23131 </row>
23132 <row>
23133 <entry><option>uucp_from_sender</option></entry>
23134 <entry>ditto</entry>
23135 </row>
23136 </tbody>
23137 </tgroup>
23138 </informaltable>
23139 </section>
23140 <section id="SECID110">
23141 <title>All incoming messages (SMTP and non-SMTP)</title>
23142 <informaltable frame="none">
23143 <tgroup cols="2" colsep="0" rowsep="0">
23144 <colspec colwidth="196pt" align="left"/>
23145 <colspec colwidth="254pt" align="left"/>
23146 <tbody>
23147 <row>
23148 <entry><option>header_maxsize</option></entry>
23149 <entry>total size of message header</entry>
23150 </row>
23151 <row>
23152 <entry><option>header_line_maxsize</option></entry>
23153 <entry>individual header line limit</entry>
23154 </row>
23155 <row>
23156 <entry><option>message_size_limit</option></entry>
23157 <entry>applies to all messages</entry>
23158 </row>
23159 <row>
23160 <entry><option>percent_hack_domains</option></entry>
23161 <entry>recognize %-hack for these domains</entry>
23162 </row>
23163 <row>
23164 <entry><option>received_header_text</option></entry>
23165 <entry>expanded to make <emphasis>Received:</emphasis></entry>
23166 </row>
23167 <row>
23168 <entry><option>received_headers_max</option></entry>
23169 <entry>for mail loop detection</entry>
23170 </row>
23171 <row>
23172 <entry><option>recipients_max</option></entry>
23173 <entry>limit per message</entry>
23174 </row>
23175 <row>
23176 <entry><option>recipients_max_reject</option></entry>
23177 <entry>permanently reject excess recipients</entry>
23178 </row>
23179 </tbody>
23180 </tgroup>
23181 </informaltable>
23182 </section>
23183 <section id="SECID111">
23184 <title>Non-SMTP incoming messages</title>
23185 <informaltable frame="none">
23186 <tgroup cols="2" colsep="0" rowsep="0">
23187 <colspec colwidth="196pt" align="left"/>
23188 <colspec colwidth="254pt" align="left"/>
23189 <tbody>
23190 <row>
23191 <entry><option>receive_timeout</option></entry>
23192 <entry>for non-SMTP messages</entry>
23193 </row>
23194 </tbody>
23195 </tgroup>
23196 </informaltable>
23197 </section>
23198 <section id="SECID112">
23199 <title>Incoming SMTP messages</title>
23200 <para>
23201 See also the <emphasis>Policy controls</emphasis> section above.
23202 </para>
23203 <informaltable frame="none">
23204 <tgroup cols="2" colsep="0" rowsep="0">
23205 <colspec colwidth="196pt" align="left"/>
23206 <colspec colwidth="254pt" align="left"/>
23207 <tbody>
23208 <row>
23209 <entry><option>dkim_verify_hashes</option></entry>
23210 <entry>DKIM hash methods accepted for signatures</entry>
23211 </row>
23212 <row>
23213 <entry><option>dkim_verify_keytypes</option></entry>
23214 <entry>DKIM key types accepted for signatures</entry>
23215 </row>
23216 <row>
23217 <entry><option>dkim_verify_min_keysizes</option></entry>
23218 <entry>DKIM key sizes accepted for signatures</entry>
23219 </row>
23220 <row>
23221 <entry><option>dkim_verify_signers</option></entry>
23222 <entry>DKIM domains for which DKIM ACL is run</entry>
23223 </row>
23224 <row>
23225 <entry><option>dmarc_forensic_sender</option></entry>
23226 <entry>DMARC sender for report messages</entry>
23227 </row>
23228 <row>
23229 <entry><option>dmarc_history_file</option></entry>
23230 <entry>DMARC results log</entry>
23231 </row>
23232 <row>
23233 <entry><option>dmarc_tld_file</option></entry>
23234 <entry>DMARC toplevel domains file</entry>
23235 </row>
23236 <row>
23237 <entry><option>host_lookup</option></entry>
23238 <entry>host name looked up for these hosts</entry>
23239 </row>
23240 <row>
23241 <entry><option>host_lookup_order</option></entry>
23242 <entry>order of DNS and local name lookups</entry>
23243 </row>
23244 <row>
23245 <entry><option>recipient_unqualified_hosts</option></entry>
23246 <entry>may send unqualified recipients</entry>
23247 </row>
23248 <row>
23249 <entry><option>rfc1413_hosts</option></entry>
23250 <entry>make ident calls to these hosts</entry>
23251 </row>
23252 <row>
23253 <entry><option>rfc1413_query_timeout</option></entry>
23254 <entry>zero disables ident calls</entry>
23255 </row>
23256 <row>
23257 <entry><option>sender_unqualified_hosts</option></entry>
23258 <entry>may send unqualified senders</entry>
23259 </row>
23260 <row>
23261 <entry><option>smtp_accept_keepalive</option></entry>
23262 <entry>some TCP/IP magic</entry>
23263 </row>
23264 <row>
23265 <entry><option>smtp_accept_max</option></entry>
23266 <entry>simultaneous incoming connections</entry>
23267 </row>
23268 <row>
23269 <entry><option>smtp_accept_max_nonmail</option></entry>
23270 <entry>non-mail commands</entry>
23271 </row>
23272 <row>
23273 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
23274 <entry>hosts to which the limit applies</entry>
23275 </row>
23276 <row>
23277 <entry><option>smtp_accept_max_per_connection</option></entry>
23278 <entry>messages per connection</entry>
23279 </row>
23280 <row>
23281 <entry><option>smtp_accept_max_per_host</option></entry>
23282 <entry>connections from one host</entry>
23283 </row>
23284 <row>
23285 <entry><option>smtp_accept_queue</option></entry>
23286 <entry>queue mail if more connections</entry>
23287 </row>
23288 <row>
23289 <entry><option>smtp_accept_queue_per_connection</option></entry>
23290 <entry>queue if more messages per connection</entry>
23291 </row>
23292 <row>
23293 <entry><option>smtp_accept_reserve</option></entry>
23294 <entry>only reserve hosts if more connections</entry>
23295 </row>
23296 <row>
23297 <entry><option>smtp_active_hostname</option></entry>
23298 <entry>host name to use in messages</entry>
23299 </row>
23300 <row>
23301 <entry><option>smtp_banner</option></entry>
23302 <entry>text for welcome banner</entry>
23303 </row>
23304 <row>
23305 <entry><option>smtp_check_spool_space</option></entry>
23306 <entry>from SIZE on MAIL command</entry>
23307 </row>
23308 <row>
23309 <entry><option>smtp_connect_backlog</option></entry>
23310 <entry>passed to TCP/IP stack</entry>
23311 </row>
23312 <row>
23313 <entry><option>smtp_enforce_sync</option></entry>
23314 <entry>of SMTP command/responses</entry>
23315 </row>
23316 <row>
23317 <entry><option>smtp_etrn_command</option></entry>
23318 <entry>what to run for ETRN</entry>
23319 </row>
23320 <row>
23321 <entry><option>smtp_etrn_serialize</option></entry>
23322 <entry>only one at once</entry>
23323 </row>
23324 <row>
23325 <entry><option>smtp_load_reserve</option></entry>
23326 <entry>only reserve hosts if this load</entry>
23327 </row>
23328 <row>
23329 <entry><option>smtp_max_unknown_commands</option></entry>
23330 <entry>before dropping connection</entry>
23331 </row>
23332 <row>
23333 <entry><option>smtp_ratelimit_hosts</option></entry>
23334 <entry>apply ratelimiting to these hosts</entry>
23335 </row>
23336 <row>
23337 <entry><option>smtp_ratelimit_mail</option></entry>
23338 <entry>ratelimit for MAIL commands</entry>
23339 </row>
23340 <row>
23341 <entry><option>smtp_ratelimit_rcpt</option></entry>
23342 <entry>ratelimit for RCPT commands</entry>
23343 </row>
23344 <row>
23345 <entry><option>smtp_receive_timeout</option></entry>
23346 <entry>per command or data line</entry>
23347 </row>
23348 <row>
23349 <entry><option>smtp_reserve_hosts</option></entry>
23350 <entry>these are the reserve hosts</entry>
23351 </row>
23352 <row>
23353 <entry><option>smtp_return_error_details</option></entry>
23354 <entry>give detail on rejections</entry>
23355 </row>
23356 </tbody>
23357 </tgroup>
23358 </informaltable>
23359 </section>
23360 <section id="SECID113">
23361 <title>SMTP extensions</title>
23362 <informaltable frame="none">
23363 <tgroup cols="2" colsep="0" rowsep="0">
23364 <colspec colwidth="196pt" align="left"/>
23365 <colspec colwidth="254pt" align="left"/>
23366 <tbody>
23367 <row>
23368 <entry><option>accept_8bitmime</option></entry>
23369 <entry>advertise 8BITMIME</entry>
23370 </row>
23371 <row>
23372 <entry><option>auth_advertise_hosts</option></entry>
23373 <entry>advertise AUTH to these hosts</entry>
23374 </row>
23375 <row>
23376 <entry><option>chunking_advertise_hosts</option></entry>
23377 <entry>advertise CHUNKING to these hosts</entry>
23378 </row>
23379 <row>
23380 <entry><option>dsn_advertise_hosts</option></entry>
23381 <entry>advertise DSN extensions to these hosts</entry>
23382 </row>
23383 <row>
23384 <entry><option>ignore_fromline_hosts</option></entry>
23385 <entry>allow <quote>From </quote> from these hosts</entry>
23386 </row>
23387 <row>
23388 <entry><option>ignore_fromline_local</option></entry>
23389 <entry>allow <quote>From </quote> from local SMTP</entry>
23390 </row>
23391 <row>
23392 <entry><option>pipelining_advertise_hosts</option></entry>
23393 <entry>advertise pipelining to these hosts</entry>
23394 </row>
23395 <row>
23396 <entry><option>pipelining_connect_advertise_hosts</option></entry>
23397 <entry>advertise pipelining to these hosts</entry>
23398 </row>
23399 <row>
23400 <entry><option>prdr_enable</option></entry>
23401 <entry>advertise PRDR to all hosts</entry>
23402 </row>
23403 <row>
23404 <entry><option>smtputf8_advertise_hosts</option></entry>
23405 <entry>advertise SMTPUTF8 to these hosts</entry>
23406 </row>
23407 <row>
23408 <entry><option>tls_advertise_hosts</option></entry>
23409 <entry>advertise TLS to these hosts</entry>
23410 </row>
23411 </tbody>
23412 </tgroup>
23413 </informaltable>
23414 </section>
23415 <section id="SECID114">
23416 <title>Processing messages</title>
23417 <informaltable frame="none">
23418 <tgroup cols="2" colsep="0" rowsep="0">
23419 <colspec colwidth="196pt" align="left"/>
23420 <colspec colwidth="254pt" align="left"/>
23421 <tbody>
23422 <row>
23423 <entry><option>allow_domain_literals</option></entry>
23424 <entry>recognize domain literal syntax</entry>
23425 </row>
23426 <row>
23427 <entry><option>allow_mx_to_ip</option></entry>
23428 <entry>allow MX to point to IP address</entry>
23429 </row>
23430 <row>
23431 <entry><option>allow_utf8_domains</option></entry>
23432 <entry>in addresses</entry>
23433 </row>
23434 <row>
23435 <entry><option>check_rfc2047_length</option></entry>
23436 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
23437 </row>
23438 <row>
23439 <entry><option>delivery_date_remove</option></entry>
23440 <entry>from incoming messages</entry>
23441 </row>
23442 <row>
23443 <entry><option>envelope_to_remove</option></entry>
23444 <entry>from incoming messages</entry>
23445 </row>
23446 <row>
23447 <entry><option>extract_addresses_remove_arguments</option></entry>
23448 <entry>affects <option>-t</option> processing</entry>
23449 </row>
23450 <row>
23451 <entry><option>headers_charset</option></entry>
23452 <entry>default for translations</entry>
23453 </row>
23454 <row>
23455 <entry><option>qualify_domain</option></entry>
23456 <entry>default for senders</entry>
23457 </row>
23458 <row>
23459 <entry><option>qualify_recipient</option></entry>
23460 <entry>default for recipients</entry>
23461 </row>
23462 <row>
23463 <entry><option>return_path_remove</option></entry>
23464 <entry>from incoming messages</entry>
23465 </row>
23466 <row>
23467 <entry><option>strip_excess_angle_brackets</option></entry>
23468 <entry>in addresses</entry>
23469 </row>
23470 <row>
23471 <entry><option>strip_trailing_dot</option></entry>
23472 <entry>at end of addresses</entry>
23473 </row>
23474 <row>
23475 <entry><option>untrusted_set_sender</option></entry>
23476 <entry>untrusted can set envelope sender</entry>
23477 </row>
23478 </tbody>
23479 </tgroup>
23480 </informaltable>
23481 </section>
23482 <section id="SECID115">
23483 <title>System filter</title>
23484 <informaltable frame="none">
23485 <tgroup cols="2" colsep="0" rowsep="0">
23486 <colspec colwidth="196pt" align="left"/>
23487 <colspec colwidth="254pt" align="left"/>
23488 <tbody>
23489 <row>
23490 <entry><option>system_filter</option></entry>
23491 <entry>locate system filter</entry>
23492 </row>
23493 <row>
23494 <entry><option>system_filter_directory_transport</option></entry>
23495 <entry>transport for delivery to a directory</entry>
23496 </row>
23497 <row>
23498 <entry><option>system_filter_file_transport</option></entry>
23499 <entry>transport for delivery to a file</entry>
23500 </row>
23501 <row>
23502 <entry><option>system_filter_group</option></entry>
23503 <entry>group for filter running</entry>
23504 </row>
23505 <row>
23506 <entry><option>system_filter_pipe_transport</option></entry>
23507 <entry>transport for delivery to a pipe</entry>
23508 </row>
23509 <row>
23510 <entry><option>system_filter_reply_transport</option></entry>
23511 <entry>transport for autoreply delivery</entry>
23512 </row>
23513 <row>
23514 <entry><option>system_filter_user</option></entry>
23515 <entry>user for filter running</entry>
23516 </row>
23517 </tbody>
23518 </tgroup>
23519 </informaltable>
23520 </section>
23521 <section id="SECID116">
23522 <title>Routing and delivery</title>
23523 <informaltable frame="none">
23524 <tgroup cols="2" colsep="0" rowsep="0">
23525 <colspec colwidth="196pt" align="left"/>
23526 <colspec colwidth="254pt" align="left"/>
23527 <tbody>
23528 <row>
23529 <entry><option>disable_ipv6</option></entry>
23530 <entry>do no IPv6 processing</entry>
23531 </row>
23532 <row>
23533 <entry><option>dns_again_means_nonexist</option></entry>
23534 <entry>for broken domains</entry>
23535 </row>
23536 <row>
23537 <entry><option>dns_check_names_pattern</option></entry>
23538 <entry>pre-DNS syntax check</entry>
23539 </row>
23540 <row>
23541 <entry><option>dns_dnssec_ok</option></entry>
23542 <entry>parameter for resolver</entry>
23543 </row>
23544 <row>
23545 <entry><option>dns_ipv4_lookup</option></entry>
23546 <entry>only v4 lookup for these domains</entry>
23547 </row>
23548 <row>
23549 <entry><option>dns_retrans</option></entry>
23550 <entry>parameter for resolver</entry>
23551 </row>
23552 <row>
23553 <entry><option>dns_retry</option></entry>
23554 <entry>parameter for resolver</entry>
23555 </row>
23556 <row>
23557 <entry><option>dns_trust_aa</option></entry>
23558 <entry>DNS zones trusted as authentic</entry>
23559 </row>
23560 <row>
23561 <entry><option>dns_use_edns0</option></entry>
23562 <entry>parameter for resolver</entry>
23563 </row>
23564 <row>
23565 <entry><option>hold_domains</option></entry>
23566 <entry>hold delivery for these domains</entry>
23567 </row>
23568 <row>
23569 <entry><option>local_interfaces</option></entry>
23570 <entry>for routing checks</entry>
23571 </row>
23572 <row>
23573 <entry><option>queue_domains</option></entry>
23574 <entry>no immediate delivery for these</entry>
23575 </row>
23576 <row>
23577 <entry><option>queue_only</option></entry>
23578 <entry>no immediate delivery at all</entry>
23579 </row>
23580 <row>
23581 <entry><option>queue_only_file</option></entry>
23582 <entry>no immediate delivery if file exists</entry>
23583 </row>
23584 <row>
23585 <entry><option>queue_only_load</option></entry>
23586 <entry>no immediate delivery if load is high</entry>
23587 </row>
23588 <row>
23589 <entry><option>queue_only_load_latch</option></entry>
23590 <entry>don&#x2019;t re-evaluate load for each message</entry>
23591 </row>
23592 <row>
23593 <entry><option>queue_only_override</option></entry>
23594 <entry>allow command line to override</entry>
23595 </row>
23596 <row>
23597 <entry><option>queue_run_in_order</option></entry>
23598 <entry>order of arrival</entry>
23599 </row>
23600 <row>
23601 <entry><option>queue_run_max</option></entry>
23602 <entry>of simultaneous queue runners</entry>
23603 </row>
23604 <row>
23605 <entry><option>queue_smtp_domains</option></entry>
23606 <entry>no immediate SMTP delivery for these</entry>
23607 </row>
23608 <row>
23609 <entry><option>remote_max_parallel</option></entry>
23610 <entry>parallel SMTP delivery per message</entry>
23611 </row>
23612 <row>
23613 <entry><option>remote_sort_domains</option></entry>
23614 <entry>order of remote deliveries</entry>
23615 </row>
23616 <row>
23617 <entry><option>retry_data_expire</option></entry>
23618 <entry>timeout for retry data</entry>
23619 </row>
23620 <row>
23621 <entry><option>retry_interval_max</option></entry>
23622 <entry>safety net for retry rules</entry>
23623 </row>
23624 </tbody>
23625 </tgroup>
23626 </informaltable>
23627 </section>
23628 <section id="SECID117">
23629 <title>Bounce and warning messages</title>
23630 <informaltable frame="none">
23631 <tgroup cols="2" colsep="0" rowsep="0">
23632 <colspec colwidth="196pt" align="left"/>
23633 <colspec colwidth="254pt" align="left"/>
23634 <tbody>
23635 <row>
23636 <entry><option>bounce_message_file</option></entry>
23637 <entry>content of bounce</entry>
23638 </row>
23639 <row>
23640 <entry><option>bounce_message_text</option></entry>
23641 <entry>content of bounce</entry>
23642 </row>
23643 <row>
23644 <entry><option>bounce_return_body</option></entry>
23645 <entry>include body if returning message</entry>
23646 </row>
23647 <row>
23648 <entry><option>bounce_return_linesize_limit</option></entry>
23649 <entry>limit on returned message line length</entry>
23650 </row>
23651 <row>
23652 <entry><option>bounce_return_message</option></entry>
23653 <entry>include original message in bounce</entry>
23654 </row>
23655 <row>
23656 <entry><option>bounce_return_size_limit</option></entry>
23657 <entry>limit on returned message</entry>
23658 </row>
23659 <row>
23660 <entry><option>bounce_sender_authentication</option></entry>
23661 <entry>send authenticated sender with bounce</entry>
23662 </row>
23663 <row>
23664 <entry><option>dsn_from</option></entry>
23665 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
23666 </row>
23667 <row>
23668 <entry><option>errors_copy</option></entry>
23669 <entry>copy bounce messages</entry>
23670 </row>
23671 <row>
23672 <entry><option>errors_reply_to</option></entry>
23673 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
23674 </row>
23675 <row>
23676 <entry><option>delay_warning</option></entry>
23677 <entry>time schedule</entry>
23678 </row>
23679 <row>
23680 <entry><option>delay_warning_condition</option></entry>
23681 <entry>condition for warning messages</entry>
23682 </row>
23683 <row>
23684 <entry><option>ignore_bounce_errors_after</option></entry>
23685 <entry>discard undeliverable bounces</entry>
23686 </row>
23687 <row>
23688 <entry><option>smtp_return_error_details</option></entry>
23689 <entry>give detail on rejections</entry>
23690 </row>
23691 <row>
23692 <entry><option>warn_message_file</option></entry>
23693 <entry>content of warning message</entry>
23694 </row>
23695 </tbody>
23696 </tgroup>
23697 </informaltable>
23698 </section>
23699 <section id="SECTalomo">
23700 <title>Alphabetical list of main options</title>
23701 <para>
23702 Those options that undergo string expansion before use are marked with
23703 &dagger;.
23704 </para>
23705 <para>
23706 <indexterm role="option">
23707 <primary><option>accept_8bitmime</option></primary>
23708 </indexterm>
23709 </para>
23710 <informaltable frame="all">
23711 <tgroup cols="4" colsep="0" rowsep="0">
23712 <colspec colwidth="8*" align="left"/>
23713 <colspec colwidth="6*" align="center"/>
23714 <colspec colwidth="6*" align="center"/>
23715 <colspec colwidth="6*" align="right"/>
23716 <tbody>
23717 <row>
23718 <entry><option>accept_8bitmime</option></entry>
23719 <entry>Use: <emphasis>main</emphasis></entry>
23720 <entry>Type: <emphasis>boolean</emphasis></entry>
23721 <entry>Default: <emphasis>true</emphasis></entry>
23722 </row>
23723 </tbody>
23724 </tgroup>
23725 </informaltable>
23726 <para>
23727 <indexterm role="concept">
23728 <primary>8BITMIME</primary>
23729 </indexterm>
23730 <indexterm role="concept">
23731 <primary>8-bit characters</primary>
23732 </indexterm>
23733 <indexterm role="concept">
23734 <primary>log</primary>
23735 <secondary>selectors</secondary>
23736 </indexterm>
23737 <indexterm role="concept">
23738 <primary>log</primary>
23739 <secondary>8BITMIME</secondary>
23740 </indexterm>
23741 <indexterm role="concept">
23742 <primary>ESMTP extensions</primary>
23743 <secondary>8BITMIME</secondary>
23744 </indexterm>
23745 This option causes Exim to send 8BITMIME in its response to an SMTP
23746 EHLO command, and to accept the BODY= parameter on MAIL commands.
23747 However, though Exim is 8-bit clean, it is not a protocol converter, and it
23748 takes no steps to do anything special with messages received by this route.
23749 </para>
23750 <para>
23751 Historically Exim kept this option off by default, but the maintainers
23752 feel that in today&#x2019;s Internet, this causes more problems than it solves.
23753 It now defaults to true.
23754 A more detailed analysis of the issues is provided by Dan Bernstein:
23755 </para>
23756 <literallayout>
23757 <emphasis role="bold"><ulink url="https://cr.yp.to/smtp/8bitmime.html">https://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
23758 </literallayout>
23759 <para>
23760 To log received 8BITMIME status use
23761 </para>
23762 <literallayout class="monospaced">
23763 log_selector = +8bitmime
23764 </literallayout>
23765 <para>
23766 <indexterm role="option">
23767 <primary><option>acl_not_smtp</option></primary>
23768 </indexterm>
23769 </para>
23770 <informaltable frame="all">
23771 <tgroup cols="4" colsep="0" rowsep="0">
23772 <colspec colwidth="8*" align="left"/>
23773 <colspec colwidth="6*" align="center"/>
23774 <colspec colwidth="6*" align="center"/>
23775 <colspec colwidth="6*" align="right"/>
23776 <tbody>
23777 <row>
23778 <entry><option>acl_not_smtp</option></entry>
23779 <entry>Use: <emphasis>main</emphasis></entry>
23780 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23781 <entry>Default: <emphasis>unset</emphasis></entry>
23782 </row>
23783 </tbody>
23784 </tgroup>
23785 </informaltable>
23786 <para>
23787 <indexterm role="concept">
23788 <primary>access control lists (ACLs)</primary>
23789 <secondary>for non-SMTP messages</secondary>
23790 </indexterm>
23791 <indexterm role="concept">
23792 <primary>non-SMTP messages</primary>
23793 <secondary>ACLs for</secondary>
23794 </indexterm>
23795 This option defines the ACL that is run when a non-SMTP message has been
23796 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
23797 further details.
23798 </para>
23799 <para>
23800 <indexterm role="option">
23801 <primary><option>acl_not_smtp_mime</option></primary>
23802 </indexterm>
23803 </para>
23804 <informaltable frame="all">
23805 <tgroup cols="4" colsep="0" rowsep="0">
23806 <colspec colwidth="8*" align="left"/>
23807 <colspec colwidth="6*" align="center"/>
23808 <colspec colwidth="6*" align="center"/>
23809 <colspec colwidth="6*" align="right"/>
23810 <tbody>
23811 <row>
23812 <entry><option>acl_not_smtp_mime</option></entry>
23813 <entry>Use: <emphasis>main</emphasis></entry>
23814 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23815 <entry>Default: <emphasis>unset</emphasis></entry>
23816 </row>
23817 </tbody>
23818 </tgroup>
23819 </informaltable>
23820 <para>
23821 This option defines the ACL that is run for individual MIME parts of non-SMTP
23822 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
23823 SMTP messages.
23824 </para>
23825 <para>
23826 <indexterm role="option">
23827 <primary><option>acl_not_smtp_start</option></primary>
23828 </indexterm>
23829 </para>
23830 <informaltable frame="all">
23831 <tgroup cols="4" colsep="0" rowsep="0">
23832 <colspec colwidth="8*" align="left"/>
23833 <colspec colwidth="6*" align="center"/>
23834 <colspec colwidth="6*" align="center"/>
23835 <colspec colwidth="6*" align="right"/>
23836 <tbody>
23837 <row>
23838 <entry><option>acl_not_smtp_start</option></entry>
23839 <entry>Use: <emphasis>main</emphasis></entry>
23840 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23841 <entry>Default: <emphasis>unset</emphasis></entry>
23842 </row>
23843 </tbody>
23844 </tgroup>
23845 </informaltable>
23846 <para>
23847 <indexterm role="concept">
23848 <primary>access control lists (ACLs)</primary>
23849 <secondary>at start of non-SMTP message</secondary>
23850 </indexterm>
23851 <indexterm role="concept">
23852 <primary>non-SMTP messages</primary>
23853 <secondary>ACLs for</secondary>
23854 </indexterm>
23855 This option defines the ACL that is run before Exim starts reading a
23856 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
23857 </para>
23858 <para>
23859 <indexterm role="option">
23860 <primary><option>acl_smtp_auth</option></primary>
23861 </indexterm>
23862 </para>
23863 <informaltable frame="all">
23864 <tgroup cols="4" colsep="0" rowsep="0">
23865 <colspec colwidth="8*" align="left"/>
23866 <colspec colwidth="6*" align="center"/>
23867 <colspec colwidth="6*" align="center"/>
23868 <colspec colwidth="6*" align="right"/>
23869 <tbody>
23870 <row>
23871 <entry><option>acl_smtp_auth</option></entry>
23872 <entry>Use: <emphasis>main</emphasis></entry>
23873 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23874 <entry>Default: <emphasis>unset</emphasis></entry>
23875 </row>
23876 </tbody>
23877 </tgroup>
23878 </informaltable>
23879 <para>
23880 <indexterm role="concept">
23881 <primary>access control lists (ACLs)</primary>
23882 <secondary>setting up for SMTP commands</secondary>
23883 </indexterm>
23884 <indexterm role="concept">
23885 <primary>AUTH</primary>
23886 <secondary>ACL for</secondary>
23887 </indexterm>
23888 This option defines the ACL that is run when an SMTP AUTH command is
23889 received. See chapter <xref linkend="CHAPACL"/> for further details.
23890 </para>
23891 <para>
23892 <indexterm role="option">
23893 <primary><option>acl_smtp_connect</option></primary>
23894 </indexterm>
23895 </para>
23896 <informaltable frame="all">
23897 <tgroup cols="4" colsep="0" rowsep="0">
23898 <colspec colwidth="8*" align="left"/>
23899 <colspec colwidth="6*" align="center"/>
23900 <colspec colwidth="6*" align="center"/>
23901 <colspec colwidth="6*" align="right"/>
23902 <tbody>
23903 <row>
23904 <entry><option>acl_smtp_connect</option></entry>
23905 <entry>Use: <emphasis>main</emphasis></entry>
23906 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23907 <entry>Default: <emphasis>unset</emphasis></entry>
23908 </row>
23909 </tbody>
23910 </tgroup>
23911 </informaltable>
23912 <para>
23913 <indexterm role="concept">
23914 <primary>access control lists (ACLs)</primary>
23915 <secondary>on SMTP connection</secondary>
23916 </indexterm>
23917 This option defines the ACL that is run when an SMTP connection is received.
23918 See chapter <xref linkend="CHAPACL"/> for further details.
23919 </para>
23920 <para>
23921 <indexterm role="option">
23922 <primary><option>acl_smtp_data</option></primary>
23923 </indexterm>
23924 </para>
23925 <informaltable frame="all">
23926 <tgroup cols="4" colsep="0" rowsep="0">
23927 <colspec colwidth="8*" align="left"/>
23928 <colspec colwidth="6*" align="center"/>
23929 <colspec colwidth="6*" align="center"/>
23930 <colspec colwidth="6*" align="right"/>
23931 <tbody>
23932 <row>
23933 <entry><option>acl_smtp_data</option></entry>
23934 <entry>Use: <emphasis>main</emphasis></entry>
23935 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23936 <entry>Default: <emphasis>unset</emphasis></entry>
23937 </row>
23938 </tbody>
23939 </tgroup>
23940 </informaltable>
23941 <para>
23942 <indexterm role="concept">
23943 <primary>DATA</primary>
23944 <secondary>ACL for</secondary>
23945 </indexterm>
23946 This option defines the ACL that is run after an SMTP DATA command has been
23947 processed and the message itself has been received, but before the final
23948 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
23949 </para>
23950 <para>
23951 <indexterm role="option">
23952 <primary><option>acl_smtp_data_prdr</option></primary>
23953 </indexterm>
23954 </para>
23955 <informaltable frame="all">
23956 <tgroup cols="4" colsep="0" rowsep="0">
23957 <colspec colwidth="8*" align="left"/>
23958 <colspec colwidth="6*" align="center"/>
23959 <colspec colwidth="6*" align="center"/>
23960 <colspec colwidth="6*" align="right"/>
23961 <tbody>
23962 <row>
23963 <entry><option>acl_smtp_data_prdr</option></entry>
23964 <entry>Use: <emphasis>main</emphasis></entry>
23965 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23966 <entry>Default: <emphasis>accept</emphasis></entry>
23967 </row>
23968 </tbody>
23969 </tgroup>
23970 </informaltable>
23971 <para>
23972 <indexterm role="concept">
23973 <primary>PRDR</primary>
23974 <secondary>ACL for</secondary>
23975 </indexterm>
23976 <indexterm role="concept">
23977 <primary>DATA</primary>
23978 <secondary>PRDR ACL for</secondary>
23979 </indexterm>
23980 <indexterm role="concept">
23981 <primary>access control lists (ACLs)</primary>
23982 <secondary>PRDR-related</secondary>
23983 </indexterm>
23984 <indexterm role="concept">
23985 <primary>access control lists (ACLs)</primary>
23986 <secondary>per-user data processing</secondary>
23987 </indexterm>
23988 This option defines the ACL that,
23989 if the PRDR feature has been negotiated,
23990 is run for each recipient after an SMTP DATA command has been
23991 processed and the message itself has been received, but before the
23992 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
23993 </para>
23994 <para>
23995 <indexterm role="option">
23996 <primary><option>acl_smtp_dkim</option></primary>
23997 </indexterm>
23998 </para>
23999 <informaltable frame="all">
24000 <tgroup cols="4" colsep="0" rowsep="0">
24001 <colspec colwidth="8*" align="left"/>
24002 <colspec colwidth="6*" align="center"/>
24003 <colspec colwidth="6*" align="center"/>
24004 <colspec colwidth="6*" align="right"/>
24005 <tbody>
24006 <row>
24007 <entry><option>acl_smtp_dkim</option></entry>
24008 <entry>Use: <emphasis>main</emphasis></entry>
24009 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24010 <entry>Default: <emphasis>unset</emphasis></entry>
24011 </row>
24012 </tbody>
24013 </tgroup>
24014 </informaltable>
24015 <para>
24016 <indexterm role="concept">
24017 <primary>DKIM</primary>
24018 <secondary>ACL for</secondary>
24019 </indexterm>
24020 This option defines the ACL that is run for each DKIM signature
24021 (by default, or as specified in the dkim_verify_signers option)
24022 of a received message.
24023 See section <xref linkend="SECDKIMVFY"/> for further details.
24024 </para>
24025 <para>
24026 <indexterm role="option">
24027 <primary><option>acl_smtp_etrn</option></primary>
24028 </indexterm>
24029 </para>
24030 <informaltable frame="all">
24031 <tgroup cols="4" colsep="0" rowsep="0">
24032 <colspec colwidth="8*" align="left"/>
24033 <colspec colwidth="6*" align="center"/>
24034 <colspec colwidth="6*" align="center"/>
24035 <colspec colwidth="6*" align="right"/>
24036 <tbody>
24037 <row>
24038 <entry><option>acl_smtp_etrn</option></entry>
24039 <entry>Use: <emphasis>main</emphasis></entry>
24040 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24041 <entry>Default: <emphasis>unset</emphasis></entry>
24042 </row>
24043 </tbody>
24044 </tgroup>
24045 </informaltable>
24046 <para>
24047 <indexterm role="concept">
24048 <primary>ETRN</primary>
24049 <secondary>ACL for</secondary>
24050 </indexterm>
24051 This option defines the ACL that is run when an SMTP ETRN command is
24052 received. See chapter <xref linkend="CHAPACL"/> for further details.
24053 </para>
24054 <para>
24055 <indexterm role="option">
24056 <primary><option>acl_smtp_expn</option></primary>
24057 </indexterm>
24058 </para>
24059 <informaltable frame="all">
24060 <tgroup cols="4" colsep="0" rowsep="0">
24061 <colspec colwidth="8*" align="left"/>
24062 <colspec colwidth="6*" align="center"/>
24063 <colspec colwidth="6*" align="center"/>
24064 <colspec colwidth="6*" align="right"/>
24065 <tbody>
24066 <row>
24067 <entry><option>acl_smtp_expn</option></entry>
24068 <entry>Use: <emphasis>main</emphasis></entry>
24069 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24070 <entry>Default: <emphasis>unset</emphasis></entry>
24071 </row>
24072 </tbody>
24073 </tgroup>
24074 </informaltable>
24075 <para>
24076 <indexterm role="concept">
24077 <primary>EXPN</primary>
24078 <secondary>ACL for</secondary>
24079 </indexterm>
24080 This option defines the ACL that is run when an SMTP EXPN command is
24081 received. See chapter <xref linkend="CHAPACL"/> for further details.
24082 </para>
24083 <para>
24084 <indexterm role="option">
24085 <primary><option>acl_smtp_helo</option></primary>
24086 </indexterm>
24087 </para>
24088 <informaltable frame="all">
24089 <tgroup cols="4" colsep="0" rowsep="0">
24090 <colspec colwidth="8*" align="left"/>
24091 <colspec colwidth="6*" align="center"/>
24092 <colspec colwidth="6*" align="center"/>
24093 <colspec colwidth="6*" align="right"/>
24094 <tbody>
24095 <row>
24096 <entry><option>acl_smtp_helo</option></entry>
24097 <entry>Use: <emphasis>main</emphasis></entry>
24098 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24099 <entry>Default: <emphasis>unset</emphasis></entry>
24100 </row>
24101 </tbody>
24102 </tgroup>
24103 </informaltable>
24104 <para>
24105 <indexterm role="concept">
24106 <primary>EHLO</primary>
24107 <secondary>ACL for</secondary>
24108 </indexterm>
24109 <indexterm role="concept">
24110 <primary>HELO</primary>
24111 <secondary>ACL for</secondary>
24112 </indexterm>
24113 This option defines the ACL that is run when an SMTP EHLO or HELO
24114 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
24115 </para>
24116 <para>
24117 <indexterm role="option">
24118 <primary><option>acl_smtp_mail</option></primary>
24119 </indexterm>
24120 </para>
24121 <informaltable frame="all">
24122 <tgroup cols="4" colsep="0" rowsep="0">
24123 <colspec colwidth="8*" align="left"/>
24124 <colspec colwidth="6*" align="center"/>
24125 <colspec colwidth="6*" align="center"/>
24126 <colspec colwidth="6*" align="right"/>
24127 <tbody>
24128 <row>
24129 <entry><option>acl_smtp_mail</option></entry>
24130 <entry>Use: <emphasis>main</emphasis></entry>
24131 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24132 <entry>Default: <emphasis>unset</emphasis></entry>
24133 </row>
24134 </tbody>
24135 </tgroup>
24136 </informaltable>
24137 <para>
24138 <indexterm role="concept">
24139 <primary>MAIL</primary>
24140 <secondary>ACL for</secondary>
24141 </indexterm>
24142 This option defines the ACL that is run when an SMTP MAIL command is
24143 received. See chapter <xref linkend="CHAPACL"/> for further details.
24144 </para>
24145 <para>
24146 <indexterm role="option">
24147 <primary><option>acl_smtp_mailauth</option></primary>
24148 </indexterm>
24149 </para>
24150 <informaltable frame="all">
24151 <tgroup cols="4" colsep="0" rowsep="0">
24152 <colspec colwidth="8*" align="left"/>
24153 <colspec colwidth="6*" align="center"/>
24154 <colspec colwidth="6*" align="center"/>
24155 <colspec colwidth="6*" align="right"/>
24156 <tbody>
24157 <row>
24158 <entry><option>acl_smtp_mailauth</option></entry>
24159 <entry>Use: <emphasis>main</emphasis></entry>
24160 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24161 <entry>Default: <emphasis>unset</emphasis></entry>
24162 </row>
24163 </tbody>
24164 </tgroup>
24165 </informaltable>
24166 <para>
24167 <indexterm role="concept">
24168 <primary>AUTH</primary>
24169 <secondary>on MAIL command</secondary>
24170 </indexterm>
24171 This option defines the ACL that is run when there is an AUTH parameter on
24172 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
24173 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
24174 </para>
24175 <para>
24176 <indexterm role="option">
24177 <primary><option>acl_smtp_mime</option></primary>
24178 </indexterm>
24179 </para>
24180 <informaltable frame="all">
24181 <tgroup cols="4" colsep="0" rowsep="0">
24182 <colspec colwidth="8*" align="left"/>
24183 <colspec colwidth="6*" align="center"/>
24184 <colspec colwidth="6*" align="center"/>
24185 <colspec colwidth="6*" align="right"/>
24186 <tbody>
24187 <row>
24188 <entry><option>acl_smtp_mime</option></entry>
24189 <entry>Use: <emphasis>main</emphasis></entry>
24190 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24191 <entry>Default: <emphasis>unset</emphasis></entry>
24192 </row>
24193 </tbody>
24194 </tgroup>
24195 </informaltable>
24196 <para>
24197 <indexterm role="concept">
24198 <primary>MIME content scanning</primary>
24199 <secondary>ACL for</secondary>
24200 </indexterm>
24201 This option is available when Exim is built with the content-scanning
24202 extension. It defines the ACL that is run for each MIME part in a message. See
24203 section <xref linkend="SECTscanmimepart"/> for details.
24204 </para>
24205 <para>
24206 <indexterm role="option">
24207 <primary><option>acl_smtp_notquit</option></primary>
24208 </indexterm>
24209 </para>
24210 <informaltable frame="all">
24211 <tgroup cols="4" colsep="0" rowsep="0">
24212 <colspec colwidth="8*" align="left"/>
24213 <colspec colwidth="6*" align="center"/>
24214 <colspec colwidth="6*" align="center"/>
24215 <colspec colwidth="6*" align="right"/>
24216 <tbody>
24217 <row>
24218 <entry><option>acl_smtp_notquit</option></entry>
24219 <entry>Use: <emphasis>main</emphasis></entry>
24220 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24221 <entry>Default: <emphasis>unset</emphasis></entry>
24222 </row>
24223 </tbody>
24224 </tgroup>
24225 </informaltable>
24226 <para>
24227 <indexterm role="concept">
24228 <primary>not-QUIT, ACL for</primary>
24229 </indexterm>
24230 This option defines the ACL that is run when an SMTP session
24231 ends without a QUIT command being received.
24232 See chapter <xref linkend="CHAPACL"/> for further details.
24233 </para>
24234 <para>
24235 <indexterm role="option">
24236 <primary><option>acl_smtp_predata</option></primary>
24237 </indexterm>
24238 </para>
24239 <informaltable frame="all">
24240 <tgroup cols="4" colsep="0" rowsep="0">
24241 <colspec colwidth="8*" align="left"/>
24242 <colspec colwidth="6*" align="center"/>
24243 <colspec colwidth="6*" align="center"/>
24244 <colspec colwidth="6*" align="right"/>
24245 <tbody>
24246 <row>
24247 <entry><option>acl_smtp_predata</option></entry>
24248 <entry>Use: <emphasis>main</emphasis></entry>
24249 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24250 <entry>Default: <emphasis>unset</emphasis></entry>
24251 </row>
24252 </tbody>
24253 </tgroup>
24254 </informaltable>
24255 <para>
24256 This option defines the ACL that is run when an SMTP DATA command is
24257 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
24258 further details.
24259 </para>
24260 <para>
24261 <indexterm role="option">
24262 <primary><option>acl_smtp_quit</option></primary>
24263 </indexterm>
24264 </para>
24265 <informaltable frame="all">
24266 <tgroup cols="4" colsep="0" rowsep="0">
24267 <colspec colwidth="8*" align="left"/>
24268 <colspec colwidth="6*" align="center"/>
24269 <colspec colwidth="6*" align="center"/>
24270 <colspec colwidth="6*" align="right"/>
24271 <tbody>
24272 <row>
24273 <entry><option>acl_smtp_quit</option></entry>
24274 <entry>Use: <emphasis>main</emphasis></entry>
24275 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24276 <entry>Default: <emphasis>unset</emphasis></entry>
24277 </row>
24278 </tbody>
24279 </tgroup>
24280 </informaltable>
24281 <para>
24282 <indexterm role="concept">
24283 <primary>QUIT, ACL for</primary>
24284 </indexterm>
24285 This option defines the ACL that is run when an SMTP QUIT command is
24286 received. See chapter <xref linkend="CHAPACL"/> for further details.
24287 </para>
24288 <para>
24289 <indexterm role="option">
24290 <primary><option>acl_smtp_rcpt</option></primary>
24291 </indexterm>
24292 </para>
24293 <informaltable frame="all">
24294 <tgroup cols="4" colsep="0" rowsep="0">
24295 <colspec colwidth="8*" align="left"/>
24296 <colspec colwidth="6*" align="center"/>
24297 <colspec colwidth="6*" align="center"/>
24298 <colspec colwidth="6*" align="right"/>
24299 <tbody>
24300 <row>
24301 <entry><option>acl_smtp_rcpt</option></entry>
24302 <entry>Use: <emphasis>main</emphasis></entry>
24303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24304 <entry>Default: <emphasis>unset</emphasis></entry>
24305 </row>
24306 </tbody>
24307 </tgroup>
24308 </informaltable>
24309 <para>
24310 <indexterm role="concept">
24311 <primary>RCPT</primary>
24312 <secondary>ACL for</secondary>
24313 </indexterm>
24314 This option defines the ACL that is run when an SMTP RCPT command is
24315 received. See chapter <xref linkend="CHAPACL"/> for further details.
24316 </para>
24317 <para>
24318 <indexterm role="option">
24319 <primary><option>acl_smtp_starttls</option></primary>
24320 </indexterm>
24321 </para>
24322 <informaltable frame="all">
24323 <tgroup cols="4" colsep="0" rowsep="0">
24324 <colspec colwidth="8*" align="left"/>
24325 <colspec colwidth="6*" align="center"/>
24326 <colspec colwidth="6*" align="center"/>
24327 <colspec colwidth="6*" align="right"/>
24328 <tbody>
24329 <row>
24330 <entry><option>acl_smtp_starttls</option></entry>
24331 <entry>Use: <emphasis>main</emphasis></entry>
24332 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24333 <entry>Default: <emphasis>unset</emphasis></entry>
24334 </row>
24335 </tbody>
24336 </tgroup>
24337 </informaltable>
24338 <para>
24339 <indexterm role="concept">
24340 <primary>STARTTLS, ACL for</primary>
24341 </indexterm>
24342 This option defines the ACL that is run when an SMTP STARTTLS command is
24343 received. See chapter <xref linkend="CHAPACL"/> for further details.
24344 </para>
24345 <para>
24346 <indexterm role="option">
24347 <primary><option>acl_smtp_vrfy</option></primary>
24348 </indexterm>
24349 </para>
24350 <informaltable frame="all">
24351 <tgroup cols="4" colsep="0" rowsep="0">
24352 <colspec colwidth="8*" align="left"/>
24353 <colspec colwidth="6*" align="center"/>
24354 <colspec colwidth="6*" align="center"/>
24355 <colspec colwidth="6*" align="right"/>
24356 <tbody>
24357 <row>
24358 <entry><option>acl_smtp_vrfy</option></entry>
24359 <entry>Use: <emphasis>main</emphasis></entry>
24360 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24361 <entry>Default: <emphasis>unset</emphasis></entry>
24362 </row>
24363 </tbody>
24364 </tgroup>
24365 </informaltable>
24366 <para>
24367 <indexterm role="concept">
24368 <primary>VRFY</primary>
24369 <secondary>ACL for</secondary>
24370 </indexterm>
24371 This option defines the ACL that is run when an SMTP VRFY command is
24372 received. See chapter <xref linkend="CHAPACL"/> for further details.
24373 </para>
24374 <para>
24375 <indexterm role="option">
24376 <primary><option>add_environment</option></primary>
24377 </indexterm>
24378 </para>
24379 <informaltable frame="all">
24380 <tgroup cols="4" colsep="0" rowsep="0">
24381 <colspec colwidth="8*" align="left"/>
24382 <colspec colwidth="6*" align="center"/>
24383 <colspec colwidth="6*" align="center"/>
24384 <colspec colwidth="6*" align="right"/>
24385 <tbody>
24386 <row>
24387 <entry><option>add_environment</option></entry>
24388 <entry>Use: <emphasis>main</emphasis></entry>
24389 <entry>Type: <emphasis>string list</emphasis></entry>
24390 <entry>Default: <emphasis>empty</emphasis></entry>
24391 </row>
24392 </tbody>
24393 </tgroup>
24394 </informaltable>
24395 <para>
24396 <indexterm role="concept">
24397 <primary>environment</primary>
24398 <secondary>set values</secondary>
24399 </indexterm>
24400 This option adds individual environment variables that the
24401 currently linked libraries and programs in child processes may use.
24402 Each list element should be of the form <quote>name=value</quote>.
24403 </para>
24404 <para>
24405 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
24406 </para>
24407 <para>
24408 <indexterm role="option">
24409 <primary><option>admin_groups</option></primary>
24410 </indexterm>
24411 </para>
24412 <informaltable frame="all">
24413 <tgroup cols="4" colsep="0" rowsep="0">
24414 <colspec colwidth="8*" align="left"/>
24415 <colspec colwidth="6*" align="center"/>
24416 <colspec colwidth="6*" align="center"/>
24417 <colspec colwidth="6*" align="right"/>
24418 <tbody>
24419 <row>
24420 <entry><option>admin_groups</option></entry>
24421 <entry>Use: <emphasis>main</emphasis></entry>
24422 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
24423 <entry>Default: <emphasis>unset</emphasis></entry>
24424 </row>
24425 </tbody>
24426 </tgroup>
24427 </informaltable>
24428 <para>
24429 <indexterm role="concept">
24430 <primary>admin user</primary>
24431 </indexterm>
24432 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
24433 current group or any of the supplementary groups of an Exim caller is in this
24434 colon-separated list, the caller has admin privileges. If all your system
24435 programmers are in a specific group, for example, you can give them all Exim
24436 admin privileges by putting that group in <option>admin_groups</option>. However, this does
24437 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
24438 To permit this, you have to add individuals to the Exim group.
24439 </para>
24440 <para>
24441 <indexterm role="option">
24442 <primary><option>allow_domain_literals</option></primary>
24443 </indexterm>
24444 </para>
24445 <informaltable frame="all">
24446 <tgroup cols="4" colsep="0" rowsep="0">
24447 <colspec colwidth="8*" align="left"/>
24448 <colspec colwidth="6*" align="center"/>
24449 <colspec colwidth="6*" align="center"/>
24450 <colspec colwidth="6*" align="right"/>
24451 <tbody>
24452 <row>
24453 <entry><option>allow_domain_literals</option></entry>
24454 <entry>Use: <emphasis>main</emphasis></entry>
24455 <entry>Type: <emphasis>boolean</emphasis></entry>
24456 <entry>Default: <emphasis>false</emphasis></entry>
24457 </row>
24458 </tbody>
24459 </tgroup>
24460 </informaltable>
24461 <para>
24462 <indexterm role="concept">
24463 <primary>domain literal</primary>
24464 </indexterm>
24465 If this option is set, the RFC 2822 domain literal format is permitted in
24466 email addresses. The option is not set by default, because the domain literal
24467 format is not normally required these days, and few people know about it. It
24468 has, however, been exploited by mail abusers.
24469 </para>
24470 <para>
24471 Unfortunately, it seems that some DNS black list maintainers are using this
24472 format to report black listing to postmasters. If you want to accept messages
24473 addressed to your hosts by IP address, you need to set
24474 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
24475 domains (defined in the named domain list <option>local_domains</option> in the default
24476 configuration). This <quote>magic string</quote> matches the domain literal form of all
24477 the local host&#x2019;s IP addresses.
24478 </para>
24479 <para>
24480 <indexterm role="option">
24481 <primary><option>allow_mx_to_ip</option></primary>
24482 </indexterm>
24483 </para>
24484 <informaltable frame="all">
24485 <tgroup cols="4" colsep="0" rowsep="0">
24486 <colspec colwidth="8*" align="left"/>
24487 <colspec colwidth="6*" align="center"/>
24488 <colspec colwidth="6*" align="center"/>
24489 <colspec colwidth="6*" align="right"/>
24490 <tbody>
24491 <row>
24492 <entry><option>allow_mx_to_ip</option></entry>
24493 <entry>Use: <emphasis>main</emphasis></entry>
24494 <entry>Type: <emphasis>boolean</emphasis></entry>
24495 <entry>Default: <emphasis>false</emphasis></entry>
24496 </row>
24497 </tbody>
24498 </tgroup>
24499 </informaltable>
24500 <para>
24501 <indexterm role="concept">
24502 <primary>MX record</primary>
24503 <secondary>pointing to IP address</secondary>
24504 </indexterm>
24505 It appears that more and more DNS zone administrators are breaking the rules
24506 and putting domain names that look like IP addresses on the right hand side of
24507 MX records. Exim follows the rules and rejects this, giving an error message
24508 that explains the misconfiguration. However, some other MTAs support this
24509 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
24510 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
24511 recommended, except when you have no other choice.
24512 </para>
24513 <para>
24514 <indexterm role="option">
24515 <primary><option>allow_utf8_domains</option></primary>
24516 </indexterm>
24517 </para>
24518 <informaltable frame="all">
24519 <tgroup cols="4" colsep="0" rowsep="0">
24520 <colspec colwidth="8*" align="left"/>
24521 <colspec colwidth="6*" align="center"/>
24522 <colspec colwidth="6*" align="center"/>
24523 <colspec colwidth="6*" align="right"/>
24524 <tbody>
24525 <row>
24526 <entry><option>allow_utf8_domains</option></entry>
24527 <entry>Use: <emphasis>main</emphasis></entry>
24528 <entry>Type: <emphasis>boolean</emphasis></entry>
24529 <entry>Default: <emphasis>false</emphasis></entry>
24530 </row>
24531 </tbody>
24532 </tgroup>
24533 </informaltable>
24534 <para>
24535 <indexterm role="concept">
24536 <primary>domain</primary>
24537 <secondary>UTF-8 characters in</secondary>
24538 </indexterm>
24539 <indexterm role="concept">
24540 <primary>UTF-8</primary>
24541 <secondary>in domain name</secondary>
24542 </indexterm>
24543 Lots of discussion is going on about internationalized domain names. One
24544 camp is strongly in favour of just using UTF-8 characters, and it seems
24545 that at least two other MTAs permit this.
24546 This option allows Exim users to experiment if they wish.
24547 </para>
24548 <para>
24549 If it is set true, Exim&#x2019;s domain parsing function allows valid
24550 UTF-8 multicharacters to appear in domain name components, in addition to
24551 letters, digits, and hyphens.
24552 </para>
24553 <para>
24554 If Exim is built with internationalization support
24555 and the SMTPUTF8 ESMTP option is in use (see chapter <xref linkend="CHAPi18n"/>)
24556 this option can be left as default.
24557 Without that,
24558 if you want to look up such domain names in the DNS, you must also
24559 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
24560 suitable setting is:
24561 </para>
24562 <literallayout class="monospaced">
24563 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
24564   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
24565 </literallayout>
24566 <para>
24567 Alternatively, you can just disable this feature by setting
24568 </para>
24569 <literallayout class="monospaced">
24570 dns_check_names_pattern =
24571 </literallayout>
24572 <para>
24573 That is, set the option to an empty string so that no check is done.
24574 </para>
24575 <para>
24576 <indexterm role="option">
24577 <primary><option>auth_advertise_hosts</option></primary>
24578 </indexterm>
24579 </para>
24580 <informaltable frame="all">
24581 <tgroup cols="4" colsep="0" rowsep="0">
24582 <colspec colwidth="8*" align="left"/>
24583 <colspec colwidth="6*" align="center"/>
24584 <colspec colwidth="6*" align="center"/>
24585 <colspec colwidth="6*" align="right"/>
24586 <tbody>
24587 <row>
24588 <entry><option>auth_advertise_hosts</option></entry>
24589 <entry>Use: <emphasis>main</emphasis></entry>
24590 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24591 <entry>Default: <emphasis>*</emphasis></entry>
24592 </row>
24593 </tbody>
24594 </tgroup>
24595 </informaltable>
24596 <para>
24597 <indexterm role="concept">
24598 <primary>authentication</primary>
24599 <secondary>advertising</secondary>
24600 </indexterm>
24601 <indexterm role="concept">
24602 <primary>AUTH</primary>
24603 <secondary>advertising</secondary>
24604 </indexterm>
24605 <indexterm role="concept">
24606 <primary>ESMTP extensions</primary>
24607 <secondary>AUTH</secondary>
24608 </indexterm>
24609 If any server authentication mechanisms are configured, Exim advertises them in
24610 response to an EHLO command only if the calling host matches this list.
24611 Otherwise, Exim does not advertise AUTH.
24612 Exim does not accept AUTH commands from clients to which it has not
24613 advertised the availability of AUTH. The advertising of individual
24614 authentication mechanisms can be controlled by the use of the
24615 <option>server_advertise_condition</option> generic authenticator option on the individual
24616 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
24617 </para>
24618 <para>
24619 Certain mail clients (for example, Netscape) require the user to provide a name
24620 and password for authentication if AUTH is advertised, even though it may
24621 not be needed (the host may accept messages from hosts on its local LAN without
24622 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
24623 to make these clients more friendly by excluding them from the set of hosts to
24624 which Exim advertises AUTH.
24625 </para>
24626 <para>
24627 <indexterm role="concept">
24628 <primary>AUTH</primary>
24629 <secondary>advertising when encrypted</secondary>
24630 </indexterm>
24631 If you want to advertise the availability of AUTH only when the connection
24632 is encrypted using TLS, you can make use of the fact that the value of this
24633 option is expanded, with a setting like this:
24634 </para>
24635 <literallayout class="monospaced">
24636 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
24637 </literallayout>
24638 <para>
24639 <indexterm role="variable">
24640 <primary><varname>$tls_in_cipher</varname></primary>
24641 </indexterm>
24642 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
24643 the expansion is empty, thus matching no hosts. Otherwise, the result of the
24644 expansion is *, which matches all hosts.
24645 </para>
24646 <para>
24647 <indexterm role="option">
24648 <primary><option>auto_thaw</option></primary>
24649 </indexterm>
24650 </para>
24651 <informaltable frame="all">
24652 <tgroup cols="4" colsep="0" rowsep="0">
24653 <colspec colwidth="8*" align="left"/>
24654 <colspec colwidth="6*" align="center"/>
24655 <colspec colwidth="6*" align="center"/>
24656 <colspec colwidth="6*" align="right"/>
24657 <tbody>
24658 <row>
24659 <entry><option>auto_thaw</option></entry>
24660 <entry>Use: <emphasis>main</emphasis></entry>
24661 <entry>Type: <emphasis>time</emphasis></entry>
24662 <entry>Default: <emphasis>0s</emphasis></entry>
24663 </row>
24664 </tbody>
24665 </tgroup>
24666 </informaltable>
24667 <para>
24668 <indexterm role="concept">
24669 <primary>thawing messages</primary>
24670 </indexterm>
24671 <indexterm role="concept">
24672 <primary>unfreezing messages</primary>
24673 </indexterm>
24674 If this option is set to a time greater than zero, a queue runner will try a
24675 new delivery attempt on any frozen message, other than a bounce message, if
24676 this much time has passed since it was frozen. This may result in the message
24677 being re-frozen if nothing has changed since the last attempt. It is a way of
24678 saying <quote>keep on trying, even though there are big problems</quote>.
24679 </para>
24680 <para>
24681 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
24682 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
24683 thought to be very useful any more, and its use should probably be avoided.
24684 </para>
24685 <para>
24686 <indexterm role="option">
24687 <primary><option>av_scanner</option></primary>
24688 </indexterm>
24689 </para>
24690 <informaltable frame="all">
24691 <tgroup cols="4" colsep="0" rowsep="0">
24692 <colspec colwidth="8*" align="left"/>
24693 <colspec colwidth="6*" align="center"/>
24694 <colspec colwidth="6*" align="center"/>
24695 <colspec colwidth="6*" align="right"/>
24696 <tbody>
24697 <row>
24698 <entry><option>av_scanner</option></entry>
24699 <entry>Use: <emphasis>main</emphasis></entry>
24700 <entry>Type: <emphasis>string</emphasis></entry>
24701 <entry>Default: <emphasis>see below</emphasis></entry>
24702 </row>
24703 </tbody>
24704 </tgroup>
24705 </informaltable>
24706 <para>
24707 This option is available if Exim is built with the content-scanning extension.
24708 It specifies which anti-virus scanner to use. The default value is:
24709 </para>
24710 <literallayout class="monospaced">
24711 sophie:/var/run/sophie
24712 </literallayout>
24713 <para>
24714 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
24715 before use. See section <xref linkend="SECTscanvirus"/> for further details.
24716 </para>
24717 <para>
24718 <indexterm role="option">
24719 <primary><option>bi_command</option></primary>
24720 </indexterm>
24721 </para>
24722 <informaltable frame="all">
24723 <tgroup cols="4" colsep="0" rowsep="0">
24724 <colspec colwidth="8*" align="left"/>
24725 <colspec colwidth="6*" align="center"/>
24726 <colspec colwidth="6*" align="center"/>
24727 <colspec colwidth="6*" align="right"/>
24728 <tbody>
24729 <row>
24730 <entry><option>bi_command</option></entry>
24731 <entry>Use: <emphasis>main</emphasis></entry>
24732 <entry>Type: <emphasis>string</emphasis></entry>
24733 <entry>Default: <emphasis>unset</emphasis></entry>
24734 </row>
24735 </tbody>
24736 </tgroup>
24737 </informaltable>
24738 <para>
24739 <indexterm role="option">
24740 <primary><option>-bi</option></primary>
24741 </indexterm>
24742 This option supplies the name of a command that is run when Exim is called with
24743 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
24744 just the command name, it is not a complete command line. If an argument is
24745 required, it must come from the <option>-oA</option> command line option.
24746 </para>
24747 <para>
24748 <indexterm role="option">
24749 <primary><option>bounce_message_file</option></primary>
24750 </indexterm>
24751 </para>
24752 <informaltable frame="all">
24753 <tgroup cols="4" colsep="0" rowsep="0">
24754 <colspec colwidth="8*" align="left"/>
24755 <colspec colwidth="6*" align="center"/>
24756 <colspec colwidth="6*" align="center"/>
24757 <colspec colwidth="6*" align="right"/>
24758 <tbody>
24759 <row>
24760 <entry><option>bounce_message_file</option></entry>
24761 <entry>Use: <emphasis>main</emphasis></entry>
24762 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24763 <entry>Default: <emphasis>unset</emphasis></entry>
24764 </row>
24765 </tbody>
24766 </tgroup>
24767 </informaltable>
24768 <para>
24769 <indexterm role="concept">
24770 <primary>bounce message</primary>
24771 <secondary>customizing</secondary>
24772 </indexterm>
24773 <indexterm role="concept">
24774 <primary>customizing</primary>
24775 <secondary>bounce message</secondary>
24776 </indexterm>
24777 This option defines a template file containing paragraphs of text to be used
24778 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
24779 chapter <xref linkend="CHAPemsgcust"/>.
24780 </para>
24781 <para revisionflag="changed">
24782 <indexterm role="concept">
24783 <primary>bounce_message_file</primary>
24784 <secondary>tainted data</secondary>
24785 </indexterm>
24786 The option is expanded to give the file path, which must be
24787 absolute and untainted.
24788 </para>
24789 <para>
24790 See also <option>warn_message_file</option>.
24791 </para>
24792 <para>
24793 <indexterm role="option">
24794 <primary><option>bounce_message_text</option></primary>
24795 </indexterm>
24796 </para>
24797 <informaltable frame="all">
24798 <tgroup cols="4" colsep="0" rowsep="0">
24799 <colspec colwidth="8*" align="left"/>
24800 <colspec colwidth="6*" align="center"/>
24801 <colspec colwidth="6*" align="center"/>
24802 <colspec colwidth="6*" align="right"/>
24803 <tbody>
24804 <row>
24805 <entry><option>bounce_message_text</option></entry>
24806 <entry>Use: <emphasis>main</emphasis></entry>
24807 <entry>Type: <emphasis>string</emphasis></entry>
24808 <entry>Default: <emphasis>unset</emphasis></entry>
24809 </row>
24810 </tbody>
24811 </tgroup>
24812 </informaltable>
24813 <para>
24814 When this option is set, its contents are included in the default bounce
24815 message immediately after <quote>This message was created automatically by mail
24816 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
24817 </para>
24818 <para>
24819 <indexterm role="option">
24820 <primary><option>bounce_return_body</option></primary>
24821 </indexterm>
24822 </para>
24823 <informaltable frame="all">
24824 <tgroup cols="4" colsep="0" rowsep="0">
24825 <colspec colwidth="8*" align="left"/>
24826 <colspec colwidth="6*" align="center"/>
24827 <colspec colwidth="6*" align="center"/>
24828 <colspec colwidth="6*" align="right"/>
24829 <tbody>
24830 <row>
24831 <entry><option>bounce_return_body</option></entry>
24832 <entry>Use: <emphasis>main</emphasis></entry>
24833 <entry>Type: <emphasis>boolean</emphasis></entry>
24834 <entry>Default: <emphasis>true</emphasis></entry>
24835 </row>
24836 </tbody>
24837 </tgroup>
24838 </informaltable>
24839 <para>
24840 <indexterm role="concept">
24841 <primary>bounce message</primary>
24842 <secondary>including body</secondary>
24843 </indexterm>
24844 This option controls whether the body of an incoming message is included in a
24845 bounce message when <option>bounce_return_message</option> is true. The default setting
24846 causes the entire message, both header and body, to be returned (subject to the
24847 value of <option>bounce_return_size_limit</option>). If this option is false, only the
24848 message header is included. In the case of a non-SMTP message containing an
24849 error that is detected during reception, only those header lines preceding the
24850 point at which the error was detected are returned.
24851 <indexterm role="concept">
24852 <primary>bounce message</primary>
24853 <secondary>including original</secondary>
24854 </indexterm>
24855 </para>
24856 <para>
24857 <indexterm role="option">
24858 <primary><option>bounce_return_linesize_limit</option></primary>
24859 </indexterm>
24860 </para>
24861 <informaltable frame="all">
24862 <tgroup cols="4" colsep="0" rowsep="0">
24863 <colspec colwidth="8*" align="left"/>
24864 <colspec colwidth="6*" align="center"/>
24865 <colspec colwidth="6*" align="center"/>
24866 <colspec colwidth="6*" align="right"/>
24867 <tbody>
24868 <row>
24869 <entry><option>bounce_return_linesize_limit</option></entry>
24870 <entry>Use: <emphasis>main</emphasis></entry>
24871 <entry>Type: <emphasis>integer</emphasis></entry>
24872 <entry>Default: <emphasis>998</emphasis></entry>
24873 </row>
24874 </tbody>
24875 </tgroup>
24876 </informaltable>
24877 <para>
24878 <indexterm role="concept">
24879 <primary>size</primary>
24880 <secondary>of bounce lines, limit</secondary>
24881 </indexterm>
24882 <indexterm role="concept">
24883 <primary>bounce message</primary>
24884 <secondary>line length limit</secondary>
24885 </indexterm>
24886 <indexterm role="concept">
24887 <primary>limit</primary>
24888 <secondary>bounce message line length</secondary>
24889 </indexterm>
24890 This option sets a limit in bytes on the line length of messages
24891 that are returned to senders due to delivery problems,
24892 when <option>bounce_return_message</option> is true.
24893 The default value corresponds to RFC limits.
24894 If the message being returned has lines longer than this value it is
24895 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
24896 </para>
24897 <para>
24898 The option also applies to bounces returned when an error is detected
24899 during reception of a message.
24900 In this case lines from the original are truncated.
24901 </para>
24902 <para>
24903 The option does not apply to messages generated by an <command>autoreply</command> transport.
24904 </para>
24905 <para>
24906 <indexterm role="option">
24907 <primary><option>bounce_return_message</option></primary>
24908 </indexterm>
24909 </para>
24910 <informaltable frame="all">
24911 <tgroup cols="4" colsep="0" rowsep="0">
24912 <colspec colwidth="8*" align="left"/>
24913 <colspec colwidth="6*" align="center"/>
24914 <colspec colwidth="6*" align="center"/>
24915 <colspec colwidth="6*" align="right"/>
24916 <tbody>
24917 <row>
24918 <entry><option>bounce_return_message</option></entry>
24919 <entry>Use: <emphasis>main</emphasis></entry>
24920 <entry>Type: <emphasis>boolean</emphasis></entry>
24921 <entry>Default: <emphasis>true</emphasis></entry>
24922 </row>
24923 </tbody>
24924 </tgroup>
24925 </informaltable>
24926 <para>
24927 If this option is set false, none of the original message is included in
24928 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
24929 <option>bounce_return_body</option>.
24930 </para>
24931 <para>
24932 <indexterm role="option">
24933 <primary><option>bounce_return_size_limit</option></primary>
24934 </indexterm>
24935 </para>
24936 <informaltable frame="all">
24937 <tgroup cols="4" colsep="0" rowsep="0">
24938 <colspec colwidth="8*" align="left"/>
24939 <colspec colwidth="6*" align="center"/>
24940 <colspec colwidth="6*" align="center"/>
24941 <colspec colwidth="6*" align="right"/>
24942 <tbody>
24943 <row>
24944 <entry><option>bounce_return_size_limit</option></entry>
24945 <entry>Use: <emphasis>main</emphasis></entry>
24946 <entry>Type: <emphasis>integer</emphasis></entry>
24947 <entry>Default: <emphasis>100K</emphasis></entry>
24948 </row>
24949 </tbody>
24950 </tgroup>
24951 </informaltable>
24952 <para>
24953 <indexterm role="concept">
24954 <primary>size</primary>
24955 <secondary>of bounce, limit</secondary>
24956 </indexterm>
24957 <indexterm role="concept">
24958 <primary>bounce message</primary>
24959 <secondary>size limit</secondary>
24960 </indexterm>
24961 <indexterm role="concept">
24962 <primary>limit</primary>
24963 <secondary>bounce message size</secondary>
24964 </indexterm>
24965 This option sets a limit in bytes on the size of messages that are returned to
24966 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
24967 limit should be less than the value of the global <option>message_size_limit</option> and of
24968 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
24969 that Exim generates. If this option is set to zero there is no limit.
24970 </para>
24971 <para>
24972 When the body of any message that is to be included in a bounce message is
24973 greater than the limit, it is truncated, and a comment pointing this out is
24974 added at the top. The actual cutoff may be greater than the value given, owing
24975 to the use of buffering for transferring the message in chunks (typically 8K in
24976 size). The idea is to save bandwidth on those undeliverable 15-megabyte
24977 messages.
24978 </para>
24979 <para>
24980 <indexterm role="option">
24981 <primary><option>bounce_sender_authentication</option></primary>
24982 </indexterm>
24983 </para>
24984 <informaltable frame="all">
24985 <tgroup cols="4" colsep="0" rowsep="0">
24986 <colspec colwidth="8*" align="left"/>
24987 <colspec colwidth="6*" align="center"/>
24988 <colspec colwidth="6*" align="center"/>
24989 <colspec colwidth="6*" align="right"/>
24990 <tbody>
24991 <row>
24992 <entry><option>bounce_sender_authentication</option></entry>
24993 <entry>Use: <emphasis>main</emphasis></entry>
24994 <entry>Type: <emphasis>string</emphasis></entry>
24995 <entry>Default: <emphasis>unset</emphasis></entry>
24996 </row>
24997 </tbody>
24998 </tgroup>
24999 </informaltable>
25000 <para>
25001 <indexterm role="concept">
25002 <primary>bounce message</primary>
25003 <secondary>sender authentication</secondary>
25004 </indexterm>
25005 <indexterm role="concept">
25006 <primary>authentication</primary>
25007 <secondary>bounce message</secondary>
25008 </indexterm>
25009 <indexterm role="concept">
25010 <primary>AUTH</primary>
25011 <secondary>on bounce message</secondary>
25012 </indexterm>
25013 This option provides an authenticated sender address that is sent with any
25014 bounce messages generated by Exim that are sent over an authenticated SMTP
25015 connection. A typical setting might be:
25016 </para>
25017 <literallayout class="monospaced">
25018 bounce_sender_authentication = mailer-daemon@my.domain.example
25019 </literallayout>
25020 <para>
25021 which would cause bounce messages to be sent using the SMTP command:
25022 </para>
25023 <literallayout class="monospaced">
25024 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
25025 </literallayout>
25026 <para>
25027 The value of <option>bounce_sender_authentication</option> must always be a complete email
25028 address.
25029 </para>
25030 <para>
25031 <indexterm role="option">
25032 <primary><option>callout_domain_negative_expire</option></primary>
25033 </indexterm>
25034 </para>
25035 <informaltable frame="all">
25036 <tgroup cols="4" colsep="0" rowsep="0">
25037 <colspec colwidth="8*" align="left"/>
25038 <colspec colwidth="6*" align="center"/>
25039 <colspec colwidth="6*" align="center"/>
25040 <colspec colwidth="6*" align="right"/>
25041 <tbody>
25042 <row>
25043 <entry><option>callout_domain_negative_expire</option></entry>
25044 <entry>Use: <emphasis>main</emphasis></entry>
25045 <entry>Type: <emphasis>time</emphasis></entry>
25046 <entry>Default: <emphasis>3h</emphasis></entry>
25047 </row>
25048 </tbody>
25049 </tgroup>
25050 </informaltable>
25051 <para>
25052 <indexterm role="concept">
25053 <primary>caching</primary>
25054 <secondary>callout timeouts</secondary>
25055 </indexterm>
25056 <indexterm role="concept">
25057 <primary>callout</primary>
25058 <secondary>caching timeouts</secondary>
25059 </indexterm>
25060 This option specifies the expiry time for negative callout cache data for a
25061 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25062 section <xref linkend="SECTcallvercache"/> for details of the caching.
25063 </para>
25064 <para>
25065 <indexterm role="option">
25066 <primary><option>callout_domain_positive_expire</option></primary>
25067 </indexterm>
25068 </para>
25069 <informaltable frame="all">
25070 <tgroup cols="4" colsep="0" rowsep="0">
25071 <colspec colwidth="8*" align="left"/>
25072 <colspec colwidth="6*" align="center"/>
25073 <colspec colwidth="6*" align="center"/>
25074 <colspec colwidth="6*" align="right"/>
25075 <tbody>
25076 <row>
25077 <entry><option>callout_domain_positive_expire</option></entry>
25078 <entry>Use: <emphasis>main</emphasis></entry>
25079 <entry>Type: <emphasis>time</emphasis></entry>
25080 <entry>Default: <emphasis>7d</emphasis></entry>
25081 </row>
25082 </tbody>
25083 </tgroup>
25084 </informaltable>
25085 <para>
25086 This option specifies the expiry time for positive callout cache data for a
25087 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25088 section <xref linkend="SECTcallvercache"/> for details of the caching.
25089 </para>
25090 <para>
25091 <indexterm role="option">
25092 <primary><option>callout_negative_expire</option></primary>
25093 </indexterm>
25094 </para>
25095 <informaltable frame="all">
25096 <tgroup cols="4" colsep="0" rowsep="0">
25097 <colspec colwidth="8*" align="left"/>
25098 <colspec colwidth="6*" align="center"/>
25099 <colspec colwidth="6*" align="center"/>
25100 <colspec colwidth="6*" align="right"/>
25101 <tbody>
25102 <row>
25103 <entry><option>callout_negative_expire</option></entry>
25104 <entry>Use: <emphasis>main</emphasis></entry>
25105 <entry>Type: <emphasis>time</emphasis></entry>
25106 <entry>Default: <emphasis>2h</emphasis></entry>
25107 </row>
25108 </tbody>
25109 </tgroup>
25110 </informaltable>
25111 <para>
25112 This option specifies the expiry time for negative callout cache data for an
25113 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25114 section <xref linkend="SECTcallvercache"/> for details of the caching.
25115 </para>
25116 <para>
25117 <indexterm role="option">
25118 <primary><option>callout_positive_expire</option></primary>
25119 </indexterm>
25120 </para>
25121 <informaltable frame="all">
25122 <tgroup cols="4" colsep="0" rowsep="0">
25123 <colspec colwidth="8*" align="left"/>
25124 <colspec colwidth="6*" align="center"/>
25125 <colspec colwidth="6*" align="center"/>
25126 <colspec colwidth="6*" align="right"/>
25127 <tbody>
25128 <row>
25129 <entry><option>callout_positive_expire</option></entry>
25130 <entry>Use: <emphasis>main</emphasis></entry>
25131 <entry>Type: <emphasis>time</emphasis></entry>
25132 <entry>Default: <emphasis>24h</emphasis></entry>
25133 </row>
25134 </tbody>
25135 </tgroup>
25136 </informaltable>
25137 <para>
25138 This option specifies the expiry time for positive callout cache data for an
25139 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25140 section <xref linkend="SECTcallvercache"/> for details of the caching.
25141 </para>
25142 <para>
25143 <indexterm role="option">
25144 <primary><option>callout_random_local_part</option></primary>
25145 </indexterm>
25146 </para>
25147 <informaltable frame="all">
25148 <tgroup cols="4" colsep="0" rowsep="0">
25149 <colspec colwidth="8*" align="left"/>
25150 <colspec colwidth="6*" align="center"/>
25151 <colspec colwidth="6*" align="center"/>
25152 <colspec colwidth="6*" align="right"/>
25153 <tbody>
25154 <row>
25155 <entry><option>callout_random_local_part</option></entry>
25156 <entry>Use: <emphasis>main</emphasis></entry>
25157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25158 <entry>Default: <emphasis>see below</emphasis></entry>
25159 </row>
25160 </tbody>
25161 </tgroup>
25162 </informaltable>
25163 <para>
25164 This option defines the <quote>random</quote> local part that can be used as part of
25165 callout verification. The default value is
25166 </para>
25167 <literallayout class="monospaced">
25168 $primary_hostname-$tod_epoch-testing
25169 </literallayout>
25170 <para>
25171 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
25172 </para>
25173 <para>
25174 <indexterm role="option">
25175 <primary><option>check_log_inodes</option></primary>
25176 </indexterm>
25177 </para>
25178 <informaltable frame="all">
25179 <tgroup cols="4" colsep="0" rowsep="0">
25180 <colspec colwidth="8*" align="left"/>
25181 <colspec colwidth="6*" align="center"/>
25182 <colspec colwidth="6*" align="center"/>
25183 <colspec colwidth="6*" align="right"/>
25184 <tbody>
25185 <row>
25186 <entry><option>check_log_inodes</option></entry>
25187 <entry>Use: <emphasis>main</emphasis></entry>
25188 <entry>Type: <emphasis>integer</emphasis></entry>
25189 <entry>Default: <emphasis>100</emphasis></entry>
25190 </row>
25191 </tbody>
25192 </tgroup>
25193 </informaltable>
25194 <para>
25195 See <option>check_spool_space</option> below.
25196 </para>
25197 <para>
25198 <indexterm role="option">
25199 <primary><option>check_log_space</option></primary>
25200 </indexterm>
25201 </para>
25202 <informaltable frame="all">
25203 <tgroup cols="4" colsep="0" rowsep="0">
25204 <colspec colwidth="8*" align="left"/>
25205 <colspec colwidth="6*" align="center"/>
25206 <colspec colwidth="6*" align="center"/>
25207 <colspec colwidth="6*" align="right"/>
25208 <tbody>
25209 <row>
25210 <entry><option>check_log_space</option></entry>
25211 <entry>Use: <emphasis>main</emphasis></entry>
25212 <entry>Type: <emphasis>integer</emphasis></entry>
25213 <entry>Default: <emphasis>10M</emphasis></entry>
25214 </row>
25215 </tbody>
25216 </tgroup>
25217 </informaltable>
25218 <para>
25219 See <option>check_spool_space</option> below.
25220 </para>
25221 <para>
25222 <indexterm role="option">
25223 <primary><option>check_rfc2047_length</option></primary>
25224 </indexterm>
25225 <indexterm role="concept">
25226 <primary>RFC 2047</primary>
25227 <secondary>disabling length check</secondary>
25228 </indexterm>
25229 <indexterm role="option">
25230 <primary><option>check_rfc2047_length</option></primary>
25231 </indexterm>
25232 </para>
25233 <informaltable frame="all">
25234 <tgroup cols="4" colsep="0" rowsep="0">
25235 <colspec colwidth="8*" align="left"/>
25236 <colspec colwidth="6*" align="center"/>
25237 <colspec colwidth="6*" align="center"/>
25238 <colspec colwidth="6*" align="right"/>
25239 <tbody>
25240 <row>
25241 <entry><option>check_rfc2047_length</option></entry>
25242 <entry>Use: <emphasis>main</emphasis></entry>
25243 <entry>Type: <emphasis>boolean</emphasis></entry>
25244 <entry>Default: <emphasis>true</emphasis></entry>
25245 </row>
25246 </tbody>
25247 </tgroup>
25248 </informaltable>
25249 <para>
25250 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
25251 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
25252 word; strings to be encoded that exceed this length are supposed to use
25253 multiple encoded words. By default, Exim does not recognize encoded words that
25254 exceed the maximum length. However, it seems that some software, in violation
25255 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
25256 set false, Exim recognizes encoded words of any length.
25257 </para>
25258 <para>
25259 <indexterm role="option">
25260 <primary><option>check_spool_inodes</option></primary>
25261 </indexterm>
25262 </para>
25263 <informaltable frame="all">
25264 <tgroup cols="4" colsep="0" rowsep="0">
25265 <colspec colwidth="8*" align="left"/>
25266 <colspec colwidth="6*" align="center"/>
25267 <colspec colwidth="6*" align="center"/>
25268 <colspec colwidth="6*" align="right"/>
25269 <tbody>
25270 <row>
25271 <entry><option>check_spool_inodes</option></entry>
25272 <entry>Use: <emphasis>main</emphasis></entry>
25273 <entry>Type: <emphasis>integer</emphasis></entry>
25274 <entry>Default: <emphasis>100</emphasis></entry>
25275 </row>
25276 </tbody>
25277 </tgroup>
25278 </informaltable>
25279 <para>
25280 See <option>check_spool_space</option> below.
25281 </para>
25282 <para>
25283 <indexterm role="option">
25284 <primary><option>check_spool_space</option></primary>
25285 </indexterm>
25286 </para>
25287 <informaltable frame="all">
25288 <tgroup cols="4" colsep="0" rowsep="0">
25289 <colspec colwidth="8*" align="left"/>
25290 <colspec colwidth="6*" align="center"/>
25291 <colspec colwidth="6*" align="center"/>
25292 <colspec colwidth="6*" align="right"/>
25293 <tbody>
25294 <row>
25295 <entry><option>check_spool_space</option></entry>
25296 <entry>Use: <emphasis>main</emphasis></entry>
25297 <entry>Type: <emphasis>integer</emphasis></entry>
25298 <entry>Default: <emphasis>10M</emphasis></entry>
25299 </row>
25300 </tbody>
25301 </tgroup>
25302 </informaltable>
25303 <para>
25304 <indexterm role="concept">
25305 <primary>checking disk space</primary>
25306 </indexterm>
25307 <indexterm role="concept">
25308 <primary>disk space, checking</primary>
25309 </indexterm>
25310 <indexterm role="concept">
25311 <primary>spool directory</primary>
25312 <secondary>checking space</secondary>
25313 </indexterm>
25314 The four <option>check_...</option> options allow for checking of disk resources before a
25315 message is accepted.
25316 </para>
25317 <para>
25318 <indexterm role="variable">
25319 <primary><varname>$log_inodes</varname></primary>
25320 </indexterm>
25321 <indexterm role="variable">
25322 <primary><varname>$log_space</varname></primary>
25323 </indexterm>
25324 <indexterm role="variable">
25325 <primary><varname>$spool_inodes</varname></primary>
25326 </indexterm>
25327 <indexterm role="variable">
25328 <primary><varname>$spool_space</varname></primary>
25329 </indexterm>
25330 When any of these options are nonzero, they apply to all incoming messages. If you
25331 want to apply different checks to different kinds of message, you can do so by
25332 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
25333 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
25334 </para>
25335 <para>
25336 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
25337 either value is greater than zero, for example:
25338 </para>
25339 <literallayout class="monospaced">
25340 check_spool_space = 100M
25341 check_spool_inodes = 100
25342 </literallayout>
25343 <para>
25344 The spool partition is the one that contains the directory defined by
25345 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
25346 transit.
25347 </para>
25348 <para>
25349 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
25350 files are written if either is greater than zero. These should be set only if
25351 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
25352 </para>
25353 <para>
25354 If there is less space or fewer inodes than requested, Exim refuses to accept
25355 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
25356 error response to the MAIL command. If ESMTP is in use and there was a
25357 SIZE parameter on the MAIL command, its value is added to the
25358 <option>check_spool_space</option> value, and the check is performed even if
25359 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
25360 </para>
25361 <para>
25362 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
25363 number of kilobytes (though specified in bytes).
25364 If a non-multiple of 1024 is specified, it is rounded up.
25365 </para>
25366 <para>
25367 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
25368 failure a message is written to stderr and Exim exits with a non-zero code, as
25369 it obviously cannot send an error message of any kind.
25370 </para>
25371 <para>
25372 There is a slight performance penalty for these checks.
25373 Versions of Exim preceding 4.88 had these disabled by default;
25374 high-rate installations confident they will never run out of resources
25375 may wish to deliberately disable them.
25376 </para>
25377 <para>
25378 <indexterm role="option">
25379 <primary><option>chunking_advertise_hosts</option></primary>
25380 </indexterm>
25381 </para>
25382 <informaltable frame="all">
25383 <tgroup cols="4" colsep="0" rowsep="0">
25384 <colspec colwidth="8*" align="left"/>
25385 <colspec colwidth="6*" align="center"/>
25386 <colspec colwidth="6*" align="center"/>
25387 <colspec colwidth="6*" align="right"/>
25388 <tbody>
25389 <row>
25390 <entry><option>chunking_advertise_hosts</option></entry>
25391 <entry>Use: <emphasis>main</emphasis></entry>
25392 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25393 <entry>Default: <emphasis>*</emphasis></entry>
25394 </row>
25395 </tbody>
25396 </tgroup>
25397 </informaltable>
25398 <para>
25399 <indexterm role="concept">
25400 <primary>CHUNKING</primary>
25401 <secondary>advertisement</secondary>
25402 </indexterm>
25403 <indexterm role="concept">
25404 <primary>RFC 3030</primary>
25405 <secondary>CHUNKING</secondary>
25406 </indexterm>
25407 <indexterm role="concept">
25408 <primary>ESMTP extensions</primary>
25409 <secondary>CHUNKING</secondary>
25410 </indexterm>
25411 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
25412 these hosts.
25413 Hosts may use the BDAT command as an alternate to DATA.
25414 </para>
25415 <para>
25416 <indexterm role="option">
25417 <primary><option>commandline_checks_require_admin</option></primary>
25418 </indexterm>
25419 </para>
25420 <informaltable frame="all">
25421 <tgroup cols="4" colsep="0" rowsep="0">
25422 <colspec colwidth="8*" align="left"/>
25423 <colspec colwidth="6*" align="center"/>
25424 <colspec colwidth="6*" align="center"/>
25425 <colspec colwidth="6*" align="right"/>
25426 <tbody>
25427 <row>
25428 <entry><option>commandline_checks_require_admin</option></entry>
25429 <entry>Use: <emphasis>main</emphasis></entry>
25430 <entry>Type: <emphasis>boolean</emphasis></entry>
25431 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
25432 </row>
25433 </tbody>
25434 </tgroup>
25435 </informaltable>
25436 <para>
25437 <indexterm role="concept">
25438 <primary>restricting access to features</primary>
25439 </indexterm>
25440 This option restricts various basic checking features to require an
25441 administrative user.
25442 This affects most of the <option>-b*</option> options, such as <option>-be</option>.
25443 </para>
25444 <para>
25445 <indexterm role="option">
25446 <primary><option>debug_store</option></primary>
25447 </indexterm>
25448 </para>
25449 <informaltable frame="all">
25450 <tgroup cols="4" colsep="0" rowsep="0">
25451 <colspec colwidth="8*" align="left"/>
25452 <colspec colwidth="6*" align="center"/>
25453 <colspec colwidth="6*" align="center"/>
25454 <colspec colwidth="6*" align="right"/>
25455 <tbody>
25456 <row>
25457 <entry><option>debug_store</option></entry>
25458 <entry>Use: <emphasis>main</emphasis></entry>
25459 <entry>Type: <emphasis>boolean</emphasis></entry>
25460 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
25461 </row>
25462 </tbody>
25463 </tgroup>
25464 </informaltable>
25465 <para>
25466 <indexterm role="concept">
25467 <primary>debugging</primary>
25468 <secondary>memory corruption</secondary>
25469 </indexterm>
25470 <indexterm role="concept">
25471 <primary>memory</primary>
25472 <secondary>debugging</secondary>
25473 </indexterm>
25474 This option, when true, enables extra checking in Exim&#x2019;s internal memory
25475 management.  For use when a memory corruption issue is being investigated,
25476 it should normally be left as default.
25477 </para>
25478 <para>
25479 <indexterm role="option">
25480 <primary><option>daemon_smtp_ports</option></primary>
25481 </indexterm>
25482 </para>
25483 <informaltable frame="all">
25484 <tgroup cols="4" colsep="0" rowsep="0">
25485 <colspec colwidth="8*" align="left"/>
25486 <colspec colwidth="6*" align="center"/>
25487 <colspec colwidth="6*" align="center"/>
25488 <colspec colwidth="6*" align="right"/>
25489 <tbody>
25490 <row>
25491 <entry><option>daemon_smtp_ports</option></entry>
25492 <entry>Use: <emphasis>main</emphasis></entry>
25493 <entry>Type: <emphasis>string</emphasis></entry>
25494 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
25495 </row>
25496 </tbody>
25497 </tgroup>
25498 </informaltable>
25499 <para>
25500 <indexterm role="concept">
25501 <primary>port</primary>
25502 <secondary>for daemon</secondary>
25503 </indexterm>
25504 <indexterm role="concept">
25505 <primary>TCP/IP</primary>
25506 <secondary>setting listening ports</secondary>
25507 </indexterm>
25508 This option specifies one or more default SMTP ports on which the Exim daemon
25509 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
25510 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
25511 </para>
25512 <para>
25513 <indexterm role="option">
25514 <primary><option>daemon_startup_retries</option></primary>
25515 </indexterm>
25516 </para>
25517 <informaltable frame="all">
25518 <tgroup cols="4" colsep="0" rowsep="0">
25519 <colspec colwidth="8*" align="left"/>
25520 <colspec colwidth="6*" align="center"/>
25521 <colspec colwidth="6*" align="center"/>
25522 <colspec colwidth="6*" align="right"/>
25523 <tbody>
25524 <row>
25525 <entry><option>daemon_startup_retries</option></entry>
25526 <entry>Use: <emphasis>main</emphasis></entry>
25527 <entry>Type: <emphasis>integer</emphasis></entry>
25528 <entry>Default: <emphasis>9</emphasis></entry>
25529 </row>
25530 </tbody>
25531 </tgroup>
25532 </informaltable>
25533 <para>
25534 <indexterm role="concept">
25535 <primary>daemon startup, retrying</primary>
25536 </indexterm>
25537 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
25538 the daemon at startup when it cannot immediately bind a listening socket
25539 (typically because the socket is already in use): <option>daemon_startup_retries</option>
25540 defines the number of retries after the first failure, and
25541 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
25542 </para>
25543 <para>
25544 <indexterm role="option">
25545 <primary><option>daemon_startup_sleep</option></primary>
25546 </indexterm>
25547 </para>
25548 <informaltable frame="all">
25549 <tgroup cols="4" colsep="0" rowsep="0">
25550 <colspec colwidth="8*" align="left"/>
25551 <colspec colwidth="6*" align="center"/>
25552 <colspec colwidth="6*" align="center"/>
25553 <colspec colwidth="6*" align="right"/>
25554 <tbody>
25555 <row>
25556 <entry><option>daemon_startup_sleep</option></entry>
25557 <entry>Use: <emphasis>main</emphasis></entry>
25558 <entry>Type: <emphasis>time</emphasis></entry>
25559 <entry>Default: <emphasis>30s</emphasis></entry>
25560 </row>
25561 </tbody>
25562 </tgroup>
25563 </informaltable>
25564 <para>
25565 See <option>daemon_startup_retries</option>.
25566 </para>
25567 <para>
25568 <indexterm role="option">
25569 <primary><option>delay_warning</option></primary>
25570 </indexterm>
25571 </para>
25572 <informaltable frame="all">
25573 <tgroup cols="4" colsep="0" rowsep="0">
25574 <colspec colwidth="8*" align="left"/>
25575 <colspec colwidth="6*" align="center"/>
25576 <colspec colwidth="6*" align="center"/>
25577 <colspec colwidth="6*" align="right"/>
25578 <tbody>
25579 <row>
25580 <entry><option>delay_warning</option></entry>
25581 <entry>Use: <emphasis>main</emphasis></entry>
25582 <entry>Type: <emphasis>time list</emphasis></entry>
25583 <entry>Default: <emphasis>24h</emphasis></entry>
25584 </row>
25585 </tbody>
25586 </tgroup>
25587 </informaltable>
25588 <para>
25589 <indexterm role="concept">
25590 <primary>warning of delay</primary>
25591 </indexterm>
25592 <indexterm role="concept">
25593 <primary>delay warning, specifying</primary>
25594 </indexterm>
25595 <indexterm role="concept">
25596 <primary>queue</primary>
25597 <secondary>delay warning</secondary>
25598 </indexterm>
25599 When a message is delayed, Exim sends a warning message to the sender at
25600 intervals specified by this option. The data is a colon-separated list of times
25601 after which to send warning messages. If the value of the option is an empty
25602 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
25603 message has been in the queue for longer than the last time, the last interval
25604 between the times is used to compute subsequent warning times. For example,
25605 with
25606 </para>
25607 <literallayout class="monospaced">
25608 delay_warning = 4h:8h:24h
25609 </literallayout>
25610 <para>
25611 the first message is sent after 4 hours, the second after 8 hours, and
25612 the third one after 24 hours. After that, messages are sent every 16 hours,
25613 because that is the interval between the last two times on the list. If you set
25614 just one time, it specifies the repeat interval. For example, with:
25615 </para>
25616 <literallayout class="monospaced">
25617 delay_warning = 6h
25618 </literallayout>
25619 <para>
25620 messages are repeated every six hours. To stop warnings after a given time, set
25621 a very large time at the end of the list. For example:
25622 </para>
25623 <literallayout class="monospaced">
25624 delay_warning = 2h:12h:99d
25625 </literallayout>
25626 <para>
25627 Note that the option is only evaluated at the time a delivery attempt fails,
25628 which depends on retry and queue-runner configuration.
25629 Typically retries will be configured more frequently than warning messages.
25630 </para>
25631 <para>
25632 <indexterm role="option">
25633 <primary><option>delay_warning_condition</option></primary>
25634 </indexterm>
25635 </para>
25636 <informaltable frame="all">
25637 <tgroup cols="4" colsep="0" rowsep="0">
25638 <colspec colwidth="8*" align="left"/>
25639 <colspec colwidth="6*" align="center"/>
25640 <colspec colwidth="6*" align="center"/>
25641 <colspec colwidth="6*" align="right"/>
25642 <tbody>
25643 <row>
25644 <entry><option>delay_warning_condition</option></entry>
25645 <entry>Use: <emphasis>main</emphasis></entry>
25646 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25647 <entry>Default: <emphasis>see below</emphasis></entry>
25648 </row>
25649 </tbody>
25650 </tgroup>
25651 </informaltable>
25652 <para>
25653 <indexterm role="variable">
25654 <primary><varname>$domain</varname></primary>
25655 </indexterm>
25656 The string is expanded at the time a warning message might be sent. If all the
25657 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
25658 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
25659 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
25660 <quote>false</quote> (the comparison being done caselessly) then the warning message is
25661 not sent. The default is:
25662 </para>
25663 <literallayout class="monospaced">
25664 delay_warning_condition = ${if or {\
25665   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
25666   { match{$h_precedence:}{(?i)bulk|list|junk} }\
25667   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
25668   } {no}{yes}}
25669 </literallayout>
25670 <para>
25671 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
25672 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
25673 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
25674 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
25675 </para>
25676 <para>
25677 <indexterm role="option">
25678 <primary><option>deliver_drop_privilege</option></primary>
25679 </indexterm>
25680 </para>
25681 <informaltable frame="all">
25682 <tgroup cols="4" colsep="0" rowsep="0">
25683 <colspec colwidth="8*" align="left"/>
25684 <colspec colwidth="6*" align="center"/>
25685 <colspec colwidth="6*" align="center"/>
25686 <colspec colwidth="6*" align="right"/>
25687 <tbody>
25688 <row>
25689 <entry><option>deliver_drop_privilege</option></entry>
25690 <entry>Use: <emphasis>main</emphasis></entry>
25691 <entry>Type: <emphasis>boolean</emphasis></entry>
25692 <entry>Default: <emphasis>false</emphasis></entry>
25693 </row>
25694 </tbody>
25695 </tgroup>
25696 </informaltable>
25697 <para>
25698 <indexterm role="concept">
25699 <primary>unprivileged delivery</primary>
25700 </indexterm>
25701 <indexterm role="concept">
25702 <primary>delivery</primary>
25703 <secondary>unprivileged</secondary>
25704 </indexterm>
25705 If this option is set true, Exim drops its root privilege at the start of a
25706 delivery process, and runs as the Exim user throughout. This severely restricts
25707 the kinds of local delivery that are possible, but is viable in certain types
25708 of configuration. There is a discussion about the use of root privilege in
25709 chapter <xref linkend="CHAPsecurity"/>.
25710 </para>
25711 <para>
25712 <indexterm role="option">
25713 <primary><option>deliver_queue_load_max</option></primary>
25714 </indexterm>
25715 </para>
25716 <informaltable frame="all">
25717 <tgroup cols="4" colsep="0" rowsep="0">
25718 <colspec colwidth="8*" align="left"/>
25719 <colspec colwidth="6*" align="center"/>
25720 <colspec colwidth="6*" align="center"/>
25721 <colspec colwidth="6*" align="right"/>
25722 <tbody>
25723 <row>
25724 <entry><option>deliver_queue_load_max</option></entry>
25725 <entry>Use: <emphasis>main</emphasis></entry>
25726 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25727 <entry>Default: <emphasis>unset</emphasis></entry>
25728 </row>
25729 </tbody>
25730 </tgroup>
25731 </informaltable>
25732 <para>
25733 <indexterm role="concept">
25734 <primary>load average</primary>
25735 </indexterm>
25736 <indexterm role="concept">
25737 <primary>queue runner</primary>
25738 <secondary>abandoning</secondary>
25739 </indexterm>
25740 When this option is set, a queue run is abandoned if the system load average
25741 becomes greater than the value of the option. The option has no effect on
25742 ancient operating systems on which Exim cannot determine the load average.
25743 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
25744 </para>
25745 <para>
25746 <indexterm role="option">
25747 <primary><option>delivery_date_remove</option></primary>
25748 </indexterm>
25749 </para>
25750 <informaltable frame="all">
25751 <tgroup cols="4" colsep="0" rowsep="0">
25752 <colspec colwidth="8*" align="left"/>
25753 <colspec colwidth="6*" align="center"/>
25754 <colspec colwidth="6*" align="center"/>
25755 <colspec colwidth="6*" align="right"/>
25756 <tbody>
25757 <row>
25758 <entry><option>delivery_date_remove</option></entry>
25759 <entry>Use: <emphasis>main</emphasis></entry>
25760 <entry>Type: <emphasis>boolean</emphasis></entry>
25761 <entry>Default: <emphasis>true</emphasis></entry>
25762 </row>
25763 </tbody>
25764 </tgroup>
25765 </informaltable>
25766 <para>
25767 <indexterm role="concept">
25768 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
25769 </indexterm>
25770 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
25771 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
25772 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
25773 should not be present in incoming messages, and this option causes them to be
25774 removed at the time the message is received, to avoid any problems that might
25775 occur when a delivered message is subsequently sent on to some other recipient.
25776 </para>
25777 <para>
25778 <indexterm role="option">
25779 <primary><option>disable_fsync</option></primary>
25780 </indexterm>
25781 </para>
25782 <informaltable frame="all">
25783 <tgroup cols="4" colsep="0" rowsep="0">
25784 <colspec colwidth="8*" align="left"/>
25785 <colspec colwidth="6*" align="center"/>
25786 <colspec colwidth="6*" align="center"/>
25787 <colspec colwidth="6*" align="right"/>
25788 <tbody>
25789 <row>
25790 <entry><option>disable_fsync</option></entry>
25791 <entry>Use: <emphasis>main</emphasis></entry>
25792 <entry>Type: <emphasis>boolean</emphasis></entry>
25793 <entry>Default: <emphasis>false</emphasis></entry>
25794 </row>
25795 </tbody>
25796 </tgroup>
25797 </informaltable>
25798 <para>
25799 <indexterm role="concept">
25800 <primary><function>fsync()</function>, disabling</primary>
25801 </indexterm>
25802 This option is available only if Exim was built with the compile-time option
25803 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
25804 a runtime configuration generates an <quote>unknown option</quote> error. You should not
25805 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
25806 really, really, really understand what you are doing. <emphasis>No pre-compiled
25807 distributions of Exim should ever make this option available.</emphasis>
25808 </para>
25809 <para>
25810 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
25811 updated files&#x2019; data to be written to disc before continuing. Unexpected events
25812 such as crashes and power outages may cause data to be lost or scrambled.
25813 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
25814 </para>
25815 <para>
25816 <indexterm role="option">
25817 <primary><option>disable_ipv6</option></primary>
25818 </indexterm>
25819 </para>
25820 <informaltable frame="all">
25821 <tgroup cols="4" colsep="0" rowsep="0">
25822 <colspec colwidth="8*" align="left"/>
25823 <colspec colwidth="6*" align="center"/>
25824 <colspec colwidth="6*" align="center"/>
25825 <colspec colwidth="6*" align="right"/>
25826 <tbody>
25827 <row>
25828 <entry><option>disable_ipv6</option></entry>
25829 <entry>Use: <emphasis>main</emphasis></entry>
25830 <entry>Type: <emphasis>boolean</emphasis></entry>
25831 <entry>Default: <emphasis>false</emphasis></entry>
25832 </row>
25833 </tbody>
25834 </tgroup>
25835 </informaltable>
25836 <para>
25837 <indexterm role="concept">
25838 <primary>IPv6</primary>
25839 <secondary>disabling</secondary>
25840 </indexterm>
25841 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
25842 activities take place. AAAA records are never looked up, and any IPv6 addresses
25843 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
25844 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
25845 to handle IPv6 literal addresses.
25846 </para>
25847 <para revisionflag="changed">
25848 <indexterm role="option">
25849 <primary><option>dkim_verify_hashes</option></primary>
25850 </indexterm>
25851 </para>
25852 <informaltable frame="all" revisionflag="changed">
25853 <tgroup cols="4" colsep="0" rowsep="0">
25854 <colspec colwidth="8*" align="left"/>
25855 <colspec colwidth="6*" align="center"/>
25856 <colspec colwidth="6*" align="center"/>
25857 <colspec colwidth="6*" align="right"/>
25858 <tbody>
25859 <row>
25860 <entry><option>dkim_verify_hashes</option></entry>
25861 <entry>Use: <emphasis>main</emphasis></entry>
25862 <entry>Type: <emphasis>string list</emphasis></entry>
25863 <entry>Default: <emphasis>sha256 : sha512</emphasis></entry>
25864 </row>
25865 </tbody>
25866 </tgroup>
25867 </informaltable>
25868 <para revisionflag="changed">
25869 <indexterm role="concept">
25870 <primary>DKIM</primary>
25871 <secondary>selecting signature algorithms</secondary>
25872 </indexterm>
25873 This option gives a list of hash types which are acceptable in signatures,
25874 </para>
25875 <para>
25876 and an order of processing.
25877 Signatures with algorithms not in the list will be ignored.
25878 </para>
25879 <para>
25880 Acceptable values include:
25881 </para>
25882 <literallayout class="monospaced">
25883 sha1
25884 sha256
25885 sha512
25886 </literallayout>
25887 <para>
25888 Note that the acceptance of sha1 violates RFC 8301.
25889 </para>
25890 <para>
25891 <indexterm role="option">
25892 <primary><option>dkim_verify_keytypes</option></primary>
25893 </indexterm>
25894 </para>
25895 <informaltable frame="all">
25896 <tgroup cols="4" colsep="0" rowsep="0">
25897 <colspec colwidth="8*" align="left"/>
25898 <colspec colwidth="6*" align="center"/>
25899 <colspec colwidth="6*" align="center"/>
25900 <colspec colwidth="6*" align="right"/>
25901 <tbody>
25902 <row>
25903 <entry><option>dkim_verify_keytypes</option></entry>
25904 <entry>Use: <emphasis>main</emphasis></entry>
25905 <entry>Type: <emphasis>string list</emphasis></entry>
25906 <entry>Default: <emphasis>ed25519 : rsa</emphasis></entry>
25907 </row>
25908 </tbody>
25909 </tgroup>
25910 </informaltable>
25911 <para>
25912 This option gives a list of key types which are acceptable in signatures,
25913 and an order of processing.
25914 Signatures with algorithms not in the list will be ignored.
25915 </para>
25916 <para revisionflag="changed">
25917 <indexterm role="option">
25918 <primary><option>dkim_verify_min_keysizes</option></primary>
25919 </indexterm>
25920 </para>
25921 <informaltable frame="all" revisionflag="changed">
25922 <tgroup cols="4" colsep="0" rowsep="0">
25923 <colspec colwidth="8*" align="left"/>
25924 <colspec colwidth="6*" align="center"/>
25925 <colspec colwidth="6*" align="center"/>
25926 <colspec colwidth="6*" align="right"/>
25927 <tbody>
25928 <row>
25929 <entry><option>dkim_verify_min_keysizes</option></entry>
25930 <entry>Use: <emphasis>main</emphasis></entry>
25931 <entry>Type: <emphasis>string list</emphasis></entry>
25932 <entry>Default: <emphasis>rsa=1024 ed25519=250</emphasis></entry>
25933 </row>
25934 </tbody>
25935 </tgroup>
25936 </informaltable>
25937 <para revisionflag="changed">
25938 This option gives a list of key sizes which are acceptable in signatures.
25939 The list is keyed by the algorithm type for the key; the values are in bits.
25940 Signatures with keys smaller than given by this option will fail verification.
25941 </para>
25942 <para revisionflag="changed">
25943 The default enforces the RFC 8301 minimum key size for RSA signatures.
25944 </para>
25945 <para>
25946 <indexterm role="option">
25947 <primary><option>dkim_verify_minimal</option></primary>
25948 </indexterm>
25949 </para>
25950 <informaltable frame="all">
25951 <tgroup cols="4" colsep="0" rowsep="0">
25952 <colspec colwidth="8*" align="left"/>
25953 <colspec colwidth="6*" align="center"/>
25954 <colspec colwidth="6*" align="center"/>
25955 <colspec colwidth="6*" align="right"/>
25956 <tbody>
25957 <row>
25958 <entry><option>dkim_verify_minimal</option></entry>
25959 <entry>Use: <emphasis>main</emphasis></entry>
25960 <entry>Type: <emphasis>boolean</emphasis></entry>
25961 <entry>Default: <emphasis>false</emphasis></entry>
25962 </row>
25963 </tbody>
25964 </tgroup>
25965 </informaltable>
25966 <para>
25967 If set to true, verification of signatures will terminate after the
25968 first success.
25969 </para>
25970 <para>
25971 <indexterm role="option">
25972 <primary><option>dkim_verify_signers</option></primary>
25973 </indexterm>
25974 </para>
25975 <informaltable frame="all">
25976 <tgroup cols="4" colsep="0" rowsep="0">
25977 <colspec colwidth="8*" align="left"/>
25978 <colspec colwidth="6*" align="center"/>
25979 <colspec colwidth="6*" align="center"/>
25980 <colspec colwidth="6*" align="right"/>
25981 <tbody>
25982 <row>
25983 <entry><option>dkim_verify_signers</option></entry>
25984 <entry>Use: <emphasis>main</emphasis></entry>
25985 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
25986 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
25987 </row>
25988 </tbody>
25989 </tgroup>
25990 </informaltable>
25991 <para>
25992 <indexterm role="concept">
25993 <primary>DKIM</primary>
25994 <secondary>controlling calls to the ACL</secondary>
25995 </indexterm>
25996 This option gives a list of DKIM domains for which the DKIM ACL is run.
25997 It is expanded after the message is received; by default it runs
25998 the ACL once for each signature in the message.
25999 See section <xref linkend="SECDKIMVFY"/>.
26000 </para>
26001 <para>
26002 <indexterm role="option">
26003 <primary><option>dmarc_forensic_sender</option></primary>
26004 </indexterm>
26005 </para>
26006 <informaltable frame="all">
26007 <tgroup cols="4" colsep="0" rowsep="0">
26008 <colspec colwidth="8*" align="left"/>
26009 <colspec colwidth="6*" align="center"/>
26010 <colspec colwidth="6*" align="center"/>
26011 <colspec colwidth="6*" align="right"/>
26012 <tbody>
26013 <row>
26014 <entry><option>dmarc_forensic_sender</option></entry>
26015 <entry>Use: <emphasis>main</emphasis></entry>
26016 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26017 <entry>Default: <emphasis>unset</emphasis></entry>
26018 </row>
26019 </tbody>
26020 </tgroup>
26021 </informaltable>
26022 <para>
26023 <indexterm role="option">
26024 <primary><option>dmarc_history_file</option></primary>
26025 </indexterm>
26026 </para>
26027 <informaltable frame="all">
26028 <tgroup cols="4" colsep="0" rowsep="0">
26029 <colspec colwidth="8*" align="left"/>
26030 <colspec colwidth="6*" align="center"/>
26031 <colspec colwidth="6*" align="center"/>
26032 <colspec colwidth="6*" align="right"/>
26033 <tbody>
26034 <row>
26035 <entry><option>dmarc_history_file</option></entry>
26036 <entry>Use: <emphasis>main</emphasis></entry>
26037 <entry>Type: <emphasis>string</emphasis></entry>
26038 <entry>Default: <emphasis>unset</emphasis></entry>
26039 </row>
26040 </tbody>
26041 </tgroup>
26042 </informaltable>
26043 <para>
26044 <indexterm role="option">
26045 <primary><option>dmarc_tld_file</option></primary>
26046 </indexterm>
26047 </para>
26048 <informaltable frame="all">
26049 <tgroup cols="4" colsep="0" rowsep="0">
26050 <colspec colwidth="8*" align="left"/>
26051 <colspec colwidth="6*" align="center"/>
26052 <colspec colwidth="6*" align="center"/>
26053 <colspec colwidth="6*" align="right"/>
26054 <tbody>
26055 <row>
26056 <entry><option>dmarc_tld_file</option></entry>
26057 <entry>Use: <emphasis>main</emphasis></entry>
26058 <entry>Type: <emphasis>string</emphasis></entry>
26059 <entry>Default: <emphasis>unset</emphasis></entry>
26060 </row>
26061 </tbody>
26062 </tgroup>
26063 </informaltable>
26064 <para>
26065 <indexterm role="concept">
26066 <primary>DMARC</primary>
26067 <secondary>main section options</secondary>
26068 </indexterm>
26069 These options control DMARC processing.
26070 See section <xref linkend="SECDMARC"/> for details.
26071 </para>
26072 <para>
26073 <indexterm role="option">
26074 <primary><option>dns_again_means_nonexist</option></primary>
26075 </indexterm>
26076 </para>
26077 <informaltable frame="all">
26078 <tgroup cols="4" colsep="0" rowsep="0">
26079 <colspec colwidth="8*" align="left"/>
26080 <colspec colwidth="6*" align="center"/>
26081 <colspec colwidth="6*" align="center"/>
26082 <colspec colwidth="6*" align="right"/>
26083 <tbody>
26084 <row>
26085 <entry><option>dns_again_means_nonexist</option></entry>
26086 <entry>Use: <emphasis>main</emphasis></entry>
26087 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26088 <entry>Default: <emphasis>unset</emphasis></entry>
26089 </row>
26090 </tbody>
26091 </tgroup>
26092 </informaltable>
26093 <para>
26094 <indexterm role="concept">
26095 <primary>DNS</primary>
26096 <secondary><quote>try again</quote> response; overriding</secondary>
26097 </indexterm>
26098 DNS lookups give a <quote>try again</quote> response for the DNS errors
26099 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
26100 keep trying to deliver a message, or to give repeated temporary errors to
26101 incoming mail. Sometimes the effect is caused by a badly set up name server and
26102 may persist for a long time. If a domain which exhibits this problem matches
26103 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
26104 This option should be used with care. You can make it apply to reverse lookups
26105 by a setting such as this:
26106 </para>
26107 <literallayout class="monospaced">
26108 dns_again_means_nonexist = *.in-addr.arpa
26109 </literallayout>
26110 <para>
26111 This option applies to all DNS lookups that Exim does. It also applies when the
26112 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
26113 since these are most likely to be caused by DNS lookup problems. The
26114 <command>dnslookup</command> router has some options of its own for controlling what happens
26115 when lookups for MX or SRV records give temporary errors. These more specific
26116 options are applied after this global option.
26117 </para>
26118 <para>
26119 <indexterm role="option">
26120 <primary><option>dns_check_names_pattern</option></primary>
26121 </indexterm>
26122 </para>
26123 <informaltable frame="all">
26124 <tgroup cols="4" colsep="0" rowsep="0">
26125 <colspec colwidth="8*" align="left"/>
26126 <colspec colwidth="6*" align="center"/>
26127 <colspec colwidth="6*" align="center"/>
26128 <colspec colwidth="6*" align="right"/>
26129 <tbody>
26130 <row>
26131 <entry><option>dns_check_names_pattern</option></entry>
26132 <entry>Use: <emphasis>main</emphasis></entry>
26133 <entry>Type: <emphasis>string</emphasis></entry>
26134 <entry>Default: <emphasis>see below</emphasis></entry>
26135 </row>
26136 </tbody>
26137 </tgroup>
26138 </informaltable>
26139 <para>
26140 <indexterm role="concept">
26141 <primary>DNS</primary>
26142 <secondary>pre-check of name syntax</secondary>
26143 </indexterm>
26144 When this option is set to a non-empty string, it causes Exim to check domain
26145 names for characters that are not allowed in host names before handing them to
26146 the DNS resolver, because some resolvers give temporary errors for names that
26147 contain unusual characters. If a domain name contains any unwanted characters,
26148 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
26149 done by matching the domain name against a regular expression, which is the
26150 value of this option. The default pattern is
26151 </para>
26152 <literallayout class="monospaced">
26153 dns_check_names_pattern = \
26154   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
26155 </literallayout>
26156 <para>
26157 which permits only letters, digits, slashes, and hyphens in components, but
26158 they must start and end with a letter or digit. Slashes are not, in fact,
26159 permitted in host names, but they are found in certain NS records (which can be
26160 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
26161 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
26162 empty string.
26163 </para>
26164 <para>
26165 <indexterm role="option">
26166 <primary><option>dns_csa_search_limit</option></primary>
26167 </indexterm>
26168 </para>
26169 <informaltable frame="all">
26170 <tgroup cols="4" colsep="0" rowsep="0">
26171 <colspec colwidth="8*" align="left"/>
26172 <colspec colwidth="6*" align="center"/>
26173 <colspec colwidth="6*" align="center"/>
26174 <colspec colwidth="6*" align="right"/>
26175 <tbody>
26176 <row>
26177 <entry><option>dns_csa_search_limit</option></entry>
26178 <entry>Use: <emphasis>main</emphasis></entry>
26179 <entry>Type: <emphasis>integer</emphasis></entry>
26180 <entry>Default: <emphasis>5</emphasis></entry>
26181 </row>
26182 </tbody>
26183 </tgroup>
26184 </informaltable>
26185 <para>
26186 This option controls the depth of parental searching for CSA SRV records in the
26187 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
26188 </para>
26189 <para>
26190 <indexterm role="option">
26191 <primary><option>dns_csa_use_reverse</option></primary>
26192 </indexterm>
26193 </para>
26194 <informaltable frame="all">
26195 <tgroup cols="4" colsep="0" rowsep="0">
26196 <colspec colwidth="8*" align="left"/>
26197 <colspec colwidth="6*" align="center"/>
26198 <colspec colwidth="6*" align="center"/>
26199 <colspec colwidth="6*" align="right"/>
26200 <tbody>
26201 <row>
26202 <entry><option>dns_csa_use_reverse</option></entry>
26203 <entry>Use: <emphasis>main</emphasis></entry>
26204 <entry>Type: <emphasis>boolean</emphasis></entry>
26205 <entry>Default: <emphasis>true</emphasis></entry>
26206 </row>
26207 </tbody>
26208 </tgroup>
26209 </informaltable>
26210 <para>
26211 This option controls whether or not an IP address, given as a CSA domain, is
26212 reversed and looked up in the reverse DNS, as described in more detail in
26213 section <xref linkend="SECTverifyCSA"/>.
26214 </para>
26215 <para>
26216 <indexterm role="option">
26217 <primary><option>dns_cname_loops</option></primary>
26218 </indexterm>
26219 </para>
26220 <informaltable frame="all">
26221 <tgroup cols="4" colsep="0" rowsep="0">
26222 <colspec colwidth="8*" align="left"/>
26223 <colspec colwidth="6*" align="center"/>
26224 <colspec colwidth="6*" align="center"/>
26225 <colspec colwidth="6*" align="right"/>
26226 <tbody>
26227 <row>
26228 <entry><option>dns_cname_loops</option></entry>
26229 <entry>Use: <emphasis>main</emphasis></entry>
26230 <entry>Type: <emphasis>integer</emphasis></entry>
26231 <entry>Default: <emphasis>1</emphasis></entry>
26232 </row>
26233 </tbody>
26234 </tgroup>
26235 </informaltable>
26236 <para>
26237 <indexterm role="concept">
26238 <primary>DNS</primary>
26239 <secondary>CNAME following</secondary>
26240 </indexterm>
26241 This option controls the following of CNAME chains, needed if the resolver does
26242 not do it internally.
26243 As of 2018 most should, and the default can be left.
26244 If you have an ancient one, a value of 10 is likely needed.
26245 </para>
26246 <para>
26247 The default value of one CNAME-follow is needed
26248 thanks to the observed return for an MX request,
26249 given no MX presence but a CNAME to an A, of the CNAME.
26250 </para>
26251 <para>
26252 <indexterm role="option">
26253 <primary><option>dns_dnssec_ok</option></primary>
26254 </indexterm>
26255 </para>
26256 <informaltable frame="all">
26257 <tgroup cols="4" colsep="0" rowsep="0">
26258 <colspec colwidth="8*" align="left"/>
26259 <colspec colwidth="6*" align="center"/>
26260 <colspec colwidth="6*" align="center"/>
26261 <colspec colwidth="6*" align="right"/>
26262 <tbody>
26263 <row>
26264 <entry><option>dns_dnssec_ok</option></entry>
26265 <entry>Use: <emphasis>main</emphasis></entry>
26266 <entry>Type: <emphasis>integer</emphasis></entry>
26267 <entry>Default: <emphasis>-1</emphasis></entry>
26268 </row>
26269 </tbody>
26270 </tgroup>
26271 </informaltable>
26272 <para>
26273 <indexterm role="concept">
26274 <primary>DNS</primary>
26275 <secondary>resolver options</secondary>
26276 </indexterm>
26277 <indexterm role="concept">
26278 <primary>DNS</primary>
26279 <secondary>DNSSEC</secondary>
26280 </indexterm>
26281 If this option is set to a non-negative number then Exim will initialise the
26282 DNS resolver library to either use or not use DNSSEC, overriding the system
26283 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
26284 </para>
26285 <para>
26286 If the resolver library does not support DNSSEC then this option has no effect.
26287 </para>
26288 <para revisionflag="changed">
26289 On Linux with glibc 2.31 or newer this is insufficient, the resolver library
26290 will default to stripping out a successful validation status.
26291 This will break a previously working Exim installation.
26292 Provided that you do trust the resolver (ie, is on localhost) you can tell
26293 glibc to pass through any successful validation with a new option in
26294 <filename>/etc/resolv.conf</filename>:
26295 </para>
26296 <literallayout class="monospaced" revisionflag="changed">
26297 options trust-ad
26298 </literallayout>
26299 <para>
26300 <indexterm role="option">
26301 <primary><option>dns_ipv4_lookup</option></primary>
26302 </indexterm>
26303 </para>
26304 <informaltable frame="all">
26305 <tgroup cols="4" colsep="0" rowsep="0">
26306 <colspec colwidth="8*" align="left"/>
26307 <colspec colwidth="6*" align="center"/>
26308 <colspec colwidth="6*" align="center"/>
26309 <colspec colwidth="6*" align="right"/>
26310 <tbody>
26311 <row>
26312 <entry><option>dns_ipv4_lookup</option></entry>
26313 <entry>Use: <emphasis>main</emphasis></entry>
26314 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26315 <entry>Default: <emphasis>unset</emphasis></entry>
26316 </row>
26317 </tbody>
26318 </tgroup>
26319 </informaltable>
26320 <para>
26321 <indexterm role="concept">
26322 <primary>IPv6</primary>
26323 <secondary>DNS lookup for AAAA records</secondary>
26324 </indexterm>
26325 <indexterm role="concept">
26326 <primary>DNS</primary>
26327 <secondary>IPv6 lookup for AAAA records</secondary>
26328 </indexterm>
26329 <indexterm role="concept">
26330 <primary>DNS</primary>
26331 <secondary>IPv6 disabling</secondary>
26332 </indexterm>
26333 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
26334 looks for IPv6 address records (AAAA records) as well as IPv4 address records
26335 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
26336 domain matches this list.
26337 </para>
26338 <para>
26339 This is a fudge to help with name servers that give big delays or otherwise do
26340 not work for the AAAA record type. In due course, when the world&#x2019;s name
26341 servers have all been upgraded, there should be no need for this option.
26342 Note that all lookups, including those done for verification, are affected;
26343 this will result in verify failure for IPv6 connections or ones using names
26344 only valid for IPv6 addresses.
26345 </para>
26346 <para>
26347 <indexterm role="option">
26348 <primary><option>dns_retrans</option></primary>
26349 </indexterm>
26350 </para>
26351 <informaltable frame="all">
26352 <tgroup cols="4" colsep="0" rowsep="0">
26353 <colspec colwidth="8*" align="left"/>
26354 <colspec colwidth="6*" align="center"/>
26355 <colspec colwidth="6*" align="center"/>
26356 <colspec colwidth="6*" align="right"/>
26357 <tbody>
26358 <row>
26359 <entry><option>dns_retrans</option></entry>
26360 <entry>Use: <emphasis>main</emphasis></entry>
26361 <entry>Type: <emphasis>time</emphasis></entry>
26362 <entry>Default: <emphasis>0s</emphasis></entry>
26363 </row>
26364 </tbody>
26365 </tgroup>
26366 </informaltable>
26367 <para>
26368 <indexterm role="concept">
26369 <primary>DNS</primary>
26370 <secondary>resolver options</secondary>
26371 </indexterm>
26372 <indexterm role="concept">
26373 <primary>timeout</primary>
26374 <secondary>dns lookup</secondary>
26375 </indexterm>
26376 <indexterm role="concept">
26377 <primary>DNS</primary>
26378 <secondary>timeout</secondary>
26379 </indexterm>
26380 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
26381 retransmission and retry parameters for DNS lookups. Values of zero (the
26382 defaults) leave the system default settings unchanged. The first value is the
26383 time between retries, and the second is the number of retries. It isn&#x2019;t
26384 totally clear exactly how these settings affect the total time a DNS lookup may
26385 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
26386 parameter values are available in the external resolver interface structure,
26387 but nowhere does it seem to describe how they are used or what you might want
26388 to set in them.
26389 See also the <option>slow_lookup_log</option> option.
26390 </para>
26391 <para>
26392 <indexterm role="option">
26393 <primary><option>dns_retry</option></primary>
26394 </indexterm>
26395 </para>
26396 <informaltable frame="all">
26397 <tgroup cols="4" colsep="0" rowsep="0">
26398 <colspec colwidth="8*" align="left"/>
26399 <colspec colwidth="6*" align="center"/>
26400 <colspec colwidth="6*" align="center"/>
26401 <colspec colwidth="6*" align="right"/>
26402 <tbody>
26403 <row>
26404 <entry><option>dns_retry</option></entry>
26405 <entry>Use: <emphasis>main</emphasis></entry>
26406 <entry>Type: <emphasis>integer</emphasis></entry>
26407 <entry>Default: <emphasis>0</emphasis></entry>
26408 </row>
26409 </tbody>
26410 </tgroup>
26411 </informaltable>
26412 <para>
26413 See <option>dns_retrans</option> above.
26414 </para>
26415 <para>
26416 <indexterm role="option">
26417 <primary><option>dns_trust_aa</option></primary>
26418 </indexterm>
26419 </para>
26420 <informaltable frame="all">
26421 <tgroup cols="4" colsep="0" rowsep="0">
26422 <colspec colwidth="8*" align="left"/>
26423 <colspec colwidth="6*" align="center"/>
26424 <colspec colwidth="6*" align="center"/>
26425 <colspec colwidth="6*" align="right"/>
26426 <tbody>
26427 <row>
26428 <entry><option>dns_trust_aa</option></entry>
26429 <entry>Use: <emphasis>main</emphasis></entry>
26430 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26431 <entry>Default: <emphasis>unset</emphasis></entry>
26432 </row>
26433 </tbody>
26434 </tgroup>
26435 </informaltable>
26436 <para>
26437 <indexterm role="concept">
26438 <primary>DNS</primary>
26439 <secondary>resolver options</secondary>
26440 </indexterm>
26441 <indexterm role="concept">
26442 <primary>DNS</primary>
26443 <secondary>DNSSEC</secondary>
26444 </indexterm>
26445 If this option is set then lookup results marked with the AA bit
26446 (Authoritative Answer) are trusted the same way as if they were
26447 DNSSEC-verified. The authority section&#x2019;s name of the answer must
26448 match with this expanded domain list.
26449 </para>
26450 <para>
26451 Use this option only if you talk directly to a resolver that is
26452 authoritative for some zones and does not set the AD (Authentic Data)
26453 bit in the answer. Some DNS servers may have an configuration option to
26454 mark the answers from their own zones as verified (they set the AD bit).
26455 Others do not have this option. It is considered as poor practice using
26456 a resolver that is an authoritative server for some zones.
26457 </para>
26458 <para>
26459 Use this option only if you really have to (e.g. if you want
26460 to use DANE for remote delivery to a server that is listed in the DNS
26461 zones that your resolver is authoritative for).
26462 </para>
26463 <para>
26464 If the DNS answer packet has the AA bit set and contains resource record
26465 in the answer section, the name of the first NS record appearing in the
26466 authority section is compared against the list. If the answer packet is
26467 authoritative but the answer section is empty, the name of the first SOA
26468 record in the authoritative section is used instead.
26469 </para>
26470 <para>
26471 <indexterm role="concept">
26472 <primary>DNS</primary>
26473 <secondary>resolver options</secondary>
26474 </indexterm>
26475 <indexterm role="option">
26476 <primary><option>dns_use_edns0</option></primary>
26477 </indexterm>
26478 </para>
26479 <informaltable frame="all">
26480 <tgroup cols="4" colsep="0" rowsep="0">
26481 <colspec colwidth="8*" align="left"/>
26482 <colspec colwidth="6*" align="center"/>
26483 <colspec colwidth="6*" align="center"/>
26484 <colspec colwidth="6*" align="right"/>
26485 <tbody>
26486 <row>
26487 <entry><option>dns_use_edns0</option></entry>
26488 <entry>Use: <emphasis>main</emphasis></entry>
26489 <entry>Type: <emphasis>integer</emphasis></entry>
26490 <entry>Default: <emphasis>-1</emphasis></entry>
26491 </row>
26492 </tbody>
26493 </tgroup>
26494 </informaltable>
26495 <para>
26496 <indexterm role="concept">
26497 <primary>DNS</primary>
26498 <secondary>resolver options</secondary>
26499 </indexterm>
26500 <indexterm role="concept">
26501 <primary>DNS</primary>
26502 <secondary>EDNS0</secondary>
26503 </indexterm>
26504 <indexterm role="concept">
26505 <primary>DNS</primary>
26506 <secondary>OpenBSD</secondary>
26507 </indexterm>
26508 If this option is set to a non-negative number then Exim will initialise the
26509 DNS resolver library to either use or not use EDNS0 extensions, overriding
26510 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
26511 on.
26512 </para>
26513 <para>
26514 If the resolver library does not support EDNS0 then this option has no effect.
26515 </para>
26516 <para>
26517 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
26518 means that DNSSEC will not work with Exim on that platform either, unless Exim
26519 is linked against an alternative DNS client library.
26520 </para>
26521 <para>
26522 <indexterm role="option">
26523 <primary><option>drop_cr</option></primary>
26524 </indexterm>
26525 </para>
26526 <informaltable frame="all">
26527 <tgroup cols="4" colsep="0" rowsep="0">
26528 <colspec colwidth="8*" align="left"/>
26529 <colspec colwidth="6*" align="center"/>
26530 <colspec colwidth="6*" align="center"/>
26531 <colspec colwidth="6*" align="right"/>
26532 <tbody>
26533 <row>
26534 <entry><option>drop_cr</option></entry>
26535 <entry>Use: <emphasis>main</emphasis></entry>
26536 <entry>Type: <emphasis>boolean</emphasis></entry>
26537 <entry>Default: <emphasis>false</emphasis></entry>
26538 </row>
26539 </tbody>
26540 </tgroup>
26541 </informaltable>
26542 <para>
26543 This is an obsolete option that is now a no-op. It used to affect the way Exim
26544 handled CR and LF characters in incoming messages. What happens now is
26545 described in section <xref linkend="SECTlineendings"/>.
26546 </para>
26547 <para>
26548 <indexterm role="option">
26549 <primary><option>dsn_advertise_hosts</option></primary>
26550 </indexterm>
26551 </para>
26552 <informaltable frame="all">
26553 <tgroup cols="4" colsep="0" rowsep="0">
26554 <colspec colwidth="8*" align="left"/>
26555 <colspec colwidth="6*" align="center"/>
26556 <colspec colwidth="6*" align="center"/>
26557 <colspec colwidth="6*" align="right"/>
26558 <tbody>
26559 <row>
26560 <entry><option>dsn_advertise_hosts</option></entry>
26561 <entry>Use: <emphasis>main</emphasis></entry>
26562 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26563 <entry>Default: <emphasis>unset</emphasis></entry>
26564 </row>
26565 </tbody>
26566 </tgroup>
26567 </informaltable>
26568 <para>
26569 <indexterm role="concept">
26570 <primary>bounce messages</primary>
26571 <secondary>success</secondary>
26572 </indexterm>
26573 <indexterm role="concept">
26574 <primary>DSN</primary>
26575 <secondary>success</secondary>
26576 </indexterm>
26577 <indexterm role="concept">
26578 <primary>Delivery Status Notification</primary>
26579 <secondary>success</secondary>
26580 </indexterm>
26581 <indexterm role="concept">
26582 <primary>ESMTP extensions</primary>
26583 <secondary>DSN</secondary>
26584 </indexterm>
26585 DSN extensions (RFC3461) will be advertised in the EHLO message to,
26586 and accepted from, these hosts.
26587 Hosts may use the NOTIFY and ENVID options on RCPT TO commands,
26588 and RET and ORCPT options on MAIL FROM commands.
26589 A NOTIFY=SUCCESS option requests success-DSN messages.
26590 A NOTIFY= option with no argument requests that no delay or failure DSNs
26591 are sent.
26592 </para>
26593 <para revisionflag="changed">
26594 <emphasis role="bold">Note</emphasis>: Supplying success-DSN messages has been criticised
26595 on privacy grounds; it can leak details of internal forwarding.
26596 </para>
26597 <para>
26598 <indexterm role="option">
26599 <primary><option>dsn_from</option></primary>
26600 </indexterm>
26601 </para>
26602 <informaltable frame="all">
26603 <tgroup cols="4" colsep="0" rowsep="0">
26604 <colspec colwidth="8*" align="left"/>
26605 <colspec colwidth="6*" align="center"/>
26606 <colspec colwidth="6*" align="center"/>
26607 <colspec colwidth="6*" align="right"/>
26608 <tbody>
26609 <row>
26610 <entry><option>dsn_from</option></entry>
26611 <entry>Use: <emphasis>main</emphasis></entry>
26612 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26613 <entry>Default: <emphasis>see below</emphasis></entry>
26614 </row>
26615 </tbody>
26616 </tgroup>
26617 </informaltable>
26618 <para>
26619 <indexterm role="concept">
26620 <primary><emphasis>From:</emphasis> header line</primary>
26621 <secondary>in bounces</secondary>
26622 </indexterm>
26623 <indexterm role="concept">
26624 <primary>bounce messages</primary>
26625 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
26626 </indexterm>
26627 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
26628 bounces and other automatically generated messages (<quote>Delivery Status
26629 Notifications</quote> &ndash; hence the name of the option). The default setting is:
26630 </para>
26631 <literallayout class="monospaced">
26632 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
26633 </literallayout>
26634 <para>
26635 The value is expanded every time it is needed. If the expansion fails, a
26636 panic is logged, and the default value is used.
26637 </para>
26638 <para>
26639 <indexterm role="option">
26640 <primary><option>envelope_to_remove</option></primary>
26641 </indexterm>
26642 </para>
26643 <informaltable frame="all">
26644 <tgroup cols="4" colsep="0" rowsep="0">
26645 <colspec colwidth="8*" align="left"/>
26646 <colspec colwidth="6*" align="center"/>
26647 <colspec colwidth="6*" align="center"/>
26648 <colspec colwidth="6*" align="right"/>
26649 <tbody>
26650 <row>
26651 <entry><option>envelope_to_remove</option></entry>
26652 <entry>Use: <emphasis>main</emphasis></entry>
26653 <entry>Type: <emphasis>boolean</emphasis></entry>
26654 <entry>Default: <emphasis>true</emphasis></entry>
26655 </row>
26656 </tbody>
26657 </tgroup>
26658 </informaltable>
26659 <para>
26660 <indexterm role="concept">
26661 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
26662 </indexterm>
26663 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
26664 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
26665 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
26666 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
26667 be present in incoming messages, and this option causes them to be removed at
26668 the time the message is received, to avoid any problems that might occur when a
26669 delivered message is subsequently sent on to some other recipient.
26670 </para>
26671 <para>
26672 <indexterm role="option">
26673 <primary><option>errors_copy</option></primary>
26674 </indexterm>
26675 </para>
26676 <informaltable frame="all">
26677 <tgroup cols="4" colsep="0" rowsep="0">
26678 <colspec colwidth="8*" align="left"/>
26679 <colspec colwidth="6*" align="center"/>
26680 <colspec colwidth="6*" align="center"/>
26681 <colspec colwidth="6*" align="right"/>
26682 <tbody>
26683 <row>
26684 <entry><option>errors_copy</option></entry>
26685 <entry>Use: <emphasis>main</emphasis></entry>
26686 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
26687 <entry>Default: <emphasis>unset</emphasis></entry>
26688 </row>
26689 </tbody>
26690 </tgroup>
26691 </informaltable>
26692 <para>
26693 <indexterm role="concept">
26694 <primary>bounce message</primary>
26695 <secondary>copy to other address</secondary>
26696 </indexterm>
26697 <indexterm role="concept">
26698 <primary>copy of bounce message</primary>
26699 </indexterm>
26700 Setting this option causes Exim to send bcc copies of bounce messages that it
26701 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
26702 coming from elsewhere. The value of the option is a colon-separated list of
26703 items. Each item consists of a pattern, terminated by white space, followed by
26704 a comma-separated list of email addresses. If a pattern contains spaces, it
26705 must be enclosed in double quotes.
26706 </para>
26707 <para>
26708 Each pattern is processed in the same way as a single item in an address list
26709 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
26710 the bounce message, the message is copied to the addresses on the list. The
26711 items are scanned in order, and once a matching one is found, no further items
26712 are examined. For example:
26713 </para>
26714 <literallayout class="monospaced">
26715 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
26716               rqps@mydomain   hostmaster@mydomain.example,\
26717                               postmaster@mydomain.example
26718 </literallayout>
26719 <para>
26720 <indexterm role="variable">
26721 <primary><varname>$domain</varname></primary>
26722 </indexterm>
26723 <indexterm role="variable">
26724 <primary><varname>$local_part</varname></primary>
26725 </indexterm>
26726 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
26727 and <varname>$domain</varname> are set from the original recipient of the error message, and if
26728 there was any wildcard matching in the pattern, the expansion
26729 <indexterm role="concept">
26730 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
26731 <secondary>in <option>errors_copy</option></secondary>
26732 </indexterm>
26733 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
26734 </para>
26735 <para>
26736 <indexterm role="option">
26737 <primary><option>errors_reply_to</option></primary>
26738 </indexterm>
26739 </para>
26740 <informaltable frame="all">
26741 <tgroup cols="4" colsep="0" rowsep="0">
26742 <colspec colwidth="8*" align="left"/>
26743 <colspec colwidth="6*" align="center"/>
26744 <colspec colwidth="6*" align="center"/>
26745 <colspec colwidth="6*" align="right"/>
26746 <tbody>
26747 <row>
26748 <entry><option>errors_reply_to</option></entry>
26749 <entry>Use: <emphasis>main</emphasis></entry>
26750 <entry>Type: <emphasis>string</emphasis></entry>
26751 <entry>Default: <emphasis>unset</emphasis></entry>
26752 </row>
26753 </tbody>
26754 </tgroup>
26755 </informaltable>
26756 <para>
26757 <indexterm role="concept">
26758 <primary>bounce message</primary>
26759 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
26760 </indexterm>
26761 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
26762 </para>
26763 <literallayout>
26764 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
26765 </literallayout>
26766 <para>
26767 <indexterm role="option">
26768 <primary><option>quota_warn_message</option></primary>
26769 </indexterm>
26770 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
26771 A warning message that is generated by the <option>quota_warn_message</option> option in an
26772 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
26773 overrides the default.
26774 </para>
26775 <para>
26776 Experience shows that people reply to bounce messages. If the
26777 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
26778 and warning messages. For example:
26779 </para>
26780 <literallayout class="monospaced">
26781 errors_reply_to = postmaster@my.domain.example
26782 </literallayout>
26783 <para>
26784 The value of the option is not expanded. It must specify a valid RFC 2822
26785 address. However, if a warning message that is generated by the
26786 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
26787 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
26788 not used.
26789 </para>
26790 <para>
26791 <indexterm role="option">
26792 <primary><option>event_action</option></primary>
26793 </indexterm>
26794 </para>
26795 <informaltable frame="all">
26796 <tgroup cols="4" colsep="0" rowsep="0">
26797 <colspec colwidth="8*" align="left"/>
26798 <colspec colwidth="6*" align="center"/>
26799 <colspec colwidth="6*" align="center"/>
26800 <colspec colwidth="6*" align="right"/>
26801 <tbody>
26802 <row>
26803 <entry><option>event_action</option></entry>
26804 <entry>Use: <emphasis>main</emphasis></entry>
26805 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26806 <entry>Default: <emphasis>unset</emphasis></entry>
26807 </row>
26808 </tbody>
26809 </tgroup>
26810 </informaltable>
26811 <para>
26812 <indexterm role="concept">
26813 <primary>events</primary>
26814 </indexterm>
26815 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
26816 For details see chapter <xref linkend="CHAPevents"/>.
26817 </para>
26818 <para>
26819 <indexterm role="option">
26820 <primary><option>exim_group</option></primary>
26821 </indexterm>
26822 </para>
26823 <informaltable frame="all">
26824 <tgroup cols="4" colsep="0" rowsep="0">
26825 <colspec colwidth="8*" align="left"/>
26826 <colspec colwidth="6*" align="center"/>
26827 <colspec colwidth="6*" align="center"/>
26828 <colspec colwidth="6*" align="right"/>
26829 <tbody>
26830 <row>
26831 <entry><option>exim_group</option></entry>
26832 <entry>Use: <emphasis>main</emphasis></entry>
26833 <entry>Type: <emphasis>string</emphasis></entry>
26834 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
26835 </row>
26836 </tbody>
26837 </tgroup>
26838 </informaltable>
26839 <para>
26840 <indexterm role="concept">
26841 <primary>gid (group id)</primary>
26842 <secondary>Exim&#x2019;s own</secondary>
26843 </indexterm>
26844 <indexterm role="concept">
26845 <primary>Exim group</primary>
26846 </indexterm>
26847 This option changes the gid under which Exim runs when it gives up root
26848 privilege. The default value is compiled into the binary. The value of this
26849 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
26850 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
26851 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
26852 security issues.
26853 </para>
26854 <para>
26855 <indexterm role="option">
26856 <primary><option>exim_path</option></primary>
26857 </indexterm>
26858 </para>
26859 <informaltable frame="all">
26860 <tgroup cols="4" colsep="0" rowsep="0">
26861 <colspec colwidth="8*" align="left"/>
26862 <colspec colwidth="6*" align="center"/>
26863 <colspec colwidth="6*" align="center"/>
26864 <colspec colwidth="6*" align="right"/>
26865 <tbody>
26866 <row>
26867 <entry><option>exim_path</option></entry>
26868 <entry>Use: <emphasis>main</emphasis></entry>
26869 <entry>Type: <emphasis>string</emphasis></entry>
26870 <entry>Default: <emphasis>see below</emphasis></entry>
26871 </row>
26872 </tbody>
26873 </tgroup>
26874 </informaltable>
26875 <para>
26876 <indexterm role="concept">
26877 <primary>Exim binary, path name</primary>
26878 </indexterm>
26879 This option specifies the path name of the Exim binary, which is used when Exim
26880 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
26881 the directory configured at compile time by the BIN_DIRECTORY setting. It
26882 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
26883 other place.
26884 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
26885 you will break those Exim utilities that scan the configuration file to find
26886 where the binary is. (They then use the <option>-bP</option> option to extract option
26887 settings such as the value of <option>spool_directory</option>.)
26888 </para>
26889 <para>
26890 <indexterm role="option">
26891 <primary><option>exim_user</option></primary>
26892 </indexterm>
26893 </para>
26894 <informaltable frame="all">
26895 <tgroup cols="4" colsep="0" rowsep="0">
26896 <colspec colwidth="8*" align="left"/>
26897 <colspec colwidth="6*" align="center"/>
26898 <colspec colwidth="6*" align="center"/>
26899 <colspec colwidth="6*" align="right"/>
26900 <tbody>
26901 <row>
26902 <entry><option>exim_user</option></entry>
26903 <entry>Use: <emphasis>main</emphasis></entry>
26904 <entry>Type: <emphasis>string</emphasis></entry>
26905 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
26906 </row>
26907 </tbody>
26908 </tgroup>
26909 </informaltable>
26910 <para>
26911 <indexterm role="concept">
26912 <primary>uid (user id)</primary>
26913 <secondary>Exim&#x2019;s own</secondary>
26914 </indexterm>
26915 <indexterm role="concept">
26916 <primary>Exim user</primary>
26917 </indexterm>
26918 This option changes the uid under which Exim runs when it gives up root
26919 privilege. The default value is compiled into the binary. Ownership of the run
26920 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
26921 options is checked against the values in the binary, not what is set here.
26922 </para>
26923 <para>
26924 Unless it consists entirely of digits, the string is looked up using
26925 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
26926 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
26927 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
26928 </para>
26929 <para>
26930 <indexterm role="option">
26931 <primary><option>exim_version</option></primary>
26932 </indexterm>
26933 </para>
26934 <informaltable frame="all">
26935 <tgroup cols="4" colsep="0" rowsep="0">
26936 <colspec colwidth="8*" align="left"/>
26937 <colspec colwidth="6*" align="center"/>
26938 <colspec colwidth="6*" align="center"/>
26939 <colspec colwidth="6*" align="right"/>
26940 <tbody>
26941 <row>
26942 <entry><option>exim_version</option></entry>
26943 <entry>Use: <emphasis>main</emphasis></entry>
26944 <entry>Type: <emphasis>string</emphasis></entry>
26945 <entry>Default: <emphasis>current version</emphasis></entry>
26946 </row>
26947 </tbody>
26948 </tgroup>
26949 </informaltable>
26950 <para>
26951 <indexterm role="concept">
26952 <primary>Exim version</primary>
26953 </indexterm>
26954 <indexterm role="concept">
26955 <primary>customizing</primary>
26956 <secondary>version number</secondary>
26957 </indexterm>
26958 <indexterm role="concept">
26959 <primary>version number of Exim</primary>
26960 <secondary>override</secondary>
26961 </indexterm>
26962 This option overrides the <varname>$version_number</varname>/<varname>$exim_version</varname> that Exim reports in
26963 various places.  Use with care; this may fool stupid security scanners.
26964 </para>
26965 <para>
26966 <indexterm role="option">
26967 <primary><option>extra_local_interfaces</option></primary>
26968 </indexterm>
26969 </para>
26970 <informaltable frame="all">
26971 <tgroup cols="4" colsep="0" rowsep="0">
26972 <colspec colwidth="8*" align="left"/>
26973 <colspec colwidth="6*" align="center"/>
26974 <colspec colwidth="6*" align="center"/>
26975 <colspec colwidth="6*" align="right"/>
26976 <tbody>
26977 <row>
26978 <entry><option>extra_local_interfaces</option></entry>
26979 <entry>Use: <emphasis>main</emphasis></entry>
26980 <entry>Type: <emphasis>string list</emphasis></entry>
26981 <entry>Default: <emphasis>unset</emphasis></entry>
26982 </row>
26983 </tbody>
26984 </tgroup>
26985 </informaltable>
26986 <para>
26987 This option defines network interfaces that are to be considered local when
26988 routing, but which are not used for listening by the daemon. See section
26989 <xref linkend="SECTreclocipadd"/> for details.
26990 </para>
26991 <para>
26992 <indexterm role="option">
26993 <primary><option>extract_addresses_remove_arguments</option></primary>
26994 </indexterm>
26995 </para>
26996 <informaltable frame="all">
26997 <tgroup cols="4" colsep="0" rowsep="0">
26998 <colspec colwidth="8*" align="left"/>
26999 <colspec colwidth="6*" align="center"/>
27000 <colspec colwidth="6*" align="center"/>
27001 <colspec colwidth="6*" align="right"/>
27002 <tbody>
27003 <row>
27004 <entry><option>extract_addresses_remove_arguments</option></entry>
27005 <entry>Use: <emphasis>main</emphasis></entry>
27006 <entry>Type: <emphasis>boolean</emphasis></entry>
27007 <entry>Default: <emphasis>true</emphasis></entry>
27008 </row>
27009 </tbody>
27010 </tgroup>
27011 </informaltable>
27012 <para>
27013 <indexterm role="option">
27014 <primary><option>-t</option></primary>
27015 </indexterm>
27016 <indexterm role="concept">
27017 <primary>command line</primary>
27018 <secondary>addresses with <option>-t</option></secondary>
27019 </indexterm>
27020 <indexterm role="concept">
27021 <primary>Sendmail compatibility</primary>
27022 <secondary><option>-t</option> option</secondary>
27023 </indexterm>
27024 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
27025 are present on the command line when the <option>-t</option> option is used to build an
27026 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
27027 line addresses are removed from the recipients list. This is also how Smail
27028 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
27029 command line addresses are added to those obtained from the header lines. When
27030 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
27031 argument headers. If it is set false, Exim adds rather than removes argument
27032 addresses.
27033 </para>
27034 <para>
27035 <indexterm role="option">
27036 <primary><option>finduser_retries</option></primary>
27037 </indexterm>
27038 </para>
27039 <informaltable frame="all">
27040 <tgroup cols="4" colsep="0" rowsep="0">
27041 <colspec colwidth="8*" align="left"/>
27042 <colspec colwidth="6*" align="center"/>
27043 <colspec colwidth="6*" align="center"/>
27044 <colspec colwidth="6*" align="right"/>
27045 <tbody>
27046 <row>
27047 <entry><option>finduser_retries</option></entry>
27048 <entry>Use: <emphasis>main</emphasis></entry>
27049 <entry>Type: <emphasis>integer</emphasis></entry>
27050 <entry>Default: <emphasis>0</emphasis></entry>
27051 </row>
27052 </tbody>
27053 </tgroup>
27054 </informaltable>
27055 <para>
27056 <indexterm role="concept">
27057 <primary>NIS, retrying user lookups</primary>
27058 </indexterm>
27059 On systems running NIS or other schemes in which user and group information is
27060 distributed from a remote system, there can be times when <function>getpwnam()</function> and
27061 related functions fail, even when given valid data, because things time out.
27062 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
27063 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
27064 many extra times to find a user or a group, waiting for one second between
27065 retries.
27066 </para>
27067 <para>
27068 <indexterm role="concept">
27069 <primary><filename>/etc/passwd</filename></primary>
27070 <secondary>multiple reading of</secondary>
27071 </indexterm>
27072 You should not set this option greater than zero if your user information is in
27073 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
27074 search the file multiple times for non-existent users, and also cause delay.
27075 </para>
27076 <para>
27077 <indexterm role="option">
27078 <primary><option>freeze_tell</option></primary>
27079 </indexterm>
27080 </para>
27081 <informaltable frame="all">
27082 <tgroup cols="4" colsep="0" rowsep="0">
27083 <colspec colwidth="8*" align="left"/>
27084 <colspec colwidth="6*" align="center"/>
27085 <colspec colwidth="6*" align="center"/>
27086 <colspec colwidth="6*" align="right"/>
27087 <tbody>
27088 <row>
27089 <entry><option>freeze_tell</option></entry>
27090 <entry>Use: <emphasis>main</emphasis></entry>
27091 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
27092 <entry>Default: <emphasis>unset</emphasis></entry>
27093 </row>
27094 </tbody>
27095 </tgroup>
27096 </informaltable>
27097 <para>
27098 <indexterm role="concept">
27099 <primary>freezing messages</primary>
27100 <secondary>sending a message when freezing</secondary>
27101 </indexterm>
27102 On encountering certain errors, or when configured to do so in a system filter,
27103 ACL, or special router, Exim freezes a message. This means that no further
27104 delivery attempts take place until an administrator thaws the message, or the
27105 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
27106 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
27107 warning message whenever it freezes something, unless the message it is
27108 freezing is a locally-generated bounce message. (Without this exception there
27109 is the possibility of looping.) The warning message is sent to the addresses
27110 supplied as the comma-separated value of this option. If several of the
27111 message&#x2019;s addresses cause freezing, only a single message is sent. If the
27112 freezing was automatic, the reason(s) for freezing can be found in the message
27113 log. If you configure freezing in a filter or ACL, you must arrange for any
27114 logging that you require.
27115 </para>
27116 <para>
27117 <indexterm role="option">
27118 <primary><option>gecos_name</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>gecos_name</option></entry>
27130 <entry>Use: <emphasis>main</emphasis></entry>
27131 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></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>HP-UX</primary>
27140 </indexterm>
27141 <indexterm role="concept">
27142 <primary><quote>gecos</quote> field, parsing</primary>
27143 </indexterm>
27144 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
27145 password file to hold other information in addition to users&#x2019; real names. Exim
27146 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
27147 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
27148 of the field are used unchanged, except that, if an ampersand is encountered,
27149 it is replaced by the user&#x2019;s login name with the first character forced to
27150 upper case, since this is a convention that is observed on many systems.
27151 </para>
27152 <para>
27153 When these options are set, <option>gecos_pattern</option> is treated as a regular
27154 expression that is to be applied to the field (again with &amp; replaced by the
27155 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
27156 user&#x2019;s name.
27157 </para>
27158 <para>
27159 <indexterm role="concept">
27160 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
27161 <secondary>in <option>gecos_name</option></secondary>
27162 </indexterm>
27163 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
27164 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
27165 name terminates at the first comma, the following can be used:
27166 </para>
27167 <literallayout class="monospaced">
27168 gecos_pattern = ([^,]*)
27169 gecos_name = $1
27170 </literallayout>
27171 <para>
27172 <indexterm role="option">
27173 <primary><option>gecos_pattern</option></primary>
27174 </indexterm>
27175 </para>
27176 <informaltable frame="all">
27177 <tgroup cols="4" colsep="0" rowsep="0">
27178 <colspec colwidth="8*" align="left"/>
27179 <colspec colwidth="6*" align="center"/>
27180 <colspec colwidth="6*" align="center"/>
27181 <colspec colwidth="6*" align="right"/>
27182 <tbody>
27183 <row>
27184 <entry><option>gecos_pattern</option></entry>
27185 <entry>Use: <emphasis>main</emphasis></entry>
27186 <entry>Type: <emphasis>string</emphasis></entry>
27187 <entry>Default: <emphasis>unset</emphasis></entry>
27188 </row>
27189 </tbody>
27190 </tgroup>
27191 </informaltable>
27192 <para>
27193 See <option>gecos_name</option> above.
27194 </para>
27195 <para>
27196 <indexterm role="option">
27197 <primary><option>gnutls_compat_mode</option></primary>
27198 </indexterm>
27199 </para>
27200 <informaltable frame="all">
27201 <tgroup cols="4" colsep="0" rowsep="0">
27202 <colspec colwidth="8*" align="left"/>
27203 <colspec colwidth="6*" align="center"/>
27204 <colspec colwidth="6*" align="center"/>
27205 <colspec colwidth="6*" align="right"/>
27206 <tbody>
27207 <row>
27208 <entry><option>gnutls_compat_mode</option></entry>
27209 <entry>Use: <emphasis>main</emphasis></entry>
27210 <entry>Type: <emphasis>boolean</emphasis></entry>
27211 <entry>Default: <emphasis>unset</emphasis></entry>
27212 </row>
27213 </tbody>
27214 </tgroup>
27215 </informaltable>
27216 <para>
27217 This option controls whether GnuTLS is used in compatibility mode in an Exim
27218 server. This reduces security slightly, but improves interworking with older
27219 implementations of TLS.
27220 </para>
27221 <para>
27222 <indexterm role="option">
27223 <primary><option>gnutls_allow_auto_pkcs11</option></primary>
27224 </indexterm>
27225 </para>
27226 <informaltable frame="all">
27227 <tgroup cols="4" colsep="0" rowsep="0">
27228 <colspec colwidth="8*" align="left"/>
27229 <colspec colwidth="6*" align="center"/>
27230 <colspec colwidth="6*" align="center"/>
27231 <colspec colwidth="6*" align="right"/>
27232 <tbody>
27233 <row>
27234 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
27235 <entry>Use: <emphasis>main</emphasis></entry>
27236 <entry>Type: <emphasis>boolean</emphasis></entry>
27237 <entry>Default: <emphasis>unset</emphasis></entry>
27238 </row>
27239 </tbody>
27240 </tgroup>
27241 </informaltable>
27242 <para>
27243 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
27244 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
27245 </para>
27246 <para>
27247 See
27248 <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>
27249 for documentation.
27250 </para>
27251 <para>
27252 <indexterm role="option">
27253 <primary><option>headers_charset</option></primary>
27254 </indexterm>
27255 </para>
27256 <informaltable frame="all">
27257 <tgroup cols="4" colsep="0" rowsep="0">
27258 <colspec colwidth="8*" align="left"/>
27259 <colspec colwidth="6*" align="center"/>
27260 <colspec colwidth="6*" align="center"/>
27261 <colspec colwidth="6*" align="right"/>
27262 <tbody>
27263 <row>
27264 <entry><option>headers_charset</option></entry>
27265 <entry>Use: <emphasis>main</emphasis></entry>
27266 <entry>Type: <emphasis>string</emphasis></entry>
27267 <entry>Default: <emphasis>see below</emphasis></entry>
27268 </row>
27269 </tbody>
27270 </tgroup>
27271 </informaltable>
27272 <para>
27273 This option sets a default character set for translating from encoded MIME
27274 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
27275 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
27276 ultimate default is ISO-8859-1. For more details see the description of header
27277 insertions in section <xref linkend="SECTexpansionitems"/>.
27278 </para>
27279 <para>
27280 <indexterm role="option">
27281 <primary><option>header_maxsize</option></primary>
27282 </indexterm>
27283 </para>
27284 <informaltable frame="all">
27285 <tgroup cols="4" colsep="0" rowsep="0">
27286 <colspec colwidth="8*" align="left"/>
27287 <colspec colwidth="6*" align="center"/>
27288 <colspec colwidth="6*" align="center"/>
27289 <colspec colwidth="6*" align="right"/>
27290 <tbody>
27291 <row>
27292 <entry><option>header_maxsize</option></entry>
27293 <entry>Use: <emphasis>main</emphasis></entry>
27294 <entry>Type: <emphasis>integer</emphasis></entry>
27295 <entry>Default: <emphasis>see below</emphasis></entry>
27296 </row>
27297 </tbody>
27298 </tgroup>
27299 </informaltable>
27300 <para>
27301 <indexterm role="concept">
27302 <primary>header section</primary>
27303 <secondary>maximum size of</secondary>
27304 </indexterm>
27305 <indexterm role="concept">
27306 <primary>limit</primary>
27307 <secondary>size of message header section</secondary>
27308 </indexterm>
27309 This option controls the overall maximum size of a message&#x2019;s header
27310 section. The default is the value of HEADER_MAXSIZE in
27311 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
27312 sections are rejected.
27313 </para>
27314 <para>
27315 <indexterm role="option">
27316 <primary><option>header_line_maxsize</option></primary>
27317 </indexterm>
27318 </para>
27319 <informaltable frame="all">
27320 <tgroup cols="4" colsep="0" rowsep="0">
27321 <colspec colwidth="8*" align="left"/>
27322 <colspec colwidth="6*" align="center"/>
27323 <colspec colwidth="6*" align="center"/>
27324 <colspec colwidth="6*" align="right"/>
27325 <tbody>
27326 <row>
27327 <entry><option>header_line_maxsize</option></entry>
27328 <entry>Use: <emphasis>main</emphasis></entry>
27329 <entry>Type: <emphasis>integer</emphasis></entry>
27330 <entry>Default: <emphasis>0</emphasis></entry>
27331 </row>
27332 </tbody>
27333 </tgroup>
27334 </informaltable>
27335 <para>
27336 <indexterm role="concept">
27337 <primary>header lines</primary>
27338 <secondary>maximum size of</secondary>
27339 </indexterm>
27340 <indexterm role="concept">
27341 <primary>limit</primary>
27342 <secondary>size of one header line</secondary>
27343 </indexterm>
27344 This option limits the length of any individual header line in a message, after
27345 all the continuations have been joined together. Messages with individual
27346 header lines that are longer than the limit are rejected. The default value of
27347 zero means <quote>no limit</quote>.
27348 </para>
27349 <para>
27350 <indexterm role="option">
27351 <primary><option>helo_accept_junk_hosts</option></primary>
27352 </indexterm>
27353 </para>
27354 <informaltable frame="all">
27355 <tgroup cols="4" colsep="0" rowsep="0">
27356 <colspec colwidth="8*" align="left"/>
27357 <colspec colwidth="6*" align="center"/>
27358 <colspec colwidth="6*" align="center"/>
27359 <colspec colwidth="6*" align="right"/>
27360 <tbody>
27361 <row>
27362 <entry><option>helo_accept_junk_hosts</option></entry>
27363 <entry>Use: <emphasis>main</emphasis></entry>
27364 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27365 <entry>Default: <emphasis>unset</emphasis></entry>
27366 </row>
27367 </tbody>
27368 </tgroup>
27369 </informaltable>
27370 <para>
27371 <indexterm role="concept">
27372 <primary>HELO</primary>
27373 <secondary>accepting junk data</secondary>
27374 </indexterm>
27375 <indexterm role="concept">
27376 <primary>EHLO</primary>
27377 <secondary>accepting junk data</secondary>
27378 </indexterm>
27379 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
27380 mail, and gives an error response for invalid data. Unfortunately, there are
27381 some SMTP clients that send syntactic junk. They can be accommodated by setting
27382 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
27383 if you want to do semantic checking.
27384 See also <option>helo_allow_chars</option> for a way of extending the permitted character
27385 set.
27386 </para>
27387 <para>
27388 <indexterm role="option">
27389 <primary><option>helo_allow_chars</option></primary>
27390 </indexterm>
27391 </para>
27392 <informaltable frame="all">
27393 <tgroup cols="4" colsep="0" rowsep="0">
27394 <colspec colwidth="8*" align="left"/>
27395 <colspec colwidth="6*" align="center"/>
27396 <colspec colwidth="6*" align="center"/>
27397 <colspec colwidth="6*" align="right"/>
27398 <tbody>
27399 <row>
27400 <entry><option>helo_allow_chars</option></entry>
27401 <entry>Use: <emphasis>main</emphasis></entry>
27402 <entry>Type: <emphasis>string</emphasis></entry>
27403 <entry>Default: <emphasis>unset</emphasis></entry>
27404 </row>
27405 </tbody>
27406 </tgroup>
27407 </informaltable>
27408 <para>
27409 <indexterm role="concept">
27410 <primary>HELO</primary>
27411 <secondary>underscores in</secondary>
27412 </indexterm>
27413 <indexterm role="concept">
27414 <primary>EHLO</primary>
27415 <secondary>underscores in</secondary>
27416 </indexterm>
27417 <indexterm role="concept">
27418 <primary>underscore in EHLO/HELO</primary>
27419 </indexterm>
27420 This option can be set to a string of rogue characters that are permitted in
27421 all EHLO and HELO names in addition to the standard letters, digits,
27422 hyphens, and dots. If you really must allow underscores, you can set
27423 </para>
27424 <literallayout class="monospaced">
27425 helo_allow_chars = _
27426 </literallayout>
27427 <para>
27428 Note that the value is one string, not a list.
27429 </para>
27430 <para>
27431 <indexterm role="option">
27432 <primary><option>helo_lookup_domains</option></primary>
27433 </indexterm>
27434 </para>
27435 <informaltable frame="all">
27436 <tgroup cols="4" colsep="0" rowsep="0">
27437 <colspec colwidth="8*" align="left"/>
27438 <colspec colwidth="6*" align="center"/>
27439 <colspec colwidth="6*" align="center"/>
27440 <colspec colwidth="6*" align="right"/>
27441 <tbody>
27442 <row>
27443 <entry><option>helo_lookup_domains</option></entry>
27444 <entry>Use: <emphasis>main</emphasis></entry>
27445 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27446 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
27447 </row>
27448 </tbody>
27449 </tgroup>
27450 </informaltable>
27451 <para>
27452 <indexterm role="concept">
27453 <primary>HELO</primary>
27454 <secondary>forcing reverse lookup</secondary>
27455 </indexterm>
27456 <indexterm role="concept">
27457 <primary>EHLO</primary>
27458 <secondary>forcing reverse lookup</secondary>
27459 </indexterm>
27460 If the domain given by a client in a HELO or EHLO command matches this
27461 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
27462 default forces a lookup if the client host gives the server&#x2019;s name or any of
27463 its IP addresses (in brackets), something that broken clients have been seen to
27464 do.
27465 </para>
27466 <para>
27467 <indexterm role="option">
27468 <primary><option>helo_try_verify_hosts</option></primary>
27469 </indexterm>
27470 </para>
27471 <informaltable frame="all">
27472 <tgroup cols="4" colsep="0" rowsep="0">
27473 <colspec colwidth="8*" align="left"/>
27474 <colspec colwidth="6*" align="center"/>
27475 <colspec colwidth="6*" align="center"/>
27476 <colspec colwidth="6*" align="right"/>
27477 <tbody>
27478 <row>
27479 <entry><option>helo_try_verify_hosts</option></entry>
27480 <entry>Use: <emphasis>main</emphasis></entry>
27481 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27482 <entry>Default: <emphasis>unset</emphasis></entry>
27483 </row>
27484 </tbody>
27485 </tgroup>
27486 </informaltable>
27487 <para>
27488 <indexterm role="concept">
27489 <primary>HELO verifying</primary>
27490 <secondary>optional</secondary>
27491 </indexterm>
27492 <indexterm role="concept">
27493 <primary>EHLO</primary>
27494 <secondary>verifying, optional</secondary>
27495 </indexterm>
27496 By default, Exim just checks the syntax of HELO and EHLO commands (see
27497 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
27498 to do more extensive checking of the data supplied by these commands. The ACL
27499 condition <literal>verify = helo</literal> is provided to make this possible.
27500 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
27501 to force the check to occur. From release 4.53 onwards, this is no longer
27502 necessary. If the check has not been done before <literal>verify = helo</literal> is
27503 encountered, it is done at that time. Consequently, this option is obsolete.
27504 Its specification is retained here for backwards compatibility.
27505 </para>
27506 <para>
27507 When an EHLO or HELO command is received, if the calling host matches
27508 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
27509 EHLO command either:
27510 </para>
27511 <itemizedlist>
27512 <listitem>
27513 <para>
27514 is an IP literal matching the calling address of the host, or
27515 </para>
27516 </listitem>
27517 <listitem>
27518 <para>
27519 <indexterm role="concept">
27520 <primary>DNS</primary>
27521 <secondary>reverse lookup</secondary>
27522 </indexterm>
27523 <indexterm role="concept">
27524 <primary>reverse DNS lookup</primary>
27525 </indexterm>
27526 matches the host name that Exim obtains by doing a reverse lookup of the
27527 calling host address, or
27528 </para>
27529 </listitem>
27530 <listitem>
27531 <para>
27532 when looked up in DNS yields the calling host address.
27533 </para>
27534 </listitem>
27535 </itemizedlist>
27536 <para>
27537 However, the EHLO or HELO command is not rejected if any of the checks
27538 fail. Processing continues, but the result of the check is remembered, and can
27539 be detected later in an ACL by the <literal>verify = helo</literal> condition.
27540 </para>
27541 <para>
27542 If DNS was used for successful verification, the variable
27543 <indexterm role="concept">
27544 <primary>DNS</primary>
27545 <secondary>DNSSEC</secondary>
27546 </indexterm>
27547 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
27548 </para>
27549 <para>
27550 <indexterm role="option">
27551 <primary><option>helo_verify_hosts</option></primary>
27552 </indexterm>
27553 </para>
27554 <informaltable frame="all">
27555 <tgroup cols="4" colsep="0" rowsep="0">
27556 <colspec colwidth="8*" align="left"/>
27557 <colspec colwidth="6*" align="center"/>
27558 <colspec colwidth="6*" align="center"/>
27559 <colspec colwidth="6*" align="right"/>
27560 <tbody>
27561 <row>
27562 <entry><option>helo_verify_hosts</option></entry>
27563 <entry>Use: <emphasis>main</emphasis></entry>
27564 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27565 <entry>Default: <emphasis>unset</emphasis></entry>
27566 </row>
27567 </tbody>
27568 </tgroup>
27569 </informaltable>
27570 <para>
27571 <indexterm role="concept">
27572 <primary>HELO verifying</primary>
27573 <secondary>mandatory</secondary>
27574 </indexterm>
27575 <indexterm role="concept">
27576 <primary>EHLO</primary>
27577 <secondary>verifying, mandatory</secondary>
27578 </indexterm>
27579 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
27580 backwards compatibility. For hosts that match this option, Exim checks the host
27581 name given in the HELO or EHLO in the same way as for
27582 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
27583 rejected with a 550 error, and entries are written to the main and reject logs.
27584 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
27585 error.
27586 </para>
27587 <para>
27588 <indexterm role="option">
27589 <primary><option>hold_domains</option></primary>
27590 </indexterm>
27591 </para>
27592 <informaltable frame="all">
27593 <tgroup cols="4" colsep="0" rowsep="0">
27594 <colspec colwidth="8*" align="left"/>
27595 <colspec colwidth="6*" align="center"/>
27596 <colspec colwidth="6*" align="center"/>
27597 <colspec colwidth="6*" align="right"/>
27598 <tbody>
27599 <row>
27600 <entry><option>hold_domains</option></entry>
27601 <entry>Use: <emphasis>main</emphasis></entry>
27602 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27603 <entry>Default: <emphasis>unset</emphasis></entry>
27604 </row>
27605 </tbody>
27606 </tgroup>
27607 </informaltable>
27608 <para>
27609 <indexterm role="concept">
27610 <primary>domain</primary>
27611 <secondary>delaying delivery</secondary>
27612 </indexterm>
27613 <indexterm role="concept">
27614 <primary>delivery</primary>
27615 <secondary>delaying certain domains</secondary>
27616 </indexterm>
27617 This option allows mail for particular domains to be held in the queue
27618 manually. The option is overridden if a message delivery is forced with the
27619 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
27620 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
27621 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
27622 it is deferred every time the message is looked at.
27623 </para>
27624 <para>
27625 This option is intended as a temporary operational measure for delaying the
27626 delivery of mail while some problem is being sorted out, or some new
27627 configuration tested. If you just want to delay the processing of some
27628 domains until a queue run occurs, you should use <option>queue_domains</option> or
27629 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
27630 </para>
27631 <para>
27632 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
27633 messages from the queue if they have been there longer than the longest retry
27634 time in any retry rule. If you want to hold messages for longer than the normal
27635 retry times, insert a dummy retry rule with a long retry time.
27636 </para>
27637 <para>
27638 <indexterm role="option">
27639 <primary><option>host_lookup</option></primary>
27640 </indexterm>
27641 </para>
27642 <informaltable frame="all">
27643 <tgroup cols="4" colsep="0" rowsep="0">
27644 <colspec colwidth="8*" align="left"/>
27645 <colspec colwidth="6*" align="center"/>
27646 <colspec colwidth="6*" align="center"/>
27647 <colspec colwidth="6*" align="right"/>
27648 <tbody>
27649 <row>
27650 <entry><option>host_lookup</option></entry>
27651 <entry>Use: <emphasis>main</emphasis></entry>
27652 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27653 <entry>Default: <emphasis>unset</emphasis></entry>
27654 </row>
27655 </tbody>
27656 </tgroup>
27657 </informaltable>
27658 <para>
27659 <indexterm role="concept">
27660 <primary>host name</primary>
27661 <secondary>lookup, forcing</secondary>
27662 </indexterm>
27663 Exim does not look up the name of a calling host from its IP address unless it
27664 is required to compare against some host list, or the host matches
27665 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
27666 option (which normally contains IP addresses rather than host names). The
27667 default configuration file contains
27668 </para>
27669 <literallayout class="monospaced">
27670 host_lookup = *
27671 </literallayout>
27672 <para>
27673 which causes a lookup to happen for all hosts. If the expense of these lookups
27674 is felt to be too great, the setting can be changed or removed.
27675 </para>
27676 <para>
27677 After a successful reverse lookup, Exim does a forward lookup on the name it
27678 has obtained, to verify that it yields the IP address that it started with. If
27679 this check fails, Exim behaves as if the name lookup failed.
27680 </para>
27681 <para>
27682 <indexterm role="variable">
27683 <primary><varname>$host_lookup_failed</varname></primary>
27684 </indexterm>
27685 <indexterm role="variable">
27686 <primary><varname>$sender_host_name</varname></primary>
27687 </indexterm>
27688 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
27689 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
27690 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
27691 <literal>verify = reverse_host_lookup</literal> in ACLs.
27692 </para>
27693 <para>
27694 <indexterm role="option">
27695 <primary><option>host_lookup_order</option></primary>
27696 </indexterm>
27697 </para>
27698 <informaltable frame="all">
27699 <tgroup cols="4" colsep="0" rowsep="0">
27700 <colspec colwidth="8*" align="left"/>
27701 <colspec colwidth="6*" align="center"/>
27702 <colspec colwidth="6*" align="center"/>
27703 <colspec colwidth="6*" align="right"/>
27704 <tbody>
27705 <row>
27706 <entry><option>host_lookup_order</option></entry>
27707 <entry>Use: <emphasis>main</emphasis></entry>
27708 <entry>Type: <emphasis>string list</emphasis></entry>
27709 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
27710 </row>
27711 </tbody>
27712 </tgroup>
27713 </informaltable>
27714 <para>
27715 This option specifies the order of different lookup methods when Exim is trying
27716 to find a host name from an IP address. The default is to do a DNS lookup
27717 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
27718 if that fails. You can change the order of these lookups, or omit one entirely,
27719 if you want.
27720 </para>
27721 <para>
27722 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
27723 multiple PTR records in the DNS and the IP address is not listed in
27724 <filename>/etc/hosts</filename>. Different operating systems give different results in this
27725 case. That is why the default tries a DNS lookup first.
27726 </para>
27727 <para>
27728 <indexterm role="option">
27729 <primary><option>host_reject_connection</option></primary>
27730 </indexterm>
27731 </para>
27732 <informaltable frame="all">
27733 <tgroup cols="4" colsep="0" rowsep="0">
27734 <colspec colwidth="8*" align="left"/>
27735 <colspec colwidth="6*" align="center"/>
27736 <colspec colwidth="6*" align="center"/>
27737 <colspec colwidth="6*" align="right"/>
27738 <tbody>
27739 <row>
27740 <entry><option>host_reject_connection</option></entry>
27741 <entry>Use: <emphasis>main</emphasis></entry>
27742 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27743 <entry>Default: <emphasis>unset</emphasis></entry>
27744 </row>
27745 </tbody>
27746 </tgroup>
27747 </informaltable>
27748 <para>
27749 <indexterm role="concept">
27750 <primary>host</primary>
27751 <secondary>rejecting connections from</secondary>
27752 </indexterm>
27753 If this option is set, incoming SMTP calls from the hosts listed are rejected
27754 as soon as the connection is made.
27755 This option is obsolete, and retained only for backward compatibility, because
27756 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
27757 connections immediately.
27758 </para>
27759 <para>
27760 The ability to give an immediate rejection (either by this option or using an
27761 ACL) is provided for use in unusual cases. Many hosts will just try again,
27762 sometimes without much delay. Normally, it is better to use an ACL to reject
27763 incoming messages at a later stage, such as after RCPT commands. See
27764 chapter <xref linkend="CHAPACL"/>.
27765 </para>
27766 <para>
27767 <indexterm role="option">
27768 <primary><option>hosts_connection_nolog</option></primary>
27769 </indexterm>
27770 </para>
27771 <informaltable frame="all">
27772 <tgroup cols="4" colsep="0" rowsep="0">
27773 <colspec colwidth="8*" align="left"/>
27774 <colspec colwidth="6*" align="center"/>
27775 <colspec colwidth="6*" align="center"/>
27776 <colspec colwidth="6*" align="right"/>
27777 <tbody>
27778 <row>
27779 <entry><option>hosts_connection_nolog</option></entry>
27780 <entry>Use: <emphasis>main</emphasis></entry>
27781 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27782 <entry>Default: <emphasis>unset</emphasis></entry>
27783 </row>
27784 </tbody>
27785 </tgroup>
27786 </informaltable>
27787 <para>
27788 <indexterm role="concept">
27789 <primary>host</primary>
27790 <secondary>not logging connections from</secondary>
27791 </indexterm>
27792 This option defines a list of hosts for which connection logging does not
27793 happen, even though the <option>smtp_connection</option> log selector is set. For example,
27794 you might want not to log SMTP connections from local processes, or from
27795 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
27796 the daemon; you should therefore strive to restrict its value to a short inline
27797 list of IP addresses and networks. To disable logging SMTP connections from
27798 local processes, you must create a host list with an empty item. For example:
27799 </para>
27800 <literallayout class="monospaced">
27801 hosts_connection_nolog = :
27802 </literallayout>
27803 <para>
27804 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
27805 </para>
27806 <para>
27807 <indexterm role="option">
27808 <primary><option>hosts_proxy</option></primary>
27809 </indexterm>
27810 </para>
27811 <informaltable frame="all">
27812 <tgroup cols="4" colsep="0" rowsep="0">
27813 <colspec colwidth="8*" align="left"/>
27814 <colspec colwidth="6*" align="center"/>
27815 <colspec colwidth="6*" align="center"/>
27816 <colspec colwidth="6*" align="right"/>
27817 <tbody>
27818 <row>
27819 <entry><option>hosts_proxy</option></entry>
27820 <entry>Use: <emphasis>main</emphasis></entry>
27821 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27822 <entry>Default: <emphasis>unset</emphasis></entry>
27823 </row>
27824 </tbody>
27825 </tgroup>
27826 </informaltable>
27827 <para>
27828 <indexterm role="concept">
27829 <primary>proxy</primary>
27830 <secondary>proxy protocol</secondary>
27831 </indexterm>
27832 This option enables use of Proxy Protocol proxies for incoming
27833 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
27834 </para>
27835 <para>
27836 <indexterm role="option">
27837 <primary><option>hosts_treat_as_local</option></primary>
27838 </indexterm>
27839 </para>
27840 <informaltable frame="all">
27841 <tgroup cols="4" colsep="0" rowsep="0">
27842 <colspec colwidth="8*" align="left"/>
27843 <colspec colwidth="6*" align="center"/>
27844 <colspec colwidth="6*" align="center"/>
27845 <colspec colwidth="6*" align="right"/>
27846 <tbody>
27847 <row>
27848 <entry><option>hosts_treat_as_local</option></entry>
27849 <entry>Use: <emphasis>main</emphasis></entry>
27850 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27851 <entry>Default: <emphasis>unset</emphasis></entry>
27852 </row>
27853 </tbody>
27854 </tgroup>
27855 </informaltable>
27856 <para>
27857 <indexterm role="concept">
27858 <primary>local host</primary>
27859 <secondary>domains treated as</secondary>
27860 </indexterm>
27861 <indexterm role="concept">
27862 <primary>host</primary>
27863 <secondary>treated as local</secondary>
27864 </indexterm>
27865 If this option is set, any host names that match the domain list are treated as
27866 if they were the local host when Exim is scanning host lists obtained from MX
27867 records
27868 or other sources. Note that the value of this option is a domain list, not a
27869 host list, because it is always used to check host names, not IP addresses.
27870 </para>
27871 <para>
27872 This option also applies when Exim is matching the special items
27873 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
27874 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
27875 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
27876 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
27877 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
27878 interfaces and recognizing the local host.
27879 </para>
27880 <para>
27881 <indexterm role="option">
27882 <primary><option>ibase_servers</option></primary>
27883 </indexterm>
27884 </para>
27885 <informaltable frame="all">
27886 <tgroup cols="4" colsep="0" rowsep="0">
27887 <colspec colwidth="8*" align="left"/>
27888 <colspec colwidth="6*" align="center"/>
27889 <colspec colwidth="6*" align="center"/>
27890 <colspec colwidth="6*" align="right"/>
27891 <tbody>
27892 <row>
27893 <entry><option>ibase_servers</option></entry>
27894 <entry>Use: <emphasis>main</emphasis></entry>
27895 <entry>Type: <emphasis>string list</emphasis></entry>
27896 <entry>Default: <emphasis>unset</emphasis></entry>
27897 </row>
27898 </tbody>
27899 </tgroup>
27900 </informaltable>
27901 <para>
27902 <indexterm role="concept">
27903 <primary>InterBase</primary>
27904 <secondary>server list</secondary>
27905 </indexterm>
27906 This option provides a list of InterBase servers and associated connection data,
27907 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
27908 The option is available only if Exim has been built with InterBase support.
27909 </para>
27910 <para>
27911 <indexterm role="option">
27912 <primary><option>ignore_bounce_errors_after</option></primary>
27913 </indexterm>
27914 </para>
27915 <informaltable frame="all">
27916 <tgroup cols="4" colsep="0" rowsep="0">
27917 <colspec colwidth="8*" align="left"/>
27918 <colspec colwidth="6*" align="center"/>
27919 <colspec colwidth="6*" align="center"/>
27920 <colspec colwidth="6*" align="right"/>
27921 <tbody>
27922 <row>
27923 <entry><option>ignore_bounce_errors_after</option></entry>
27924 <entry>Use: <emphasis>main</emphasis></entry>
27925 <entry>Type: <emphasis>time</emphasis></entry>
27926 <entry>Default: <emphasis>10w</emphasis></entry>
27927 </row>
27928 </tbody>
27929 </tgroup>
27930 </informaltable>
27931 <para>
27932 <indexterm role="concept">
27933 <primary>bounce message</primary>
27934 <secondary>discarding</secondary>
27935 </indexterm>
27936 <indexterm role="concept">
27937 <primary>discarding bounce message</primary>
27938 </indexterm>
27939 This option affects the processing of bounce messages that cannot be delivered,
27940 that is, those that suffer a permanent delivery failure. (Bounce messages that
27941 suffer temporary delivery failures are of course retried in the usual way.)
27942 </para>
27943 <para>
27944 After a permanent delivery failure, bounce messages are frozen,
27945 because there is no sender to whom they can be returned. When a frozen bounce
27946 message has been in the queue for more than the given time, it is unfrozen at
27947 the next queue run, and a further delivery is attempted. If delivery fails
27948 again, the bounce message is discarded. This makes it possible to keep failed
27949 bounce messages around for a shorter time than the normal maximum retry time
27950 for frozen messages. For example,
27951 </para>
27952 <literallayout class="monospaced">
27953 ignore_bounce_errors_after = 12h
27954 </literallayout>
27955 <para>
27956 retries failed bounce message deliveries after 12 hours, discarding any further
27957 failures. If the value of this option is set to a zero time period, bounce
27958 failures are discarded immediately. Setting a very long time (as in the default
27959 value) has the effect of disabling this option. For ways of automatically
27960 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
27961 <option>timeout_frozen_after</option>.
27962 </para>
27963 <para>
27964 <indexterm role="option">
27965 <primary><option>ignore_fromline_hosts</option></primary>
27966 </indexterm>
27967 </para>
27968 <informaltable frame="all">
27969 <tgroup cols="4" colsep="0" rowsep="0">
27970 <colspec colwidth="8*" align="left"/>
27971 <colspec colwidth="6*" align="center"/>
27972 <colspec colwidth="6*" align="center"/>
27973 <colspec colwidth="6*" align="right"/>
27974 <tbody>
27975 <row>
27976 <entry><option>ignore_fromline_hosts</option></entry>
27977 <entry>Use: <emphasis>main</emphasis></entry>
27978 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27979 <entry>Default: <emphasis>unset</emphasis></entry>
27980 </row>
27981 </tbody>
27982 </tgroup>
27983 </informaltable>
27984 <para>
27985 <indexterm role="concept">
27986 <primary><quote>From</quote> line</primary>
27987 </indexterm>
27988 <indexterm role="concept">
27989 <primary>UUCP</primary>
27990 <secondary><quote>From</quote> line</secondary>
27991 </indexterm>
27992 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
27993 the headers of a message. By default this is treated as the start of the
27994 message&#x2019;s body, which means that any following headers are not recognized as
27995 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
27996 match those hosts that insist on sending it. If the sender is actually a local
27997 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
27998 <option>ignore_fromline_local</option> must be set to achieve this effect.
27999 </para>
28000 <para>
28001 <indexterm role="option">
28002 <primary><option>ignore_fromline_local</option></primary>
28003 </indexterm>
28004 </para>
28005 <informaltable frame="all">
28006 <tgroup cols="4" colsep="0" rowsep="0">
28007 <colspec colwidth="8*" align="left"/>
28008 <colspec colwidth="6*" align="center"/>
28009 <colspec colwidth="6*" align="center"/>
28010 <colspec colwidth="6*" align="right"/>
28011 <tbody>
28012 <row>
28013 <entry><option>ignore_fromline_local</option></entry>
28014 <entry>Use: <emphasis>main</emphasis></entry>
28015 <entry>Type: <emphasis>boolean</emphasis></entry>
28016 <entry>Default: <emphasis>false</emphasis></entry>
28017 </row>
28018 </tbody>
28019 </tgroup>
28020 </informaltable>
28021 <para>
28022 See <option>ignore_fromline_hosts</option> above.
28023 </para>
28024 <para>
28025 <indexterm role="option">
28026 <primary><option>keep_environment</option></primary>
28027 </indexterm>
28028 </para>
28029 <informaltable frame="all">
28030 <tgroup cols="4" colsep="0" rowsep="0">
28031 <colspec colwidth="8*" align="left"/>
28032 <colspec colwidth="6*" align="center"/>
28033 <colspec colwidth="6*" align="center"/>
28034 <colspec colwidth="6*" align="right"/>
28035 <tbody>
28036 <row>
28037 <entry><option>keep_environment</option></entry>
28038 <entry>Use: <emphasis>main</emphasis></entry>
28039 <entry>Type: <emphasis>string list</emphasis></entry>
28040 <entry>Default: <emphasis>unset</emphasis></entry>
28041 </row>
28042 </tbody>
28043 </tgroup>
28044 </informaltable>
28045 <para>
28046 <indexterm role="concept">
28047 <primary>environment</primary>
28048 <secondary>values from</secondary>
28049 </indexterm>
28050 This option contains a string list of environment variables to keep.
28051 You have to trust these variables or you have to be sure that
28052 these variables do not impose any security risk. Keep in mind that
28053 during the startup phase Exim is running with an effective UID 0 in most
28054 installations. As the default value is an empty list, the default
28055 environment for using libraries, running embedded Perl code, or running
28056 external binaries is empty, and does not not even contain PATH or HOME.
28057 </para>
28058 <para>
28059 Actually the list is interpreted as a list of patterns
28060 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
28061 </para>
28062 <para>
28063 WARNING: Macro substitution is still done first, so having a macro
28064 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
28065 unexpected results. You may work around this using a regular expression
28066 that does not match the macro name: ^[F]OO_HOME$.
28067 </para>
28068 <para>
28069 Current versions of Exim issue a warning during startup if you do not mention
28070 <option>keep_environment</option> in your runtime configuration file and if your
28071 current environment is not empty. Future versions may not issue that warning
28072 anymore.
28073 </para>
28074 <para>
28075 See the <option>add_environment</option> main config option for a way to set
28076 environment variables to a fixed value.  The environment for <command>pipe</command>
28077 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
28078 details.
28079 </para>
28080 <para>
28081 <indexterm role="option">
28082 <primary><option>keep_malformed</option></primary>
28083 </indexterm>
28084 </para>
28085 <informaltable frame="all">
28086 <tgroup cols="4" colsep="0" rowsep="0">
28087 <colspec colwidth="8*" align="left"/>
28088 <colspec colwidth="6*" align="center"/>
28089 <colspec colwidth="6*" align="center"/>
28090 <colspec colwidth="6*" align="right"/>
28091 <tbody>
28092 <row>
28093 <entry><option>keep_malformed</option></entry>
28094 <entry>Use: <emphasis>main</emphasis></entry>
28095 <entry>Type: <emphasis>time</emphasis></entry>
28096 <entry>Default: <emphasis>4d</emphasis></entry>
28097 </row>
28098 </tbody>
28099 </tgroup>
28100 </informaltable>
28101 <para>
28102 This option specifies the length of time to keep messages whose spool files
28103 have been corrupted in some way. This should, of course, never happen. At the
28104 next attempt to deliver such a message, it gets removed. The incident is
28105 logged.
28106 </para>
28107 <para>
28108 <indexterm role="option">
28109 <primary><option>ldap_ca_cert_dir</option></primary>
28110 </indexterm>
28111 </para>
28112 <informaltable frame="all">
28113 <tgroup cols="4" colsep="0" rowsep="0">
28114 <colspec colwidth="8*" align="left"/>
28115 <colspec colwidth="6*" align="center"/>
28116 <colspec colwidth="6*" align="center"/>
28117 <colspec colwidth="6*" align="right"/>
28118 <tbody>
28119 <row>
28120 <entry><option>ldap_ca_cert_dir</option></entry>
28121 <entry>Use: <emphasis>main</emphasis></entry>
28122 <entry>Type: <emphasis>string</emphasis></entry>
28123 <entry>Default: <emphasis>unset</emphasis></entry>
28124 </row>
28125 </tbody>
28126 </tgroup>
28127 </informaltable>
28128 <para>
28129 <indexterm role="concept">
28130 <primary>LDAP</primary>
28131 <secondary>,</secondary>
28132 </indexterm>
28133 <indexterm role="concept">
28134 <primary>certificate</primary>
28135 <secondary>directory for LDAP</secondary>
28136 </indexterm>
28137 This option indicates which directory contains CA certificates for verifying
28138 a TLS certificate presented by an LDAP server.
28139 While Exim does not provide a default value, your SSL library may.
28140 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
28141 and constrained to be a directory.
28142 </para>
28143 <para>
28144 <indexterm role="option">
28145 <primary><option>ldap_ca_cert_file</option></primary>
28146 </indexterm>
28147 </para>
28148 <informaltable frame="all">
28149 <tgroup cols="4" colsep="0" rowsep="0">
28150 <colspec colwidth="8*" align="left"/>
28151 <colspec colwidth="6*" align="center"/>
28152 <colspec colwidth="6*" align="center"/>
28153 <colspec colwidth="6*" align="right"/>
28154 <tbody>
28155 <row>
28156 <entry><option>ldap_ca_cert_file</option></entry>
28157 <entry>Use: <emphasis>main</emphasis></entry>
28158 <entry>Type: <emphasis>string</emphasis></entry>
28159 <entry>Default: <emphasis>unset</emphasis></entry>
28160 </row>
28161 </tbody>
28162 </tgroup>
28163 </informaltable>
28164 <para>
28165 <indexterm role="concept">
28166 <primary>LDAP</primary>
28167 <secondary>,</secondary>
28168 </indexterm>
28169 <indexterm role="concept">
28170 <primary>certificate</primary>
28171 <secondary>file for LDAP</secondary>
28172 </indexterm>
28173 This option indicates which file contains CA certificates for verifying
28174 a TLS certificate presented by an LDAP server.
28175 While Exim does not provide a default value, your SSL library may.
28176 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
28177 and constrained to be a file.
28178 </para>
28179 <para>
28180 <indexterm role="option">
28181 <primary><option>ldap_cert_file</option></primary>
28182 </indexterm>
28183 </para>
28184 <informaltable frame="all">
28185 <tgroup cols="4" colsep="0" rowsep="0">
28186 <colspec colwidth="8*" align="left"/>
28187 <colspec colwidth="6*" align="center"/>
28188 <colspec colwidth="6*" align="center"/>
28189 <colspec colwidth="6*" align="right"/>
28190 <tbody>
28191 <row>
28192 <entry><option>ldap_cert_file</option></entry>
28193 <entry>Use: <emphasis>main</emphasis></entry>
28194 <entry>Type: <emphasis>string</emphasis></entry>
28195 <entry>Default: <emphasis>unset</emphasis></entry>
28196 </row>
28197 </tbody>
28198 </tgroup>
28199 </informaltable>
28200 <para>
28201 <indexterm role="concept">
28202 <primary>LDAP</primary>
28203 <secondary>TLS client certificate file</secondary>
28204 </indexterm>
28205 <indexterm role="concept">
28206 <primary>certificate</primary>
28207 <secondary>file for LDAP</secondary>
28208 </indexterm>
28209 This option indicates which file contains an TLS client certificate which
28210 Exim should present to the LDAP server during TLS negotiation.
28211 Should be used together with <option>ldap_cert_key</option>.
28212 </para>
28213 <para>
28214 <indexterm role="option">
28215 <primary><option>ldap_cert_key</option></primary>
28216 </indexterm>
28217 </para>
28218 <informaltable frame="all">
28219 <tgroup cols="4" colsep="0" rowsep="0">
28220 <colspec colwidth="8*" align="left"/>
28221 <colspec colwidth="6*" align="center"/>
28222 <colspec colwidth="6*" align="center"/>
28223 <colspec colwidth="6*" align="right"/>
28224 <tbody>
28225 <row>
28226 <entry><option>ldap_cert_key</option></entry>
28227 <entry>Use: <emphasis>main</emphasis></entry>
28228 <entry>Type: <emphasis>string</emphasis></entry>
28229 <entry>Default: <emphasis>unset</emphasis></entry>
28230 </row>
28231 </tbody>
28232 </tgroup>
28233 </informaltable>
28234 <para>
28235 <indexterm role="concept">
28236 <primary>LDAP</primary>
28237 <secondary>TLS client key file</secondary>
28238 </indexterm>
28239 <indexterm role="concept">
28240 <primary>certificate</primary>
28241 <secondary>key for LDAP</secondary>
28242 </indexterm>
28243 This option indicates which file contains the secret/private key to use
28244 to prove identity to the LDAP server during TLS negotiation.
28245 Should be used together with <option>ldap_cert_file</option>, which contains the
28246 identity to be proven.
28247 </para>
28248 <para>
28249 <indexterm role="option">
28250 <primary><option>ldap_cipher_suite</option></primary>
28251 </indexterm>
28252 </para>
28253 <informaltable frame="all">
28254 <tgroup cols="4" colsep="0" rowsep="0">
28255 <colspec colwidth="8*" align="left"/>
28256 <colspec colwidth="6*" align="center"/>
28257 <colspec colwidth="6*" align="center"/>
28258 <colspec colwidth="6*" align="right"/>
28259 <tbody>
28260 <row>
28261 <entry><option>ldap_cipher_suite</option></entry>
28262 <entry>Use: <emphasis>main</emphasis></entry>
28263 <entry>Type: <emphasis>string</emphasis></entry>
28264 <entry>Default: <emphasis>unset</emphasis></entry>
28265 </row>
28266 </tbody>
28267 </tgroup>
28268 </informaltable>
28269 <para>
28270 <indexterm role="concept">
28271 <primary>LDAP</primary>
28272 <secondary>TLS cipher suite</secondary>
28273 </indexterm>
28274 This controls the TLS cipher-suite negotiation during TLS negotiation with
28275 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
28276 cipher-suite options with OpenSSL (as used by LDAP client libraries).
28277 </para>
28278 <para>
28279 <indexterm role="option">
28280 <primary><option>ldap_default_servers</option></primary>
28281 </indexterm>
28282 </para>
28283 <informaltable frame="all">
28284 <tgroup cols="4" colsep="0" rowsep="0">
28285 <colspec colwidth="8*" align="left"/>
28286 <colspec colwidth="6*" align="center"/>
28287 <colspec colwidth="6*" align="center"/>
28288 <colspec colwidth="6*" align="right"/>
28289 <tbody>
28290 <row>
28291 <entry><option>ldap_default_servers</option></entry>
28292 <entry>Use: <emphasis>main</emphasis></entry>
28293 <entry>Type: <emphasis>string list</emphasis></entry>
28294 <entry>Default: <emphasis>unset</emphasis></entry>
28295 </row>
28296 </tbody>
28297 </tgroup>
28298 </informaltable>
28299 <para>
28300 <indexterm role="concept">
28301 <primary>LDAP</primary>
28302 <secondary>default servers</secondary>
28303 </indexterm>
28304 This option provides a list of LDAP servers which are tried in turn when an
28305 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
28306 details of LDAP queries. This option is available only when Exim has been built
28307 with LDAP support.
28308 </para>
28309 <para>
28310 <indexterm role="option">
28311 <primary><option>ldap_require_cert</option></primary>
28312 </indexterm>
28313 </para>
28314 <informaltable frame="all">
28315 <tgroup cols="4" colsep="0" rowsep="0">
28316 <colspec colwidth="8*" align="left"/>
28317 <colspec colwidth="6*" align="center"/>
28318 <colspec colwidth="6*" align="center"/>
28319 <colspec colwidth="6*" align="right"/>
28320 <tbody>
28321 <row>
28322 <entry><option>ldap_require_cert</option></entry>
28323 <entry>Use: <emphasis>main</emphasis></entry>
28324 <entry>Type: <emphasis>string</emphasis></entry>
28325 <entry>Default: <emphasis>unset.</emphasis></entry>
28326 </row>
28327 </tbody>
28328 </tgroup>
28329 </informaltable>
28330 <para>
28331 <indexterm role="concept">
28332 <primary>LDAP</primary>
28333 <secondary>policy for LDAP server TLS cert presentation</secondary>
28334 </indexterm>
28335 This should be one of the values "hard", "demand", "allow", "try" or "never".
28336 A value other than one of these is interpreted as "never".
28337 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
28338 Although Exim does not set a default, the LDAP library probably defaults
28339 to hard/demand.
28340 </para>
28341 <para>
28342 <indexterm role="option">
28343 <primary><option>ldap_start_tls</option></primary>
28344 </indexterm>
28345 </para>
28346 <informaltable frame="all">
28347 <tgroup cols="4" colsep="0" rowsep="0">
28348 <colspec colwidth="8*" align="left"/>
28349 <colspec colwidth="6*" align="center"/>
28350 <colspec colwidth="6*" align="center"/>
28351 <colspec colwidth="6*" align="right"/>
28352 <tbody>
28353 <row>
28354 <entry><option>ldap_start_tls</option></entry>
28355 <entry>Use: <emphasis>main</emphasis></entry>
28356 <entry>Type: <emphasis>boolean</emphasis></entry>
28357 <entry>Default: <emphasis>false</emphasis></entry>
28358 </row>
28359 </tbody>
28360 </tgroup>
28361 </informaltable>
28362 <para>
28363 <indexterm role="concept">
28364 <primary>LDAP</primary>
28365 <secondary>whether or not to negotiate TLS</secondary>
28366 </indexterm>
28367 If set, Exim will attempt to negotiate TLS with the LDAP server when
28368 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
28369 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
28370 of SSL-on-connect.
28371 In the event of failure to negotiate TLS, the action taken is controlled
28372 by <option>ldap_require_cert</option>.
28373 This option is ignored for <literal>ldapi</literal> connections.
28374 </para>
28375 <para>
28376 <indexterm role="option">
28377 <primary><option>ldap_version</option></primary>
28378 </indexterm>
28379 </para>
28380 <informaltable frame="all">
28381 <tgroup cols="4" colsep="0" rowsep="0">
28382 <colspec colwidth="8*" align="left"/>
28383 <colspec colwidth="6*" align="center"/>
28384 <colspec colwidth="6*" align="center"/>
28385 <colspec colwidth="6*" align="right"/>
28386 <tbody>
28387 <row>
28388 <entry><option>ldap_version</option></entry>
28389 <entry>Use: <emphasis>main</emphasis></entry>
28390 <entry>Type: <emphasis>integer</emphasis></entry>
28391 <entry>Default: <emphasis>unset</emphasis></entry>
28392 </row>
28393 </tbody>
28394 </tgroup>
28395 </informaltable>
28396 <para>
28397 <indexterm role="concept">
28398 <primary>LDAP</primary>
28399 <secondary>protocol version, forcing</secondary>
28400 </indexterm>
28401 This option can be used to force Exim to set a specific protocol version for
28402 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
28403 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
28404 the LDAP headers; otherwise it is 2. This option is available only when Exim
28405 has been built with LDAP support.
28406 </para>
28407 <para>
28408 <indexterm role="option">
28409 <primary><option>local_from_check</option></primary>
28410 </indexterm>
28411 </para>
28412 <informaltable frame="all">
28413 <tgroup cols="4" colsep="0" rowsep="0">
28414 <colspec colwidth="8*" align="left"/>
28415 <colspec colwidth="6*" align="center"/>
28416 <colspec colwidth="6*" align="center"/>
28417 <colspec colwidth="6*" align="right"/>
28418 <tbody>
28419 <row>
28420 <entry><option>local_from_check</option></entry>
28421 <entry>Use: <emphasis>main</emphasis></entry>
28422 <entry>Type: <emphasis>boolean</emphasis></entry>
28423 <entry>Default: <emphasis>true</emphasis></entry>
28424 </row>
28425 </tbody>
28426 </tgroup>
28427 </informaltable>
28428 <para>
28429 <indexterm role="concept">
28430 <primary><emphasis>Sender:</emphasis> header line</primary>
28431 <secondary>disabling addition of</secondary>
28432 </indexterm>
28433 <indexterm role="concept">
28434 <primary><emphasis>From:</emphasis> header line</primary>
28435 <secondary>disabling checking of</secondary>
28436 </indexterm>
28437 When a message is submitted locally (that is, not over a TCP/IP connection) by
28438 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
28439 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
28440 the domain specified by <option>qualify_domain</option>.
28441 </para>
28442 <para>
28443 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
28444 locally submitted message is automatically qualified by Exim, unless the
28445 <option>-bnq</option> command line option is used.
28446 </para>
28447 <para>
28448 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
28449 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
28450 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
28451 and the default qualify domain.
28452 </para>
28453 <para>
28454 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
28455 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
28456 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
28457 <option>local_sender_retain</option> to be true.
28458 </para>
28459 <para>
28460 <indexterm role="concept">
28461 <primary>envelope from</primary>
28462 </indexterm>
28463 <indexterm role="concept">
28464 <primary>envelope sender</primary>
28465 </indexterm>
28466 These options affect only the header lines in the message. The envelope sender
28467 is still forced to be the login id at the qualify domain unless
28468 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
28469 </para>
28470 <para>
28471 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
28472 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
28473 has more details about <emphasis>Sender:</emphasis> processing.
28474 </para>
28475 <para>
28476 <indexterm role="option">
28477 <primary><option>local_from_prefix</option></primary>
28478 </indexterm>
28479 </para>
28480 <informaltable frame="all">
28481 <tgroup cols="4" colsep="0" rowsep="0">
28482 <colspec colwidth="8*" align="left"/>
28483 <colspec colwidth="6*" align="center"/>
28484 <colspec colwidth="6*" align="center"/>
28485 <colspec colwidth="6*" align="right"/>
28486 <tbody>
28487 <row>
28488 <entry><option>local_from_prefix</option></entry>
28489 <entry>Use: <emphasis>main</emphasis></entry>
28490 <entry>Type: <emphasis>string</emphasis></entry>
28491 <entry>Default: <emphasis>unset</emphasis></entry>
28492 </row>
28493 </tbody>
28494 </tgroup>
28495 </informaltable>
28496 <para>
28497 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
28498 matching the login id (see <option>local_from_check</option> above), it can be configured to
28499 ignore certain prefixes and suffixes in the local part of the address. This is
28500 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
28501 appropriate lists, in the same form as the <option>local_part_prefix</option> and
28502 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
28503 example, if
28504 </para>
28505 <literallayout class="monospaced">
28506 local_from_prefix = *-
28507 </literallayout>
28508 <para>
28509 is set, a <emphasis>From:</emphasis> line containing
28510 </para>
28511 <literallayout class="monospaced">
28512 From: anything-user@your.domain.example
28513 </literallayout>
28514 <para>
28515 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
28516 matches the actual sender address that is constructed from the login name and
28517 qualify domain.
28518 </para>
28519 <para>
28520 <indexterm role="option">
28521 <primary><option>local_from_suffix</option></primary>
28522 </indexterm>
28523 </para>
28524 <informaltable frame="all">
28525 <tgroup cols="4" colsep="0" rowsep="0">
28526 <colspec colwidth="8*" align="left"/>
28527 <colspec colwidth="6*" align="center"/>
28528 <colspec colwidth="6*" align="center"/>
28529 <colspec colwidth="6*" align="right"/>
28530 <tbody>
28531 <row>
28532 <entry><option>local_from_suffix</option></entry>
28533 <entry>Use: <emphasis>main</emphasis></entry>
28534 <entry>Type: <emphasis>string</emphasis></entry>
28535 <entry>Default: <emphasis>unset</emphasis></entry>
28536 </row>
28537 </tbody>
28538 </tgroup>
28539 </informaltable>
28540 <para>
28541 See <option>local_from_prefix</option> above.
28542 </para>
28543 <para>
28544 <indexterm role="option">
28545 <primary><option>local_interfaces</option></primary>
28546 </indexterm>
28547 </para>
28548 <informaltable frame="all">
28549 <tgroup cols="4" colsep="0" rowsep="0">
28550 <colspec colwidth="8*" align="left"/>
28551 <colspec colwidth="6*" align="center"/>
28552 <colspec colwidth="6*" align="center"/>
28553 <colspec colwidth="6*" align="right"/>
28554 <tbody>
28555 <row>
28556 <entry><option>local_interfaces</option></entry>
28557 <entry>Use: <emphasis>main</emphasis></entry>
28558 <entry>Type: <emphasis>string list</emphasis></entry>
28559 <entry>Default: <emphasis>see below</emphasis></entry>
28560 </row>
28561 </tbody>
28562 </tgroup>
28563 </informaltable>
28564 <para>
28565 This option controls which network interfaces are used by the daemon for
28566 listening; they are also used to identify the local host when routing. Chapter
28567 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
28568 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
28569 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
28570 <option>local_interfaces</option> is
28571 </para>
28572 <literallayout class="monospaced">
28573 local_interfaces = 0.0.0.0
28574 </literallayout>
28575 <para>
28576 when Exim is built without IPv6 support; otherwise it is
28577 </para>
28578 <literallayout class="monospaced">
28579 local_interfaces = &lt;; ::0 ; 0.0.0.0
28580 </literallayout>
28581 <para>
28582 <indexterm role="option">
28583 <primary><option>local_scan_timeout</option></primary>
28584 </indexterm>
28585 </para>
28586 <informaltable frame="all">
28587 <tgroup cols="4" colsep="0" rowsep="0">
28588 <colspec colwidth="8*" align="left"/>
28589 <colspec colwidth="6*" align="center"/>
28590 <colspec colwidth="6*" align="center"/>
28591 <colspec colwidth="6*" align="right"/>
28592 <tbody>
28593 <row>
28594 <entry><option>local_scan_timeout</option></entry>
28595 <entry>Use: <emphasis>main</emphasis></entry>
28596 <entry>Type: <emphasis>time</emphasis></entry>
28597 <entry>Default: <emphasis>5m</emphasis></entry>
28598 </row>
28599 </tbody>
28600 </tgroup>
28601 </informaltable>
28602 <para>
28603 <indexterm role="concept">
28604 <primary>timeout</primary>
28605 <secondary>for <function>local_scan()</function> function</secondary>
28606 </indexterm>
28607 <indexterm role="concept">
28608 <primary><function>local_scan()</function> function</primary>
28609 <secondary>timeout</secondary>
28610 </indexterm>
28611 This timeout applies to the <function>local_scan()</function> function (see chapter
28612 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
28613 the incoming message is rejected with a temporary error if it is an SMTP
28614 message. For a non-SMTP message, the message is dropped and Exim ends with a
28615 non-zero code. The incident is logged on the main and reject logs.
28616 </para>
28617 <para>
28618 <indexterm role="option">
28619 <primary><option>local_sender_retain</option></primary>
28620 </indexterm>
28621 </para>
28622 <informaltable frame="all">
28623 <tgroup cols="4" colsep="0" rowsep="0">
28624 <colspec colwidth="8*" align="left"/>
28625 <colspec colwidth="6*" align="center"/>
28626 <colspec colwidth="6*" align="center"/>
28627 <colspec colwidth="6*" align="right"/>
28628 <tbody>
28629 <row>
28630 <entry><option>local_sender_retain</option></entry>
28631 <entry>Use: <emphasis>main</emphasis></entry>
28632 <entry>Type: <emphasis>boolean</emphasis></entry>
28633 <entry>Default: <emphasis>false</emphasis></entry>
28634 </row>
28635 </tbody>
28636 </tgroup>
28637 </informaltable>
28638 <para>
28639 <indexterm role="concept">
28640 <primary><emphasis>Sender:</emphasis> header line</primary>
28641 <secondary>retaining from local submission</secondary>
28642 </indexterm>
28643 When a message is submitted locally (that is, not over a TCP/IP connection) by
28644 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
28645 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
28646 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
28647 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
28648 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
28649 </para>
28650 <para>
28651 <indexterm role="option">
28652 <primary><option>localhost_number</option></primary>
28653 </indexterm>
28654 </para>
28655 <informaltable frame="all">
28656 <tgroup cols="4" colsep="0" rowsep="0">
28657 <colspec colwidth="8*" align="left"/>
28658 <colspec colwidth="6*" align="center"/>
28659 <colspec colwidth="6*" align="center"/>
28660 <colspec colwidth="6*" align="right"/>
28661 <tbody>
28662 <row>
28663 <entry><option>localhost_number</option></entry>
28664 <entry>Use: <emphasis>main</emphasis></entry>
28665 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28666 <entry>Default: <emphasis>unset</emphasis></entry>
28667 </row>
28668 </tbody>
28669 </tgroup>
28670 </informaltable>
28671 <para>
28672 <indexterm role="concept">
28673 <primary>host</primary>
28674 <secondary>locally unique number for</secondary>
28675 </indexterm>
28676 <indexterm role="concept">
28677 <primary>message ids</primary>
28678 <secondary>with multiple hosts</secondary>
28679 </indexterm>
28680 <indexterm role="variable">
28681 <primary><varname>$localhost_number</varname></primary>
28682 </indexterm>
28683 Exim&#x2019;s message ids are normally unique only within the local host. If
28684 uniqueness among a set of hosts is required, each host must set a different
28685 value for the <option>localhost_number</option> option. The string is expanded immediately
28686 after reading the configuration file (so that a number can be computed from the
28687 host name, for example) and the result of the expansion must be a number in the
28688 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
28689 systems). This is available in subsequent string expansions via the variable
28690 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
28691 characters of the message id, instead of just being a fractional part of the
28692 time, are computed from the time and the local host number as described in
28693 section <xref linkend="SECTmessiden"/>.
28694 </para>
28695 <para>
28696 <indexterm role="option">
28697 <primary><option>log_file_path</option></primary>
28698 </indexterm>
28699 </para>
28700 <informaltable frame="all">
28701 <tgroup cols="4" colsep="0" rowsep="0">
28702 <colspec colwidth="8*" align="left"/>
28703 <colspec colwidth="6*" align="center"/>
28704 <colspec colwidth="6*" align="center"/>
28705 <colspec colwidth="6*" align="right"/>
28706 <tbody>
28707 <row>
28708 <entry><option>log_file_path</option></entry>
28709 <entry>Use: <emphasis>main</emphasis></entry>
28710 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28711 <entry>Default: <emphasis>set at compile time</emphasis></entry>
28712 </row>
28713 </tbody>
28714 </tgroup>
28715 </informaltable>
28716 <para>
28717 <indexterm role="concept">
28718 <primary>log</primary>
28719 <secondary>file path for</secondary>
28720 </indexterm>
28721 This option sets the path which is used to determine the names of Exim&#x2019;s log
28722 files, or indicates that logging is to be to syslog, or both. It is expanded
28723 when Exim is entered, so it can, for example, contain a reference to the host
28724 name. If no specific path is set for the log files at compile or runtime,
28725 or if the option is unset at runtime (i.e.  <literal>log_file_path = </literal>)
28726 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
28727 A path must start with a slash.
28728 To send to syslog, use the word <quote>syslog</quote>.
28729 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
28730 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
28731 used. If this string is fixed at your installation (contains no expansion
28732 variables) it is recommended that you do not set this option in the
28733 configuration file, but instead supply the path using LOG_FILE_PATH in
28734 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
28735 early on &ndash; in particular, failure to read the configuration file.
28736 </para>
28737 <para>
28738 <indexterm role="option">
28739 <primary><option>log_selector</option></primary>
28740 </indexterm>
28741 </para>
28742 <informaltable frame="all">
28743 <tgroup cols="4" colsep="0" rowsep="0">
28744 <colspec colwidth="8*" align="left"/>
28745 <colspec colwidth="6*" align="center"/>
28746 <colspec colwidth="6*" align="center"/>
28747 <colspec colwidth="6*" align="right"/>
28748 <tbody>
28749 <row>
28750 <entry><option>log_selector</option></entry>
28751 <entry>Use: <emphasis>main</emphasis></entry>
28752 <entry>Type: <emphasis>string</emphasis></entry>
28753 <entry>Default: <emphasis>unset</emphasis></entry>
28754 </row>
28755 </tbody>
28756 </tgroup>
28757 </informaltable>
28758 <para>
28759 <indexterm role="concept">
28760 <primary>log</primary>
28761 <secondary>selectors</secondary>
28762 </indexterm>
28763 This option can be used to reduce or increase the number of things that Exim
28764 writes to its log files. Its argument is made up of names preceded by plus or
28765 minus characters. For example:
28766 </para>
28767 <literallayout class="monospaced">
28768 log_selector = +arguments -retry_defer
28769 </literallayout>
28770 <para>
28771 A list of possible names and what they control is given in the chapter on
28772 logging, in section <xref linkend="SECTlogselector"/>.
28773 </para>
28774 <para>
28775 <indexterm role="option">
28776 <primary><option>log_timezone</option></primary>
28777 </indexterm>
28778 </para>
28779 <informaltable frame="all">
28780 <tgroup cols="4" colsep="0" rowsep="0">
28781 <colspec colwidth="8*" align="left"/>
28782 <colspec colwidth="6*" align="center"/>
28783 <colspec colwidth="6*" align="center"/>
28784 <colspec colwidth="6*" align="right"/>
28785 <tbody>
28786 <row>
28787 <entry><option>log_timezone</option></entry>
28788 <entry>Use: <emphasis>main</emphasis></entry>
28789 <entry>Type: <emphasis>boolean</emphasis></entry>
28790 <entry>Default: <emphasis>false</emphasis></entry>
28791 </row>
28792 </tbody>
28793 </tgroup>
28794 </informaltable>
28795 <para>
28796 <indexterm role="concept">
28797 <primary>log</primary>
28798 <secondary>timezone for entries</secondary>
28799 </indexterm>
28800 <indexterm role="variable">
28801 <primary><varname>$tod_log</varname></primary>
28802 </indexterm>
28803 <indexterm role="variable">
28804 <primary><varname>$tod_zone</varname></primary>
28805 </indexterm>
28806 By default, the timestamps on log lines are in local time without the
28807 timezone. This means that if your timezone changes twice a year, the timestamps
28808 in log lines are ambiguous for an hour when the clocks go back. One way of
28809 avoiding this problem is to set the timezone to UTC. An alternative is to set
28810 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
28811 timestamps in log lines. Turning on this option can add quite a lot to the size
28812 of log files because each line is extended by 6 characters. Note that the
28813 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
28814 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
28815 </para>
28816 <para>
28817 <indexterm role="option">
28818 <primary><option>lookup_open_max</option></primary>
28819 </indexterm>
28820 </para>
28821 <informaltable frame="all">
28822 <tgroup cols="4" colsep="0" rowsep="0">
28823 <colspec colwidth="8*" align="left"/>
28824 <colspec colwidth="6*" align="center"/>
28825 <colspec colwidth="6*" align="center"/>
28826 <colspec colwidth="6*" align="right"/>
28827 <tbody>
28828 <row>
28829 <entry><option>lookup_open_max</option></entry>
28830 <entry>Use: <emphasis>main</emphasis></entry>
28831 <entry>Type: <emphasis>integer</emphasis></entry>
28832 <entry>Default: <emphasis>25</emphasis></entry>
28833 </row>
28834 </tbody>
28835 </tgroup>
28836 </informaltable>
28837 <para>
28838 <indexterm role="concept">
28839 <primary>too many open files</primary>
28840 </indexterm>
28841 <indexterm role="concept">
28842 <primary>open files, too many</primary>
28843 </indexterm>
28844 <indexterm role="concept">
28845 <primary>file</primary>
28846 <secondary>too many open</secondary>
28847 </indexterm>
28848 <indexterm role="concept">
28849 <primary>lookup</primary>
28850 <secondary>maximum open files</secondary>
28851 </indexterm>
28852 <indexterm role="concept">
28853 <primary>limit</primary>
28854 <secondary>open files for lookups</secondary>
28855 </indexterm>
28856 This option limits the number of simultaneously open files for single-key
28857 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
28858 Exim normally keeps these files open during routing, because often the same
28859 file is required several times. If the limit is reached, Exim closes the least
28860 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
28861 actually opens two files for each logical DBM database, though it still counts
28862 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
28863 open files</quote> errors with NDBM, you need to reduce the value of
28864 <option>lookup_open_max</option>.
28865 </para>
28866 <para>
28867 <indexterm role="option">
28868 <primary><option>max_username_length</option></primary>
28869 </indexterm>
28870 </para>
28871 <informaltable frame="all">
28872 <tgroup cols="4" colsep="0" rowsep="0">
28873 <colspec colwidth="8*" align="left"/>
28874 <colspec colwidth="6*" align="center"/>
28875 <colspec colwidth="6*" align="center"/>
28876 <colspec colwidth="6*" align="right"/>
28877 <tbody>
28878 <row>
28879 <entry><option>max_username_length</option></entry>
28880 <entry>Use: <emphasis>main</emphasis></entry>
28881 <entry>Type: <emphasis>integer</emphasis></entry>
28882 <entry>Default: <emphasis>0</emphasis></entry>
28883 </row>
28884 </tbody>
28885 </tgroup>
28886 </informaltable>
28887 <para>
28888 <indexterm role="concept">
28889 <primary>length of login name</primary>
28890 </indexterm>
28891 <indexterm role="concept">
28892 <primary>user name</primary>
28893 <secondary>maximum length</secondary>
28894 </indexterm>
28895 <indexterm role="concept">
28896 <primary>limit</primary>
28897 <secondary>user name length</secondary>
28898 </indexterm>
28899 Some operating systems are broken in that they truncate long arguments to
28900 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
28901 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
28902 an argument that is longer behaves as if <function>getpwnam()</function> failed.
28903 </para>
28904 <para>
28905 <indexterm role="option">
28906 <primary><option>message_body_newlines</option></primary>
28907 </indexterm>
28908 </para>
28909 <informaltable frame="all">
28910 <tgroup cols="4" colsep="0" rowsep="0">
28911 <colspec colwidth="8*" align="left"/>
28912 <colspec colwidth="6*" align="center"/>
28913 <colspec colwidth="6*" align="center"/>
28914 <colspec colwidth="6*" align="right"/>
28915 <tbody>
28916 <row>
28917 <entry><option>message_body_newlines</option></entry>
28918 <entry>Use: <emphasis>main</emphasis></entry>
28919 <entry>Type: <emphasis>bool</emphasis></entry>
28920 <entry>Default: <emphasis>false</emphasis></entry>
28921 </row>
28922 </tbody>
28923 </tgroup>
28924 </informaltable>
28925 <para>
28926 <indexterm role="concept">
28927 <primary>message body</primary>
28928 <secondary>newlines in variables</secondary>
28929 </indexterm>
28930 <indexterm role="concept">
28931 <primary>newline</primary>
28932 <secondary>in message body variables</secondary>
28933 </indexterm>
28934 <indexterm role="variable">
28935 <primary><varname>$message_body</varname></primary>
28936 </indexterm>
28937 <indexterm role="variable">
28938 <primary><varname>$message_body_end</varname></primary>
28939 </indexterm>
28940 By default, newlines in the message body are replaced by spaces when setting
28941 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
28942 option is set true, this no longer happens.
28943 </para>
28944 <para>
28945 <indexterm role="option">
28946 <primary><option>message_body_visible</option></primary>
28947 </indexterm>
28948 </para>
28949 <informaltable frame="all">
28950 <tgroup cols="4" colsep="0" rowsep="0">
28951 <colspec colwidth="8*" align="left"/>
28952 <colspec colwidth="6*" align="center"/>
28953 <colspec colwidth="6*" align="center"/>
28954 <colspec colwidth="6*" align="right"/>
28955 <tbody>
28956 <row>
28957 <entry><option>message_body_visible</option></entry>
28958 <entry>Use: <emphasis>main</emphasis></entry>
28959 <entry>Type: <emphasis>integer</emphasis></entry>
28960 <entry>Default: <emphasis>500</emphasis></entry>
28961 </row>
28962 </tbody>
28963 </tgroup>
28964 </informaltable>
28965 <para>
28966 <indexterm role="concept">
28967 <primary>body of message</primary>
28968 <secondary>visible size</secondary>
28969 </indexterm>
28970 <indexterm role="concept">
28971 <primary>message body</primary>
28972 <secondary>visible size</secondary>
28973 </indexterm>
28974 <indexterm role="variable">
28975 <primary><varname>$message_body</varname></primary>
28976 </indexterm>
28977 <indexterm role="variable">
28978 <primary><varname>$message_body_end</varname></primary>
28979 </indexterm>
28980 This option specifies how much of a message&#x2019;s body is to be included in the
28981 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
28982 </para>
28983 <para>
28984 <indexterm role="option">
28985 <primary><option>message_id_header_domain</option></primary>
28986 </indexterm>
28987 </para>
28988 <informaltable frame="all">
28989 <tgroup cols="4" colsep="0" rowsep="0">
28990 <colspec colwidth="8*" align="left"/>
28991 <colspec colwidth="6*" align="center"/>
28992 <colspec colwidth="6*" align="center"/>
28993 <colspec colwidth="6*" align="right"/>
28994 <tbody>
28995 <row>
28996 <entry><option>message_id_header_domain</option></entry>
28997 <entry>Use: <emphasis>main</emphasis></entry>
28998 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28999 <entry>Default: <emphasis>unset</emphasis></entry>
29000 </row>
29001 </tbody>
29002 </tgroup>
29003 </informaltable>
29004 <para>
29005 <indexterm role="concept">
29006 <primary><emphasis>Message-ID:</emphasis> header line</primary>
29007 </indexterm>
29008 If this option is set, the string is expanded and used as the right hand side
29009 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
29010 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
29011 means <quote>not received over TCP/IP.</quote>
29012 Otherwise, the primary host name is used.
29013 Only letters, digits, dot and hyphen are accepted; any other characters are
29014 replaced by hyphens. If the expansion is forced to fail, or if the result is an
29015 empty string, the option is ignored.
29016 </para>
29017 <para>
29018 <indexterm role="option">
29019 <primary><option>message_id_header_text</option></primary>
29020 </indexterm>
29021 </para>
29022 <informaltable frame="all">
29023 <tgroup cols="4" colsep="0" rowsep="0">
29024 <colspec colwidth="8*" align="left"/>
29025 <colspec colwidth="6*" align="center"/>
29026 <colspec colwidth="6*" align="center"/>
29027 <colspec colwidth="6*" align="right"/>
29028 <tbody>
29029 <row>
29030 <entry><option>message_id_header_text</option></entry>
29031 <entry>Use: <emphasis>main</emphasis></entry>
29032 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29033 <entry>Default: <emphasis>unset</emphasis></entry>
29034 </row>
29035 </tbody>
29036 </tgroup>
29037 </informaltable>
29038 <para>
29039 If this variable is set, the string is expanded and used to augment the text of
29040 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
29041 message does not have one. The text of this header is required by RFC 2822 to
29042 take the form of an address. By default, Exim uses its internal message id as
29043 the local part, and the primary host name as the domain. If this option is set,
29044 it is expanded, and provided the expansion is not forced to fail, and does not
29045 yield an empty string, the result is inserted into the header immediately
29046 before the @, separated from the internal message id by a dot. Any characters
29047 that are illegal in an address are automatically converted into hyphens. This
29048 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
29049 colons will become hyphens.
29050 </para>
29051 <para>
29052 <indexterm role="option">
29053 <primary><option>message_logs</option></primary>
29054 </indexterm>
29055 </para>
29056 <informaltable frame="all">
29057 <tgroup cols="4" colsep="0" rowsep="0">
29058 <colspec colwidth="8*" align="left"/>
29059 <colspec colwidth="6*" align="center"/>
29060 <colspec colwidth="6*" align="center"/>
29061 <colspec colwidth="6*" align="right"/>
29062 <tbody>
29063 <row>
29064 <entry><option>message_logs</option></entry>
29065 <entry>Use: <emphasis>main</emphasis></entry>
29066 <entry>Type: <emphasis>boolean</emphasis></entry>
29067 <entry>Default: <emphasis>true</emphasis></entry>
29068 </row>
29069 </tbody>
29070 </tgroup>
29071 </informaltable>
29072 <para>
29073 <indexterm role="concept">
29074 <primary>message logs</primary>
29075 <secondary>disabling</secondary>
29076 </indexterm>
29077 <indexterm role="concept">
29078 <primary>log</primary>
29079 <secondary>message log; disabling</secondary>
29080 </indexterm>
29081 If this option is turned off, per-message log files are not created in the
29082 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
29083 Exim, by reducing the number of files involved in handling a message from a
29084 minimum of four (header spool file, body spool file, delivery journal, and
29085 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
29086 which is not affected by this option.
29087 </para>
29088 <para>
29089 <indexterm role="option">
29090 <primary><option>message_size_limit</option></primary>
29091 </indexterm>
29092 </para>
29093 <informaltable frame="all">
29094 <tgroup cols="4" colsep="0" rowsep="0">
29095 <colspec colwidth="8*" align="left"/>
29096 <colspec colwidth="6*" align="center"/>
29097 <colspec colwidth="6*" align="center"/>
29098 <colspec colwidth="6*" align="right"/>
29099 <tbody>
29100 <row>
29101 <entry><option>message_size_limit</option></entry>
29102 <entry>Use: <emphasis>main</emphasis></entry>
29103 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29104 <entry>Default: <emphasis>50M</emphasis></entry>
29105 </row>
29106 </tbody>
29107 </tgroup>
29108 </informaltable>
29109 <para>
29110 <indexterm role="concept">
29111 <primary>message</primary>
29112 <secondary>size limit</secondary>
29113 </indexterm>
29114 <indexterm role="concept">
29115 <primary>limit</primary>
29116 <secondary>message size</secondary>
29117 </indexterm>
29118 <indexterm role="concept">
29119 <primary>size</primary>
29120 <secondary>of message, limit</secondary>
29121 </indexterm>
29122 This option limits the maximum size of message that Exim will process. The
29123 value is expanded for each incoming connection so, for example, it can be made
29124 to depend on the IP address of the remote host for messages arriving via
29125 TCP/IP. After expansion, the value must be a sequence of decimal digits,
29126 optionally followed by K or M.
29127 </para>
29128 <para>
29129 <indexterm role="concept">
29130 <primary>SIZE</primary>
29131 <secondary>ESMTP extension, advertising</secondary>
29132 </indexterm>
29133 <indexterm role="concept">
29134 <primary>ESMTP extensions</primary>
29135 <secondary>SIZE</secondary>
29136 </indexterm>
29137 If nonzero the value will be advertised as a parameter to the ESMTP SIZE
29138 service extension keyword.
29139 </para>
29140 <para>
29141 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
29142 other properties of an individual message, because it has to be advertised in
29143 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
29144 error. A value of zero means no limit, but its use is not recommended. See also
29145 <option>bounce_return_size_limit</option>.
29146 </para>
29147 <para>
29148 Incoming SMTP messages are failed with a 552 error if the limit is
29149 exceeded; locally-generated messages either get a stderr message or a delivery
29150 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
29151 an oversized message is logged in both the main and the reject logs. See also
29152 the generic transport option <option>message_size_limit</option>, which limits the size of
29153 message that an individual transport can process.
29154 </para>
29155 <para>
29156 If you use a virus-scanner and set this option to to a value larger than the
29157 maximum size that your virus-scanner is configured to support, you may get
29158 failures triggered by large mails.  The right size to configure for the
29159 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
29160 probably safest to just set it to a little larger than this value.  E.g., with a
29161 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
29162 some problems may result.
29163 </para>
29164 <para>
29165 A value of 0 will disable size limit checking; Exim will still advertise the
29166 SIZE extension in an EHLO response, but without a limit, so as to permit
29167 SMTP clients to still indicate the message size along with the MAIL verb.
29168 </para>
29169 <para>
29170 <indexterm role="option">
29171 <primary><option>move_frozen_messages</option></primary>
29172 </indexterm>
29173 </para>
29174 <informaltable frame="all">
29175 <tgroup cols="4" colsep="0" rowsep="0">
29176 <colspec colwidth="8*" align="left"/>
29177 <colspec colwidth="6*" align="center"/>
29178 <colspec colwidth="6*" align="center"/>
29179 <colspec colwidth="6*" align="right"/>
29180 <tbody>
29181 <row>
29182 <entry><option>move_frozen_messages</option></entry>
29183 <entry>Use: <emphasis>main</emphasis></entry>
29184 <entry>Type: <emphasis>boolean</emphasis></entry>
29185 <entry>Default: <emphasis>false</emphasis></entry>
29186 </row>
29187 </tbody>
29188 </tgroup>
29189 </informaltable>
29190 <para>
29191 <indexterm role="concept">
29192 <primary>frozen messages</primary>
29193 <secondary>moving</secondary>
29194 </indexterm>
29195 This option, which is available only if Exim has been built with the setting
29196 </para>
29197 <literallayout class="monospaced">
29198 SUPPORT_MOVE_FROZEN_MESSAGES=yes
29199 </literallayout>
29200 <para>
29201 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
29202 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
29203 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
29204 standard utilities for handling such moved messages, and they do not show up in
29205 lists generated by <option>-bp</option> or by the Exim monitor.
29206 </para>
29207 <para>
29208 <indexterm role="option">
29209 <primary><option>mua_wrapper</option></primary>
29210 </indexterm>
29211 </para>
29212 <informaltable frame="all">
29213 <tgroup cols="4" colsep="0" rowsep="0">
29214 <colspec colwidth="8*" align="left"/>
29215 <colspec colwidth="6*" align="center"/>
29216 <colspec colwidth="6*" align="center"/>
29217 <colspec colwidth="6*" align="right"/>
29218 <tbody>
29219 <row>
29220 <entry><option>mua_wrapper</option></entry>
29221 <entry>Use: <emphasis>main</emphasis></entry>
29222 <entry>Type: <emphasis>boolean</emphasis></entry>
29223 <entry>Default: <emphasis>false</emphasis></entry>
29224 </row>
29225 </tbody>
29226 </tgroup>
29227 </informaltable>
29228 <para>
29229 Setting this option true causes Exim to run in a very restrictive mode in which
29230 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
29231 contains a full description of this facility.
29232 </para>
29233 <para>
29234 <indexterm role="option">
29235 <primary><option>mysql_servers</option></primary>
29236 </indexterm>
29237 </para>
29238 <informaltable frame="all">
29239 <tgroup cols="4" colsep="0" rowsep="0">
29240 <colspec colwidth="8*" align="left"/>
29241 <colspec colwidth="6*" align="center"/>
29242 <colspec colwidth="6*" align="center"/>
29243 <colspec colwidth="6*" align="right"/>
29244 <tbody>
29245 <row>
29246 <entry><option>mysql_servers</option></entry>
29247 <entry>Use: <emphasis>main</emphasis></entry>
29248 <entry>Type: <emphasis>string list</emphasis></entry>
29249 <entry>Default: <emphasis>unset</emphasis></entry>
29250 </row>
29251 </tbody>
29252 </tgroup>
29253 </informaltable>
29254 <para>
29255 <indexterm role="concept">
29256 <primary>MySQL</primary>
29257 <secondary>server list</secondary>
29258 </indexterm>
29259 This option provides a list of MySQL servers and associated connection data, to
29260 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
29261 option is available only if Exim has been built with MySQL support.
29262 </para>
29263 <para>
29264 <indexterm role="option">
29265 <primary><option>never_users</option></primary>
29266 </indexterm>
29267 </para>
29268 <informaltable frame="all">
29269 <tgroup cols="4" colsep="0" rowsep="0">
29270 <colspec colwidth="8*" align="left"/>
29271 <colspec colwidth="6*" align="center"/>
29272 <colspec colwidth="6*" align="center"/>
29273 <colspec colwidth="6*" align="right"/>
29274 <tbody>
29275 <row>
29276 <entry><option>never_users</option></entry>
29277 <entry>Use: <emphasis>main</emphasis></entry>
29278 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29279 <entry>Default: <emphasis>unset</emphasis></entry>
29280 </row>
29281 </tbody>
29282 </tgroup>
29283 </informaltable>
29284 <para>
29285 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
29286 message deliveries are normally run in processes that are setuid to the
29287 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
29288 It is usually desirable to prevent any deliveries from running as root, as a
29289 safety precaution.
29290 </para>
29291 <para>
29292 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
29293 list of users that must not be used for local deliveries. This list is fixed in
29294 the binary and cannot be overridden by the configuration file. By default, it
29295 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
29296 can be used to add more users to the fixed list.
29297 </para>
29298 <para>
29299 If a message is to be delivered as one of the users on the fixed list or the
29300 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
29301 example is
29302 </para>
29303 <literallayout class="monospaced">
29304 never_users = root:daemon:bin
29305 </literallayout>
29306 <para>
29307 Including root is redundant if it is also on the fixed list, but it does no
29308 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
29309 transport driver.
29310 </para>
29311 <para revisionflag="changed">
29312 <indexterm role="option">
29313 <primary><option>notifier_socket</option></primary>
29314 </indexterm>
29315 </para>
29316 <informaltable frame="all" revisionflag="changed">
29317 <tgroup cols="4" colsep="0" rowsep="0">
29318 <colspec colwidth="8*" align="left"/>
29319 <colspec colwidth="6*" align="center"/>
29320 <colspec colwidth="6*" align="center"/>
29321 <colspec colwidth="6*" align="right"/>
29322 <tbody>
29323 <row>
29324 <entry><option>notifier_socket</option></entry>
29325 <entry>Use: <emphasis>main</emphasis></entry>
29326 <entry>Type: <emphasis>string</emphasis></entry>
29327 <entry>Default: <emphasis>$spool_directory/exim_daemon_notify</emphasis></entry>
29328 </row>
29329 </tbody>
29330 </tgroup>
29331 </informaltable>
29332 <para revisionflag="changed">
29333 This option gives the name for a unix-domain socket on which the daemon
29334 listens for work and information-requests.
29335 Only installations running multiple daemons sharing a spool directory
29336 should need to modify the default.
29337 </para>
29338 <para revisionflag="changed">
29339 The option is expanded before use.
29340 If the platform supports Linux-style abstract socket names, the result
29341 is used with a nul byte prefixed.
29342 Otherwise, it should be a full path name and use a directory accessible
29343 to Exim.
29344 </para>
29345 <para revisionflag="changed">
29346 If the Exim command line uses a <option>-oX</option> option and does not use <option>-oP</option>
29347 then a notifier socket is not created.
29348 </para>
29349 <para>
29350 <indexterm role="option">
29351 <primary><option>openssl_options</option></primary>
29352 </indexterm>
29353 </para>
29354 <informaltable frame="all">
29355 <tgroup cols="4" colsep="0" rowsep="0">
29356 <colspec colwidth="8*" align="left"/>
29357 <colspec colwidth="6*" align="center"/>
29358 <colspec colwidth="6*" align="center"/>
29359 <colspec colwidth="6*" align="right"/>
29360 <tbody>
29361 <row>
29362 <entry><option>openssl_options</option></entry>
29363 <entry>Use: <emphasis>main</emphasis></entry>
29364 <entry>Type: <emphasis>string list</emphasis></entry>
29365 <entry>Default: <emphasis>+no_sslv2 +no_sslv3 +single_dh_use +no_ticket +no_renegotiation</emphasis></entry>
29366 </row>
29367 </tbody>
29368 </tgroup>
29369 </informaltable>
29370 <para>
29371 <indexterm role="concept">
29372 <primary>OpenSSL </primary>
29373 <secondary>compatibility</secondary>
29374 </indexterm>
29375 This option allows an administrator to adjust the SSL options applied
29376 by OpenSSL to connections.  It is given as a space-separated list of items,
29377 each one to be +added or -subtracted from the current value.
29378 </para>
29379 <para>
29380 This option is only available if Exim is built against OpenSSL.  The values
29381 available for this option vary according to the age of your OpenSSL install.
29382 The <quote>all</quote> value controls a subset of flags which are available, typically
29383 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
29384 list the values known on your system and Exim should support all the
29385 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
29386 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
29387 </para>
29388 <para>
29389 Note that adjusting the options can have severe impact upon the security of
29390 SSL as used by Exim.  It is possible to disable safety checks and shoot
29391 yourself in the foot in various unpleasant ways.  This option should not be
29392 adjusted lightly.  An unrecognised item will be detected at startup, by
29393 invoking Exim with the <option>-bV</option> flag.
29394 </para>
29395 <para>
29396 The option affects Exim operating both as a server and as a client.
29397 </para>
29398 <para>
29399 Historical note: prior to release 4.80, Exim defaulted this value to
29400 "+dont_insert_empty_fragments", which may still be needed for compatibility
29401 with some clients, but which lowers security by increasing exposure to
29402 some now infamous attacks.
29403 </para>
29404 <para>
29405 Examples:
29406 </para>
29407 <literallayout class="monospaced">
29408 # Make both old MS and old Eudora happy:
29409 openssl_options = -all +microsoft_big_sslv3_buffer \
29410                        +dont_insert_empty_fragments
29411
29412 # Disable older protocol versions:
29413 openssl_options = +no_sslv2 +no_sslv3
29414 </literallayout>
29415 <para>
29416 Possible options may include:
29417 </para>
29418 <itemizedlist>
29419 <listitem>
29420 <para>
29421 <literal>all</literal>
29422 </para>
29423 </listitem>
29424 <listitem>
29425 <para>
29426 <literal>allow_unsafe_legacy_renegotiation</literal>
29427 </para>
29428 </listitem>
29429 <listitem>
29430 <para>
29431 <literal>cipher_server_preference</literal>
29432 </para>
29433 </listitem>
29434 <listitem>
29435 <para>
29436 <literal>dont_insert_empty_fragments</literal>
29437 </para>
29438 </listitem>
29439 <listitem>
29440 <para>
29441 <literal>ephemeral_rsa</literal>
29442 </para>
29443 </listitem>
29444 <listitem>
29445 <para>
29446 <literal>legacy_server_connect</literal>
29447 </para>
29448 </listitem>
29449 <listitem>
29450 <para>
29451 <literal>microsoft_big_sslv3_buffer</literal>
29452 </para>
29453 </listitem>
29454 <listitem>
29455 <para>
29456 <literal>microsoft_sess_id_bug</literal>
29457 </para>
29458 </listitem>
29459 <listitem>
29460 <para>
29461 <literal>msie_sslv2_rsa_padding</literal>
29462 </para>
29463 </listitem>
29464 <listitem>
29465 <para>
29466 <literal>netscape_challenge_bug</literal>
29467 </para>
29468 </listitem>
29469 <listitem>
29470 <para>
29471 <literal>netscape_reuse_cipher_change_bug</literal>
29472 </para>
29473 </listitem>
29474 <listitem>
29475 <para>
29476 <literal>no_compression</literal>
29477 </para>
29478 </listitem>
29479 <listitem>
29480 <para>
29481 <literal>no_session_resumption_on_renegotiation</literal>
29482 </para>
29483 </listitem>
29484 <listitem>
29485 <para>
29486 <literal>no_sslv2</literal>
29487 </para>
29488 </listitem>
29489 <listitem>
29490 <para>
29491 <literal>no_sslv3</literal>
29492 </para>
29493 </listitem>
29494 <listitem>
29495 <para>
29496 <literal>no_ticket</literal>
29497 </para>
29498 </listitem>
29499 <listitem>
29500 <para>
29501 <literal>no_tlsv1</literal>
29502 </para>
29503 </listitem>
29504 <listitem>
29505 <para>
29506 <literal>no_tlsv1_1</literal>
29507 </para>
29508 </listitem>
29509 <listitem>
29510 <para>
29511 <literal>no_tlsv1_2</literal>
29512 </para>
29513 </listitem>
29514 <listitem>
29515 <para>
29516 <literal>safari_ecdhe_ecdsa_bug</literal>
29517 </para>
29518 </listitem>
29519 <listitem>
29520 <para>
29521 <literal>single_dh_use</literal>
29522 </para>
29523 </listitem>
29524 <listitem>
29525 <para>
29526 <literal>single_ecdh_use</literal>
29527 </para>
29528 </listitem>
29529 <listitem>
29530 <para>
29531 <literal>ssleay_080_client_dh_bug</literal>
29532 </para>
29533 </listitem>
29534 <listitem>
29535 <para>
29536 <literal>sslref2_reuse_cert_type_bug</literal>
29537 </para>
29538 </listitem>
29539 <listitem>
29540 <para>
29541 <literal>tls_block_padding_bug</literal>
29542 </para>
29543 </listitem>
29544 <listitem>
29545 <para>
29546 <literal>tls_d5_bug</literal>
29547 </para>
29548 </listitem>
29549 <listitem>
29550 <para>
29551 <literal>tls_rollback_bug</literal>
29552 </para>
29553 </listitem>
29554 </itemizedlist>
29555 <para>
29556 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
29557 all clients connecting using the MacOS SecureTransport TLS facility prior
29558 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
29559 to negotiate TLS then this option value might help, provided that your OpenSSL
29560 release is new enough to contain this work-around.  This may be a situation
29561 where you have to upgrade OpenSSL to get buggy clients working.
29562 </para>
29563 <para>
29564 <indexterm role="option">
29565 <primary><option>oracle_servers</option></primary>
29566 </indexterm>
29567 </para>
29568 <informaltable frame="all">
29569 <tgroup cols="4" colsep="0" rowsep="0">
29570 <colspec colwidth="8*" align="left"/>
29571 <colspec colwidth="6*" align="center"/>
29572 <colspec colwidth="6*" align="center"/>
29573 <colspec colwidth="6*" align="right"/>
29574 <tbody>
29575 <row>
29576 <entry><option>oracle_servers</option></entry>
29577 <entry>Use: <emphasis>main</emphasis></entry>
29578 <entry>Type: <emphasis>string list</emphasis></entry>
29579 <entry>Default: <emphasis>unset</emphasis></entry>
29580 </row>
29581 </tbody>
29582 </tgroup>
29583 </informaltable>
29584 <para>
29585 <indexterm role="concept">
29586 <primary>Oracle</primary>
29587 <secondary>server list</secondary>
29588 </indexterm>
29589 This option provides a list of Oracle servers and associated connection data,
29590 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
29591 The option is available only if Exim has been built with Oracle support.
29592 </para>
29593 <para>
29594 <indexterm role="option">
29595 <primary><option>percent_hack_domains</option></primary>
29596 </indexterm>
29597 </para>
29598 <informaltable frame="all">
29599 <tgroup cols="4" colsep="0" rowsep="0">
29600 <colspec colwidth="8*" align="left"/>
29601 <colspec colwidth="6*" align="center"/>
29602 <colspec colwidth="6*" align="center"/>
29603 <colspec colwidth="6*" align="right"/>
29604 <tbody>
29605 <row>
29606 <entry><option>percent_hack_domains</option></entry>
29607 <entry>Use: <emphasis>main</emphasis></entry>
29608 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29609 <entry>Default: <emphasis>unset</emphasis></entry>
29610 </row>
29611 </tbody>
29612 </tgroup>
29613 </informaltable>
29614 <para>
29615 <indexterm role="concept">
29616 <primary><quote>percent hack</quote></primary>
29617 </indexterm>
29618 <indexterm role="concept">
29619 <primary>source routing</primary>
29620 <secondary>in email address</secondary>
29621 </indexterm>
29622 <indexterm role="concept">
29623 <primary>address</primary>
29624 <secondary>source-routed</secondary>
29625 </indexterm>
29626 The <quote>percent hack</quote> is the convention whereby a local part containing a
29627 percent sign is re-interpreted as a new email address, with the percent
29628 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
29629 also applied to RFC 2822 addresses that begin with an @ character. If this
29630 option is set, Exim implements the percent facility for those domains listed,
29631 but no others. This happens before an incoming SMTP address is tested against
29632 an ACL.
29633 </para>
29634 <para>
29635 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
29636 trying to get round relaying restrictions. For this reason, it is best avoided
29637 if at all possible. Unfortunately, a number of less security-conscious MTAs
29638 implement it unconditionally. If you are running Exim on a gateway host, and
29639 routing mail through to internal MTAs without processing the local parts, it is
29640 a good idea to reject recipient addresses with percent characters in their
29641 local parts. Exim&#x2019;s default configuration does this.
29642 </para>
29643 <para>
29644 <indexterm role="option">
29645 <primary><option>perl_at_start</option></primary>
29646 </indexterm>
29647 </para>
29648 <informaltable frame="all">
29649 <tgroup cols="4" colsep="0" rowsep="0">
29650 <colspec colwidth="8*" align="left"/>
29651 <colspec colwidth="6*" align="center"/>
29652 <colspec colwidth="6*" align="center"/>
29653 <colspec colwidth="6*" align="right"/>
29654 <tbody>
29655 <row>
29656 <entry><option>perl_at_start</option></entry>
29657 <entry>Use: <emphasis>main</emphasis></entry>
29658 <entry>Type: <emphasis>boolean</emphasis></entry>
29659 <entry>Default: <emphasis>false</emphasis></entry>
29660 </row>
29661 </tbody>
29662 </tgroup>
29663 </informaltable>
29664 <para>
29665 <indexterm role="concept">
29666 <primary>Perl</primary>
29667 </indexterm>
29668 This option is available only when Exim is built with an embedded Perl
29669 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
29670 </para>
29671 <para>
29672 <indexterm role="option">
29673 <primary><option>perl_startup</option></primary>
29674 </indexterm>
29675 </para>
29676 <informaltable frame="all">
29677 <tgroup cols="4" colsep="0" rowsep="0">
29678 <colspec colwidth="8*" align="left"/>
29679 <colspec colwidth="6*" align="center"/>
29680 <colspec colwidth="6*" align="center"/>
29681 <colspec colwidth="6*" align="right"/>
29682 <tbody>
29683 <row>
29684 <entry><option>perl_startup</option></entry>
29685 <entry>Use: <emphasis>main</emphasis></entry>
29686 <entry>Type: <emphasis>string</emphasis></entry>
29687 <entry>Default: <emphasis>unset</emphasis></entry>
29688 </row>
29689 </tbody>
29690 </tgroup>
29691 </informaltable>
29692 <para>
29693 <indexterm role="concept">
29694 <primary>Perl</primary>
29695 </indexterm>
29696 This option is available only when Exim is built with an embedded Perl
29697 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
29698 </para>
29699 <para>
29700 <indexterm role="option">
29701 <primary><option>perl_taintmode</option></primary>
29702 </indexterm>
29703 </para>
29704 <informaltable frame="all">
29705 <tgroup cols="4" colsep="0" rowsep="0">
29706 <colspec colwidth="8*" align="left"/>
29707 <colspec colwidth="6*" align="center"/>
29708 <colspec colwidth="6*" align="center"/>
29709 <colspec colwidth="6*" align="right"/>
29710 <tbody>
29711 <row>
29712 <entry><option>perl_taintmode</option></entry>
29713 <entry>Use: <emphasis>main</emphasis></entry>
29714 <entry>Type: <emphasis>boolean</emphasis></entry>
29715 <entry>Default: <emphasis>false</emphasis></entry>
29716 </row>
29717 </tbody>
29718 </tgroup>
29719 </informaltable>
29720 <para>
29721 <indexterm role="concept">
29722 <primary>Perl</primary>
29723 </indexterm>
29724 This option enables the taint mode of the embedded Perl interpreter.
29725 </para>
29726 <para>
29727 <indexterm role="option">
29728 <primary><option>pgsql_servers</option></primary>
29729 </indexterm>
29730 </para>
29731 <informaltable frame="all">
29732 <tgroup cols="4" colsep="0" rowsep="0">
29733 <colspec colwidth="8*" align="left"/>
29734 <colspec colwidth="6*" align="center"/>
29735 <colspec colwidth="6*" align="center"/>
29736 <colspec colwidth="6*" align="right"/>
29737 <tbody>
29738 <row>
29739 <entry><option>pgsql_servers</option></entry>
29740 <entry>Use: <emphasis>main</emphasis></entry>
29741 <entry>Type: <emphasis>string list</emphasis></entry>
29742 <entry>Default: <emphasis>unset</emphasis></entry>
29743 </row>
29744 </tbody>
29745 </tgroup>
29746 </informaltable>
29747 <para>
29748 <indexterm role="concept">
29749 <primary>PostgreSQL lookup type</primary>
29750 <secondary>server list</secondary>
29751 </indexterm>
29752 This option provides a list of PostgreSQL servers and associated connection
29753 data, to be used in conjunction with <command>pgsql</command> lookups (see section
29754 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
29755 PostgreSQL support.
29756 </para>
29757 <para>
29758 <indexterm role="option">
29759 <primary><option>pid_file_path</option></primary>
29760 </indexterm>
29761 </para>
29762 <informaltable frame="all">
29763 <tgroup cols="4" colsep="0" rowsep="0">
29764 <colspec colwidth="8*" align="left"/>
29765 <colspec colwidth="6*" align="center"/>
29766 <colspec colwidth="6*" align="center"/>
29767 <colspec colwidth="6*" align="right"/>
29768 <tbody>
29769 <row>
29770 <entry><option>pid_file_path</option></entry>
29771 <entry>Use: <emphasis>main</emphasis></entry>
29772 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29773 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29774 </row>
29775 </tbody>
29776 </tgroup>
29777 </informaltable>
29778 <para>
29779 <indexterm role="concept">
29780 <primary>daemon</primary>
29781 <secondary>pid file path</secondary>
29782 </indexterm>
29783 <indexterm role="concept">
29784 <primary>pid file, path for</primary>
29785 </indexterm>
29786 This option sets the name of the file to which the Exim daemon writes its
29787 process id. The string is expanded, so it can contain, for example, references
29788 to the host name:
29789 </para>
29790 <literallayout class="monospaced">
29791 pid_file_path = /var/log/$primary_hostname/exim.pid
29792 </literallayout>
29793 <para>
29794 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
29795 spool directory.
29796 The value set by the option can be overridden by the <option>-oP</option> command line
29797 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
29798 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
29799 </para>
29800 <para>
29801 <indexterm role="option">
29802 <primary><option>pipelining_advertise_hosts</option></primary>
29803 </indexterm>
29804 </para>
29805 <informaltable frame="all">
29806 <tgroup cols="4" colsep="0" rowsep="0">
29807 <colspec colwidth="8*" align="left"/>
29808 <colspec colwidth="6*" align="center"/>
29809 <colspec colwidth="6*" align="center"/>
29810 <colspec colwidth="6*" align="right"/>
29811 <tbody>
29812 <row>
29813 <entry><option>pipelining_advertise_hosts</option></entry>
29814 <entry>Use: <emphasis>main</emphasis></entry>
29815 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29816 <entry>Default: <emphasis>*</emphasis></entry>
29817 </row>
29818 </tbody>
29819 </tgroup>
29820 </informaltable>
29821 <para>
29822 <indexterm role="concept">
29823 <primary>PIPELINING</primary>
29824 <secondary>suppressing advertising</secondary>
29825 </indexterm>
29826 <indexterm role="concept">
29827 <primary>ESMTP extensions</primary>
29828 <secondary>PIPELINING</secondary>
29829 </indexterm>
29830 This option can be used to suppress the advertisement of the SMTP
29831 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
29832 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
29833 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
29834 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
29835 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
29836 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
29837 </para>
29838 <para>
29839 <indexterm role="option">
29840 <primary><option>pipelining_connect_advertise_hosts</option></primary>
29841 </indexterm>
29842 </para>
29843 <informaltable frame="all">
29844 <tgroup cols="4" colsep="0" rowsep="0">
29845 <colspec colwidth="8*" align="left"/>
29846 <colspec colwidth="6*" align="center"/>
29847 <colspec colwidth="6*" align="center"/>
29848 <colspec colwidth="6*" align="right"/>
29849 <tbody>
29850 <row>
29851 <entry><option>pipelining_connect_advertise_hosts</option></entry>
29852 <entry>Use: <emphasis>main</emphasis></entry>
29853 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
29854 <entry>Default: <emphasis>*</emphasis></entry>
29855 </row>
29856 </tbody>
29857 </tgroup>
29858 </informaltable>
29859 <para>
29860 <indexterm role="concept">
29861 <primary>pipelining</primary>
29862 <secondary>early connection</secondary>
29863 </indexterm>
29864 <indexterm role="concept">
29865 <primary>pipelining</primary>
29866 <secondary>PIPE_CONNECT</secondary>
29867 </indexterm>
29868 <indexterm role="concept">
29869 <primary>ESMTP extensions</primary>
29870 <secondary>PIPE_CONNECT</secondary>
29871 </indexterm>
29872 If Exim is built with the SUPPORT_PIPE_CONNECT build option
29873 this option controls which hosts the facility is advertised to
29874 and from which pipeline early-connection (before MAIL) SMTP
29875 commands are acceptable.
29876 When used, the pipelining saves on roundtrip times.
29877 </para>
29878 <para>
29879 See also the <option>hosts_pipe_connect</option> smtp transport option.
29880 </para>
29881 <para revisionflag="changed">
29882 The SMTP service extension keyword advertised is <quote>PIPE_CONNECT</quote>.
29883 </para>
29884 <para>
29885 <indexterm role="option">
29886 <primary><option>prdr_enable</option></primary>
29887 </indexterm>
29888 </para>
29889 <informaltable frame="all">
29890 <tgroup cols="4" colsep="0" rowsep="0">
29891 <colspec colwidth="8*" align="left"/>
29892 <colspec colwidth="6*" align="center"/>
29893 <colspec colwidth="6*" align="center"/>
29894 <colspec colwidth="6*" align="right"/>
29895 <tbody>
29896 <row>
29897 <entry><option>prdr_enable</option></entry>
29898 <entry>Use: <emphasis>main</emphasis></entry>
29899 <entry>Type: <emphasis>boolean</emphasis></entry>
29900 <entry>Default: <emphasis>false</emphasis></entry>
29901 </row>
29902 </tbody>
29903 </tgroup>
29904 </informaltable>
29905 <para>
29906 <indexterm role="concept">
29907 <primary>PRDR</primary>
29908 <secondary>enabling on server</secondary>
29909 </indexterm>
29910 <indexterm role="concept">
29911 <primary>ESMTP extensions</primary>
29912 <secondary>PRDR</secondary>
29913 </indexterm>
29914 This option can be used to enable the Per-Recipient Data Response extension
29915 to SMTP, defined by Eric Hall.
29916 If the option is set, PRDR is advertised by Exim when operating as a server.
29917 If the client requests PRDR, and more than one recipient, for a message
29918 an additional ACL is called for each recipient after the message content
29919 is received.  See section <xref linkend="SECTPRDRACL"/>.
29920 </para>
29921 <para>
29922 <indexterm role="option">
29923 <primary><option>preserve_message_logs</option></primary>
29924 </indexterm>
29925 </para>
29926 <informaltable frame="all">
29927 <tgroup cols="4" colsep="0" rowsep="0">
29928 <colspec colwidth="8*" align="left"/>
29929 <colspec colwidth="6*" align="center"/>
29930 <colspec colwidth="6*" align="center"/>
29931 <colspec colwidth="6*" align="right"/>
29932 <tbody>
29933 <row>
29934 <entry><option>preserve_message_logs</option></entry>
29935 <entry>Use: <emphasis>main</emphasis></entry>
29936 <entry>Type: <emphasis>boolean</emphasis></entry>
29937 <entry>Default: <emphasis>false</emphasis></entry>
29938 </row>
29939 </tbody>
29940 </tgroup>
29941 </informaltable>
29942 <para>
29943 <indexterm role="concept">
29944 <primary>message logs</primary>
29945 <secondary>preserving</secondary>
29946 </indexterm>
29947 If this option is set, message log files are not deleted when messages are
29948 completed. Instead, they are moved to a sub-directory of the spool directory
29949 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
29950 purposes. This is a dangerous option to set on systems with any appreciable
29951 volume of mail. Use with care!
29952 </para>
29953 <para>
29954 <indexterm role="option">
29955 <primary><option>primary_hostname</option></primary>
29956 </indexterm>
29957 </para>
29958 <informaltable frame="all">
29959 <tgroup cols="4" colsep="0" rowsep="0">
29960 <colspec colwidth="8*" align="left"/>
29961 <colspec colwidth="6*" align="center"/>
29962 <colspec colwidth="6*" align="center"/>
29963 <colspec colwidth="6*" align="right"/>
29964 <tbody>
29965 <row>
29966 <entry><option>primary_hostname</option></entry>
29967 <entry>Use: <emphasis>main</emphasis></entry>
29968 <entry>Type: <emphasis>string</emphasis></entry>
29969 <entry>Default: <emphasis>see below</emphasis></entry>
29970 </row>
29971 </tbody>
29972 </tgroup>
29973 </informaltable>
29974 <para>
29975 <indexterm role="concept">
29976 <primary>name</primary>
29977 <secondary>of local host</secondary>
29978 </indexterm>
29979 <indexterm role="concept">
29980 <primary>host</primary>
29981 <secondary>name of local</secondary>
29982 </indexterm>
29983 <indexterm role="concept">
29984 <primary>local host</primary>
29985 <secondary>name of</secondary>
29986 </indexterm>
29987 <indexterm role="variable">
29988 <primary><varname>$primary_hostname</varname></primary>
29989 </indexterm>
29990 This specifies the name of the current host. It is used in the default EHLO or
29991 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
29992 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
29993 The value is also used by default in some SMTP response messages from an Exim
29994 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
29995 </para>
29996 <para>
29997 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
29998 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
29999 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
30000 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
30001 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
30002 explicitly by this option, or defaulted.
30003 </para>
30004 <para>
30005 <indexterm role="option">
30006 <primary><option>print_topbitchars</option></primary>
30007 </indexterm>
30008 </para>
30009 <informaltable frame="all">
30010 <tgroup cols="4" colsep="0" rowsep="0">
30011 <colspec colwidth="8*" align="left"/>
30012 <colspec colwidth="6*" align="center"/>
30013 <colspec colwidth="6*" align="center"/>
30014 <colspec colwidth="6*" align="right"/>
30015 <tbody>
30016 <row>
30017 <entry><option>print_topbitchars</option></entry>
30018 <entry>Use: <emphasis>main</emphasis></entry>
30019 <entry>Type: <emphasis>boolean</emphasis></entry>
30020 <entry>Default: <emphasis>false</emphasis></entry>
30021 </row>
30022 </tbody>
30023 </tgroup>
30024 </informaltable>
30025 <para>
30026 <indexterm role="concept">
30027 <primary>printing characters</primary>
30028 </indexterm>
30029 <indexterm role="concept">
30030 <primary>8-bit characters</primary>
30031 </indexterm>
30032 By default, Exim considers only those characters whose codes lie in the range
30033 32&ndash;126 to be printing characters. In a number of circumstances (for example,
30034 when writing log entries) non-printing characters are converted into escape
30035 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
30036 is set, code values of 128 and above are also considered to be printing
30037 characters.
30038 </para>
30039 <para>
30040 This option also affects the header syntax checks performed by the
30041 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
30042 the user&#x2019;s full name when constructing From: and Sender: addresses (as
30043 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
30044 Exim to generate eight bit message headers that do not conform to the
30045 standards.
30046 </para>
30047 <para>
30048 <indexterm role="option">
30049 <primary><option>process_log_path</option></primary>
30050 </indexterm>
30051 </para>
30052 <informaltable frame="all">
30053 <tgroup cols="4" colsep="0" rowsep="0">
30054 <colspec colwidth="8*" align="left"/>
30055 <colspec colwidth="6*" align="center"/>
30056 <colspec colwidth="6*" align="center"/>
30057 <colspec colwidth="6*" align="right"/>
30058 <tbody>
30059 <row>
30060 <entry><option>process_log_path</option></entry>
30061 <entry>Use: <emphasis>main</emphasis></entry>
30062 <entry>Type: <emphasis>string</emphasis></entry>
30063 <entry>Default: <emphasis>unset</emphasis></entry>
30064 </row>
30065 </tbody>
30066 </tgroup>
30067 </informaltable>
30068 <para>
30069 <indexterm role="concept">
30070 <primary>process log path</primary>
30071 </indexterm>
30072 <indexterm role="concept">
30073 <primary>log</primary>
30074 <secondary>process log</secondary>
30075 </indexterm>
30076 <indexterm role="concept">
30077 <primary><emphasis>exiwhat</emphasis></primary>
30078 </indexterm>
30079 This option sets the name of the file to which an Exim process writes its
30080 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
30081 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
30082 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
30083 can be useful in environments where two different Exims are running, using
30084 different spool directories.
30085 </para>
30086 <para>
30087 <indexterm role="option">
30088 <primary><option>prod_requires_admin</option></primary>
30089 </indexterm>
30090 </para>
30091 <informaltable frame="all">
30092 <tgroup cols="4" colsep="0" rowsep="0">
30093 <colspec colwidth="8*" align="left"/>
30094 <colspec colwidth="6*" align="center"/>
30095 <colspec colwidth="6*" align="center"/>
30096 <colspec colwidth="6*" align="right"/>
30097 <tbody>
30098 <row>
30099 <entry><option>prod_requires_admin</option></entry>
30100 <entry>Use: <emphasis>main</emphasis></entry>
30101 <entry>Type: <emphasis>boolean</emphasis></entry>
30102 <entry>Default: <emphasis>true</emphasis></entry>
30103 </row>
30104 </tbody>
30105 </tgroup>
30106 </informaltable>
30107 <para>
30108 <indexterm role="concept">
30109 <primary>restricting access to features</primary>
30110 </indexterm>
30111 <indexterm role="option">
30112 <primary><option>-M</option></primary>
30113 </indexterm>
30114 <indexterm role="option">
30115 <primary><option>-R</option></primary>
30116 </indexterm>
30117 <indexterm role="option">
30118 <primary><option>-q</option></primary>
30119 </indexterm>
30120 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
30121 admin user unless <option>prod_requires_admin</option> is set false. See also
30122 <option>queue_list_requires_admin</option> and <option>commandline_checks_require_admin</option>.
30123 </para>
30124 <para>
30125 <indexterm role="option">
30126 <primary><option>qualify_domain</option></primary>
30127 </indexterm>
30128 </para>
30129 <informaltable frame="all">
30130 <tgroup cols="4" colsep="0" rowsep="0">
30131 <colspec colwidth="8*" align="left"/>
30132 <colspec colwidth="6*" align="center"/>
30133 <colspec colwidth="6*" align="center"/>
30134 <colspec colwidth="6*" align="right"/>
30135 <tbody>
30136 <row>
30137 <entry><option>qualify_domain</option></entry>
30138 <entry>Use: <emphasis>main</emphasis></entry>
30139 <entry>Type: <emphasis>string</emphasis></entry>
30140 <entry>Default: <emphasis>see below</emphasis></entry>
30141 </row>
30142 </tbody>
30143 </tgroup>
30144 </informaltable>
30145 <para>
30146 <indexterm role="concept">
30147 <primary>domain</primary>
30148 <secondary>for qualifying addresses</secondary>
30149 </indexterm>
30150 <indexterm role="concept">
30151 <primary>address</primary>
30152 <secondary>qualification</secondary>
30153 </indexterm>
30154 This option specifies the domain name that is added to any envelope sender
30155 addresses that do not have a domain qualification. It also applies to
30156 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
30157 are accepted by default only for locally-generated messages. Qualification is
30158 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
30159 locally-generated messages, unless the <option>-bnq</option> command line option is used.
30160 </para>
30161 <para>
30162 Messages from external sources must always contain fully qualified addresses,
30163 unless the sending host matches <option>sender_unqualified_hosts</option> or
30164 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
30165 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
30166 necessary. Internally, Exim always works with fully qualified envelope
30167 addresses. If <option>qualify_domain</option> is not set, it defaults to the
30168 <option>primary_hostname</option> value.
30169 </para>
30170 <para>
30171 <indexterm role="option">
30172 <primary><option>qualify_recipient</option></primary>
30173 </indexterm>
30174 </para>
30175 <informaltable frame="all">
30176 <tgroup cols="4" colsep="0" rowsep="0">
30177 <colspec colwidth="8*" align="left"/>
30178 <colspec colwidth="6*" align="center"/>
30179 <colspec colwidth="6*" align="center"/>
30180 <colspec colwidth="6*" align="right"/>
30181 <tbody>
30182 <row>
30183 <entry><option>qualify_recipient</option></entry>
30184 <entry>Use: <emphasis>main</emphasis></entry>
30185 <entry>Type: <emphasis>string</emphasis></entry>
30186 <entry>Default: <emphasis>see below</emphasis></entry>
30187 </row>
30188 </tbody>
30189 </tgroup>
30190 </informaltable>
30191 <para>
30192 This option allows you to specify a different domain for qualifying recipient
30193 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
30194 </para>
30195 <para>
30196 <indexterm role="option">
30197 <primary><option>queue_domains</option></primary>
30198 </indexterm>
30199 </para>
30200 <informaltable frame="all">
30201 <tgroup cols="4" colsep="0" rowsep="0">
30202 <colspec colwidth="8*" align="left"/>
30203 <colspec colwidth="6*" align="center"/>
30204 <colspec colwidth="6*" align="center"/>
30205 <colspec colwidth="6*" align="right"/>
30206 <tbody>
30207 <row>
30208 <entry><option>queue_domains</option></entry>
30209 <entry>Use: <emphasis>main</emphasis></entry>
30210 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30211 <entry>Default: <emphasis>unset</emphasis></entry>
30212 </row>
30213 </tbody>
30214 </tgroup>
30215 </informaltable>
30216 <para>
30217 <indexterm role="concept">
30218 <primary>domain</primary>
30219 <secondary>specifying non-immediate delivery</secondary>
30220 </indexterm>
30221 <indexterm role="concept">
30222 <primary>queueing incoming messages</primary>
30223 </indexterm>
30224 <indexterm role="concept">
30225 <primary>message</primary>
30226 <secondary>queueing certain domains</secondary>
30227 </indexterm>
30228 This option lists domains for which immediate delivery is not required.
30229 A delivery process is started whenever a message is received, but only those
30230 domains that do not match are processed. All other deliveries wait until the
30231 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
30232 </para>
30233 <para>
30234 <indexterm role="option">
30235 <primary><option>queue_list_requires_admin</option></primary>
30236 </indexterm>
30237 </para>
30238 <informaltable frame="all">
30239 <tgroup cols="4" colsep="0" rowsep="0">
30240 <colspec colwidth="8*" align="left"/>
30241 <colspec colwidth="6*" align="center"/>
30242 <colspec colwidth="6*" align="center"/>
30243 <colspec colwidth="6*" align="right"/>
30244 <tbody>
30245 <row>
30246 <entry><option>queue_list_requires_admin</option></entry>
30247 <entry>Use: <emphasis>main</emphasis></entry>
30248 <entry>Type: <emphasis>boolean</emphasis></entry>
30249 <entry>Default: <emphasis>true</emphasis></entry>
30250 </row>
30251 </tbody>
30252 </tgroup>
30253 </informaltable>
30254 <para>
30255 <indexterm role="concept">
30256 <primary>restricting access to features</primary>
30257 </indexterm>
30258 <indexterm role="option">
30259 <primary><option>-bp</option></primary>
30260 </indexterm>
30261 The <option>-bp</option> command-line option, which lists the messages that are on the
30262 queue, requires the caller to be an admin user unless
30263 <option>queue_list_requires_admin</option> is set false.
30264 See also <option>prod_requires_admin</option> and <option>commandline_checks_require_admin</option>.
30265 </para>
30266 <para>
30267 <indexterm role="option">
30268 <primary><option>queue_only</option></primary>
30269 </indexterm>
30270 </para>
30271 <informaltable frame="all">
30272 <tgroup cols="4" colsep="0" rowsep="0">
30273 <colspec colwidth="8*" align="left"/>
30274 <colspec colwidth="6*" align="center"/>
30275 <colspec colwidth="6*" align="center"/>
30276 <colspec colwidth="6*" align="right"/>
30277 <tbody>
30278 <row>
30279 <entry><option>queue_only</option></entry>
30280 <entry>Use: <emphasis>main</emphasis></entry>
30281 <entry>Type: <emphasis>boolean</emphasis></entry>
30282 <entry>Default: <emphasis>false</emphasis></entry>
30283 </row>
30284 </tbody>
30285 </tgroup>
30286 </informaltable>
30287 <para>
30288 <indexterm role="concept">
30289 <primary>queueing incoming messages</primary>
30290 </indexterm>
30291 <indexterm role="concept">
30292 <primary>message</primary>
30293 <secondary>queueing unconditionally</secondary>
30294 </indexterm>
30295 If <option>queue_only</option> is set, a delivery process is not automatically started
30296 whenever a message is received. Instead, the message waits in the queue for the
30297 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
30298 delivered immediately when certain conditions (such as heavy load) occur.
30299 </para>
30300 <para>
30301 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
30302 and <option>-odi</option> command line options override <option>queue_only</option> unless
30303 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
30304 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
30305 </para>
30306 <para>
30307 <indexterm role="option">
30308 <primary><option>queue_only_file</option></primary>
30309 </indexterm>
30310 </para>
30311 <informaltable frame="all">
30312 <tgroup cols="4" colsep="0" rowsep="0">
30313 <colspec colwidth="8*" align="left"/>
30314 <colspec colwidth="6*" align="center"/>
30315 <colspec colwidth="6*" align="center"/>
30316 <colspec colwidth="6*" align="right"/>
30317 <tbody>
30318 <row>
30319 <entry><option>queue_only_file</option></entry>
30320 <entry>Use: <emphasis>main</emphasis></entry>
30321 <entry>Type: <emphasis>string</emphasis></entry>
30322 <entry>Default: <emphasis>unset</emphasis></entry>
30323 </row>
30324 </tbody>
30325 </tgroup>
30326 </informaltable>
30327 <para>
30328 <indexterm role="concept">
30329 <primary>queueing incoming messages</primary>
30330 </indexterm>
30331 <indexterm role="concept">
30332 <primary>message</primary>
30333 <secondary>queueing by file existence</secondary>
30334 </indexterm>
30335 This option can be set to a colon-separated list of absolute path names, each
30336 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
30337 it tests for the existence of each listed path using a call to <function>stat()</function>. For
30338 each path that exists, the corresponding queueing option is set.
30339 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
30340 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
30341 </para>
30342 <literallayout class="monospaced">
30343 queue_only_file = smtp/some/file
30344 </literallayout>
30345 <para>
30346 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
30347 <filename>/some/file</filename> exists.
30348 </para>
30349 <para>
30350 <indexterm role="option">
30351 <primary><option>queue_only_load</option></primary>
30352 </indexterm>
30353 </para>
30354 <informaltable frame="all">
30355 <tgroup cols="4" colsep="0" rowsep="0">
30356 <colspec colwidth="8*" align="left"/>
30357 <colspec colwidth="6*" align="center"/>
30358 <colspec colwidth="6*" align="center"/>
30359 <colspec colwidth="6*" align="right"/>
30360 <tbody>
30361 <row>
30362 <entry><option>queue_only_load</option></entry>
30363 <entry>Use: <emphasis>main</emphasis></entry>
30364 <entry>Type: <emphasis>fixed-point</emphasis></entry>
30365 <entry>Default: <emphasis>unset</emphasis></entry>
30366 </row>
30367 </tbody>
30368 </tgroup>
30369 </informaltable>
30370 <para>
30371 <indexterm role="concept">
30372 <primary>load average</primary>
30373 </indexterm>
30374 <indexterm role="concept">
30375 <primary>queueing incoming messages</primary>
30376 </indexterm>
30377 <indexterm role="concept">
30378 <primary>message</primary>
30379 <secondary>queueing by load</secondary>
30380 </indexterm>
30381 If the system load average is higher than this value, incoming messages from
30382 all sources are queued, and no automatic deliveries are started. If this
30383 happens during local or remote SMTP input, all subsequent messages received on
30384 the same SMTP connection are queued by default, whatever happens to the load in
30385 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
30386 false.
30387 </para>
30388 <para>
30389 Deliveries will subsequently be performed by queue runner processes. This
30390 option has no effect on ancient operating systems on which Exim cannot
30391 determine the load average. See also <option>deliver_queue_load_max</option> and
30392 <option>smtp_load_reserve</option>.
30393 </para>
30394 <para>
30395 <indexterm role="option">
30396 <primary><option>queue_only_load_latch</option></primary>
30397 </indexterm>
30398 </para>
30399 <informaltable frame="all">
30400 <tgroup cols="4" colsep="0" rowsep="0">
30401 <colspec colwidth="8*" align="left"/>
30402 <colspec colwidth="6*" align="center"/>
30403 <colspec colwidth="6*" align="center"/>
30404 <colspec colwidth="6*" align="right"/>
30405 <tbody>
30406 <row>
30407 <entry><option>queue_only_load_latch</option></entry>
30408 <entry>Use: <emphasis>main</emphasis></entry>
30409 <entry>Type: <emphasis>boolean</emphasis></entry>
30410 <entry>Default: <emphasis>true</emphasis></entry>
30411 </row>
30412 </tbody>
30413 </tgroup>
30414 </informaltable>
30415 <para>
30416 <indexterm role="concept">
30417 <primary>load average</primary>
30418 <secondary>re-evaluating per message</secondary>
30419 </indexterm>
30420 When this option is true (the default), once one message has been queued
30421 because the load average is higher than the value set by <option>queue_only_load</option>,
30422 all subsequent messages received on the same SMTP connection are also queued.
30423 This is a deliberate choice; even though the load average may fall below the
30424 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
30425 connection when not delivering earlier ones. However, there are special
30426 circumstances such as very long-lived connections from scanning appliances
30427 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
30428 should be set false. This causes the value of the load average to be
30429 re-evaluated for each message.
30430 </para>
30431 <para>
30432 <indexterm role="option">
30433 <primary><option>queue_only_override</option></primary>
30434 </indexterm>
30435 </para>
30436 <informaltable frame="all">
30437 <tgroup cols="4" colsep="0" rowsep="0">
30438 <colspec colwidth="8*" align="left"/>
30439 <colspec colwidth="6*" align="center"/>
30440 <colspec colwidth="6*" align="center"/>
30441 <colspec colwidth="6*" align="right"/>
30442 <tbody>
30443 <row>
30444 <entry><option>queue_only_override</option></entry>
30445 <entry>Use: <emphasis>main</emphasis></entry>
30446 <entry>Type: <emphasis>boolean</emphasis></entry>
30447 <entry>Default: <emphasis>true</emphasis></entry>
30448 </row>
30449 </tbody>
30450 </tgroup>
30451 </informaltable>
30452 <para>
30453 <indexterm role="concept">
30454 <primary>queueing incoming messages</primary>
30455 </indexterm>
30456 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
30457 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
30458 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
30459 to override; they are accepted, but ignored.
30460 </para>
30461 <para>
30462 <indexterm role="option">
30463 <primary><option>queue_run_in_order</option></primary>
30464 </indexterm>
30465 </para>
30466 <informaltable frame="all">
30467 <tgroup cols="4" colsep="0" rowsep="0">
30468 <colspec colwidth="8*" align="left"/>
30469 <colspec colwidth="6*" align="center"/>
30470 <colspec colwidth="6*" align="center"/>
30471 <colspec colwidth="6*" align="right"/>
30472 <tbody>
30473 <row>
30474 <entry><option>queue_run_in_order</option></entry>
30475 <entry>Use: <emphasis>main</emphasis></entry>
30476 <entry>Type: <emphasis>boolean</emphasis></entry>
30477 <entry>Default: <emphasis>false</emphasis></entry>
30478 </row>
30479 </tbody>
30480 </tgroup>
30481 </informaltable>
30482 <para>
30483 <indexterm role="concept">
30484 <primary>queue runner</primary>
30485 <secondary>processing messages in order</secondary>
30486 </indexterm>
30487 If this option is set, queue runs happen in order of message arrival instead of
30488 in an arbitrary order. For this to happen, a complete list of the entire queue
30489 must be set up before the deliveries start. When the queue is all held in a
30490 single directory (the default), a single list is created for both the ordered
30491 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
30492 single list is not created when <option>queue_run_in_order</option> is false. In this case,
30493 the sub-directories are processed one at a time (in a random order), and this
30494 avoids setting up one huge list for the whole queue. Thus, setting
30495 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
30496 when the queue is large, because of the extra work in setting up the single,
30497 large list. In most situations, <option>queue_run_in_order</option> should not be set.
30498 </para>
30499 <para>
30500 <indexterm role="option">
30501 <primary><option>queue_run_max</option></primary>
30502 </indexterm>
30503 </para>
30504 <informaltable frame="all">
30505 <tgroup cols="4" colsep="0" rowsep="0">
30506 <colspec colwidth="8*" align="left"/>
30507 <colspec colwidth="6*" align="center"/>
30508 <colspec colwidth="6*" align="center"/>
30509 <colspec colwidth="6*" align="right"/>
30510 <tbody>
30511 <row>
30512 <entry><option>queue_run_max</option></entry>
30513 <entry>Use: <emphasis>main</emphasis></entry>
30514 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
30515 <entry>Default: <emphasis>5</emphasis></entry>
30516 </row>
30517 </tbody>
30518 </tgroup>
30519 </informaltable>
30520 <para>
30521 <indexterm role="concept">
30522 <primary>queue runner</primary>
30523 <secondary>maximum number of</secondary>
30524 </indexterm>
30525 This controls the maximum number of queue runner processes that an Exim daemon
30526 can run simultaneously. This does not mean that it starts them all at once,
30527 but rather that if the maximum number are still running when the time comes to
30528 start another one, it refrains from starting another one. This can happen with
30529 very large queues and/or very sluggish deliveries. This option does not,
30530 however, interlock with other processes, so additional queue runners can be
30531 started by other means, or by killing and restarting the daemon.
30532 </para>
30533 <para>
30534 Setting this option to zero does not suppress queue runs; rather, it disables
30535 the limit, allowing any number of simultaneous queue runner processes to be
30536 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
30537 the daemon&#x2019;s command line.
30538 </para>
30539 <para>
30540 <indexterm role="concept">
30541 <primary>queues</primary>
30542 <secondary>named</secondary>
30543 </indexterm>
30544 <indexterm role="concept">
30545 <primary>named queues</primary>
30546 <secondary>resource limit</secondary>
30547 </indexterm>
30548 To set limits for different named queues use
30549 an expansion depending on the <varname>$queue_name</varname> variable.
30550 </para>
30551 <para>
30552 <indexterm role="option">
30553 <primary><option>queue_smtp_domains</option></primary>
30554 </indexterm>
30555 </para>
30556 <informaltable frame="all">
30557 <tgroup cols="4" colsep="0" rowsep="0">
30558 <colspec colwidth="8*" align="left"/>
30559 <colspec colwidth="6*" align="center"/>
30560 <colspec colwidth="6*" align="center"/>
30561 <colspec colwidth="6*" align="right"/>
30562 <tbody>
30563 <row>
30564 <entry><option>queue_smtp_domains</option></entry>
30565 <entry>Use: <emphasis>main</emphasis></entry>
30566 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30567 <entry>Default: <emphasis>unset</emphasis></entry>
30568 </row>
30569 </tbody>
30570 </tgroup>
30571 </informaltable>
30572 <para>
30573 <indexterm role="concept">
30574 <primary>queueing incoming messages</primary>
30575 </indexterm>
30576 <indexterm role="concept">
30577 <primary>message</primary>
30578 <secondary>queueing remote deliveries</secondary>
30579 </indexterm>
30580 <indexterm role="concept">
30581 <primary>first pass routing</primary>
30582 </indexterm>
30583 When this option is set, a delivery process is started whenever a message is
30584 received, routing is performed, and local deliveries take place.
30585 However, if any SMTP deliveries are required for domains that match
30586 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
30587 message waits in the queue for the next queue run. Since routing of the message
30588 has taken place, Exim knows to which remote hosts it must be delivered, and so
30589 when the queue run happens, multiple messages for the same host are delivered
30590 over a single SMTP connection. The <option>-odqs</option> command line option causes all
30591 SMTP deliveries to be queued in this way, and is equivalent to setting
30592 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
30593 <option>queue_domains</option>.
30594 </para>
30595 <para>
30596 <indexterm role="option">
30597 <primary><option>receive_timeout</option></primary>
30598 </indexterm>
30599 </para>
30600 <informaltable frame="all">
30601 <tgroup cols="4" colsep="0" rowsep="0">
30602 <colspec colwidth="8*" align="left"/>
30603 <colspec colwidth="6*" align="center"/>
30604 <colspec colwidth="6*" align="center"/>
30605 <colspec colwidth="6*" align="right"/>
30606 <tbody>
30607 <row>
30608 <entry><option>receive_timeout</option></entry>
30609 <entry>Use: <emphasis>main</emphasis></entry>
30610 <entry>Type: <emphasis>time</emphasis></entry>
30611 <entry>Default: <emphasis>0s</emphasis></entry>
30612 </row>
30613 </tbody>
30614 </tgroup>
30615 </informaltable>
30616 <para>
30617 <indexterm role="concept">
30618 <primary>timeout</primary>
30619 <secondary>for non-SMTP input</secondary>
30620 </indexterm>
30621 This option sets the timeout for accepting a non-SMTP message, that is, the
30622 maximum time that Exim waits when reading a message on the standard input. If
30623 the value is zero, it will wait forever. This setting is overridden by the
30624 <option>-or</option> command line option. The timeout for incoming SMTP messages is
30625 controlled by <option>smtp_receive_timeout</option>.
30626 </para>
30627 <para>
30628 <indexterm role="option">
30629 <primary><option>received_header_text</option></primary>
30630 </indexterm>
30631 </para>
30632 <informaltable frame="all">
30633 <tgroup cols="4" colsep="0" rowsep="0">
30634 <colspec colwidth="8*" align="left"/>
30635 <colspec colwidth="6*" align="center"/>
30636 <colspec colwidth="6*" align="center"/>
30637 <colspec colwidth="6*" align="right"/>
30638 <tbody>
30639 <row>
30640 <entry><option>received_header_text</option></entry>
30641 <entry>Use: <emphasis>main</emphasis></entry>
30642 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30643 <entry>Default: <emphasis>see below</emphasis></entry>
30644 </row>
30645 </tbody>
30646 </tgroup>
30647 </informaltable>
30648 <para>
30649 <indexterm role="concept">
30650 <primary>customizing</primary>
30651 <secondary><emphasis>Received:</emphasis> header</secondary>
30652 </indexterm>
30653 <indexterm role="concept">
30654 <primary><emphasis>Received:</emphasis> header line</primary>
30655 <secondary>customizing</secondary>
30656 </indexterm>
30657 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
30658 added to each message, except for the timestamp, which is automatically added
30659 on at the end (preceded by a semicolon). The string is expanded each time it is
30660 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
30661 added to the message. Otherwise, the string should start with the text
30662 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
30663 header lines.
30664 The default setting is:
30665 </para>
30666 <literallayout class="monospaced">
30667 received_header_text = Received: \
30668   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
30669     {${if def:sender_ident \
30670       {from ${quote_local_part:$sender_ident} }}\
30671         ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
30672   by $primary_hostname \
30673   ${if def:received_protocol {with $received_protocol }}\
30674   ${if def:tls_in_ver        { ($tls_in_ver)}}\
30675   ${if def:tls_in_cipher_std { tls $tls_in_cipher_std\n\t}}\
30676   (Exim $version_number)\n\t\
30677   ${if def:sender_address \
30678   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
30679   id $message_exim_id\
30680   ${if def:received_for {\n\tfor $received_for}}
30681 </literallayout>
30682 <para>
30683 The references to the TLS version and cipher are
30684 omitted when Exim is built without TLS
30685 support. The use of conditional expansions ensures that this works for both
30686 locally generated messages and messages received from remote hosts, giving
30687 header lines such as the following:
30688 </para>
30689 <literallayout class="monospaced">
30690 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
30691 by marley.carol.example with esmtp (Exim 4.00)
30692 (envelope-from &lt;bob@carol.example&gt;)
30693 id 16IOWa-00019l-00
30694 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
30695 Received: by scrooge.carol.example with local (Exim 4.00)
30696 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
30697 </literallayout>
30698 <para>
30699 Until the body of the message has been received, the timestamp is the time when
30700 the message started to be received. Once the body has arrived, and all policy
30701 checks have taken place, the timestamp is updated to the time at which the
30702 message was accepted.
30703 </para>
30704 <para>
30705 <indexterm role="option">
30706 <primary><option>received_headers_max</option></primary>
30707 </indexterm>
30708 </para>
30709 <informaltable frame="all">
30710 <tgroup cols="4" colsep="0" rowsep="0">
30711 <colspec colwidth="8*" align="left"/>
30712 <colspec colwidth="6*" align="center"/>
30713 <colspec colwidth="6*" align="center"/>
30714 <colspec colwidth="6*" align="right"/>
30715 <tbody>
30716 <row>
30717 <entry><option>received_headers_max</option></entry>
30718 <entry>Use: <emphasis>main</emphasis></entry>
30719 <entry>Type: <emphasis>integer</emphasis></entry>
30720 <entry>Default: <emphasis>30</emphasis></entry>
30721 </row>
30722 </tbody>
30723 </tgroup>
30724 </informaltable>
30725 <para>
30726 <indexterm role="concept">
30727 <primary>loop</primary>
30728 <secondary>prevention</secondary>
30729 </indexterm>
30730 <indexterm role="concept">
30731 <primary>mail loop prevention</primary>
30732 </indexterm>
30733 <indexterm role="concept">
30734 <primary><emphasis>Received:</emphasis> header line</primary>
30735 <secondary>counting</secondary>
30736 </indexterm>
30737 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
30738 counted, and if it is greater than this parameter, a mail loop is assumed to
30739 have occurred, the delivery is abandoned, and an error message is generated.
30740 This applies to both local and remote deliveries.
30741 </para>
30742 <para>
30743 <indexterm role="option">
30744 <primary><option>recipient_unqualified_hosts</option></primary>
30745 </indexterm>
30746 </para>
30747 <informaltable frame="all">
30748 <tgroup cols="4" colsep="0" rowsep="0">
30749 <colspec colwidth="8*" align="left"/>
30750 <colspec colwidth="6*" align="center"/>
30751 <colspec colwidth="6*" align="center"/>
30752 <colspec colwidth="6*" align="right"/>
30753 <tbody>
30754 <row>
30755 <entry><option>recipient_unqualified_hosts</option></entry>
30756 <entry>Use: <emphasis>main</emphasis></entry>
30757 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30758 <entry>Default: <emphasis>unset</emphasis></entry>
30759 </row>
30760 </tbody>
30761 </tgroup>
30762 </informaltable>
30763 <para>
30764 <indexterm role="concept">
30765 <primary>unqualified addresses</primary>
30766 </indexterm>
30767 <indexterm role="concept">
30768 <primary>host</primary>
30769 <secondary>unqualified addresses from</secondary>
30770 </indexterm>
30771 This option lists those hosts from which Exim is prepared to accept unqualified
30772 recipient addresses in message envelopes. The addresses are made fully
30773 qualified by the addition of the <option>qualify_recipient</option> value. This option also
30774 affects message header lines. Exim does not reject unqualified recipient
30775 addresses in headers, but it qualifies them only if the message came from a
30776 host that matches <option>recipient_unqualified_hosts</option>,
30777 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
30778 option was not set.
30779 </para>
30780 <para>
30781 <indexterm role="option">
30782 <primary><option>recipients_max</option></primary>
30783 </indexterm>
30784 </para>
30785 <informaltable frame="all">
30786 <tgroup cols="4" colsep="0" rowsep="0">
30787 <colspec colwidth="8*" align="left"/>
30788 <colspec colwidth="6*" align="center"/>
30789 <colspec colwidth="6*" align="center"/>
30790 <colspec colwidth="6*" align="right"/>
30791 <tbody>
30792 <row>
30793 <entry><option>recipients_max</option></entry>
30794 <entry>Use: <emphasis>main</emphasis></entry>
30795 <entry>Type: <emphasis>integer</emphasis></entry>
30796 <entry>Default: <emphasis>50000</emphasis></entry>
30797 </row>
30798 </tbody>
30799 </tgroup>
30800 </informaltable>
30801 <para>
30802 <indexterm role="concept">
30803 <primary>limit</primary>
30804 <secondary>number of recipients</secondary>
30805 </indexterm>
30806 <indexterm role="concept">
30807 <primary>recipient</primary>
30808 <secondary>maximum number</secondary>
30809 </indexterm>
30810 If this option is set greater than zero, it specifies the maximum number of
30811 original recipients for any message. Additional recipients that are generated
30812 by aliasing or forwarding do not count. SMTP messages get a 452 response for
30813 all recipients over the limit; earlier recipients are delivered as normal.
30814 Non-SMTP messages with too many recipients are failed, and no deliveries are
30815 done.
30816 </para>
30817 <para>
30818 <indexterm role="concept">
30819 <primary>RCPT</primary>
30820 <secondary>maximum number of incoming</secondary>
30821 </indexterm>
30822 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
30823 RCPT commands in a single message.
30824 </para>
30825 <para>
30826 <indexterm role="option">
30827 <primary><option>recipients_max_reject</option></primary>
30828 </indexterm>
30829 </para>
30830 <informaltable frame="all">
30831 <tgroup cols="4" colsep="0" rowsep="0">
30832 <colspec colwidth="8*" align="left"/>
30833 <colspec colwidth="6*" align="center"/>
30834 <colspec colwidth="6*" align="center"/>
30835 <colspec colwidth="6*" align="right"/>
30836 <tbody>
30837 <row>
30838 <entry><option>recipients_max_reject</option></entry>
30839 <entry>Use: <emphasis>main</emphasis></entry>
30840 <entry>Type: <emphasis>boolean</emphasis></entry>
30841 <entry>Default: <emphasis>false</emphasis></entry>
30842 </row>
30843 </tbody>
30844 </tgroup>
30845 </informaltable>
30846 <para>
30847 If this option is set true, Exim rejects SMTP messages containing too many
30848 recipients by giving 552 errors to the surplus RCPT commands, and a 554
30849 error to the eventual DATA command. Otherwise (the default) it gives a 452
30850 error to the surplus RCPT commands and accepts the message on behalf of the
30851 initial set of recipients. The remote server should then re-send the message
30852 for the remaining recipients at a later time.
30853 </para>
30854 <para>
30855 <indexterm role="option">
30856 <primary><option>remote_max_parallel</option></primary>
30857 </indexterm>
30858 </para>
30859 <informaltable frame="all">
30860 <tgroup cols="4" colsep="0" rowsep="0">
30861 <colspec colwidth="8*" align="left"/>
30862 <colspec colwidth="6*" align="center"/>
30863 <colspec colwidth="6*" align="center"/>
30864 <colspec colwidth="6*" align="right"/>
30865 <tbody>
30866 <row>
30867 <entry><option>remote_max_parallel</option></entry>
30868 <entry>Use: <emphasis>main</emphasis></entry>
30869 <entry>Type: <emphasis>integer</emphasis></entry>
30870 <entry>Default: <emphasis>2</emphasis></entry>
30871 </row>
30872 </tbody>
30873 </tgroup>
30874 </informaltable>
30875 <para>
30876 <indexterm role="concept">
30877 <primary>delivery</primary>
30878 <secondary>parallelism for remote</secondary>
30879 </indexterm>
30880 This option controls parallel delivery of one message to a number of remote
30881 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
30882 does all the remote deliveries for a message one by one. Otherwise, if a single
30883 message has to be delivered to more than one remote host, or if several copies
30884 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
30885 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
30886 deliveries are required, the maximum number of processes are started, and as
30887 each one finishes, another is begun. The order of starting processes is the
30888 same as if sequential delivery were being done, and can be controlled by the
30889 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
30890 with debugging turned on, the debugging output from each delivery process is
30891 tagged with its process id.
30892 </para>
30893 <para>
30894 This option controls only the maximum number of parallel deliveries for one
30895 message in one Exim delivery process. Because Exim has no central queue
30896 manager, there is no way of controlling the total number of simultaneous
30897 deliveries if the configuration allows a delivery attempt as soon as a message
30898 is received.
30899 </para>
30900 <para>
30901 <indexterm role="concept">
30902 <primary>number of deliveries</primary>
30903 </indexterm>
30904 <indexterm role="concept">
30905 <primary>delivery</primary>
30906 <secondary>maximum number of</secondary>
30907 </indexterm>
30908 If you want to control the total number of deliveries on the system, you
30909 need to set the <option>queue_only</option> option. This ensures that all incoming messages
30910 are added to the queue without starting a delivery process. Then set up an Exim
30911 daemon to start queue runner processes at appropriate intervals (probably
30912 fairly often, for example, every minute), and limit the total number of queue
30913 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
30914 delivers only one message at a time, the maximum number of deliveries that can
30915 then take place at once is <option>queue_run_max</option> multiplied by
30916 <option>remote_max_parallel</option>.
30917 </para>
30918 <para>
30919 If it is purely remote deliveries you want to control, use
30920 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
30921 doing the SMTP routing before queueing, so that several messages for the same
30922 host will eventually get delivered down the same connection.
30923 </para>
30924 <para>
30925 <indexterm role="option">
30926 <primary><option>remote_sort_domains</option></primary>
30927 </indexterm>
30928 </para>
30929 <informaltable frame="all">
30930 <tgroup cols="4" colsep="0" rowsep="0">
30931 <colspec colwidth="8*" align="left"/>
30932 <colspec colwidth="6*" align="center"/>
30933 <colspec colwidth="6*" align="center"/>
30934 <colspec colwidth="6*" align="right"/>
30935 <tbody>
30936 <row>
30937 <entry><option>remote_sort_domains</option></entry>
30938 <entry>Use: <emphasis>main</emphasis></entry>
30939 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30940 <entry>Default: <emphasis>unset</emphasis></entry>
30941 </row>
30942 </tbody>
30943 </tgroup>
30944 </informaltable>
30945 <para>
30946 <indexterm role="concept">
30947 <primary>sorting remote deliveries</primary>
30948 </indexterm>
30949 <indexterm role="concept">
30950 <primary>delivery</primary>
30951 <secondary>sorting remote</secondary>
30952 </indexterm>
30953 When there are a number of remote deliveries for a message, they are sorted by
30954 domain into the order given by this list. For example,
30955 </para>
30956 <literallayout class="monospaced">
30957 remote_sort_domains = *.cam.ac.uk:*.uk
30958 </literallayout>
30959 <para>
30960 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
30961 then to those in the <option>uk</option> domain, then to any others.
30962 </para>
30963 <para>
30964 <indexterm role="option">
30965 <primary><option>retry_data_expire</option></primary>
30966 </indexterm>
30967 </para>
30968 <informaltable frame="all">
30969 <tgroup cols="4" colsep="0" rowsep="0">
30970 <colspec colwidth="8*" align="left"/>
30971 <colspec colwidth="6*" align="center"/>
30972 <colspec colwidth="6*" align="center"/>
30973 <colspec colwidth="6*" align="right"/>
30974 <tbody>
30975 <row>
30976 <entry><option>retry_data_expire</option></entry>
30977 <entry>Use: <emphasis>main</emphasis></entry>
30978 <entry>Type: <emphasis>time</emphasis></entry>
30979 <entry>Default: <emphasis>7d</emphasis></entry>
30980 </row>
30981 </tbody>
30982 </tgroup>
30983 </informaltable>
30984 <para>
30985 <indexterm role="concept">
30986 <primary>hints database</primary>
30987 <secondary>data expiry</secondary>
30988 </indexterm>
30989 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
30990 database. Any older retry data is ignored. This means that, for example, once a
30991 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
30992 past failures.
30993 </para>
30994 <para>
30995 <indexterm role="option">
30996 <primary><option>retry_interval_max</option></primary>
30997 </indexterm>
30998 </para>
30999 <informaltable frame="all">
31000 <tgroup cols="4" colsep="0" rowsep="0">
31001 <colspec colwidth="8*" align="left"/>
31002 <colspec colwidth="6*" align="center"/>
31003 <colspec colwidth="6*" align="center"/>
31004 <colspec colwidth="6*" align="right"/>
31005 <tbody>
31006 <row>
31007 <entry><option>retry_interval_max</option></entry>
31008 <entry>Use: <emphasis>main</emphasis></entry>
31009 <entry>Type: <emphasis>time</emphasis></entry>
31010 <entry>Default: <emphasis>24h</emphasis></entry>
31011 </row>
31012 </tbody>
31013 </tgroup>
31014 </informaltable>
31015 <para>
31016 <indexterm role="concept">
31017 <primary>retry</primary>
31018 <secondary>limit on interval</secondary>
31019 </indexterm>
31020 <indexterm role="concept">
31021 <primary>limit</primary>
31022 <secondary>on retry interval</secondary>
31023 </indexterm>
31024 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
31025 intervals between delivery attempts for messages that cannot be delivered
31026 straight away. This option sets an overall limit to the length of time between
31027 retries. It cannot be set greater than 24 hours; any attempt to do so forces
31028 the default value.
31029 </para>
31030 <para>
31031 <indexterm role="option">
31032 <primary><option>return_path_remove</option></primary>
31033 </indexterm>
31034 </para>
31035 <informaltable frame="all">
31036 <tgroup cols="4" colsep="0" rowsep="0">
31037 <colspec colwidth="8*" align="left"/>
31038 <colspec colwidth="6*" align="center"/>
31039 <colspec colwidth="6*" align="center"/>
31040 <colspec colwidth="6*" align="right"/>
31041 <tbody>
31042 <row>
31043 <entry><option>return_path_remove</option></entry>
31044 <entry>Use: <emphasis>main</emphasis></entry>
31045 <entry>Type: <emphasis>boolean</emphasis></entry>
31046 <entry>Default: <emphasis>true</emphasis></entry>
31047 </row>
31048 </tbody>
31049 </tgroup>
31050 </informaltable>
31051 <para>
31052 <indexterm role="concept">
31053 <primary><emphasis>Return-path:</emphasis> header line</primary>
31054 <secondary>removing</secondary>
31055 </indexterm>
31056 RFC 2821, section 4.4, states that an SMTP server must insert a
31057 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
31058 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
31059 MAIL command. This description implies that this header should not be present
31060 in an incoming message. If <option>return_path_remove</option> is true, any existing
31061 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
31062 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
31063 the time of delivery. They are normally used only for final local deliveries.
31064 </para>
31065 <para>
31066 <indexterm role="option">
31067 <primary><option>return_size_limit</option></primary>
31068 </indexterm>
31069 </para>
31070 <informaltable frame="all">
31071 <tgroup cols="4" colsep="0" rowsep="0">
31072 <colspec colwidth="8*" align="left"/>
31073 <colspec colwidth="6*" align="center"/>
31074 <colspec colwidth="6*" align="center"/>
31075 <colspec colwidth="6*" align="right"/>
31076 <tbody>
31077 <row>
31078 <entry><option>return_size_limit</option></entry>
31079 <entry>Use: <emphasis>main</emphasis></entry>
31080 <entry>Type: <emphasis>integer</emphasis></entry>
31081 <entry>Default: <emphasis>100K</emphasis></entry>
31082 </row>
31083 </tbody>
31084 </tgroup>
31085 </informaltable>
31086 <para>
31087 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
31088 </para>
31089 <para>
31090 <indexterm role="option">
31091 <primary><option>rfc1413_hosts</option></primary>
31092 </indexterm>
31093 </para>
31094 <informaltable frame="all">
31095 <tgroup cols="4" colsep="0" rowsep="0">
31096 <colspec colwidth="8*" align="left"/>
31097 <colspec colwidth="6*" align="center"/>
31098 <colspec colwidth="6*" align="center"/>
31099 <colspec colwidth="6*" align="right"/>
31100 <tbody>
31101 <row>
31102 <entry><option>rfc1413_hosts</option></entry>
31103 <entry>Use: <emphasis>main</emphasis></entry>
31104 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31105 <entry>Default: <emphasis>@[]</emphasis></entry>
31106 </row>
31107 </tbody>
31108 </tgroup>
31109 </informaltable>
31110 <para>
31111 <indexterm role="concept">
31112 <primary>RFC 1413</primary>
31113 </indexterm>
31114 <indexterm role="concept">
31115 <primary>host</primary>
31116 <secondary>for RFC 1413 calls</secondary>
31117 </indexterm>
31118 RFC 1413 identification calls are made to any client host which matches
31119 an item in the list.
31120 The default value specifies just this host, being any local interface
31121 for the system.
31122 </para>
31123 <para>
31124 <indexterm role="option">
31125 <primary><option>rfc1413_query_timeout</option></primary>
31126 </indexterm>
31127 </para>
31128 <informaltable frame="all">
31129 <tgroup cols="4" colsep="0" rowsep="0">
31130 <colspec colwidth="8*" align="left"/>
31131 <colspec colwidth="6*" align="center"/>
31132 <colspec colwidth="6*" align="center"/>
31133 <colspec colwidth="6*" align="right"/>
31134 <tbody>
31135 <row>
31136 <entry><option>rfc1413_query_timeout</option></entry>
31137 <entry>Use: <emphasis>main</emphasis></entry>
31138 <entry>Type: <emphasis>time</emphasis></entry>
31139 <entry>Default: <emphasis>0s</emphasis></entry>
31140 </row>
31141 </tbody>
31142 </tgroup>
31143 </informaltable>
31144 <para>
31145 <indexterm role="concept">
31146 <primary>RFC 1413</primary>
31147 <secondary>query timeout</secondary>
31148 </indexterm>
31149 <indexterm role="concept">
31150 <primary>timeout</primary>
31151 <secondary>for RFC 1413 call</secondary>
31152 </indexterm>
31153 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
31154 no RFC 1413 calls are ever made.
31155 </para>
31156 <para>
31157 <indexterm role="option">
31158 <primary><option>sender_unqualified_hosts</option></primary>
31159 </indexterm>
31160 </para>
31161 <informaltable frame="all">
31162 <tgroup cols="4" colsep="0" rowsep="0">
31163 <colspec colwidth="8*" align="left"/>
31164 <colspec colwidth="6*" align="center"/>
31165 <colspec colwidth="6*" align="center"/>
31166 <colspec colwidth="6*" align="right"/>
31167 <tbody>
31168 <row>
31169 <entry><option>sender_unqualified_hosts</option></entry>
31170 <entry>Use: <emphasis>main</emphasis></entry>
31171 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31172 <entry>Default: <emphasis>unset</emphasis></entry>
31173 </row>
31174 </tbody>
31175 </tgroup>
31176 </informaltable>
31177 <para>
31178 <indexterm role="concept">
31179 <primary>unqualified addresses</primary>
31180 </indexterm>
31181 <indexterm role="concept">
31182 <primary>host</primary>
31183 <secondary>unqualified addresses from</secondary>
31184 </indexterm>
31185 This option lists those hosts from which Exim is prepared to accept unqualified
31186 sender addresses. The addresses are made fully qualified by the addition of
31187 <option>qualify_domain</option>. This option also affects message header lines. Exim does
31188 not reject unqualified addresses in headers that contain sender addresses, but
31189 it qualifies them only if the message came from a host that matches
31190 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
31191 using TCP/IP), and the <option>-bnq</option> option was not set.
31192 </para>
31193 <para>
31194 <indexterm role="option">
31195 <primary><option>slow_lookup_log</option></primary>
31196 </indexterm>
31197 </para>
31198 <informaltable frame="all">
31199 <tgroup cols="4" colsep="0" rowsep="0">
31200 <colspec colwidth="8*" align="left"/>
31201 <colspec colwidth="6*" align="center"/>
31202 <colspec colwidth="6*" align="center"/>
31203 <colspec colwidth="6*" align="right"/>
31204 <tbody>
31205 <row>
31206 <entry><option>slow_lookup_log</option></entry>
31207 <entry>Use: <emphasis>main</emphasis></entry>
31208 <entry>Type: <emphasis>integer</emphasis></entry>
31209 <entry>Default: <emphasis>0</emphasis></entry>
31210 </row>
31211 </tbody>
31212 </tgroup>
31213 </informaltable>
31214 <para>
31215 <indexterm role="concept">
31216 <primary>logging</primary>
31217 <secondary>slow lookups</secondary>
31218 </indexterm>
31219 <indexterm role="concept">
31220 <primary>dns</primary>
31221 <secondary>logging slow lookups</secondary>
31222 </indexterm>
31223 This option controls logging of slow lookups.
31224 If the value is nonzero it is taken as a number of milliseconds
31225 and lookups taking longer than this are logged.
31226 Currently this applies only to DNS lookups.
31227 </para>
31228 <para>
31229 <indexterm role="option">
31230 <primary><option>smtp_accept_keepalive</option></primary>
31231 </indexterm>
31232 </para>
31233 <informaltable frame="all">
31234 <tgroup cols="4" colsep="0" rowsep="0">
31235 <colspec colwidth="8*" align="left"/>
31236 <colspec colwidth="6*" align="center"/>
31237 <colspec colwidth="6*" align="center"/>
31238 <colspec colwidth="6*" align="right"/>
31239 <tbody>
31240 <row>
31241 <entry><option>smtp_accept_keepalive</option></entry>
31242 <entry>Use: <emphasis>main</emphasis></entry>
31243 <entry>Type: <emphasis>boolean</emphasis></entry>
31244 <entry>Default: <emphasis>true</emphasis></entry>
31245 </row>
31246 </tbody>
31247 </tgroup>
31248 </informaltable>
31249 <para>
31250 <indexterm role="concept">
31251 <primary>keepalive</primary>
31252 <secondary>on incoming connection</secondary>
31253 </indexterm>
31254 This option controls the setting of the SO_KEEPALIVE option on incoming
31255 TCP/IP socket connections. When set, it causes the kernel to probe idle
31256 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
31257 other end of the connection should send an acknowledgment if the connection is
31258 still okay or a reset if the connection has been aborted. The reason for doing
31259 this is that it has the beneficial effect of freeing up certain types of
31260 connection that can get stuck when the remote host is disconnected without
31261 tidying up the TCP/IP call properly. The keepalive mechanism takes several
31262 hours to detect unreachable hosts.
31263 </para>
31264 <para>
31265 <indexterm role="option">
31266 <primary><option>smtp_accept_max</option></primary>
31267 </indexterm>
31268 </para>
31269 <informaltable frame="all">
31270 <tgroup cols="4" colsep="0" rowsep="0">
31271 <colspec colwidth="8*" align="left"/>
31272 <colspec colwidth="6*" align="center"/>
31273 <colspec colwidth="6*" align="center"/>
31274 <colspec colwidth="6*" align="right"/>
31275 <tbody>
31276 <row>
31277 <entry><option>smtp_accept_max</option></entry>
31278 <entry>Use: <emphasis>main</emphasis></entry>
31279 <entry>Type: <emphasis>integer</emphasis></entry>
31280 <entry>Default: <emphasis>20</emphasis></entry>
31281 </row>
31282 </tbody>
31283 </tgroup>
31284 </informaltable>
31285 <para>
31286 <indexterm role="concept">
31287 <primary>limit</primary>
31288 <secondary>incoming SMTP connections</secondary>
31289 </indexterm>
31290 <indexterm role="concept">
31291 <primary>SMTP</primary>
31292 <secondary>incoming connection count</secondary>
31293 </indexterm>
31294 <indexterm role="concept">
31295 <primary>inetd</primary>
31296 </indexterm>
31297 This option specifies the maximum number of simultaneous incoming SMTP calls
31298 that Exim will accept. It applies only to the listening daemon; there is no
31299 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
31300 value is set to zero, no limit is applied. However, it is required to be
31301 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
31302 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
31303 </para>
31304 <para>
31305 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
31306 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
31307 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
31308 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
31309 </para>
31310 <para>
31311 <indexterm role="option">
31312 <primary><option>smtp_accept_max_nonmail</option></primary>
31313 </indexterm>
31314 </para>
31315 <informaltable frame="all">
31316 <tgroup cols="4" colsep="0" rowsep="0">
31317 <colspec colwidth="8*" align="left"/>
31318 <colspec colwidth="6*" align="center"/>
31319 <colspec colwidth="6*" align="center"/>
31320 <colspec colwidth="6*" align="right"/>
31321 <tbody>
31322 <row>
31323 <entry><option>smtp_accept_max_nonmail</option></entry>
31324 <entry>Use: <emphasis>main</emphasis></entry>
31325 <entry>Type: <emphasis>integer</emphasis></entry>
31326 <entry>Default: <emphasis>10</emphasis></entry>
31327 </row>
31328 </tbody>
31329 </tgroup>
31330 </informaltable>
31331 <para>
31332 <indexterm role="concept">
31333 <primary>limit</primary>
31334 <secondary>non-mail SMTP commands</secondary>
31335 </indexterm>
31336 <indexterm role="concept">
31337 <primary>SMTP</primary>
31338 <secondary>limiting non-mail commands</secondary>
31339 </indexterm>
31340 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
31341 the connection if there are too many. This option defines <quote>too many</quote>. The
31342 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
31343 client looping sending EHLO, for example. The check is applied only if the
31344 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
31345 </para>
31346 <para>
31347 When a new message is expected, one occurrence of RSET is not counted. This
31348 allows a client to send one RSET between messages (this is not necessary,
31349 but some clients do it). Exim also allows one uncounted occurrence of HELO
31350 or EHLO, and one occurrence of STARTTLS between messages. After
31351 starting up a TLS session, another EHLO is expected, and so it too is not
31352 counted. The first occurrence of AUTH in a connection, or immediately
31353 following STARTTLS is not counted. Otherwise, all commands other than
31354 MAIL, RCPT, DATA, and QUIT are counted.
31355 </para>
31356 <para>
31357 <indexterm role="option">
31358 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
31359 </indexterm>
31360 </para>
31361 <informaltable frame="all">
31362 <tgroup cols="4" colsep="0" rowsep="0">
31363 <colspec colwidth="8*" align="left"/>
31364 <colspec colwidth="6*" align="center"/>
31365 <colspec colwidth="6*" align="center"/>
31366 <colspec colwidth="6*" align="right"/>
31367 <tbody>
31368 <row>
31369 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
31370 <entry>Use: <emphasis>main</emphasis></entry>
31371 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31372 <entry>Default: <emphasis>*</emphasis></entry>
31373 </row>
31374 </tbody>
31375 </tgroup>
31376 </informaltable>
31377 <para>
31378 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
31379 check by setting this option. The default value makes it apply to all hosts. By
31380 changing the value, you can exclude any badly-behaved hosts that you have to
31381 live with.
31382 </para>
31383 <para>
31384 <indexterm role="option">
31385 <primary><option>smtp_accept_max_per_connection</option></primary>
31386 </indexterm>
31387 </para>
31388 <informaltable frame="all">
31389 <tgroup cols="4" colsep="0" rowsep="0">
31390 <colspec colwidth="8*" align="left"/>
31391 <colspec colwidth="6*" align="center"/>
31392 <colspec colwidth="6*" align="center"/>
31393 <colspec colwidth="6*" align="right"/>
31394 <tbody>
31395 <row>
31396 <entry><option>smtp_accept_max_per_connection</option></entry>
31397 <entry>Use: <emphasis>main</emphasis></entry>
31398 <entry>Type: <emphasis>integer</emphasis></entry>
31399 <entry>Default: <emphasis>1000</emphasis></entry>
31400 </row>
31401 </tbody>
31402 </tgroup>
31403 </informaltable>
31404 <para>
31405 <indexterm role="concept">
31406 <primary>SMTP</primary>
31407 <secondary>limiting incoming message count</secondary>
31408 </indexterm>
31409 <indexterm role="concept">
31410 <primary>limit</primary>
31411 <secondary>messages per SMTP connection</secondary>
31412 </indexterm>
31413 The value of this option limits the number of MAIL commands that Exim is
31414 prepared to accept over a single SMTP connection, whether or not each command
31415 results in the transfer of a message. After the limit is reached, a 421
31416 response is given to subsequent MAIL commands. This limit is a safety
31417 precaution against a client that goes mad (incidents of this type have been
31418 seen).
31419 </para>
31420 <para>
31421 <indexterm role="option">
31422 <primary><option>smtp_accept_max_per_host</option></primary>
31423 </indexterm>
31424 </para>
31425 <informaltable frame="all">
31426 <tgroup cols="4" colsep="0" rowsep="0">
31427 <colspec colwidth="8*" align="left"/>
31428 <colspec colwidth="6*" align="center"/>
31429 <colspec colwidth="6*" align="center"/>
31430 <colspec colwidth="6*" align="right"/>
31431 <tbody>
31432 <row>
31433 <entry><option>smtp_accept_max_per_host</option></entry>
31434 <entry>Use: <emphasis>main</emphasis></entry>
31435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31436 <entry>Default: <emphasis>unset</emphasis></entry>
31437 </row>
31438 </tbody>
31439 </tgroup>
31440 </informaltable>
31441 <para>
31442 <indexterm role="concept">
31443 <primary>limit</primary>
31444 <secondary>SMTP connections from one host</secondary>
31445 </indexterm>
31446 <indexterm role="concept">
31447 <primary>host</primary>
31448 <secondary>limiting SMTP connections from</secondary>
31449 </indexterm>
31450 This option restricts the number of simultaneous IP connections from a single
31451 host (strictly, from a single IP address) to the Exim daemon. The option is
31452 expanded, to enable different limits to be applied to different hosts by
31453 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
31454 connection attempts from the same host are rejected with error code 421. This
31455 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
31456 of zero imposes no limit. If this option is set greater than zero, it is
31457 required that <option>smtp_accept_max</option> be non-zero.
31458 </para>
31459 <para>
31460 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
31461 constructions that take an appreciable amount of time. The expansion and test
31462 happen in the main daemon loop, in order to reject additional connections
31463 without forking additional processes (otherwise a denial-of-service attack
31464 could cause a vast number or processes to be created). While the daemon is
31465 doing this processing, it cannot accept any other incoming connections.
31466 </para>
31467 <para>
31468 <indexterm role="option">
31469 <primary><option>smtp_accept_queue</option></primary>
31470 </indexterm>
31471 </para>
31472 <informaltable frame="all">
31473 <tgroup cols="4" colsep="0" rowsep="0">
31474 <colspec colwidth="8*" align="left"/>
31475 <colspec colwidth="6*" align="center"/>
31476 <colspec colwidth="6*" align="center"/>
31477 <colspec colwidth="6*" align="right"/>
31478 <tbody>
31479 <row>
31480 <entry><option>smtp_accept_queue</option></entry>
31481 <entry>Use: <emphasis>main</emphasis></entry>
31482 <entry>Type: <emphasis>integer</emphasis></entry>
31483 <entry>Default: <emphasis>0</emphasis></entry>
31484 </row>
31485 </tbody>
31486 </tgroup>
31487 </informaltable>
31488 <para>
31489 <indexterm role="concept">
31490 <primary>SMTP</primary>
31491 <secondary>incoming connection count</secondary>
31492 </indexterm>
31493 <indexterm role="concept">
31494 <primary>queueing incoming messages</primary>
31495 </indexterm>
31496 <indexterm role="concept">
31497 <primary>message</primary>
31498 <secondary>queueing by SMTP connection count</secondary>
31499 </indexterm>
31500 If the number of simultaneous incoming SMTP connections being handled via the
31501 listening daemon exceeds this value, messages received by SMTP are just placed
31502 in the queue; no delivery processes are started automatically. The count is
31503 fixed at the start of an SMTP connection. It cannot be updated in the
31504 subprocess that receives messages, and so the queueing or not queueing applies
31505 to all messages received in the same connection.
31506 </para>
31507 <para>
31508 A value of zero implies no limit, and clearly any non-zero value is useful only
31509 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
31510 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
31511 various <option>-od</option><emphasis>x</emphasis> command line options.
31512 </para>
31513 <para>
31514 <indexterm role="option">
31515 <primary><option>smtp_accept_queue_per_connection</option></primary>
31516 </indexterm>
31517 </para>
31518 <informaltable frame="all">
31519 <tgroup cols="4" colsep="0" rowsep="0">
31520 <colspec colwidth="8*" align="left"/>
31521 <colspec colwidth="6*" align="center"/>
31522 <colspec colwidth="6*" align="center"/>
31523 <colspec colwidth="6*" align="right"/>
31524 <tbody>
31525 <row>
31526 <entry><option>smtp_accept_queue_per_connection</option></entry>
31527 <entry>Use: <emphasis>main</emphasis></entry>
31528 <entry>Type: <emphasis>integer</emphasis></entry>
31529 <entry>Default: <emphasis>10</emphasis></entry>
31530 </row>
31531 </tbody>
31532 </tgroup>
31533 </informaltable>
31534 <para>
31535 <indexterm role="concept">
31536 <primary>queueing incoming messages</primary>
31537 </indexterm>
31538 <indexterm role="concept">
31539 <primary>message</primary>
31540 <secondary>queueing by message count</secondary>
31541 </indexterm>
31542 This option limits the number of delivery processes that Exim starts
31543 automatically when receiving messages via SMTP, whether via the daemon or by
31544 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
31545 and the number of messages received in a single SMTP session exceeds this
31546 number, subsequent messages are placed in the queue, but no delivery processes
31547 are started. This helps to limit the number of Exim processes when a server
31548 restarts after downtime and there is a lot of mail waiting for it on other
31549 systems. On large systems, the default should probably be increased, and on
31550 dial-in client systems it should probably be set to zero (that is, disabled).
31551 </para>
31552 <para>
31553 <indexterm role="option">
31554 <primary><option>smtp_accept_reserve</option></primary>
31555 </indexterm>
31556 </para>
31557 <informaltable frame="all">
31558 <tgroup cols="4" colsep="0" rowsep="0">
31559 <colspec colwidth="8*" align="left"/>
31560 <colspec colwidth="6*" align="center"/>
31561 <colspec colwidth="6*" align="center"/>
31562 <colspec colwidth="6*" align="right"/>
31563 <tbody>
31564 <row>
31565 <entry><option>smtp_accept_reserve</option></entry>
31566 <entry>Use: <emphasis>main</emphasis></entry>
31567 <entry>Type: <emphasis>integer</emphasis></entry>
31568 <entry>Default: <emphasis>0</emphasis></entry>
31569 </row>
31570 </tbody>
31571 </tgroup>
31572 </informaltable>
31573 <para>
31574 <indexterm role="concept">
31575 <primary>SMTP</primary>
31576 <secondary>incoming call count</secondary>
31577 </indexterm>
31578 <indexterm role="concept">
31579 <primary>host</primary>
31580 <secondary>reserved</secondary>
31581 </indexterm>
31582 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
31583 number of SMTP connections that are reserved for connections from the hosts
31584 that are specified in <option>smtp_reserve_hosts</option>. The value set in
31585 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
31586 restricted to this number of connections; the option specifies a minimum number
31587 of connection slots for them, not a maximum. It is a guarantee that this group
31588 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
31589 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
31590 individual host.
31591 </para>
31592 <para>
31593 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
31594 set to 5, once there are 45 active connections (from any hosts), new
31595 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
31596 provided the other criteria for acceptance are met.
31597 </para>
31598 <para>
31599 <indexterm role="option">
31600 <primary><option>smtp_active_hostname</option></primary>
31601 </indexterm>
31602 </para>
31603 <informaltable frame="all">
31604 <tgroup cols="4" colsep="0" rowsep="0">
31605 <colspec colwidth="8*" align="left"/>
31606 <colspec colwidth="6*" align="center"/>
31607 <colspec colwidth="6*" align="center"/>
31608 <colspec colwidth="6*" align="right"/>
31609 <tbody>
31610 <row>
31611 <entry><option>smtp_active_hostname</option></entry>
31612 <entry>Use: <emphasis>main</emphasis></entry>
31613 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31614 <entry>Default: <emphasis>unset</emphasis></entry>
31615 </row>
31616 </tbody>
31617 </tgroup>
31618 </informaltable>
31619 <para>
31620 <indexterm role="concept">
31621 <primary>host</primary>
31622 <secondary>name in SMTP responses</secondary>
31623 </indexterm>
31624 <indexterm role="concept">
31625 <primary>SMTP</primary>
31626 <secondary>host name in responses</secondary>
31627 </indexterm>
31628 <indexterm role="variable">
31629 <primary><varname>$primary_hostname</varname></primary>
31630 </indexterm>
31631 This option is provided for multi-homed servers that want to masquerade as
31632 several different hosts. At the start of an incoming SMTP connection, its value
31633 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
31634 responses. For example, it is used as domain name in the response to an
31635 incoming HELO or EHLO command.
31636 </para>
31637 <para>
31638 <indexterm role="variable">
31639 <primary><varname>$smtp_active_hostname</varname></primary>
31640 </indexterm>
31641 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
31642 is saved with any messages that are received. It is therefore available for use
31643 in routers and transports when the message is later delivered.
31644 </para>
31645 <para>
31646 If this option is unset, or if its expansion is forced to fail, or if the
31647 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
31648 used. Other expansion failures cause a message to be written to the main and
31649 panic logs, and the SMTP command receives a temporary error. Typically, the
31650 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
31651 For example:
31652 </para>
31653 <literallayout class="monospaced">
31654 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
31655   {cox.mydomain}{box.mydomain}}
31656 </literallayout>
31657 <para>
31658 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
31659 messages, it is also used as the default for HELO commands in callout
31660 verification if there is no remote transport from which to obtain a
31661 <option>helo_data</option> value.
31662 </para>
31663 <para>
31664 <indexterm role="option">
31665 <primary><option>smtp_banner</option></primary>
31666 </indexterm>
31667 </para>
31668 <informaltable frame="all">
31669 <tgroup cols="4" colsep="0" rowsep="0">
31670 <colspec colwidth="8*" align="left"/>
31671 <colspec colwidth="6*" align="center"/>
31672 <colspec colwidth="6*" align="center"/>
31673 <colspec colwidth="6*" align="right"/>
31674 <tbody>
31675 <row>
31676 <entry><option>smtp_banner</option></entry>
31677 <entry>Use: <emphasis>main</emphasis></entry>
31678 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31679 <entry>Default: <emphasis>see below</emphasis></entry>
31680 </row>
31681 </tbody>
31682 </tgroup>
31683 </informaltable>
31684 <para>
31685 <indexterm role="concept">
31686 <primary>SMTP</primary>
31687 <secondary>welcome banner</secondary>
31688 </indexterm>
31689 <indexterm role="concept">
31690 <primary>banner for SMTP</primary>
31691 </indexterm>
31692 <indexterm role="concept">
31693 <primary>welcome banner for SMTP</primary>
31694 </indexterm>
31695 <indexterm role="concept">
31696 <primary>customizing</primary>
31697 <secondary>SMTP banner</secondary>
31698 </indexterm>
31699 This string, which is expanded every time it is used, is output as the initial
31700 positive response to an SMTP connection. The default setting is:
31701 </para>
31702 <literallayout class="monospaced">
31703 smtp_banner = $smtp_active_hostname ESMTP Exim \
31704   $version_number $tod_full
31705 </literallayout>
31706 <para>
31707 Failure to expand the string causes a panic error. If you want to create a
31708 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
31709 appropriate points, but not at the end. Note that the 220 code is not included
31710 in this string. Exim adds it automatically (several times in the case of a
31711 multiline response).
31712 </para>
31713 <para>
31714 <indexterm role="option">
31715 <primary><option>smtp_check_spool_space</option></primary>
31716 </indexterm>
31717 </para>
31718 <informaltable frame="all">
31719 <tgroup cols="4" colsep="0" rowsep="0">
31720 <colspec colwidth="8*" align="left"/>
31721 <colspec colwidth="6*" align="center"/>
31722 <colspec colwidth="6*" align="center"/>
31723 <colspec colwidth="6*" align="right"/>
31724 <tbody>
31725 <row>
31726 <entry><option>smtp_check_spool_space</option></entry>
31727 <entry>Use: <emphasis>main</emphasis></entry>
31728 <entry>Type: <emphasis>boolean</emphasis></entry>
31729 <entry>Default: <emphasis>true</emphasis></entry>
31730 </row>
31731 </tbody>
31732 </tgroup>
31733 </informaltable>
31734 <para>
31735 <indexterm role="concept">
31736 <primary>checking disk space</primary>
31737 </indexterm>
31738 <indexterm role="concept">
31739 <primary>disk space, checking</primary>
31740 </indexterm>
31741 <indexterm role="concept">
31742 <primary>spool directory</primary>
31743 <secondary>checking space</secondary>
31744 </indexterm>
31745 When this option is set, if an incoming SMTP session encounters the SIZE
31746 option on a MAIL command, it checks that there is enough space in the
31747 spool directory&#x2019;s partition to accept a message of that size, while still
31748 leaving free the amount specified by <option>check_spool_space</option> (even if that value
31749 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
31750 </para>
31751 <para>
31752 <indexterm role="option">
31753 <primary><option>smtp_connect_backlog</option></primary>
31754 </indexterm>
31755 </para>
31756 <informaltable frame="all">
31757 <tgroup cols="4" colsep="0" rowsep="0">
31758 <colspec colwidth="8*" align="left"/>
31759 <colspec colwidth="6*" align="center"/>
31760 <colspec colwidth="6*" align="center"/>
31761 <colspec colwidth="6*" align="right"/>
31762 <tbody>
31763 <row>
31764 <entry><option>smtp_connect_backlog</option></entry>
31765 <entry>Use: <emphasis>main</emphasis></entry>
31766 <entry>Type: <emphasis>integer</emphasis></entry>
31767 <entry>Default: <emphasis>20</emphasis></entry>
31768 </row>
31769 </tbody>
31770 </tgroup>
31771 </informaltable>
31772 <para>
31773 <indexterm role="concept">
31774 <primary>connection backlog</primary>
31775 </indexterm>
31776 <indexterm role="concept">
31777 <primary>SMTP</primary>
31778 <secondary>connection backlog</secondary>
31779 </indexterm>
31780 <indexterm role="concept">
31781 <primary>backlog of connections</primary>
31782 </indexterm>
31783 This option specifies a maximum number of waiting SMTP connections. Exim passes
31784 this value to the TCP/IP system when it sets up its listener. Once this number
31785 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
31786 attempts are refused at the TCP/IP level. At least, that is what the manuals
31787 say; in some circumstances such connection attempts have been observed to time
31788 out instead. For large systems it is probably a good idea to increase the
31789 value (to 50, say). It also gives some protection against denial-of-service
31790 attacks by SYN flooding.
31791 </para>
31792 <para>
31793 <indexterm role="option">
31794 <primary><option>smtp_enforce_sync</option></primary>
31795 </indexterm>
31796 </para>
31797 <informaltable frame="all">
31798 <tgroup cols="4" colsep="0" rowsep="0">
31799 <colspec colwidth="8*" align="left"/>
31800 <colspec colwidth="6*" align="center"/>
31801 <colspec colwidth="6*" align="center"/>
31802 <colspec colwidth="6*" align="right"/>
31803 <tbody>
31804 <row>
31805 <entry><option>smtp_enforce_sync</option></entry>
31806 <entry>Use: <emphasis>main</emphasis></entry>
31807 <entry>Type: <emphasis>boolean</emphasis></entry>
31808 <entry>Default: <emphasis>true</emphasis></entry>
31809 </row>
31810 </tbody>
31811 </tgroup>
31812 </informaltable>
31813 <para>
31814 <indexterm role="concept">
31815 <primary>SMTP</primary>
31816 <secondary>synchronization checking</secondary>
31817 </indexterm>
31818 <indexterm role="concept">
31819 <primary>synchronization checking in SMTP</primary>
31820 </indexterm>
31821 The SMTP protocol specification requires the client to wait for a response from
31822 the server at certain points in the dialogue. Without PIPELINING these
31823 synchronization points are after every command; with PIPELINING they are
31824 fewer, but they still exist.
31825 </para>
31826 <para>
31827 Some spamming sites send out a complete set of SMTP commands without waiting
31828 for any response. Exim protects against this by rejecting a message if the
31829 client has sent further input when it should not have. The error response <quote>554
31830 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
31831 for this error cannot be perfect because of transmission delays (unexpected
31832 input may be on its way but not yet received when Exim checks). However, it
31833 does detect many instances.
31834 </para>
31835 <para>
31836 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
31837 If you want to disable the check selectively (for example, only for certain
31838 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
31839 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
31840 </para>
31841 <para>
31842 <indexterm role="option">
31843 <primary><option>smtp_etrn_command</option></primary>
31844 </indexterm>
31845 </para>
31846 <informaltable frame="all">
31847 <tgroup cols="4" colsep="0" rowsep="0">
31848 <colspec colwidth="8*" align="left"/>
31849 <colspec colwidth="6*" align="center"/>
31850 <colspec colwidth="6*" align="center"/>
31851 <colspec colwidth="6*" align="right"/>
31852 <tbody>
31853 <row>
31854 <entry><option>smtp_etrn_command</option></entry>
31855 <entry>Use: <emphasis>main</emphasis></entry>
31856 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31857 <entry>Default: <emphasis>unset</emphasis></entry>
31858 </row>
31859 </tbody>
31860 </tgroup>
31861 </informaltable>
31862 <para>
31863 <indexterm role="concept">
31864 <primary>ETRN</primary>
31865 <secondary>command to be run</secondary>
31866 </indexterm>
31867 <indexterm role="concept">
31868 <primary>ESMTP extensions</primary>
31869 <secondary>ETRN</secondary>
31870 </indexterm>
31871 <indexterm role="variable">
31872 <primary><varname>$domain</varname></primary>
31873 </indexterm>
31874 If this option is set, the given command is run whenever an SMTP ETRN
31875 command is received from a host that is permitted to issue such commands (see
31876 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
31877 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
31878 argument of the ETRN command, and no syntax checking is done on it. For
31879 example:
31880 </para>
31881 <literallayout class="monospaced">
31882 smtp_etrn_command = /etc/etrn_command $domain \
31883                     $sender_host_address
31884 </literallayout>
31885 <para revisionflag="changed">
31886 If the option is not set, the argument for the ETRN command must
31887 be a <emphasis>#</emphasis> followed by an address string.
31888 In this case an <emphasis>exim -R &lt;string&gt;</emphasis> command is used;
31889 if the ETRN ACL has set up a named-queue then <emphasis>-MCG &lt;queue&gt;</emphasis> is appended.
31890 </para>
31891 <para>
31892 A new process is created to run the command, but Exim does not wait for it to
31893 complete. Consequently, its status cannot be checked. If the command cannot be
31894 run, a line is written to the panic log, but the ETRN caller still receives
31895 a 250 success response. Exim is normally running under its own uid when
31896 receiving SMTP, so it is not possible for it to change the uid before running
31897 the command.
31898 </para>
31899 <para>
31900 <indexterm role="option">
31901 <primary><option>smtp_etrn_serialize</option></primary>
31902 </indexterm>
31903 </para>
31904 <informaltable frame="all">
31905 <tgroup cols="4" colsep="0" rowsep="0">
31906 <colspec colwidth="8*" align="left"/>
31907 <colspec colwidth="6*" align="center"/>
31908 <colspec colwidth="6*" align="center"/>
31909 <colspec colwidth="6*" align="right"/>
31910 <tbody>
31911 <row>
31912 <entry><option>smtp_etrn_serialize</option></entry>
31913 <entry>Use: <emphasis>main</emphasis></entry>
31914 <entry>Type: <emphasis>boolean</emphasis></entry>
31915 <entry>Default: <emphasis>true</emphasis></entry>
31916 </row>
31917 </tbody>
31918 </tgroup>
31919 </informaltable>
31920 <para>
31921 <indexterm role="concept">
31922 <primary>ETRN</primary>
31923 <secondary>serializing</secondary>
31924 </indexterm>
31925 When this option is set, it prevents the simultaneous execution of more than
31926 one identical command as a result of ETRN in an SMTP connection. See
31927 section <xref linkend="SECTETRN"/> for details.
31928 </para>
31929 <para>
31930 <indexterm role="option">
31931 <primary><option>smtp_load_reserve</option></primary>
31932 </indexterm>
31933 </para>
31934 <informaltable frame="all">
31935 <tgroup cols="4" colsep="0" rowsep="0">
31936 <colspec colwidth="8*" align="left"/>
31937 <colspec colwidth="6*" align="center"/>
31938 <colspec colwidth="6*" align="center"/>
31939 <colspec colwidth="6*" align="right"/>
31940 <tbody>
31941 <row>
31942 <entry><option>smtp_load_reserve</option></entry>
31943 <entry>Use: <emphasis>main</emphasis></entry>
31944 <entry>Type: <emphasis>fixed-point</emphasis></entry>
31945 <entry>Default: <emphasis>unset</emphasis></entry>
31946 </row>
31947 </tbody>
31948 </tgroup>
31949 </informaltable>
31950 <para>
31951 <indexterm role="concept">
31952 <primary>load average</primary>
31953 </indexterm>
31954 If the system load average ever gets higher than this, incoming SMTP calls are
31955 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
31956 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
31957 the load is over the limit. The option has no effect on ancient operating
31958 systems on which Exim cannot determine the load average. See also
31959 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
31960 </para>
31961 <para>
31962 <indexterm role="option">
31963 <primary><option>smtp_max_synprot_errors</option></primary>
31964 </indexterm>
31965 </para>
31966 <informaltable frame="all">
31967 <tgroup cols="4" colsep="0" rowsep="0">
31968 <colspec colwidth="8*" align="left"/>
31969 <colspec colwidth="6*" align="center"/>
31970 <colspec colwidth="6*" align="center"/>
31971 <colspec colwidth="6*" align="right"/>
31972 <tbody>
31973 <row>
31974 <entry><option>smtp_max_synprot_errors</option></entry>
31975 <entry>Use: <emphasis>main</emphasis></entry>
31976 <entry>Type: <emphasis>integer</emphasis></entry>
31977 <entry>Default: <emphasis>3</emphasis></entry>
31978 </row>
31979 </tbody>
31980 </tgroup>
31981 </informaltable>
31982 <para>
31983 <indexterm role="concept">
31984 <primary>SMTP</primary>
31985 <secondary>limiting syntax and protocol errors</secondary>
31986 </indexterm>
31987 <indexterm role="concept">
31988 <primary>limit</primary>
31989 <secondary>SMTP syntax and protocol errors</secondary>
31990 </indexterm>
31991 Exim rejects SMTP commands that contain syntax or protocol errors. In
31992 particular, a syntactically invalid email address, as in this command:
31993 </para>
31994 <literallayout class="monospaced">
31995 RCPT TO:&lt;abc xyz@a.b.c&gt;
31996 </literallayout>
31997 <para>
31998 causes immediate rejection of the command, before any other tests are done.
31999 (The ACL cannot be run if there is no valid address to set up for it.) An
32000 example of a protocol error is receiving RCPT before MAIL. If there are
32001 too many syntax or protocol errors in one SMTP session, the connection is
32002 dropped. The limit is set by this option.
32003 </para>
32004 <para>
32005 <indexterm role="concept">
32006 <primary>PIPELINING</primary>
32007 <secondary>expected errors</secondary>
32008 </indexterm>
32009 When the PIPELINING extension to SMTP is in use, some protocol errors are
32010 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
32011 Exim assumes that PIPELINING will be used if it advertises it (see
32012 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
32013 not count towards the limit.
32014 </para>
32015 <para>
32016 <indexterm role="option">
32017 <primary><option>smtp_max_unknown_commands</option></primary>
32018 </indexterm>
32019 </para>
32020 <informaltable frame="all">
32021 <tgroup cols="4" colsep="0" rowsep="0">
32022 <colspec colwidth="8*" align="left"/>
32023 <colspec colwidth="6*" align="center"/>
32024 <colspec colwidth="6*" align="center"/>
32025 <colspec colwidth="6*" align="right"/>
32026 <tbody>
32027 <row>
32028 <entry><option>smtp_max_unknown_commands</option></entry>
32029 <entry>Use: <emphasis>main</emphasis></entry>
32030 <entry>Type: <emphasis>integer</emphasis></entry>
32031 <entry>Default: <emphasis>3</emphasis></entry>
32032 </row>
32033 </tbody>
32034 </tgroup>
32035 </informaltable>
32036 <para>
32037 <indexterm role="concept">
32038 <primary>SMTP</primary>
32039 <secondary>limiting unknown commands</secondary>
32040 </indexterm>
32041 <indexterm role="concept">
32042 <primary>limit</primary>
32043 <secondary>unknown SMTP commands</secondary>
32044 </indexterm>
32045 If there are too many unrecognized commands in an incoming SMTP session, an
32046 Exim server drops the connection. This is a defence against some kinds of abuse
32047 that subvert web
32048 clients
32049 into making connections to SMTP ports; in these circumstances, a number of
32050 non-SMTP command lines are sent first.
32051 </para>
32052 <para>
32053 <indexterm role="option">
32054 <primary><option>smtp_ratelimit_hosts</option></primary>
32055 </indexterm>
32056 </para>
32057 <informaltable frame="all">
32058 <tgroup cols="4" colsep="0" rowsep="0">
32059 <colspec colwidth="8*" align="left"/>
32060 <colspec colwidth="6*" align="center"/>
32061 <colspec colwidth="6*" align="center"/>
32062 <colspec colwidth="6*" align="right"/>
32063 <tbody>
32064 <row>
32065 <entry><option>smtp_ratelimit_hosts</option></entry>
32066 <entry>Use: <emphasis>main</emphasis></entry>
32067 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32068 <entry>Default: <emphasis>unset</emphasis></entry>
32069 </row>
32070 </tbody>
32071 </tgroup>
32072 </informaltable>
32073 <para>
32074 <indexterm role="concept">
32075 <primary>SMTP</primary>
32076 <secondary>rate limiting</secondary>
32077 </indexterm>
32078 <indexterm role="concept">
32079 <primary>limit</primary>
32080 <secondary>rate of message arrival</secondary>
32081 </indexterm>
32082 <indexterm role="concept">
32083 <primary>RCPT</primary>
32084 <secondary>rate limiting</secondary>
32085 </indexterm>
32086 Some sites find it helpful to be able to limit the rate at which certain hosts
32087 can send them messages, and the rate at which an individual message can specify
32088 recipients.
32089 </para>
32090 <para>
32091 Exim has two rate-limiting facilities. This section describes the older
32092 facility, which can limit rates within a single connection. The newer
32093 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
32094 <xref linkend="SECTratelimiting"/> for details of the newer facility.
32095 </para>
32096 <para>
32097 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
32098 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
32099 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
32100 respectively. Each option, if set, must contain a set of four comma-separated
32101 values:
32102 </para>
32103 <itemizedlist>
32104 <listitem>
32105 <para>
32106 A threshold, before which there is no rate limiting.
32107 </para>
32108 </listitem>
32109 <listitem>
32110 <para>
32111 An initial time delay. Unlike other times in Exim, numbers with decimal
32112 fractional parts are allowed here.
32113 </para>
32114 </listitem>
32115 <listitem>
32116 <para>
32117 A factor by which to increase the delay each time.
32118 </para>
32119 </listitem>
32120 <listitem>
32121 <para>
32122 A maximum value for the delay. This should normally be less than 5 minutes,
32123 because after that time, the client is liable to timeout the SMTP command.
32124 </para>
32125 </listitem>
32126 </itemizedlist>
32127 <para>
32128 For example, these settings have been used successfully at the site which
32129 first suggested this feature, for controlling mail from their customers:
32130 </para>
32131 <literallayout class="monospaced">
32132 smtp_ratelimit_mail = 2,0.5s,1.05,4m
32133 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
32134 </literallayout>
32135 <para>
32136 The first setting specifies delays that are applied to MAIL commands after
32137 two have been received over a single connection. The initial delay is 0.5
32138 seconds, increasing by a factor of 1.05 each time. The second setting applies
32139 delays to RCPT commands when more than four occur in a single message.
32140 </para>
32141 <para>
32142 <indexterm role="option">
32143 <primary><option>smtp_ratelimit_mail</option></primary>
32144 </indexterm>
32145 </para>
32146 <informaltable frame="all">
32147 <tgroup cols="4" colsep="0" rowsep="0">
32148 <colspec colwidth="8*" align="left"/>
32149 <colspec colwidth="6*" align="center"/>
32150 <colspec colwidth="6*" align="center"/>
32151 <colspec colwidth="6*" align="right"/>
32152 <tbody>
32153 <row>
32154 <entry><option>smtp_ratelimit_mail</option></entry>
32155 <entry>Use: <emphasis>main</emphasis></entry>
32156 <entry>Type: <emphasis>string</emphasis></entry>
32157 <entry>Default: <emphasis>unset</emphasis></entry>
32158 </row>
32159 </tbody>
32160 </tgroup>
32161 </informaltable>
32162 <para>
32163 See <option>smtp_ratelimit_hosts</option> above.
32164 </para>
32165 <para>
32166 <indexterm role="option">
32167 <primary><option>smtp_ratelimit_rcpt</option></primary>
32168 </indexterm>
32169 </para>
32170 <informaltable frame="all">
32171 <tgroup cols="4" colsep="0" rowsep="0">
32172 <colspec colwidth="8*" align="left"/>
32173 <colspec colwidth="6*" align="center"/>
32174 <colspec colwidth="6*" align="center"/>
32175 <colspec colwidth="6*" align="right"/>
32176 <tbody>
32177 <row>
32178 <entry><option>smtp_ratelimit_rcpt</option></entry>
32179 <entry>Use: <emphasis>main</emphasis></entry>
32180 <entry>Type: <emphasis>string</emphasis></entry>
32181 <entry>Default: <emphasis>unset</emphasis></entry>
32182 </row>
32183 </tbody>
32184 </tgroup>
32185 </informaltable>
32186 <para>
32187 See <option>smtp_ratelimit_hosts</option> above.
32188 </para>
32189 <para>
32190 <indexterm role="option">
32191 <primary><option>smtp_receive_timeout</option></primary>
32192 </indexterm>
32193 </para>
32194 <informaltable frame="all">
32195 <tgroup cols="4" colsep="0" rowsep="0">
32196 <colspec colwidth="8*" align="left"/>
32197 <colspec colwidth="6*" align="center"/>
32198 <colspec colwidth="6*" align="center"/>
32199 <colspec colwidth="6*" align="right"/>
32200 <tbody>
32201 <row>
32202 <entry><option>smtp_receive_timeout</option></entry>
32203 <entry>Use: <emphasis>main</emphasis></entry>
32204 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
32205 <entry>Default: <emphasis>5m</emphasis></entry>
32206 </row>
32207 </tbody>
32208 </tgroup>
32209 </informaltable>
32210 <para>
32211 <indexterm role="concept">
32212 <primary>timeout</primary>
32213 <secondary>for SMTP input</secondary>
32214 </indexterm>
32215 <indexterm role="concept">
32216 <primary>SMTP</primary>
32217 <secondary>input timeout</secondary>
32218 </indexterm>
32219 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
32220 input, including batch SMTP. If a line of input (either an SMTP command or a
32221 data line) is not received within this time, the SMTP connection is dropped and
32222 the message is abandoned.
32223 A line is written to the log containing one of the following messages:
32224 </para>
32225 <literallayout class="monospaced">
32226 SMTP command timeout on connection from...
32227 SMTP data timeout on connection from...
32228 </literallayout>
32229 <para>
32230 The former means that Exim was expecting to read an SMTP command; the latter
32231 means that it was in the DATA phase, reading the contents of a message.
32232 </para>
32233 <para>
32234 If the first character of the option is a <quote>$</quote> the option is
32235 expanded before use and may depend on
32236 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
32237 </para>
32238 <para>
32239 <indexterm role="option">
32240 <primary><option>-os</option></primary>
32241 </indexterm>
32242 The value set by this option can be overridden by the
32243 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
32244 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
32245 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
32246 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
32247 </para>
32248 <para>
32249 <indexterm role="option">
32250 <primary><option>smtp_reserve_hosts</option></primary>
32251 </indexterm>
32252 </para>
32253 <informaltable frame="all">
32254 <tgroup cols="4" colsep="0" rowsep="0">
32255 <colspec colwidth="8*" align="left"/>
32256 <colspec colwidth="6*" align="center"/>
32257 <colspec colwidth="6*" align="center"/>
32258 <colspec colwidth="6*" align="right"/>
32259 <tbody>
32260 <row>
32261 <entry><option>smtp_reserve_hosts</option></entry>
32262 <entry>Use: <emphasis>main</emphasis></entry>
32263 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32264 <entry>Default: <emphasis>unset</emphasis></entry>
32265 </row>
32266 </tbody>
32267 </tgroup>
32268 </informaltable>
32269 <para>
32270 This option defines hosts for which SMTP connections are reserved; see
32271 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
32272 </para>
32273 <para>
32274 <indexterm role="option">
32275 <primary><option>smtp_return_error_details</option></primary>
32276 </indexterm>
32277 </para>
32278 <informaltable frame="all">
32279 <tgroup cols="4" colsep="0" rowsep="0">
32280 <colspec colwidth="8*" align="left"/>
32281 <colspec colwidth="6*" align="center"/>
32282 <colspec colwidth="6*" align="center"/>
32283 <colspec colwidth="6*" align="right"/>
32284 <tbody>
32285 <row>
32286 <entry><option>smtp_return_error_details</option></entry>
32287 <entry>Use: <emphasis>main</emphasis></entry>
32288 <entry>Type: <emphasis>boolean</emphasis></entry>
32289 <entry>Default: <emphasis>false</emphasis></entry>
32290 </row>
32291 </tbody>
32292 </tgroup>
32293 </informaltable>
32294 <para>
32295 <indexterm role="concept">
32296 <primary>SMTP</primary>
32297 <secondary>details policy failures</secondary>
32298 </indexterm>
32299 <indexterm role="concept">
32300 <primary>policy control</primary>
32301 <secondary>rejection, returning details</secondary>
32302 </indexterm>
32303 In the default state, Exim uses bland messages such as
32304 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
32305 reasons. Many sysadmins like this because it gives away little information
32306 to spammers. However, some other sysadmins who are applying strict checking
32307 policies want to give out much fuller information about failures. Setting
32308 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
32309 example, instead of <quote>Administrative prohibition</quote>, it might give:
32310 </para>
32311 <literallayout class="monospaced">
32312 550-Rejected after DATA: '&gt;' missing at end of address:
32313 550 failing address in "From" header is: &lt;user@dom.ain
32314 </literallayout>
32315 <para>
32316 <indexterm role="option">
32317 <primary><option>smtputf8_advertise_hosts</option></primary>
32318 </indexterm>
32319 </para>
32320 <informaltable frame="all">
32321 <tgroup cols="4" colsep="0" rowsep="0">
32322 <colspec colwidth="8*" align="left"/>
32323 <colspec colwidth="6*" align="center"/>
32324 <colspec colwidth="6*" align="center"/>
32325 <colspec colwidth="6*" align="right"/>
32326 <tbody>
32327 <row>
32328 <entry><option>smtputf8_advertise_hosts</option></entry>
32329 <entry>Use: <emphasis>main</emphasis></entry>
32330 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32331 <entry>Default: <emphasis>*</emphasis></entry>
32332 </row>
32333 </tbody>
32334 </tgroup>
32335 </informaltable>
32336 <para>
32337 <indexterm role="concept">
32338 <primary>SMTPUTF8</primary>
32339 <secondary>ESMTP extension, advertising</secondary>
32340 </indexterm>
32341 <indexterm role="concept">
32342 <primary>ESMTP extensions</primary>
32343 <secondary>SMTPUTF8</secondary>
32344 </indexterm>
32345 When Exim is built with support for internationalised mail names,
32346 the availability thereof is advertised in
32347 response to EHLO only to those client hosts that match this option. See
32348 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
32349 </para>
32350 <para>
32351 <indexterm role="option">
32352 <primary><option>spamd_address</option></primary>
32353 </indexterm>
32354 </para>
32355 <informaltable frame="all">
32356 <tgroup cols="4" colsep="0" rowsep="0">
32357 <colspec colwidth="8*" align="left"/>
32358 <colspec colwidth="6*" align="center"/>
32359 <colspec colwidth="6*" align="center"/>
32360 <colspec colwidth="6*" align="right"/>
32361 <tbody>
32362 <row>
32363 <entry><option>spamd_address</option></entry>
32364 <entry>Use: <emphasis>main</emphasis></entry>
32365 <entry>Type: <emphasis>string</emphasis></entry>
32366 <entry>Default: <emphasis>127.0.0.1 783</emphasis></entry>
32367 </row>
32368 </tbody>
32369 </tgroup>
32370 </informaltable>
32371 <para>
32372 This option is available when Exim is compiled with the content-scanning
32373 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
32374 See section <xref linkend="SECTscanspamass"/> for more details.
32375 </para>
32376 <para>
32377 <indexterm role="option">
32378 <primary><option>spf_guess</option></primary>
32379 </indexterm>
32380 </para>
32381 <informaltable frame="all">
32382 <tgroup cols="4" colsep="0" rowsep="0">
32383 <colspec colwidth="8*" align="left"/>
32384 <colspec colwidth="6*" align="center"/>
32385 <colspec colwidth="6*" align="center"/>
32386 <colspec colwidth="6*" align="right"/>
32387 <tbody>
32388 <row>
32389 <entry><option>spf_guess</option></entry>
32390 <entry>Use: <emphasis>main</emphasis></entry>
32391 <entry>Type: <emphasis>string</emphasis></entry>
32392 <entry>Default: <emphasis>v=spf1 a/24 mx/24 ptr ?all</emphasis></entry>
32393 </row>
32394 </tbody>
32395 </tgroup>
32396 </informaltable>
32397 <para>
32398 This option is available when Exim is compiled with SPF support.
32399 See section <xref linkend="SECSPF"/> for more details.
32400 </para>
32401 <para revisionflag="changed">
32402 <indexterm role="option">
32403 <primary><option>spf_smtp_comment_template</option></primary>
32404 </indexterm>
32405 </para>
32406 <informaltable frame="all" revisionflag="changed">
32407 <tgroup cols="4" colsep="0" rowsep="0">
32408 <colspec colwidth="8*" align="left"/>
32409 <colspec colwidth="6*" align="center"/>
32410 <colspec colwidth="6*" align="center"/>
32411 <colspec colwidth="6*" align="right"/>
32412 <tbody>
32413 <row>
32414 <entry><option>spf_smtp_comment_template</option></entry>
32415 <entry>Use: <emphasis>main</emphasis></entry>
32416 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32417 <entry>Default: <emphasis>Please%_see%_http://www.open-spf.org/Why</emphasis></entry>
32418 </row>
32419 </tbody>
32420 </tgroup>
32421 </informaltable>
32422 <para revisionflag="changed">
32423 This option is available when Exim is compiled with SPF support.  It
32424 allows the customisation of the SMTP comment that the SPF library
32425 generates.  You are strongly encouraged to link to your own explanative
32426 site. The template must not contain spaces. If you need spaces in the
32427 output, use the proper placeholder. If libspf2 can not parse the
32428 template, it uses a built-in default broken link. The following placeholders
32429 (along with Exim variables (but see below)) are allowed in the template:
32430 </para>
32431 <itemizedlist revisionflag="changed">
32432 <listitem>
32433 <para revisionflag="changed">
32434 <emphasis role="bold">%_</emphasis>: A space.
32435 </para>
32436 </listitem>
32437 <listitem>
32438 <para revisionflag="changed">
32439 <emphasis role="bold">%{L}</emphasis>: Envelope sender&#x2019;s local part.
32440 </para>
32441 </listitem>
32442 <listitem>
32443 <para revisionflag="changed">
32444 <emphasis role="bold">%{S}</emphasis>: Envelope sender.
32445 </para>
32446 </listitem>
32447 <listitem>
32448 <para revisionflag="changed">
32449 <emphasis role="bold">%{O}</emphasis>: Envelope sender&#x2019;s domain.
32450 </para>
32451 </listitem>
32452 <listitem>
32453 <para revisionflag="changed">
32454 <emphasis role="bold">%{D}</emphasis>: Current(?) domain.
32455 </para>
32456 </listitem>
32457 <listitem>
32458 <para revisionflag="changed">
32459 <emphasis role="bold">%{I}</emphasis>: SMTP client Ip.
32460 </para>
32461 </listitem>
32462 <listitem>
32463 <para revisionflag="changed">
32464 <emphasis role="bold">%{C}</emphasis>: SMTP client pretty IP.
32465 </para>
32466 </listitem>
32467 <listitem>
32468 <para revisionflag="changed">
32469 <emphasis role="bold">%{T}</emphasis>: Epoch time (UTC).
32470 </para>
32471 </listitem>
32472 <listitem>
32473 <para revisionflag="changed">
32474 <emphasis role="bold">%{P}</emphasis>: SMTP client domain name.
32475 </para>
32476 </listitem>
32477 <listitem>
32478 <para revisionflag="changed">
32479 <emphasis role="bold">%{V}</emphasis>: IP version.
32480 </para>
32481 </listitem>
32482 <listitem>
32483 <para revisionflag="changed">
32484 <emphasis role="bold">%{H}</emphasis>: EHLO/HELO domain.
32485 </para>
32486 </listitem>
32487 <listitem>
32488 <para revisionflag="changed">
32489 <emphasis role="bold">%{R}</emphasis>: Receiving domain.
32490 </para>
32491 </listitem>
32492 </itemizedlist>
32493 <para revisionflag="changed">
32494 The capitalized placeholders do proper URL encoding, if you use them
32495 lowercased, no encoding takes place.  This list was compiled from the
32496 libspf2 sources.
32497 </para>
32498 <para revisionflag="changed">
32499 A note on using Exim variables: As
32500 currently the SPF library is initialized before the SMTP EHLO phase,
32501 the variables useful for expansion are quite limited.
32502 </para>
32503 <para>
32504 <indexterm role="option">
32505 <primary><option>split_spool_directory</option></primary>
32506 </indexterm>
32507 </para>
32508 <informaltable frame="all">
32509 <tgroup cols="4" colsep="0" rowsep="0">
32510 <colspec colwidth="8*" align="left"/>
32511 <colspec colwidth="6*" align="center"/>
32512 <colspec colwidth="6*" align="center"/>
32513 <colspec colwidth="6*" align="right"/>
32514 <tbody>
32515 <row>
32516 <entry><option>split_spool_directory</option></entry>
32517 <entry>Use: <emphasis>main</emphasis></entry>
32518 <entry>Type: <emphasis>boolean</emphasis></entry>
32519 <entry>Default: <emphasis>false</emphasis></entry>
32520 </row>
32521 </tbody>
32522 </tgroup>
32523 </informaltable>
32524 <para>
32525 <indexterm role="concept">
32526 <primary>multiple spool directories</primary>
32527 </indexterm>
32528 <indexterm role="concept">
32529 <primary>spool directory</primary>
32530 <secondary>split</secondary>
32531 </indexterm>
32532 <indexterm role="concept">
32533 <primary>directories, multiple</primary>
32534 </indexterm>
32535 If this option is set, it causes Exim to split its input directory into 62
32536 subdirectories, each with a single alphanumeric character as its name. The
32537 sixth character of the message id is used to allocate messages to
32538 subdirectories; this is the least significant base-62 digit of the time of
32539 arrival of the message.
32540 </para>
32541 <para>
32542 Splitting up the spool in this way may provide better performance on systems
32543 where there are long mail queues, by reducing the number of files in any one
32544 directory. The msglog directory is also split up in a similar way to the input
32545 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
32546 are still placed in the single directory <filename>msglog.OLD</filename>.
32547 </para>
32548 <para>
32549 It is not necessary to take any special action for existing messages when
32550 changing <option>split_spool_directory</option>. Exim notices messages that are in the
32551 <quote>wrong</quote> place, and continues to process them. If the option is turned off
32552 after a period of being on, the subdirectories will eventually empty and be
32553 automatically deleted.
32554 </para>
32555 <para>
32556 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
32557 changes. Instead of creating a list of all messages in the queue, and then
32558 trying to deliver each one, in turn, it constructs a list of those in one
32559 sub-directory and tries to deliver them, before moving on to the next
32560 sub-directory. The sub-directories are processed in a random order. This
32561 spreads out the scanning of the input directories, and uses less memory. It is
32562 particularly beneficial when there are lots of messages in the queue. However,
32563 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
32564 entire queue has to be scanned and sorted before any deliveries can start.
32565 </para>
32566 <para>
32567 <indexterm role="option">
32568 <primary><option>spool_directory</option></primary>
32569 </indexterm>
32570 </para>
32571 <informaltable frame="all">
32572 <tgroup cols="4" colsep="0" rowsep="0">
32573 <colspec colwidth="8*" align="left"/>
32574 <colspec colwidth="6*" align="center"/>
32575 <colspec colwidth="6*" align="center"/>
32576 <colspec colwidth="6*" align="right"/>
32577 <tbody>
32578 <row>
32579 <entry><option>spool_directory</option></entry>
32580 <entry>Use: <emphasis>main</emphasis></entry>
32581 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32582 <entry>Default: <emphasis>set at compile time</emphasis></entry>
32583 </row>
32584 </tbody>
32585 </tgroup>
32586 </informaltable>
32587 <para>
32588 <indexterm role="concept">
32589 <primary>spool directory</primary>
32590 <secondary>path to</secondary>
32591 </indexterm>
32592 This defines the directory in which Exim keeps its spool, that is, the messages
32593 it is waiting to deliver. The default value is taken from the compile-time
32594 configuration setting, if there is one. If not, this option must be set. The
32595 string is expanded, so it can contain, for example, a reference to
32596 <varname>$primary_hostname</varname>.
32597 </para>
32598 <para>
32599 If the spool directory name is fixed on your installation, it is recommended
32600 that you set it at build time rather than from this option, particularly if the
32601 log files are being written to the spool directory (see <option>log_file_path</option>).
32602 Otherwise log files cannot be used for errors that are detected early on, such
32603 as failures in the configuration file.
32604 </para>
32605 <para>
32606 By using this option to override the compiled-in path, it is possible to run
32607 tests of Exim without using the standard spool.
32608 </para>
32609 <para>
32610 <indexterm role="option">
32611 <primary><option>spool_wireformat</option></primary>
32612 </indexterm>
32613 </para>
32614 <informaltable frame="all">
32615 <tgroup cols="4" colsep="0" rowsep="0">
32616 <colspec colwidth="8*" align="left"/>
32617 <colspec colwidth="6*" align="center"/>
32618 <colspec colwidth="6*" align="center"/>
32619 <colspec colwidth="6*" align="right"/>
32620 <tbody>
32621 <row>
32622 <entry><option>spool_wireformat</option></entry>
32623 <entry>Use: <emphasis>main</emphasis></entry>
32624 <entry>Type: <emphasis>boolean</emphasis></entry>
32625 <entry>Default: <emphasis>false</emphasis></entry>
32626 </row>
32627 </tbody>
32628 </tgroup>
32629 </informaltable>
32630 <para>
32631 <indexterm role="concept">
32632 <primary>spool directory</primary>
32633 <secondary>file formats</secondary>
32634 </indexterm>
32635 If this option is set, Exim may for some messages use an alternative format
32636 for data-files in the spool which matches the wire format.
32637 Doing this permits more efficient message reception and transmission.
32638 Currently it is only done for messages received using the ESMTP CHUNKING
32639 option.
32640 </para>
32641 <para>
32642 The following variables will not have useful values:
32643 </para>
32644 <literallayout class="monospaced">
32645 $max_received_linelength
32646 $body_linecount
32647 $body_zerocount
32648 </literallayout>
32649 <para>
32650 Users of the local_scan() API (see <xref linkend="CHAPlocalscan"/>),
32651 and any external programs which are passed a reference to a message data file
32652 (except via the <quote>regex</quote>, <quote>malware</quote> or <quote>spam</quote>) ACL conditions)
32653 will need to be aware of the different formats potentially available.
32654 </para>
32655 <para>
32656 Using any of the ACL conditions noted will negate the reception benefit
32657 (as a Unix-mbox-format file is constructed for them).
32658 The transmission benefit is maintained.
32659 </para>
32660 <para>
32661 <indexterm role="option">
32662 <primary><option>sqlite_lock_timeout</option></primary>
32663 </indexterm>
32664 </para>
32665 <informaltable frame="all">
32666 <tgroup cols="4" colsep="0" rowsep="0">
32667 <colspec colwidth="8*" align="left"/>
32668 <colspec colwidth="6*" align="center"/>
32669 <colspec colwidth="6*" align="center"/>
32670 <colspec colwidth="6*" align="right"/>
32671 <tbody>
32672 <row>
32673 <entry><option>sqlite_lock_timeout</option></entry>
32674 <entry>Use: <emphasis>main</emphasis></entry>
32675 <entry>Type: <emphasis>time</emphasis></entry>
32676 <entry>Default: <emphasis>5s</emphasis></entry>
32677 </row>
32678 </tbody>
32679 </tgroup>
32680 </informaltable>
32681 <para>
32682 <indexterm role="concept">
32683 <primary>sqlite lookup type</primary>
32684 <secondary>lock timeout</secondary>
32685 </indexterm>
32686 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
32687 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
32688 </para>
32689 <para>
32690 <indexterm role="option">
32691 <primary><option>strict_acl_vars</option></primary>
32692 </indexterm>
32693 </para>
32694 <informaltable frame="all">
32695 <tgroup cols="4" colsep="0" rowsep="0">
32696 <colspec colwidth="8*" align="left"/>
32697 <colspec colwidth="6*" align="center"/>
32698 <colspec colwidth="6*" align="center"/>
32699 <colspec colwidth="6*" align="right"/>
32700 <tbody>
32701 <row>
32702 <entry><option>strict_acl_vars</option></entry>
32703 <entry>Use: <emphasis>main</emphasis></entry>
32704 <entry>Type: <emphasis>boolean</emphasis></entry>
32705 <entry>Default: <emphasis>false</emphasis></entry>
32706 </row>
32707 </tbody>
32708 </tgroup>
32709 </informaltable>
32710 <para>
32711 <indexterm role="concept">
32712 <primary>access control lists (ACLs)</primary>
32713 <secondary>variables, handling unset</secondary>
32714 </indexterm>
32715 This option controls what happens if a syntactically valid but undefined ACL
32716 variable is referenced. If it is false (the default), an empty string
32717 is substituted; if it is true, an error is generated. See section
32718 <xref linkend="SECTaclvariables"/> for details of ACL variables.
32719 </para>
32720 <para>
32721 <indexterm role="option">
32722 <primary><option>strip_excess_angle_brackets</option></primary>
32723 </indexterm>
32724 </para>
32725 <informaltable frame="all">
32726 <tgroup cols="4" colsep="0" rowsep="0">
32727 <colspec colwidth="8*" align="left"/>
32728 <colspec colwidth="6*" align="center"/>
32729 <colspec colwidth="6*" align="center"/>
32730 <colspec colwidth="6*" align="right"/>
32731 <tbody>
32732 <row>
32733 <entry><option>strip_excess_angle_brackets</option></entry>
32734 <entry>Use: <emphasis>main</emphasis></entry>
32735 <entry>Type: <emphasis>boolean</emphasis></entry>
32736 <entry>Default: <emphasis>false</emphasis></entry>
32737 </row>
32738 </tbody>
32739 </tgroup>
32740 </informaltable>
32741 <para>
32742 <indexterm role="concept">
32743 <primary>angle brackets, excess</primary>
32744 </indexterm>
32745 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
32746 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
32747 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
32748 passed on to another MTA, the excess angle brackets are not passed on. If this
32749 option is not set, multiple pairs of angle brackets cause a syntax error.
32750 </para>
32751 <para>
32752 <indexterm role="option">
32753 <primary><option>strip_trailing_dot</option></primary>
32754 </indexterm>
32755 </para>
32756 <informaltable frame="all">
32757 <tgroup cols="4" colsep="0" rowsep="0">
32758 <colspec colwidth="8*" align="left"/>
32759 <colspec colwidth="6*" align="center"/>
32760 <colspec colwidth="6*" align="center"/>
32761 <colspec colwidth="6*" align="right"/>
32762 <tbody>
32763 <row>
32764 <entry><option>strip_trailing_dot</option></entry>
32765 <entry>Use: <emphasis>main</emphasis></entry>
32766 <entry>Type: <emphasis>boolean</emphasis></entry>
32767 <entry>Default: <emphasis>false</emphasis></entry>
32768 </row>
32769 </tbody>
32770 </tgroup>
32771 </informaltable>
32772 <para>
32773 <indexterm role="concept">
32774 <primary>trailing dot on domain</primary>
32775 </indexterm>
32776 <indexterm role="concept">
32777 <primary>dot</primary>
32778 <secondary>trailing on domain</secondary>
32779 </indexterm>
32780 If this option is set, a trailing dot at the end of a domain in an address is
32781 ignored. If this is in the envelope and the message is passed on to another
32782 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
32783 domain causes a syntax error.
32784 However, addresses in header lines are checked only when an ACL requests header
32785 syntax checking.
32786 </para>
32787 <para>
32788 <indexterm role="option">
32789 <primary><option>syslog_duplication</option></primary>
32790 </indexterm>
32791 </para>
32792 <informaltable frame="all">
32793 <tgroup cols="4" colsep="0" rowsep="0">
32794 <colspec colwidth="8*" align="left"/>
32795 <colspec colwidth="6*" align="center"/>
32796 <colspec colwidth="6*" align="center"/>
32797 <colspec colwidth="6*" align="right"/>
32798 <tbody>
32799 <row>
32800 <entry><option>syslog_duplication</option></entry>
32801 <entry>Use: <emphasis>main</emphasis></entry>
32802 <entry>Type: <emphasis>boolean</emphasis></entry>
32803 <entry>Default: <emphasis>true</emphasis></entry>
32804 </row>
32805 </tbody>
32806 </tgroup>
32807 </informaltable>
32808 <para>
32809 <indexterm role="concept">
32810 <primary>syslog</primary>
32811 <secondary>duplicate log lines; suppressing</secondary>
32812 </indexterm>
32813 When Exim is logging to syslog, it writes the log lines for its three
32814 separate logs at different syslog priorities so that they can in principle
32815 be separated on the logging hosts. Some installations do not require this
32816 separation, and in those cases, the duplication of certain log lines is a
32817 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
32818 particular log line is written to syslog. For lines that normally go to
32819 both the main log and the reject log, the reject log version (possibly
32820 containing message header lines) is written, at LOG_NOTICE priority.
32821 Lines that normally go to both the main and the panic log are written at
32822 the LOG_ALERT priority.
32823 </para>
32824 <para>
32825 <indexterm role="option">
32826 <primary><option>syslog_facility</option></primary>
32827 </indexterm>
32828 </para>
32829 <informaltable frame="all">
32830 <tgroup cols="4" colsep="0" rowsep="0">
32831 <colspec colwidth="8*" align="left"/>
32832 <colspec colwidth="6*" align="center"/>
32833 <colspec colwidth="6*" align="center"/>
32834 <colspec colwidth="6*" align="right"/>
32835 <tbody>
32836 <row>
32837 <entry><option>syslog_facility</option></entry>
32838 <entry>Use: <emphasis>main</emphasis></entry>
32839 <entry>Type: <emphasis>string</emphasis></entry>
32840 <entry>Default: <emphasis>unset</emphasis></entry>
32841 </row>
32842 </tbody>
32843 </tgroup>
32844 </informaltable>
32845 <para>
32846 <indexterm role="concept">
32847 <primary>syslog</primary>
32848 <secondary>facility; setting</secondary>
32849 </indexterm>
32850 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
32851 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
32852 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
32853 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
32854 details of Exim&#x2019;s logging.
32855 </para>
32856 <para>
32857 <indexterm role="option">
32858 <primary><option>syslog_pid</option></primary>
32859 </indexterm>
32860 </para>
32861 <informaltable frame="all">
32862 <tgroup cols="4" colsep="0" rowsep="0">
32863 <colspec colwidth="8*" align="left"/>
32864 <colspec colwidth="6*" align="center"/>
32865 <colspec colwidth="6*" align="center"/>
32866 <colspec colwidth="6*" align="right"/>
32867 <tbody>
32868 <row>
32869 <entry><option>syslog_pid</option></entry>
32870 <entry>Use: <emphasis>main</emphasis></entry>
32871 <entry>Type: <emphasis>boolean</emphasis></entry>
32872 <entry>Default: <emphasis>true</emphasis></entry>
32873 </row>
32874 </tbody>
32875 </tgroup>
32876 </informaltable>
32877 <para>
32878 <indexterm role="concept">
32879 <primary>syslog</primary>
32880 <secondary>pid</secondary>
32881 </indexterm>
32882 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
32883 omitted when these lines are sent to syslog. (Syslog normally prefixes
32884 the log lines with the PID of the logging process automatically.) You need
32885 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
32886 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
32887 </para>
32888 <para>
32889 <indexterm role="option">
32890 <primary><option>syslog_processname</option></primary>
32891 </indexterm>
32892 </para>
32893 <informaltable frame="all">
32894 <tgroup cols="4" colsep="0" rowsep="0">
32895 <colspec colwidth="8*" align="left"/>
32896 <colspec colwidth="6*" align="center"/>
32897 <colspec colwidth="6*" align="center"/>
32898 <colspec colwidth="6*" align="right"/>
32899 <tbody>
32900 <row>
32901 <entry><option>syslog_processname</option></entry>
32902 <entry>Use: <emphasis>main</emphasis></entry>
32903 <entry>Type: <emphasis>string</emphasis></entry>
32904 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
32905 </row>
32906 </tbody>
32907 </tgroup>
32908 </informaltable>
32909 <para>
32910 <indexterm role="concept">
32911 <primary>syslog</primary>
32912 <secondary>process name; setting</secondary>
32913 </indexterm>
32914 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
32915 syslog. The value must be no longer than 32 characters. See chapter
32916 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
32917 </para>
32918 <para>
32919 <indexterm role="option">
32920 <primary><option>syslog_timestamp</option></primary>
32921 </indexterm>
32922 </para>
32923 <informaltable frame="all">
32924 <tgroup cols="4" colsep="0" rowsep="0">
32925 <colspec colwidth="8*" align="left"/>
32926 <colspec colwidth="6*" align="center"/>
32927 <colspec colwidth="6*" align="center"/>
32928 <colspec colwidth="6*" align="right"/>
32929 <tbody>
32930 <row>
32931 <entry><option>syslog_timestamp</option></entry>
32932 <entry>Use: <emphasis>main</emphasis></entry>
32933 <entry>Type: <emphasis>boolean</emphasis></entry>
32934 <entry>Default: <emphasis>true</emphasis></entry>
32935 </row>
32936 </tbody>
32937 </tgroup>
32938 </informaltable>
32939 <para>
32940 <indexterm role="concept">
32941 <primary>syslog</primary>
32942 <secondary>timestamps</secondary>
32943 </indexterm>
32944 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
32945 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
32946 details of Exim&#x2019;s logging.
32947 </para>
32948 <para>
32949 <indexterm role="option">
32950 <primary><option>system_filter</option></primary>
32951 </indexterm>
32952 </para>
32953 <informaltable frame="all">
32954 <tgroup cols="4" colsep="0" rowsep="0">
32955 <colspec colwidth="8*" align="left"/>
32956 <colspec colwidth="6*" align="center"/>
32957 <colspec colwidth="6*" align="center"/>
32958 <colspec colwidth="6*" align="right"/>
32959 <tbody>
32960 <row>
32961 <entry><option>system_filter</option></entry>
32962 <entry>Use: <emphasis>main</emphasis></entry>
32963 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32964 <entry>Default: <emphasis>unset</emphasis></entry>
32965 </row>
32966 </tbody>
32967 </tgroup>
32968 </informaltable>
32969 <para>
32970 <indexterm role="concept">
32971 <primary>filter</primary>
32972 <secondary>system filter</secondary>
32973 </indexterm>
32974 <indexterm role="concept">
32975 <primary>system filter</primary>
32976 <secondary>specifying</secondary>
32977 </indexterm>
32978 <indexterm role="concept">
32979 <primary>Sieve filter</primary>
32980 <secondary>not available for system filter</secondary>
32981 </indexterm>
32982 This option specifies an Exim filter file that is applied to all messages at
32983 the start of each delivery attempt, before any routing is done. System filters
32984 must be Exim filters; they cannot be Sieve filters. If the system filter
32985 generates any deliveries to files or pipes, or any new mail messages, the
32986 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
32987 which transports are to be used. Details of this facility are given in chapter
32988 <xref linkend="CHAPsystemfilter"/>.
32989 A forced expansion failure results in no filter operation.
32990 </para>
32991 <para>
32992 <indexterm role="option">
32993 <primary><option>system_filter_directory_transport</option></primary>
32994 </indexterm>
32995 </para>
32996 <informaltable frame="all">
32997 <tgroup cols="4" colsep="0" rowsep="0">
32998 <colspec colwidth="8*" align="left"/>
32999 <colspec colwidth="6*" align="center"/>
33000 <colspec colwidth="6*" align="center"/>
33001 <colspec colwidth="6*" align="right"/>
33002 <tbody>
33003 <row>
33004 <entry><option>system_filter_directory_transport</option></entry>
33005 <entry>Use: <emphasis>main</emphasis></entry>
33006 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33007 <entry>Default: <emphasis>unset</emphasis></entry>
33008 </row>
33009 </tbody>
33010 </tgroup>
33011 </informaltable>
33012 <para>
33013 <indexterm role="variable">
33014 <primary><varname>$address_file</varname></primary>
33015 </indexterm>
33016 This sets the name of the transport driver that is to be used when the
33017 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
33018 implying delivery of each message into a separate file in some directory.
33019 During the delivery, the variable <varname>$address_file</varname> contains the path name.
33020 </para>
33021 <para>
33022 <indexterm role="option">
33023 <primary><option>system_filter_file_transport</option></primary>
33024 </indexterm>
33025 </para>
33026 <informaltable frame="all">
33027 <tgroup cols="4" colsep="0" rowsep="0">
33028 <colspec colwidth="8*" align="left"/>
33029 <colspec colwidth="6*" align="center"/>
33030 <colspec colwidth="6*" align="center"/>
33031 <colspec colwidth="6*" align="right"/>
33032 <tbody>
33033 <row>
33034 <entry><option>system_filter_file_transport</option></entry>
33035 <entry>Use: <emphasis>main</emphasis></entry>
33036 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33037 <entry>Default: <emphasis>unset</emphasis></entry>
33038 </row>
33039 </tbody>
33040 </tgroup>
33041 </informaltable>
33042 <para>
33043 <indexterm role="concept">
33044 <primary>file</primary>
33045 <secondary>transport for system filter</secondary>
33046 </indexterm>
33047 This sets the name of the transport driver that is to be used when the <option>save</option>
33048 command in a system message filter specifies a path not ending in <quote>/</quote>. During
33049 the delivery, the variable <varname>$address_file</varname> contains the path name.
33050 </para>
33051 <para>
33052 <indexterm role="option">
33053 <primary><option>system_filter_group</option></primary>
33054 </indexterm>
33055 </para>
33056 <informaltable frame="all">
33057 <tgroup cols="4" colsep="0" rowsep="0">
33058 <colspec colwidth="8*" align="left"/>
33059 <colspec colwidth="6*" align="center"/>
33060 <colspec colwidth="6*" align="center"/>
33061 <colspec colwidth="6*" align="right"/>
33062 <tbody>
33063 <row>
33064 <entry><option>system_filter_group</option></entry>
33065 <entry>Use: <emphasis>main</emphasis></entry>
33066 <entry>Type: <emphasis>string</emphasis></entry>
33067 <entry>Default: <emphasis>unset</emphasis></entry>
33068 </row>
33069 </tbody>
33070 </tgroup>
33071 </informaltable>
33072 <para>
33073 <indexterm role="concept">
33074 <primary>gid (group id)</primary>
33075 <secondary>system filter</secondary>
33076 </indexterm>
33077 This option is used only when <option>system_filter_user</option> is also set. It sets the
33078 gid under which the system filter is run, overriding any gid that is associated
33079 with the user. The value may be numerical or symbolic.
33080 </para>
33081 <para>
33082 <indexterm role="option">
33083 <primary><option>system_filter_pipe_transport</option></primary>
33084 </indexterm>
33085 </para>
33086 <informaltable frame="all">
33087 <tgroup cols="4" colsep="0" rowsep="0">
33088 <colspec colwidth="8*" align="left"/>
33089 <colspec colwidth="6*" align="center"/>
33090 <colspec colwidth="6*" align="center"/>
33091 <colspec colwidth="6*" align="right"/>
33092 <tbody>
33093 <row>
33094 <entry><option>system_filter_pipe_transport</option></entry>
33095 <entry>Use: <emphasis>main</emphasis></entry>
33096 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33097 <entry>Default: <emphasis>unset</emphasis></entry>
33098 </row>
33099 </tbody>
33100 </tgroup>
33101 </informaltable>
33102 <para>
33103 <indexterm role="concept">
33104 <primary><command>pipe</command> transport</primary>
33105 <secondary>for system filter</secondary>
33106 </indexterm>
33107 <indexterm role="variable">
33108 <primary><varname>$address_pipe</varname></primary>
33109 </indexterm>
33110 This specifies the transport driver that is to be used when a <option>pipe</option> command
33111 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
33112 contains the pipe command.
33113 </para>
33114 <para>
33115 <indexterm role="option">
33116 <primary><option>system_filter_reply_transport</option></primary>
33117 </indexterm>
33118 </para>
33119 <informaltable frame="all">
33120 <tgroup cols="4" colsep="0" rowsep="0">
33121 <colspec colwidth="8*" align="left"/>
33122 <colspec colwidth="6*" align="center"/>
33123 <colspec colwidth="6*" align="center"/>
33124 <colspec colwidth="6*" align="right"/>
33125 <tbody>
33126 <row>
33127 <entry><option>system_filter_reply_transport</option></entry>
33128 <entry>Use: <emphasis>main</emphasis></entry>
33129 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33130 <entry>Default: <emphasis>unset</emphasis></entry>
33131 </row>
33132 </tbody>
33133 </tgroup>
33134 </informaltable>
33135 <para>
33136 <indexterm role="concept">
33137 <primary><command>autoreply</command> transport</primary>
33138 <secondary>for system filter</secondary>
33139 </indexterm>
33140 This specifies the transport driver that is to be used when a <option>mail</option> command
33141 is used in a system filter.
33142 </para>
33143 <para>
33144 <indexterm role="option">
33145 <primary><option>system_filter_user</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>system_filter_user</option></entry>
33157 <entry>Use: <emphasis>main</emphasis></entry>
33158 <entry>Type: <emphasis>string</emphasis></entry>
33159 <entry>Default: <emphasis>unset</emphasis></entry>
33160 </row>
33161 </tbody>
33162 </tgroup>
33163 </informaltable>
33164 <para>
33165 <indexterm role="concept">
33166 <primary>uid (user id)</primary>
33167 <secondary>system filter</secondary>
33168 </indexterm>
33169 If this option is set to root, the system filter is run in the main Exim
33170 delivery process, as root.  Otherwise, the system filter runs in a separate
33171 process, as the given user, defaulting to the Exim run-time user.
33172 Unless the string consists entirely of digits, it
33173 is looked up in the password data. Failure to find the named user causes a
33174 configuration error. The gid is either taken from the password data, or
33175 specified by <option>system_filter_group</option>. When the uid is specified numerically,
33176 <option>system_filter_group</option> is required to be set.
33177 </para>
33178 <para>
33179 If the system filter generates any pipe, file, or reply deliveries, the uid
33180 under which the filter is run is used when transporting them, unless a
33181 transport option overrides.
33182 </para>
33183 <para>
33184 <indexterm role="option">
33185 <primary><option>tcp_nodelay</option></primary>
33186 </indexterm>
33187 </para>
33188 <informaltable frame="all">
33189 <tgroup cols="4" colsep="0" rowsep="0">
33190 <colspec colwidth="8*" align="left"/>
33191 <colspec colwidth="6*" align="center"/>
33192 <colspec colwidth="6*" align="center"/>
33193 <colspec colwidth="6*" align="right"/>
33194 <tbody>
33195 <row>
33196 <entry><option>tcp_nodelay</option></entry>
33197 <entry>Use: <emphasis>main</emphasis></entry>
33198 <entry>Type: <emphasis>boolean</emphasis></entry>
33199 <entry>Default: <emphasis>true</emphasis></entry>
33200 </row>
33201 </tbody>
33202 </tgroup>
33203 </informaltable>
33204 <para>
33205 <indexterm role="concept">
33206 <primary>daemon</primary>
33207 <secondary>TCP_NODELAY on sockets</secondary>
33208 </indexterm>
33209 <indexterm role="concept">
33210 <primary>Nagle algorithm</primary>
33211 </indexterm>
33212 <indexterm role="concept">
33213 <primary>TCP_NODELAY on listening sockets</primary>
33214 </indexterm>
33215 If this option is set false, it stops the Exim daemon setting the
33216 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
33217 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
33218 performance in interactive (character-by-character) situations. Turning it off
33219 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
33220 However, it appears that some broken clients cannot cope, and time out. Hence
33221 this option. It affects only those sockets that are set up for listening by the
33222 daemon. Sockets created by the smtp transport for delivering mail always set
33223 TCP_NODELAY.
33224 </para>
33225 <para>
33226 <indexterm role="option">
33227 <primary><option>timeout_frozen_after</option></primary>
33228 </indexterm>
33229 </para>
33230 <informaltable frame="all">
33231 <tgroup cols="4" colsep="0" rowsep="0">
33232 <colspec colwidth="8*" align="left"/>
33233 <colspec colwidth="6*" align="center"/>
33234 <colspec colwidth="6*" align="center"/>
33235 <colspec colwidth="6*" align="right"/>
33236 <tbody>
33237 <row>
33238 <entry><option>timeout_frozen_after</option></entry>
33239 <entry>Use: <emphasis>main</emphasis></entry>
33240 <entry>Type: <emphasis>time</emphasis></entry>
33241 <entry>Default: <emphasis>0s</emphasis></entry>
33242 </row>
33243 </tbody>
33244 </tgroup>
33245 </informaltable>
33246 <para>
33247 <indexterm role="concept">
33248 <primary>frozen messages</primary>
33249 <secondary>timing out</secondary>
33250 </indexterm>
33251 <indexterm role="concept">
33252 <primary>timeout</primary>
33253 <secondary>frozen messages</secondary>
33254 </indexterm>
33255 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
33256 message of any kind that has been in the queue for longer than the given time
33257 is automatically cancelled at the next queue run. If the frozen message is a
33258 bounce message, it is just discarded; otherwise, a bounce is sent to the
33259 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
33260 If you want to timeout frozen bounce messages earlier than other kinds of
33261 frozen message, see <option>ignore_bounce_errors_after</option>.
33262 </para>
33263 <para>
33264 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
33265 frozen messages remain in the queue forever (except for any frozen bounce
33266 messages that are released by <option>ignore_bounce_errors_after</option>).
33267 </para>
33268 <para>
33269 <indexterm role="option">
33270 <primary><option>timezone</option></primary>
33271 </indexterm>
33272 </para>
33273 <informaltable frame="all">
33274 <tgroup cols="4" colsep="0" rowsep="0">
33275 <colspec colwidth="8*" align="left"/>
33276 <colspec colwidth="6*" align="center"/>
33277 <colspec colwidth="6*" align="center"/>
33278 <colspec colwidth="6*" align="right"/>
33279 <tbody>
33280 <row>
33281 <entry><option>timezone</option></entry>
33282 <entry>Use: <emphasis>main</emphasis></entry>
33283 <entry>Type: <emphasis>string</emphasis></entry>
33284 <entry>Default: <emphasis>unset</emphasis></entry>
33285 </row>
33286 </tbody>
33287 </tgroup>
33288 </informaltable>
33289 <para>
33290 <indexterm role="concept">
33291 <primary>timezone, setting</primary>
33292 </indexterm>
33293 <indexterm role="concept">
33294 <primary>environment</primary>
33295 <secondary>values from</secondary>
33296 </indexterm>
33297 The value of <option>timezone</option> is used to set the environment variable TZ while
33298 running Exim (if it is different on entry). This ensures that all timestamps
33299 created by Exim are in the required timezone. If you want all your timestamps
33300 to be in UTC (aka GMT) you should set
33301 </para>
33302 <literallayout class="monospaced">
33303 timezone = UTC
33304 </literallayout>
33305 <para>
33306 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
33307 or, if that is not set, from the value of the TZ environment variable when Exim
33308 is built. If <option>timezone</option> is set to the empty string, either at build or run
33309 time, any existing TZ variable is removed from the environment when Exim
33310 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
33311 unfortunately not all, operating systems.
33312 </para>
33313 <para>
33314 <indexterm role="option">
33315 <primary><option>tls_advertise_hosts</option></primary>
33316 </indexterm>
33317 </para>
33318 <informaltable frame="all">
33319 <tgroup cols="4" colsep="0" rowsep="0">
33320 <colspec colwidth="8*" align="left"/>
33321 <colspec colwidth="6*" align="center"/>
33322 <colspec colwidth="6*" align="center"/>
33323 <colspec colwidth="6*" align="right"/>
33324 <tbody>
33325 <row>
33326 <entry><option>tls_advertise_hosts</option></entry>
33327 <entry>Use: <emphasis>main</emphasis></entry>
33328 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33329 <entry>Default: <emphasis>*</emphasis></entry>
33330 </row>
33331 </tbody>
33332 </tgroup>
33333 </informaltable>
33334 <para>
33335 <indexterm role="concept">
33336 <primary>TLS</primary>
33337 <secondary>advertising</secondary>
33338 </indexterm>
33339 <indexterm role="concept">
33340 <primary>encryption</primary>
33341 <secondary>on SMTP connection</secondary>
33342 </indexterm>
33343 <indexterm role="concept">
33344 <primary>SMTP</primary>
33345 <secondary>encrypted connection</secondary>
33346 </indexterm>
33347 <indexterm role="concept">
33348 <primary>ESMTP extensions</primary>
33349 <secondary>STARTTLS</secondary>
33350 </indexterm>
33351 When Exim is built with support for TLS encrypted connections, the availability
33352 of the STARTTLS command to set up an encrypted session is advertised in
33353 response to EHLO only to those client hosts that match this option. See
33354 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
33355 Note that the default value requires that a certificate be supplied
33356 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
33357 is not required the <option>tls_advertise_hosts</option> option should be set empty.
33358 </para>
33359 <para>
33360 <indexterm role="option">
33361 <primary><option>unset</option></primary>
33362 </indexterm>
33363 </para>
33364 <informaltable frame="all">
33365 <tgroup cols="4" colsep="0" rowsep="0">
33366 <colspec colwidth="8*" align="left"/>
33367 <colspec colwidth="6*" align="center"/>
33368 <colspec colwidth="6*" align="center"/>
33369 <colspec colwidth="6*" align="right"/>
33370 <tbody>
33371 <row>
33372 <entry><option>tls_certificate</option></entry>
33373 <entry>Use: <emphasis>main</emphasis></entry>
33374 <entry>Type: <emphasis>string</emphasis></entry>
33375 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33376 </row>
33377 </tbody>
33378 </tgroup>
33379 </informaltable>
33380 <para>
33381 <indexterm role="concept">
33382 <primary>TLS</primary>
33383 <secondary>server certificate; location of</secondary>
33384 </indexterm>
33385 <indexterm role="concept">
33386 <primary>certificate</primary>
33387 <secondary>server, location of</secondary>
33388 </indexterm>
33389 The value of this option is expanded, and must then be a list of absolute paths to
33390 files which contain the server&#x2019;s certificates (in PEM format).
33391 Commonly only one file is needed.
33392 The server&#x2019;s private key is also
33393 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
33394 <xref linkend="CHAPTLS"/> for further details.
33395 </para>
33396 <para>
33397 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
33398 receiving incoming messages as a server. If you want to supply certificates for
33399 use when sending messages as a client, you must set the <option>tls_certificate</option>
33400 option in the relevant <command>smtp</command> transport.
33401 </para>
33402 <para>
33403 <emphasis role="bold">Note</emphasis>: If you use filenames based on IP addresses, change the list
33404 separator in the usual way (<xref linkend="SECTlistsepchange"/>) to avoid confusion under IPv6.
33405 </para>
33406 <para>
33407 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
33408 when a list of more than one
33409 file is used, the <varname>$tls_in_ourcert</varname> variable is unreliable.
33410 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
33411 </para>
33412 <para>
33413 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
33414 if the OpenSSL build supports TLS extensions and the TLS client sends the
33415 Server Name Indication extension, then this option and others documented in
33416 <xref linkend="SECTtlssni"/> will be re-expanded.
33417 </para>
33418 <para>
33419 If this option is unset or empty a fresh self-signed certificate will be
33420 generated for every connection.
33421 </para>
33422 <para>
33423 <indexterm role="option">
33424 <primary><option>tls_crl</option></primary>
33425 </indexterm>
33426 </para>
33427 <informaltable frame="all">
33428 <tgroup cols="4" colsep="0" rowsep="0">
33429 <colspec colwidth="8*" align="left"/>
33430 <colspec colwidth="6*" align="center"/>
33431 <colspec colwidth="6*" align="center"/>
33432 <colspec colwidth="6*" align="right"/>
33433 <tbody>
33434 <row>
33435 <entry><option>tls_crl</option></entry>
33436 <entry>Use: <emphasis>main</emphasis></entry>
33437 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33438 <entry>Default: <emphasis>unset</emphasis></entry>
33439 </row>
33440 </tbody>
33441 </tgroup>
33442 </informaltable>
33443 <para>
33444 <indexterm role="concept">
33445 <primary>TLS</primary>
33446 <secondary>server certificate revocation list</secondary>
33447 </indexterm>
33448 <indexterm role="concept">
33449 <primary>certificate</primary>
33450 <secondary>revocation list for server</secondary>
33451 </indexterm>
33452 This option specifies a certificate revocation list. The expanded value must
33453 be the name of a file that contains CRLs in PEM format.
33454 </para>
33455 <para>
33456 Under OpenSSL the option can specify a directory with CRL files.
33457 </para>
33458 <para>
33459 <emphasis role="bold">Note:</emphasis> Under OpenSSL the option must, if given, supply a CRL
33460 for each signing element of the certificate chain (i.e. all but the leaf).
33461 For the file variant this can be multiple PEM blocks in the one file.
33462 </para>
33463 <para>
33464 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
33465 </para>
33466 <para>
33467 <indexterm role="option">
33468 <primary><option>tls_dh_max_bits</option></primary>
33469 </indexterm>
33470 </para>
33471 <informaltable frame="all">
33472 <tgroup cols="4" colsep="0" rowsep="0">
33473 <colspec colwidth="8*" align="left"/>
33474 <colspec colwidth="6*" align="center"/>
33475 <colspec colwidth="6*" align="center"/>
33476 <colspec colwidth="6*" align="right"/>
33477 <tbody>
33478 <row>
33479 <entry><option>tls_dh_max_bits</option></entry>
33480 <entry>Use: <emphasis>main</emphasis></entry>
33481 <entry>Type: <emphasis>integer</emphasis></entry>
33482 <entry>Default: <emphasis>2236</emphasis></entry>
33483 </row>
33484 </tbody>
33485 </tgroup>
33486 </informaltable>
33487 <para>
33488 <indexterm role="concept">
33489 <primary>TLS</primary>
33490 <secondary>D-H bit count</secondary>
33491 </indexterm>
33492 The number of bits used for Diffie-Hellman key-exchange may be suggested by
33493 the chosen TLS library.  That value might prove to be too high for
33494 interoperability.  This option provides a maximum clamp on the value
33495 suggested, trading off security for interoperability.
33496 </para>
33497 <para>
33498 The value must be at least 1024.
33499 </para>
33500 <para>
33501 The value 2236 was chosen because, at time of adding the option, it was the
33502 hard-coded maximum value supported by the NSS cryptographic library, as used
33503 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
33504 </para>
33505 <para>
33506 If you prefer more security and are willing to break some clients, raise this
33507 number.
33508 </para>
33509 <para>
33510 Note that the value passed to GnuTLS for *generating* a new prime may be a
33511 little less than this figure, because GnuTLS is inexact and may produce a
33512 larger prime than requested.
33513 </para>
33514 <para>
33515 <indexterm role="option">
33516 <primary><option>tls_dhparam</option></primary>
33517 </indexterm>
33518 </para>
33519 <informaltable frame="all">
33520 <tgroup cols="4" colsep="0" rowsep="0">
33521 <colspec colwidth="8*" align="left"/>
33522 <colspec colwidth="6*" align="center"/>
33523 <colspec colwidth="6*" align="center"/>
33524 <colspec colwidth="6*" align="right"/>
33525 <tbody>
33526 <row>
33527 <entry><option>tls_dhparam</option></entry>
33528 <entry>Use: <emphasis>main</emphasis></entry>
33529 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33530 <entry>Default: <emphasis>unset</emphasis></entry>
33531 </row>
33532 </tbody>
33533 </tgroup>
33534 </informaltable>
33535 <para>
33536 <indexterm role="concept">
33537 <primary>TLS</primary>
33538 <secondary>D-H parameters for server</secondary>
33539 </indexterm>
33540 The value of this option is expanded and indicates the source of DH parameters
33541 to be used by Exim.
33542 </para>
33543 <para>
33544 This option is ignored for GnuTLS version 3.6.0 and later.
33545 The library manages parameter negotiation internally.
33546 </para>
33547 <para>
33548 <emphasis role="bold">Note: The Exim Maintainers strongly recommend,
33549 for other TLS library versions,
33550 using a filename with site-generated
33551 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
33552 other specific constants available are a fallback so that even when
33553 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
33554 </para>
33555 <para>
33556 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
33557 then it names a file from which DH
33558 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
33559 PKCS#3 representation of the DH prime.  If the file does not exist, for
33560 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
33561 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
33562 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
33563 and treated as though the <option>tls_dhparam</option> were set to "none".
33564 </para>
33565 <para>
33566 If this option expands to the string "none", then no DH parameters will be
33567 loaded by Exim.
33568 </para>
33569 <para>
33570 If this option expands to the string "historic" and Exim is using GnuTLS, then
33571 Exim will attempt to load a file from inside the spool directory.  If the file
33572 does not exist, Exim will attempt to create it.
33573 See section <xref linkend="SECTgnutlsparam"/> for further details.
33574 </para>
33575 <para>
33576 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
33577 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
33578 </para>
33579 <para>
33580 In older versions of Exim the default was the 2048 bit prime described in section
33581 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
33582 in IKE is assigned number 23.
33583 </para>
33584 <para>
33585 Otherwise, the option must expand to the name used by Exim for any of a number
33586 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
33587 sources.  As names, Exim uses a standard specified name, else "ike" followed by
33588 the number used by IKE, or "default" which corresponds to
33589 <literal>exim.dev.20160529.3</literal>.
33590 </para>
33591 <para>
33592 The available standard primes are:
33593 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
33594 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
33595 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
33596 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
33597 </para>
33598 <para>
33599 The available additional primes are:
33600 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
33601 </para>
33602 <para>
33603 Some of these will be too small to be accepted by clients.
33604 Some may be too large to be accepted by clients.
33605 The open cryptographic community has suspicions about the integrity of some
33606 of the later IKE values, which led into RFC7919 providing new fixed constants
33607 (the "ffdhe" identifiers).
33608 </para>
33609 <para>
33610 At this point, all of the "ike" values should be considered obsolete;
33611 they&#x2019;re still in Exim to avoid breaking unusual configurations, but are
33612 candidates for removal the next time we have backwards-incompatible changes.
33613 </para>
33614 <para>
33615 The TLS protocol does not negotiate an acceptable size for this; clients tend
33616 to hard-drop connections if what is offered by the server is unacceptable,
33617 whether too large or too small, and there&#x2019;s no provision for the client to
33618 tell the server what these constraints are.  Thus, as a server operator, you
33619 need to make an educated guess as to what is most likely to work for your
33620 userbase.
33621 </para>
33622 <para>
33623 Some known size constraints suggest that a bit-size in the range 2048 to 2236
33624 is most likely to maximise interoperability.  The upper bound comes from
33625 applications using the Mozilla Network Security Services (NSS) library, which
33626 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
33627 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
33628 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
33629 acceptable bound from 1024 to 2048.
33630 </para>
33631 <para>
33632 <indexterm role="option">
33633 <primary><option>tls_eccurve</option></primary>
33634 </indexterm>
33635 </para>
33636 <informaltable frame="all">
33637 <tgroup cols="4" colsep="0" rowsep="0">
33638 <colspec colwidth="8*" align="left"/>
33639 <colspec colwidth="6*" align="center"/>
33640 <colspec colwidth="6*" align="center"/>
33641 <colspec colwidth="6*" align="right"/>
33642 <tbody>
33643 <row>
33644 <entry><option>tls_eccurve</option></entry>
33645 <entry>Use: <emphasis>main</emphasis></entry>
33646 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33647 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
33648 </row>
33649 </tbody>
33650 </tgroup>
33651 </informaltable>
33652 <para>
33653 <indexterm role="concept">
33654 <primary>TLS</primary>
33655 <secondary>EC cryptography</secondary>
33656 </indexterm>
33657 This option selects a EC curve for use by Exim when used with OpenSSL.
33658 It has no effect when Exim is used with GnuTLS.
33659 </para>
33660 <para>
33661 After expansion it must contain a valid EC curve parameter, such as
33662 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
33663 for valid selections.
33664 </para>
33665 <para>
33666 For OpenSSL versions before (and not including) 1.0.2, the string
33667 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
33668 <literal>auto</literal> tells the library to choose.
33669 </para>
33670 <para>
33671 If the option expands to an empty string, no EC curves will be enabled.
33672 </para>
33673 <para>
33674 <indexterm role="option">
33675 <primary><option>tls_ocsp_file</option></primary>
33676 </indexterm>
33677 </para>
33678 <informaltable frame="all">
33679 <tgroup cols="4" colsep="0" rowsep="0">
33680 <colspec colwidth="8*" align="left"/>
33681 <colspec colwidth="6*" align="center"/>
33682 <colspec colwidth="6*" align="center"/>
33683 <colspec colwidth="6*" align="right"/>
33684 <tbody>
33685 <row>
33686 <entry><option>tls_ocsp_file</option></entry>
33687 <entry>Use: <emphasis>main</emphasis></entry>
33688 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33689 <entry>Default: <emphasis>unset</emphasis></entry>
33690 </row>
33691 </tbody>
33692 </tgroup>
33693 </informaltable>
33694 <para>
33695 <indexterm role="concept">
33696 <primary>TLS</primary>
33697 <secondary>certificate status</secondary>
33698 </indexterm>
33699 <indexterm role="concept">
33700 <primary>TLS</primary>
33701 <secondary>OCSP proof file</secondary>
33702 </indexterm>
33703 This option
33704 must if set expand to the absolute path to a file which contains a current
33705 status proof for the server&#x2019;s certificate, as obtained from the
33706 Certificate Authority.
33707 </para>
33708 <para>
33709 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
33710 The macro "_HAVE_TLS_OCSP" will be defined for those versions.
33711 </para>
33712 <para>
33713 For OpenSSL 1.1.0 or later, and
33714 for GnuTLS 3.5.6 or later the expanded value of this option can be a list
33715 of files, to match a list given for the <option>tls_certificate</option> option.
33716 The ordering of the two lists must match.
33717 The macro "_HAVE_TLS_OCSP_LIST" will be defined for those versions.
33718 </para>
33719 <para>
33720 The file(s) should be in DER format,
33721 except for GnuTLS 3.6.3 or later
33722 or for OpenSSL,
33723 when an optional filetype prefix can be used.
33724 The prefix must be one of "DER" or "PEM", followed by
33725 a single space.  If one is used it sets the format for subsequent
33726 files in the list; the initial format is DER.
33727 If multiple proofs are wanted, for multiple chain elements
33728 (this only works under TLS1.3)
33729 they must be coded as a combined OCSP response.
33730 </para>
33731 <para>
33732 Although GnuTLS will accept PEM files with multiple separate
33733 PEM blobs (ie. separate OCSP responses), it sends them in the
33734 TLS Certificate record interleaved with the certificates of the chain;
33735 although a GnuTLS client is happy with that, an OpenSSL client is not.
33736 </para>
33737 <para>
33738 <indexterm role="option">
33739 <primary><option>tls_on_connect_ports</option></primary>
33740 </indexterm>
33741 </para>
33742 <informaltable frame="all">
33743 <tgroup cols="4" colsep="0" rowsep="0">
33744 <colspec colwidth="8*" align="left"/>
33745 <colspec colwidth="6*" align="center"/>
33746 <colspec colwidth="6*" align="center"/>
33747 <colspec colwidth="6*" align="right"/>
33748 <tbody>
33749 <row>
33750 <entry><option>tls_on_connect_ports</option></entry>
33751 <entry>Use: <emphasis>main</emphasis></entry>
33752 <entry>Type: <emphasis>string list</emphasis></entry>
33753 <entry>Default: <emphasis>unset</emphasis></entry>
33754 </row>
33755 </tbody>
33756 </tgroup>
33757 </informaltable>
33758 <para>
33759 <indexterm role="concept">
33760 <primary>SSMTP</primary>
33761 </indexterm>
33762 <indexterm role="concept">
33763 <primary>SMTPS</primary>
33764 </indexterm>
33765 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
33766 operate the SSMTP (SMTPS) protocol, where a TLS session is immediately
33767 set up without waiting for the client to issue a STARTTLS command. For
33768 further details, see section <xref linkend="SECTsupobssmt"/>.
33769 </para>
33770 <para>
33771 <indexterm role="option">
33772 <primary><option>unset</option></primary>
33773 </indexterm>
33774 </para>
33775 <informaltable frame="all">
33776 <tgroup cols="4" colsep="0" rowsep="0">
33777 <colspec colwidth="8*" align="left"/>
33778 <colspec colwidth="6*" align="center"/>
33779 <colspec colwidth="6*" align="center"/>
33780 <colspec colwidth="6*" align="right"/>
33781 <tbody>
33782 <row>
33783 <entry><option>tls_privatekey</option></entry>
33784 <entry>Use: <emphasis>main</emphasis></entry>
33785 <entry>Type: <emphasis>string</emphasis></entry>
33786 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
33787 </row>
33788 </tbody>
33789 </tgroup>
33790 </informaltable>
33791 <para>
33792 <indexterm role="concept">
33793 <primary>TLS</primary>
33794 <secondary>server private key; location of</secondary>
33795 </indexterm>
33796 The value of this option is expanded, and must then be a list of absolute paths to
33797 files which contains the server&#x2019;s private keys.
33798 If this option is unset, or if
33799 the expansion is forced to fail, or the result is an empty string, the private
33800 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
33801 <xref linkend="CHAPTLS"/> for further details.
33802 </para>
33803 <para>
33804 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
33805 </para>
33806 <para>
33807 <indexterm role="option">
33808 <primary><option>tls_remember_esmtp</option></primary>
33809 </indexterm>
33810 </para>
33811 <informaltable frame="all">
33812 <tgroup cols="4" colsep="0" rowsep="0">
33813 <colspec colwidth="8*" align="left"/>
33814 <colspec colwidth="6*" align="center"/>
33815 <colspec colwidth="6*" align="center"/>
33816 <colspec colwidth="6*" align="right"/>
33817 <tbody>
33818 <row>
33819 <entry><option>tls_remember_esmtp</option></entry>
33820 <entry>Use: <emphasis>main</emphasis></entry>
33821 <entry>Type: <emphasis>boolean</emphasis></entry>
33822 <entry>Default: <emphasis>false</emphasis></entry>
33823 </row>
33824 </tbody>
33825 </tgroup>
33826 </informaltable>
33827 <para>
33828 <indexterm role="concept">
33829 <primary>TLS</primary>
33830 <secondary>esmtp state; remembering</secondary>
33831 </indexterm>
33832 <indexterm role="concept">
33833 <primary>TLS</primary>
33834 <secondary>broken clients</secondary>
33835 </indexterm>
33836 If this option is set true, Exim violates the RFCs by remembering that it is in
33837 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
33838 support for broken clients that fail to send a new EHLO after starting a
33839 TLS session.
33840 </para>
33841 <para>
33842 <indexterm role="option">
33843 <primary><option>tls_require_ciphers</option></primary>
33844 </indexterm>
33845 </para>
33846 <informaltable frame="all">
33847 <tgroup cols="4" colsep="0" rowsep="0">
33848 <colspec colwidth="8*" align="left"/>
33849 <colspec colwidth="6*" align="center"/>
33850 <colspec colwidth="6*" align="center"/>
33851 <colspec colwidth="6*" align="right"/>
33852 <tbody>
33853 <row>
33854 <entry><option>tls_require_ciphers</option></entry>
33855 <entry>Use: <emphasis>main</emphasis></entry>
33856 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33857 <entry>Default: <emphasis>unset</emphasis></entry>
33858 </row>
33859 </tbody>
33860 </tgroup>
33861 </informaltable>
33862 <para>
33863 <indexterm role="concept">
33864 <primary>TLS</primary>
33865 <secondary>requiring specific ciphers</secondary>
33866 </indexterm>
33867 <indexterm role="concept">
33868 <primary>cipher</primary>
33869 <secondary>requiring specific</secondary>
33870 </indexterm>
33871 This option controls which ciphers can be used for incoming TLS connections.
33872 The <command>smtp</command> transport has an option of the same name for controlling outgoing
33873 connections. This option is expanded for each connection, so can be varied for
33874 different clients if required. The value of this option must be a list of
33875 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
33876 in somewhat different ways. If GnuTLS is being used, the client controls the
33877 preference order of the available ciphers. Details are given in sections
33878 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
33879 </para>
33880 <para>
33881 <indexterm role="option">
33882 <primary><option>tls_try_verify_hosts</option></primary>
33883 </indexterm>
33884 </para>
33885 <informaltable frame="all">
33886 <tgroup cols="4" colsep="0" rowsep="0">
33887 <colspec colwidth="8*" align="left"/>
33888 <colspec colwidth="6*" align="center"/>
33889 <colspec colwidth="6*" align="center"/>
33890 <colspec colwidth="6*" align="right"/>
33891 <tbody>
33892 <row>
33893 <entry><option>tls_try_verify_hosts</option></entry>
33894 <entry>Use: <emphasis>main</emphasis></entry>
33895 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33896 <entry>Default: <emphasis>unset</emphasis></entry>
33897 </row>
33898 </tbody>
33899 </tgroup>
33900 </informaltable>
33901 <para>
33902 <indexterm role="concept">
33903 <primary>TLS</primary>
33904 <secondary>client certificate verification</secondary>
33905 </indexterm>
33906 <indexterm role="concept">
33907 <primary>certificate</primary>
33908 <secondary>verification of client</secondary>
33909 </indexterm>
33910 See <option>tls_verify_hosts</option> below.
33911 </para>
33912 <para>
33913 <indexterm role="option">
33914 <primary><option>tls_verify_certificates</option></primary>
33915 </indexterm>
33916 </para>
33917 <informaltable frame="all">
33918 <tgroup cols="4" colsep="0" rowsep="0">
33919 <colspec colwidth="8*" align="left"/>
33920 <colspec colwidth="6*" align="center"/>
33921 <colspec colwidth="6*" align="center"/>
33922 <colspec colwidth="6*" align="right"/>
33923 <tbody>
33924 <row>
33925 <entry><option>tls_verify_certificates</option></entry>
33926 <entry>Use: <emphasis>main</emphasis></entry>
33927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33928 <entry>Default: <emphasis>system</emphasis></entry>
33929 </row>
33930 </tbody>
33931 </tgroup>
33932 </informaltable>
33933 <para>
33934 <indexterm role="concept">
33935 <primary>TLS</primary>
33936 <secondary>client certificate verification</secondary>
33937 </indexterm>
33938 <indexterm role="concept">
33939 <primary>certificate</primary>
33940 <secondary>verification of client</secondary>
33941 </indexterm>
33942 The value of this option is expanded, and must then be either the
33943 word "system"
33944 or the absolute path to
33945 a file or directory containing permitted certificates for clients that
33946 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
33947 </para>
33948 <para>
33949 The "system" value for the option will use a
33950 system default location compiled into the SSL library.
33951 This is not available for GnuTLS versions preceding 3.0.20,
33952 and will be taken as empty; an explicit location
33953 must be specified.
33954 </para>
33955 <para>
33956 The use of a directory for the option value is not available for GnuTLS versions
33957 preceding 3.3.6 and a single file must be used.
33958 </para>
33959 <para>
33960 With OpenSSL the certificates specified
33961 explicitly
33962 either by file or directory
33963 are added to those given by the system default location.
33964 </para>
33965 <para>
33966 These certificates should be for the certificate authorities trusted, rather
33967 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
33968 the value is a file then the certificates are sent by Exim as a server to
33969 connecting clients, defining the list of accepted certificate authorities.
33970 Thus the values defined should be considered public data.  To avoid this,
33971 use the explicit directory version.
33972 </para>
33973 <para>
33974 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
33975 </para>
33976 <para>
33977 A forced expansion failure or setting to an empty string is equivalent to
33978 being unset.
33979 </para>
33980 <para>
33981 <indexterm role="option">
33982 <primary><option>tls_verify_hosts</option></primary>
33983 </indexterm>
33984 </para>
33985 <informaltable frame="all">
33986 <tgroup cols="4" colsep="0" rowsep="0">
33987 <colspec colwidth="8*" align="left"/>
33988 <colspec colwidth="6*" align="center"/>
33989 <colspec colwidth="6*" align="center"/>
33990 <colspec colwidth="6*" align="right"/>
33991 <tbody>
33992 <row>
33993 <entry><option>tls_verify_hosts</option></entry>
33994 <entry>Use: <emphasis>main</emphasis></entry>
33995 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33996 <entry>Default: <emphasis>unset</emphasis></entry>
33997 </row>
33998 </tbody>
33999 </tgroup>
34000 </informaltable>
34001 <para>
34002 <indexterm role="concept">
34003 <primary>TLS</primary>
34004 <secondary>client certificate verification</secondary>
34005 </indexterm>
34006 <indexterm role="concept">
34007 <primary>certificate</primary>
34008 <secondary>verification of client</secondary>
34009 </indexterm>
34010 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
34011 certificates from clients. The expected certificates are defined by
34012 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
34013 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
34014 <option>tls_verify_certificates</option> is not set.
34015 </para>
34016 <para>
34017 Any client that matches <option>tls_verify_hosts</option> is constrained by
34018 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
34019 present one of the listed certificates. If it does not, the connection is
34020 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
34021 the host to use TLS. It can still send SMTP commands through unencrypted
34022 connections. Forcing a client to use TLS has to be done separately using an
34023 ACL to reject inappropriate commands when the connection is not encrypted.
34024 </para>
34025 <para>
34026 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
34027 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
34028 certificate and checks it against <option>tls_verify_certificates</option>, but does not
34029 abort the connection if there is no certificate or if it does not match. This
34030 state can be detected in an ACL, which makes it possible to implement policies
34031 such as <quote>accept for relay only if a verified certificate has been received,
34032 but accept for local delivery if encrypted, even without a verified
34033 certificate</quote>.
34034 </para>
34035 <para>
34036 Client hosts that match neither of these lists are not asked to present
34037 certificates.
34038 </para>
34039 <para>
34040 <indexterm role="option">
34041 <primary><option>trusted_groups</option></primary>
34042 </indexterm>
34043 </para>
34044 <informaltable frame="all">
34045 <tgroup cols="4" colsep="0" rowsep="0">
34046 <colspec colwidth="8*" align="left"/>
34047 <colspec colwidth="6*" align="center"/>
34048 <colspec colwidth="6*" align="center"/>
34049 <colspec colwidth="6*" align="right"/>
34050 <tbody>
34051 <row>
34052 <entry><option>trusted_groups</option></entry>
34053 <entry>Use: <emphasis>main</emphasis></entry>
34054 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34055 <entry>Default: <emphasis>unset</emphasis></entry>
34056 </row>
34057 </tbody>
34058 </tgroup>
34059 </informaltable>
34060 <para>
34061 <indexterm role="concept">
34062 <primary>trusted groups</primary>
34063 </indexterm>
34064 <indexterm role="concept">
34065 <primary>groups</primary>
34066 <secondary>trusted</secondary>
34067 </indexterm>
34068 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
34069 option is set, any process that is running in one of the listed groups, or
34070 which has one of them as a supplementary group, is trusted. The groups can be
34071 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
34072 details of what trusted callers are permitted to do. If neither
34073 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
34074 are trusted.
34075 </para>
34076 <para>
34077 <indexterm role="option">
34078 <primary><option>trusted_users</option></primary>
34079 </indexterm>
34080 </para>
34081 <informaltable frame="all">
34082 <tgroup cols="4" colsep="0" rowsep="0">
34083 <colspec colwidth="8*" align="left"/>
34084 <colspec colwidth="6*" align="center"/>
34085 <colspec colwidth="6*" align="center"/>
34086 <colspec colwidth="6*" align="right"/>
34087 <tbody>
34088 <row>
34089 <entry><option>trusted_users</option></entry>
34090 <entry>Use: <emphasis>main</emphasis></entry>
34091 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34092 <entry>Default: <emphasis>unset</emphasis></entry>
34093 </row>
34094 </tbody>
34095 </tgroup>
34096 </informaltable>
34097 <para>
34098 <indexterm role="concept">
34099 <primary>trusted users</primary>
34100 </indexterm>
34101 <indexterm role="concept">
34102 <primary>user</primary>
34103 <secondary>trusted</secondary>
34104 </indexterm>
34105 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
34106 option is set, any process that is running as one of the listed users is
34107 trusted. The users can be specified numerically or by name. See section
34108 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
34109 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
34110 Exim user are trusted.
34111 </para>
34112 <para>
34113 <indexterm role="option">
34114 <primary><option>unknown_login</option></primary>
34115 </indexterm>
34116 </para>
34117 <informaltable frame="all">
34118 <tgroup cols="4" colsep="0" rowsep="0">
34119 <colspec colwidth="8*" align="left"/>
34120 <colspec colwidth="6*" align="center"/>
34121 <colspec colwidth="6*" align="center"/>
34122 <colspec colwidth="6*" align="right"/>
34123 <tbody>
34124 <row>
34125 <entry><option>unknown_login</option></entry>
34126 <entry>Use: <emphasis>main</emphasis></entry>
34127 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34128 <entry>Default: <emphasis>unset</emphasis></entry>
34129 </row>
34130 </tbody>
34131 </tgroup>
34132 </informaltable>
34133 <para>
34134 <indexterm role="concept">
34135 <primary>uid (user id)</primary>
34136 <secondary>unknown caller</secondary>
34137 </indexterm>
34138 <indexterm role="variable">
34139 <primary><varname>$caller_uid</varname></primary>
34140 </indexterm>
34141 This is a specialized feature for use in unusual configurations. By default, if
34142 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
34143 gives up. The <option>unknown_login</option> option can be used to set a login name to be
34144 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
34145 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
34146 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
34147 <option>-F</option> option.
34148 </para>
34149 <para>
34150 <indexterm role="option">
34151 <primary><option>unknown_username</option></primary>
34152 </indexterm>
34153 </para>
34154 <informaltable frame="all">
34155 <tgroup cols="4" colsep="0" rowsep="0">
34156 <colspec colwidth="8*" align="left"/>
34157 <colspec colwidth="6*" align="center"/>
34158 <colspec colwidth="6*" align="center"/>
34159 <colspec colwidth="6*" align="right"/>
34160 <tbody>
34161 <row>
34162 <entry><option>unknown_username</option></entry>
34163 <entry>Use: <emphasis>main</emphasis></entry>
34164 <entry>Type: <emphasis>string</emphasis></entry>
34165 <entry>Default: <emphasis>unset</emphasis></entry>
34166 </row>
34167 </tbody>
34168 </tgroup>
34169 </informaltable>
34170 <para>
34171 See <option>unknown_login</option>.
34172 </para>
34173 <para>
34174 <indexterm role="option">
34175 <primary><option>untrusted_set_sender</option></primary>
34176 </indexterm>
34177 </para>
34178 <informaltable frame="all">
34179 <tgroup cols="4" colsep="0" rowsep="0">
34180 <colspec colwidth="8*" align="left"/>
34181 <colspec colwidth="6*" align="center"/>
34182 <colspec colwidth="6*" align="center"/>
34183 <colspec colwidth="6*" align="right"/>
34184 <tbody>
34185 <row>
34186 <entry><option>untrusted_set_sender</option></entry>
34187 <entry>Use: <emphasis>main</emphasis></entry>
34188 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
34189 <entry>Default: <emphasis>unset</emphasis></entry>
34190 </row>
34191 </tbody>
34192 </tgroup>
34193 </informaltable>
34194 <para>
34195 <indexterm role="concept">
34196 <primary>trusted users</primary>
34197 </indexterm>
34198 <indexterm role="concept">
34199 <primary>sender</primary>
34200 <secondary>setting by untrusted user</secondary>
34201 </indexterm>
34202 <indexterm role="concept">
34203 <primary>untrusted user setting sender</primary>
34204 </indexterm>
34205 <indexterm role="concept">
34206 <primary>user</primary>
34207 <secondary>untrusted setting sender</secondary>
34208 </indexterm>
34209 <indexterm role="concept">
34210 <primary>envelope from</primary>
34211 </indexterm>
34212 <indexterm role="concept">
34213 <primary>envelope sender</primary>
34214 </indexterm>
34215 When an untrusted user submits a message to Exim using the standard input, Exim
34216 normally creates an envelope sender address from the user&#x2019;s login and the
34217 default qualification domain. Data from the <option>-f</option> option (for setting envelope
34218 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
34219 is used) is ignored.
34220 </para>
34221 <para>
34222 However, untrusted users are permitted to set an empty envelope sender address,
34223 to declare that a message should never generate any bounces. For example:
34224 </para>
34225 <literallayout class="monospaced">
34226 exim -f '&lt;&gt;' user@domain.example
34227 </literallayout>
34228 <para>
34229 <indexterm role="variable">
34230 <primary><varname>$sender_ident</varname></primary>
34231 </indexterm>
34232 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
34233 other envelope sender addresses in a controlled way. When it is set, untrusted
34234 users are allowed to set envelope sender addresses that match any of the
34235 patterns in the list. Like all address lists, the string is expanded. The
34236 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
34237 users to setting senders that start with their login ids
34238 followed by a hyphen
34239 by a setting like this:
34240 </para>
34241 <literallayout class="monospaced">
34242 untrusted_set_sender = ^$sender_ident-
34243 </literallayout>
34244 <para>
34245 If you want to allow untrusted users to set envelope sender addresses without
34246 restriction, you can use
34247 </para>
34248 <literallayout class="monospaced">
34249 untrusted_set_sender = *
34250 </literallayout>
34251 <para>
34252 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
34253 only to the setting of the envelope sender. It does not permit untrusted users
34254 to use the other options which trusted user can use to override message
34255 parameters. Furthermore, it does not stop Exim from removing an existing
34256 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
34257 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
34258 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
34259 described in section <xref linkend="SECTthesenhea"/>.
34260 </para>
34261 <para>
34262 The log line for a message&#x2019;s arrival shows the envelope sender following
34263 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
34264 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
34265 envelope sender address, the user&#x2019;s login is shown in parentheses after the
34266 sender address.
34267 </para>
34268 <para>
34269 <indexterm role="option">
34270 <primary><option>uucp_from_pattern</option></primary>
34271 </indexterm>
34272 </para>
34273 <informaltable frame="all">
34274 <tgroup cols="4" colsep="0" rowsep="0">
34275 <colspec colwidth="8*" align="left"/>
34276 <colspec colwidth="6*" align="center"/>
34277 <colspec colwidth="6*" align="center"/>
34278 <colspec colwidth="6*" align="right"/>
34279 <tbody>
34280 <row>
34281 <entry><option>uucp_from_pattern</option></entry>
34282 <entry>Use: <emphasis>main</emphasis></entry>
34283 <entry>Type: <emphasis>string</emphasis></entry>
34284 <entry>Default: <emphasis>see below</emphasis></entry>
34285 </row>
34286 </tbody>
34287 </tgroup>
34288 </informaltable>
34289 <para>
34290 <indexterm role="concept">
34291 <primary><quote>From</quote> line</primary>
34292 </indexterm>
34293 <indexterm role="concept">
34294 <primary>UUCP</primary>
34295 <secondary><quote>From</quote> line</secondary>
34296 </indexterm>
34297 Some applications that pass messages to an MTA via a command line interface use
34298 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
34299 particular, this is used by UUCP software. Exim recognizes such a line by means
34300 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
34301 matches, the sender address is constructed by expanding the contents of
34302 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
34303 default pattern recognizes lines in the following two forms:
34304 </para>
34305 <literallayout class="monospaced">
34306 From ph10 Fri Jan  5 12:35 GMT 1996
34307 From ph10 Fri, 7 Jan 97 14:00:00 GMT
34308 </literallayout>
34309 <para>
34310 The pattern can be seen by running
34311 </para>
34312 <literallayout class="monospaced">
34313 exim -bP uucp_from_pattern
34314 </literallayout>
34315 <para>
34316 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
34317 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
34318 regular expression by a parenthesized subpattern. The default value for
34319 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
34320 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
34321 <option>ignore_fromline_hosts</option>.
34322 </para>
34323 <para>
34324 <indexterm role="option">
34325 <primary><option>uucp_from_sender</option></primary>
34326 </indexterm>
34327 </para>
34328 <informaltable frame="all">
34329 <tgroup cols="4" colsep="0" rowsep="0">
34330 <colspec colwidth="8*" align="left"/>
34331 <colspec colwidth="6*" align="center"/>
34332 <colspec colwidth="6*" align="center"/>
34333 <colspec colwidth="6*" align="right"/>
34334 <tbody>
34335 <row>
34336 <entry><option>uucp_from_sender</option></entry>
34337 <entry>Use: <emphasis>main</emphasis></entry>
34338 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34339 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
34340 </row>
34341 </tbody>
34342 </tgroup>
34343 </informaltable>
34344 <para>
34345 See <option>uucp_from_pattern</option> above.
34346 </para>
34347 <para>
34348 <indexterm role="option">
34349 <primary><option>warn_message_file</option></primary>
34350 </indexterm>
34351 </para>
34352 <informaltable frame="all">
34353 <tgroup cols="4" colsep="0" rowsep="0">
34354 <colspec colwidth="8*" align="left"/>
34355 <colspec colwidth="6*" align="center"/>
34356 <colspec colwidth="6*" align="center"/>
34357 <colspec colwidth="6*" align="right"/>
34358 <tbody>
34359 <row>
34360 <entry><option>warn_message_file</option></entry>
34361 <entry>Use: <emphasis>main</emphasis></entry>
34362 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34363 <entry>Default: <emphasis>unset</emphasis></entry>
34364 </row>
34365 </tbody>
34366 </tgroup>
34367 </informaltable>
34368 <para>
34369 <indexterm role="concept">
34370 <primary>warning of delay</primary>
34371 <secondary>customizing the message</secondary>
34372 </indexterm>
34373 <indexterm role="concept">
34374 <primary>customizing</primary>
34375 <secondary>warning message</secondary>
34376 </indexterm>
34377 This option defines a template file containing paragraphs of text to be used
34378 for constructing the warning message which is sent by Exim when a message has
34379 been in the queue for a specified amount of time, as specified by
34380 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
34381 <xref linkend="CHAPemsgcust"/>.
34382 </para>
34383 <para revisionflag="changed">
34384 <indexterm role="concept">
34385 <primary>warn_message_file</primary>
34386 <secondary>tainted data</secondary>
34387 </indexterm>
34388 The option is expanded to give the file path, which must be
34389 absolute and untainted.
34390 </para>
34391 <para>
34392 See also <option>bounce_message_file</option>.
34393 </para>
34394 <para>
34395 <indexterm role="option">
34396 <primary><option>write_rejectlog</option></primary>
34397 </indexterm>
34398 </para>
34399 <informaltable frame="all">
34400 <tgroup cols="4" colsep="0" rowsep="0">
34401 <colspec colwidth="8*" align="left"/>
34402 <colspec colwidth="6*" align="center"/>
34403 <colspec colwidth="6*" align="center"/>
34404 <colspec colwidth="6*" align="right"/>
34405 <tbody>
34406 <row>
34407 <entry><option>write_rejectlog</option></entry>
34408 <entry>Use: <emphasis>main</emphasis></entry>
34409 <entry>Type: <emphasis>boolean</emphasis></entry>
34410 <entry>Default: <emphasis>true</emphasis></entry>
34411 </row>
34412 </tbody>
34413 </tgroup>
34414 </informaltable>
34415 <para>
34416 <indexterm role="concept">
34417 <primary>reject log</primary>
34418 <secondary>disabling</secondary>
34419 </indexterm>
34420 If this option is set false, Exim no longer writes anything to the reject log.
34421 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
34422 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
34423 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
34424 </para>
34425 </section>
34426 </chapter>
34427
34428 <chapter id="CHAProutergeneric">
34429 <title>Generic options for routers</title>
34430 <para>
34431 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
34432 <primary>options</primary>
34433 <secondary>generic; for routers</secondary>
34434 </indexterm>
34435 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
34436 <primary>generic options</primary>
34437 <secondary>router</secondary>
34438 </indexterm>
34439 This chapter describes the generic options that apply to all routers.
34440 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
34441 </para>
34442 <para>
34443 For a general description of how a router operates, see sections
34444 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
34445 which the preconditions are tested. The order of expansion of the options that
34446 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
34447 <option>headers_remove</option>, <option>transport</option>.
34448 </para>
34449 <para revisionflag="changed">
34450 The name of a router is limited to be 64 ASCII characters long;
34451 prior to Exim 4.95 names would be silently truncated at this length, but now
34452 it is enforced.
34453 </para>
34454 <para>
34455 <indexterm role="option">
34456 <primary><option>address_data</option></primary>
34457 </indexterm>
34458 </para>
34459 <informaltable frame="all">
34460 <tgroup cols="4" colsep="0" rowsep="0">
34461 <colspec colwidth="8*" align="left"/>
34462 <colspec colwidth="6*" align="center"/>
34463 <colspec colwidth="6*" align="center"/>
34464 <colspec colwidth="6*" align="right"/>
34465 <tbody>
34466 <row>
34467 <entry><option>address_data</option></entry>
34468 <entry>Use: <emphasis>routers</emphasis></entry>
34469 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34470 <entry>Default: <emphasis>unset</emphasis></entry>
34471 </row>
34472 </tbody>
34473 </tgroup>
34474 </informaltable>
34475 <para>
34476 <indexterm role="concept">
34477 <primary>router</primary>
34478 <secondary>data attached to address</secondary>
34479 </indexterm>
34480 The string is expanded just before the router is run, that is, after all the
34481 precondition tests have succeeded. If the expansion is forced to fail, the
34482 router declines, the value of <option>address_data</option> remains unchanged, and the
34483 <option>more</option> option controls what happens next. Other expansion failures cause
34484 delivery of the address to be deferred.
34485 </para>
34486 <para>
34487 <indexterm role="variable">
34488 <primary><varname>$address_data</varname></primary>
34489 </indexterm>
34490 When the expansion succeeds, the value is retained with the address, and can be
34491 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
34492 routers, and the eventual transport.
34493 </para>
34494 <para>
34495 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
34496 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
34497 in the filter. This is not normally a problem, because such data is usually
34498 either not confidential or it <quote>belongs</quote> to the current user, but if you do
34499 put confidential data into <varname>$address_data</varname> you need to remember this point.
34500 </para>
34501 <para>
34502 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
34503 with the address, though it can be changed by another <option>address_data</option> setting
34504 on a subsequent router. If a router generates child addresses, the value of
34505 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
34506 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
34507 </para>
34508 <para>
34509 The idea of <option>address_data</option> is that you can use it to look up a lot of data
34510 for the address once, and then pick out parts of the data later. For example,
34511 you could use a single LDAP lookup to return a string of the form
34512 </para>
34513 <literallayout class="monospaced">
34514 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
34515 </literallayout>
34516 <para>
34517 In the transport you could pick out the mailbox by a setting such as
34518 </para>
34519 <literallayout class="monospaced">
34520 file = ${extract{mailbox}{$address_data}}
34521 </literallayout>
34522 <para>
34523 This makes the configuration file less messy, and also reduces the number of
34524 lookups (though Exim does cache lookups).
34525 </para>
34526 <para>
34527 See also the <option>set</option> option below.
34528 </para>
34529 <para>
34530 <indexterm role="variable">
34531 <primary><varname>$sender_address_data</varname></primary>
34532 </indexterm>
34533 <indexterm role="variable">
34534 <primary><varname>$address_data</varname></primary>
34535 </indexterm>
34536 The <option>address_data</option> facility is also useful as a means of passing information
34537 from one router to another, and from a router to a transport. In addition, if
34538 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
34539 ACL, it remains available for use in the rest of the ACL statement. After
34540 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
34541 </para>
34542 <para>
34543 <indexterm role="option">
34544 <primary><option>address_test</option></primary>
34545 </indexterm>
34546 </para>
34547 <informaltable frame="all">
34548 <tgroup cols="4" colsep="0" rowsep="0">
34549 <colspec colwidth="8*" align="left"/>
34550 <colspec colwidth="6*" align="center"/>
34551 <colspec colwidth="6*" align="center"/>
34552 <colspec colwidth="6*" align="right"/>
34553 <tbody>
34554 <row>
34555 <entry><option>address_test</option></entry>
34556 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34557 <entry>Type: <emphasis>boolean</emphasis></entry>
34558 <entry>Default: <emphasis>true</emphasis></entry>
34559 </row>
34560 </tbody>
34561 </tgroup>
34562 </informaltable>
34563 <para>
34564 <indexterm role="option">
34565 <primary><option>-bt</option></primary>
34566 </indexterm>
34567 <indexterm role="concept">
34568 <primary>router</primary>
34569 <secondary>skipping when address testing</secondary>
34570 </indexterm>
34571 If this option is set false, the router is skipped when routing is being tested
34572 by means of the <option>-bt</option> command line option. This can be a convenience when
34573 your first router sends messages to an external scanner, because it saves you
34574 having to set the <quote>already scanned</quote> indicator when testing real address
34575 routing.
34576 </para>
34577 <para>
34578 <indexterm role="option">
34579 <primary><option>cannot_route_message</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>cannot_route_message</option></entry>
34591 <entry>Use: <emphasis>routers</emphasis></entry>
34592 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34593 <entry>Default: <emphasis>unset</emphasis></entry>
34594 </row>
34595 </tbody>
34596 </tgroup>
34597 </informaltable>
34598 <para>
34599 <indexterm role="concept">
34600 <primary>router</primary>
34601 <secondary>customizing <quote>cannot route</quote> message</secondary>
34602 </indexterm>
34603 <indexterm role="concept">
34604 <primary>customizing</primary>
34605 <secondary><quote>cannot route</quote> message</secondary>
34606 </indexterm>
34607 This option specifies a text message that is used when an address cannot be
34608 routed because Exim has run out of routers. The default message is
34609 <quote>Unrouteable address</quote>. This option is useful only on routers that have
34610 <option>more</option> set false, or on the very last router in a configuration, because the
34611 value that is used is taken from the last router that is considered. This
34612 includes a router that is skipped because its preconditions are not met, as
34613 well as a router that declines. For example, using the default configuration,
34614 you could put:
34615 </para>
34616 <literallayout class="monospaced">
34617 cannot_route_message = Remote domain not found in DNS
34618 </literallayout>
34619 <para>
34620 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
34621 and
34622 </para>
34623 <literallayout class="monospaced">
34624 cannot_route_message = Unknown local user
34625 </literallayout>
34626 <para>
34627 on the final router that checks for local users. If string expansion fails for
34628 this option, the default message is used. Unless the expansion failure was
34629 explicitly forced, a message about the failure is written to the main and panic
34630 logs, in addition to the normal message about the routing failure.
34631 </para>
34632 <para>
34633 <indexterm role="option">
34634 <primary><option>caseful_local_part</option></primary>
34635 </indexterm>
34636 </para>
34637 <informaltable frame="all">
34638 <tgroup cols="4" colsep="0" rowsep="0">
34639 <colspec colwidth="8*" align="left"/>
34640 <colspec colwidth="6*" align="center"/>
34641 <colspec colwidth="6*" align="center"/>
34642 <colspec colwidth="6*" align="right"/>
34643 <tbody>
34644 <row>
34645 <entry><option>caseful_local_part</option></entry>
34646 <entry>Use: <emphasis>routers</emphasis></entry>
34647 <entry>Type: <emphasis>boolean</emphasis></entry>
34648 <entry>Default: <emphasis>false</emphasis></entry>
34649 </row>
34650 </tbody>
34651 </tgroup>
34652 </informaltable>
34653 <para>
34654 <indexterm role="concept">
34655 <primary>case of local parts</primary>
34656 </indexterm>
34657 <indexterm role="concept">
34658 <primary>router</primary>
34659 <secondary>case of local parts</secondary>
34660 </indexterm>
34661 By default, routers handle the local parts of addresses in a case-insensitive
34662 manner, though the actual case is preserved for transmission with the message.
34663 If you want the case of letters to be significant in a router, you must set
34664 this option true. For individual router options that contain address or local
34665 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
34666 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
34667 more details.
34668 </para>
34669 <para>
34670 <indexterm role="variable">
34671 <primary><varname>$local_part</varname></primary>
34672 </indexterm>
34673 <indexterm role="variable">
34674 <primary><varname>$original_local_part</varname></primary>
34675 </indexterm>
34676 <indexterm role="variable">
34677 <primary><varname>$parent_local_part</varname></primary>
34678 </indexterm>
34679 The value of the <varname>$local_part</varname> variable is forced to lower case while a
34680 router is running unless <option>caseful_local_part</option> is set. When a router assigns
34681 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
34682 is the same as it was in the router. Similarly, when a router generates child
34683 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
34684 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
34685 </para>
34686 <para>
34687 This option applies to the processing of an address by a router. When a
34688 recipient address is being processed in an ACL, there is a separate <option>control</option>
34689 modifier that can be used to specify case-sensitive processing within the ACL
34690 (see section <xref linkend="SECTcontrols"/>).
34691 </para>
34692 <para>
34693 <indexterm role="option">
34694 <primary><option>check_local_user</option></primary>
34695 </indexterm>
34696 </para>
34697 <informaltable frame="all">
34698 <tgroup cols="4" colsep="0" rowsep="0">
34699 <colspec colwidth="8*" align="left"/>
34700 <colspec colwidth="6*" align="center"/>
34701 <colspec colwidth="6*" align="center"/>
34702 <colspec colwidth="6*" align="right"/>
34703 <tbody>
34704 <row>
34705 <entry><option>check_local_user</option></entry>
34706 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34707 <entry>Type: <emphasis>boolean</emphasis></entry>
34708 <entry>Default: <emphasis>false</emphasis></entry>
34709 </row>
34710 </tbody>
34711 </tgroup>
34712 </informaltable>
34713 <para>
34714 <indexterm role="concept">
34715 <primary>local user, checking in router</primary>
34716 </indexterm>
34717 <indexterm role="concept">
34718 <primary>router</primary>
34719 <secondary>checking for local user</secondary>
34720 </indexterm>
34721 <indexterm role="concept">
34722 <primary><filename>/etc/passwd</filename></primary>
34723 </indexterm>
34724 <indexterm role="variable">
34725 <primary><varname>$home</varname></primary>
34726 </indexterm>
34727 When this option is true, Exim checks that the local part of the recipient
34728 address (with affixes removed if relevant) is the name of an account on the
34729 local system. The check is done by calling the <function>getpwnam()</function> function rather
34730 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
34731 holding password data (such as NIS) are supported. If the local part is a local
34732 user, <varname>$home</varname> is set from the password data, and can be tested in other
34733 preconditions that are evaluated after this one (the order of evaluation is
34734 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
34735 overridden by <option>router_home_directory</option>. If the local part is not a local user,
34736 the router is skipped.
34737 </para>
34738 <para>
34739 If you want to check that the local part is either the name of a local user
34740 or matches something else, you cannot combine <option>check_local_user</option> with a
34741 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
34742 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
34743 setting to achieve this. For example:
34744 </para>
34745 <literallayout class="monospaced">
34746 local_parts = passwd;$local_part : lsearch;/etc/other/users
34747 </literallayout>
34748 <para>
34749 Note, however, that the side effects of <option>check_local_user</option> (such as setting
34750 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
34751 <option>local_parts</option> (or any other) precondition.
34752 </para>
34753 <para>
34754 <indexterm role="option">
34755 <primary><option>condition</option></primary>
34756 </indexterm>
34757 </para>
34758 <informaltable frame="all">
34759 <tgroup cols="4" colsep="0" rowsep="0">
34760 <colspec colwidth="8*" align="left"/>
34761 <colspec colwidth="6*" align="center"/>
34762 <colspec colwidth="6*" align="center"/>
34763 <colspec colwidth="6*" align="right"/>
34764 <tbody>
34765 <row>
34766 <entry><option>condition</option></entry>
34767 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
34768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34769 <entry>Default: <emphasis>unset</emphasis></entry>
34770 </row>
34771 </tbody>
34772 </tgroup>
34773 </informaltable>
34774 <para>
34775 <indexterm role="concept">
34776 <primary>router</primary>
34777 <secondary>customized precondition</secondary>
34778 </indexterm>
34779 This option specifies a general precondition test that has to succeed for the
34780 router to be called. The <option>condition</option> option is the last precondition to be
34781 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
34782 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
34783 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
34784 router is skipped, and the address is offered to the next one.
34785 </para>
34786 <para>
34787 If the result is any other value, the router is run (as this is the last
34788 precondition to be evaluated, all the other preconditions must be true).
34789 </para>
34790 <para>
34791 This option is unusual in that multiple <option>condition</option> options may be present.
34792 All <option>condition</option> options must succeed.
34793 </para>
34794 <para>
34795 The <option>condition</option> option provides a means of applying custom conditions to the
34796 running of routers. Note that in the case of a simple conditional expansion,
34797 the default expansion values are exactly what is wanted. For example:
34798 </para>
34799 <literallayout class="monospaced">
34800 condition = ${if &gt;{$message_age}{600}}
34801 </literallayout>
34802 <para>
34803 Because of the default behaviour of the string expansion, this is equivalent to
34804 </para>
34805 <literallayout class="monospaced">
34806 condition = ${if &gt;{$message_age}{600}{true}{}}
34807 </literallayout>
34808 <para>
34809 A multiple condition example, which succeeds:
34810 </para>
34811 <literallayout class="monospaced">
34812 condition = ${if &gt;{$message_age}{600}}
34813 condition = ${if !eq{${lc:$local_part}}{postmaster}}
34814 condition = foobar
34815 </literallayout>
34816 <para>
34817 If the expansion fails (other than forced failure) delivery is deferred. Some
34818 of the other precondition options are common special cases that could in fact
34819 be specified using <option>condition</option>.
34820 </para>
34821 <para>
34822 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
34823 are far older, and use one set of semantics.  ACLs are newer and when
34824 they were created, the ACL <option>condition</option> process was given far stricter
34825 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
34826 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
34827 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
34828 Router rules processing behavior.
34829 </para>
34830 <para>
34831 This is best illustrated in an example:
34832 </para>
34833 <literallayout class="monospaced">
34834 # If used in an ACL condition will fail with a syntax error, but
34835 # in a router condition any extra characters are treated as a string
34836
34837 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
34838 true {yes} {no}}
34839
34840 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
34841  {yes} {no}}
34842 </literallayout>
34843 <para>
34844 In each example above, the <option>if</option> statement actually ends after
34845 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
34846 default <option>if</option> behavior is to return a boolean true or a null answer
34847 (which evaluates to false). The rest of the line is then treated as a
34848 string. So the first example resulted in the boolean answer <quote>true</quote>
34849 with the string <quote> {yes} {no}}</quote> appended to it. The second example
34850 resulted in the null output (indicating false) with the string
34851 <quote> {yes} {no}}</quote> appended to it.
34852 </para>
34853 <para>
34854 In fact you can put excess forward braces in too.  In the router
34855 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
34856 mean something, like after a <quote>$</quote> or when required as part of a
34857 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
34858 string characters.
34859 </para>
34860 <para>
34861 Thus, in a Router, the above expansion strings will both always evaluate
34862 true, as the result of expansion is a non-empty string which doesn&#x2019;t
34863 match an explicit false value.  This can be tricky to debug.  By
34864 contrast, in an ACL either of those strings will always result in an
34865 expansion error because the result doesn&#x2019;t look sufficiently boolean.
34866 </para>
34867 <para>
34868 <indexterm role="option">
34869 <primary><option>debug_print</option></primary>
34870 </indexterm>
34871 </para>
34872 <informaltable frame="all">
34873 <tgroup cols="4" colsep="0" rowsep="0">
34874 <colspec colwidth="8*" align="left"/>
34875 <colspec colwidth="6*" align="center"/>
34876 <colspec colwidth="6*" align="center"/>
34877 <colspec colwidth="6*" align="right"/>
34878 <tbody>
34879 <row>
34880 <entry><option>debug_print</option></entry>
34881 <entry>Use: <emphasis>routers</emphasis></entry>
34882 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34883 <entry>Default: <emphasis>unset</emphasis></entry>
34884 </row>
34885 </tbody>
34886 </tgroup>
34887 </informaltable>
34888 <para>
34889 <indexterm role="concept">
34890 <primary>testing</primary>
34891 <secondary>variables in drivers</secondary>
34892 </indexterm>
34893 If this option is set and debugging is enabled (see the <option>-d</option> command line
34894 option) or in address-testing mode (see the <option>-bt</option> command line option),
34895 the string is expanded and included in the debugging output.
34896 If expansion of the string fails, the error message is written to the debugging
34897 output, and Exim carries on processing.
34898 This option is provided to help with checking out the values of variables and
34899 so on when debugging router configurations. For example, if a <option>condition</option>
34900 option appears not to be working, <option>debug_print</option> can be used to output the
34901 variables it references. The output happens after checks for <option>domains</option>,
34902 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
34903 are tested. A newline is added to the text if it does not end with one.
34904 The variable <varname>$router_name</varname> contains the name of the router.
34905 </para>
34906 <para>
34907 <indexterm role="option">
34908 <primary><option>disable_logging</option></primary>
34909 </indexterm>
34910 </para>
34911 <informaltable frame="all">
34912 <tgroup cols="4" colsep="0" rowsep="0">
34913 <colspec colwidth="8*" align="left"/>
34914 <colspec colwidth="6*" align="center"/>
34915 <colspec colwidth="6*" align="center"/>
34916 <colspec colwidth="6*" align="right"/>
34917 <tbody>
34918 <row>
34919 <entry><option>disable_logging</option></entry>
34920 <entry>Use: <emphasis>routers</emphasis></entry>
34921 <entry>Type: <emphasis>boolean</emphasis></entry>
34922 <entry>Default: <emphasis>false</emphasis></entry>
34923 </row>
34924 </tbody>
34925 </tgroup>
34926 </informaltable>
34927 <para>
34928 If this option is set true, nothing is logged for any routing errors
34929 or for any deliveries caused by this router. You should not set this option
34930 unless you really, really know what you are doing. See also the generic
34931 transport option of the same name.
34932 </para>
34933 <para>
34934 <indexterm role="option">
34935 <primary><option>dnssec_request_domains</option></primary>
34936 </indexterm>
34937 </para>
34938 <informaltable frame="all">
34939 <tgroup cols="4" colsep="0" rowsep="0">
34940 <colspec colwidth="8*" align="left"/>
34941 <colspec colwidth="6*" align="center"/>
34942 <colspec colwidth="6*" align="center"/>
34943 <colspec colwidth="6*" align="right"/>
34944 <tbody>
34945 <row>
34946 <entry><option>dnssec_request_domains</option></entry>
34947 <entry>Use: <emphasis>routers</emphasis></entry>
34948 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34949 <entry>Default: <emphasis>*</emphasis></entry>
34950 </row>
34951 </tbody>
34952 </tgroup>
34953 </informaltable>
34954 <para>
34955 <indexterm role="concept">
34956 <primary>MX record</primary>
34957 <secondary>security</secondary>
34958 </indexterm>
34959 <indexterm role="concept">
34960 <primary>DNSSEC</primary>
34961 <secondary>MX lookup</secondary>
34962 </indexterm>
34963 <indexterm role="concept">
34964 <primary>security</primary>
34965 <secondary>MX lookup</secondary>
34966 </indexterm>
34967 <indexterm role="concept">
34968 <primary>DNS</primary>
34969 <secondary>DNSSEC</secondary>
34970 </indexterm>
34971 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
34972 the dnssec request bit set.
34973 This applies to all of the SRV, MX, AAAA, A lookup sequence.
34974 </para>
34975 <para>
34976 <indexterm role="option">
34977 <primary><option>dnssec_require_domains</option></primary>
34978 </indexterm>
34979 </para>
34980 <informaltable frame="all">
34981 <tgroup cols="4" colsep="0" rowsep="0">
34982 <colspec colwidth="8*" align="left"/>
34983 <colspec colwidth="6*" align="center"/>
34984 <colspec colwidth="6*" align="center"/>
34985 <colspec colwidth="6*" align="right"/>
34986 <tbody>
34987 <row>
34988 <entry><option>dnssec_require_domains</option></entry>
34989 <entry>Use: <emphasis>routers</emphasis></entry>
34990 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
34991 <entry>Default: <emphasis>unset</emphasis></entry>
34992 </row>
34993 </tbody>
34994 </tgroup>
34995 </informaltable>
34996 <para>
34997 <indexterm role="concept">
34998 <primary>MX record</primary>
34999 <secondary>security</secondary>
35000 </indexterm>
35001 <indexterm role="concept">
35002 <primary>DNSSEC</primary>
35003 <secondary>MX lookup</secondary>
35004 </indexterm>
35005 <indexterm role="concept">
35006 <primary>security</primary>
35007 <secondary>MX lookup</secondary>
35008 </indexterm>
35009 <indexterm role="concept">
35010 <primary>DNS</primary>
35011 <secondary>DNSSEC</secondary>
35012 </indexterm>
35013 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
35014 the dnssec request bit set.  Any returns not having the Authenticated Data bit
35015 (AD bit) set will be ignored and logged as a host-lookup failure.
35016 This applies to all of the SRV, MX, AAAA, A lookup sequence.
35017 </para>
35018 <para>
35019 <indexterm role="option">
35020 <primary><option>domains</option></primary>
35021 </indexterm>
35022 </para>
35023 <informaltable frame="all">
35024 <tgroup cols="4" colsep="0" rowsep="0">
35025 <colspec colwidth="8*" align="left"/>
35026 <colspec colwidth="6*" align="center"/>
35027 <colspec colwidth="6*" align="center"/>
35028 <colspec colwidth="6*" align="right"/>
35029 <tbody>
35030 <row>
35031 <entry><option>domains</option></entry>
35032 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35033 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
35034 <entry>Default: <emphasis>unset</emphasis></entry>
35035 </row>
35036 </tbody>
35037 </tgroup>
35038 </informaltable>
35039 <para>
35040 <indexterm role="concept">
35041 <primary>router</primary>
35042 <secondary>restricting to specific domains</secondary>
35043 </indexterm>
35044 <indexterm role="variable">
35045 <primary><varname>$domain_data</varname></primary>
35046 </indexterm>
35047 If this option is set, the router is skipped unless the current domain matches
35048 the list. If the match is achieved by means of a file lookup, the data that the
35049 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
35050 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
35051 a list of the order in which preconditions are evaluated.
35052 </para>
35053 <para>
35054 <indexterm role="option">
35055 <primary><option>driver</option></primary>
35056 </indexterm>
35057 </para>
35058 <informaltable frame="all">
35059 <tgroup cols="4" colsep="0" rowsep="0">
35060 <colspec colwidth="8*" align="left"/>
35061 <colspec colwidth="6*" align="center"/>
35062 <colspec colwidth="6*" align="center"/>
35063 <colspec colwidth="6*" align="right"/>
35064 <tbody>
35065 <row>
35066 <entry><option>driver</option></entry>
35067 <entry>Use: <emphasis>routers</emphasis></entry>
35068 <entry>Type: <emphasis>string</emphasis></entry>
35069 <entry>Default: <emphasis>unset</emphasis></entry>
35070 </row>
35071 </tbody>
35072 </tgroup>
35073 </informaltable>
35074 <para>
35075 This option must always be set. It specifies which of the available routers is
35076 to be used.
35077 </para>
35078 <para>
35079 <indexterm role="option">
35080 <primary><option>dsn_lasthop</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>dsn_lasthop</option></entry>
35092 <entry>Use: <emphasis>routers</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>DSN</primary>
35102 <secondary>success</secondary>
35103 </indexterm>
35104 <indexterm role="concept">
35105 <primary>Delivery Status Notification</primary>
35106 <secondary>success</secondary>
35107 </indexterm>
35108 If this option is set true, and extended DSN (RFC3461) processing is in effect,
35109 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
35110 instead send a success DSN as if the next hop does not support DSN.
35111 Not effective on redirect routers.
35112 </para>
35113 <para>
35114 <indexterm role="option">
35115 <primary><option>errors_to</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>errors_to</option></entry>
35127 <entry>Use: <emphasis>routers</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>envelope from</primary>
35137 </indexterm>
35138 <indexterm role="concept">
35139 <primary>envelope sender</primary>
35140 </indexterm>
35141 <indexterm role="concept">
35142 <primary>router</primary>
35143 <secondary>changing address for errors</secondary>
35144 </indexterm>
35145 If a router successfully handles an address, it may assign the address to a
35146 transport for delivery or it may generate child addresses. In both cases, if
35147 there is a delivery problem during later processing, the resulting bounce
35148 message is sent to the address that results from expanding this string,
35149 provided that the address verifies successfully. The <option>errors_to</option> option is
35150 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
35151 </para>
35152 <para>
35153 The <option>errors_to</option> setting associated with an address can be overridden if it
35154 subsequently passes through other routers that have their own <option>errors_to</option>
35155 settings, or if the message is delivered by a transport with a <option>return_path</option>
35156 setting.
35157 </para>
35158 <para>
35159 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
35160 the expansion fails to verify, the errors address associated with the incoming
35161 address is used. At top level, this is the envelope sender. A non-forced
35162 expansion failure causes delivery to be deferred.
35163 </para>
35164 <para>
35165 If an address for which <option>errors_to</option> has been set ends up being delivered over
35166 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
35167 any bounces that are generated by other MTAs on the delivery route are also
35168 sent there. You can set <option>errors_to</option> to the empty string by either of these
35169 settings:
35170 </para>
35171 <literallayout class="monospaced">
35172 errors_to =
35173 errors_to = ""
35174 </literallayout>
35175 <para>
35176 An expansion item that yields an empty string has the same effect. If you do
35177 this, a locally detected delivery error for addresses processed by this router
35178 no longer gives rise to a bounce message; the error is discarded. If the
35179 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
35180 overridden by the <option>return_path</option> option on the transport.
35181 </para>
35182 <para>
35183 <indexterm role="variable">
35184 <primary><varname>$address_data</varname></primary>
35185 </indexterm>
35186 If for some reason you want to discard local errors, but use a non-empty
35187 MAIL command for remote delivery, you can preserve the original return
35188 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
35189 setting <option>return_path</option>.
35190 </para>
35191 <para>
35192 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
35193 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
35194 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
35195 </para>
35196 <para>
35197 <indexterm role="option">
35198 <primary><option>expn</option></primary>
35199 </indexterm>
35200 </para>
35201 <informaltable frame="all">
35202 <tgroup cols="4" colsep="0" rowsep="0">
35203 <colspec colwidth="8*" align="left"/>
35204 <colspec colwidth="6*" align="center"/>
35205 <colspec colwidth="6*" align="center"/>
35206 <colspec colwidth="6*" align="right"/>
35207 <tbody>
35208 <row>
35209 <entry><option>expn</option></entry>
35210 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35211 <entry>Type: <emphasis>boolean</emphasis></entry>
35212 <entry>Default: <emphasis>true</emphasis></entry>
35213 </row>
35214 </tbody>
35215 </tgroup>
35216 </informaltable>
35217 <para>
35218 <indexterm role="concept">
35219 <primary>address</primary>
35220 <secondary>testing</secondary>
35221 </indexterm>
35222 <indexterm role="concept">
35223 <primary>testing</primary>
35224 <secondary>addresses</secondary>
35225 </indexterm>
35226 <indexterm role="concept">
35227 <primary>EXPN</primary>
35228 <secondary>router skipping</secondary>
35229 </indexterm>
35230 <indexterm role="concept">
35231 <primary>router</primary>
35232 <secondary>skipping for EXPN</secondary>
35233 </indexterm>
35234 If this option is turned off, the router is skipped when testing an address
35235 as a result of processing an SMTP EXPN command. You might, for example,
35236 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
35237 on for the system alias file.
35238 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35239 are evaluated.
35240 </para>
35241 <para>
35242 The use of the SMTP EXPN command is controlled by an ACL (see chapter
35243 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
35244 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
35245 </para>
35246 <para>
35247 <indexterm role="option">
35248 <primary><option>fail_verify</option></primary>
35249 </indexterm>
35250 </para>
35251 <informaltable frame="all">
35252 <tgroup cols="4" colsep="0" rowsep="0">
35253 <colspec colwidth="8*" align="left"/>
35254 <colspec colwidth="6*" align="center"/>
35255 <colspec colwidth="6*" align="center"/>
35256 <colspec colwidth="6*" align="right"/>
35257 <tbody>
35258 <row>
35259 <entry><option>fail_verify</option></entry>
35260 <entry>Use: <emphasis>routers</emphasis></entry>
35261 <entry>Type: <emphasis>boolean</emphasis></entry>
35262 <entry>Default: <emphasis>false</emphasis></entry>
35263 </row>
35264 </tbody>
35265 </tgroup>
35266 </informaltable>
35267 <para>
35268 <indexterm role="concept">
35269 <primary>router</primary>
35270 <secondary>forcing verification failure</secondary>
35271 </indexterm>
35272 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
35273 <option>fail_verify_recipient</option> to the same value.
35274 </para>
35275 <para>
35276 <indexterm role="option">
35277 <primary><option>fail_verify_recipient</option></primary>
35278 </indexterm>
35279 </para>
35280 <informaltable frame="all">
35281 <tgroup cols="4" colsep="0" rowsep="0">
35282 <colspec colwidth="8*" align="left"/>
35283 <colspec colwidth="6*" align="center"/>
35284 <colspec colwidth="6*" align="center"/>
35285 <colspec colwidth="6*" align="right"/>
35286 <tbody>
35287 <row>
35288 <entry><option>fail_verify_recipient</option></entry>
35289 <entry>Use: <emphasis>routers</emphasis></entry>
35290 <entry>Type: <emphasis>boolean</emphasis></entry>
35291 <entry>Default: <emphasis>false</emphasis></entry>
35292 </row>
35293 </tbody>
35294 </tgroup>
35295 </informaltable>
35296 <para>
35297 If this option is true and an address is accepted by this router when
35298 verifying a recipient, verification fails.
35299 </para>
35300 <para>
35301 <indexterm role="option">
35302 <primary><option>fail_verify_sender</option></primary>
35303 </indexterm>
35304 </para>
35305 <informaltable frame="all">
35306 <tgroup cols="4" colsep="0" rowsep="0">
35307 <colspec colwidth="8*" align="left"/>
35308 <colspec colwidth="6*" align="center"/>
35309 <colspec colwidth="6*" align="center"/>
35310 <colspec colwidth="6*" align="right"/>
35311 <tbody>
35312 <row>
35313 <entry><option>fail_verify_sender</option></entry>
35314 <entry>Use: <emphasis>routers</emphasis></entry>
35315 <entry>Type: <emphasis>boolean</emphasis></entry>
35316 <entry>Default: <emphasis>false</emphasis></entry>
35317 </row>
35318 </tbody>
35319 </tgroup>
35320 </informaltable>
35321 <para>
35322 If this option is true and an address is accepted by this router when
35323 verifying a sender, verification fails.
35324 </para>
35325 <para>
35326 <indexterm role="option">
35327 <primary><option>fallback_hosts</option></primary>
35328 </indexterm>
35329 </para>
35330 <informaltable frame="all">
35331 <tgroup cols="4" colsep="0" rowsep="0">
35332 <colspec colwidth="8*" align="left"/>
35333 <colspec colwidth="6*" align="center"/>
35334 <colspec colwidth="6*" align="center"/>
35335 <colspec colwidth="6*" align="right"/>
35336 <tbody>
35337 <row>
35338 <entry><option>fallback_hosts</option></entry>
35339 <entry>Use: <emphasis>routers</emphasis></entry>
35340 <entry>Type: <emphasis>string list</emphasis></entry>
35341 <entry>Default: <emphasis>unset</emphasis></entry>
35342 </row>
35343 </tbody>
35344 </tgroup>
35345 </informaltable>
35346 <para>
35347 <indexterm role="concept">
35348 <primary>router</primary>
35349 <secondary>fallback hosts</secondary>
35350 </indexterm>
35351 <indexterm role="concept">
35352 <primary>fallback</primary>
35353 <secondary>hosts specified on router</secondary>
35354 </indexterm>
35355 String expansion is not applied to this option. The argument must be a
35356 colon-separated list of host names or IP addresses. The list separator can be
35357 changed (see section <xref linkend="SECTlistsepchange"/>), and a port can be specified with
35358 each name or address. In fact, the format of each item is exactly the same as
35359 defined for the list of hosts in a <command>manualroute</command> router (see section
35360 <xref linkend="SECTformatonehostitem"/>).
35361 </para>
35362 <para>
35363 If a router queues an address for a remote transport, this host list is
35364 associated with the address, and used instead of the transport&#x2019;s fallback host
35365 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
35366 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
35367 transport for further details.
35368 </para>
35369 <para>
35370 <indexterm role="option">
35371 <primary><option>group</option></primary>
35372 </indexterm>
35373 </para>
35374 <informaltable frame="all">
35375 <tgroup cols="4" colsep="0" rowsep="0">
35376 <colspec colwidth="8*" align="left"/>
35377 <colspec colwidth="6*" align="center"/>
35378 <colspec colwidth="6*" align="center"/>
35379 <colspec colwidth="6*" align="right"/>
35380 <tbody>
35381 <row>
35382 <entry><option>group</option></entry>
35383 <entry>Use: <emphasis>routers</emphasis></entry>
35384 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35385 <entry>Default: <emphasis>see below</emphasis></entry>
35386 </row>
35387 </tbody>
35388 </tgroup>
35389 </informaltable>
35390 <para>
35391 <indexterm role="concept">
35392 <primary>gid (group id)</primary>
35393 <secondary>local delivery</secondary>
35394 </indexterm>
35395 <indexterm role="concept">
35396 <primary>local transports</primary>
35397 <secondary>uid and gid</secondary>
35398 </indexterm>
35399 <indexterm role="concept">
35400 <primary>transport</primary>
35401 <secondary>local</secondary>
35402 </indexterm>
35403 <indexterm role="concept">
35404 <primary>router</primary>
35405 <secondary>setting group</secondary>
35406 </indexterm>
35407 When a router queues an address for a transport, and the transport does not
35408 specify a group, the group given here is used when running the delivery
35409 process.
35410 The group may be specified numerically or by name. If expansion fails, the
35411 error is logged and delivery is deferred.
35412 The default is unset, unless <option>check_local_user</option> is set, when the default
35413 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
35414 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
35415 </para>
35416 <para>
35417 <indexterm role="option">
35418 <primary><option>headers_add</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>headers_add</option></entry>
35430 <entry>Use: <emphasis>routers</emphasis></entry>
35431 <entry>Type: <emphasis>list</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>header lines</primary>
35440 <secondary>adding</secondary>
35441 </indexterm>
35442 <indexterm role="concept">
35443 <primary>router</primary>
35444 <secondary>adding header lines</secondary>
35445 </indexterm>
35446 This option specifies a list of text headers,
35447 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
35448 that is associated with any addresses that are accepted by the router.
35449 Each item is separately expanded, at routing time.  However, this
35450 option has no effect when an address is just being verified. The way in which
35451 the text is used to add header lines at transport time is described in section
35452 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
35453 message is in the process of being transported. This means that references to
35454 header lines in string expansions in the transport&#x2019;s configuration do not
35455 <quote>see</quote> the added header lines.
35456 </para>
35457 <para>
35458 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
35459 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
35460 an item expansion is forced to fail, the item has no effect. Other expansion
35461 failures are treated as configuration errors.
35462 </para>
35463 <para>
35464 Unlike most options, <option>headers_add</option> can be specified multiple times
35465 for a router; all listed headers are added.
35466 </para>
35467 <para>
35468 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
35469 router that has the <option>one_time</option> option set.
35470 </para>
35471 <para>
35472 <indexterm role="concept">
35473 <primary>duplicate addresses</primary>
35474 </indexterm>
35475 <indexterm role="option">
35476 <primary><option>unseen</option></primary>
35477 </indexterm>
35478 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
35479 additions are deleted when the address is passed on to subsequent routers.
35480 For a <option>redirect</option> router, if a generated address is the same as the incoming
35481 address, this can lead to duplicate addresses with different header
35482 modifications. Exim does not do duplicate deliveries (except, in certain
35483 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
35484 which of the duplicates is discarded, so this ambiguous situation should be
35485 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
35486 </para>
35487 <para>
35488 <indexterm role="option">
35489 <primary><option>headers_remove</option></primary>
35490 </indexterm>
35491 </para>
35492 <informaltable frame="all">
35493 <tgroup cols="4" colsep="0" rowsep="0">
35494 <colspec colwidth="8*" align="left"/>
35495 <colspec colwidth="6*" align="center"/>
35496 <colspec colwidth="6*" align="center"/>
35497 <colspec colwidth="6*" align="right"/>
35498 <tbody>
35499 <row>
35500 <entry><option>headers_remove</option></entry>
35501 <entry>Use: <emphasis>routers</emphasis></entry>
35502 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
35503 <entry>Default: <emphasis>unset</emphasis></entry>
35504 </row>
35505 </tbody>
35506 </tgroup>
35507 </informaltable>
35508 <para>
35509 <indexterm role="concept">
35510 <primary>header lines</primary>
35511 <secondary>removing</secondary>
35512 </indexterm>
35513 <indexterm role="concept">
35514 <primary>router</primary>
35515 <secondary>removing header lines</secondary>
35516 </indexterm>
35517 This option specifies a list of text headers,
35518 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
35519 that is associated with any addresses that are accepted by the router.
35520 However, the option has no effect when an address is just being verified.
35521 Each list item is separately expanded, at transport time.
35522 </para>
35523 <para revisionflag="changed">
35524 If an item ends in *, it will match any header with the given prefix.
35525 </para>
35526 <para>
35527 The way in which
35528 the text is used to remove header lines at transport time is described in
35529 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
35530 the message is in the process of being transported. This means that references
35531 to header lines in string expansions in the transport&#x2019;s configuration still
35532 <quote>see</quote> the original header lines.
35533 </para>
35534 <para>
35535 The <option>headers_remove</option> option is handled after <option>errors_to</option> and
35536 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
35537 the item has no effect. Other expansion failures are treated as configuration
35538 errors.
35539 </para>
35540 <para>
35541 Unlike most options, <option>headers_remove</option> can be specified multiple times
35542 for a router; all listed headers are removed.
35543 </para>
35544 <para>
35545 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
35546 router that has the <option>one_time</option> option set.
35547 </para>
35548 <para>
35549 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
35550 removal requests are deleted when the address is passed on to subsequent
35551 routers, and this can lead to problems with duplicates -- see the similar
35552 warning for <option>headers_add</option> above.
35553 </para>
35554 <para>
35555 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
35556 items that contain a list separator must have it doubled.
35557 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
35558 </para>
35559 <para>
35560 <indexterm role="option">
35561 <primary><option>ignore_target_hosts</option></primary>
35562 </indexterm>
35563 </para>
35564 <informaltable frame="all">
35565 <tgroup cols="4" colsep="0" rowsep="0">
35566 <colspec colwidth="8*" align="left"/>
35567 <colspec colwidth="6*" align="center"/>
35568 <colspec colwidth="6*" align="center"/>
35569 <colspec colwidth="6*" align="right"/>
35570 <tbody>
35571 <row>
35572 <entry><option>ignore_target_hosts</option></entry>
35573 <entry>Use: <emphasis>routers</emphasis></entry>
35574 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35575 <entry>Default: <emphasis>unset</emphasis></entry>
35576 </row>
35577 </tbody>
35578 </tgroup>
35579 </informaltable>
35580 <para>
35581 <indexterm role="concept">
35582 <primary>IP address</primary>
35583 <secondary>discarding</secondary>
35584 </indexterm>
35585 <indexterm role="concept">
35586 <primary>router</primary>
35587 <secondary>discarding IP addresses</secondary>
35588 </indexterm>
35589 Although this option is a host list, it should normally contain IP address
35590 entries rather than names. If any host that is looked up by the router has an
35591 IP address that matches an item in this list, Exim behaves as if that IP
35592 address did not exist. This option allows you to cope with rogue DNS entries
35593 like
35594 </para>
35595 <literallayout class="monospaced">
35596 remote.domain.example.  A  127.0.0.1
35597 </literallayout>
35598 <para>
35599 by setting
35600 </para>
35601 <literallayout class="monospaced">
35602 ignore_target_hosts = 127.0.0.1
35603 </literallayout>
35604 <para>
35605 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
35606 discarded in this way, the router declines. In a conventional configuration, an
35607 attempt to mail to such a domain would normally provoke the <quote>unrouteable
35608 domain</quote> error, and an attempt to verify an address in the domain would fail.
35609 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
35610 router declines if presented with one of the listed addresses.
35611 </para>
35612 <para>
35613 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
35614 means of the first or the second of the following settings, respectively:
35615 </para>
35616 <literallayout class="monospaced">
35617 ignore_target_hosts = 0.0.0.0/0
35618 ignore_target_hosts = &lt;; 0::0/0
35619 </literallayout>
35620 <para>
35621 The pattern in the first line matches all IPv4 addresses, whereas the pattern
35622 in the second line matches all IPv6 addresses.
35623 </para>
35624 <para>
35625 This option may also be useful for ignoring link-local and site-local IPv6
35626 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
35627 is expanded before use as a list, it is possible to make it dependent on the
35628 domain that is being routed.
35629 </para>
35630 <para>
35631 <indexterm role="variable">
35632 <primary><varname>$host_address</varname></primary>
35633 </indexterm>
35634 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
35635 checked.
35636 </para>
35637 <para>
35638 <indexterm role="option">
35639 <primary><option>initgroups</option></primary>
35640 </indexterm>
35641 </para>
35642 <informaltable frame="all">
35643 <tgroup cols="4" colsep="0" rowsep="0">
35644 <colspec colwidth="8*" align="left"/>
35645 <colspec colwidth="6*" align="center"/>
35646 <colspec colwidth="6*" align="center"/>
35647 <colspec colwidth="6*" align="right"/>
35648 <tbody>
35649 <row>
35650 <entry><option>initgroups</option></entry>
35651 <entry>Use: <emphasis>routers</emphasis></entry>
35652 <entry>Type: <emphasis>boolean</emphasis></entry>
35653 <entry>Default: <emphasis>false</emphasis></entry>
35654 </row>
35655 </tbody>
35656 </tgroup>
35657 </informaltable>
35658 <para>
35659 <indexterm role="concept">
35660 <primary>additional groups</primary>
35661 </indexterm>
35662 <indexterm role="concept">
35663 <primary>groups</primary>
35664 <secondary>additional</secondary>
35665 </indexterm>
35666 <indexterm role="concept">
35667 <primary>local transports</primary>
35668 <secondary>uid and gid</secondary>
35669 </indexterm>
35670 <indexterm role="concept">
35671 <primary>transport</primary>
35672 <secondary>local</secondary>
35673 </indexterm>
35674 If the router queues an address for a transport, and this option is true, and
35675 the uid supplied by the router is not overridden by the transport, the
35676 <function>initgroups()</function> function is called when running the transport to ensure that
35677 any additional groups associated with the uid are set up. See also <option>group</option>
35678 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
35679 </para>
35680 <para>
35681 <indexterm role="option">
35682 <primary><option>local_part_prefix</option></primary>
35683 </indexterm>
35684 </para>
35685 <informaltable frame="all">
35686 <tgroup cols="4" colsep="0" rowsep="0">
35687 <colspec colwidth="8*" align="left"/>
35688 <colspec colwidth="6*" align="center"/>
35689 <colspec colwidth="6*" align="center"/>
35690 <colspec colwidth="6*" align="right"/>
35691 <tbody>
35692 <row>
35693 <entry><option>local_part_prefix</option></entry>
35694 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35695 <entry>Type: <emphasis>string list</emphasis></entry>
35696 <entry>Default: <emphasis>unset</emphasis></entry>
35697 </row>
35698 </tbody>
35699 </tgroup>
35700 </informaltable>
35701 <para>
35702 <indexterm role="concept">
35703 <primary>affix</primary>
35704 <secondary>router precondition</secondary>
35705 </indexterm>
35706 <indexterm role="concept">
35707 <primary>router</primary>
35708 <secondary>prefix for local part</secondary>
35709 </indexterm>
35710 <indexterm role="concept">
35711 <primary>prefix</primary>
35712 <secondary>for local part, used in router</secondary>
35713 </indexterm>
35714 If this option is set, the router is skipped unless the local part starts with
35715 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
35716 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
35717 evaluated.
35718 </para>
35719 <para>
35720 The list is scanned from left to right, and the first prefix that matches is
35721 used. A limited form of wildcard is available; if the prefix begins with an
35722 asterisk, it matches the longest possible sequence of arbitrary characters at
35723 the start of the local part. An asterisk should therefore always be followed by
35724 some character that does not occur in normal local parts.
35725 <indexterm role="concept">
35726 <primary>multiple mailboxes</primary>
35727 </indexterm>
35728 <indexterm role="concept">
35729 <primary>mailbox</primary>
35730 <secondary>multiple</secondary>
35731 </indexterm>
35732 Wildcarding can be used to set up multiple user mailboxes, as described in
35733 section <xref linkend="SECTmulbox"/>.
35734 </para>
35735 <para>
35736 <indexterm role="variable">
35737 <primary><varname>$local_part</varname></primary>
35738 </indexterm>
35739 <indexterm role="variable">
35740 <primary><varname>$local_part_prefix</varname></primary>
35741 </indexterm>
35742 During the testing of the <option>local_parts</option> option, and while the router is
35743 running, the prefix is removed from the local part, and is available in the
35744 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
35745 the router accepts the address, this remains true during subsequent delivery by
35746 a transport. In particular, the local part that is transmitted in the RCPT
35747 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
35748 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
35749 the relevant transport.
35750 </para>
35751 <para revisionflag="changed">
35752 <indexterm role="variable">
35753 <primary><varname>$local_part_prefix_v</varname></primary>
35754 </indexterm>
35755 If wildcarding (above) was used then the part of the prefix matching the
35756 wildcard is available in <varname>$local_part_prefix_v</varname>.
35757 </para>
35758 <para>
35759 When an address is being verified, <option>local_part_prefix</option> affects only the
35760 behaviour of the router. If the callout feature of verification is in use, this
35761 means that the full address, including the prefix, will be used during the
35762 callout.
35763 </para>
35764 <para>
35765 The prefix facility is commonly used to handle local parts of the form
35766 <option>owner-something</option>. Another common use is to support local parts of the form
35767 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
35768 to tell a user their forwarding is broken &ndash; by placing a router like this one
35769 immediately before the router that handles <filename>.forward</filename> files:
35770 </para>
35771 <literallayout class="monospaced">
35772 real_localuser:
35773   driver = accept
35774   local_part_prefix = real-
35775   check_local_user
35776   transport = local_delivery
35777 </literallayout>
35778 <para>
35779 For security, it would probably be a good idea to restrict the use of this
35780 router to locally-generated messages, using a condition such as this:
35781 </para>
35782 <literallayout class="monospaced">
35783   condition = ${if match {$sender_host_address}\
35784                          {\N^(|127\.0\.0\.1)$\N}}
35785 </literallayout>
35786 <para>
35787 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
35788 both conditions must be met if not optional. Care must be taken if wildcards
35789 are used in both a prefix and a suffix on the same router. Different
35790 separator characters must be used to avoid ambiguity.
35791 </para>
35792 <para>
35793 <indexterm role="option">
35794 <primary><option>local_part_prefix_optional</option></primary>
35795 </indexterm>
35796 </para>
35797 <informaltable frame="all">
35798 <tgroup cols="4" colsep="0" rowsep="0">
35799 <colspec colwidth="8*" align="left"/>
35800 <colspec colwidth="6*" align="center"/>
35801 <colspec colwidth="6*" align="center"/>
35802 <colspec colwidth="6*" align="right"/>
35803 <tbody>
35804 <row>
35805 <entry><option>local_part_prefix_optional</option></entry>
35806 <entry>Use: <emphasis>routers</emphasis></entry>
35807 <entry>Type: <emphasis>boolean</emphasis></entry>
35808 <entry>Default: <emphasis>false</emphasis></entry>
35809 </row>
35810 </tbody>
35811 </tgroup>
35812 </informaltable>
35813 <para>
35814 See <option>local_part_prefix</option> above.
35815 </para>
35816 <para>
35817 <indexterm role="option">
35818 <primary><option>local_part_suffix</option></primary>
35819 </indexterm>
35820 </para>
35821 <informaltable frame="all">
35822 <tgroup cols="4" colsep="0" rowsep="0">
35823 <colspec colwidth="8*" align="left"/>
35824 <colspec colwidth="6*" align="center"/>
35825 <colspec colwidth="6*" align="center"/>
35826 <colspec colwidth="6*" align="right"/>
35827 <tbody>
35828 <row>
35829 <entry><option>local_part_suffix</option></entry>
35830 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35831 <entry>Type: <emphasis>string list</emphasis></entry>
35832 <entry>Default: <emphasis>unset</emphasis></entry>
35833 </row>
35834 </tbody>
35835 </tgroup>
35836 </informaltable>
35837 <para>
35838 <indexterm role="concept">
35839 <primary>router</primary>
35840 <secondary>suffix for local part</secondary>
35841 </indexterm>
35842 <indexterm role="concept">
35843 <primary>suffix for local part</primary>
35844 <secondary>used in router</secondary>
35845 </indexterm>
35846 This option operates in the same way as <option>local_part_prefix</option>, except that the
35847 local part must end (rather than start) with the given string, the
35848 <option>local_part_suffix_optional</option> option determines whether the suffix is
35849 mandatory, and the wildcard * character, if present, must be the last
35850 character of the suffix. This option facility is commonly used to handle local
35851 parts of the form <option>something-request</option> and multiple user mailboxes of the form
35852 <option>username-foo</option>.
35853 </para>
35854 <para>
35855 <indexterm role="option">
35856 <primary><option>local_part_suffix_optional</option></primary>
35857 </indexterm>
35858 </para>
35859 <informaltable frame="all">
35860 <tgroup cols="4" colsep="0" rowsep="0">
35861 <colspec colwidth="8*" align="left"/>
35862 <colspec colwidth="6*" align="center"/>
35863 <colspec colwidth="6*" align="center"/>
35864 <colspec colwidth="6*" align="right"/>
35865 <tbody>
35866 <row>
35867 <entry><option>local_part_suffix_optional</option></entry>
35868 <entry>Use: <emphasis>routers</emphasis></entry>
35869 <entry>Type: <emphasis>boolean</emphasis></entry>
35870 <entry>Default: <emphasis>false</emphasis></entry>
35871 </row>
35872 </tbody>
35873 </tgroup>
35874 </informaltable>
35875 <para>
35876 See <option>local_part_suffix</option> above.
35877 </para>
35878 <para>
35879 <indexterm role="option">
35880 <primary><option>local_parts</option></primary>
35881 </indexterm>
35882 </para>
35883 <informaltable frame="all">
35884 <tgroup cols="4" colsep="0" rowsep="0">
35885 <colspec colwidth="8*" align="left"/>
35886 <colspec colwidth="6*" align="center"/>
35887 <colspec colwidth="6*" align="center"/>
35888 <colspec colwidth="6*" align="right"/>
35889 <tbody>
35890 <row>
35891 <entry><option>local_parts</option></entry>
35892 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35893 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
35894 <entry>Default: <emphasis>unset</emphasis></entry>
35895 </row>
35896 </tbody>
35897 </tgroup>
35898 </informaltable>
35899 <para>
35900 <indexterm role="concept">
35901 <primary>router</primary>
35902 <secondary>restricting to specific local parts</secondary>
35903 </indexterm>
35904 <indexterm role="concept">
35905 <primary>local part</primary>
35906 <secondary>checking in router</secondary>
35907 </indexterm>
35908 The router is run only if the local part of the address matches the list.
35909 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
35910 are evaluated, and
35911 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
35912 string is expanded, it is possible to make it depend on the domain, for
35913 example:
35914 </para>
35915 <literallayout class="monospaced">
35916 local_parts = dbm;/usr/local/specials/$domain
35917 </literallayout>
35918 <para>
35919 <indexterm role="variable">
35920 <primary><varname>$local_part_data</varname></primary>
35921 </indexterm>
35922 If the match is achieved by a lookup, the data that the lookup returned
35923 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
35924 expansions of the router&#x2019;s private options. You might use this option, for
35925 example, if you have a large number of local virtual domains, and you want to
35926 send all postmaster mail to the same place without having to set up an alias in
35927 each virtual domain:
35928 </para>
35929 <literallayout class="monospaced">
35930 postmaster:
35931   driver = redirect
35932   local_parts = postmaster
35933   data = postmaster@real.domain.example
35934 </literallayout>
35935 <para>
35936 <indexterm role="option">
35937 <primary><option>log_as_local</option></primary>
35938 </indexterm>
35939 </para>
35940 <informaltable frame="all">
35941 <tgroup cols="4" colsep="0" rowsep="0">
35942 <colspec colwidth="8*" align="left"/>
35943 <colspec colwidth="6*" align="center"/>
35944 <colspec colwidth="6*" align="center"/>
35945 <colspec colwidth="6*" align="right"/>
35946 <tbody>
35947 <row>
35948 <entry><option>log_as_local</option></entry>
35949 <entry>Use: <emphasis>routers</emphasis></entry>
35950 <entry>Type: <emphasis>boolean</emphasis></entry>
35951 <entry>Default: <emphasis>see below</emphasis></entry>
35952 </row>
35953 </tbody>
35954 </tgroup>
35955 </informaltable>
35956 <para>
35957 <indexterm role="concept">
35958 <primary>log</primary>
35959 <secondary>delivery line</secondary>
35960 </indexterm>
35961 <indexterm role="concept">
35962 <primary>delivery</primary>
35963 <secondary>log line format</secondary>
35964 </indexterm>
35965 Exim has two logging styles for delivery, the idea being to make local
35966 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
35967 recipient address is given just as the local part, without a domain. The use of
35968 this style is controlled by this option. It defaults to true for the <command>accept</command>
35969 router, and false for all the others. This option applies only when a
35970 router assigns an address to a transport. It has no effect on routers that
35971 redirect addresses.
35972 </para>
35973 <para>
35974 <indexterm role="option">
35975 <primary><option>more</option></primary>
35976 </indexterm>
35977 </para>
35978 <informaltable frame="all">
35979 <tgroup cols="4" colsep="0" rowsep="0">
35980 <colspec colwidth="8*" align="left"/>
35981 <colspec colwidth="6*" align="center"/>
35982 <colspec colwidth="6*" align="center"/>
35983 <colspec colwidth="6*" align="right"/>
35984 <tbody>
35985 <row>
35986 <entry><option>more</option></entry>
35987 <entry>Use: <emphasis>routers</emphasis></entry>
35988 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
35989 <entry>Default: <emphasis>true</emphasis></entry>
35990 </row>
35991 </tbody>
35992 </tgroup>
35993 </informaltable>
35994 <para>
35995 The result of string expansion for this option must be a valid boolean value,
35996 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
35997 result causes an error, and delivery is deferred. If the expansion is forced to
35998 fail, the default value for the option (true) is used. Other failures cause
35999 delivery to be deferred.
36000 </para>
36001 <para>
36002 If this option is set false, and the router declines to handle the address, no
36003 further routers are tried, routing fails, and the address is bounced.
36004 <indexterm role="option">
36005 <primary><option>self</option></primary>
36006 </indexterm>
36007 However, if the router explicitly passes an address to the following router by
36008 means of the setting
36009 </para>
36010 <literallayout class="monospaced">
36011 self = pass
36012 </literallayout>
36013 <para>
36014 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
36015 does not affect the behaviour if one of the precondition tests fails. In that
36016 case, the address is always passed to the next router.
36017 </para>
36018 <para>
36019 Note that <option>address_data</option> is not considered to be a precondition. If its
36020 expansion is forced to fail, the router declines, and the value of <option>more</option>
36021 controls what happens next.
36022 </para>
36023 <para>
36024 <indexterm role="option">
36025 <primary><option>pass_on_timeout</option></primary>
36026 </indexterm>
36027 </para>
36028 <informaltable frame="all">
36029 <tgroup cols="4" colsep="0" rowsep="0">
36030 <colspec colwidth="8*" align="left"/>
36031 <colspec colwidth="6*" align="center"/>
36032 <colspec colwidth="6*" align="center"/>
36033 <colspec colwidth="6*" align="right"/>
36034 <tbody>
36035 <row>
36036 <entry><option>pass_on_timeout</option></entry>
36037 <entry>Use: <emphasis>routers</emphasis></entry>
36038 <entry>Type: <emphasis>boolean</emphasis></entry>
36039 <entry>Default: <emphasis>false</emphasis></entry>
36040 </row>
36041 </tbody>
36042 </tgroup>
36043 </informaltable>
36044 <para>
36045 <indexterm role="concept">
36046 <primary>timeout</primary>
36047 <secondary>of router</secondary>
36048 </indexterm>
36049 <indexterm role="concept">
36050 <primary>router</primary>
36051 <secondary>timeout</secondary>
36052 </indexterm>
36053 If a router times out during a host lookup, it normally causes deferral of the
36054 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
36055 router, overriding <option>no_more</option>. This may be helpful for systems that are
36056 intermittently connected to the Internet, or those that want to pass to a smart
36057 host any messages that cannot immediately be delivered.
36058 </para>
36059 <para>
36060 There are occasional other temporary errors that can occur while doing DNS
36061 lookups. They are treated in the same way as a timeout, and this option
36062 applies to all of them.
36063 </para>
36064 <para>
36065 <indexterm role="option">
36066 <primary><option>pass_router</option></primary>
36067 </indexterm>
36068 </para>
36069 <informaltable frame="all">
36070 <tgroup cols="4" colsep="0" rowsep="0">
36071 <colspec colwidth="8*" align="left"/>
36072 <colspec colwidth="6*" align="center"/>
36073 <colspec colwidth="6*" align="center"/>
36074 <colspec colwidth="6*" align="right"/>
36075 <tbody>
36076 <row>
36077 <entry><option>pass_router</option></entry>
36078 <entry>Use: <emphasis>routers</emphasis></entry>
36079 <entry>Type: <emphasis>string</emphasis></entry>
36080 <entry>Default: <emphasis>unset</emphasis></entry>
36081 </row>
36082 </tbody>
36083 </tgroup>
36084 </informaltable>
36085 <para>
36086 <indexterm role="concept">
36087 <primary>router</primary>
36088 <secondary>go to after <quote>pass</quote></secondary>
36089 </indexterm>
36090 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
36091 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
36092 routing to continue, and overriding a false setting of <option>more</option>. When one of
36093 these routers returns <quote>pass</quote>, the address is normally handed on to the next
36094 router in sequence. This can be changed by setting <option>pass_router</option> to the name
36095 of another router. However (unlike <option>redirect_router</option>) the named router must
36096 be below the current router, to avoid loops. Note that this option applies only
36097 to the special case of <quote>pass</quote>. It does not apply when a router returns
36098 <quote>decline</quote> because it cannot handle an address.
36099 </para>
36100 <para>
36101 <indexterm role="option">
36102 <primary><option>redirect_router</option></primary>
36103 </indexterm>
36104 </para>
36105 <informaltable frame="all">
36106 <tgroup cols="4" colsep="0" rowsep="0">
36107 <colspec colwidth="8*" align="left"/>
36108 <colspec colwidth="6*" align="center"/>
36109 <colspec colwidth="6*" align="center"/>
36110 <colspec colwidth="6*" align="right"/>
36111 <tbody>
36112 <row>
36113 <entry><option>redirect_router</option></entry>
36114 <entry>Use: <emphasis>routers</emphasis></entry>
36115 <entry>Type: <emphasis>string</emphasis></entry>
36116 <entry>Default: <emphasis>unset</emphasis></entry>
36117 </row>
36118 </tbody>
36119 </tgroup>
36120 </informaltable>
36121 <para>
36122 <indexterm role="concept">
36123 <primary>router</primary>
36124 <secondary>start at after redirection</secondary>
36125 </indexterm>
36126 Sometimes an administrator knows that it is pointless to reprocess addresses
36127 generated from alias or forward files with the same router again. For
36128 example, if an alias file translates real names into login ids there is no
36129 point searching the alias file a second time, especially if it is a large file.
36130 </para>
36131 <para>
36132 The <option>redirect_router</option> option can be set to the name of any router instance.
36133 It causes the routing of any generated addresses to start at the named router
36134 instead of at the first router. This option has no effect if the router in
36135 which it is set does not generate new addresses.
36136 </para>
36137 <para>
36138 <indexterm role="option">
36139 <primary><option>require_files</option></primary>
36140 </indexterm>
36141 </para>
36142 <informaltable frame="all">
36143 <tgroup cols="4" colsep="0" rowsep="0">
36144 <colspec colwidth="8*" align="left"/>
36145 <colspec colwidth="6*" align="center"/>
36146 <colspec colwidth="6*" align="center"/>
36147 <colspec colwidth="6*" align="right"/>
36148 <tbody>
36149 <row>
36150 <entry><option>require_files</option></entry>
36151 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36152 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
36153 <entry>Default: <emphasis>unset</emphasis></entry>
36154 </row>
36155 </tbody>
36156 </tgroup>
36157 </informaltable>
36158 <para>
36159 <indexterm role="concept">
36160 <primary>file</primary>
36161 <secondary>requiring for router</secondary>
36162 </indexterm>
36163 <indexterm role="concept">
36164 <primary>router</primary>
36165 <secondary>requiring file existence</secondary>
36166 </indexterm>
36167 This option provides a general mechanism for predicating the running of a
36168 router on the existence or non-existence of certain files or directories.
36169 Before running a router, as one of its precondition tests, Exim works its way
36170 through the <option>require_files</option> list, expanding each item separately.
36171 </para>
36172 <para>
36173 Because the list is split before expansion, any colons in expansion items must
36174 be doubled, or the facility for using a different list separator must be used
36175 (<xref linkend="SECTlistsepchange"/>).
36176 If any expansion is forced to fail, the item is ignored. Other expansion
36177 failures cause routing of the address to be deferred.
36178 </para>
36179 <para>
36180 If any expanded string is empty, it is ignored. Otherwise, except as described
36181 below, each string must be a fully qualified file path, optionally preceded by
36182 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
36183 existence of the files or directories. The router is skipped if any paths not
36184 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
36185 </para>
36186 <para>
36187 <indexterm role="concept">
36188 <primary>NFS</primary>
36189 </indexterm>
36190 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
36191 the message is deferred. This can happen when NFS-mounted filesystems are
36192 unavailable.
36193 </para>
36194 <para>
36195 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
36196 options, so you cannot use it to check for the existence of a file in which to
36197 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
36198 full list of the order in which preconditions are evaluated.) However, as
36199 these options are all expanded, you can use the <option>exists</option> expansion condition
36200 to make such tests. The <option>require_files</option> option is intended for checking files
36201 that the router may be going to use internally, or which are needed by a
36202 transport (e.g., <filename>.procmailrc</filename>).
36203 </para>
36204 <para>
36205 During delivery, the <function>stat()</function> function is run as root, but there is a
36206 facility for some checking of the accessibility of a file by another user.
36207 This is not a proper permissions check, but just a <quote>rough</quote> check that
36208 operates as follows:
36209 </para>
36210 <para>
36211 If an item in a <option>require_files</option> list does not contain any forward slash
36212 characters, it is taken to be the user (and optional group, separated by a
36213 comma) to be checked for subsequent files in the list. If no group is specified
36214 but the user is specified symbolically, the gid associated with the uid is
36215 used. For example:
36216 </para>
36217 <literallayout class="monospaced">
36218 require_files = mail:/some/file
36219 require_files = $local_part_data:$home/.procmailrc
36220 </literallayout>
36221 <para>
36222 If a user or group name in a <option>require_files</option> list does not exist, the
36223 <option>require_files</option> condition fails.
36224 </para>
36225 <para>
36226 Exim performs the check by scanning along the components of the file path, and
36227 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
36228 directories, and <quote>r</quote> access on the final file. Note that this means that file
36229 access control lists, if the operating system has them, are ignored.
36230 </para>
36231 <para>
36232 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
36233 incoming SMTP message, Exim is not running as root, but under its own uid. This
36234 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
36235 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
36236 user is not permitted to read one of the directories on the file&#x2019;s path.
36237 </para>
36238 <para>
36239 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
36240 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
36241 without root access. In this case, if a check for access by a particular user
36242 is requested, Exim creates a subprocess that runs as that user, and tries the
36243 check again in that process.
36244 </para>
36245 <para>
36246 The default action for handling an unresolved EACCES is to consider it to
36247 be caused by a configuration error, and routing is deferred because the
36248 existence or non-existence of the file cannot be determined. However, in some
36249 circumstances it may be desirable to treat this condition as if the file did
36250 not exist. If the filename (or the exclamation mark that precedes the filename
36251 for non-existence) is preceded by a plus sign, the EACCES error is treated
36252 as if the file did not exist. For example:
36253 </para>
36254 <literallayout class="monospaced">
36255 require_files = +/some/file
36256 </literallayout>
36257 <para>
36258 If the router is not an essential part of verification (for example, it
36259 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
36260 option false so that the router is skipped when verifying.
36261 </para>
36262 <para>
36263 <indexterm role="option">
36264 <primary><option>retry_use_local_part</option></primary>
36265 </indexterm>
36266 </para>
36267 <informaltable frame="all">
36268 <tgroup cols="4" colsep="0" rowsep="0">
36269 <colspec colwidth="8*" align="left"/>
36270 <colspec colwidth="6*" align="center"/>
36271 <colspec colwidth="6*" align="center"/>
36272 <colspec colwidth="6*" align="right"/>
36273 <tbody>
36274 <row>
36275 <entry><option>retry_use_local_part</option></entry>
36276 <entry>Use: <emphasis>routers</emphasis></entry>
36277 <entry>Type: <emphasis>boolean</emphasis></entry>
36278 <entry>Default: <emphasis>see below</emphasis></entry>
36279 </row>
36280 </tbody>
36281 </tgroup>
36282 </informaltable>
36283 <para>
36284 <indexterm role="concept">
36285 <primary>hints database</primary>
36286 <secondary>retry keys</secondary>
36287 </indexterm>
36288 <indexterm role="concept">
36289 <primary>local part</primary>
36290 <secondary>in retry keys</secondary>
36291 </indexterm>
36292 When a delivery suffers a temporary routing failure, a retry record is created
36293 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
36294 domain, the key for the retry record should not involve the local part, but for
36295 other addresses, both the domain and the local part should be included.
36296 Usually, remote routing is of the former kind, and local routing is of the
36297 latter kind.
36298 </para>
36299 <para>
36300 This option controls whether the local part is used to form the key for retry
36301 hints for addresses that suffer temporary errors while being handled by this
36302 router. The default value is true for any router that has any of
36303 <option>check_local_user</option>,
36304 <option>local_parts</option>,
36305 <option>condition</option>,
36306 <option>local_part_prefix</option>,
36307 <option>local_part_suffix</option>,
36308 <option>senders</option> or
36309 <option>require_files</option>
36310 set, and false otherwise. Note that this option does not apply to hints keys
36311 for transport delays; they are controlled by a generic transport option of the
36312 same name.
36313 </para>
36314 <para>
36315 Failing to set this option when it is needed
36316 (because a remote router handles only some of the local-parts for a domain)
36317 can result in incorrect error messages being generated.
36318 </para>
36319 <para>
36320 The setting of <option>retry_use_local_part</option> applies only to the router on which it
36321 appears. If the router generates child addresses, they are routed
36322 independently; this setting does not become attached to them.
36323 </para>
36324 <para>
36325 <indexterm role="option">
36326 <primary><option>router_home_directory</option></primary>
36327 </indexterm>
36328 </para>
36329 <informaltable frame="all">
36330 <tgroup cols="4" colsep="0" rowsep="0">
36331 <colspec colwidth="8*" align="left"/>
36332 <colspec colwidth="6*" align="center"/>
36333 <colspec colwidth="6*" align="center"/>
36334 <colspec colwidth="6*" align="right"/>
36335 <tbody>
36336 <row>
36337 <entry><option>router_home_directory</option></entry>
36338 <entry>Use: <emphasis>routers</emphasis></entry>
36339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36340 <entry>Default: <emphasis>unset</emphasis></entry>
36341 </row>
36342 </tbody>
36343 </tgroup>
36344 </informaltable>
36345 <para>
36346 <indexterm role="concept">
36347 <primary>router</primary>
36348 <secondary>home directory for</secondary>
36349 </indexterm>
36350 <indexterm role="concept">
36351 <primary>home directory</primary>
36352 <secondary>for router</secondary>
36353 </indexterm>
36354 <indexterm role="variable">
36355 <primary><varname>$home</varname></primary>
36356 </indexterm>
36357 This option sets a home directory for use while the router is running. (Compare
36358 <option>transport_home_directory</option>, which sets a home directory for later
36359 transporting.) In particular, if used on a <command>redirect</command> router, this option
36360 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
36361 forced expansion failure causes the option to be ignored &ndash; other failures
36362 cause the router to defer.
36363 </para>
36364 <para>
36365 Expansion of <option>router_home_directory</option> happens immediately after the
36366 <option>check_local_user</option> test (if configured), before any further expansions take
36367 place.
36368 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
36369 are evaluated.)
36370 While the router is running, <option>router_home_directory</option> overrides the value of
36371 <varname>$home</varname> that came from <option>check_local_user</option>.
36372 </para>
36373 <para>
36374 When a router accepts an address and assigns it to a local transport (including
36375 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
36376 delivery), the home directory setting for the transport is taken from the first
36377 of these values that is set:
36378 </para>
36379 <itemizedlist>
36380 <listitem>
36381 <para>
36382 The <option>home_directory</option> option on the transport;
36383 </para>
36384 </listitem>
36385 <listitem>
36386 <para>
36387 The <option>transport_home_directory</option> option on the router;
36388 </para>
36389 </listitem>
36390 <listitem>
36391 <para>
36392 The password data if <option>check_local_user</option> is set on the router;
36393 </para>
36394 </listitem>
36395 <listitem>
36396 <para>
36397 The <option>router_home_directory</option> option on the router.
36398 </para>
36399 </listitem>
36400 </itemizedlist>
36401 <para>
36402 In other words, <option>router_home_directory</option> overrides the password data for the
36403 router, but not for the transport.
36404 </para>
36405 <para>
36406 <indexterm role="option">
36407 <primary><option>self</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>self</option></entry>
36419 <entry>Use: <emphasis>routers</emphasis></entry>
36420 <entry>Type: <emphasis>string</emphasis></entry>
36421 <entry>Default: <emphasis>freeze</emphasis></entry>
36422 </row>
36423 </tbody>
36424 </tgroup>
36425 </informaltable>
36426 <para>
36427 <indexterm role="concept">
36428 <primary>MX record</primary>
36429 <secondary>pointing to local host</secondary>
36430 </indexterm>
36431 <indexterm role="concept">
36432 <primary>local host</primary>
36433 <secondary>MX pointing to</secondary>
36434 </indexterm>
36435 This option applies to those routers that use a recipient address to find a
36436 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
36437 and <command>manualroute</command> routers.
36438 Certain configurations of the <command>queryprogram</command> router can also specify a list
36439 of remote hosts.
36440 Usually such routers are configured to send the message to a remote host via an
36441 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
36442 host on the list turns out to be the local host.
36443 The way in which Exim checks for the local host is described in section
36444 <xref linkend="SECTreclocipadd"/>.
36445 </para>
36446 <para>
36447 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
36448 example, the router should be configured not to process this domain), or an
36449 error in the DNS (for example, the MX should not point to this host). For this
36450 reason, the default action is to log the incident, defer the address, and
36451 freeze the message. The following alternatives are provided for use in special
36452 cases:
36453 </para>
36454 <variablelist>
36455 <varlistentry>
36456 <term><option>defer</option></term>
36457 <listitem>
36458 <para>
36459 Delivery of the message is tried again later, but the message is not frozen.
36460 </para>
36461 </listitem></varlistentry>
36462 <varlistentry>
36463 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
36464 <listitem>
36465 <para>
36466 The domain is changed to the given domain, and the address is passed back to
36467 be reprocessed by the routers. No rewriting of headers takes place. This
36468 behaviour is essentially a redirection.
36469 </para>
36470 </listitem></varlistentry>
36471 <varlistentry>
36472 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
36473 <listitem>
36474 <para>
36475 The domain is changed to the given domain, and the address is passed back to be
36476 reprocessed by the routers. Any headers that contain the original domain are
36477 rewritten.
36478 </para>
36479 </listitem></varlistentry>
36480 <varlistentry>
36481 <term><option>pass</option></term>
36482 <listitem>
36483 <para>
36484 <indexterm role="option">
36485 <primary><option>more</option></primary>
36486 </indexterm>
36487 <indexterm role="variable">
36488 <primary><varname>$self_hostname</varname></primary>
36489 </indexterm>
36490 The router passes the address to the next router, or to the router named in the
36491 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
36492 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
36493 name of the local host that the router encountered. This can be used to
36494 distinguish between different cases for hosts with multiple names. The
36495 combination
36496 </para>
36497 <literallayout class="monospaced">
36498 self = pass
36499 no_more
36500 </literallayout>
36501 <para>
36502 ensures that only those addresses that routed to the local host are passed on.
36503 Without <option>no_more</option>, addresses that were declined for other reasons would also
36504 be passed to the next router.
36505 </para>
36506 </listitem></varlistentry>
36507 <varlistentry>
36508 <term><option>fail</option></term>
36509 <listitem>
36510 <para>
36511 Delivery fails and an error report is generated.
36512 </para>
36513 </listitem></varlistentry>
36514 <varlistentry>
36515 <term><option>send</option></term>
36516 <listitem>
36517 <para>
36518 <indexterm role="concept">
36519 <primary>local host</primary>
36520 <secondary>sending to</secondary>
36521 </indexterm>
36522 The anomaly is ignored and the address is queued for the transport. This
36523 setting should be used with extreme caution. For an <command>smtp</command> transport, it
36524 makes sense only in cases where the program that is listening on the SMTP port
36525 is not this version of Exim. That is, it must be some other MTA, or Exim with a
36526 different configuration file that handles the domain in another way.
36527 </para>
36528 </listitem></varlistentry>
36529 </variablelist>
36530 <para>
36531 <indexterm role="option">
36532 <primary><option>senders</option></primary>
36533 </indexterm>
36534 </para>
36535 <informaltable frame="all">
36536 <tgroup cols="4" colsep="0" rowsep="0">
36537 <colspec colwidth="8*" align="left"/>
36538 <colspec colwidth="6*" align="center"/>
36539 <colspec colwidth="6*" align="center"/>
36540 <colspec colwidth="6*" align="right"/>
36541 <tbody>
36542 <row>
36543 <entry><option>senders</option></entry>
36544 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36545 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
36546 <entry>Default: <emphasis>unset</emphasis></entry>
36547 </row>
36548 </tbody>
36549 </tgroup>
36550 </informaltable>
36551 <para>
36552 <indexterm role="concept">
36553 <primary>router</primary>
36554 <secondary>checking senders</secondary>
36555 </indexterm>
36556 If this option is set, the router is skipped unless the message&#x2019;s sender
36557 address matches something on the list.
36558 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
36559 are evaluated.
36560 </para>
36561 <para>
36562 There are issues concerning verification when the running of routers is
36563 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
36564 setting, it sets the sender to the null string. When using the <option>-bt</option> option
36565 to check a configuration file, it is necessary also to use the <option>-f</option> option to
36566 set an appropriate sender. For incoming mail, the sender is unset when
36567 verifying the sender, but is available when verifying any recipients. If the
36568 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
36569 matters.
36570 </para>
36571 <para>
36572 <indexterm role="option">
36573 <primary><option>set</option></primary>
36574 </indexterm>
36575 </para>
36576 <informaltable frame="all">
36577 <tgroup cols="4" colsep="0" rowsep="0">
36578 <colspec colwidth="8*" align="left"/>
36579 <colspec colwidth="6*" align="center"/>
36580 <colspec colwidth="6*" align="center"/>
36581 <colspec colwidth="6*" align="right"/>
36582 <tbody>
36583 <row>
36584 <entry><option>set</option></entry>
36585 <entry>Use: <emphasis>routers</emphasis></entry>
36586 <entry>Type: <emphasis>string list</emphasis></entry>
36587 <entry>Default: <emphasis>unset</emphasis></entry>
36588 </row>
36589 </tbody>
36590 </tgroup>
36591 </informaltable>
36592 <para>
36593 <indexterm role="concept">
36594 <primary>router</primary>
36595 <secondary>variables</secondary>
36596 </indexterm>
36597 This option may be used multiple times on a router;
36598 because of this the list aspect is mostly irrelevant.
36599 The list separator is a semicolon but can be changed in the
36600 usual way.
36601 </para>
36602 <para>
36603 Each list-element given must be of the form <quote>name = value</quote>
36604 and the names used must start with the string <quote>r_</quote>.
36605 Values containing a list-separator should have them doubled.
36606 When a router runs, the strings are evaluated in order,
36607 to create variables which are added to the set associated with
36608 the address.
36609 The variable is set with the expansion of the value.
36610 The variables can be used by the router options
36611 (not including any preconditions)
36612 and by the transport.
36613 Later definitions of a given named variable will override former ones.
36614 Variable use is via the usual <varname>$r_...</varname> syntax.
36615 </para>
36616 <para>
36617 This is similar to the <option>address_data</option> option, except that
36618 many independent variables can be used, with choice of naming.
36619 </para>
36620 <para>
36621 <indexterm role="option">
36622 <primary><option>translate_ip_address</option></primary>
36623 </indexterm>
36624 </para>
36625 <informaltable frame="all">
36626 <tgroup cols="4" colsep="0" rowsep="0">
36627 <colspec colwidth="8*" align="left"/>
36628 <colspec colwidth="6*" align="center"/>
36629 <colspec colwidth="6*" align="center"/>
36630 <colspec colwidth="6*" align="right"/>
36631 <tbody>
36632 <row>
36633 <entry><option>translate_ip_address</option></entry>
36634 <entry>Use: <emphasis>routers</emphasis></entry>
36635 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36636 <entry>Default: <emphasis>unset</emphasis></entry>
36637 </row>
36638 </tbody>
36639 </tgroup>
36640 </informaltable>
36641 <para>
36642 <indexterm role="concept">
36643 <primary>IP address</primary>
36644 <secondary>translating</secondary>
36645 </indexterm>
36646 <indexterm role="concept">
36647 <primary>packet radio</primary>
36648 </indexterm>
36649 <indexterm role="concept">
36650 <primary>router</primary>
36651 <secondary>IP address translation</secondary>
36652 </indexterm>
36653 There exist some rare networking situations (for example, packet radio) where
36654 it is helpful to be able to translate IP addresses generated by normal routing
36655 mechanisms into other IP addresses, thus performing a kind of manual IP
36656 routing. This should be done only if the normal IP routing of the TCP/IP stack
36657 is inadequate or broken. Because this is an extremely uncommon requirement, the
36658 code to support this option is not included in the Exim binary unless
36659 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
36660 </para>
36661 <para>
36662 <indexterm role="variable">
36663 <primary><varname>$host_address</varname></primary>
36664 </indexterm>
36665 The <option>translate_ip_address</option> string is expanded for every IP address generated
36666 by the router, with the generated address set in <varname>$host_address</varname>. If the
36667 expansion is forced to fail, no action is taken.
36668 For any other expansion error, delivery of the message is deferred.
36669 If the result of the expansion is an IP address, that replaces the original
36670 address; otherwise the result is assumed to be a host name &ndash; this is looked
36671 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
36672 produce one or more replacement IP addresses. For example, to subvert all IP
36673 addresses in some specific networks, this could be added to a router:
36674 </para>
36675 <literallayout class="monospaced">
36676 translate_ip_address = \
36677   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
36678     {$value}fail}}
36679 </literallayout>
36680 <para>
36681 The file would contain lines like
36682 </para>
36683 <literallayout class="monospaced">
36684 10.2.3.128/26    some.host
36685 10.8.4.34/26     10.44.8.15
36686 </literallayout>
36687 <para>
36688 You should not make use of this facility unless you really understand what you
36689 are doing.
36690 </para>
36691 <para>
36692 <indexterm role="option">
36693 <primary><option>transport</option></primary>
36694 </indexterm>
36695 </para>
36696 <informaltable frame="all">
36697 <tgroup cols="4" colsep="0" rowsep="0">
36698 <colspec colwidth="8*" align="left"/>
36699 <colspec colwidth="6*" align="center"/>
36700 <colspec colwidth="6*" align="center"/>
36701 <colspec colwidth="6*" align="right"/>
36702 <tbody>
36703 <row>
36704 <entry><option>transport</option></entry>
36705 <entry>Use: <emphasis>routers</emphasis></entry>
36706 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36707 <entry>Default: <emphasis>unset</emphasis></entry>
36708 </row>
36709 </tbody>
36710 </tgroup>
36711 </informaltable>
36712 <para>
36713 This option specifies the transport to be used when a router accepts an address
36714 and sets it up for delivery. A transport is never needed if a router is used
36715 only for verification. The value of the option is expanded at routing time,
36716 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
36717 and result must be the name of one of the configured transports. If it is not,
36718 delivery is deferred.
36719 </para>
36720 <para>
36721 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
36722 have some private options that set up transports for pipe and file deliveries
36723 (see chapter <xref linkend="CHAPredirect"/>).
36724 </para>
36725 <para>
36726 <indexterm role="option">
36727 <primary><option>transport_current_directory</option></primary>
36728 </indexterm>
36729 </para>
36730 <informaltable frame="all">
36731 <tgroup cols="4" colsep="0" rowsep="0">
36732 <colspec colwidth="8*" align="left"/>
36733 <colspec colwidth="6*" align="center"/>
36734 <colspec colwidth="6*" align="center"/>
36735 <colspec colwidth="6*" align="right"/>
36736 <tbody>
36737 <row>
36738 <entry><option>transport_current_directory</option></entry>
36739 <entry>Use: <emphasis>routers</emphasis></entry>
36740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36741 <entry>Default: <emphasis>unset</emphasis></entry>
36742 </row>
36743 </tbody>
36744 </tgroup>
36745 </informaltable>
36746 <para>
36747 <indexterm role="concept">
36748 <primary>current directory for local transport</primary>
36749 </indexterm>
36750 This option associates a current directory with any address that is routed
36751 to a local transport. This can happen either because a transport is
36752 explicitly configured for the router, or because it generates a delivery to a
36753 file or a pipe. During the delivery process (that is, at transport time), this
36754 option string is expanded and is set as the current directory, unless
36755 overridden by a setting on the transport.
36756 If the expansion fails for any reason, including forced failure, an error is
36757 logged, and delivery is deferred.
36758 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
36759 environment.
36760 </para>
36761 <para>
36762 <indexterm role="option">
36763 <primary><option>transport_home_directory</option></primary>
36764 </indexterm>
36765 </para>
36766 <informaltable frame="all">
36767 <tgroup cols="4" colsep="0" rowsep="0">
36768 <colspec colwidth="8*" align="left"/>
36769 <colspec colwidth="6*" align="center"/>
36770 <colspec colwidth="6*" align="center"/>
36771 <colspec colwidth="6*" align="right"/>
36772 <tbody>
36773 <row>
36774 <entry><option>transport_home_directory</option></entry>
36775 <entry>Use: <emphasis>routers</emphasis></entry>
36776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36777 <entry>Default: <emphasis>see below</emphasis></entry>
36778 </row>
36779 </tbody>
36780 </tgroup>
36781 </informaltable>
36782 <para>
36783 <indexterm role="concept">
36784 <primary>home directory</primary>
36785 <secondary>for local transport</secondary>
36786 </indexterm>
36787 This option associates a home directory with any address that is routed to a
36788 local transport. This can happen either because a transport is explicitly
36789 configured for the router, or because it generates a delivery to a file or a
36790 pipe. During the delivery process (that is, at transport time), the option
36791 string is expanded and is set as the home directory, unless overridden by a
36792 setting of <option>home_directory</option> on the transport.
36793 If the expansion fails for any reason, including forced failure, an error is
36794 logged, and delivery is deferred.
36795 </para>
36796 <para>
36797 If the transport does not specify a home directory, and
36798 <option>transport_home_directory</option> is not set for the router, the home directory for
36799 the transport is taken from the password data if <option>check_local_user</option> is set for
36800 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
36801 is set; if not, no home directory is set for the transport.
36802 </para>
36803 <para>
36804 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
36805 environment.
36806 </para>
36807 <para>
36808 <indexterm role="option">
36809 <primary><option>unseen</option></primary>
36810 </indexterm>
36811 </para>
36812 <informaltable frame="all">
36813 <tgroup cols="4" colsep="0" rowsep="0">
36814 <colspec colwidth="8*" align="left"/>
36815 <colspec colwidth="6*" align="center"/>
36816 <colspec colwidth="6*" align="center"/>
36817 <colspec colwidth="6*" align="right"/>
36818 <tbody>
36819 <row>
36820 <entry><option>unseen</option></entry>
36821 <entry>Use: <emphasis>routers</emphasis></entry>
36822 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
36823 <entry>Default: <emphasis>false</emphasis></entry>
36824 </row>
36825 </tbody>
36826 </tgroup>
36827 </informaltable>
36828 <para>
36829 <indexterm role="concept">
36830 <primary>router</primary>
36831 <secondary>carrying on after success</secondary>
36832 </indexterm>
36833 The result of string expansion for this option must be a valid boolean value,
36834 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
36835 result causes an error, and delivery is deferred. If the expansion is forced to
36836 fail, the default value for the option (false) is used. Other failures cause
36837 delivery to be deferred.
36838 </para>
36839 <para>
36840 When this option is set true, routing does not cease if the router accepts the
36841 address. Instead, a copy of the incoming address is passed to the next router,
36842 overriding a false setting of <option>more</option>. There is little point in setting
36843 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
36844 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
36845 sometimes true and sometimes false).
36846 </para>
36847 <para>
36848 <indexterm role="concept">
36849 <primary>copy of message (<option>unseen</option> option)</primary>
36850 </indexterm>
36851 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
36852 qualifier in filter files. It can be used to cause copies of messages to be
36853 delivered to some other destination, while also carrying out a normal delivery.
36854 In effect, the current address is made into a <quote>parent</quote> that has two children
36855 &ndash; one that is delivered as specified by this router, and a clone that goes on
36856 to be routed further. For this reason, <option>unseen</option> may not be combined with the
36857 <option>one_time</option> option in a <command>redirect</command> router.
36858 </para>
36859 <para>
36860 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
36861 this router or by previous routers affect the <quote>unseen</quote> copy of the message
36862 only. The clone that continues to be processed by further routers starts with
36863 no added headers and none specified for removal. For a <option>redirect</option> router, if
36864 a generated address is the same as the incoming address, this can lead to
36865 duplicate addresses with different header modifications. Exim does not do
36866 duplicate deliveries (except, in certain circumstances, to pipes -- see section
36867 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
36868 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
36869 <option>redirect</option> router may be of help.
36870 </para>
36871 <para>
36872 Unlike the handling of header modifications, any data that was set by the
36873 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
36874 subsequent routers.
36875 </para>
36876 <para>
36877 <indexterm role="option">
36878 <primary><option>user</option></primary>
36879 </indexterm>
36880 </para>
36881 <informaltable frame="all">
36882 <tgroup cols="4" colsep="0" rowsep="0">
36883 <colspec colwidth="8*" align="left"/>
36884 <colspec colwidth="6*" align="center"/>
36885 <colspec colwidth="6*" align="center"/>
36886 <colspec colwidth="6*" align="right"/>
36887 <tbody>
36888 <row>
36889 <entry><option>user</option></entry>
36890 <entry>Use: <emphasis>routers</emphasis></entry>
36891 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36892 <entry>Default: <emphasis>see below</emphasis></entry>
36893 </row>
36894 </tbody>
36895 </tgroup>
36896 </informaltable>
36897 <para>
36898 <indexterm role="concept">
36899 <primary>uid (user id)</primary>
36900 <secondary>local delivery</secondary>
36901 </indexterm>
36902 <indexterm role="concept">
36903 <primary>local transports</primary>
36904 <secondary>uid and gid</secondary>
36905 </indexterm>
36906 <indexterm role="concept">
36907 <primary>transport</primary>
36908 <secondary>local</secondary>
36909 </indexterm>
36910 <indexterm role="concept">
36911 <primary>router</primary>
36912 <secondary>user for filter processing</secondary>
36913 </indexterm>
36914 <indexterm role="concept">
36915 <primary>filter</primary>
36916 <secondary>user for processing</secondary>
36917 </indexterm>
36918 When a router queues an address for a transport, and the transport does not
36919 specify a user, the user given here is used when running the delivery process.
36920 The user may be specified numerically or by name. If expansion fails, the
36921 error is logged and delivery is deferred.
36922 This user is also used by the <command>redirect</command> router when running a filter file.
36923 The default is unset, except when <option>check_local_user</option> is set. In this case,
36924 the default is taken from the password information. If the user is specified as
36925 a name, and <option>group</option> is not set, the group associated with the user is used.
36926 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
36927 <xref linkend="CHAPenvironment"/>.
36928 </para>
36929 <para>
36930 <indexterm role="option">
36931 <primary><option>verify</option></primary>
36932 </indexterm>
36933 </para>
36934 <informaltable frame="all">
36935 <tgroup cols="4" colsep="0" rowsep="0">
36936 <colspec colwidth="8*" align="left"/>
36937 <colspec colwidth="6*" align="center"/>
36938 <colspec colwidth="6*" align="center"/>
36939 <colspec colwidth="6*" align="right"/>
36940 <tbody>
36941 <row>
36942 <entry><option>verify</option></entry>
36943 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36944 <entry>Type: <emphasis>boolean</emphasis></entry>
36945 <entry>Default: <emphasis>true</emphasis></entry>
36946 </row>
36947 </tbody>
36948 </tgroup>
36949 </informaltable>
36950 <para>
36951 Setting this option has the effect of setting <option>verify_sender</option> and
36952 <option>verify_recipient</option> to the same value.
36953 </para>
36954 <para>
36955 <indexterm role="option">
36956 <primary><option>verify_only</option></primary>
36957 </indexterm>
36958 </para>
36959 <informaltable frame="all">
36960 <tgroup cols="4" colsep="0" rowsep="0">
36961 <colspec colwidth="8*" align="left"/>
36962 <colspec colwidth="6*" align="center"/>
36963 <colspec colwidth="6*" align="center"/>
36964 <colspec colwidth="6*" align="right"/>
36965 <tbody>
36966 <row>
36967 <entry><option>verify_only</option></entry>
36968 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36969 <entry>Type: <emphasis>boolean</emphasis></entry>
36970 <entry>Default: <emphasis>false</emphasis></entry>
36971 </row>
36972 </tbody>
36973 </tgroup>
36974 </informaltable>
36975 <para>
36976 <indexterm role="concept">
36977 <primary>EXPN</primary>
36978 <secondary>with <option>verify_only</option></secondary>
36979 </indexterm>
36980 <indexterm role="option">
36981 <primary><option>-bv</option></primary>
36982 </indexterm>
36983 <indexterm role="concept">
36984 <primary>router</primary>
36985 <secondary>used only when verifying</secondary>
36986 </indexterm>
36987 If this option is set, the router is used only when verifying an address,
36988 delivering in cutthrough mode or
36989 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
36990 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
36991 restricted to verifying only senders or recipients by means of
36992 <option>verify_sender</option> and <option>verify_recipient</option>.
36993 </para>
36994 <para>
36995 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
36996 SMTP message, Exim is not running as root, but under its own uid. If the router
36997 accesses any files, you need to make sure that they are accessible to the Exim
36998 user or group.
36999 </para>
37000 <para>
37001 <indexterm role="option">
37002 <primary><option>verify_recipient</option></primary>
37003 </indexterm>
37004 </para>
37005 <informaltable frame="all">
37006 <tgroup cols="4" colsep="0" rowsep="0">
37007 <colspec colwidth="8*" align="left"/>
37008 <colspec colwidth="6*" align="center"/>
37009 <colspec colwidth="6*" align="center"/>
37010 <colspec colwidth="6*" align="right"/>
37011 <tbody>
37012 <row>
37013 <entry><option>verify_recipient</option></entry>
37014 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37015 <entry>Type: <emphasis>boolean</emphasis></entry>
37016 <entry>Default: <emphasis>true</emphasis></entry>
37017 </row>
37018 </tbody>
37019 </tgroup>
37020 </informaltable>
37021 <para>
37022 If this option is false, the router is skipped when verifying recipient
37023 addresses,
37024 delivering in cutthrough mode
37025 or testing recipient verification using <option>-bv</option>.
37026 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37027 are evaluated.
37028 See also the <varname>$verify_mode</varname> variable.
37029 </para>
37030 <para>
37031 <indexterm role="option">
37032 <primary><option>verify_sender</option></primary>
37033 </indexterm>
37034 </para>
37035 <informaltable frame="all">
37036 <tgroup cols="4" colsep="0" rowsep="0">
37037 <colspec colwidth="8*" align="left"/>
37038 <colspec colwidth="6*" align="center"/>
37039 <colspec colwidth="6*" align="center"/>
37040 <colspec colwidth="6*" align="right"/>
37041 <tbody>
37042 <row>
37043 <entry><option>verify_sender</option></entry>
37044 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37045 <entry>Type: <emphasis>boolean</emphasis></entry>
37046 <entry>Default: <emphasis>true</emphasis></entry>
37047 </row>
37048 </tbody>
37049 </tgroup>
37050 </informaltable>
37051 <para>
37052 If this option is false, the router is skipped when verifying sender addresses
37053 or testing sender verification using <option>-bvs</option>.
37054 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37055 are evaluated.
37056 See also the <varname>$verify_mode</varname> variable.
37057 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
37058 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
37059 </para>
37060 </chapter>
37061
37062 <chapter id="CHID4">
37063 <title>The accept router</title>
37064 <para>
37065 <indexterm role="concept">
37066 <primary><command>accept</command> router</primary>
37067 </indexterm>
37068 <indexterm role="concept">
37069 <primary>routers</primary>
37070 <secondary><command>accept</command></secondary>
37071 </indexterm>
37072 The <command>accept</command> router has no private options of its own. Unless it is being
37073 used purely for verification (see <option>verify_only</option>) a transport is required to
37074 be defined by the generic <option>transport</option> option. If the preconditions that are
37075 specified by generic options are met, the router accepts the address and queues
37076 it for the given transport. The most common use of this router is for setting
37077 up deliveries to local mailboxes. For example:
37078 </para>
37079 <literallayout class="monospaced">
37080 localusers:
37081   driver = accept
37082   domains = mydomain.example
37083   check_local_user
37084   transport = local_delivery
37085 </literallayout>
37086 <para>
37087 The <option>domains</option> condition in this example checks the domain of the address, and
37088 <option>check_local_user</option> checks that the local part is the login of a local user.
37089 When both preconditions are met, the <command>accept</command> router runs, and queues the
37090 address for the <command>local_delivery</command> transport.
37091 </para>
37092 </chapter>
37093
37094 <chapter id="CHAPdnslookup">
37095 <title>The dnslookup router</title>
37096 <para>
37097 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
37098 <primary><command>dnslookup</command> router</primary>
37099 </indexterm>
37100 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
37101 <primary>routers</primary>
37102 <secondary><command>dnslookup</command></secondary>
37103 </indexterm>
37104 The <command>dnslookup</command> router looks up the hosts that handle mail for the
37105 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
37106 unless <option>verify_only</option> is set.
37107 </para>
37108 <para>
37109 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
37110 SRV records. If none are found, or if SRV support is not configured,
37111 MX records are looked up. If no MX records exist, address records are sought.
37112 However, <option>mx_domains</option> can be set to disable the direct use of address
37113 records.
37114 </para>
37115 <para>
37116 MX records of equal priority are sorted by Exim into a random order. Exim then
37117 looks for address records for the host names obtained from MX or SRV records.
37118 When a host has more than one IP address, they are sorted into a random order,
37119 except that IPv6 addresses are sorted before IPv4 addresses. If all the
37120 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
37121 generic option, the router declines.
37122 </para>
37123 <para>
37124 Unless they have the highest priority (lowest MX value), MX records that point
37125 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
37126 are discarded, together with any other MX records of equal or lower priority.
37127 </para>
37128 <para>
37129 <indexterm role="concept">
37130 <primary>MX record</primary>
37131 <secondary>pointing to local host</secondary>
37132 </indexterm>
37133 <indexterm role="concept">
37134 <primary>local host</primary>
37135 <secondary>MX pointing to</secondary>
37136 </indexterm>
37137 <indexterm role="option">
37138 <primary><option>self</option></primary>
37139 <secondary>in <command>dnslookup</command> router</secondary>
37140 </indexterm>
37141 If the host pointed to by the highest priority MX record, or looked up as an
37142 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
37143 happens is controlled by the generic <option>self</option> option.
37144 </para>
37145 <section id="SECTprowitdnsloo">
37146 <title>Problems with DNS lookups</title>
37147 <para>
37148 There have been problems with DNS servers when SRV records are looked up.
37149 Some misbehaving servers return a DNS error or timeout when a non-existent
37150 SRV record is sought. Similar problems have in the past been reported for
37151 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
37152 problem, but it is heavy-handed because it is a global option.
37153 </para>
37154 <para>
37155 For this reason, there are two options, <option>srv_fail_domains</option> and
37156 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
37157 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
37158 an attempt to look up an SRV or MX record causes one of these results, and the
37159 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
37160 such record</quote>. In the case of an SRV lookup, this means that the router
37161 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
37162 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
37163 case routing fails.
37164 </para>
37165 </section>
37166 <section id="SECTdnslookupdecline">
37167 <title>Declining addresses by dnslookup</title>
37168 <para>
37169 <indexterm role="concept">
37170 <primary><command>dnslookup</command> router</primary>
37171 <secondary>declines</secondary>
37172 </indexterm>
37173 There are a few cases where a <command>dnslookup</command> router will decline to accept
37174 an address; if such a router is expected to handle "all remaining non-local
37175 domains", then it is important to set <option>no_more</option>.
37176 </para>
37177 <para>
37178 The router will defer rather than decline if the domain
37179 is found in the <option>fail_defer_domains</option> router option.
37180 </para>
37181 <para>
37182 Reasons for a <command>dnslookup</command> router to decline currently include:
37183 </para>
37184 <itemizedlist>
37185 <listitem>
37186 <para>
37187 The domain does not exist in DNS
37188 </para>
37189 </listitem>
37190 <listitem>
37191 <para>
37192 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
37193 convention (borrowed from SRV) used to indicate that there is no such service
37194 for this domain and to not fall back to trying A/AAAA records.
37195 </para>
37196 </listitem>
37197 <listitem>
37198 <para>
37199 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
37200 </para>
37201 </listitem>
37202 <listitem>
37203 <para>
37204 MX record points to a non-existent host.
37205 </para>
37206 </listitem>
37207 <listitem>
37208 <para>
37209 MX record points to an IP address and the main section option
37210 <option>allow_mx_to_ip</option> is not set.
37211 </para>
37212 </listitem>
37213 <listitem>
37214 <para>
37215 MX records exist and point to valid hosts, but all hosts resolve only to
37216 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
37217 </para>
37218 </listitem>
37219 <listitem>
37220 <para>
37221 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
37222 <option>dns_check_names_pattern</option> for handling one variant of this)
37223 </para>
37224 </listitem>
37225 <listitem>
37226 <para>
37227 <option>check_secondary_mx</option> is set on this router but the local host can
37228 not be found in the MX records (see below)
37229 </para>
37230 </listitem>
37231 </itemizedlist>
37232 </section>
37233 <section id="SECID118">
37234 <title>Private options for dnslookup</title>
37235 <para>
37236 <indexterm role="concept">
37237 <primary>options</primary>
37238 <secondary><command>dnslookup</command> router</secondary>
37239 </indexterm>
37240 The private options for the <command>dnslookup</command> router are as follows:
37241 </para>
37242 <para>
37243 <indexterm role="option">
37244 <primary><option>check_secondary_mx</option></primary>
37245 </indexterm>
37246 </para>
37247 <informaltable frame="all">
37248 <tgroup cols="4" colsep="0" rowsep="0">
37249 <colspec colwidth="8*" align="left"/>
37250 <colspec colwidth="6*" align="center"/>
37251 <colspec colwidth="6*" align="center"/>
37252 <colspec colwidth="6*" align="right"/>
37253 <tbody>
37254 <row>
37255 <entry><option>check_secondary_mx</option></entry>
37256 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37257 <entry>Type: <emphasis>boolean</emphasis></entry>
37258 <entry>Default: <emphasis>false</emphasis></entry>
37259 </row>
37260 </tbody>
37261 </tgroup>
37262 </informaltable>
37263 <para>
37264 <indexterm role="concept">
37265 <primary>MX record</primary>
37266 <secondary>checking for secondary</secondary>
37267 </indexterm>
37268 If this option is set, the router declines unless the local host is found in
37269 (and removed from) the list of hosts obtained by MX lookup. This can be used to
37270 process domains for which the local host is a secondary mail exchanger
37271 differently to other domains. The way in which Exim decides whether a host is
37272 the local host is described in section <xref linkend="SECTreclocipadd"/>.
37273 </para>
37274 <para>
37275 <indexterm role="option">
37276 <primary><option>check_srv</option></primary>
37277 </indexterm>
37278 </para>
37279 <informaltable frame="all">
37280 <tgroup cols="4" colsep="0" rowsep="0">
37281 <colspec colwidth="8*" align="left"/>
37282 <colspec colwidth="6*" align="center"/>
37283 <colspec colwidth="6*" align="center"/>
37284 <colspec colwidth="6*" align="right"/>
37285 <tbody>
37286 <row>
37287 <entry><option>check_srv</option></entry>
37288 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37290 <entry>Default: <emphasis>unset</emphasis></entry>
37291 </row>
37292 </tbody>
37293 </tgroup>
37294 </informaltable>
37295 <para>
37296 <indexterm role="concept">
37297 <primary>SRV record</primary>
37298 <secondary>enabling use of</secondary>
37299 </indexterm>
37300 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
37301 addition to MX and address records. The support is disabled by default. To
37302 enable SRV support, set the <option>check_srv</option> option to the name of the service
37303 required. For example,
37304 </para>
37305 <literallayout class="monospaced">
37306 check_srv = smtp
37307 </literallayout>
37308 <para>
37309 looks for SRV records that refer to the normal smtp service. The option is
37310 expanded, so the service name can vary from message to message or address
37311 to address. This might be helpful if SRV records are being used for a
37312 submission service. If the expansion is forced to fail, the <option>check_srv</option>
37313 option is ignored, and the router proceeds to look for MX records in the
37314 normal way.
37315 </para>
37316 <para>
37317 When the expansion succeeds, the router searches first for SRV records for
37318 the given service (it assumes TCP protocol). A single SRV record with a
37319 host name that consists of just a single dot indicates <quote>no such service for
37320 this domain</quote>; if this is encountered, the router declines. If other kinds of
37321 SRV record are found, they are used to construct a host list for delivery
37322 according to the rules of RFC 2782. MX records are not sought in this case.
37323 </para>
37324 <para>
37325 When no SRV records are found, MX records (and address records) are sought in
37326 the traditional way. In other words, SRV records take precedence over MX
37327 records, just as MX records take precedence over address records. Note that
37328 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
37329 defined it. It is apparently believed that MX records are sufficient for email
37330 and that SRV records should not be used for this purpose. However, SRV records
37331 have an additional <quote>weight</quote> feature which some people might find useful when
37332 trying to split an SMTP load between hosts of different power.
37333 </para>
37334 <para>
37335 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
37336 when there is a DNS lookup error.
37337 </para>
37338 <para>
37339 <indexterm role="option">
37340 <primary><option>fail_defer_domains</option></primary>
37341 </indexterm>
37342 </para>
37343 <informaltable frame="all">
37344 <tgroup cols="4" colsep="0" rowsep="0">
37345 <colspec colwidth="8*" align="left"/>
37346 <colspec colwidth="6*" align="center"/>
37347 <colspec colwidth="6*" align="center"/>
37348 <colspec colwidth="6*" align="right"/>
37349 <tbody>
37350 <row>
37351 <entry><option>fail_defer_domains</option></entry>
37352 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37353 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37354 <entry>Default: <emphasis>unset</emphasis></entry>
37355 </row>
37356 </tbody>
37357 </tgroup>
37358 </informaltable>
37359 <para>
37360 <indexterm role="concept">
37361 <primary>MX record</primary>
37362 <secondary>not found</secondary>
37363 </indexterm>
37364 DNS lookups for domains matching <option>fail_defer_domains</option>
37365 which find no matching record will cause the router to defer
37366 rather than the default behaviour of decline.
37367 This maybe be useful for queueing messages for a newly created
37368 domain while the DNS configuration is not ready.
37369 However, it will result in any message with mistyped domains
37370 also being queued.
37371 </para>
37372 <para>
37373 <indexterm role="option">
37374 <primary><option>ipv4_only</option></primary>
37375 </indexterm>
37376 </para>
37377 <informaltable frame="all">
37378 <tgroup cols="4" colsep="0" rowsep="0">
37379 <colspec colwidth="8*" align="left"/>
37380 <colspec colwidth="6*" align="center"/>
37381 <colspec colwidth="6*" align="center"/>
37382 <colspec colwidth="6*" align="right"/>
37383 <tbody>
37384 <row>
37385 <entry><option>ipv4_only</option></entry>
37386 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37387 <entry>Type: <emphasis>unset</emphasis></entry>
37388 <entry>Default: <emphasis></emphasis></entry>
37389 </row>
37390 </tbody>
37391 </tgroup>
37392 </informaltable>
37393 <para>
37394 <indexterm role="concept">
37395 <primary>IPv6</primary>
37396 <secondary>disabling</secondary>
37397 </indexterm>
37398 <indexterm role="concept">
37399 <primary>DNS</primary>
37400 <secondary>IPv6 disabling</secondary>
37401 </indexterm>
37402 The string is expanded, and if the result is anything but a forced failure,
37403 or an empty string, or one of the strings “0” or “no” or “false”
37404 (checked without regard to the case of the letters),
37405 only A records are used.
37406 </para>
37407 <para>
37408 <indexterm role="option">
37409 <primary><option>ipv4_prefer</option></primary>
37410 </indexterm>
37411 </para>
37412 <informaltable frame="all">
37413 <tgroup cols="4" colsep="0" rowsep="0">
37414 <colspec colwidth="8*" align="left"/>
37415 <colspec colwidth="6*" align="center"/>
37416 <colspec colwidth="6*" align="center"/>
37417 <colspec colwidth="6*" align="right"/>
37418 <tbody>
37419 <row>
37420 <entry><option>ipv4_prefer</option></entry>
37421 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37422 <entry>Type: <emphasis>unset</emphasis></entry>
37423 <entry>Default: <emphasis></emphasis></entry>
37424 </row>
37425 </tbody>
37426 </tgroup>
37427 </informaltable>
37428 <para>
37429 <indexterm role="concept">
37430 <primary>IPv4</primary>
37431 <secondary>preference</secondary>
37432 </indexterm>
37433 <indexterm role="concept">
37434 <primary>DNS</primary>
37435 <secondary>IPv4 preference</secondary>
37436 </indexterm>
37437 The string is expanded, and if the result is anything but a forced failure,
37438 or an empty string, or one of the strings “0” or “no” or “false”
37439 (checked without regard to the case of the letters),
37440 A records are sorted before AAAA records (inverting the default).
37441 </para>
37442 <para>
37443 <indexterm role="option">
37444 <primary><option>mx_domains</option></primary>
37445 </indexterm>
37446 </para>
37447 <informaltable frame="all">
37448 <tgroup cols="4" colsep="0" rowsep="0">
37449 <colspec colwidth="8*" align="left"/>
37450 <colspec colwidth="6*" align="center"/>
37451 <colspec colwidth="6*" align="center"/>
37452 <colspec colwidth="6*" align="right"/>
37453 <tbody>
37454 <row>
37455 <entry><option>mx_domains</option></entry>
37456 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37457 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37458 <entry>Default: <emphasis>unset</emphasis></entry>
37459 </row>
37460 </tbody>
37461 </tgroup>
37462 </informaltable>
37463 <para>
37464 <indexterm role="concept">
37465 <primary>MX record</primary>
37466 <secondary>required to exist</secondary>
37467 </indexterm>
37468 <indexterm role="concept">
37469 <primary>SRV record</primary>
37470 <secondary>required to exist</secondary>
37471 </indexterm>
37472 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
37473 record in order to be recognized. (The name of this option could be improved.)
37474 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
37475 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
37476 setting:
37477 </para>
37478 <literallayout class="monospaced">
37479 mx_domains = ! *.discworld.fict.example : *.fict.example
37480 </literallayout>
37481 <para>
37482 This specifies that messages addressed to a domain that matches the list but
37483 has no MX record should be bounced immediately instead of being routed using
37484 the address record.
37485 </para>
37486 <para>
37487 <indexterm role="option">
37488 <primary><option>mx_fail_domains</option></primary>
37489 </indexterm>
37490 </para>
37491 <informaltable frame="all">
37492 <tgroup cols="4" colsep="0" rowsep="0">
37493 <colspec colwidth="8*" align="left"/>
37494 <colspec colwidth="6*" align="center"/>
37495 <colspec colwidth="6*" align="center"/>
37496 <colspec colwidth="6*" align="right"/>
37497 <tbody>
37498 <row>
37499 <entry><option>mx_fail_domains</option></entry>
37500 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37501 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37502 <entry>Default: <emphasis>unset</emphasis></entry>
37503 </row>
37504 </tbody>
37505 </tgroup>
37506 </informaltable>
37507 <para>
37508 If the DNS lookup for MX records for one of the domains in this list causes a
37509 DNS lookup error, Exim behaves as if no MX records were found. See section
37510 <xref linkend="SECTprowitdnsloo"/> for more discussion.
37511 </para>
37512 <para>
37513 <indexterm role="option">
37514 <primary><option>qualify_single</option></primary>
37515 </indexterm>
37516 </para>
37517 <informaltable frame="all">
37518 <tgroup cols="4" colsep="0" rowsep="0">
37519 <colspec colwidth="8*" align="left"/>
37520 <colspec colwidth="6*" align="center"/>
37521 <colspec colwidth="6*" align="center"/>
37522 <colspec colwidth="6*" align="right"/>
37523 <tbody>
37524 <row>
37525 <entry><option>qualify_single</option></entry>
37526 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37527 <entry>Type: <emphasis>boolean</emphasis></entry>
37528 <entry>Default: <emphasis>true</emphasis></entry>
37529 </row>
37530 </tbody>
37531 </tgroup>
37532 </informaltable>
37533 <para>
37534 <indexterm role="concept">
37535 <primary>DNS</primary>
37536 <secondary>resolver options</secondary>
37537 </indexterm>
37538 <indexterm role="concept">
37539 <primary>DNS</primary>
37540 <secondary>qualifying single-component names</secondary>
37541 </indexterm>
37542 When this option is true, the resolver option RES_DEFNAMES is set for DNS
37543 lookups. Typically, but not standardly, this causes the resolver to qualify
37544 single-component names with the default domain. For example, on a machine
37545 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
37546 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
37547 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
37548 <emphasis>resolv.conf</emphasis>.
37549 </para>
37550 <para>
37551 <indexterm role="option">
37552 <primary><option>rewrite_headers</option></primary>
37553 </indexterm>
37554 </para>
37555 <informaltable frame="all">
37556 <tgroup cols="4" colsep="0" rowsep="0">
37557 <colspec colwidth="8*" align="left"/>
37558 <colspec colwidth="6*" align="center"/>
37559 <colspec colwidth="6*" align="center"/>
37560 <colspec colwidth="6*" align="right"/>
37561 <tbody>
37562 <row>
37563 <entry><option>rewrite_headers</option></entry>
37564 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37565 <entry>Type: <emphasis>boolean</emphasis></entry>
37566 <entry>Default: <emphasis>true</emphasis></entry>
37567 </row>
37568 </tbody>
37569 </tgroup>
37570 </informaltable>
37571 <para>
37572 <indexterm role="concept">
37573 <primary>rewriting</primary>
37574 <secondary>header lines</secondary>
37575 </indexterm>
37576 <indexterm role="concept">
37577 <primary>header lines</primary>
37578 <secondary>rewriting</secondary>
37579 </indexterm>
37580 If the domain name in the address that is being processed is not fully
37581 qualified, it may be expanded to its full form by a DNS lookup. For example, if
37582 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
37583 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
37584 occur as a result of setting the <option>widen_domains</option> option. If
37585 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
37586 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
37587 header lines of the message are rewritten with the full domain name.
37588 </para>
37589 <para>
37590 This option should be turned off only when it is known that no message is
37591 ever going to be sent outside an environment where the abbreviation makes
37592 sense.
37593 </para>
37594 <para>
37595 When an MX record is looked up in the DNS and matches a wildcard record, name
37596 servers normally return a record containing the name that has been looked up,
37597 making it impossible to detect whether a wildcard was present or not. However,
37598 some name servers have recently been seen to return the wildcard entry. If the
37599 name returned by a DNS lookup begins with an asterisk, it is not used for
37600 header rewriting.
37601 </para>
37602 <para>
37603 <indexterm role="option">
37604 <primary><option>same_domain_copy_routing</option></primary>
37605 </indexterm>
37606 </para>
37607 <informaltable frame="all">
37608 <tgroup cols="4" colsep="0" rowsep="0">
37609 <colspec colwidth="8*" align="left"/>
37610 <colspec colwidth="6*" align="center"/>
37611 <colspec colwidth="6*" align="center"/>
37612 <colspec colwidth="6*" align="right"/>
37613 <tbody>
37614 <row>
37615 <entry><option>same_domain_copy_routing</option></entry>
37616 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37617 <entry>Type: <emphasis>boolean</emphasis></entry>
37618 <entry>Default: <emphasis>false</emphasis></entry>
37619 </row>
37620 </tbody>
37621 </tgroup>
37622 </informaltable>
37623 <para>
37624 <indexterm role="concept">
37625 <primary>address</primary>
37626 <secondary>copying routing</secondary>
37627 </indexterm>
37628 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
37629 to the same list of hosts. However, this cannot be presumed, because the router
37630 options and preconditions may refer to the local part of the address. By
37631 default, therefore, Exim routes each address in a message independently. DNS
37632 servers run caches, so repeated DNS lookups are not normally expensive, and in
37633 any case, personal messages rarely have more than a few recipients.
37634 </para>
37635 <para>
37636 If you are running mailing lists with large numbers of subscribers at the same
37637 domain, and you are using a <command>dnslookup</command> router which is independent of the
37638 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
37639 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
37640 routes an address to a remote transport, any other unrouted addresses in the
37641 message that have the same domain are automatically given the same routing
37642 without processing them independently,
37643 provided the following conditions are met:
37644 </para>
37645 <itemizedlist>
37646 <listitem>
37647 <para>
37648 No router that processed the address specified <option>headers_add</option> or
37649 <option>headers_remove</option>.
37650 </para>
37651 </listitem>
37652 <listitem>
37653 <para>
37654 The router did not change the address in any way, for example, by <quote>widening</quote>
37655 the domain.
37656 </para>
37657 </listitem>
37658 </itemizedlist>
37659 <para>
37660 <indexterm role="option">
37661 <primary><option>search_parents</option></primary>
37662 </indexterm>
37663 </para>
37664 <informaltable frame="all">
37665 <tgroup cols="4" colsep="0" rowsep="0">
37666 <colspec colwidth="8*" align="left"/>
37667 <colspec colwidth="6*" align="center"/>
37668 <colspec colwidth="6*" align="center"/>
37669 <colspec colwidth="6*" align="right"/>
37670 <tbody>
37671 <row>
37672 <entry><option>search_parents</option></entry>
37673 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37674 <entry>Type: <emphasis>boolean</emphasis></entry>
37675 <entry>Default: <emphasis>false</emphasis></entry>
37676 </row>
37677 </tbody>
37678 </tgroup>
37679 </informaltable>
37680 <para>
37681 <indexterm role="concept">
37682 <primary>DNS</primary>
37683 <secondary>resolver options</secondary>
37684 </indexterm>
37685 When this option is true, the resolver option RES_DNSRCH is set for DNS
37686 lookups. This is different from the <option>qualify_single</option> option in that it
37687 applies to domains containing dots. Typically, but not standardly, it causes
37688 the resolver to search for the name in the current domain and in parent
37689 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
37690 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
37691 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
37692 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
37693 </para>
37694 <para>
37695 Setting this option true can cause problems in domains that have a wildcard MX
37696 record, because any domain that does not have its own MX record matches the
37697 local wildcard.
37698 </para>
37699 <para>
37700 <indexterm role="option">
37701 <primary><option>srv_fail_domains</option></primary>
37702 </indexterm>
37703 </para>
37704 <informaltable frame="all">
37705 <tgroup cols="4" colsep="0" rowsep="0">
37706 <colspec colwidth="8*" align="left"/>
37707 <colspec colwidth="6*" align="center"/>
37708 <colspec colwidth="6*" align="center"/>
37709 <colspec colwidth="6*" align="right"/>
37710 <tbody>
37711 <row>
37712 <entry><option>srv_fail_domains</option></entry>
37713 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37714 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
37715 <entry>Default: <emphasis>unset</emphasis></entry>
37716 </row>
37717 </tbody>
37718 </tgroup>
37719 </informaltable>
37720 <para>
37721 If the DNS lookup for SRV records for one of the domains in this list causes a
37722 DNS lookup error, Exim behaves as if no SRV records were found. See section
37723 <xref linkend="SECTprowitdnsloo"/> for more discussion.
37724 </para>
37725 <para>
37726 <indexterm role="option">
37727 <primary><option>widen_domains</option></primary>
37728 </indexterm>
37729 </para>
37730 <informaltable frame="all">
37731 <tgroup cols="4" colsep="0" rowsep="0">
37732 <colspec colwidth="8*" align="left"/>
37733 <colspec colwidth="6*" align="center"/>
37734 <colspec colwidth="6*" align="center"/>
37735 <colspec colwidth="6*" align="right"/>
37736 <tbody>
37737 <row>
37738 <entry><option>widen_domains</option></entry>
37739 <entry>Use: <emphasis>dnslookup</emphasis></entry>
37740 <entry>Type: <emphasis>string list</emphasis></entry>
37741 <entry>Default: <emphasis>unset</emphasis></entry>
37742 </row>
37743 </tbody>
37744 </tgroup>
37745 </informaltable>
37746 <para>
37747 <indexterm role="concept">
37748 <primary>domain</primary>
37749 <secondary>partial; widening</secondary>
37750 </indexterm>
37751 If a DNS lookup fails and this option is set, each of its strings in turn is
37752 added onto the end of the domain, and the lookup is tried again. For example,
37753 if
37754 </para>
37755 <literallayout class="monospaced">
37756 widen_domains = fict.example:ref.example
37757 </literallayout>
37758 <para>
37759 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
37760 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
37761 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
37762 and <option>search_parents</option> options can cause some widening to be undertaken inside
37763 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
37764 when verifying, unless <option>rewrite_headers</option> is false (not the default).
37765 </para>
37766 </section>
37767 <section id="SECID119">
37768 <title>Effect of qualify_single and search_parents</title>
37769 <para>
37770 When a domain from an envelope recipient is changed by the resolver as a result
37771 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
37772 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
37773 is set false. Exim then re-routes the address, using the full domain.
37774 </para>
37775 <para>
37776 These two options affect only the DNS lookup that takes place inside the router
37777 for the domain of the address that is being routed. They do not affect lookups
37778 such as that implied by
37779 </para>
37780 <literallayout class="monospaced">
37781 domains = @mx_any
37782 </literallayout>
37783 <para>
37784 that may happen while processing a router precondition before the router is
37785 entered. No widening ever takes place for these lookups.
37786 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
37787 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
37788 </para>
37789 </section>
37790 </chapter>
37791
37792 <chapter id="CHID5">
37793 <title>The ipliteral router</title>
37794 <para>
37795 <indexterm role="concept">
37796 <primary><command>ipliteral</command> router</primary>
37797 </indexterm>
37798 <indexterm role="concept">
37799 <primary>domain literal</primary>
37800 <secondary>routing</secondary>
37801 </indexterm>
37802 <indexterm role="concept">
37803 <primary>routers</primary>
37804 <secondary><command>ipliteral</command></secondary>
37805 </indexterm>
37806 This router has no private options. Unless it is being used purely for
37807 verification (see <option>verify_only</option>) a transport is required to be defined by the
37808 generic <option>transport</option> option. The router accepts the address if its domain part
37809 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
37810 router handles the address
37811 </para>
37812 <literallayout class="monospaced">
37813 root@[192.168.1.1]
37814 </literallayout>
37815 <para>
37816 by setting up delivery to the host with that IP address. IPv4 domain literals
37817 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
37818 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
37819 </para>
37820 <literallayout class="monospaced">
37821 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
37822 </literallayout>
37823 <para>
37824 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
37825 grounds that sooner or later somebody will try it.
37826 </para>
37827 <para>
37828 <indexterm role="option">
37829 <primary><option>self</option></primary>
37830 <secondary>in <command>ipliteral</command> router</secondary>
37831 </indexterm>
37832 If the IP address matches something in <option>ignore_target_hosts</option>, the router
37833 declines. If an IP literal turns out to refer to the local host, the generic
37834 <option>self</option> option determines what happens.
37835 </para>
37836 <para>
37837 The RFCs require support for domain literals; however, their use is
37838 controversial in today&#x2019;s Internet. If you want to use this router, you must
37839 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
37840 Exim will not recognize the domain literal syntax in addresses.
37841 </para>
37842 </chapter>
37843
37844 <chapter id="CHID6">
37845 <title>The iplookup router</title>
37846 <para>
37847 <indexterm role="concept">
37848 <primary><command>iplookup</command> router</primary>
37849 </indexterm>
37850 <indexterm role="concept">
37851 <primary>routers</primary>
37852 <secondary><command>iplookup</command></secondary>
37853 </indexterm>
37854 The <command>iplookup</command> router was written to fulfil a specific requirement in
37855 Cambridge University (which in fact no longer exists). For this reason, it is
37856 not included in the binary of Exim by default. If you want to include it, you
37857 must set
37858 </para>
37859 <literallayout class="monospaced">
37860 ROUTER_IPLOOKUP=yes
37861 </literallayout>
37862 <para>
37863 in your <filename>Local/Makefile</filename> configuration file.
37864 </para>
37865 <para>
37866 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
37867 connection to one or more specific hosts. The host can then return the same or
37868 a different address &ndash; in effect rewriting the recipient address in the
37869 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
37870 this process fails, the address can be passed on to other routers, or delivery
37871 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
37872 must not be specified for it.
37873 </para>
37874 <para>
37875 <indexterm role="concept">
37876 <primary>options</primary>
37877 <secondary><command>iplookup</command> router</secondary>
37878 </indexterm>
37879 <indexterm role="option">
37880 <primary><option>hosts</option></primary>
37881 </indexterm>
37882 </para>
37883 <informaltable frame="all">
37884 <tgroup cols="4" colsep="0" rowsep="0">
37885 <colspec colwidth="8*" align="left"/>
37886 <colspec colwidth="6*" align="center"/>
37887 <colspec colwidth="6*" align="center"/>
37888 <colspec colwidth="6*" align="right"/>
37889 <tbody>
37890 <row>
37891 <entry><option>hosts</option></entry>
37892 <entry>Use: <emphasis>iplookup</emphasis></entry>
37893 <entry>Type: <emphasis>string</emphasis></entry>
37894 <entry>Default: <emphasis>unset</emphasis></entry>
37895 </row>
37896 </tbody>
37897 </tgroup>
37898 </informaltable>
37899 <para>
37900 This option must be supplied. Its value is a colon-separated list of host
37901 names. The hosts are looked up using <function>gethostbyname()</function>
37902 (or <function>getipnodebyname()</function> when available)
37903 and are tried in order until one responds to the query. If none respond, what
37904 happens is controlled by <option>optional</option>.
37905 </para>
37906 <para>
37907 <indexterm role="option">
37908 <primary><option>optional</option></primary>
37909 </indexterm>
37910 </para>
37911 <informaltable frame="all">
37912 <tgroup cols="4" colsep="0" rowsep="0">
37913 <colspec colwidth="8*" align="left"/>
37914 <colspec colwidth="6*" align="center"/>
37915 <colspec colwidth="6*" align="center"/>
37916 <colspec colwidth="6*" align="right"/>
37917 <tbody>
37918 <row>
37919 <entry><option>optional</option></entry>
37920 <entry>Use: <emphasis>iplookup</emphasis></entry>
37921 <entry>Type: <emphasis>boolean</emphasis></entry>
37922 <entry>Default: <emphasis>false</emphasis></entry>
37923 </row>
37924 </tbody>
37925 </tgroup>
37926 </informaltable>
37927 <para>
37928 If <option>optional</option> is true, if no response is obtained from any host, the address
37929 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
37930 delivery to the address is deferred.
37931 </para>
37932 <para>
37933 <indexterm role="option">
37934 <primary><option>port</option></primary>
37935 </indexterm>
37936 </para>
37937 <informaltable frame="all">
37938 <tgroup cols="4" colsep="0" rowsep="0">
37939 <colspec colwidth="8*" align="left"/>
37940 <colspec colwidth="6*" align="center"/>
37941 <colspec colwidth="6*" align="center"/>
37942 <colspec colwidth="6*" align="right"/>
37943 <tbody>
37944 <row>
37945 <entry><option>port</option></entry>
37946 <entry>Use: <emphasis>iplookup</emphasis></entry>
37947 <entry>Type: <emphasis>integer</emphasis></entry>
37948 <entry>Default: <emphasis>0</emphasis></entry>
37949 </row>
37950 </tbody>
37951 </tgroup>
37952 </informaltable>
37953 <para>
37954 <indexterm role="concept">
37955 <primary>port</primary>
37956 <secondary><command>iplookup</command> router</secondary>
37957 </indexterm>
37958 This option must be supplied. It specifies the port number for the TCP or UDP
37959 call.
37960 </para>
37961 <para>
37962 <indexterm role="option">
37963 <primary><option>protocol</option></primary>
37964 </indexterm>
37965 </para>
37966 <informaltable frame="all">
37967 <tgroup cols="4" colsep="0" rowsep="0">
37968 <colspec colwidth="8*" align="left"/>
37969 <colspec colwidth="6*" align="center"/>
37970 <colspec colwidth="6*" align="center"/>
37971 <colspec colwidth="6*" align="right"/>
37972 <tbody>
37973 <row>
37974 <entry><option>protocol</option></entry>
37975 <entry>Use: <emphasis>iplookup</emphasis></entry>
37976 <entry>Type: <emphasis>string</emphasis></entry>
37977 <entry>Default: <emphasis>udp</emphasis></entry>
37978 </row>
37979 </tbody>
37980 </tgroup>
37981 </informaltable>
37982 <para>
37983 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
37984 protocols is to be used.
37985 </para>
37986 <para>
37987 <indexterm role="option">
37988 <primary><option>query</option></primary>
37989 </indexterm>
37990 </para>
37991 <informaltable frame="all">
37992 <tgroup cols="4" colsep="0" rowsep="0">
37993 <colspec colwidth="8*" align="left"/>
37994 <colspec colwidth="6*" align="center"/>
37995 <colspec colwidth="6*" align="center"/>
37996 <colspec colwidth="6*" align="right"/>
37997 <tbody>
37998 <row>
37999 <entry><option>query</option></entry>
38000 <entry>Use: <emphasis>iplookup</emphasis></entry>
38001 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38002 <entry>Default: <emphasis>see below</emphasis></entry>
38003 </row>
38004 </tbody>
38005 </tgroup>
38006 </informaltable>
38007 <para>
38008 This defines the content of the query that is sent to the remote hosts. The
38009 default value is:
38010 </para>
38011 <literallayout class="monospaced">
38012 $local_part@$domain $local_part@$domain
38013 </literallayout>
38014 <para>
38015 The repetition serves as a way of checking that a response is to the correct
38016 query in the default case (see <option>response_pattern</option> below).
38017 </para>
38018 <para>
38019 <indexterm role="option">
38020 <primary><option>reroute</option></primary>
38021 </indexterm>
38022 </para>
38023 <informaltable frame="all">
38024 <tgroup cols="4" colsep="0" rowsep="0">
38025 <colspec colwidth="8*" align="left"/>
38026 <colspec colwidth="6*" align="center"/>
38027 <colspec colwidth="6*" align="center"/>
38028 <colspec colwidth="6*" align="right"/>
38029 <tbody>
38030 <row>
38031 <entry><option>reroute</option></entry>
38032 <entry>Use: <emphasis>iplookup</emphasis></entry>
38033 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38034 <entry>Default: <emphasis>unset</emphasis></entry>
38035 </row>
38036 </tbody>
38037 </tgroup>
38038 </informaltable>
38039 <para>
38040 If this option is not set, the rerouted address is precisely the byte string
38041 returned by the remote host, up to the first white space, if any. If set, the
38042 string is expanded to form the rerouted address. It can include parts matched
38043 in the response by <option>response_pattern</option> by means of numeric variables such as
38044 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
38045 whether or not a pattern is in use. In all cases, the rerouted address must end
38046 up in the form <emphasis>local_part@domain</emphasis>.
38047 </para>
38048 <para>
38049 <indexterm role="option">
38050 <primary><option>response_pattern</option></primary>
38051 </indexterm>
38052 </para>
38053 <informaltable frame="all">
38054 <tgroup cols="4" colsep="0" rowsep="0">
38055 <colspec colwidth="8*" align="left"/>
38056 <colspec colwidth="6*" align="center"/>
38057 <colspec colwidth="6*" align="center"/>
38058 <colspec colwidth="6*" align="right"/>
38059 <tbody>
38060 <row>
38061 <entry><option>response_pattern</option></entry>
38062 <entry>Use: <emphasis>iplookup</emphasis></entry>
38063 <entry>Type: <emphasis>string</emphasis></entry>
38064 <entry>Default: <emphasis>unset</emphasis></entry>
38065 </row>
38066 </tbody>
38067 </tgroup>
38068 </informaltable>
38069 <para>
38070 This option can be set to a regular expression that is applied to the string
38071 returned from the remote host. If the pattern does not match the response, the
38072 router declines. If <option>response_pattern</option> is not set, no checking of the
38073 response is done, unless the query was defaulted, in which case there is a
38074 check that the text returned after the first white space is the original
38075 address. This checks that the answer that has been received is in response to
38076 the correct question. For example, if the response is just a new domain, the
38077 following could be used:
38078 </para>
38079 <literallayout class="monospaced">
38080 response_pattern = ^([^@]+)$
38081 reroute = $local_part@$1
38082 </literallayout>
38083 <para>
38084 <indexterm role="option">
38085 <primary><option>timeout</option></primary>
38086 </indexterm>
38087 </para>
38088 <informaltable frame="all">
38089 <tgroup cols="4" colsep="0" rowsep="0">
38090 <colspec colwidth="8*" align="left"/>
38091 <colspec colwidth="6*" align="center"/>
38092 <colspec colwidth="6*" align="center"/>
38093 <colspec colwidth="6*" align="right"/>
38094 <tbody>
38095 <row>
38096 <entry><option>timeout</option></entry>
38097 <entry>Use: <emphasis>iplookup</emphasis></entry>
38098 <entry>Type: <emphasis>time</emphasis></entry>
38099 <entry>Default: <emphasis>5s</emphasis></entry>
38100 </row>
38101 </tbody>
38102 </tgroup>
38103 </informaltable>
38104 <para>
38105 This specifies the amount of time to wait for a response from the remote
38106 machine. The same timeout is used for the <function>connect()</function> function for a TCP
38107 call. It does not apply to UDP.
38108 </para>
38109 </chapter>
38110
38111 <chapter id="CHID7">
38112 <title>The manualroute router</title>
38113 <para>
38114 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
38115 <primary><command>manualroute</command> router</primary>
38116 </indexterm>
38117 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
38118 <primary>routers</primary>
38119 <secondary><command>manualroute</command></secondary>
38120 </indexterm>
38121 <indexterm role="concept">
38122 <primary>domain</primary>
38123 <secondary>manually routing</secondary>
38124 </indexterm>
38125 The <command>manualroute</command> router is so-called because it provides a way of manually
38126 routing an address according to its domain. It is mainly used when you want to
38127 route addresses to remote hosts according to your own rules, bypassing the
38128 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
38129 route to local transports, a facility that may be useful if you want to save
38130 messages for dial-in hosts in local files.
38131 </para>
38132 <para>
38133 The <command>manualroute</command> router compares a list of domain patterns with the domain
38134 it is trying to route. If there is no match, the router declines. Each pattern
38135 has associated with it a list of hosts and some other optional data, which may
38136 include a transport. The combination of a pattern and its data is called a
38137 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
38138 generic <option>transport</option> option must specify a transport, unless the router is
38139 being used purely for verification (see <option>verify_only</option>).
38140 </para>
38141 <para>
38142 <indexterm role="variable">
38143 <primary><varname>$host</varname></primary>
38144 </indexterm>
38145 In the case of verification, matching the domain pattern is sufficient for the
38146 router to accept the address. When actually routing an address for delivery,
38147 an address that matches a domain pattern is queued for the associated
38148 transport. If the transport is not a local one, a host list must be associated
38149 with the pattern; IP addresses are looked up for the hosts, and these are
38150 passed to the transport along with the mail address. For local transports, a
38151 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
38152 text string.
38153 </para>
38154 <para>
38155 The list of routing rules can be provided as an inline string in
38156 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
38157 or database by setting <option>route_data</option>. Only one of these settings may appear in
38158 any one instance of <command>manualroute</command>. The format of routing rules is described
38159 below, following the list of private options.
38160 </para>
38161 <section id="SECTprioptman">
38162 <title>Private options for manualroute</title>
38163 <para>
38164 <indexterm role="concept">
38165 <primary>options</primary>
38166 <secondary><command>manualroute</command> router</secondary>
38167 </indexterm>
38168 The private options for the <command>manualroute</command> router are as follows:
38169 </para>
38170 <para>
38171 <indexterm role="option">
38172 <primary><option>host_all_ignored</option></primary>
38173 </indexterm>
38174 </para>
38175 <informaltable frame="all">
38176 <tgroup cols="4" colsep="0" rowsep="0">
38177 <colspec colwidth="8*" align="left"/>
38178 <colspec colwidth="6*" align="center"/>
38179 <colspec colwidth="6*" align="center"/>
38180 <colspec colwidth="6*" align="right"/>
38181 <tbody>
38182 <row>
38183 <entry><option>host_all_ignored</option></entry>
38184 <entry>Use: <emphasis>manualroute</emphasis></entry>
38185 <entry>Type: <emphasis>string</emphasis></entry>
38186 <entry>Default: <emphasis>defer</emphasis></entry>
38187 </row>
38188 </tbody>
38189 </tgroup>
38190 </informaltable>
38191 <para>
38192 See <option>host_find_failed</option>.
38193 </para>
38194 <para>
38195 <indexterm role="option">
38196 <primary><option>host_find_failed</option></primary>
38197 </indexterm>
38198 </para>
38199 <informaltable frame="all">
38200 <tgroup cols="4" colsep="0" rowsep="0">
38201 <colspec colwidth="8*" align="left"/>
38202 <colspec colwidth="6*" align="center"/>
38203 <colspec colwidth="6*" align="center"/>
38204 <colspec colwidth="6*" align="right"/>
38205 <tbody>
38206 <row>
38207 <entry><option>host_find_failed</option></entry>
38208 <entry>Use: <emphasis>manualroute</emphasis></entry>
38209 <entry>Type: <emphasis>string</emphasis></entry>
38210 <entry>Default: <emphasis>freeze</emphasis></entry>
38211 </row>
38212 </tbody>
38213 </tgroup>
38214 </informaltable>
38215 <para>
38216 This option controls what happens when <command>manualroute</command> tries to find an IP
38217 address for a host, and the host does not exist. The option can be set to one
38218 of the following values:
38219 </para>
38220 <literallayout class="monospaced">
38221 decline
38222 defer
38223 fail
38224 freeze
38225 ignore
38226 pass
38227 </literallayout>
38228 <para>
38229 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
38230 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
38231 forces the address to be passed to the next router (or the router defined by
38232 <option>pass_router</option>),
38233 <indexterm role="option">
38234 <primary><option>more</option></primary>
38235 </indexterm>
38236 overriding <option>no_more</option>, whereas the latter passes the address to the next
38237 router only if <option>more</option> is true.
38238 </para>
38239 <para>
38240 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
38241 cannot be found. If all the hosts in the list are ignored, the behaviour is
38242 controlled by the <option>host_all_ignored</option> option. This takes the same values
38243 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
38244 </para>
38245 <para>
38246 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
38247 state; if a host lookup gets a temporary error, delivery is deferred unless the
38248 generic <option>pass_on_timeout</option> option is set.
38249 </para>
38250 <para>
38251 <indexterm role="option">
38252 <primary><option>hosts_randomize</option></primary>
38253 </indexterm>
38254 </para>
38255 <informaltable frame="all">
38256 <tgroup cols="4" colsep="0" rowsep="0">
38257 <colspec colwidth="8*" align="left"/>
38258 <colspec colwidth="6*" align="center"/>
38259 <colspec colwidth="6*" align="center"/>
38260 <colspec colwidth="6*" align="right"/>
38261 <tbody>
38262 <row>
38263 <entry><option>hosts_randomize</option></entry>
38264 <entry>Use: <emphasis>manualroute</emphasis></entry>
38265 <entry>Type: <emphasis>boolean</emphasis></entry>
38266 <entry>Default: <emphasis>false</emphasis></entry>
38267 </row>
38268 </tbody>
38269 </tgroup>
38270 </informaltable>
38271 <para>
38272 <indexterm role="concept">
38273 <primary>randomized host list</primary>
38274 </indexterm>
38275 <indexterm role="concept">
38276 <primary>host</primary>
38277 <secondary>list of; randomized</secondary>
38278 </indexterm>
38279 If this option is set, the order of the items in a host list in a routing rule
38280 is randomized each time the list is used, unless an option in the routing rule
38281 overrides (see below). Randomizing the order of a host list can be used to do
38282 crude load sharing. However, if more than one mail address is routed by the
38283 same router to the same host list, the host lists are considered to be the same
38284 (even though they may be randomized into different orders) for the purpose of
38285 deciding whether to batch the deliveries into a single SMTP transaction.
38286 </para>
38287 <para>
38288 When <option>hosts_randomize</option> is true, a host list may be split
38289 into groups whose order is separately randomized. This makes it possible to
38290 set up MX-like behaviour. The boundaries between groups are indicated by an
38291 item that is just <literal>+</literal> in the host list. For example:
38292 </para>
38293 <literallayout class="monospaced">
38294 route_list = * host1:host2:host3:+:host4:host5
38295 </literallayout>
38296 <para>
38297 The order of the first three hosts and the order of the last two hosts is
38298 randomized for each use, but the first three always end up before the last two.
38299 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
38300 randomized host list is passed to an <command>smtp</command> transport that also has
38301 <option>hosts_randomize set</option>, the list is not re-randomized.
38302 </para>
38303 <para>
38304 <indexterm role="option">
38305 <primary><option>route_data</option></primary>
38306 </indexterm>
38307 </para>
38308 <informaltable frame="all">
38309 <tgroup cols="4" colsep="0" rowsep="0">
38310 <colspec colwidth="8*" align="left"/>
38311 <colspec colwidth="6*" align="center"/>
38312 <colspec colwidth="6*" align="center"/>
38313 <colspec colwidth="6*" align="right"/>
38314 <tbody>
38315 <row>
38316 <entry><option>route_data</option></entry>
38317 <entry>Use: <emphasis>manualroute</emphasis></entry>
38318 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38319 <entry>Default: <emphasis>unset</emphasis></entry>
38320 </row>
38321 </tbody>
38322 </tgroup>
38323 </informaltable>
38324 <para>
38325 If this option is set, it must expand to yield the data part of a routing rule.
38326 Typically, the expansion string includes a lookup based on the domain. For
38327 example:
38328 </para>
38329 <literallayout class="monospaced">
38330 route_data = ${lookup{$domain}dbm{/etc/routes}}
38331 </literallayout>
38332 <para>
38333 If the expansion is forced to fail, or the result is an empty string, the
38334 router declines. Other kinds of expansion failure cause delivery to be
38335 deferred.
38336 </para>
38337 <para>
38338 <indexterm role="option">
38339 <primary><option>route_list</option></primary>
38340 </indexterm>
38341 </para>
38342 <informaltable frame="all">
38343 <tgroup cols="4" colsep="0" rowsep="0">
38344 <colspec colwidth="8*" align="left"/>
38345 <colspec colwidth="6*" align="center"/>
38346 <colspec colwidth="6*" align="center"/>
38347 <colspec colwidth="6*" align="right"/>
38348 <tbody>
38349 <row>
38350 <entry><option>route_list</option></entry>
38351 <entry>Use: <emphasis>manualroute</emphasis></entry>
38352 <entry>Type: <emphasis>string list</emphasis></entry>
38353 <entry>Default: <emphasis>unset</emphasis></entry>
38354 </row>
38355 </tbody>
38356 </tgroup>
38357 </informaltable>
38358 <para>
38359 This string is a list of routing rules, in the form defined below. Note that,
38360 unlike most string lists, the items are separated by semicolons. This is so
38361 that they may contain colon-separated host lists.
38362 </para>
38363 <para>
38364 <indexterm role="option">
38365 <primary><option>same_domain_copy_routing</option></primary>
38366 </indexterm>
38367 </para>
38368 <informaltable frame="all">
38369 <tgroup cols="4" colsep="0" rowsep="0">
38370 <colspec colwidth="8*" align="left"/>
38371 <colspec colwidth="6*" align="center"/>
38372 <colspec colwidth="6*" align="center"/>
38373 <colspec colwidth="6*" align="right"/>
38374 <tbody>
38375 <row>
38376 <entry><option>same_domain_copy_routing</option></entry>
38377 <entry>Use: <emphasis>manualroute</emphasis></entry>
38378 <entry>Type: <emphasis>boolean</emphasis></entry>
38379 <entry>Default: <emphasis>false</emphasis></entry>
38380 </row>
38381 </tbody>
38382 </tgroup>
38383 </informaltable>
38384 <para>
38385 <indexterm role="concept">
38386 <primary>address</primary>
38387 <secondary>copying routing</secondary>
38388 </indexterm>
38389 Addresses with the same domain are normally routed by the <command>manualroute</command>
38390 router to the same list of hosts. However, this cannot be presumed, because the
38391 router options and preconditions may refer to the local part of the address. By
38392 default, therefore, Exim routes each address in a message independently. DNS
38393 servers run caches, so repeated DNS lookups are not normally expensive, and in
38394 any case, personal messages rarely have more than a few recipients.
38395 </para>
38396 <para>
38397 If you are running mailing lists with large numbers of subscribers at the same
38398 domain, and you are using a <command>manualroute</command> router which is independent of the
38399 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
38400 lookups for identical domains in one message. In this case, when
38401 <command>manualroute</command> routes an address to a remote transport, any other unrouted
38402 addresses in the message that have the same domain are automatically given the
38403 same routing without processing them independently. However, this is only done
38404 if <option>headers_add</option> and <option>headers_remove</option> are unset.
38405 </para>
38406 </section>
38407 <section id="SECID120">
38408 <title>Routing rules in route_list</title>
38409 <para>
38410 The value of <option>route_list</option> is a string consisting of a sequence of routing
38411 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
38412 entered as two semicolons. Alternatively, the list separator can be changed as
38413 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
38414 Empty rules are ignored. The format of each rule is
38415 </para>
38416 <literallayout>
38417 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
38418 </literallayout>
38419 <para>
38420 The following example contains two rules, each with a simple domain pattern and
38421 no options:
38422 </para>
38423 <literallayout class="monospaced">
38424 route_list = \
38425   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
38426   thes.ref.example  mail-3.ref.example:mail-4.ref.example
38427 </literallayout>
38428 <para>
38429 The three parts of a rule are separated by white space. The pattern and the
38430 list of hosts can be enclosed in quotes if necessary, and if they are, the
38431 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
38432 single domain pattern, which is the only mandatory item in the rule. The
38433 pattern is in the same format as one item in a domain list (see section
38434 <xref linkend="SECTdomainlist"/>),
38435 except that it may not be the name of an interpolated file.
38436 That is, it may be wildcarded, or a regular expression, or a file or database
38437 lookup (with semicolons doubled, because of the use of semicolon as a separator
38438 in a <option>route_list</option>).
38439 </para>
38440 <para>
38441 The rules in <option>route_list</option> are searched in order until one of the patterns
38442 matches the domain that is being routed. The list of hosts and then options are
38443 then used as described below. If there is no match, the router declines. When
38444 <option>route_list</option> is set, <option>route_data</option> must not be set.
38445 </para>
38446 </section>
38447 <section id="SECID121">
38448 <title>Routing rules in route_data</title>
38449 <para>
38450 The use of <option>route_list</option> is convenient when there are only a small number of
38451 routing rules. For larger numbers, it is easier to use a file or database to
38452 hold the routing information, and use the <option>route_data</option> option instead.
38453 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
38454 Most commonly, <option>route_data</option> is set as a string that contains an
38455 expansion lookup. For example, suppose we place two routing rules in a file
38456 like this:
38457 </para>
38458 <literallayout class="monospaced">
38459 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
38460 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
38461 </literallayout>
38462 <para>
38463 This data can be accessed by setting
38464 </para>
38465 <literallayout class="monospaced">
38466 route_data = ${lookup{$domain}lsearch{/the/file/name}}
38467 </literallayout>
38468 <para>
38469 Failure of the lookup results in an empty string, causing the router to
38470 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
38471 requirement is that the result of expanding the string is a list of hosts,
38472 possibly followed by options, separated by white space. The list of hosts must
38473 be enclosed in quotes if it contains white space.
38474 </para>
38475 </section>
38476 <section id="SECID122">
38477 <title>Format of the list of hosts</title>
38478 <para>
38479 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
38480 always separately expanded before use. If the expansion fails, the router
38481 declines. The result of the expansion must be a colon-separated list of names
38482 and/or IP addresses, optionally also including ports.
38483 If the list is written with spaces, it must be protected with quotes.
38484 The format of each item
38485 in the list is described in the next section. The list separator can be changed
38486 as described in section <xref linkend="SECTlistsepchange"/>.
38487 </para>
38488 <para>
38489 If the list of hosts was obtained from a <option>route_list</option> item, the following
38490 variables are set during its expansion:
38491 </para>
38492 <itemizedlist>
38493 <listitem>
38494 <para>
38495 <indexterm role="concept">
38496 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
38497 <secondary>in <command>manualroute</command> router</secondary>
38498 </indexterm>
38499 If the domain was matched against a regular expression, the numeric variables
38500 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
38501 </para>
38502 <literallayout class="monospaced">
38503 route_list = ^domain(\d+)   host-$1.text.example
38504 </literallayout>
38505 </listitem>
38506 <listitem>
38507 <para>
38508 <varname>$0</varname> is always set to the entire domain.
38509 </para>
38510 </listitem>
38511 <listitem>
38512 <para>
38513 <varname>$1</varname> is also set when partial matching is done in a file lookup.
38514 </para>
38515 </listitem>
38516 <listitem>
38517 <para>
38518 <indexterm role="variable">
38519 <primary><varname>$value</varname></primary>
38520 </indexterm>
38521 If the pattern that matched the domain was a lookup item, the data that was
38522 looked up is available in the expansion variable <varname>$value</varname>. For example:
38523 </para>
38524 <literallayout class="monospaced">
38525 route_list = lsearch;;/some/file.routes  $value
38526 </literallayout>
38527 </listitem>
38528 </itemizedlist>
38529 <para>
38530 Note the doubling of the semicolon in the pattern that is necessary because
38531 semicolon is the default route list separator.
38532 </para>
38533 </section>
38534 <section id="SECTformatonehostitem">
38535 <title>Format of one host item</title>
38536 <para>
38537 Each item in the list of hosts can be either a host name or an IP address,
38538 optionally with an attached port number, or it can be a single "+"
38539 (see <option>hosts_randomize</option>).
38540 When no port is given, an IP address
38541 is not enclosed in brackets. When a port is specified, it overrides the port
38542 specification on the transport. The port is separated from the name or address
38543 by a colon. This leads to some complications:
38544 </para>
38545 <itemizedlist>
38546 <listitem>
38547 <para>
38548 Because colon is the default separator for the list of hosts, either
38549 the colon that specifies a port must be doubled, or the list separator must
38550 be changed. The following two examples have the same effect:
38551 </para>
38552 <literallayout class="monospaced">
38553 route_list = * "host1.tld::1225 : host2.tld::1226"
38554 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
38555 </literallayout>
38556 </listitem>
38557 <listitem>
38558 <para>
38559 When IPv6 addresses are involved, it gets worse, because they contain
38560 colons of their own. To make this case easier, it is permitted to
38561 enclose an IP address (either v4 or v6) in square brackets if a port
38562 number follows. For example:
38563 </para>
38564 <literallayout class="monospaced">
38565 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
38566 </literallayout>
38567 </listitem>
38568 </itemizedlist>
38569 </section>
38570 <section id="SECThostshowused">
38571 <title>How the list of hosts is used</title>
38572 <para>
38573 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
38574 the hosts is tried, in the order specified, when carrying out the SMTP
38575 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
38576 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
38577 transport.
38578 </para>
38579 <para>
38580 Hosts may be listed by name or by IP address. An unadorned name in the list of
38581 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
38582 interpreted as an indirection to a sublist of hosts obtained by looking up MX
38583 records in the DNS. For example:
38584 </para>
38585 <literallayout class="monospaced">
38586 route_list = *  x.y.z:p.q.r/MX:e.f.g
38587 </literallayout>
38588 <para>
38589 If this feature is used with a port specifier, the port must come last. For
38590 example:
38591 </para>
38592 <literallayout class="monospaced">
38593 route_list = *  dom1.tld/mx::1225
38594 </literallayout>
38595 <para>
38596 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
38597 randomized before any lookups are done. Exim then scans the list; for any name
38598 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
38599 be an interface on the local host and the item is not the first in the list,
38600 Exim discards it and any subsequent items. If it is the first item, what
38601 happens is controlled by the
38602 <indexterm role="option">
38603 <primary><option>self</option></primary>
38604 <secondary>in <command>manualroute</command> router</secondary>
38605 </indexterm>
38606 <option>self</option> option of the router.
38607 </para>
38608 <para>
38609 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
38610 hosts obtained by looking up MX records for the name. This is always a DNS
38611 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
38612 below) are not relevant here. The order of these hosts is determined by the
38613 preference values in the MX records, according to the usual rules. Because
38614 randomizing happens before the MX lookup, it does not affect the order that is
38615 defined by MX preferences.
38616 </para>
38617 <para>
38618 If the local host is present in the sublist obtained from MX records, but is
38619 not the most preferred host in that list, it and any equally or less
38620 preferred hosts are removed before the sublist is inserted into the main list.
38621 </para>
38622 <para>
38623 If the local host is the most preferred host in the MX list, what happens
38624 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
38625 is not the first item (that is, there are previous hosts in the main list),
38626 Exim discards this name and any subsequent items in the main list.
38627 </para>
38628 <para>
38629 If the MX item is first in the list of hosts, and the local host is the
38630 most preferred host, what happens is controlled by the <option>self</option> option of the
38631 router.
38632 </para>
38633 <para>
38634 DNS failures when lookup up the MX records are treated in the same way as DNS
38635 failures when looking up IP addresses: <option>pass_on_timeout</option> and
38636 <option>host_find_failed</option> are used when relevant.
38637 </para>
38638 <para>
38639 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
38640 whether obtained from an MX lookup or not.
38641 </para>
38642 </section>
38643 <section id="SECThowoptused">
38644 <title>How the options are used</title>
38645 <para>
38646 The options are a sequence of words, space-separated.
38647 One of the words can be the name of a transport; this overrides the
38648 <option>transport</option> option on the router for this particular routing rule only. The
38649 other words (if present) control randomization of the list of hosts on a
38650 per-rule basis, and how the IP addresses of the hosts are to be found when
38651 routing to a remote transport. These options are as follows:
38652 </para>
38653 <itemizedlist>
38654 <listitem>
38655 <para>
38656 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
38657 setting of <option>hosts_randomize</option> for this routing rule only.
38658 </para>
38659 </listitem>
38660 <listitem>
38661 <para>
38662 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
38663 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
38664 </para>
38665 </listitem>
38666 <listitem>
38667 <para>
38668 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
38669 find IP addresses. This function may ultimately cause a DNS lookup, but it may
38670 also look in <filename>/etc/hosts</filename> or other sources of information.
38671 </para>
38672 </listitem>
38673 <listitem>
38674 <para>
38675 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
38676 no address records are found. If there is a temporary DNS error (such as a
38677 timeout), delivery is deferred.
38678 </para>
38679 </listitem>
38680 <listitem>
38681 <para>
38682 <option>ipv4_only</option>: in direct DNS lookups, look up only A records.
38683 </para>
38684 </listitem>
38685 <listitem>
38686 <para>
38687 <option>ipv4_prefer</option>: in direct DNS lookups, sort A records before AAAA records.
38688 </para>
38689 </listitem>
38690 </itemizedlist>
38691 <para>
38692 For example:
38693 </para>
38694 <literallayout class="monospaced">
38695 route_list = domain1  host1:host2:host3  randomize bydns;\
38696              domain2  host4:host5
38697 </literallayout>
38698 <para>
38699 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
38700 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
38701 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
38702 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
38703 call.
38704 </para>
38705 <para>
38706 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
38707 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
38708 instead of TRY_AGAIN. That is why the default action is to try a DNS
38709 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
38710 function called.
38711 </para>
38712 <para>
38713 <emphasis role="bold">Compatibility</emphasis>: From Exim 4.85 until fixed for 4.90, there was an
38714 inadvertent constraint that a transport name as an option had to be the last
38715 option specified.
38716 </para>
38717 <para>
38718 If no IP address for a host can be found, what happens is controlled by the
38719 <option>host_find_failed</option> option.
38720 </para>
38721 <para>
38722 <indexterm role="variable">
38723 <primary><varname>$host</varname></primary>
38724 </indexterm>
38725 When an address is routed to a local transport, IP addresses are not looked up.
38726 The host list is passed to the transport in the <varname>$host</varname> variable.
38727 </para>
38728 </section>
38729 <section id="SECID123">
38730 <title>Manualroute examples</title>
38731 <para>
38732 In some of the examples that follow, the presence of the <option>remote_smtp</option>
38733 transport, as defined in the default configuration file, is assumed:
38734 </para>
38735 <itemizedlist>
38736 <listitem>
38737 <para>
38738 <indexterm role="concept">
38739 <primary>smart host</primary>
38740 <secondary>example router</secondary>
38741 </indexterm>
38742 The <command>manualroute</command> router can be used to forward all external mail to a
38743 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
38744 named domain list that contains your local domains, for example:
38745 </para>
38746 <literallayout class="monospaced">
38747 domainlist local_domains = my.domain.example
38748 </literallayout>
38749 <para>
38750 You can arrange for all other domains to be routed to a smart host by making
38751 your first router something like this:
38752 </para>
38753 <literallayout class="monospaced">
38754 smart_route:
38755   driver = manualroute
38756   domains = !+local_domains
38757   transport = remote_smtp
38758   route_list = * smarthost.ref.example
38759 </literallayout>
38760 <para>
38761 This causes all non-local addresses to be sent to the single host
38762 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
38763 they are tried in order
38764 (but you can use <option>hosts_randomize</option> to vary the order each time).
38765 Another way of configuring the same thing is this:
38766 </para>
38767 <literallayout class="monospaced">
38768 smart_route:
38769   driver = manualroute
38770   transport = remote_smtp
38771   route_list = !+local_domains  smarthost.ref.example
38772 </literallayout>
38773 <para>
38774 There is no difference in behaviour between these two routers as they stand.
38775 However, they behave differently if <option>no_more</option> is added to them. In the first
38776 example, the router is skipped if the domain does not match the <option>domains</option>
38777 precondition; the following router is always tried. If the router runs, it
38778 always matches the domain and so can never decline. Therefore, <option>no_more</option>
38779 would have no effect. In the second case, the router is never skipped; it
38780 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
38781 <option>no_more</option> would prevent subsequent routers from running.
38782 </para>
38783 </listitem>
38784 <listitem>
38785 <para>
38786 <indexterm role="concept">
38787 <primary>mail hub example</primary>
38788 </indexterm>
38789 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
38790 records in the DNS and delivers it via its own private routing mechanism. Often
38791 the final destinations are behind a firewall, with the mail hub being the one
38792 machine that can connect to machines both inside and outside the firewall. The
38793 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
38794 to the correct hosts. For a small number of domains, the routing can be inline,
38795 using the <option>route_list</option> option, but for a larger number a file or database
38796 lookup is easier to manage.
38797 </para>
38798 <para>
38799 If the domain names are in fact the names of the machines to which the mail is
38800 to be sent by the mail hub, the configuration can be quite simple. For
38801 example:
38802 </para>
38803 <literallayout class="monospaced">
38804 hub_route:
38805   driver = manualroute
38806   transport = remote_smtp
38807   route_list = *.rhodes.tvs.example  $domain
38808 </literallayout>
38809 <para>
38810 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
38811 whose names are the same as the mail domains. A similar approach can be taken
38812 if the host name can be obtained from the domain name by a string manipulation
38813 that the expansion facilities can handle. Otherwise, a lookup based on the
38814 domain can be used to find the host:
38815 </para>
38816 <literallayout class="monospaced">
38817 through_firewall:
38818   driver = manualroute
38819   transport = remote_smtp
38820   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
38821 </literallayout>
38822 <para>
38823 The result of the lookup must be the name or IP address of the host (or
38824 hosts) to which the address is to be routed. If the lookup fails, the route
38825 data is empty, causing the router to decline. The address then passes to the
38826 next router.
38827 </para>
38828 </listitem>
38829 <listitem>
38830 <para>
38831 <indexterm role="concept">
38832 <primary>batched SMTP output example</primary>
38833 </indexterm>
38834 <indexterm role="concept">
38835 <primary>SMTP</primary>
38836 <secondary>batched outgoing; example</secondary>
38837 </indexterm>
38838 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
38839 SMTP format for onward transportation by some other means. This is one way of
38840 storing mail for a dial-up host when it is not connected. The route list entry
38841 can be as simple as a single domain name in a configuration like this:
38842 </para>
38843 <literallayout class="monospaced">
38844 save_in_file:
38845   driver = manualroute
38846   transport = batchsmtp_appendfile
38847   route_list = saved.domain.example
38848 </literallayout>
38849 <para>
38850 though often a pattern is used to pick up more than one domain. If there are
38851 several domains or groups of domains with different transport requirements,
38852 different transports can be listed in the routing information:
38853 </para>
38854 <literallayout class="monospaced">
38855 save_in_file:
38856   driver = manualroute
38857   route_list = \
38858     *.saved.domain1.example  $domain  batch_appendfile; \
38859     *.saved.domain2.example  \
38860       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
38861       batch_pipe
38862 </literallayout>
38863 <para>
38864 <indexterm role="variable">
38865 <primary><varname>$domain</varname></primary>
38866 </indexterm>
38867 <indexterm role="variable">
38868 <primary><varname>$host</varname></primary>
38869 </indexterm>
38870 The first of these just passes the domain in the <varname>$host</varname> variable, which
38871 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
38872 file lookup to find a value to pass, causing the router to decline to handle
38873 the address if the lookup fails.
38874 </para>
38875 </listitem>
38876 <listitem>
38877 <para>
38878 <indexterm role="concept">
38879 <primary>UUCP</primary>
38880 <secondary>example of router for</secondary>
38881 </indexterm>
38882 Routing mail directly to UUCP software is a specific case of the use of
38883 <command>manualroute</command> in a gateway to another mail environment. This is an example of
38884 one way it can be done:
38885 </para>
38886 <literallayout class="monospaced">
38887 # Transport
38888 uucp:
38889   driver = pipe
38890   user = nobody
38891   command = /usr/local/bin/uux -r - \
38892     ${substr_-5:$host}!rmail ${local_part}
38893   return_fail_output = true
38894
38895 # Router
38896 uucphost:
38897   transport = uucp
38898   driver = manualroute
38899   route_data = \
38900     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
38901 </literallayout>
38902 <para>
38903 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
38904 </para>
38905 <literallayout class="monospaced">
38906 darksite.ethereal.example:           darksite.UUCP
38907 </literallayout>
38908 <para>
38909 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
38910 makes clear the distinction between the domain name
38911 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
38912 </para>
38913 </listitem>
38914 </itemizedlist>
38915 <para>
38916 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
38917 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
38918 </para>
38919 </section>
38920 </chapter>
38921
38922 <chapter id="CHAPdriverlast">
38923 <title>The queryprogram router</title>
38924 <para>
38925 <indexterm role="concept" id="IIDquerou1" class="startofrange">
38926 <primary><command>queryprogram</command> router</primary>
38927 </indexterm>
38928 <indexterm role="concept" id="IIDquerou2" class="startofrange">
38929 <primary>routers</primary>
38930 <secondary><command>queryprogram</command></secondary>
38931 </indexterm>
38932 <indexterm role="concept">
38933 <primary>routing</primary>
38934 <secondary>by external program</secondary>
38935 </indexterm>
38936 The <command>queryprogram</command> router routes an address by running an external command
38937 and acting on its output. This is an expensive way to route, and is intended
38938 mainly for use in lightly-loaded systems, or for performing experiments.
38939 However, if it is possible to use the precondition options (<option>domains</option>,
38940 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
38941 be used in special cases, even on a busy host. There are the following private
38942 options:
38943 <indexterm role="concept">
38944 <primary>options</primary>
38945 <secondary><command>queryprogram</command> router</secondary>
38946 </indexterm>
38947 </para>
38948 <para>
38949 <indexterm role="option">
38950 <primary><option>command</option></primary>
38951 </indexterm>
38952 </para>
38953 <informaltable frame="all">
38954 <tgroup cols="4" colsep="0" rowsep="0">
38955 <colspec colwidth="8*" align="left"/>
38956 <colspec colwidth="6*" align="center"/>
38957 <colspec colwidth="6*" align="center"/>
38958 <colspec colwidth="6*" align="right"/>
38959 <tbody>
38960 <row>
38961 <entry><option>command</option></entry>
38962 <entry>Use: <emphasis>queryprogram</emphasis></entry>
38963 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38964 <entry>Default: <emphasis>unset</emphasis></entry>
38965 </row>
38966 </tbody>
38967 </tgroup>
38968 </informaltable>
38969 <para>
38970 This option must be set. It specifies the command that is to be run. The
38971 command is split up into a command name and arguments, and then each is
38972 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
38973 <xref linkend="CHAPpipetransport"/>).
38974 </para>
38975 <para>
38976 <indexterm role="option">
38977 <primary><option>command_group</option></primary>
38978 </indexterm>
38979 </para>
38980 <informaltable frame="all">
38981 <tgroup cols="4" colsep="0" rowsep="0">
38982 <colspec colwidth="8*" align="left"/>
38983 <colspec colwidth="6*" align="center"/>
38984 <colspec colwidth="6*" align="center"/>
38985 <colspec colwidth="6*" align="right"/>
38986 <tbody>
38987 <row>
38988 <entry><option>command_group</option></entry>
38989 <entry>Use: <emphasis>queryprogram</emphasis></entry>
38990 <entry>Type: <emphasis>string</emphasis></entry>
38991 <entry>Default: <emphasis>unset</emphasis></entry>
38992 </row>
38993 </tbody>
38994 </tgroup>
38995 </informaltable>
38996 <para>
38997 <indexterm role="concept">
38998 <primary>gid (group id)</primary>
38999 <secondary>in <command>queryprogram</command> router</secondary>
39000 </indexterm>
39001 This option specifies a gid to be set when running the command while routing an
39002 address for deliver. It must be set if <option>command_user</option> specifies a numerical
39003 uid. If it begins with a digit, it is interpreted as the numerical value of the
39004 gid. Otherwise it is looked up using <function>getgrnam()</function>.
39005 </para>
39006 <para>
39007 <indexterm role="option">
39008 <primary><option>command_user</option></primary>
39009 </indexterm>
39010 </para>
39011 <informaltable frame="all">
39012 <tgroup cols="4" colsep="0" rowsep="0">
39013 <colspec colwidth="8*" align="left"/>
39014 <colspec colwidth="6*" align="center"/>
39015 <colspec colwidth="6*" align="center"/>
39016 <colspec colwidth="6*" align="right"/>
39017 <tbody>
39018 <row>
39019 <entry><option>command_user</option></entry>
39020 <entry>Use: <emphasis>queryprogram</emphasis></entry>
39021 <entry>Type: <emphasis>string</emphasis></entry>
39022 <entry>Default: <emphasis>unset</emphasis></entry>
39023 </row>
39024 </tbody>
39025 </tgroup>
39026 </informaltable>
39027 <para>
39028 <indexterm role="concept">
39029 <primary>uid (user id)</primary>
39030 <secondary>for <command>queryprogram</command></secondary>
39031 </indexterm>
39032 This option must be set. It specifies the uid which is set when running the
39033 command while routing an address for delivery. If the value begins with a digit,
39034 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
39035 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
39036 not set, a value for the gid also.
39037 </para>
39038 <para>
39039 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
39040 root, which it does during a normal delivery in a conventional configuration.
39041 However, when an address is being verified during message reception, Exim is
39042 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
39043 is called from a non-root process, Exim cannot change uid or gid before running
39044 the command. In this circumstance the command runs under the current uid and
39045 gid.
39046 </para>
39047 <para>
39048 <indexterm role="option">
39049 <primary><option>current_directory</option></primary>
39050 </indexterm>
39051 </para>
39052 <informaltable frame="all">
39053 <tgroup cols="4" colsep="0" rowsep="0">
39054 <colspec colwidth="8*" align="left"/>
39055 <colspec colwidth="6*" align="center"/>
39056 <colspec colwidth="6*" align="center"/>
39057 <colspec colwidth="6*" align="right"/>
39058 <tbody>
39059 <row>
39060 <entry><option>current_directory</option></entry>
39061 <entry>Use: <emphasis>queryprogram</emphasis></entry>
39062 <entry>Type: <emphasis>string</emphasis></entry>
39063 <entry>Default: <emphasis>/</emphasis></entry>
39064 </row>
39065 </tbody>
39066 </tgroup>
39067 </informaltable>
39068 <para>
39069 This option specifies an absolute path which is made the current directory
39070 before running the command.
39071 </para>
39072 <para>
39073 <indexterm role="option">
39074 <primary><option>timeout</option></primary>
39075 </indexterm>
39076 </para>
39077 <informaltable frame="all">
39078 <tgroup cols="4" colsep="0" rowsep="0">
39079 <colspec colwidth="8*" align="left"/>
39080 <colspec colwidth="6*" align="center"/>
39081 <colspec colwidth="6*" align="center"/>
39082 <colspec colwidth="6*" align="right"/>
39083 <tbody>
39084 <row>
39085 <entry><option>timeout</option></entry>
39086 <entry>Use: <emphasis>queryprogram</emphasis></entry>
39087 <entry>Type: <emphasis>time</emphasis></entry>
39088 <entry>Default: <emphasis>1h</emphasis></entry>
39089 </row>
39090 </tbody>
39091 </tgroup>
39092 </informaltable>
39093 <para>
39094 If the command does not complete within the timeout period, its process group
39095 is killed and the message is frozen. A value of zero time specifies no
39096 timeout.
39097 </para>
39098 <para>
39099 The standard output of the command is connected to a pipe, which is read when
39100 the command terminates. It should consist of a single line of output,
39101 containing up to five fields, separated by white space. The maximum length of
39102 the line is 1023 characters. Longer lines are silently truncated. The first
39103 field is one of the following words (case-insensitive):
39104 </para>
39105 <itemizedlist>
39106 <listitem>
39107 <para>
39108 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
39109 below).
39110 </para>
39111 </listitem>
39112 <listitem>
39113 <para>
39114 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
39115 <option>no_more</option> is set.
39116 </para>
39117 </listitem>
39118 <listitem>
39119 <para>
39120 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
39121 subsequent text on the line is an error message. If the router is run as part
39122 of address verification during an incoming SMTP message, the message is
39123 included in the SMTP response.
39124 </para>
39125 </listitem>
39126 <listitem>
39127 <para>
39128 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
39129 subsequent text on the line is an error message which is logged. It is not
39130 included in any SMTP response.
39131 </para>
39132 </listitem>
39133 <listitem>
39134 <para>
39135 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
39136 </para>
39137 </listitem>
39138 <listitem>
39139 <para>
39140 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
39141 <option>pass_router</option>), overriding <option>no_more</option>.
39142 </para>
39143 </listitem>
39144 <listitem>
39145 <para>
39146 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
39147 new addresses, which are routed independently, starting with the first router,
39148 or the router specified by <option>redirect_router</option>, if set.
39149 </para>
39150 </listitem>
39151 </itemizedlist>
39152 <para>
39153 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
39154 number of keyed data values, as follows (split into two lines here, to fit on
39155 the page):
39156 </para>
39157 <literallayout class="monospaced">
39158 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
39159 LOOKUP=byname|bydns DATA=&lt;text&gt;
39160 </literallayout>
39161 <para>
39162 The data items can be given in any order, and all are optional. If no transport
39163 is included, the transport specified by the generic <option>transport</option> option is
39164 used. The list of hosts and the lookup type are needed only if the transport is
39165 an <command>smtp</command> transport that does not itself supply a list of hosts.
39166 </para>
39167 <para>
39168 The format of the list of hosts is the same as for the <command>manualroute</command> router.
39169 As well as host names and IP addresses with optional port numbers, as described
39170 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
39171 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
39172 (see section <xref linkend="SECThostshowused"/>).
39173 </para>
39174 <para>
39175 If the lookup type is not specified, Exim behaves as follows when trying to
39176 find an IP address for each host: First, a DNS lookup is done. If this yields
39177 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
39178 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
39179 result of the lookup is the result of that call.
39180 </para>
39181 <para>
39182 <indexterm role="variable">
39183 <primary><varname>$address_data</varname></primary>
39184 </indexterm>
39185 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
39186 variable. For example, this return line
39187 </para>
39188 <literallayout class="monospaced">
39189 accept hosts=x1.y.example:x2.y.example data="rule1"
39190 </literallayout>
39191 <para>
39192 routes the address to the default transport, passing a list of two hosts. When
39193 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
39194 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
39195 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
39196 </para>
39197 </chapter>
39198
39199 <chapter id="CHAPredirect">
39200 <title>The redirect router</title>
39201 <para>
39202 <indexterm role="concept" id="IIDredrou1" class="startofrange">
39203 <primary><command>redirect</command> router</primary>
39204 </indexterm>
39205 <indexterm role="concept" id="IIDredrou2" class="startofrange">
39206 <primary>routers</primary>
39207 <secondary><command>redirect</command></secondary>
39208 </indexterm>
39209 <indexterm role="concept">
39210 <primary>alias file</primary>
39211 <secondary>in a <command>redirect</command> router</secondary>
39212 </indexterm>
39213 <indexterm role="concept">
39214 <primary>address redirection</primary>
39215 <secondary><command>redirect</command> router</secondary>
39216 </indexterm>
39217 The <command>redirect</command> router handles several kinds of address redirection. Its most
39218 common uses are for resolving local part aliases from a central alias file
39219 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
39220 files, but it has many other potential uses. The incoming address can be
39221 redirected in several different ways:
39222 </para>
39223 <itemizedlist>
39224 <listitem>
39225 <para>
39226 It can be replaced by one or more new addresses which are themselves routed
39227 independently.
39228 </para>
39229 </listitem>
39230 <listitem>
39231 <para>
39232 It can be routed to be delivered to a given file or directory.
39233 </para>
39234 </listitem>
39235 <listitem>
39236 <para>
39237 It can be routed to be delivered to a specified pipe command.
39238 </para>
39239 </listitem>
39240 <listitem>
39241 <para>
39242 It can cause an automatic reply to be generated.
39243 </para>
39244 </listitem>
39245 <listitem>
39246 <para>
39247 It can be forced to fail, optionally with a custom error message.
39248 </para>
39249 </listitem>
39250 <listitem>
39251 <para>
39252 It can be temporarily deferred, optionally with a custom message.
39253 </para>
39254 </listitem>
39255 <listitem>
39256 <para>
39257 It can be discarded.
39258 </para>
39259 </listitem>
39260 </itemizedlist>
39261 <para>
39262 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
39263 However, there are some private options which define transports for delivery to
39264 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
39265 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
39266 </para>
39267 <para>
39268 If success DSNs have been requested
39269 <indexterm role="concept">
39270 <primary>DSN</primary>
39271 <secondary>success</secondary>
39272 </indexterm>
39273 <indexterm role="concept">
39274 <primary>Delivery Status Notification</primary>
39275 <secondary>success</secondary>
39276 </indexterm>
39277 redirection triggers one and the DSN options are not passed any further.
39278 </para>
39279 <section id="SECID124">
39280 <title>Redirection data</title>
39281 <para>
39282 The router operates by interpreting a text string which it obtains either by
39283 expanding the contents of the <option>data</option> option, or by reading the entire
39284 contents of a file whose name is given in the <option>file</option> option. These two
39285 options are mutually exclusive. The first is commonly used for handling system
39286 aliases, in a configuration like this:
39287 </para>
39288 <literallayout class="monospaced">
39289 system_aliases:
39290   driver = redirect
39291   data = ${lookup{$local_part}lsearch{/etc/aliases}}
39292 </literallayout>
39293 <para>
39294 If the lookup fails, the expanded string in this example is empty. When the
39295 expansion of <option>data</option> results in an empty string, the router declines. A forced
39296 expansion failure also causes the router to decline; other expansion failures
39297 cause delivery to be deferred.
39298 </para>
39299 <para>
39300 A configuration using <option>file</option> is commonly used for handling users&#x2019;
39301 <filename>.forward</filename> files, like this:
39302 </para>
39303 <literallayout class="monospaced">
39304 userforward:
39305   driver = redirect
39306   check_local_user
39307   file = $home/.forward
39308   no_verify
39309 </literallayout>
39310 <para>
39311 If the file does not exist, or causes no action to be taken (for example, it is
39312 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
39313 is not the case when the file contains syntactically valid items that happen to
39314 yield empty addresses, for example, items containing only RFC 2822 address
39315 comments.
39316 </para>
39317 <para revisionflag="changed">
39318 <indexterm role="concept">
39319 <primary>tainted data</primary>
39320 <secondary>in filenames</secondary>
39321 </indexterm>
39322 <indexterm role="concept">
39323 <primary>redirect</primary>
39324 <secondary>tainted data</secondary>
39325 </indexterm>
39326 Tainted data may not be used for a filename.
39327 </para>
39328 <para revisionflag="changed">
39329 <emphasis role="bold">Warning</emphasis>: It is unwise to use <varname>$local_part</varname> or <varname>$domain</varname>
39330 directly for redirection,
39331 as they are provided by a potential attacker.
39332 In the examples above, <varname>$local_part</varname> is used for looking up data held locally
39333 on the system, and not used directly (the second example derives <varname>$home</varname> via
39334 the passsword file or database, using <varname>$local_part</varname>).
39335 </para>
39336 </section>
39337 <section id="SECID125">
39338 <title>Forward files and address verification</title>
39339 <para>
39340 <indexterm role="concept">
39341 <primary>address redirection</primary>
39342 <secondary>while verifying</secondary>
39343 </indexterm>
39344 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
39345 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
39346 </para>
39347 <itemizedlist>
39348 <listitem>
39349 <para>
39350 When Exim is receiving an incoming SMTP message from a remote host, it is
39351 running under the Exim uid, not as root. Exim is unable to change uid to read
39352 the file as the user, and it may not be able to read it as the Exim user. So in
39353 practice the router may not be able to operate.
39354 </para>
39355 </listitem>
39356 <listitem>
39357 <para>
39358 However, even when the router can operate, the existence of a <filename>.forward</filename> file
39359 is unimportant when verifying an address. What should be checked is whether the
39360 local part is a valid user name or not. Cutting out the redirection processing
39361 saves some resources.
39362 </para>
39363 </listitem>
39364 </itemizedlist>
39365 </section>
39366 <section id="SECID126">
39367 <title>Interpreting redirection data</title>
39368 <para>
39369 <indexterm role="concept">
39370 <primary>Sieve filter</primary>
39371 <secondary>specifying in redirection data</secondary>
39372 </indexterm>
39373 <indexterm role="concept">
39374 <primary>filter</primary>
39375 <secondary>specifying in redirection data</secondary>
39376 </indexterm>
39377 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
39378 can be interpreted in two different ways:
39379 </para>
39380 <itemizedlist>
39381 <listitem>
39382 <para>
39383 If the <option>allow_filter</option> option is set true, and the data begins with the text
39384 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
39385 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
39386 respectively. Details of the syntax and semantics of filter files are described
39387 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
39388 document is intended for use by end users.
39389 </para>
39390 </listitem>
39391 <listitem>
39392 <para>
39393 Otherwise, the data must be a comma-separated list of redirection items, as
39394 described in the next section.
39395 </para>
39396 </listitem>
39397 </itemizedlist>
39398 <para>
39399 When a message is redirected to a file (a <quote>mail folder</quote>), the filename given
39400 in a non-filter redirection list must always be an absolute path. A filter may
39401 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
39402 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
39403 for the <command>appendfile</command> transport.
39404 </para>
39405 </section>
39406 <section id="SECTitenonfilred">
39407 <title>Items in a non-filter redirection list</title>
39408 <para>
39409 <indexterm role="concept">
39410 <primary>address redirection</primary>
39411 <secondary>non-filter list items</secondary>
39412 </indexterm>
39413 When the redirection data is not an Exim or Sieve filter, for example, if it
39414 comes from a conventional alias or forward file, it consists of a list of
39415 addresses, filenames, pipe commands, or certain special items (see section
39416 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
39417 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
39418 depending on their default values. The items in the list are separated by
39419 commas or newlines.
39420 If a comma is required in an item, the entire item must be enclosed in double
39421 quotes.
39422 </para>
39423 <para>
39424 Lines starting with a # character are comments, and are ignored, and # may
39425 also appear following a comma, in which case everything between the # and the
39426 next newline character is ignored.
39427 </para>
39428 <para>
39429 If an item is entirely enclosed in double quotes, these are removed. Otherwise
39430 double quotes are retained because some forms of mail address require their use
39431 (but never to enclose the entire address). In the following description,
39432 <quote>item</quote> refers to what remains after any surrounding double quotes have been
39433 removed.
39434 </para>
39435 <para>
39436 <indexterm role="variable">
39437 <primary><varname>$local_part</varname></primary>
39438 </indexterm>
39439 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
39440 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
39441 of the <option>quote_local_part</option> expansion operator, in case the local part contains
39442 special characters. For example, to redirect all mail for the domain
39443 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
39444 setting:
39445 </para>
39446 <literallayout class="monospaced">
39447 data = ${quote_local_part:$local_part}@newdomain.example
39448 </literallayout>
39449 </section>
39450 <section id="SECTredlocmai">
39451 <title>Redirecting to a local mailbox</title>
39452 <para>
39453 <indexterm role="concept">
39454 <primary>routing</primary>
39455 <secondary>loops in</secondary>
39456 </indexterm>
39457 <indexterm role="concept">
39458 <primary>loop</primary>
39459 <secondary>while routing, avoidance of</secondary>
39460 </indexterm>
39461 <indexterm role="concept">
39462 <primary>address redirection</primary>
39463 <secondary>to local mailbox</secondary>
39464 </indexterm>
39465 A redirection item may safely be the same as the address currently under
39466 consideration. This does not cause a routing loop, because a router is
39467 automatically skipped if any ancestor of the address that is being processed
39468 is the same as the current address and was processed by the current router.
39469 Such an address is therefore passed to the following routers, so it is handled
39470 as if there were no redirection. When making this loop-avoidance test, the
39471 complete local part, including any prefix or suffix, is used.
39472 </para>
39473 <para>
39474 <indexterm role="concept">
39475 <primary>address redirection</primary>
39476 <secondary>local part without domain</secondary>
39477 </indexterm>
39478 Specifying the same local part without a domain is a common usage in personal
39479 filter files when the user wants to have messages delivered to the local
39480 mailbox and also forwarded elsewhere. For example, the user whose login is
39481 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
39482 </para>
39483 <literallayout class="monospaced">
39484 cleo, cleopatra@egypt.example
39485 </literallayout>
39486 <para>
39487 <indexterm role="concept">
39488 <primary>backslash in alias file</primary>
39489 </indexterm>
39490 <indexterm role="concept">
39491 <primary>alias file</primary>
39492 <secondary>backslash in</secondary>
39493 </indexterm>
39494 For compatibility with other MTAs, such unqualified local parts may be
39495 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
39496 it does make a difference if more than one domain is being handled
39497 synonymously.
39498 </para>
39499 <para>
39500 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
39501 2822 address that does not include a domain, the item is qualified using the
39502 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
39503 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
39504 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
39505 </para>
39506 <para>
39507 Care must be taken if there are alias names for local users.
39508 Consider an MTA handling a single local domain where the system alias file
39509 contains:
39510 </para>
39511 <literallayout class="monospaced">
39512 Sam.Reman: spqr
39513 </literallayout>
39514 <para>
39515 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
39516 messages in the local mailbox, and also forward copies elsewhere. He creates
39517 this forward file:
39518 </para>
39519 <literallayout class="monospaced">
39520 Sam.Reman, spqr@reme.elsewhere.example
39521 </literallayout>
39522 <para>
39523 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
39524 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
39525 second time round, because it has previously routed it,
39526 and the following routers presumably cannot handle the alias. The forward file
39527 should really contain
39528 </para>
39529 <literallayout class="monospaced">
39530 spqr, spqr@reme.elsewhere.example
39531 </literallayout>
39532 <para>
39533 but because this is such a common error, the <option>check_ancestor</option> option (see
39534 below) exists to provide a way to get round it. This is normally set on a
39535 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
39536 </para>
39537 </section>
39538 <section id="SECTspecitredli">
39539 <title>Special items in redirection lists</title>
39540 <para>
39541 In addition to addresses, the following types of item may appear in redirection
39542 lists (that is, in non-filter redirection data):
39543 </para>
39544 <itemizedlist>
39545 <listitem>
39546 <para>
39547 <indexterm role="concept">
39548 <primary>pipe</primary>
39549 <secondary>in redirection list</secondary>
39550 </indexterm>
39551 <indexterm role="concept">
39552 <primary>address redirection</primary>
39553 <secondary>to pipe</secondary>
39554 </indexterm>
39555 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
39556 as a valid RFC 2822 address that includes a domain. A transport for running the
39557 command must be specified by the <option>pipe_transport</option> option.
39558 Normally, either the router or the transport specifies a user and a group under
39559 which to run the delivery. The default is to use the Exim user and group.
39560 </para>
39561 <para>
39562 Single or double quotes can be used for enclosing the individual arguments of
39563 the pipe command; no interpretation of escapes is done for single quotes. If
39564 the command contains a comma character, it is necessary to put the whole item
39565 in double quotes, for example:
39566 </para>
39567 <literallayout class="monospaced">
39568 "|/some/command ready,steady,go"
39569 </literallayout>
39570 <para>
39571 since items in redirection lists are terminated by commas. Do not, however,
39572 quote just the command. An item such as
39573 </para>
39574 <literallayout class="monospaced">
39575 |"/some/command ready,steady,go"
39576 </literallayout>
39577 <para>
39578 is interpreted as a pipe with a rather strange command name, and no arguments.
39579 </para>
39580 <para>
39581 Note that the above example assumes that the text comes from a lookup source
39582 of some sort, so that the quotes are part of the data.  If composing a
39583 redirect router with a <option>data</option> option directly specifying this command, the
39584 quotes will be used by the configuration parser to define the extent of one
39585 string, but will not be passed down into the redirect router itself.  There
39586 are two main approaches to get around this: escape quotes to be part of the
39587 data itself, or avoid using this mechanism and instead create a custom
39588 transport with the <option>command</option> option set and reference that transport from
39589 an <option>accept</option> router.
39590 </para>
39591 </listitem>
39592 <listitem>
39593 <para>
39594 <indexterm role="concept">
39595 <primary>file</primary>
39596 <secondary>in redirection list</secondary>
39597 </indexterm>
39598 <indexterm role="concept">
39599 <primary>address redirection</primary>
39600 <secondary>to file</secondary>
39601 </indexterm>
39602 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
39603 parse as a valid RFC 2822 address that includes a domain. For example,
39604 </para>
39605 <literallayout class="monospaced">
39606 /home/world/minbari
39607 </literallayout>
39608 <para>
39609 is treated as a filename, but
39610 </para>
39611 <literallayout class="monospaced">
39612 /s=molari/o=babylon/@x400gate.way
39613 </literallayout>
39614 <para>
39615 is treated as an address. For a filename, a transport must be specified using
39616 the <option>file_transport</option> option. However, if the generated path name ends with a
39617 forward slash character, it is interpreted as a directory name rather than a
39618 filename, and <option>directory_transport</option> is used instead.
39619 </para>
39620 <para>
39621 Normally, either the router or the transport specifies a user and a group under
39622 which to run the delivery. The default is to use the Exim user and group.
39623 </para>
39624 <para>
39625 <indexterm role="concept">
39626 <primary><filename>/dev/null</filename></primary>
39627 </indexterm>
39628 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
39629 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
39630 instead of a transport name. In this case the user and group are not used.
39631 </para>
39632 </listitem>
39633 <listitem>
39634 <para>
39635 <indexterm role="concept">
39636 <primary>included address list</primary>
39637 </indexterm>
39638 <indexterm role="concept">
39639 <primary>address redirection</primary>
39640 <secondary>included external list</secondary>
39641 </indexterm>
39642 If an item is of the form
39643 </para>
39644 <literallayout class="monospaced">
39645 :include:&lt;path name&gt;
39646 </literallayout>
39647 <para>
39648 a list of further items is taken from the given file and included at that
39649 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
39650 out-of-line addition to the list. The items in the included list are separated
39651 by commas or newlines and are not subject to expansion. If this is the first
39652 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
39653 the alias name. This example is incorrect:
39654 </para>
39655 <literallayout class="monospaced">
39656 list1    :include:/opt/lists/list1
39657 </literallayout>
39658 <para>
39659 It must be given as
39660 </para>
39661 <literallayout class="monospaced">
39662 list1:   :include:/opt/lists/list1
39663 </literallayout>
39664 <para revisionflag="changed">
39665 <indexterm role="concept">
39666 <primary>tainted data</primary>
39667 <secondary>in filenames</secondary>
39668 </indexterm>
39669 <indexterm role="concept">
39670 <primary>redirect</primary>
39671 <secondary>tainted data</secondary>
39672 </indexterm>
39673 Tainted data may not be used for a filename.
39674 </para>
39675 </listitem>
39676 <listitem>
39677 <para>
39678 <indexterm role="concept">
39679 <primary>address redirection</primary>
39680 <secondary>to black hole</secondary>
39681 </indexterm>
39682 <indexterm role="concept">
39683 <primary>delivery</primary>
39684 <secondary>discard</secondary>
39685 </indexterm>
39686 <indexterm role="concept">
39687 <primary>delivery</primary>
39688 <secondary>blackhole</secondary>
39689 </indexterm>
39690 <indexterm role="concept">
39691 <primary>black hole</primary>
39692 </indexterm>
39693 <indexterm role="concept">
39694 <primary>abandoning mail</primary>
39695 </indexterm>
39696 Sometimes you want to throw away mail to a particular local part.  Making the
39697 <option>data</option> option expand to an empty string does not work, because that causes
39698 the router to decline. Instead, the alias item
39699 </para>
39700 <literallayout class="monospaced">
39701 :blackhole:
39702 </literallayout>
39703 <para>
39704 can be used. It does what its name implies. No delivery is
39705 done, and no error message is generated. This has the same effect as specifying
39706 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
39707 </para>
39708 <para>
39709 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
39710 delivery is done for the original local part, even if other redirection items
39711 are present. If you are generating a multi-item list (for example, by reading a
39712 database) and need the ability to provide a no-op item, you must use
39713 <filename>/dev/null</filename>.
39714 </para>
39715 </listitem>
39716 <listitem>
39717 <para>
39718 <indexterm role="concept">
39719 <primary>delivery</primary>
39720 <secondary>forcing failure</secondary>
39721 </indexterm>
39722 <indexterm role="concept">
39723 <primary>delivery</primary>
39724 <secondary>forcing deferral</secondary>
39725 </indexterm>
39726 <indexterm role="concept">
39727 <primary>failing delivery</primary>
39728 <secondary>forcing</secondary>
39729 </indexterm>
39730 <indexterm role="concept">
39731 <primary>deferred delivery, forcing</primary>
39732 </indexterm>
39733 <indexterm role="concept">
39734 <primary>customizing</primary>
39735 <secondary>failure message</secondary>
39736 </indexterm>
39737 An attempt to deliver a particular address can be deferred or forced to fail by
39738 redirection items of the form
39739 </para>
39740 <literallayout class="monospaced">
39741 :defer:
39742 :fail:
39743 </literallayout>
39744 <para>
39745 respectively. When a redirection list contains such an item, it applies
39746 to the entire redirection; any other items in the list are ignored. Any
39747 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
39748 associated with the failure. For example, an alias file might contain:
39749 </para>
39750 <literallayout class="monospaced">
39751 X.Employee:  :fail: Gone away, no forwarding address
39752 </literallayout>
39753 <para>
39754 In the case of an address that is being verified from an ACL or as the subject
39755 of a
39756 <indexterm role="concept">
39757 <primary>VRFY</primary>
39758 <secondary>error text, display of</secondary>
39759 </indexterm>
39760 VRFY command, the text is included in the SMTP error response by
39761 default.
39762 <indexterm role="concept">
39763 <primary>EXPN</primary>
39764 <secondary>error text, display of</secondary>
39765 </indexterm>
39766 The text is not included in the response to an EXPN command. In non-SMTP cases
39767 the text is included in the error message that Exim generates.
39768 </para>
39769 <para>
39770 <indexterm role="concept">
39771 <primary>SMTP</primary>
39772 <secondary>error codes</secondary>
39773 </indexterm>
39774 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
39775 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
39776 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
39777 followed by a space, and the very first digit is the same as the default error
39778 code, the code from the message is used instead. If the very first digit is
39779 incorrect, a panic error is logged, and the default code is used. You can
39780 suppress the use of the supplied code in a redirect router by setting the
39781 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
39782 ignored.
39783 </para>
39784 <para>
39785 <indexterm role="variable">
39786 <primary><varname>$acl_verify_message</varname></primary>
39787 </indexterm>
39788 In an ACL, an explicitly provided message overrides the default, but the
39789 default message is available in the variable <varname>$acl_verify_message</varname> and can
39790 therefore be included in a custom message if this is desired.
39791 </para>
39792 <para>
39793 Normally the error text is the rest of the redirection list &ndash; a comma does
39794 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
39795 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
39796 as part of the continuation process, but they may exist in other kinds of
39797 lookup and in <emphasis>:include:</emphasis> files.
39798 </para>
39799 <para>
39800 During routing for message delivery (as opposed to verification), a redirection
39801 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
39802 whereas <emphasis>:defer:</emphasis> causes the message to remain in the queue so that a
39803 subsequent delivery attempt can happen at a later time. If an address is
39804 deferred for too long, it will ultimately fail, because the normal retry
39805 rules still apply.
39806 </para>
39807 </listitem>
39808 <listitem>
39809 <para>
39810 <indexterm role="concept">
39811 <primary>alias file</primary>
39812 <secondary>exception to default</secondary>
39813 </indexterm>
39814 Sometimes it is useful to use a single-key search type with a default (see
39815 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
39816 for exceptions to the default. These can be handled by aliasing them to
39817 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
39818 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
39819 results in an empty redirection list has the same effect.
39820 </para>
39821 </listitem>
39822 </itemizedlist>
39823 </section>
39824 <section id="SECTdupaddr">
39825 <title>Duplicate addresses</title>
39826 <para>
39827 <indexterm role="concept">
39828 <primary>duplicate addresses</primary>
39829 </indexterm>
39830 <indexterm role="concept">
39831 <primary>address duplicate, discarding</primary>
39832 </indexterm>
39833 <indexterm role="concept">
39834 <primary>pipe</primary>
39835 <secondary>duplicated</secondary>
39836 </indexterm>
39837 Exim removes duplicate addresses from the list to which it is delivering, so as
39838 to deliver just one copy to each address. This does not apply to deliveries
39839 routed to pipes by different immediate parent addresses, but an indirect
39840 aliasing scheme of the type
39841 </para>
39842 <literallayout class="monospaced">
39843 pipe:       |/some/command $local_part
39844 localpart1: pipe
39845 localpart2: pipe
39846 </literallayout>
39847 <para>
39848 does not work with a message that is addressed to both local parts, because
39849 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
39850 discarded as being the same as a previously handled address. However, a scheme
39851 such as
39852 </para>
39853 <literallayout class="monospaced">
39854 localpart1: |/some/command $local_part
39855 localpart2: |/some/command $local_part
39856 </literallayout>
39857 <para>
39858 does result in two different pipe deliveries, because the immediate parents of
39859 the pipes are distinct.
39860 </para>
39861 </section>
39862 <section id="SECID128">
39863 <title>Repeated redirection expansion</title>
39864 <para>
39865 <indexterm role="concept">
39866 <primary>repeated redirection expansion</primary>
39867 </indexterm>
39868 <indexterm role="concept">
39869 <primary>address redirection</primary>
39870 <secondary>repeated for each delivery attempt</secondary>
39871 </indexterm>
39872 When a message cannot be delivered to all of its recipients immediately,
39873 leading to two or more delivery attempts, redirection expansion is carried out
39874 afresh each time for those addresses whose children were not all previously
39875 delivered. If redirection is being used as a mailing list, this can lead to new
39876 members of the list receiving copies of old messages. The <option>one_time</option> option
39877 can be used to avoid this.
39878 </para>
39879 </section>
39880 <section id="SECID129">
39881 <title>Errors in redirection lists</title>
39882 <para>
39883 <indexterm role="concept">
39884 <primary>address redirection</primary>
39885 <secondary>errors</secondary>
39886 </indexterm>
39887 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
39888 error is skipped, and an entry is written to the main log. This may be useful
39889 for mailing lists that are automatically managed. Otherwise, if an error is
39890 detected while generating the list of new addresses, the original address is
39891 deferred. See also <option>syntax_errors_to</option>.
39892 </para>
39893 </section>
39894 <section id="SECID130">
39895 <title>Private options for the redirect router</title>
39896 <para>
39897 <indexterm role="concept">
39898 <primary>options</primary>
39899 <secondary><command>redirect</command> router</secondary>
39900 </indexterm>
39901 The private options for the <command>redirect</command> router are as follows:
39902 </para>
39903 <para>
39904 <indexterm role="option">
39905 <primary><option>allow_defer</option></primary>
39906 </indexterm>
39907 </para>
39908 <informaltable frame="all">
39909 <tgroup cols="4" colsep="0" rowsep="0">
39910 <colspec colwidth="8*" align="left"/>
39911 <colspec colwidth="6*" align="center"/>
39912 <colspec colwidth="6*" align="center"/>
39913 <colspec colwidth="6*" align="right"/>
39914 <tbody>
39915 <row>
39916 <entry><option>allow_defer</option></entry>
39917 <entry>Use: <emphasis>redirect</emphasis></entry>
39918 <entry>Type: <emphasis>boolean</emphasis></entry>
39919 <entry>Default: <emphasis>false</emphasis></entry>
39920 </row>
39921 </tbody>
39922 </tgroup>
39923 </informaltable>
39924 <para>
39925 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
39926 data, or the <option>defer</option> command in an Exim filter file.
39927 </para>
39928 <para>
39929 <indexterm role="option">
39930 <primary><option>allow_fail</option></primary>
39931 </indexterm>
39932 </para>
39933 <informaltable frame="all">
39934 <tgroup cols="4" colsep="0" rowsep="0">
39935 <colspec colwidth="8*" align="left"/>
39936 <colspec colwidth="6*" align="center"/>
39937 <colspec colwidth="6*" align="center"/>
39938 <colspec colwidth="6*" align="right"/>
39939 <tbody>
39940 <row>
39941 <entry><option>allow_fail</option></entry>
39942 <entry>Use: <emphasis>redirect</emphasis></entry>
39943 <entry>Type: <emphasis>boolean</emphasis></entry>
39944 <entry>Default: <emphasis>false</emphasis></entry>
39945 </row>
39946 </tbody>
39947 </tgroup>
39948 </informaltable>
39949 <para>
39950 <indexterm role="concept">
39951 <primary>failing delivery</primary>
39952 <secondary>from filter</secondary>
39953 </indexterm>
39954 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
39955 and the <option>fail</option> command may be used in an Exim filter file.
39956 </para>
39957 <para>
39958 <indexterm role="option">
39959 <primary><option>allow_filter</option></primary>
39960 </indexterm>
39961 </para>
39962 <informaltable frame="all">
39963 <tgroup cols="4" colsep="0" rowsep="0">
39964 <colspec colwidth="8*" align="left"/>
39965 <colspec colwidth="6*" align="center"/>
39966 <colspec colwidth="6*" align="center"/>
39967 <colspec colwidth="6*" align="right"/>
39968 <tbody>
39969 <row>
39970 <entry><option>allow_filter</option></entry>
39971 <entry>Use: <emphasis>redirect</emphasis></entry>
39972 <entry>Type: <emphasis>boolean</emphasis></entry>
39973 <entry>Default: <emphasis>false</emphasis></entry>
39974 </row>
39975 </tbody>
39976 </tgroup>
39977 </informaltable>
39978 <para>
39979 <indexterm role="concept">
39980 <primary>filter</primary>
39981 <secondary>enabling use of</secondary>
39982 </indexterm>
39983 <indexterm role="concept">
39984 <primary>Sieve filter</primary>
39985 <secondary>enabling use of</secondary>
39986 </indexterm>
39987 Setting this option allows Exim to interpret redirection data that starts with
39988 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
39989 are some features of Exim filter files that some administrators may wish to
39990 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
39991 </para>
39992 <para>
39993 It is also possible to lock out Exim filters or Sieve filters while allowing
39994 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
39995 </para>
39996 <para>
39997 The filter is run using the uid and gid set by the generic <option>user</option> and
39998 <option>group</option> options. These take their defaults from the password data if
39999 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
40000 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
40001 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
40002 </para>
40003 <para>
40004 <indexterm role="option">
40005 <primary><option>allow_freeze</option></primary>
40006 </indexterm>
40007 </para>
40008 <informaltable frame="all">
40009 <tgroup cols="4" colsep="0" rowsep="0">
40010 <colspec colwidth="8*" align="left"/>
40011 <colspec colwidth="6*" align="center"/>
40012 <colspec colwidth="6*" align="center"/>
40013 <colspec colwidth="6*" align="right"/>
40014 <tbody>
40015 <row>
40016 <entry><option>allow_freeze</option></entry>
40017 <entry>Use: <emphasis>redirect</emphasis></entry>
40018 <entry>Type: <emphasis>boolean</emphasis></entry>
40019 <entry>Default: <emphasis>false</emphasis></entry>
40020 </row>
40021 </tbody>
40022 </tgroup>
40023 </informaltable>
40024 <para>
40025 <indexterm role="concept">
40026 <primary>freezing messages</primary>
40027 <secondary>allowing in filter</secondary>
40028 </indexterm>
40029 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
40030 This command is more normally encountered in system filters, and is disabled by
40031 default for redirection filters because it isn&#x2019;t something you usually want to
40032 let ordinary users do.
40033 </para>
40034 <para>
40035 <indexterm role="option">
40036 <primary><option>check_ancestor</option></primary>
40037 </indexterm>
40038 </para>
40039 <informaltable frame="all">
40040 <tgroup cols="4" colsep="0" rowsep="0">
40041 <colspec colwidth="8*" align="left"/>
40042 <colspec colwidth="6*" align="center"/>
40043 <colspec colwidth="6*" align="center"/>
40044 <colspec colwidth="6*" align="right"/>
40045 <tbody>
40046 <row>
40047 <entry><option>check_ancestor</option></entry>
40048 <entry>Use: <emphasis>redirect</emphasis></entry>
40049 <entry>Type: <emphasis>boolean</emphasis></entry>
40050 <entry>Default: <emphasis>false</emphasis></entry>
40051 </row>
40052 </tbody>
40053 </tgroup>
40054 </informaltable>
40055 <para>
40056 This option is concerned with handling generated addresses that are the same
40057 as some address in the list of redirection ancestors of the current address.
40058 Although it is turned off by default in the code, it is set in the default
40059 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
40060 for this use of the <command>redirect</command> router.
40061 </para>
40062 <para>
40063 When <option>check_ancestor</option> is set, if a generated address (including the domain)
40064 is the same as any ancestor of the current address, it is replaced by a copy of
40065 the current address. This helps in the case where local part A is aliased to B,
40066 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
40067 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
40068 <filename>&nbsp;jb/.forward</filename> contains:
40069 </para>
40070 <literallayout class="monospaced">
40071 \Joe.Bloggs, &lt;other item(s)&gt;
40072 </literallayout>
40073 <para>
40074 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
40075 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
40076 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
40077 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
40078 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
40079 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
40080 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
40081 original address. See also the <option>repeat_use</option> option below.
40082 </para>
40083 <para>
40084 <indexterm role="option">
40085 <primary><option>check_group</option></primary>
40086 </indexterm>
40087 </para>
40088 <informaltable frame="all">
40089 <tgroup cols="4" colsep="0" rowsep="0">
40090 <colspec colwidth="8*" align="left"/>
40091 <colspec colwidth="6*" align="center"/>
40092 <colspec colwidth="6*" align="center"/>
40093 <colspec colwidth="6*" align="right"/>
40094 <tbody>
40095 <row>
40096 <entry><option>check_group</option></entry>
40097 <entry>Use: <emphasis>redirect</emphasis></entry>
40098 <entry>Type: <emphasis>boolean</emphasis></entry>
40099 <entry>Default: <emphasis>see below</emphasis></entry>
40100 </row>
40101 </tbody>
40102 </tgroup>
40103 </informaltable>
40104 <para>
40105 When the <option>file</option> option is used, the group owner of the file is checked only
40106 when this option is set. The permitted groups are those listed in the
40107 <option>owngroups</option> option, together with the user&#x2019;s default group if
40108 <option>check_local_user</option> is set. If the file has the wrong group, routing is
40109 deferred. The default setting for this option is true if <option>check_local_user</option>
40110 is set and the <option>modemask</option> option permits the group write bit, or if the
40111 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
40112 </para>
40113 <para>
40114 <indexterm role="option">
40115 <primary><option>check_owner</option></primary>
40116 </indexterm>
40117 </para>
40118 <informaltable frame="all">
40119 <tgroup cols="4" colsep="0" rowsep="0">
40120 <colspec colwidth="8*" align="left"/>
40121 <colspec colwidth="6*" align="center"/>
40122 <colspec colwidth="6*" align="center"/>
40123 <colspec colwidth="6*" align="right"/>
40124 <tbody>
40125 <row>
40126 <entry><option>check_owner</option></entry>
40127 <entry>Use: <emphasis>redirect</emphasis></entry>
40128 <entry>Type: <emphasis>boolean</emphasis></entry>
40129 <entry>Default: <emphasis>see below</emphasis></entry>
40130 </row>
40131 </tbody>
40132 </tgroup>
40133 </informaltable>
40134 <para>
40135 When the <option>file</option> option is used, the owner of the file is checked only when
40136 this option is set. If <option>check_local_user</option> is set, the local user is
40137 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
40138 option. The default value for this option is true if <option>check_local_user</option> or
40139 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
40140 </para>
40141 <para>
40142 <indexterm role="option">
40143 <primary><option>data</option></primary>
40144 </indexterm>
40145 </para>
40146 <informaltable frame="all">
40147 <tgroup cols="4" colsep="0" rowsep="0">
40148 <colspec colwidth="8*" align="left"/>
40149 <colspec colwidth="6*" align="center"/>
40150 <colspec colwidth="6*" align="center"/>
40151 <colspec colwidth="6*" align="right"/>
40152 <tbody>
40153 <row>
40154 <entry><option>data</option></entry>
40155 <entry>Use: <emphasis>redirect</emphasis></entry>
40156 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40157 <entry>Default: <emphasis>unset</emphasis></entry>
40158 </row>
40159 </tbody>
40160 </tgroup>
40161 </informaltable>
40162 <para>
40163 This option is mutually exclusive with <option>file</option>. One or other of them must be
40164 set, but not both. The contents of <option>data</option> are expanded, and then used as the
40165 list of forwarding items, or as a set of filtering instructions. If the
40166 expansion is forced to fail, or the result is an empty string or a string that
40167 has no effect (consists entirely of comments), the router declines.
40168 </para>
40169 <para>
40170 When filtering instructions are used, the string must begin with <quote>#Exim
40171 filter</quote>, and all comments in the string, including this initial one, must be
40172 terminated with newline characters. For example:
40173 </para>
40174 <literallayout class="monospaced">
40175 data = #Exim filter\n\
40176        if $h_to: contains Exim then save $home/mail/exim endif
40177 </literallayout>
40178 <para>
40179 If you are reading the data from a database where newlines cannot be included,
40180 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
40181 choice into a newline.
40182 </para>
40183 <para>
40184 <indexterm role="option">
40185 <primary><option>directory_transport</option></primary>
40186 </indexterm>
40187 </para>
40188 <informaltable frame="all">
40189 <tgroup cols="4" colsep="0" rowsep="0">
40190 <colspec colwidth="8*" align="left"/>
40191 <colspec colwidth="6*" align="center"/>
40192 <colspec colwidth="6*" align="center"/>
40193 <colspec colwidth="6*" align="right"/>
40194 <tbody>
40195 <row>
40196 <entry><option>directory_transport</option></entry>
40197 <entry>Use: <emphasis>redirect</emphasis></entry>
40198 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40199 <entry>Default: <emphasis>unset</emphasis></entry>
40200 </row>
40201 </tbody>
40202 </tgroup>
40203 </informaltable>
40204 <para>
40205 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
40206 ending with a slash is specified as a new <quote>address</quote>. The transport used is
40207 specified by this option, which, after expansion, must be the name of a
40208 configured transport. This should normally be an <command>appendfile</command> transport.
40209 </para>
40210 <para>
40211 <indexterm role="option">
40212 <primary><option>file</option></primary>
40213 </indexterm>
40214 </para>
40215 <informaltable frame="all">
40216 <tgroup cols="4" colsep="0" rowsep="0">
40217 <colspec colwidth="8*" align="left"/>
40218 <colspec colwidth="6*" align="center"/>
40219 <colspec colwidth="6*" align="center"/>
40220 <colspec colwidth="6*" align="right"/>
40221 <tbody>
40222 <row>
40223 <entry><option>file</option></entry>
40224 <entry>Use: <emphasis>redirect</emphasis></entry>
40225 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40226 <entry>Default: <emphasis>unset</emphasis></entry>
40227 </row>
40228 </tbody>
40229 </tgroup>
40230 </informaltable>
40231 <para>
40232 This option specifies the name of a file that contains the redirection data. It
40233 is mutually exclusive with the <option>data</option> option. The string is expanded before
40234 use; if the expansion is forced to fail, the router declines. Other expansion
40235 failures cause delivery to be deferred. The result of a successful expansion
40236 must be an absolute path. The entire file is read and used as the redirection
40237 data. If the data is an empty string or a string that has no effect (consists
40238 entirely of comments), the router declines.
40239 </para>
40240 <para>
40241 <indexterm role="concept">
40242 <primary>NFS</primary>
40243 <secondary>checking for file existence</secondary>
40244 </indexterm>
40245 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
40246 runs a check on the containing directory,
40247 unless <option>ignore_enotdir</option> is true (see below).
40248 If the directory does not appear to exist, delivery is deferred. This can
40249 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
40250 is a mount problem. If the containing directory does exist, but the file does
40251 not, the router declines.
40252 </para>
40253 <para>
40254 <indexterm role="option">
40255 <primary><option>file_transport</option></primary>
40256 </indexterm>
40257 </para>
40258 <informaltable frame="all">
40259 <tgroup cols="4" colsep="0" rowsep="0">
40260 <colspec colwidth="8*" align="left"/>
40261 <colspec colwidth="6*" align="center"/>
40262 <colspec colwidth="6*" align="center"/>
40263 <colspec colwidth="6*" align="right"/>
40264 <tbody>
40265 <row>
40266 <entry><option>file_transport</option></entry>
40267 <entry>Use: <emphasis>redirect</emphasis></entry>
40268 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40269 <entry>Default: <emphasis>unset</emphasis></entry>
40270 </row>
40271 </tbody>
40272 </tgroup>
40273 </informaltable>
40274 <para>
40275 <indexterm role="variable">
40276 <primary><varname>$address_file</varname></primary>
40277 </indexterm>
40278 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
40279 ending in a slash is specified as a new <quote>address</quote>. The transport used is
40280 specified by this option, which, after expansion, must be the name of a
40281 configured transport. This should normally be an <command>appendfile</command> transport. When
40282 it is running, the filename is in <varname>$address_file</varname>.
40283 </para>
40284 <para>
40285 <indexterm role="option">
40286 <primary><option>filter_prepend_home</option></primary>
40287 </indexterm>
40288 </para>
40289 <informaltable frame="all">
40290 <tgroup cols="4" colsep="0" rowsep="0">
40291 <colspec colwidth="8*" align="left"/>
40292 <colspec colwidth="6*" align="center"/>
40293 <colspec colwidth="6*" align="center"/>
40294 <colspec colwidth="6*" align="right"/>
40295 <tbody>
40296 <row>
40297 <entry><option>filter_prepend_home</option></entry>
40298 <entry>Use: <emphasis>redirect</emphasis></entry>
40299 <entry>Type: <emphasis>boolean</emphasis></entry>
40300 <entry>Default: <emphasis>true</emphasis></entry>
40301 </row>
40302 </tbody>
40303 </tgroup>
40304 </informaltable>
40305 <para>
40306 When this option is true, if a <command>save</command> command in an Exim filter specifies a
40307 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
40308 relative path. If this option is set false, this action does not happen. The
40309 relative path is then passed to the transport unmodified.
40310 </para>
40311 <para>
40312 <indexterm role="option">
40313 <primary><option>forbid_blackhole</option></primary>
40314 </indexterm>
40315 </para>
40316 <informaltable frame="all">
40317 <tgroup cols="4" colsep="0" rowsep="0">
40318 <colspec colwidth="8*" align="left"/>
40319 <colspec colwidth="6*" align="center"/>
40320 <colspec colwidth="6*" align="center"/>
40321 <colspec colwidth="6*" align="right"/>
40322 <tbody>
40323 <row>
40324 <entry><option>forbid_blackhole</option></entry>
40325 <entry>Use: <emphasis>redirect</emphasis></entry>
40326 <entry>Type: <emphasis>boolean</emphasis></entry>
40327 <entry>Default: <emphasis>false</emphasis></entry>
40328 </row>
40329 </tbody>
40330 </tgroup>
40331 </informaltable>
40332 <para>
40333 <indexterm role="concept">
40334 <primary>restricting access to features</primary>
40335 </indexterm>
40336 <indexterm role="concept">
40337 <primary>filter</primary>
40338 <secondary>locking out certain features</secondary>
40339 </indexterm>
40340 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
40341 redirection list.
40342 </para>
40343 <para>
40344 <indexterm role="option">
40345 <primary><option>forbid_exim_filter</option></primary>
40346 </indexterm>
40347 </para>
40348 <informaltable frame="all">
40349 <tgroup cols="4" colsep="0" rowsep="0">
40350 <colspec colwidth="8*" align="left"/>
40351 <colspec colwidth="6*" align="center"/>
40352 <colspec colwidth="6*" align="center"/>
40353 <colspec colwidth="6*" align="right"/>
40354 <tbody>
40355 <row>
40356 <entry><option>forbid_exim_filter</option></entry>
40357 <entry>Use: <emphasis>redirect</emphasis></entry>
40358 <entry>Type: <emphasis>boolean</emphasis></entry>
40359 <entry>Default: <emphasis>false</emphasis></entry>
40360 </row>
40361 </tbody>
40362 </tgroup>
40363 </informaltable>
40364 <para>
40365 <indexterm role="concept">
40366 <primary>restricting access to features</primary>
40367 </indexterm>
40368 <indexterm role="concept">
40369 <primary>filter</primary>
40370 <secondary>locking out certain features</secondary>
40371 </indexterm>
40372 If this option is set true, only Sieve filters are permitted when
40373 <option>allow_filter</option> is true.
40374 </para>
40375 <para>
40376 <indexterm role="option">
40377 <primary><option>forbid_file</option></primary>
40378 </indexterm>
40379 </para>
40380 <informaltable frame="all">
40381 <tgroup cols="4" colsep="0" rowsep="0">
40382 <colspec colwidth="8*" align="left"/>
40383 <colspec colwidth="6*" align="center"/>
40384 <colspec colwidth="6*" align="center"/>
40385 <colspec colwidth="6*" align="right"/>
40386 <tbody>
40387 <row>
40388 <entry><option>forbid_file</option></entry>
40389 <entry>Use: <emphasis>redirect</emphasis></entry>
40390 <entry>Type: <emphasis>boolean</emphasis></entry>
40391 <entry>Default: <emphasis>false</emphasis></entry>
40392 </row>
40393 </tbody>
40394 </tgroup>
40395 </informaltable>
40396 <para>
40397 <indexterm role="concept">
40398 <primary>restricting access to features</primary>
40399 </indexterm>
40400 <indexterm role="concept">
40401 <primary>delivery</primary>
40402 <secondary>to file; forbidding</secondary>
40403 </indexterm>
40404 <indexterm role="concept">
40405 <primary>filter</primary>
40406 <secondary>locking out certain features</secondary>
40407 </indexterm>
40408 <indexterm role="concept">
40409 <primary>Sieve filter</primary>
40410 <secondary>forbidding delivery to a file</secondary>
40411 </indexterm>
40412 <indexterm role="concept">
40413 <primary>Sieve filter</primary>
40414 <secondary><quote>keep</quote> facility; disabling</secondary>
40415 </indexterm>
40416 If this option is true, this router may not generate a new address that
40417 specifies delivery to a local file or directory, either from a filter or from a
40418 conventional forward file. This option is forced to be true if <option>one_time</option> is
40419 set. It applies to Sieve filters as well as to Exim filters, but if true, it
40420 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
40421 </para>
40422 <para>
40423 <indexterm role="option">
40424 <primary><option>forbid_filter_dlfunc</option></primary>
40425 </indexterm>
40426 </para>
40427 <informaltable frame="all">
40428 <tgroup cols="4" colsep="0" rowsep="0">
40429 <colspec colwidth="8*" align="left"/>
40430 <colspec colwidth="6*" align="center"/>
40431 <colspec colwidth="6*" align="center"/>
40432 <colspec colwidth="6*" align="right"/>
40433 <tbody>
40434 <row>
40435 <entry><option>forbid_filter_dlfunc</option></entry>
40436 <entry>Use: <emphasis>redirect</emphasis></entry>
40437 <entry>Type: <emphasis>boolean</emphasis></entry>
40438 <entry>Default: <emphasis>false</emphasis></entry>
40439 </row>
40440 </tbody>
40441 </tgroup>
40442 </informaltable>
40443 <para>
40444 <indexterm role="concept">
40445 <primary>restricting access to features</primary>
40446 </indexterm>
40447 <indexterm role="concept">
40448 <primary>filter</primary>
40449 <secondary>locking out certain features</secondary>
40450 </indexterm>
40451 If this option is true, string expansions in Exim filters are not allowed to
40452 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
40453 functions.
40454 </para>
40455 <para>
40456 <indexterm role="option">
40457 <primary><option>forbid_filter_existstest</option></primary>
40458 </indexterm>
40459 </para>
40460 <informaltable frame="all">
40461 <tgroup cols="4" colsep="0" rowsep="0">
40462 <colspec colwidth="8*" align="left"/>
40463 <colspec colwidth="6*" align="center"/>
40464 <colspec colwidth="6*" align="center"/>
40465 <colspec colwidth="6*" align="right"/>
40466 <tbody>
40467 <row>
40468 <entry><option>forbid_filter_existstest</option></entry>
40469 <entry>Use: <emphasis>redirect</emphasis></entry>
40470 <entry>Type: <emphasis>boolean</emphasis></entry>
40471 <entry>Default: <emphasis>false</emphasis></entry>
40472 </row>
40473 </tbody>
40474 </tgroup>
40475 </informaltable>
40476 <para>
40477 <indexterm role="concept">
40478 <primary>restricting access to features</primary>
40479 </indexterm>
40480 <indexterm role="concept">
40481 <primary>filter</primary>
40482 <secondary>locking out certain features</secondary>
40483 </indexterm>
40484 <indexterm role="concept">
40485 <primary>expansion</primary>
40486 <secondary>statting a file</secondary>
40487 </indexterm>
40488 If this option is true, string expansions in Exim filters are not allowed to
40489 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
40490 </para>
40491 <para>
40492 <indexterm role="option">
40493 <primary><option>forbid_filter_logwrite</option></primary>
40494 </indexterm>
40495 </para>
40496 <informaltable frame="all">
40497 <tgroup cols="4" colsep="0" rowsep="0">
40498 <colspec colwidth="8*" align="left"/>
40499 <colspec colwidth="6*" align="center"/>
40500 <colspec colwidth="6*" align="center"/>
40501 <colspec colwidth="6*" align="right"/>
40502 <tbody>
40503 <row>
40504 <entry><option>forbid_filter_logwrite</option></entry>
40505 <entry>Use: <emphasis>redirect</emphasis></entry>
40506 <entry>Type: <emphasis>boolean</emphasis></entry>
40507 <entry>Default: <emphasis>false</emphasis></entry>
40508 </row>
40509 </tbody>
40510 </tgroup>
40511 </informaltable>
40512 <para>
40513 <indexterm role="concept">
40514 <primary>restricting access to features</primary>
40515 </indexterm>
40516 <indexterm role="concept">
40517 <primary>filter</primary>
40518 <secondary>locking out certain features</secondary>
40519 </indexterm>
40520 If this option is true, use of the logging facility in Exim filters is not
40521 permitted. Logging is in any case available only if the filter is being run
40522 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
40523 <filename>.forward</filename> files).
40524 </para>
40525 <para>
40526 <indexterm role="option">
40527 <primary><option>forbid_filter_lookup</option></primary>
40528 </indexterm>
40529 </para>
40530 <informaltable frame="all">
40531 <tgroup cols="4" colsep="0" rowsep="0">
40532 <colspec colwidth="8*" align="left"/>
40533 <colspec colwidth="6*" align="center"/>
40534 <colspec colwidth="6*" align="center"/>
40535 <colspec colwidth="6*" align="right"/>
40536 <tbody>
40537 <row>
40538 <entry><option>forbid_filter_lookup</option></entry>
40539 <entry>Use: <emphasis>redirect</emphasis></entry>
40540 <entry>Type: <emphasis>boolean</emphasis></entry>
40541 <entry>Default: <emphasis>false</emphasis></entry>
40542 </row>
40543 </tbody>
40544 </tgroup>
40545 </informaltable>
40546 <para>
40547 <indexterm role="concept">
40548 <primary>restricting access to features</primary>
40549 </indexterm>
40550 <indexterm role="concept">
40551 <primary>filter</primary>
40552 <secondary>locking out certain features</secondary>
40553 </indexterm>
40554 If this option is true, string expansions in Exim filter files are not allowed
40555 to make use of <option>lookup</option> items.
40556 </para>
40557 <para>
40558 <indexterm role="option">
40559 <primary><option>forbid_filter_perl</option></primary>
40560 </indexterm>
40561 </para>
40562 <informaltable frame="all">
40563 <tgroup cols="4" colsep="0" rowsep="0">
40564 <colspec colwidth="8*" align="left"/>
40565 <colspec colwidth="6*" align="center"/>
40566 <colspec colwidth="6*" align="center"/>
40567 <colspec colwidth="6*" align="right"/>
40568 <tbody>
40569 <row>
40570 <entry><option>forbid_filter_perl</option></entry>
40571 <entry>Use: <emphasis>redirect</emphasis></entry>
40572 <entry>Type: <emphasis>boolean</emphasis></entry>
40573 <entry>Default: <emphasis>false</emphasis></entry>
40574 </row>
40575 </tbody>
40576 </tgroup>
40577 </informaltable>
40578 <para>
40579 <indexterm role="concept">
40580 <primary>restricting access to features</primary>
40581 </indexterm>
40582 <indexterm role="concept">
40583 <primary>filter</primary>
40584 <secondary>locking out certain features</secondary>
40585 </indexterm>
40586 This option has an effect only if Exim is built with embedded Perl support. If
40587 it is true, string expansions in Exim filter files are not allowed to make use
40588 of the embedded Perl support.
40589 </para>
40590 <para>
40591 <indexterm role="option">
40592 <primary><option>forbid_filter_readfile</option></primary>
40593 </indexterm>
40594 </para>
40595 <informaltable frame="all">
40596 <tgroup cols="4" colsep="0" rowsep="0">
40597 <colspec colwidth="8*" align="left"/>
40598 <colspec colwidth="6*" align="center"/>
40599 <colspec colwidth="6*" align="center"/>
40600 <colspec colwidth="6*" align="right"/>
40601 <tbody>
40602 <row>
40603 <entry><option>forbid_filter_readfile</option></entry>
40604 <entry>Use: <emphasis>redirect</emphasis></entry>
40605 <entry>Type: <emphasis>boolean</emphasis></entry>
40606 <entry>Default: <emphasis>false</emphasis></entry>
40607 </row>
40608 </tbody>
40609 </tgroup>
40610 </informaltable>
40611 <para>
40612 <indexterm role="concept">
40613 <primary>restricting access to features</primary>
40614 </indexterm>
40615 <indexterm role="concept">
40616 <primary>filter</primary>
40617 <secondary>locking out certain features</secondary>
40618 </indexterm>
40619 If this option is true, string expansions in Exim filter files are not allowed
40620 to make use of <option>readfile</option> items.
40621 </para>
40622 <para>
40623 <indexterm role="option">
40624 <primary><option>forbid_filter_readsocket</option></primary>
40625 </indexterm>
40626 </para>
40627 <informaltable frame="all">
40628 <tgroup cols="4" colsep="0" rowsep="0">
40629 <colspec colwidth="8*" align="left"/>
40630 <colspec colwidth="6*" align="center"/>
40631 <colspec colwidth="6*" align="center"/>
40632 <colspec colwidth="6*" align="right"/>
40633 <tbody>
40634 <row>
40635 <entry><option>forbid_filter_readsocket</option></entry>
40636 <entry>Use: <emphasis>redirect</emphasis></entry>
40637 <entry>Type: <emphasis>boolean</emphasis></entry>
40638 <entry>Default: <emphasis>false</emphasis></entry>
40639 </row>
40640 </tbody>
40641 </tgroup>
40642 </informaltable>
40643 <para>
40644 <indexterm role="concept">
40645 <primary>restricting access to features</primary>
40646 </indexterm>
40647 <indexterm role="concept">
40648 <primary>filter</primary>
40649 <secondary>locking out certain features</secondary>
40650 </indexterm>
40651 If this option is true, string expansions in Exim filter files are not allowed
40652 to make use of <option>readsocket</option> items.
40653 </para>
40654 <para>
40655 <indexterm role="option">
40656 <primary><option>forbid_filter_reply</option></primary>
40657 </indexterm>
40658 </para>
40659 <informaltable frame="all">
40660 <tgroup cols="4" colsep="0" rowsep="0">
40661 <colspec colwidth="8*" align="left"/>
40662 <colspec colwidth="6*" align="center"/>
40663 <colspec colwidth="6*" align="center"/>
40664 <colspec colwidth="6*" align="right"/>
40665 <tbody>
40666 <row>
40667 <entry><option>forbid_filter_reply</option></entry>
40668 <entry>Use: <emphasis>redirect</emphasis></entry>
40669 <entry>Type: <emphasis>boolean</emphasis></entry>
40670 <entry>Default: <emphasis>false</emphasis></entry>
40671 </row>
40672 </tbody>
40673 </tgroup>
40674 </informaltable>
40675 <para>
40676 <indexterm role="concept">
40677 <primary>restricting access to features</primary>
40678 </indexterm>
40679 <indexterm role="concept">
40680 <primary>filter</primary>
40681 <secondary>locking out certain features</secondary>
40682 </indexterm>
40683 If this option is true, this router may not generate an automatic reply
40684 message. Automatic replies can be generated only from Exim or Sieve filter
40685 files, not from traditional forward files. This option is forced to be true if
40686 <option>one_time</option> is set.
40687 </para>
40688 <para>
40689 <indexterm role="option">
40690 <primary><option>forbid_filter_run</option></primary>
40691 </indexterm>
40692 </para>
40693 <informaltable frame="all">
40694 <tgroup cols="4" colsep="0" rowsep="0">
40695 <colspec colwidth="8*" align="left"/>
40696 <colspec colwidth="6*" align="center"/>
40697 <colspec colwidth="6*" align="center"/>
40698 <colspec colwidth="6*" align="right"/>
40699 <tbody>
40700 <row>
40701 <entry><option>forbid_filter_run</option></entry>
40702 <entry>Use: <emphasis>redirect</emphasis></entry>
40703 <entry>Type: <emphasis>boolean</emphasis></entry>
40704 <entry>Default: <emphasis>false</emphasis></entry>
40705 </row>
40706 </tbody>
40707 </tgroup>
40708 </informaltable>
40709 <para>
40710 <indexterm role="concept">
40711 <primary>restricting access to features</primary>
40712 </indexterm>
40713 <indexterm role="concept">
40714 <primary>filter</primary>
40715 <secondary>locking out certain features</secondary>
40716 </indexterm>
40717 If this option is true, string expansions in Exim filter files are not allowed
40718 to make use of <option>run</option> items.
40719 </para>
40720 <para>
40721 <indexterm role="option">
40722 <primary><option>forbid_include</option></primary>
40723 </indexterm>
40724 </para>
40725 <informaltable frame="all">
40726 <tgroup cols="4" colsep="0" rowsep="0">
40727 <colspec colwidth="8*" align="left"/>
40728 <colspec colwidth="6*" align="center"/>
40729 <colspec colwidth="6*" align="center"/>
40730 <colspec colwidth="6*" align="right"/>
40731 <tbody>
40732 <row>
40733 <entry><option>forbid_include</option></entry>
40734 <entry>Use: <emphasis>redirect</emphasis></entry>
40735 <entry>Type: <emphasis>boolean</emphasis></entry>
40736 <entry>Default: <emphasis>false</emphasis></entry>
40737 </row>
40738 </tbody>
40739 </tgroup>
40740 </informaltable>
40741 <para>
40742 <indexterm role="concept">
40743 <primary>restricting access to features</primary>
40744 </indexterm>
40745 <indexterm role="concept">
40746 <primary>filter</primary>
40747 <secondary>locking out certain features</secondary>
40748 </indexterm>
40749 If this option is true, items of the form
40750 </para>
40751 <literallayout class="monospaced">
40752 :include:&lt;path name&gt;
40753 </literallayout>
40754 <para>
40755 are not permitted in non-filter redirection lists.
40756 </para>
40757 <para>
40758 <indexterm role="option">
40759 <primary><option>forbid_pipe</option></primary>
40760 </indexterm>
40761 </para>
40762 <informaltable frame="all">
40763 <tgroup cols="4" colsep="0" rowsep="0">
40764 <colspec colwidth="8*" align="left"/>
40765 <colspec colwidth="6*" align="center"/>
40766 <colspec colwidth="6*" align="center"/>
40767 <colspec colwidth="6*" align="right"/>
40768 <tbody>
40769 <row>
40770 <entry><option>forbid_pipe</option></entry>
40771 <entry>Use: <emphasis>redirect</emphasis></entry>
40772 <entry>Type: <emphasis>boolean</emphasis></entry>
40773 <entry>Default: <emphasis>false</emphasis></entry>
40774 </row>
40775 </tbody>
40776 </tgroup>
40777 </informaltable>
40778 <para>
40779 <indexterm role="concept">
40780 <primary>restricting access to features</primary>
40781 </indexterm>
40782 <indexterm role="concept">
40783 <primary>filter</primary>
40784 <secondary>locking out certain features</secondary>
40785 </indexterm>
40786 <indexterm role="concept">
40787 <primary>delivery</primary>
40788 <secondary>to pipe; forbidding</secondary>
40789 </indexterm>
40790 If this option is true, this router may not generate a new address which
40791 specifies delivery to a pipe, either from an Exim filter or from a conventional
40792 forward file. This option is forced to be true if <option>one_time</option> is set.
40793 </para>
40794 <para>
40795 <indexterm role="option">
40796 <primary><option>forbid_sieve_filter</option></primary>
40797 </indexterm>
40798 </para>
40799 <informaltable frame="all">
40800 <tgroup cols="4" colsep="0" rowsep="0">
40801 <colspec colwidth="8*" align="left"/>
40802 <colspec colwidth="6*" align="center"/>
40803 <colspec colwidth="6*" align="center"/>
40804 <colspec colwidth="6*" align="right"/>
40805 <tbody>
40806 <row>
40807 <entry><option>forbid_sieve_filter</option></entry>
40808 <entry>Use: <emphasis>redirect</emphasis></entry>
40809 <entry>Type: <emphasis>boolean</emphasis></entry>
40810 <entry>Default: <emphasis>false</emphasis></entry>
40811 </row>
40812 </tbody>
40813 </tgroup>
40814 </informaltable>
40815 <para>
40816 <indexterm role="concept">
40817 <primary>restricting access to features</primary>
40818 </indexterm>
40819 <indexterm role="concept">
40820 <primary>filter</primary>
40821 <secondary>locking out certain features</secondary>
40822 </indexterm>
40823 If this option is set true, only Exim filters are permitted when
40824 <option>allow_filter</option> is true.
40825 </para>
40826 <para>
40827 <indexterm role="concept">
40828 <primary>SMTP</primary>
40829 <secondary>error codes</secondary>
40830 </indexterm>
40831 <indexterm role="option">
40832 <primary><option>forbid_smtp_code</option></primary>
40833 </indexterm>
40834 </para>
40835 <informaltable frame="all">
40836 <tgroup cols="4" colsep="0" rowsep="0">
40837 <colspec colwidth="8*" align="left"/>
40838 <colspec colwidth="6*" align="center"/>
40839 <colspec colwidth="6*" align="center"/>
40840 <colspec colwidth="6*" align="right"/>
40841 <tbody>
40842 <row>
40843 <entry><option>forbid_smtp_code</option></entry>
40844 <entry>Use: <emphasis>redirect</emphasis></entry>
40845 <entry>Type: <emphasis>boolean</emphasis></entry>
40846 <entry>Default: <emphasis>false</emphasis></entry>
40847 </row>
40848 </tbody>
40849 </tgroup>
40850 </informaltable>
40851 <para>
40852 If this option is set true, any SMTP error codes that are present at the start
40853 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
40854 the default codes (451 and 550, respectively) are always used.
40855 </para>
40856 <para>
40857 <indexterm role="option">
40858 <primary><option>hide_child_in_errmsg</option></primary>
40859 </indexterm>
40860 </para>
40861 <informaltable frame="all">
40862 <tgroup cols="4" colsep="0" rowsep="0">
40863 <colspec colwidth="8*" align="left"/>
40864 <colspec colwidth="6*" align="center"/>
40865 <colspec colwidth="6*" align="center"/>
40866 <colspec colwidth="6*" align="right"/>
40867 <tbody>
40868 <row>
40869 <entry><option>hide_child_in_errmsg</option></entry>
40870 <entry>Use: <emphasis>redirect</emphasis></entry>
40871 <entry>Type: <emphasis>boolean</emphasis></entry>
40872 <entry>Default: <emphasis>false</emphasis></entry>
40873 </row>
40874 </tbody>
40875 </tgroup>
40876 </informaltable>
40877 <para>
40878 <indexterm role="concept">
40879 <primary>bounce message</primary>
40880 <secondary>redirection details; suppressing</secondary>
40881 </indexterm>
40882 If this option is true, it prevents Exim from quoting a child address if it
40883 generates a bounce or delay message for it. Instead it says <quote>an address
40884 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
40885 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
40886 bounce may well quote the generated address.
40887 </para>
40888 <para>
40889 <indexterm role="option">
40890 <primary><option>ignore_eacces</option></primary>
40891 </indexterm>
40892 </para>
40893 <informaltable frame="all">
40894 <tgroup cols="4" colsep="0" rowsep="0">
40895 <colspec colwidth="8*" align="left"/>
40896 <colspec colwidth="6*" align="center"/>
40897 <colspec colwidth="6*" align="center"/>
40898 <colspec colwidth="6*" align="right"/>
40899 <tbody>
40900 <row>
40901 <entry><option>ignore_eacces</option></entry>
40902 <entry>Use: <emphasis>redirect</emphasis></entry>
40903 <entry>Type: <emphasis>boolean</emphasis></entry>
40904 <entry>Default: <emphasis>false</emphasis></entry>
40905 </row>
40906 </tbody>
40907 </tgroup>
40908 </informaltable>
40909 <para>
40910 <indexterm role="concept">
40911 <primary>EACCES</primary>
40912 </indexterm>
40913 If this option is set and an attempt to open a redirection file yields the
40914 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
40915 file did not exist.
40916 </para>
40917 <para>
40918 <indexterm role="option">
40919 <primary><option>ignore_enotdir</option></primary>
40920 </indexterm>
40921 </para>
40922 <informaltable frame="all">
40923 <tgroup cols="4" colsep="0" rowsep="0">
40924 <colspec colwidth="8*" align="left"/>
40925 <colspec colwidth="6*" align="center"/>
40926 <colspec colwidth="6*" align="center"/>
40927 <colspec colwidth="6*" align="right"/>
40928 <tbody>
40929 <row>
40930 <entry><option>ignore_enotdir</option></entry>
40931 <entry>Use: <emphasis>redirect</emphasis></entry>
40932 <entry>Type: <emphasis>boolean</emphasis></entry>
40933 <entry>Default: <emphasis>false</emphasis></entry>
40934 </row>
40935 </tbody>
40936 </tgroup>
40937 </informaltable>
40938 <para>
40939 <indexterm role="concept">
40940 <primary>ENOTDIR</primary>
40941 </indexterm>
40942 If this option is set and an attempt to open a redirection file yields the
40943 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
40944 router behaves as if the file did not exist.
40945 </para>
40946 <para>
40947 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
40948 router that has the <option>file</option> option set discovers that the file does not exist
40949 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
40950 against unmounted NFS directories. If the parent can not be statted, delivery
40951 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
40952 is set, because that option tells Exim to ignore <quote>something on the path is not
40953 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
40954 that some operating systems give ENOENT where others give ENOTDIR.
40955 </para>
40956 <para>
40957 <indexterm role="option">
40958 <primary><option>include_directory</option></primary>
40959 </indexterm>
40960 </para>
40961 <informaltable frame="all">
40962 <tgroup cols="4" colsep="0" rowsep="0">
40963 <colspec colwidth="8*" align="left"/>
40964 <colspec colwidth="6*" align="center"/>
40965 <colspec colwidth="6*" align="center"/>
40966 <colspec colwidth="6*" align="right"/>
40967 <tbody>
40968 <row>
40969 <entry><option>include_directory</option></entry>
40970 <entry>Use: <emphasis>redirect</emphasis></entry>
40971 <entry>Type: <emphasis>string</emphasis></entry>
40972 <entry>Default: <emphasis>unset</emphasis></entry>
40973 </row>
40974 </tbody>
40975 </tgroup>
40976 </informaltable>
40977 <para>
40978 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
40979 redirection list must start with this directory.
40980 </para>
40981 <para>
40982 <indexterm role="option">
40983 <primary><option>modemask</option></primary>
40984 </indexterm>
40985 </para>
40986 <informaltable frame="all">
40987 <tgroup cols="4" colsep="0" rowsep="0">
40988 <colspec colwidth="8*" align="left"/>
40989 <colspec colwidth="6*" align="center"/>
40990 <colspec colwidth="6*" align="center"/>
40991 <colspec colwidth="6*" align="right"/>
40992 <tbody>
40993 <row>
40994 <entry><option>modemask</option></entry>
40995 <entry>Use: <emphasis>redirect</emphasis></entry>
40996 <entry>Type: <emphasis>octal integer</emphasis></entry>
40997 <entry>Default: <emphasis>022</emphasis></entry>
40998 </row>
40999 </tbody>
41000 </tgroup>
41001 </informaltable>
41002 <para>
41003 This specifies mode bits which must not be set for a file specified by the
41004 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
41005 </para>
41006 <para>
41007 <indexterm role="option">
41008 <primary><option>one_time</option></primary>
41009 </indexterm>
41010 </para>
41011 <informaltable frame="all">
41012 <tgroup cols="4" colsep="0" rowsep="0">
41013 <colspec colwidth="8*" align="left"/>
41014 <colspec colwidth="6*" align="center"/>
41015 <colspec colwidth="6*" align="center"/>
41016 <colspec colwidth="6*" align="right"/>
41017 <tbody>
41018 <row>
41019 <entry><option>one_time</option></entry>
41020 <entry>Use: <emphasis>redirect</emphasis></entry>
41021 <entry>Type: <emphasis>boolean</emphasis></entry>
41022 <entry>Default: <emphasis>false</emphasis></entry>
41023 </row>
41024 </tbody>
41025 </tgroup>
41026 </informaltable>
41027 <para>
41028 <indexterm role="concept">
41029 <primary>one-time aliasing/forwarding expansion</primary>
41030 </indexterm>
41031 <indexterm role="concept">
41032 <primary>alias file</primary>
41033 <secondary>one-time expansion</secondary>
41034 </indexterm>
41035 <indexterm role="concept">
41036 <primary>forward file</primary>
41037 <secondary>one-time expansion</secondary>
41038 </indexterm>
41039 <indexterm role="concept">
41040 <primary>mailing lists</primary>
41041 <secondary>one-time expansion</secondary>
41042 </indexterm>
41043 <indexterm role="concept">
41044 <primary>address redirection</primary>
41045 <secondary>one-time expansion</secondary>
41046 </indexterm>
41047 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
41048 files each time it tries to deliver a message causes a problem when one or more
41049 of the generated addresses fails be delivered at the first attempt. The problem
41050 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
41051 but of what happens when the redirection list changes during the time that the
41052 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
41053 lists, where new subscribers might receive copies of messages that were posted
41054 before they subscribed.
41055 </para>
41056 <para>
41057 If <option>one_time</option> is set and any addresses generated by the router fail to
41058 deliver at the first attempt, the failing addresses are added to the message as
41059 <quote>top level</quote> addresses, and the parent address that generated them is marked
41060 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
41061 attempt.
41062 </para>
41063 <para>
41064 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
41065 router would be lost if delivery did not succeed at the first attempt. For this
41066 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
41067 permitted when <option>one_time</option> is set.
41068 </para>
41069 <para>
41070 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
41071 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
41072 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
41073 </para>
41074 <para>
41075 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
41076 <option>one_time</option>.
41077 </para>
41078 <para>
41079 The original top-level address is remembered with each of the generated
41080 addresses, and is output in any log messages. However, any intermediate parent
41081 addresses are not recorded. This makes a difference to the log only if
41082 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
41083 typically be used for mailing lists, where there is normally just one level of
41084 expansion.
41085 </para>
41086 <para>
41087 <indexterm role="option">
41088 <primary><option>owners</option></primary>
41089 </indexterm>
41090 </para>
41091 <informaltable frame="all">
41092 <tgroup cols="4" colsep="0" rowsep="0">
41093 <colspec colwidth="8*" align="left"/>
41094 <colspec colwidth="6*" align="center"/>
41095 <colspec colwidth="6*" align="center"/>
41096 <colspec colwidth="6*" align="right"/>
41097 <tbody>
41098 <row>
41099 <entry><option>owners</option></entry>
41100 <entry>Use: <emphasis>redirect</emphasis></entry>
41101 <entry>Type: <emphasis>string list</emphasis></entry>
41102 <entry>Default: <emphasis>unset</emphasis></entry>
41103 </row>
41104 </tbody>
41105 </tgroup>
41106 </informaltable>
41107 <para>
41108 <indexterm role="concept">
41109 <primary>ownership</primary>
41110 <secondary>alias file</secondary>
41111 </indexterm>
41112 <indexterm role="concept">
41113 <primary>ownership</primary>
41114 <secondary>forward file</secondary>
41115 </indexterm>
41116 <indexterm role="concept">
41117 <primary>alias file</primary>
41118 <secondary>ownership</secondary>
41119 </indexterm>
41120 <indexterm role="concept">
41121 <primary>forward file</primary>
41122 <secondary>ownership</secondary>
41123 </indexterm>
41124 This specifies a list of permitted owners for the file specified by <option>file</option>.
41125 This list is in addition to the local user when <option>check_local_user</option> is set.
41126 See <option>check_owner</option> above.
41127 </para>
41128 <para>
41129 <indexterm role="option">
41130 <primary><option>owngroups</option></primary>
41131 </indexterm>
41132 </para>
41133 <informaltable frame="all">
41134 <tgroup cols="4" colsep="0" rowsep="0">
41135 <colspec colwidth="8*" align="left"/>
41136 <colspec colwidth="6*" align="center"/>
41137 <colspec colwidth="6*" align="center"/>
41138 <colspec colwidth="6*" align="right"/>
41139 <tbody>
41140 <row>
41141 <entry><option>owngroups</option></entry>
41142 <entry>Use: <emphasis>redirect</emphasis></entry>
41143 <entry>Type: <emphasis>string list</emphasis></entry>
41144 <entry>Default: <emphasis>unset</emphasis></entry>
41145 </row>
41146 </tbody>
41147 </tgroup>
41148 </informaltable>
41149 <para>
41150 This specifies a list of permitted groups for the file specified by <option>file</option>.
41151 The list is in addition to the local user&#x2019;s primary group when
41152 <option>check_local_user</option> is set. See <option>check_group</option> above.
41153 </para>
41154 <para>
41155 <indexterm role="option">
41156 <primary><option>pipe_transport</option></primary>
41157 </indexterm>
41158 </para>
41159 <informaltable frame="all">
41160 <tgroup cols="4" colsep="0" rowsep="0">
41161 <colspec colwidth="8*" align="left"/>
41162 <colspec colwidth="6*" align="center"/>
41163 <colspec colwidth="6*" align="center"/>
41164 <colspec colwidth="6*" align="right"/>
41165 <tbody>
41166 <row>
41167 <entry><option>pipe_transport</option></entry>
41168 <entry>Use: <emphasis>redirect</emphasis></entry>
41169 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41170 <entry>Default: <emphasis>unset</emphasis></entry>
41171 </row>
41172 </tbody>
41173 </tgroup>
41174 </informaltable>
41175 <para>
41176 <indexterm role="variable">
41177 <primary><varname>$address_pipe</varname></primary>
41178 </indexterm>
41179 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
41180 starting with a vertical bar character is specified as a new <quote>address</quote>. The
41181 transport used is specified by this option, which, after expansion, must be the
41182 name of a configured transport. This should normally be a <command>pipe</command> transport.
41183 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
41184 </para>
41185 <para>
41186 <indexterm role="option">
41187 <primary><option>qualify_domain</option></primary>
41188 </indexterm>
41189 </para>
41190 <informaltable frame="all">
41191 <tgroup cols="4" colsep="0" rowsep="0">
41192 <colspec colwidth="8*" align="left"/>
41193 <colspec colwidth="6*" align="center"/>
41194 <colspec colwidth="6*" align="center"/>
41195 <colspec colwidth="6*" align="right"/>
41196 <tbody>
41197 <row>
41198 <entry><option>qualify_domain</option></entry>
41199 <entry>Use: <emphasis>redirect</emphasis></entry>
41200 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41201 <entry>Default: <emphasis>unset</emphasis></entry>
41202 </row>
41203 </tbody>
41204 </tgroup>
41205 </informaltable>
41206 <para>
41207 <indexterm role="variable">
41208 <primary><varname>$qualify_recipient</varname></primary>
41209 </indexterm>
41210 If this option is set, and an unqualified address (one without a domain) is
41211 generated, and that address would normally be qualified by the global setting
41212 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
41213 expanding this string. If the expansion fails, the router declines. If you want
41214 to revert to the default, you can have the expansion generate
41215 <varname>$qualify_recipient</varname>.
41216 </para>
41217 <para>
41218 This option applies to all unqualified addresses generated by Exim filters,
41219 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
41220 not preceded by a backslash. Sieve filters cannot generate unqualified
41221 addresses.
41222 </para>
41223 <para>
41224 <indexterm role="option">
41225 <primary><option>qualify_preserve_domain</option></primary>
41226 </indexterm>
41227 </para>
41228 <informaltable frame="all">
41229 <tgroup cols="4" colsep="0" rowsep="0">
41230 <colspec colwidth="8*" align="left"/>
41231 <colspec colwidth="6*" align="center"/>
41232 <colspec colwidth="6*" align="center"/>
41233 <colspec colwidth="6*" align="right"/>
41234 <tbody>
41235 <row>
41236 <entry><option>qualify_preserve_domain</option></entry>
41237 <entry>Use: <emphasis>redirect</emphasis></entry>
41238 <entry>Type: <emphasis>boolean</emphasis></entry>
41239 <entry>Default: <emphasis>false</emphasis></entry>
41240 </row>
41241 </tbody>
41242 </tgroup>
41243 </informaltable>
41244 <para>
41245 <indexterm role="concept">
41246 <primary>domain</primary>
41247 <secondary>in redirection; preserving</secondary>
41248 </indexterm>
41249 <indexterm role="concept">
41250 <primary>preserving domain in redirection</primary>
41251 </indexterm>
41252 <indexterm role="concept">
41253 <primary>address redirection</primary>
41254 <secondary>domain; preserving</secondary>
41255 </indexterm>
41256 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
41257 set (a configuration error occurs if it is). If an unqualified address (one
41258 without a domain) is generated, it is qualified with the domain of the parent
41259 address (the immediately preceding ancestor) instead of the global
41260 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
41261 this applies whether or not the address is preceded by a backslash.
41262 </para>
41263 <para>
41264 <indexterm role="option">
41265 <primary><option>repeat_use</option></primary>
41266 </indexterm>
41267 </para>
41268 <informaltable frame="all">
41269 <tgroup cols="4" colsep="0" rowsep="0">
41270 <colspec colwidth="8*" align="left"/>
41271 <colspec colwidth="6*" align="center"/>
41272 <colspec colwidth="6*" align="center"/>
41273 <colspec colwidth="6*" align="right"/>
41274 <tbody>
41275 <row>
41276 <entry><option>repeat_use</option></entry>
41277 <entry>Use: <emphasis>redirect</emphasis></entry>
41278 <entry>Type: <emphasis>boolean</emphasis></entry>
41279 <entry>Default: <emphasis>true</emphasis></entry>
41280 </row>
41281 </tbody>
41282 </tgroup>
41283 </informaltable>
41284 <para>
41285 If this option is set false, the router is skipped for a child address that has
41286 any ancestor that was routed by this router. This test happens before any of
41287 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
41288 only when the ancestor is the same as the current address. See also
41289 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
41290 </para>
41291 <para>
41292 <indexterm role="option">
41293 <primary><option>reply_transport</option></primary>
41294 </indexterm>
41295 </para>
41296 <informaltable frame="all">
41297 <tgroup cols="4" colsep="0" rowsep="0">
41298 <colspec colwidth="8*" align="left"/>
41299 <colspec colwidth="6*" align="center"/>
41300 <colspec colwidth="6*" align="center"/>
41301 <colspec colwidth="6*" align="right"/>
41302 <tbody>
41303 <row>
41304 <entry><option>reply_transport</option></entry>
41305 <entry>Use: <emphasis>redirect</emphasis></entry>
41306 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41307 <entry>Default: <emphasis>unset</emphasis></entry>
41308 </row>
41309 </tbody>
41310 </tgroup>
41311 </informaltable>
41312 <para>
41313 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
41314 <option>vacation</option> command is used in a filter file. The transport used is specified
41315 by this option, which, after expansion, must be the name of a configured
41316 transport. This should normally be an <command>autoreply</command> transport. Other transports
41317 are unlikely to do anything sensible or useful.
41318 </para>
41319 <para>
41320 <indexterm role="option">
41321 <primary><option>rewrite</option></primary>
41322 </indexterm>
41323 </para>
41324 <informaltable frame="all">
41325 <tgroup cols="4" colsep="0" rowsep="0">
41326 <colspec colwidth="8*" align="left"/>
41327 <colspec colwidth="6*" align="center"/>
41328 <colspec colwidth="6*" align="center"/>
41329 <colspec colwidth="6*" align="right"/>
41330 <tbody>
41331 <row>
41332 <entry><option>rewrite</option></entry>
41333 <entry>Use: <emphasis>redirect</emphasis></entry>
41334 <entry>Type: <emphasis>boolean</emphasis></entry>
41335 <entry>Default: <emphasis>true</emphasis></entry>
41336 </row>
41337 </tbody>
41338 </tgroup>
41339 </informaltable>
41340 <para>
41341 <indexterm role="concept">
41342 <primary>address redirection</primary>
41343 <secondary>disabling rewriting</secondary>
41344 </indexterm>
41345 If this option is set false, addresses generated by the router are not
41346 subject to address rewriting. Otherwise, they are treated like new addresses
41347 and are rewritten according to the global rewriting rules.
41348 </para>
41349 <para>
41350 <indexterm role="option">
41351 <primary><option>sieve_subaddress</option></primary>
41352 </indexterm>
41353 </para>
41354 <informaltable frame="all">
41355 <tgroup cols="4" colsep="0" rowsep="0">
41356 <colspec colwidth="8*" align="left"/>
41357 <colspec colwidth="6*" align="center"/>
41358 <colspec colwidth="6*" align="center"/>
41359 <colspec colwidth="6*" align="right"/>
41360 <tbody>
41361 <row>
41362 <entry><option>sieve_subaddress</option></entry>
41363 <entry>Use: <emphasis>redirect</emphasis></entry>
41364 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41365 <entry>Default: <emphasis>unset</emphasis></entry>
41366 </row>
41367 </tbody>
41368 </tgroup>
41369 </informaltable>
41370 <para>
41371 The value of this option is passed to a Sieve filter to specify the
41372 :subaddress part of an address.
41373 </para>
41374 <para>
41375 <indexterm role="option">
41376 <primary><option>sieve_useraddress</option></primary>
41377 </indexterm>
41378 </para>
41379 <informaltable frame="all">
41380 <tgroup cols="4" colsep="0" rowsep="0">
41381 <colspec colwidth="8*" align="left"/>
41382 <colspec colwidth="6*" align="center"/>
41383 <colspec colwidth="6*" align="center"/>
41384 <colspec colwidth="6*" align="right"/>
41385 <tbody>
41386 <row>
41387 <entry><option>sieve_useraddress</option></entry>
41388 <entry>Use: <emphasis>redirect</emphasis></entry>
41389 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41390 <entry>Default: <emphasis>unset</emphasis></entry>
41391 </row>
41392 </tbody>
41393 </tgroup>
41394 </informaltable>
41395 <para>
41396 The value of this option is passed to a Sieve filter to specify the :user part
41397 of an address. However, if it is unset, the entire original local part
41398 (including any prefix or suffix) is used for :user.
41399 </para>
41400 <para>
41401 <indexterm role="option">
41402 <primary><option>sieve_vacation_directory</option></primary>
41403 </indexterm>
41404 </para>
41405 <informaltable frame="all">
41406 <tgroup cols="4" colsep="0" rowsep="0">
41407 <colspec colwidth="8*" align="left"/>
41408 <colspec colwidth="6*" align="center"/>
41409 <colspec colwidth="6*" align="center"/>
41410 <colspec colwidth="6*" align="right"/>
41411 <tbody>
41412 <row>
41413 <entry><option>sieve_vacation_directory</option></entry>
41414 <entry>Use: <emphasis>redirect</emphasis></entry>
41415 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41416 <entry>Default: <emphasis>unset</emphasis></entry>
41417 </row>
41418 </tbody>
41419 </tgroup>
41420 </informaltable>
41421 <para>
41422 <indexterm role="concept">
41423 <primary>Sieve filter</primary>
41424 <secondary>vacation directory</secondary>
41425 </indexterm>
41426 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
41427 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
41428 (do not put anything else in that directory), and ensure that the
41429 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
41430 needs their own directory; Exim will create it if necessary.
41431 </para>
41432 <para>
41433 <indexterm role="option">
41434 <primary><option>skip_syntax_errors</option></primary>
41435 </indexterm>
41436 </para>
41437 <informaltable frame="all">
41438 <tgroup cols="4" colsep="0" rowsep="0">
41439 <colspec colwidth="8*" align="left"/>
41440 <colspec colwidth="6*" align="center"/>
41441 <colspec colwidth="6*" align="center"/>
41442 <colspec colwidth="6*" align="right"/>
41443 <tbody>
41444 <row>
41445 <entry><option>skip_syntax_errors</option></entry>
41446 <entry>Use: <emphasis>redirect</emphasis></entry>
41447 <entry>Type: <emphasis>boolean</emphasis></entry>
41448 <entry>Default: <emphasis>false</emphasis></entry>
41449 </row>
41450 </tbody>
41451 </tgroup>
41452 </informaltable>
41453 <para>
41454 <indexterm role="concept">
41455 <primary>forward file</primary>
41456 <secondary>broken</secondary>
41457 </indexterm>
41458 <indexterm role="concept">
41459 <primary>address redirection</primary>
41460 <secondary>broken files</secondary>
41461 </indexterm>
41462 <indexterm role="concept">
41463 <primary>alias file</primary>
41464 <secondary>broken</secondary>
41465 </indexterm>
41466 <indexterm role="concept">
41467 <primary>broken alias or forward files</primary>
41468 </indexterm>
41469 <indexterm role="concept">
41470 <primary>ignoring faulty addresses</primary>
41471 </indexterm>
41472 <indexterm role="concept">
41473 <primary>skipping faulty addresses</primary>
41474 </indexterm>
41475 <indexterm role="concept">
41476 <primary>error</primary>
41477 <secondary>skipping bad syntax</secondary>
41478 </indexterm>
41479 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
41480 non-filter redirection data are skipped, and each failing address is logged. If
41481 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
41482 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
41483 are expanded and placed at the head of the error message generated by
41484 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
41485 be the same address as the generic <option>errors_to</option> option. The
41486 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
41487 </para>
41488 <para>
41489 If all the addresses in a redirection list are skipped because of syntax
41490 errors, the router declines to handle the original address, and it is passed to
41491 the following routers.
41492 </para>
41493 <para>
41494 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
41495 error in the filter causes filtering to be abandoned without any action being
41496 taken. The incident is logged, and the router declines to handle the address,
41497 so it is passed to the following routers.
41498 </para>
41499 <para>
41500 <indexterm role="concept">
41501 <primary>Sieve filter</primary>
41502 <secondary>syntax errors in</secondary>
41503 </indexterm>
41504 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
41505 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
41506 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
41507 </para>
41508 <para>
41509 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
41510 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
41511 option, used with an address that does not get redirected, can be used to
41512 notify users of these errors, by means of a router like this:
41513 </para>
41514 <literallayout class="monospaced">
41515 userforward:
41516   driver = redirect
41517   allow_filter
41518   check_local_user
41519   file = $home/.forward
41520   file_transport = address_file
41521   pipe_transport = address_pipe
41522   reply_transport = address_reply
41523   no_verify
41524   skip_syntax_errors
41525   syntax_errors_to = real-$local_part@$domain
41526   syntax_errors_text = \
41527    This is an automatically generated message. An error has\n\
41528    been found in your .forward file. Details of the error are\n\
41529    reported below. While this error persists, you will receive\n\
41530    a copy of this message for every message that is addressed\n\
41531    to you. If your .forward file is a filter file, or if it is\n\
41532    a non-filter file containing no valid forwarding addresses,\n\
41533    a copy of each incoming message will be put in your normal\n\
41534    mailbox. If a non-filter file contains at least one valid\n\
41535    forwarding address, forwarding to the valid addresses will\n\
41536    happen, and those will be the only deliveries that occur.
41537 </literallayout>
41538 <para>
41539 You also need a router to ensure that local addresses that are prefixed by
41540 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
41541 put this immediately before the <command>userforward</command> router:
41542 </para>
41543 <literallayout class="monospaced">
41544 real_localuser:
41545   driver = accept
41546   check_local_user
41547   local_part_prefix = real-
41548   transport = local_delivery
41549 </literallayout>
41550 <para>
41551 For security, it would probably be a good idea to restrict the use of this
41552 router to locally-generated messages, using a condition such as this:
41553 </para>
41554 <literallayout class="monospaced">
41555   condition = ${if match {$sender_host_address}\
41556                          {\N^(|127\.0\.0\.1)$\N}}
41557 </literallayout>
41558 <para>
41559 <indexterm role="option">
41560 <primary><option>syntax_errors_text</option></primary>
41561 </indexterm>
41562 </para>
41563 <informaltable frame="all">
41564 <tgroup cols="4" colsep="0" rowsep="0">
41565 <colspec colwidth="8*" align="left"/>
41566 <colspec colwidth="6*" align="center"/>
41567 <colspec colwidth="6*" align="center"/>
41568 <colspec colwidth="6*" align="right"/>
41569 <tbody>
41570 <row>
41571 <entry><option>syntax_errors_text</option></entry>
41572 <entry>Use: <emphasis>redirect</emphasis></entry>
41573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41574 <entry>Default: <emphasis>unset</emphasis></entry>
41575 </row>
41576 </tbody>
41577 </tgroup>
41578 </informaltable>
41579 <para>
41580 See <option>skip_syntax_errors</option> above.
41581 </para>
41582 <para>
41583 <indexterm role="option">
41584 <primary><option>syntax_errors_to</option></primary>
41585 </indexterm>
41586 </para>
41587 <informaltable frame="all">
41588 <tgroup cols="4" colsep="0" rowsep="0">
41589 <colspec colwidth="8*" align="left"/>
41590 <colspec colwidth="6*" align="center"/>
41591 <colspec colwidth="6*" align="center"/>
41592 <colspec colwidth="6*" align="right"/>
41593 <tbody>
41594 <row>
41595 <entry><option>syntax_errors_to</option></entry>
41596 <entry>Use: <emphasis>redirect</emphasis></entry>
41597 <entry>Type: <emphasis>string</emphasis></entry>
41598 <entry>Default: <emphasis>unset</emphasis></entry>
41599 </row>
41600 </tbody>
41601 </tgroup>
41602 </informaltable>
41603 <para>
41604 See <option>skip_syntax_errors</option> above.
41605 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
41606 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
41607 </para>
41608 </section>
41609 </chapter>
41610
41611 <chapter id="CHAPenvironment">
41612 <title>Environment for running local transports</title>
41613 <titleabbrev>Environment for local transports</titleabbrev>
41614 <para>
41615 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
41616 <primary>local transports</primary>
41617 <secondary>environment for</secondary>
41618 </indexterm>
41619 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
41620 <primary>environment</primary>
41621 <secondary>local transports</secondary>
41622 </indexterm>
41623 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
41624 <primary>transport</primary>
41625 <secondary>local; environment for</secondary>
41626 </indexterm>
41627 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
41628 transport can be thought of as similar to a pipe.) Exim always runs transports
41629 in subprocesses, under specified uids and gids. Typical deliveries to local
41630 mailboxes run under the uid and gid of the local user.
41631 </para>
41632 <para>
41633 Exim also sets a specific current directory while running the transport; for
41634 some transports a home directory setting is also relevant. The <command>pipe</command>
41635 transport is the only one that sets up environment variables; see section
41636 <xref linkend="SECTpipeenv"/> for details.
41637 </para>
41638 <para>
41639 The values used for the uid, gid, and the directories may come from several
41640 different places. In many cases, the router that handles the address associates
41641 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
41642 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
41643 configuration, and these override anything that comes from the router.
41644 </para>
41645 <section id="SECID131">
41646 <title>Concurrent deliveries</title>
41647 <para>
41648 <indexterm role="concept">
41649 <primary>concurrent deliveries</primary>
41650 </indexterm>
41651 <indexterm role="concept">
41652 <primary>simultaneous deliveries</primary>
41653 </indexterm>
41654 If two different messages for the same local recipient arrive more or less
41655 simultaneously, the two delivery processes are likely to run concurrently. When
41656 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
41657 rules to stop concurrent processes from writing to the same file at the same
41658 time.
41659 </para>
41660 <para>
41661 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
41662 locking that is needed. Here is a silly example:
41663 </para>
41664 <literallayout class="monospaced">
41665 my_transport:
41666   driver = pipe
41667   command = /bin/sh -c 'cat &gt;&gt;/some/file'
41668 </literallayout>
41669 <para>
41670 This is supposed to write the message at the end of the file. However, if two
41671 messages arrive at the same time, the file will be scrambled. You can use the
41672 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
41673 file using the same algorithm that Exim itself uses.
41674 </para>
41675 </section>
41676 <section id="SECTenvuidgid">
41677 <title>Uids and gids</title>
41678 <para>
41679 <indexterm role="concept">
41680 <primary>local transports</primary>
41681 <secondary>uid and gid</secondary>
41682 </indexterm>
41683 <indexterm role="concept">
41684 <primary>transport</primary>
41685 <secondary>local; uid and gid</secondary>
41686 </indexterm>
41687 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
41688 overrides any group that the router set in the address, even if <option>user</option> is not
41689 set for the transport. This makes it possible, for example, to run local mail
41690 delivery under the uid of the recipient (set by the router), but in a special
41691 group (set by the transport). For example:
41692 </para>
41693 <literallayout class="monospaced">
41694 # Routers ...
41695 # User/group are set by check_local_user in this router
41696 local_users:
41697   driver = accept
41698   check_local_user
41699   transport = group_delivery
41700
41701 # Transports ...
41702 # This transport overrides the group
41703 group_delivery:
41704   driver = appendfile
41705   file = /var/spool/mail/$local_part_data
41706   group = mail
41707 </literallayout>
41708 <para>
41709 If <option>user</option> is set for a transport, its value overrides what is set in the
41710 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
41711 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
41712 set.
41713 </para>
41714 <para>
41715 <indexterm role="option">
41716 <primary><option>initgroups</option></primary>
41717 </indexterm>
41718 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
41719 function is called for the groups associated with that uid if the
41720 <option>initgroups</option> option is set for the transport. When the uid is not specified
41721 by the transport, but is associated with the address by a router, the option
41722 for calling <function>initgroups()</function> is taken from the router configuration.
41723 </para>
41724 <para>
41725 <indexterm role="concept">
41726 <primary><command>pipe</command> transport</primary>
41727 <secondary>uid for</secondary>
41728 </indexterm>
41729 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
41730 is set and <option>user</option> is not set, the uid of the process that called Exim to
41731 receive the message is used, and if <option>group</option> is not set, the corresponding
41732 original gid is also used.
41733 </para>
41734 <para>
41735 This is the detailed preference order for obtaining a gid; the first of the
41736 following that is set is used:
41737 </para>
41738 <itemizedlist>
41739 <listitem>
41740 <para>
41741 A <option>group</option> setting of the transport;
41742 </para>
41743 </listitem>
41744 <listitem>
41745 <para>
41746 A <option>group</option> setting of the router;
41747 </para>
41748 </listitem>
41749 <listitem>
41750 <para>
41751 A gid associated with a user setting of the router, either as a result of
41752 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
41753 </para>
41754 </listitem>
41755 <listitem>
41756 <para>
41757 The group associated with a non-numeric <option>user</option> setting of the transport;
41758 </para>
41759 </listitem>
41760 <listitem>
41761 <para>
41762 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
41763 the uid is the creator&#x2019;s uid;
41764 </para>
41765 </listitem>
41766 <listitem>
41767 <para>
41768 The Exim gid if the Exim uid is being used as a default.
41769 </para>
41770 </listitem>
41771 </itemizedlist>
41772 <para>
41773 If, for example, the user is specified numerically on the router and there are
41774 no group settings, no gid is available. In this situation, an error occurs.
41775 This is different for the uid, for which there always is an ultimate default.
41776 The first of the following that is set is used:
41777 </para>
41778 <itemizedlist>
41779 <listitem>
41780 <para>
41781 A <option>user</option> setting of the transport;
41782 </para>
41783 </listitem>
41784 <listitem>
41785 <para>
41786 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
41787 </para>
41788 </listitem>
41789 <listitem>
41790 <para>
41791 A <option>user</option> setting of the router;
41792 </para>
41793 </listitem>
41794 <listitem>
41795 <para>
41796 A <option>check_local_user</option> setting of the router;
41797 </para>
41798 </listitem>
41799 <listitem>
41800 <para>
41801 The Exim uid.
41802 </para>
41803 </listitem>
41804 </itemizedlist>
41805 <para>
41806 Of course, an error will still occur if the uid that is chosen is on the
41807 <option>never_users</option> list.
41808 </para>
41809 </section>
41810 <section id="SECID132">
41811 <title>Current and home directories</title>
41812 <para>
41813 <indexterm role="concept">
41814 <primary>current directory for local transport</primary>
41815 </indexterm>
41816 <indexterm role="concept">
41817 <primary>home directory</primary>
41818 <secondary>for local transport</secondary>
41819 </indexterm>
41820 <indexterm role="concept">
41821 <primary>transport</primary>
41822 <secondary>local; home directory for</secondary>
41823 </indexterm>
41824 <indexterm role="concept">
41825 <primary>transport</primary>
41826 <secondary>local; current directory for</secondary>
41827 </indexterm>
41828 Routers may set current and home directories for local transports by means of
41829 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
41830 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
41831 are set, they override the router&#x2019;s values. In detail, the home directory
41832 for a local transport is taken from the first of these values that is set:
41833 </para>
41834 <itemizedlist>
41835 <listitem>
41836 <para>
41837 The <option>home_directory</option> option on the transport;
41838 </para>
41839 </listitem>
41840 <listitem>
41841 <para>
41842 The <option>transport_home_directory</option> option on the router;
41843 </para>
41844 </listitem>
41845 <listitem>
41846 <para>
41847 The password data if <option>check_local_user</option> is set on the router;
41848 </para>
41849 </listitem>
41850 <listitem>
41851 <para>
41852 The <option>router_home_directory</option> option on the router.
41853 </para>
41854 </listitem>
41855 </itemizedlist>
41856 <para>
41857 The current directory is taken from the first of these values that is set:
41858 </para>
41859 <itemizedlist>
41860 <listitem>
41861 <para>
41862 The <option>current_directory</option> option on the transport;
41863 </para>
41864 </listitem>
41865 <listitem>
41866 <para>
41867 The <option>transport_current_directory</option> option on the router.
41868 </para>
41869 </listitem>
41870 </itemizedlist>
41871 <para>
41872 If neither the router nor the transport sets a current directory, Exim uses the
41873 value of the home directory, if it is set. Otherwise it sets the current
41874 directory to <filename>/</filename> before running a local transport.
41875 </para>
41876 </section>
41877 <section id="SECID133">
41878 <title>Expansion variables derived from the address</title>
41879 <para>
41880 <indexterm role="variable">
41881 <primary><varname>$domain</varname></primary>
41882 </indexterm>
41883 <indexterm role="variable">
41884 <primary><varname>$local_part</varname></primary>
41885 </indexterm>
41886 <indexterm role="variable">
41887 <primary><varname>$original_domain</varname></primary>
41888 </indexterm>
41889 Normally a local delivery is handling a single address, and in that case the
41890 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
41891 deliveries. However, in some circumstances more than one address may be handled
41892 at once (for example, while writing batch SMTP for onward transmission by some
41893 other means). In this case, the variables associated with the local part are
41894 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
41895 and <varname>$original_domain</varname> is never set.
41896 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
41897 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
41898 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
41899 </para>
41900 </section>
41901 </chapter>
41902
41903 <chapter id="CHAPtransportgeneric">
41904 <title>Generic options for transports</title>
41905 <para>
41906 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
41907 <primary>generic options</primary>
41908 <secondary>transport</secondary>
41909 </indexterm>
41910 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
41911 <primary>options</primary>
41912 <secondary>generic; for transports</secondary>
41913 </indexterm>
41914 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
41915 <primary>transport</primary>
41916 <secondary>generic options for</secondary>
41917 </indexterm>
41918 </para>
41919 <para revisionflag="changed">
41920 The name of a transport is limited to be 64 ASCII characters long;
41921 prior to Exim 4.95 names would be silently truncated at this length, but now
41922 it is enforced.
41923 </para>
41924 <para>
41925 The following generic options apply to all transports:
41926 </para>
41927 <para>
41928 <indexterm role="option">
41929 <primary><option>body_only</option></primary>
41930 </indexterm>
41931 </para>
41932 <informaltable frame="all">
41933 <tgroup cols="4" colsep="0" rowsep="0">
41934 <colspec colwidth="8*" align="left"/>
41935 <colspec colwidth="6*" align="center"/>
41936 <colspec colwidth="6*" align="center"/>
41937 <colspec colwidth="6*" align="right"/>
41938 <tbody>
41939 <row>
41940 <entry><option>body_only</option></entry>
41941 <entry>Use: <emphasis>transports</emphasis></entry>
41942 <entry>Type: <emphasis>boolean</emphasis></entry>
41943 <entry>Default: <emphasis>false</emphasis></entry>
41944 </row>
41945 </tbody>
41946 </tgroup>
41947 </informaltable>
41948 <para>
41949 <indexterm role="concept">
41950 <primary>transport</primary>
41951 <secondary>body only</secondary>
41952 </indexterm>
41953 <indexterm role="concept">
41954 <primary>message</primary>
41955 <secondary>transporting body only</secondary>
41956 </indexterm>
41957 <indexterm role="concept">
41958 <primary>body of message</primary>
41959 <secondary>transporting</secondary>
41960 </indexterm>
41961 If this option is set, the message&#x2019;s headers are not transported. It is
41962 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
41963 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
41964 <option>message_suffix</option> should be checked, because this option does not
41965 automatically suppress them.
41966 </para>
41967 <para>
41968 <indexterm role="option">
41969 <primary><option>current_directory</option></primary>
41970 </indexterm>
41971 </para>
41972 <informaltable frame="all">
41973 <tgroup cols="4" colsep="0" rowsep="0">
41974 <colspec colwidth="8*" align="left"/>
41975 <colspec colwidth="6*" align="center"/>
41976 <colspec colwidth="6*" align="center"/>
41977 <colspec colwidth="6*" align="right"/>
41978 <tbody>
41979 <row>
41980 <entry><option>current_directory</option></entry>
41981 <entry>Use: <emphasis>transports</emphasis></entry>
41982 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41983 <entry>Default: <emphasis>unset</emphasis></entry>
41984 </row>
41985 </tbody>
41986 </tgroup>
41987 </informaltable>
41988 <para>
41989 <indexterm role="concept">
41990 <primary>transport</primary>
41991 <secondary>current directory for</secondary>
41992 </indexterm>
41993 This specifies the current directory that is to be set while running the
41994 transport, overriding any value that may have been set by the router.
41995 If the expansion fails for any reason, including forced failure, an error is
41996 logged, and delivery is deferred.
41997 </para>
41998 <para>
41999 <indexterm role="option">
42000 <primary><option>disable_logging</option></primary>
42001 </indexterm>
42002 </para>
42003 <informaltable frame="all">
42004 <tgroup cols="4" colsep="0" rowsep="0">
42005 <colspec colwidth="8*" align="left"/>
42006 <colspec colwidth="6*" align="center"/>
42007 <colspec colwidth="6*" align="center"/>
42008 <colspec colwidth="6*" align="right"/>
42009 <tbody>
42010 <row>
42011 <entry><option>disable_logging</option></entry>
42012 <entry>Use: <emphasis>transports</emphasis></entry>
42013 <entry>Type: <emphasis>boolean</emphasis></entry>
42014 <entry>Default: <emphasis>false</emphasis></entry>
42015 </row>
42016 </tbody>
42017 </tgroup>
42018 </informaltable>
42019 <para>
42020 If this option is set true, nothing is logged for any
42021 deliveries by the transport or for any
42022 transport errors. You should not set this option unless you really, really know
42023 what you are doing.
42024 </para>
42025 <para>
42026 <indexterm role="option">
42027 <primary><option>debug_print</option></primary>
42028 </indexterm>
42029 </para>
42030 <informaltable frame="all">
42031 <tgroup cols="4" colsep="0" rowsep="0">
42032 <colspec colwidth="8*" align="left"/>
42033 <colspec colwidth="6*" align="center"/>
42034 <colspec colwidth="6*" align="center"/>
42035 <colspec colwidth="6*" align="right"/>
42036 <tbody>
42037 <row>
42038 <entry><option>debug_print</option></entry>
42039 <entry>Use: <emphasis>transports</emphasis></entry>
42040 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42041 <entry>Default: <emphasis>unset</emphasis></entry>
42042 </row>
42043 </tbody>
42044 </tgroup>
42045 </informaltable>
42046 <para>
42047 <indexterm role="concept">
42048 <primary>testing</primary>
42049 <secondary>variables in drivers</secondary>
42050 </indexterm>
42051 If this option is set and debugging is enabled (see the <option>-d</option> command line
42052 option), the string is expanded and included in the debugging output when the
42053 transport is run.
42054 If expansion of the string fails, the error message is written to the debugging
42055 output, and Exim carries on processing.
42056 This facility is provided to help with checking out the values of variables and
42057 so on when debugging driver configurations. For example, if a <option>headers_add</option>
42058 option is not working properly, <option>debug_print</option> could be used to output the
42059 variables it references. A newline is added to the text if it does not end with
42060 one.
42061 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
42062 transport and the router that called it.
42063 </para>
42064 <para>
42065 <indexterm role="option">
42066 <primary><option>delivery_date_add</option></primary>
42067 </indexterm>
42068 </para>
42069 <informaltable frame="all">
42070 <tgroup cols="4" colsep="0" rowsep="0">
42071 <colspec colwidth="8*" align="left"/>
42072 <colspec colwidth="6*" align="center"/>
42073 <colspec colwidth="6*" align="center"/>
42074 <colspec colwidth="6*" align="right"/>
42075 <tbody>
42076 <row>
42077 <entry><option>delivery_date_add</option></entry>
42078 <entry>Use: <emphasis>transports</emphasis></entry>
42079 <entry>Type: <emphasis>boolean</emphasis></entry>
42080 <entry>Default: <emphasis>false</emphasis></entry>
42081 </row>
42082 </tbody>
42083 </tgroup>
42084 </informaltable>
42085 <para>
42086 <indexterm role="concept">
42087 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
42088 </indexterm>
42089 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
42090 This gives the actual time the delivery was made. As this is not a standard
42091 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
42092 requests its removal from incoming messages, so that delivered messages can
42093 safely be resent to other recipients.
42094 </para>
42095 <para>
42096 <indexterm role="option">
42097 <primary><option>driver</option></primary>
42098 </indexterm>
42099 </para>
42100 <informaltable frame="all">
42101 <tgroup cols="4" colsep="0" rowsep="0">
42102 <colspec colwidth="8*" align="left"/>
42103 <colspec colwidth="6*" align="center"/>
42104 <colspec colwidth="6*" align="center"/>
42105 <colspec colwidth="6*" align="right"/>
42106 <tbody>
42107 <row>
42108 <entry><option>driver</option></entry>
42109 <entry>Use: <emphasis>transports</emphasis></entry>
42110 <entry>Type: <emphasis>string</emphasis></entry>
42111 <entry>Default: <emphasis>unset</emphasis></entry>
42112 </row>
42113 </tbody>
42114 </tgroup>
42115 </informaltable>
42116 <para>
42117 This specifies which of the available transport drivers is to be used.
42118 There is no default, and this option must be set for every transport.
42119 </para>
42120 <para>
42121 <indexterm role="option">
42122 <primary><option>envelope_to_add</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>envelope_to_add</option></entry>
42134 <entry>Use: <emphasis>transports</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><emphasis>Envelope-to:</emphasis> header line</primary>
42144 </indexterm>
42145 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
42146 This gives the original address(es) in the incoming envelope that caused this
42147 delivery to happen. More than one address may be present if the transport is
42148 configured to handle several addresses at once, or if more than one original
42149 address was redirected to the same final address. As this is not a standard
42150 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
42151 its removal from incoming messages, so that delivered messages can safely be
42152 resent to other recipients.
42153 </para>
42154 <para>
42155 <indexterm role="option">
42156 <primary><option>event_action</option></primary>
42157 </indexterm>
42158 </para>
42159 <informaltable frame="all">
42160 <tgroup cols="4" colsep="0" rowsep="0">
42161 <colspec colwidth="8*" align="left"/>
42162 <colspec colwidth="6*" align="center"/>
42163 <colspec colwidth="6*" align="center"/>
42164 <colspec colwidth="6*" align="right"/>
42165 <tbody>
42166 <row>
42167 <entry><option>event_action</option></entry>
42168 <entry>Use: <emphasis>transports</emphasis></entry>
42169 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42170 <entry>Default: <emphasis>unset</emphasis></entry>
42171 </row>
42172 </tbody>
42173 </tgroup>
42174 </informaltable>
42175 <para>
42176 <indexterm role="concept">
42177 <primary>events</primary>
42178 </indexterm>
42179 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
42180 For details see chapter <xref linkend="CHAPevents"/>.
42181 </para>
42182 <para>
42183 <indexterm role="option">
42184 <primary><option>group</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>group</option></entry>
42196 <entry>Use: <emphasis>transports</emphasis></entry>
42197 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42198 <entry>Default: <emphasis>Exim group</emphasis></entry>
42199 </row>
42200 </tbody>
42201 </tgroup>
42202 </informaltable>
42203 <para>
42204 <indexterm role="concept">
42205 <primary>transport</primary>
42206 <secondary>group; specifying</secondary>
42207 </indexterm>
42208 This option specifies a gid for running the transport process, overriding any
42209 value that the router supplies, and also overriding any value associated with
42210 <option>user</option> (see below).
42211 </para>
42212 <para>
42213 <indexterm role="option">
42214 <primary><option>headers_add</option></primary>
42215 </indexterm>
42216 </para>
42217 <informaltable frame="all">
42218 <tgroup cols="4" colsep="0" rowsep="0">
42219 <colspec colwidth="8*" align="left"/>
42220 <colspec colwidth="6*" align="center"/>
42221 <colspec colwidth="6*" align="center"/>
42222 <colspec colwidth="6*" align="right"/>
42223 <tbody>
42224 <row>
42225 <entry><option>headers_add</option></entry>
42226 <entry>Use: <emphasis>transports</emphasis></entry>
42227 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
42228 <entry>Default: <emphasis>unset</emphasis></entry>
42229 </row>
42230 </tbody>
42231 </tgroup>
42232 </informaltable>
42233 <para>
42234 <indexterm role="concept">
42235 <primary>header lines</primary>
42236 <secondary>adding in transport</secondary>
42237 </indexterm>
42238 <indexterm role="concept">
42239 <primary>transport</primary>
42240 <secondary>header lines; adding</secondary>
42241 </indexterm>
42242 This option specifies a list of text headers,
42243 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
42244 which are (separately) expanded and added to the header
42245 portion of a message as it is transported, as described in section
42246 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
42247 routers. If the result of the expansion is an empty string, or if the expansion
42248 is forced to fail, no action is taken. Other expansion failures are treated as
42249 errors and cause the delivery to be deferred.
42250 </para>
42251 <para>
42252 Unlike most options, <option>headers_add</option> can be specified multiple times
42253 for a transport; all listed headers are added.
42254 </para>
42255 <para>
42256 <indexterm role="option">
42257 <primary><option>headers_only</option></primary>
42258 </indexterm>
42259 </para>
42260 <informaltable frame="all">
42261 <tgroup cols="4" colsep="0" rowsep="0">
42262 <colspec colwidth="8*" align="left"/>
42263 <colspec colwidth="6*" align="center"/>
42264 <colspec colwidth="6*" align="center"/>
42265 <colspec colwidth="6*" align="right"/>
42266 <tbody>
42267 <row>
42268 <entry><option>headers_only</option></entry>
42269 <entry>Use: <emphasis>transports</emphasis></entry>
42270 <entry>Type: <emphasis>boolean</emphasis></entry>
42271 <entry>Default: <emphasis>false</emphasis></entry>
42272 </row>
42273 </tbody>
42274 </tgroup>
42275 </informaltable>
42276 <para>
42277 <indexterm role="concept">
42278 <primary>transport</primary>
42279 <secondary>header lines only</secondary>
42280 </indexterm>
42281 <indexterm role="concept">
42282 <primary>message</primary>
42283 <secondary>transporting headers only</secondary>
42284 </indexterm>
42285 <indexterm role="concept">
42286 <primary>header lines</primary>
42287 <secondary>transporting</secondary>
42288 </indexterm>
42289 If this option is set, the message&#x2019;s body is not transported. It is mutually
42290 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
42291 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
42292 checked, since this option does not automatically suppress them.
42293 </para>
42294 <para>
42295 <indexterm role="option">
42296 <primary><option>headers_remove</option></primary>
42297 </indexterm>
42298 </para>
42299 <informaltable frame="all">
42300 <tgroup cols="4" colsep="0" rowsep="0">
42301 <colspec colwidth="8*" align="left"/>
42302 <colspec colwidth="6*" align="center"/>
42303 <colspec colwidth="6*" align="center"/>
42304 <colspec colwidth="6*" align="right"/>
42305 <tbody>
42306 <row>
42307 <entry><option>headers_remove</option></entry>
42308 <entry>Use: <emphasis>transports</emphasis></entry>
42309 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
42310 <entry>Default: <emphasis>unset</emphasis></entry>
42311 </row>
42312 </tbody>
42313 </tgroup>
42314 </informaltable>
42315 <para>
42316 <indexterm role="concept">
42317 <primary>header lines</primary>
42318 <secondary>removing</secondary>
42319 </indexterm>
42320 <indexterm role="concept">
42321 <primary>transport</primary>
42322 <secondary>header lines; removing</secondary>
42323 </indexterm>
42324 This option specifies a list of text headers,
42325 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
42326 to be removed from the message.
42327 However, the option has no effect when an address is just being verified.
42328 Each list item is separately expanded.
42329 If the result of the expansion is an empty string, or if the expansion
42330 is forced to fail, no action is taken. Other expansion failures are treated as
42331 errors and cause the delivery to be deferred.
42332 </para>
42333 <para revisionflag="changed">
42334 If an item ends in *, it will match any header with the given prefix.
42335 </para>
42336 <para>
42337 Matching headers are omitted from the message as it is transported, as described
42338 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
42339 routers.
42340 </para>
42341 <para>
42342 Unlike most options, <option>headers_remove</option> can be specified multiple times
42343 for a transport; all listed headers are removed.
42344 </para>
42345 <para>
42346 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
42347 items that contain a list separator must have it doubled.
42348 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
42349 </para>
42350 <para>
42351 <indexterm role="option">
42352 <primary><option>headers_rewrite</option></primary>
42353 </indexterm>
42354 </para>
42355 <informaltable frame="all">
42356 <tgroup cols="4" colsep="0" rowsep="0">
42357 <colspec colwidth="8*" align="left"/>
42358 <colspec colwidth="6*" align="center"/>
42359 <colspec colwidth="6*" align="center"/>
42360 <colspec colwidth="6*" align="right"/>
42361 <tbody>
42362 <row>
42363 <entry><option>headers_rewrite</option></entry>
42364 <entry>Use: <emphasis>transports</emphasis></entry>
42365 <entry>Type: <emphasis>string</emphasis></entry>
42366 <entry>Default: <emphasis>unset</emphasis></entry>
42367 </row>
42368 </tbody>
42369 </tgroup>
42370 </informaltable>
42371 <para>
42372 <indexterm role="concept">
42373 <primary>transport</primary>
42374 <secondary>header lines; rewriting</secondary>
42375 </indexterm>
42376 <indexterm role="concept">
42377 <primary>rewriting</primary>
42378 <secondary>at transport time</secondary>
42379 </indexterm>
42380 This option allows addresses in header lines to be rewritten at transport time,
42381 that is, as the message is being copied to its destination. The contents of the
42382 option are a colon-separated list of rewriting rules. Each rule is in exactly
42383 the same form as one of the general rewriting rules that are applied when a
42384 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
42385 example,
42386 </para>
42387 <literallayout class="monospaced">
42388 headers_rewrite = a@b c@d f : \
42389                   x@y w@z
42390 </literallayout>
42391 <para>
42392 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
42393 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
42394 header lines just before they are written out at transport time, so they affect
42395 only those copies of the message that pass through the transport. However, only
42396 the message&#x2019;s original header lines, and any that were added by a system
42397 filter, are rewritten. If a router or transport adds header lines, they are not
42398 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
42399 envelope. You can change the return path using <option>return_path</option>, but you cannot
42400 change envelope recipients at this time.
42401 </para>
42402 <para>
42403 <indexterm role="option">
42404 <primary><option>home_directory</option></primary>
42405 </indexterm>
42406 </para>
42407 <informaltable frame="all">
42408 <tgroup cols="4" colsep="0" rowsep="0">
42409 <colspec colwidth="8*" align="left"/>
42410 <colspec colwidth="6*" align="center"/>
42411 <colspec colwidth="6*" align="center"/>
42412 <colspec colwidth="6*" align="right"/>
42413 <tbody>
42414 <row>
42415 <entry><option>home_directory</option></entry>
42416 <entry>Use: <emphasis>transports</emphasis></entry>
42417 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42418 <entry>Default: <emphasis>unset</emphasis></entry>
42419 </row>
42420 </tbody>
42421 </tgroup>
42422 </informaltable>
42423 <para>
42424 <indexterm role="concept">
42425 <primary>transport</primary>
42426 <secondary>home directory for</secondary>
42427 </indexterm>
42428 <indexterm role="variable">
42429 <primary><varname>$home</varname></primary>
42430 </indexterm>
42431 This option specifies a home directory setting for a local transport,
42432 overriding any value that may be set by the router. The home directory is
42433 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
42434 used as the current directory if no current directory is set by the
42435 <option>current_directory</option> option on the transport or the
42436 <option>transport_current_directory</option> option on the router. If the expansion fails
42437 for any reason, including forced failure, an error is logged, and delivery is
42438 deferred.
42439 </para>
42440 <para>
42441 <indexterm role="option">
42442 <primary><option>initgroups</option></primary>
42443 </indexterm>
42444 </para>
42445 <informaltable frame="all">
42446 <tgroup cols="4" colsep="0" rowsep="0">
42447 <colspec colwidth="8*" align="left"/>
42448 <colspec colwidth="6*" align="center"/>
42449 <colspec colwidth="6*" align="center"/>
42450 <colspec colwidth="6*" align="right"/>
42451 <tbody>
42452 <row>
42453 <entry><option>initgroups</option></entry>
42454 <entry>Use: <emphasis>transports</emphasis></entry>
42455 <entry>Type: <emphasis>boolean</emphasis></entry>
42456 <entry>Default: <emphasis>false</emphasis></entry>
42457 </row>
42458 </tbody>
42459 </tgroup>
42460 </informaltable>
42461 <para>
42462 <indexterm role="concept">
42463 <primary>additional groups</primary>
42464 </indexterm>
42465 <indexterm role="concept">
42466 <primary>groups</primary>
42467 <secondary>additional</secondary>
42468 </indexterm>
42469 <indexterm role="concept">
42470 <primary>transport</primary>
42471 <secondary>group; additional</secondary>
42472 </indexterm>
42473 If this option is true and the uid for the delivery process is provided by the
42474 transport, the <function>initgroups()</function> function is called when running the transport
42475 to ensure that any additional groups associated with the uid are set up.
42476 </para>
42477 <para>
42478 <indexterm role="option">
42479 <primary><option>max_parallel</option></primary>
42480 </indexterm>
42481 </para>
42482 <informaltable frame="all">
42483 <tgroup cols="4" colsep="0" rowsep="0">
42484 <colspec colwidth="8*" align="left"/>
42485 <colspec colwidth="6*" align="center"/>
42486 <colspec colwidth="6*" align="center"/>
42487 <colspec colwidth="6*" align="right"/>
42488 <tbody>
42489 <row>
42490 <entry><option>max_parallel</option></entry>
42491 <entry>Use: <emphasis>transports</emphasis></entry>
42492 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
42493 <entry>Default: <emphasis>unset</emphasis></entry>
42494 </row>
42495 </tbody>
42496 </tgroup>
42497 </informaltable>
42498 <para>
42499 <indexterm role="concept">
42500 <primary>limit</primary>
42501 <secondary>transport parallelism</secondary>
42502 </indexterm>
42503 <indexterm role="concept">
42504 <primary>transport</primary>
42505 <secondary>parallel processes</secondary>
42506 </indexterm>
42507 <indexterm role="concept">
42508 <primary>transport</primary>
42509 <secondary>concurrency limit</secondary>
42510 </indexterm>
42511 <indexterm role="concept">
42512 <primary>delivery</primary>
42513 <secondary>parallelism for transport</secondary>
42514 </indexterm>
42515 If this option is set and expands to an integer greater than zero
42516 it limits the number of concurrent runs of the transport.
42517 The control does not apply to shadow transports.
42518 </para>
42519 <para>
42520 <indexterm role="concept">
42521 <primary>hints database</primary>
42522 <secondary>transport concurrency control</secondary>
42523 </indexterm>
42524 Exim implements this control by means of a hints database in which a record is
42525 incremented whenever a transport process is being created. The record
42526 is decremented and possibly removed when the process terminates.
42527 Obviously there is scope for
42528 records to get left lying around if there is a system or program crash. To
42529 guard against this, Exim ignores any records that are more than six hours old.
42530 </para>
42531 <para>
42532 If you use this option, you should also arrange to delete the
42533 relevant hints database whenever your system reboots. The names of the files
42534 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
42535 may be one or two files, depending on the type of DBM in use. The same files
42536 are used for ETRN and smtp transport serialization.
42537 </para>
42538 <para>
42539 <indexterm role="option">
42540 <primary><option>message_size_limit</option></primary>
42541 </indexterm>
42542 </para>
42543 <informaltable frame="all">
42544 <tgroup cols="4" colsep="0" rowsep="0">
42545 <colspec colwidth="8*" align="left"/>
42546 <colspec colwidth="6*" align="center"/>
42547 <colspec colwidth="6*" align="center"/>
42548 <colspec colwidth="6*" align="right"/>
42549 <tbody>
42550 <row>
42551 <entry><option>message_size_limit</option></entry>
42552 <entry>Use: <emphasis>transports</emphasis></entry>
42553 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42554 <entry>Default: <emphasis>0</emphasis></entry>
42555 </row>
42556 </tbody>
42557 </tgroup>
42558 </informaltable>
42559 <para>
42560 <indexterm role="concept">
42561 <primary>limit</primary>
42562 <secondary>message size per transport</secondary>
42563 </indexterm>
42564 <indexterm role="concept">
42565 <primary>size</primary>
42566 <secondary>of message, limit</secondary>
42567 </indexterm>
42568 <indexterm role="concept">
42569 <primary>transport</primary>
42570 <secondary>message size; limiting</secondary>
42571 </indexterm>
42572 This option controls the size of messages passed through the transport. It is
42573 expanded before use; the result of the expansion must be a sequence of decimal
42574 digits, optionally followed by K or M. If the expansion fails for any reason,
42575 including forced failure, or if the result is not of the required form,
42576 delivery is deferred. If the value is greater than zero and the size of a
42577 message exceeds this limit, the address is failed. If there is any chance that
42578 the resulting bounce message could be routed to the same transport, you should
42579 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
42580 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
42581 delivered.
42582 </para>
42583 <para>
42584 <indexterm role="option">
42585 <primary><option>rcpt_include_affixes</option></primary>
42586 </indexterm>
42587 </para>
42588 <informaltable frame="all">
42589 <tgroup cols="4" colsep="0" rowsep="0">
42590 <colspec colwidth="8*" align="left"/>
42591 <colspec colwidth="6*" align="center"/>
42592 <colspec colwidth="6*" align="center"/>
42593 <colspec colwidth="6*" align="right"/>
42594 <tbody>
42595 <row>
42596 <entry><option>rcpt_include_affixes</option></entry>
42597 <entry>Use: <emphasis>transports</emphasis></entry>
42598 <entry>Type: <emphasis>boolean</emphasis></entry>
42599 <entry>Default: <emphasis>false</emphasis></entry>
42600 </row>
42601 </tbody>
42602 </tgroup>
42603 </informaltable>
42604 <para>
42605 <indexterm role="concept">
42606 <primary>prefix</primary>
42607 <secondary>for local part, including in envelope</secondary>
42608 </indexterm>
42609 <indexterm role="concept">
42610 <primary>suffix for local part</primary>
42611 <secondary>including in envelope</secondary>
42612 </indexterm>
42613 <indexterm role="concept">
42614 <primary>local part</primary>
42615 <secondary>prefix</secondary>
42616 </indexterm>
42617 <indexterm role="concept">
42618 <primary>local part</primary>
42619 <secondary>suffix</secondary>
42620 </indexterm>
42621 When this option is false (the default), and an address that has had any
42622 affixes (prefixes or suffixes) removed from the local part is delivered by any
42623 form of SMTP or LMTP, the affixes are not included. For example, if a router
42624 that contains
42625 </para>
42626 <literallayout class="monospaced">
42627 local_part_prefix = *-
42628 </literallayout>
42629 <para>
42630 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
42631 is delivered with
42632 </para>
42633 <literallayout class="monospaced">
42634 RCPT TO:&lt;xyz@some.domain&gt;
42635 </literallayout>
42636 <para>
42637 This is also the case when an ACL-time callout is being used to verify a
42638 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
42639 whole local part is included in the RCPT command. This option applies to BSMTP
42640 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
42641 <command>lmtp</command> and <command>smtp</command> transports.
42642 </para>
42643 <para>
42644 <indexterm role="option">
42645 <primary><option>retry_use_local_part</option></primary>
42646 </indexterm>
42647 </para>
42648 <informaltable frame="all">
42649 <tgroup cols="4" colsep="0" rowsep="0">
42650 <colspec colwidth="8*" align="left"/>
42651 <colspec colwidth="6*" align="center"/>
42652 <colspec colwidth="6*" align="center"/>
42653 <colspec colwidth="6*" align="right"/>
42654 <tbody>
42655 <row>
42656 <entry><option>retry_use_local_part</option></entry>
42657 <entry>Use: <emphasis>transports</emphasis></entry>
42658 <entry>Type: <emphasis>boolean</emphasis></entry>
42659 <entry>Default: <emphasis>see below</emphasis></entry>
42660 </row>
42661 </tbody>
42662 </tgroup>
42663 </informaltable>
42664 <para>
42665 <indexterm role="concept">
42666 <primary>hints database</primary>
42667 <secondary>retry keys</secondary>
42668 </indexterm>
42669 When a delivery suffers a temporary failure, a retry record is created
42670 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
42671 is based on the name and/or IP address of the failing remote host. For local
42672 deliveries, the key is normally the entire address, including both the local
42673 part and the domain. This is suitable for most common cases of local delivery
42674 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
42675 deliveries to that mailbox, not to the whole domain.
42676 </para>
42677 <para>
42678 However, in some special cases you may want to treat a temporary local delivery
42679 as a failure associated with the domain, and not with a particular local part.
42680 (For example, if you are storing all mail for some domain in files.) You can do
42681 this by setting <option>retry_use_local_part</option> false.
42682 </para>
42683 <para>
42684 For all the local transports, its default value is true. For remote transports,
42685 the default value is false for tidiness, but changing the value has no effect
42686 on a remote transport in the current implementation.
42687 </para>
42688 <para>
42689 <indexterm role="option">
42690 <primary><option>return_path</option></primary>
42691 </indexterm>
42692 </para>
42693 <informaltable frame="all">
42694 <tgroup cols="4" colsep="0" rowsep="0">
42695 <colspec colwidth="8*" align="left"/>
42696 <colspec colwidth="6*" align="center"/>
42697 <colspec colwidth="6*" align="center"/>
42698 <colspec colwidth="6*" align="right"/>
42699 <tbody>
42700 <row>
42701 <entry><option>return_path</option></entry>
42702 <entry>Use: <emphasis>transports</emphasis></entry>
42703 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42704 <entry>Default: <emphasis>unset</emphasis></entry>
42705 </row>
42706 </tbody>
42707 </tgroup>
42708 </informaltable>
42709 <para>
42710 <indexterm role="concept">
42711 <primary>envelope sender</primary>
42712 </indexterm>
42713 <indexterm role="concept">
42714 <primary>envelope from</primary>
42715 </indexterm>
42716 <indexterm role="concept">
42717 <primary>transport</primary>
42718 <secondary>return path; changing</secondary>
42719 </indexterm>
42720 <indexterm role="concept">
42721 <primary>return path</primary>
42722 <secondary>changing in transport</secondary>
42723 </indexterm>
42724 If this option is set, the string is expanded at transport time and replaces
42725 the existing return path (envelope sender) value in the copy of the message
42726 that is being delivered. An empty return path is permitted. This feature is
42727 designed for remote deliveries, where the value of this option is used in the
42728 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
42729 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
42730 header line, if one is added to the message (see the next option).
42731 </para>
42732 <para>
42733 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
42734 <option>return_path_on_delivery</option> to the log selector.
42735 </para>
42736 <para>
42737 <indexterm role="variable">
42738 <primary><varname>$return_path</varname></primary>
42739 </indexterm>
42740 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
42741 either the message&#x2019;s envelope sender, or an address set by the
42742 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
42743 replacement occurs; if it fails for another reason, delivery is deferred. This
42744 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
42745 section <xref linkend="SECTverp"/>.
42746 </para>
42747 <para>
42748 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
42749 remote server rejects a message at SMTP time, the bounce message is not sent to
42750 the value of this option. It is sent to the previously set errors address.
42751 This defaults to the incoming sender address, but can be changed by setting
42752 <option>errors_to</option> in a router.
42753 </para>
42754 <para>
42755 <indexterm role="option">
42756 <primary><option>return_path_add</option></primary>
42757 </indexterm>
42758 </para>
42759 <informaltable frame="all">
42760 <tgroup cols="4" colsep="0" rowsep="0">
42761 <colspec colwidth="8*" align="left"/>
42762 <colspec colwidth="6*" align="center"/>
42763 <colspec colwidth="6*" align="center"/>
42764 <colspec colwidth="6*" align="right"/>
42765 <tbody>
42766 <row>
42767 <entry><option>return_path_add</option></entry>
42768 <entry>Use: <emphasis>transports</emphasis></entry>
42769 <entry>Type: <emphasis>boolean</emphasis></entry>
42770 <entry>Default: <emphasis>false</emphasis></entry>
42771 </row>
42772 </tbody>
42773 </tgroup>
42774 </informaltable>
42775 <para>
42776 <indexterm role="concept">
42777 <primary><emphasis>Return-path:</emphasis> header line</primary>
42778 </indexterm>
42779 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
42780 Although the return path is normally available in the prefix line of BSD
42781 mailboxes, this is commonly not displayed by MUAs, and so the user does not
42782 have easy access to it.
42783 </para>
42784 <para>
42785 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
42786 the delivery SMTP server makes the final delivery</quote>. This implies that this
42787 header should not be present in incoming messages. Exim has a configuration
42788 option, <option>return_path_remove</option>, which requests removal of this header from
42789 incoming messages, so that delivered messages can safely be resent to other
42790 recipients.
42791 </para>
42792 <para>
42793 <indexterm role="option">
42794 <primary><option>shadow_condition</option></primary>
42795 </indexterm>
42796 </para>
42797 <informaltable frame="all">
42798 <tgroup cols="4" colsep="0" rowsep="0">
42799 <colspec colwidth="8*" align="left"/>
42800 <colspec colwidth="6*" align="center"/>
42801 <colspec colwidth="6*" align="center"/>
42802 <colspec colwidth="6*" align="right"/>
42803 <tbody>
42804 <row>
42805 <entry><option>shadow_condition</option></entry>
42806 <entry>Use: <emphasis>transports</emphasis></entry>
42807 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42808 <entry>Default: <emphasis>unset</emphasis></entry>
42809 </row>
42810 </tbody>
42811 </tgroup>
42812 </informaltable>
42813 <para>
42814 See <option>shadow_transport</option> below.
42815 </para>
42816 <para>
42817 <indexterm role="option">
42818 <primary><option>shadow_transport</option></primary>
42819 </indexterm>
42820 </para>
42821 <informaltable frame="all">
42822 <tgroup cols="4" colsep="0" rowsep="0">
42823 <colspec colwidth="8*" align="left"/>
42824 <colspec colwidth="6*" align="center"/>
42825 <colspec colwidth="6*" align="center"/>
42826 <colspec colwidth="6*" align="right"/>
42827 <tbody>
42828 <row>
42829 <entry><option>shadow_transport</option></entry>
42830 <entry>Use: <emphasis>transports</emphasis></entry>
42831 <entry>Type: <emphasis>string</emphasis></entry>
42832 <entry>Default: <emphasis>unset</emphasis></entry>
42833 </row>
42834 </tbody>
42835 </tgroup>
42836 </informaltable>
42837 <para>
42838 <indexterm role="concept">
42839 <primary>shadow transport</primary>
42840 </indexterm>
42841 <indexterm role="concept">
42842 <primary>transport</primary>
42843 <secondary>shadow</secondary>
42844 </indexterm>
42845 A local transport may set the <option>shadow_transport</option> option to the name of
42846 another local transport. Shadow remote transports are not supported.
42847 </para>
42848 <para>
42849 Whenever a delivery to the main transport succeeds, and either
42850 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
42851 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
42852 passed to the shadow transport, with the same delivery address or addresses. If
42853 expansion fails, no action is taken except that non-forced expansion failures
42854 cause a log line to be written.
42855 </para>
42856 <para>
42857 The result of the shadow transport is discarded and does not affect the
42858 subsequent processing of the message. Only a single level of shadowing is
42859 provided; the <option>shadow_transport</option> option is ignored on any transport when it
42860 is running as a shadow. Options concerned with output from pipes are also
42861 ignored. The log line for the successful delivery has an item added on the end,
42862 of the form
42863 </para>
42864 <literallayout class="monospaced">
42865 ST=&lt;shadow transport name&gt;
42866 </literallayout>
42867 <para>
42868 If the shadow transport did not succeed, the error message is put in
42869 parentheses afterwards. Shadow transports can be used for a number of different
42870 purposes, including keeping more detailed log information than Exim normally
42871 provides, and implementing automatic acknowledgment policies based on message
42872 headers that some sites insist on.
42873 </para>
42874 <para>
42875 <indexterm role="option">
42876 <primary><option>transport_filter</option></primary>
42877 </indexterm>
42878 </para>
42879 <informaltable frame="all">
42880 <tgroup cols="4" colsep="0" rowsep="0">
42881 <colspec colwidth="8*" align="left"/>
42882 <colspec colwidth="6*" align="center"/>
42883 <colspec colwidth="6*" align="center"/>
42884 <colspec colwidth="6*" align="right"/>
42885 <tbody>
42886 <row>
42887 <entry><option>transport_filter</option></entry>
42888 <entry>Use: <emphasis>transports</emphasis></entry>
42889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42890 <entry>Default: <emphasis>unset</emphasis></entry>
42891 </row>
42892 </tbody>
42893 </tgroup>
42894 </informaltable>
42895 <para>
42896 <indexterm role="concept">
42897 <primary>transport</primary>
42898 <secondary>filter</secondary>
42899 </indexterm>
42900 <indexterm role="concept">
42901 <primary>filter</primary>
42902 <secondary>transport filter</secondary>
42903 </indexterm>
42904 This option sets up a filtering (in the Unix shell sense) process for messages
42905 at transport time. It should not be confused with mail filtering as set up by
42906 individual users or via a system filter.
42907 If unset, or expanding to an empty string, no filtering is done.
42908 </para>
42909 <para>
42910 When the message is about to be written out, the command specified by
42911 <option>transport_filter</option> is started up in a separate, parallel process, and
42912 the entire message, including the header lines, is passed to it on its standard
42913 input (this in fact is done from a third process, to avoid deadlock). The
42914 command must be specified as an absolute path.
42915 </para>
42916 <para>
42917 The lines of the message that are written to the transport filter are
42918 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
42919 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
42920 lines beginning with a dot, and also before any processing implied by the
42921 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
42922 <command>pipe</command> transports.
42923 </para>
42924 <para>
42925 The standard error for the filter process is set to the same destination as its
42926 standard output; this is read and written to the message&#x2019;s ultimate
42927 destination. The process that writes the message to the filter, the
42928 filter itself, and the original process that reads the result and delivers it
42929 are all run in parallel, like a shell pipeline.
42930 </para>
42931 <para>
42932 The filter can perform any transformations it likes, but of course should take
42933 care not to break RFC 2822 syntax. Exim does not check the result, except to
42934 test for a final newline when SMTP is in use. All messages transmitted over
42935 SMTP must end with a newline, so Exim supplies one if it is missing.
42936 </para>
42937 <para>
42938 <indexterm role="concept">
42939 <primary>content scanning</primary>
42940 <secondary>per user</secondary>
42941 </indexterm>
42942 A transport filter can be used to provide content-scanning on a per-user basis
42943 at delivery time if the only required effect of the scan is to modify the
42944 message. For example, a content scan could insert a new header line containing
42945 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
42946 not possible to discard a message at this stage.
42947 </para>
42948 <para>
42949 <indexterm role="concept">
42950 <primary>SIZE</primary>
42951 <secondary>ESMTP extension</secondary>
42952 </indexterm>
42953 A problem might arise if the filter increases the size of a message that is
42954 being sent down an SMTP connection. If the receiving SMTP server has indicated
42955 support for the SIZE parameter, Exim will have sent the size of the message
42956 at the start of the SMTP session. If what is actually sent is substantially
42957 more, the server might reject the message. This can be worked round by setting
42958 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
42959 additions to the message, or to disable the use of SIZE altogether.
42960 </para>
42961 <para>
42962 <indexterm role="variable">
42963 <primary><varname>$pipe_addresses</varname></primary>
42964 </indexterm>
42965 The value of the <option>transport_filter</option> option is the command string for starting
42966 the filter, which is run directly from Exim, not under a shell. The string is
42967 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
42968 Exim breaks it up into arguments and then expands each argument separately (see
42969 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
42970 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
42971 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
42972 an ideal name for this feature here, but as it was already implemented for the
42973 <command>pipe</command> transport, it seemed sensible not to change it.)
42974 </para>
42975 <para>
42976 <indexterm role="variable">
42977 <primary><varname>$host</varname></primary>
42978 </indexterm>
42979 <indexterm role="variable">
42980 <primary><varname>$host_address</varname></primary>
42981 </indexterm>
42982 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
42983 transport is a remote one. They contain the name and IP address of the host to
42984 which the message is being sent. For example:
42985 </para>
42986 <literallayout class="monospaced">
42987 transport_filter = /some/directory/transport-filter.pl \
42988   $host $host_address $sender_address $pipe_addresses
42989 </literallayout>
42990 <para>
42991 Two problems arise if you want to use more complicated expansion items to
42992 generate transport filter commands, both of which due to the fact that the
42993 command is split up <emphasis>before</emphasis> expansion.
42994 </para>
42995 <itemizedlist>
42996 <listitem>
42997 <para>
42998 If an expansion item contains white space, you must quote it, so that it is all
42999 part of the same command item. If the entire option setting is one such
43000 expansion item, you have to take care what kind of quoting you use. For
43001 example:
43002 </para>
43003 <literallayout class="monospaced">
43004 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
43005 </literallayout>
43006 <para>
43007 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
43008 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
43009 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
43010 the single quotes were missing, the line would be split into two items,
43011 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
43012 Exim tried to expand the first one.
43013 </para>
43014 </listitem>
43015 <listitem>
43016 <para>
43017 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
43018 expansion cannot generate multiple arguments, or a command name followed by
43019 arguments. Consider this example:
43020 </para>
43021 <literallayout class="monospaced">
43022 transport_filter = ${lookup{$host}lsearch{/a/file}\
43023                     {$value}{/bin/cat}}
43024 </literallayout>
43025 <para>
43026 The result of the lookup is interpreted as the name of the command, even
43027 if it contains white space. The simplest way round this is to use a shell:
43028 </para>
43029 <literallayout class="monospaced">
43030 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
43031                                {$value}{/bin/cat}}
43032 </literallayout>
43033 </listitem>
43034 </itemizedlist>
43035 <para>
43036 The filter process is run under the same uid and gid as the normal delivery.
43037 For remote deliveries this is the Exim uid/gid by default. The command should
43038 normally yield a zero return code. Transport filters are not supposed to fail.
43039 A non-zero code is taken to mean that the transport filter encountered some
43040 serious problem. Delivery of the message is deferred; the message remains on
43041 the queue and is tried again later. It is not possible to cause a message to be
43042 bounced from a transport filter.
43043 </para>
43044 <para>
43045 If a transport filter is set on an autoreply transport, the original message is
43046 passed through the filter as it is being copied into the newly generated
43047 message, which happens if the <option>return_message</option> option is set.
43048 </para>
43049 <para>
43050 <indexterm role="option">
43051 <primary><option>transport_filter_timeout</option></primary>
43052 </indexterm>
43053 </para>
43054 <informaltable frame="all">
43055 <tgroup cols="4" colsep="0" rowsep="0">
43056 <colspec colwidth="8*" align="left"/>
43057 <colspec colwidth="6*" align="center"/>
43058 <colspec colwidth="6*" align="center"/>
43059 <colspec colwidth="6*" align="right"/>
43060 <tbody>
43061 <row>
43062 <entry><option>transport_filter_timeout</option></entry>
43063 <entry>Use: <emphasis>transports</emphasis></entry>
43064 <entry>Type: <emphasis>time</emphasis></entry>
43065 <entry>Default: <emphasis>5m</emphasis></entry>
43066 </row>
43067 </tbody>
43068 </tgroup>
43069 </informaltable>
43070 <para>
43071 <indexterm role="concept">
43072 <primary>transport</primary>
43073 <secondary>filter, timeout</secondary>
43074 </indexterm>
43075 When Exim is reading the output of a transport filter, it applies a timeout
43076 that can be set by this option. Exceeding the timeout is normally treated as a
43077 temporary delivery failure. However, if a transport filter is used with a
43078 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
43079 way as a timeout in the pipe command itself. By default, a timeout is a hard
43080 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
43081 becomes a temporary error.
43082 </para>
43083 <para>
43084 <indexterm role="option">
43085 <primary><option>user</option></primary>
43086 </indexterm>
43087 </para>
43088 <informaltable frame="all">
43089 <tgroup cols="4" colsep="0" rowsep="0">
43090 <colspec colwidth="8*" align="left"/>
43091 <colspec colwidth="6*" align="center"/>
43092 <colspec colwidth="6*" align="center"/>
43093 <colspec colwidth="6*" align="right"/>
43094 <tbody>
43095 <row>
43096 <entry><option>user</option></entry>
43097 <entry>Use: <emphasis>transports</emphasis></entry>
43098 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43099 <entry>Default: <emphasis>Exim user</emphasis></entry>
43100 </row>
43101 </tbody>
43102 </tgroup>
43103 </informaltable>
43104 <para>
43105 <indexterm role="concept">
43106 <primary>uid (user id)</primary>
43107 <secondary>local delivery</secondary>
43108 </indexterm>
43109 <indexterm role="concept">
43110 <primary>transport</primary>
43111 <secondary>user, specifying</secondary>
43112 </indexterm>
43113 This option specifies the user under whose uid the delivery process is to be
43114 run, overriding any uid that may have been set by the router. If the user is
43115 given as a name, the uid is looked up from the password data, and the
43116 associated group is taken as the value of the gid to be used if the <option>group</option>
43117 option is not set.
43118 </para>
43119 <para>
43120 For deliveries that use local transports, a user and group are normally
43121 specified explicitly or implicitly (for example, as a result of
43122 <option>check_local_user</option>) by the router or transport.
43123 </para>
43124 <para>
43125 <indexterm role="concept">
43126 <primary>hints database</primary>
43127 <secondary>access by remote transport</secondary>
43128 </indexterm>
43129 For remote transports, you should leave this option unset unless you really are
43130 sure you know what you are doing. When a remote transport is running, it needs
43131 to be able to access Exim&#x2019;s hints databases, because each host may have its own
43132 retry data.
43133 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
43134 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
43135 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
43136 </para>
43137 </chapter>
43138
43139 <chapter id="CHAPbatching">
43140 <title>Address batching in local transports</title>
43141 <titleabbrev>Address batching</titleabbrev>
43142 <para>
43143 <indexterm role="concept">
43144 <primary>transport</primary>
43145 <secondary>local; address batching in</secondary>
43146 </indexterm>
43147 The only remote transport (<command>smtp</command>) is normally configured to handle more than
43148 one address at a time, so that when several addresses are routed to the same
43149 remote host, just one copy of the message is sent. Local transports, however,
43150 normally handle one address at a time. That is, a separate instance of the
43151 transport is run for each address that is routed to the transport. A separate
43152 copy of the message is delivered each time.
43153 </para>
43154 <para>
43155 <indexterm role="concept">
43156 <primary>batched local delivery</primary>
43157 </indexterm>
43158 <indexterm role="option">
43159 <primary><option>batch_max</option></primary>
43160 </indexterm>
43161 <indexterm role="option">
43162 <primary><option>batch_id</option></primary>
43163 </indexterm>
43164 In special cases, it may be desirable to handle several addresses at once in a
43165 local transport, for example:
43166 </para>
43167 <itemizedlist>
43168 <listitem>
43169 <para>
43170 In an <command>appendfile</command> transport, when storing messages in files for later
43171 delivery by some other means, a single copy of the message with multiple
43172 recipients saves space.
43173 </para>
43174 </listitem>
43175 <listitem>
43176 <para>
43177 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
43178 a single copy saves time, and is the normal way LMTP is expected to work.
43179 </para>
43180 </listitem>
43181 <listitem>
43182 <para>
43183 In a <command>pipe</command> transport, when passing the message
43184 to a scanner program or
43185 to some other delivery mechanism such as UUCP, multiple recipients may be
43186 acceptable.
43187 </para>
43188 </listitem>
43189 </itemizedlist>
43190 <para>
43191 These three local transports all have the same options for controlling multiple
43192 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
43193 repeating the information for each transport, these options are described here.
43194 </para>
43195 <para>
43196 The <option>batch_max</option> option specifies the maximum number of addresses that can be
43197 delivered together in a single run of the transport. Its default value is one
43198 (no batching). When more than one address is routed to a transport that has a
43199 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
43200 (that is, in a single run of the transport with multiple recipients), subject
43201 to certain conditions:
43202 </para>
43203 <itemizedlist>
43204 <listitem>
43205 <para>
43206 <indexterm role="variable">
43207 <primary><varname>$local_part</varname></primary>
43208 </indexterm>
43209 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
43210 batching is possible.
43211 </para>
43212 </listitem>
43213 <listitem>
43214 <para>
43215 <indexterm role="variable">
43216 <primary><varname>$domain</varname></primary>
43217 </indexterm>
43218 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
43219 addresses with the same domain are batched.
43220 </para>
43221 </listitem>
43222 <listitem>
43223 <para>
43224 <indexterm role="concept">
43225 <primary>customizing</primary>
43226 <secondary>batching condition</secondary>
43227 </indexterm>
43228 If <option>batch_id</option> is set, it is expanded for each address, and only those
43229 addresses with the same expanded value are batched. This allows you to specify
43230 customized batching conditions. Failure of the expansion for any reason,
43231 including forced failure, disables batching, but it does not stop the delivery
43232 from taking place.
43233 </para>
43234 </listitem>
43235 <listitem>
43236 <para>
43237 Batched addresses must also have the same errors address (where to send
43238 delivery errors), the same header additions and removals, the same user and
43239 group for the transport, and if a host list is present, the first host must
43240 be the same.
43241 </para>
43242 </listitem>
43243 </itemizedlist>
43244 <para>
43245 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
43246 both when the file or pipe command is specified in the transport, and when it
43247 is specified by a <command>redirect</command> router, but all the batched addresses must of
43248 course be routed to the same file or pipe command. These two transports have an
43249 option called <option>use_bsmtp</option>, which causes them to deliver the message in
43250 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
43251 <option>check_string</option> and <option>escape_string</option> options are forced to the values
43252 </para>
43253 <literallayout class="monospaced">
43254 check_string = "."
43255 escape_string = ".."
43256 </literallayout>
43257 <para>
43258 when batched SMTP is in use. A full description of the batch SMTP mechanism is
43259 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
43260 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
43261 </para>
43262 <para>
43263 <indexterm role="concept">
43264 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
43265 </indexterm>
43266 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
43267 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
43268 that are being processed together. If you are using a batching <command>appendfile</command>
43269 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
43270 addresses is to set the <option>envelope_to_add</option> option.
43271 </para>
43272 <para>
43273 <indexterm role="concept">
43274 <primary><command>pipe</command> transport</primary>
43275 <secondary>with multiple addresses</secondary>
43276 </indexterm>
43277 <indexterm role="variable">
43278 <primary><varname>$pipe_addresses</varname></primary>
43279 </indexterm>
43280 If you are using a <command>pipe</command> transport without BSMTP, and setting the
43281 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
43282 the command. This is not a true variable; it is a bit of magic that causes each
43283 of the recipient addresses to be inserted into the command as a separate
43284 argument. This provides a way of accessing all the addresses that are being
43285 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
43286 are specified by a <command>redirect</command> router.
43287 </para>
43288 </chapter>
43289
43290 <chapter id="CHAPappendfile">
43291 <title>The appendfile transport</title>
43292 <para>
43293 <indexterm role="concept" id="IIDapptra1" class="startofrange">
43294 <primary><command>appendfile</command> transport</primary>
43295 </indexterm>
43296 <indexterm role="concept" id="IIDapptra2" class="startofrange">
43297 <primary>transports</primary>
43298 <secondary><command>appendfile</command></secondary>
43299 </indexterm>
43300 <indexterm role="concept">
43301 <primary>directory creation</primary>
43302 </indexterm>
43303 <indexterm role="concept">
43304 <primary>creating directories</primary>
43305 </indexterm>
43306 The <command>appendfile</command> transport delivers a message by appending it to an existing
43307 file, or by creating an entirely new file in a specified directory. Single
43308 files to which messages are appended can be in the traditional Unix mailbox
43309 format, or optionally in the MBX format supported by the Pine MUA and
43310 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
43311 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
43312 to give added protection against failures that happen part-way through the
43313 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
43314 supported. For all file formats, Exim attempts to create as many levels of
43315 directory as necessary, provided that <option>create_directory</option> is set.
43316 </para>
43317 <para>
43318 The code for the optional formats is not included in the Exim binary by
43319 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
43320 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
43321 included.
43322 </para>
43323 <para>
43324 <indexterm role="concept">
43325 <primary>quota</primary>
43326 <secondary>system</secondary>
43327 </indexterm>
43328 Exim recognizes system quota errors, and generates an appropriate message. Exim
43329 also supports its own quota control within the transport, for use when the
43330 system facility is unavailable or cannot be used for some reason.
43331 </para>
43332 <para>
43333 If there is an error while appending to a file (for example, quota exceeded or
43334 partition filled), Exim attempts to reset the file&#x2019;s length and last
43335 modification time back to what they were before. If there is an error while
43336 creating an entirely new file, the new file is removed.
43337 </para>
43338 <para>
43339 Before appending to a file, a number of security checks are made, and the
43340 file is locked. A detailed description is given below, after the list of
43341 private options.
43342 </para>
43343 <para>
43344 The <command>appendfile</command> transport is most commonly used for local deliveries to
43345 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
43346 putting messages into files for remote delivery by some means other than Exim.
43347 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
43348 option).
43349 </para>
43350 <section id="SECTfildiropt">
43351 <title>The file and directory options</title>
43352 <para>
43353 The <option>file</option> option specifies a single file, to which the message is appended;
43354 the <option>directory</option> option specifies a directory, in which a new file containing
43355 the message is created. Only one of these two options can be set, and for
43356 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
43357 </para>
43358 <para>
43359 <indexterm role="variable">
43360 <primary><varname>$address_file</varname></primary>
43361 </indexterm>
43362 <indexterm role="variable">
43363 <primary><varname>$local_part</varname></primary>
43364 </indexterm>
43365 However, <command>appendfile</command> is also used for delivering messages to files or
43366 directories whose names (or parts of names) are obtained from alias,
43367 forwarding, or filtering operations (for example, a <option>save</option> command in a
43368 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
43369 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
43370 name (or partial name) of the file or directory generated by the redirection
43371 operation. There are two cases:
43372 </para>
43373 <itemizedlist>
43374 <listitem>
43375 <para>
43376 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
43377 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
43378 common case when users with local accounts use filtering to sort mail into
43379 different folders. See for example, the <command>address_file</command> transport in the
43380 default configuration. If the path ends with a slash, it is assumed to be the
43381 name of a directory. A delivery to a directory can also be forced by setting
43382 <option>maildir_format</option> or <option>mailstore_format</option>.
43383 </para>
43384 </listitem>
43385 <listitem>
43386 <para>
43387 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
43388 used to determine the file or directory name for the delivery. Normally, the
43389 contents of <varname>$address_file</varname> are used in some way in the string expansion.
43390 </para>
43391 </listitem>
43392 </itemizedlist>
43393 <para revisionflag="changed">
43394 <indexterm role="concept">
43395 <primary>tainted data</primary>
43396 <secondary>in filenames</secondary>
43397 </indexterm>
43398 <indexterm role="concept">
43399 <primary>appendfile</primary>
43400 <secondary>tainted data</secondary>
43401 </indexterm>
43402 Tainted data may not be used for a file or directory name.
43403 This means that, for instance, <varname>$local_part</varname> cannot be used directly
43404 as a component of a path.  It can however be used as the key for a lookup
43405 which returns a path (or component).
43406 </para>
43407 <para>
43408 <indexterm role="concept">
43409 <primary>Sieve filter</primary>
43410 <secondary>configuring <command>appendfile</command></secondary>
43411 </indexterm>
43412 <indexterm role="concept">
43413 <primary>Sieve filter</primary>
43414 <secondary>relative mailbox path handling</secondary>
43415 </indexterm>
43416 As an example of the second case, consider an environment where users do not
43417 have home directories. They may be permitted to use Exim filter commands of the
43418 form:
43419 </para>
43420 <literallayout class="monospaced">
43421 save folder23
43422 </literallayout>
43423 <para>
43424 or Sieve filter commands of the form:
43425 </para>
43426 <literallayout class="monospaced">
43427 require "fileinto";
43428 fileinto "folder23";
43429 </literallayout>
43430 <para>
43431 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
43432 must transform the relative path into an appropriate absolute filename. In the
43433 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
43434 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
43435 way of handling this requirement:
43436 </para>
43437 <literallayout class="monospaced">
43438 file = ${if eq{$address_file}{inbox} \
43439             {/var/mail/$local_part_data} \
43440             {${if eq{${substr_0_1:$address_file}}{/} \
43441                   {$address_file} \
43442                   {$home/mail/$address_file} \
43443             }} \
43444        }
43445 </literallayout>
43446 <para>
43447 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
43448 location, absolute paths are used without change, and other folders are in the
43449 <filename>mail</filename> directory within the home directory.
43450 </para>
43451 <para>
43452 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
43453 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
43454 the router. In particular, this is the case if <option>check_local_user</option> is set. If
43455 you want to prevent this happening at routing time, you can set
43456 <option>router_home_directory</option> empty. This forces the router to pass the relative
43457 path to the transport.
43458 </para>
43459 <para>
43460 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
43461 the <option>file</option> or <option>directory</option> option is still used if it is set.
43462 </para>
43463 </section>
43464 <section id="SECID134">
43465 <title>Private options for appendfile</title>
43466 <para>
43467 <indexterm role="concept">
43468 <primary>options</primary>
43469 <secondary><command>appendfile</command> transport</secondary>
43470 </indexterm>
43471 </para>
43472 <para>
43473 <indexterm role="option">
43474 <primary><option>allow_fifo</option></primary>
43475 </indexterm>
43476 </para>
43477 <informaltable frame="all">
43478 <tgroup cols="4" colsep="0" rowsep="0">
43479 <colspec colwidth="8*" align="left"/>
43480 <colspec colwidth="6*" align="center"/>
43481 <colspec colwidth="6*" align="center"/>
43482 <colspec colwidth="6*" align="right"/>
43483 <tbody>
43484 <row>
43485 <entry><option>allow_fifo</option></entry>
43486 <entry>Use: <emphasis>appendfile</emphasis></entry>
43487 <entry>Type: <emphasis>boolean</emphasis></entry>
43488 <entry>Default: <emphasis>false</emphasis></entry>
43489 </row>
43490 </tbody>
43491 </tgroup>
43492 </informaltable>
43493 <para>
43494 <indexterm role="concept">
43495 <primary>fifo (named pipe)</primary>
43496 </indexterm>
43497 <indexterm role="concept">
43498 <primary>named pipe (fifo)</primary>
43499 </indexterm>
43500 <indexterm role="concept">
43501 <primary>pipe</primary>
43502 <secondary>named (fifo)</secondary>
43503 </indexterm>
43504 Setting this option permits delivery to named pipes (FIFOs) as well as to
43505 regular files. If no process is reading the named pipe at delivery time, the
43506 delivery is deferred.
43507 </para>
43508 <para>
43509 <indexterm role="option">
43510 <primary><option>allow_symlink</option></primary>
43511 </indexterm>
43512 </para>
43513 <informaltable frame="all">
43514 <tgroup cols="4" colsep="0" rowsep="0">
43515 <colspec colwidth="8*" align="left"/>
43516 <colspec colwidth="6*" align="center"/>
43517 <colspec colwidth="6*" align="center"/>
43518 <colspec colwidth="6*" align="right"/>
43519 <tbody>
43520 <row>
43521 <entry><option>allow_symlink</option></entry>
43522 <entry>Use: <emphasis>appendfile</emphasis></entry>
43523 <entry>Type: <emphasis>boolean</emphasis></entry>
43524 <entry>Default: <emphasis>false</emphasis></entry>
43525 </row>
43526 </tbody>
43527 </tgroup>
43528 </informaltable>
43529 <para>
43530 <indexterm role="concept">
43531 <primary>symbolic link</primary>
43532 <secondary>to mailbox</secondary>
43533 </indexterm>
43534 <indexterm role="concept">
43535 <primary>mailbox</primary>
43536 <secondary>symbolic link</secondary>
43537 </indexterm>
43538 By default, <command>appendfile</command> will not deliver if the path name for the file is
43539 that of a symbolic link. Setting this option relaxes that constraint, but there
43540 are security issues involved in the use of symbolic links. Be sure you know
43541 what you are doing if you set this. Details of exactly what this option affects
43542 are included in the discussion which follows this list of options.
43543 </para>
43544 <para>
43545 <indexterm role="option">
43546 <primary><option>batch_id</option></primary>
43547 </indexterm>
43548 </para>
43549 <informaltable frame="all">
43550 <tgroup cols="4" colsep="0" rowsep="0">
43551 <colspec colwidth="8*" align="left"/>
43552 <colspec colwidth="6*" align="center"/>
43553 <colspec colwidth="6*" align="center"/>
43554 <colspec colwidth="6*" align="right"/>
43555 <tbody>
43556 <row>
43557 <entry><option>batch_id</option></entry>
43558 <entry>Use: <emphasis>appendfile</emphasis></entry>
43559 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43560 <entry>Default: <emphasis>unset</emphasis></entry>
43561 </row>
43562 </tbody>
43563 </tgroup>
43564 </informaltable>
43565 <para>
43566 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43567 However, batching is automatically disabled for <command>appendfile</command> deliveries that
43568 happen as a result of forwarding or aliasing or other redirection directly to a
43569 file.
43570 </para>
43571 <para>
43572 <indexterm role="option">
43573 <primary><option>batch_max</option></primary>
43574 </indexterm>
43575 </para>
43576 <informaltable frame="all">
43577 <tgroup cols="4" colsep="0" rowsep="0">
43578 <colspec colwidth="8*" align="left"/>
43579 <colspec colwidth="6*" align="center"/>
43580 <colspec colwidth="6*" align="center"/>
43581 <colspec colwidth="6*" align="right"/>
43582 <tbody>
43583 <row>
43584 <entry><option>batch_max</option></entry>
43585 <entry>Use: <emphasis>appendfile</emphasis></entry>
43586 <entry>Type: <emphasis>integer</emphasis></entry>
43587 <entry>Default: <emphasis>1</emphasis></entry>
43588 </row>
43589 </tbody>
43590 </tgroup>
43591 </informaltable>
43592 <para>
43593 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
43594 </para>
43595 <para>
43596 <indexterm role="option">
43597 <primary><option>check_group</option></primary>
43598 </indexterm>
43599 </para>
43600 <informaltable frame="all">
43601 <tgroup cols="4" colsep="0" rowsep="0">
43602 <colspec colwidth="8*" align="left"/>
43603 <colspec colwidth="6*" align="center"/>
43604 <colspec colwidth="6*" align="center"/>
43605 <colspec colwidth="6*" align="right"/>
43606 <tbody>
43607 <row>
43608 <entry><option>check_group</option></entry>
43609 <entry>Use: <emphasis>appendfile</emphasis></entry>
43610 <entry>Type: <emphasis>boolean</emphasis></entry>
43611 <entry>Default: <emphasis>false</emphasis></entry>
43612 </row>
43613 </tbody>
43614 </tgroup>
43615 </informaltable>
43616 <para>
43617 When this option is set, the group owner of the file defined by the <option>file</option>
43618 option is checked to see that it is the same as the group under which the
43619 delivery process is running. The default setting is false because the default
43620 file mode is 0600, which means that the group is irrelevant.
43621 </para>
43622 <para>
43623 <indexterm role="option">
43624 <primary><option>check_owner</option></primary>
43625 </indexterm>
43626 </para>
43627 <informaltable frame="all">
43628 <tgroup cols="4" colsep="0" rowsep="0">
43629 <colspec colwidth="8*" align="left"/>
43630 <colspec colwidth="6*" align="center"/>
43631 <colspec colwidth="6*" align="center"/>
43632 <colspec colwidth="6*" align="right"/>
43633 <tbody>
43634 <row>
43635 <entry><option>check_owner</option></entry>
43636 <entry>Use: <emphasis>appendfile</emphasis></entry>
43637 <entry>Type: <emphasis>boolean</emphasis></entry>
43638 <entry>Default: <emphasis>true</emphasis></entry>
43639 </row>
43640 </tbody>
43641 </tgroup>
43642 </informaltable>
43643 <para>
43644 When this option is set, the owner of the file defined by the <option>file</option> option
43645 is checked to ensure that it is the same as the user under which the delivery
43646 process is running.
43647 </para>
43648 <para>
43649 <indexterm role="option">
43650 <primary><option>check_string</option></primary>
43651 </indexterm>
43652 </para>
43653 <informaltable frame="all">
43654 <tgroup cols="4" colsep="0" rowsep="0">
43655 <colspec colwidth="8*" align="left"/>
43656 <colspec colwidth="6*" align="center"/>
43657 <colspec colwidth="6*" align="center"/>
43658 <colspec colwidth="6*" align="right"/>
43659 <tbody>
43660 <row>
43661 <entry><option>check_string</option></entry>
43662 <entry>Use: <emphasis>appendfile</emphasis></entry>
43663 <entry>Type: <emphasis>string</emphasis></entry>
43664 <entry>Default: <emphasis>see below</emphasis></entry>
43665 </row>
43666 </tbody>
43667 </tgroup>
43668 </informaltable>
43669 <para>
43670 <indexterm role="concept">
43671 <primary><quote>From</quote> line</primary>
43672 </indexterm>
43673 As <command>appendfile</command> writes the message, the start of each line is tested for
43674 matching <option>check_string</option>, and if it does, the initial matching characters are
43675 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
43676 a literal string, not a regular expression, and the case of any letters it
43677 contains is significant.
43678 </para>
43679 <para>
43680 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
43681 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
43682 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
43683 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
43684 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
43685 </para>
43686 <para>
43687 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
43688 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
43689 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
43690 if another format is used. For example, to deliver to mailboxes in MMDF format:
43691 <indexterm role="concept">
43692 <primary>MMDF format mailbox</primary>
43693 </indexterm>
43694 <indexterm role="concept">
43695 <primary>mailbox</primary>
43696 <secondary>MMDF format</secondary>
43697 </indexterm>
43698 </para>
43699 <literallayout class="monospaced">
43700 check_string = "\1\1\1\1\n"
43701 escape_string = "\1\1\1\1 \n"
43702 message_prefix = "\1\1\1\1\n"
43703 message_suffix = "\1\1\1\1\n"
43704 </literallayout>
43705 <para>
43706 <indexterm role="option">
43707 <primary><option>create_directory</option></primary>
43708 </indexterm>
43709 </para>
43710 <informaltable frame="all">
43711 <tgroup cols="4" colsep="0" rowsep="0">
43712 <colspec colwidth="8*" align="left"/>
43713 <colspec colwidth="6*" align="center"/>
43714 <colspec colwidth="6*" align="center"/>
43715 <colspec colwidth="6*" align="right"/>
43716 <tbody>
43717 <row>
43718 <entry><option>create_directory</option></entry>
43719 <entry>Use: <emphasis>appendfile</emphasis></entry>
43720 <entry>Type: <emphasis>boolean</emphasis></entry>
43721 <entry>Default: <emphasis>true</emphasis></entry>
43722 </row>
43723 </tbody>
43724 </tgroup>
43725 </informaltable>
43726 <para>
43727 <indexterm role="concept">
43728 <primary>directory creation</primary>
43729 </indexterm>
43730 When this option is true, Exim attempts to create any missing superior
43731 directories for the file that it is about to write. A created directory&#x2019;s mode
43732 is given by the <option>directory_mode</option> option.
43733 </para>
43734 <para>
43735 The group ownership of a newly created directory is highly dependent on the
43736 operating system (and possibly the file system) that is being used. For
43737 example, in Solaris, if the parent directory has the setgid bit set, its group
43738 is propagated to the child; if not, the currently set group is used. However,
43739 in FreeBSD, the parent&#x2019;s group is always used.
43740 </para>
43741 <para>
43742 <indexterm role="option">
43743 <primary><option>create_file</option></primary>
43744 </indexterm>
43745 </para>
43746 <informaltable frame="all">
43747 <tgroup cols="4" colsep="0" rowsep="0">
43748 <colspec colwidth="8*" align="left"/>
43749 <colspec colwidth="6*" align="center"/>
43750 <colspec colwidth="6*" align="center"/>
43751 <colspec colwidth="6*" align="right"/>
43752 <tbody>
43753 <row>
43754 <entry><option>create_file</option></entry>
43755 <entry>Use: <emphasis>appendfile</emphasis></entry>
43756 <entry>Type: <emphasis>string</emphasis></entry>
43757 <entry>Default: <emphasis>anywhere</emphasis></entry>
43758 </row>
43759 </tbody>
43760 </tgroup>
43761 </informaltable>
43762 <para>
43763 This option constrains the location of files and directories that are created
43764 by this transport. It applies to files defined by the <option>file</option> option and
43765 directories defined by the <option>directory</option> option. In the case of maildir
43766 delivery, it applies to the top level directory, not the maildir directories
43767 beneath.
43768 </para>
43769 <para>
43770 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
43771 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
43772 set for the transport. This option is not useful when an explicit filename is
43773 given for normal mailbox deliveries. It is intended for the case when filenames
43774 are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
43775 by an <command>appendfile</command> transport called <option>address_file</option>. See also
43776 <option>file_must_exist</option>.
43777 </para>
43778 <para>
43779 <indexterm role="option">
43780 <primary><option>directory</option></primary>
43781 </indexterm>
43782 </para>
43783 <informaltable frame="all">
43784 <tgroup cols="4" colsep="0" rowsep="0">
43785 <colspec colwidth="8*" align="left"/>
43786 <colspec colwidth="6*" align="center"/>
43787 <colspec colwidth="6*" align="center"/>
43788 <colspec colwidth="6*" align="right"/>
43789 <tbody>
43790 <row>
43791 <entry><option>directory</option></entry>
43792 <entry>Use: <emphasis>appendfile</emphasis></entry>
43793 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43794 <entry>Default: <emphasis>unset</emphasis></entry>
43795 </row>
43796 </tbody>
43797 </tgroup>
43798 </informaltable>
43799 <para>
43800 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
43801 or <option>directory</option> must be set, unless the delivery is the direct result of a
43802 redirection (see section <xref linkend="SECTfildiropt"/>).
43803 </para>
43804 <para>
43805 When <option>directory</option> is set, the string is expanded, and the message is delivered
43806 into a new file or files in or below the given directory, instead of being
43807 appended to a single mailbox file. A number of different formats are provided
43808 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
43809 <xref linkend="SECTopdir"/> for further details of this form of delivery.
43810 </para>
43811 <para>
43812 <indexterm role="option">
43813 <primary><option>directory_file</option></primary>
43814 </indexterm>
43815 </para>
43816 <informaltable frame="all">
43817 <tgroup cols="4" colsep="0" rowsep="0">
43818 <colspec colwidth="8*" align="left"/>
43819 <colspec colwidth="6*" align="center"/>
43820 <colspec colwidth="6*" align="center"/>
43821 <colspec colwidth="6*" align="right"/>
43822 <tbody>
43823 <row>
43824 <entry><option>directory_file</option></entry>
43825 <entry>Use: <emphasis>appendfile</emphasis></entry>
43826 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43827 <entry>Default: <emphasis>see below</emphasis></entry>
43828 </row>
43829 </tbody>
43830 </tgroup>
43831 </informaltable>
43832 <para>
43833 <indexterm role="concept">
43834 <primary>base62</primary>
43835 </indexterm>
43836 <indexterm role="variable">
43837 <primary><varname>$inode</varname></primary>
43838 </indexterm>
43839 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
43840 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
43841 whose name is obtained by expanding this string. The default value is:
43842 </para>
43843 <literallayout class="monospaced">
43844 q${base62:$tod_epoch}-$inode
43845 </literallayout>
43846 <para>
43847 This generates a unique name from the current time, in base 62 form, and the
43848 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
43849 option.
43850 </para>
43851 <para>
43852 <indexterm role="option">
43853 <primary><option>directory_mode</option></primary>
43854 </indexterm>
43855 </para>
43856 <informaltable frame="all">
43857 <tgroup cols="4" colsep="0" rowsep="0">
43858 <colspec colwidth="8*" align="left"/>
43859 <colspec colwidth="6*" align="center"/>
43860 <colspec colwidth="6*" align="center"/>
43861 <colspec colwidth="6*" align="right"/>
43862 <tbody>
43863 <row>
43864 <entry><option>directory_mode</option></entry>
43865 <entry>Use: <emphasis>appendfile</emphasis></entry>
43866 <entry>Type: <emphasis>octal integer</emphasis></entry>
43867 <entry>Default: <emphasis>0700</emphasis></entry>
43868 </row>
43869 </tbody>
43870 </tgroup>
43871 </informaltable>
43872 <para>
43873 If <command>appendfile</command> creates any directories as a result of the
43874 <option>create_directory</option> option, their mode is specified by this option.
43875 </para>
43876 <para>
43877 <indexterm role="option">
43878 <primary><option>escape_string</option></primary>
43879 </indexterm>
43880 </para>
43881 <informaltable frame="all">
43882 <tgroup cols="4" colsep="0" rowsep="0">
43883 <colspec colwidth="8*" align="left"/>
43884 <colspec colwidth="6*" align="center"/>
43885 <colspec colwidth="6*" align="center"/>
43886 <colspec colwidth="6*" align="right"/>
43887 <tbody>
43888 <row>
43889 <entry><option>escape_string</option></entry>
43890 <entry>Use: <emphasis>appendfile</emphasis></entry>
43891 <entry>Type: <emphasis>string</emphasis></entry>
43892 <entry>Default: <emphasis>see description</emphasis></entry>
43893 </row>
43894 </tbody>
43895 </tgroup>
43896 </informaltable>
43897 <para>
43898 See <option>check_string</option> above.
43899 </para>
43900 <para>
43901 <indexterm role="option">
43902 <primary><option>file</option></primary>
43903 </indexterm>
43904 </para>
43905 <informaltable frame="all">
43906 <tgroup cols="4" colsep="0" rowsep="0">
43907 <colspec colwidth="8*" align="left"/>
43908 <colspec colwidth="6*" align="center"/>
43909 <colspec colwidth="6*" align="center"/>
43910 <colspec colwidth="6*" align="right"/>
43911 <tbody>
43912 <row>
43913 <entry><option>file</option></entry>
43914 <entry>Use: <emphasis>appendfile</emphasis></entry>
43915 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43916 <entry>Default: <emphasis>unset</emphasis></entry>
43917 </row>
43918 </tbody>
43919 </tgroup>
43920 </informaltable>
43921 <para>
43922 This option is mutually exclusive with the <option>directory</option> option, but one of
43923 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
43924 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
43925 specifies a single file, to which the message is appended. One or more of
43926 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
43927 <option>file</option>.
43928 </para>
43929 <para>
43930 <indexterm role="concept">
43931 <primary>NFS</primary>
43932 <secondary>lock file</secondary>
43933 </indexterm>
43934 <indexterm role="concept">
43935 <primary>locking files</primary>
43936 </indexterm>
43937 <indexterm role="concept">
43938 <primary>lock files</primary>
43939 </indexterm>
43940 If you are using more than one host to deliver over NFS into the same
43941 mailboxes, you should always use lock files.
43942 </para>
43943 <para>
43944 The string value is expanded for each delivery, and must yield an absolute
43945 path. The most common settings of this option are variations on one of these
43946 examples:
43947 </para>
43948 <literallayout class="monospaced">
43949 file = /var/spool/mail/$local_part_data
43950 file = /home/$local_part_data/inbox
43951 file = $home/inbox
43952 </literallayout>
43953 <para>
43954 <indexterm role="concept">
43955 <primary><quote>sticky</quote> bit</primary>
43956 </indexterm>
43957 In the first example, all deliveries are done into the same directory. If Exim
43958 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
43959 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
43960 deliveries to be possible, or alternatively the <option>group</option> option can be used to
43961 run the delivery under a group id which has write access to the directory.
43962 </para>
43963 <para>
43964 <indexterm role="option">
43965 <primary><option>file_format</option></primary>
43966 </indexterm>
43967 </para>
43968 <informaltable frame="all">
43969 <tgroup cols="4" colsep="0" rowsep="0">
43970 <colspec colwidth="8*" align="left"/>
43971 <colspec colwidth="6*" align="center"/>
43972 <colspec colwidth="6*" align="center"/>
43973 <colspec colwidth="6*" align="right"/>
43974 <tbody>
43975 <row>
43976 <entry><option>file_format</option></entry>
43977 <entry>Use: <emphasis>appendfile</emphasis></entry>
43978 <entry>Type: <emphasis>string</emphasis></entry>
43979 <entry>Default: <emphasis>unset</emphasis></entry>
43980 </row>
43981 </tbody>
43982 </tgroup>
43983 </informaltable>
43984 <para>
43985 <indexterm role="concept">
43986 <primary>file</primary>
43987 <secondary>mailbox; checking existing format</secondary>
43988 </indexterm>
43989 This option requests the transport to check the format of an existing file
43990 before adding to it. The check consists of matching a specific string at the
43991 start of the file. The value of the option consists of an even number of
43992 colon-separated strings. The first of each pair is the test string, and the
43993 second is the name of a transport. If the transport associated with a matched
43994 string is not the current transport, control is passed over to the other
43995 transport. For example, suppose the standard <command>local_delivery</command> transport has
43996 this added to it:
43997 </para>
43998 <literallayout class="monospaced">
43999 file_format = "From       : local_delivery :\
44000                \1\1\1\1\n : local_mmdf_delivery"
44001 </literallayout>
44002 <para>
44003 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
44004 a mailbox begins with four binary ones followed by a newline, control is passed
44005 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
44006 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
44007 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
44008 match any string, or if the transport named for a given string is not defined,
44009 delivery is deferred.
44010 </para>
44011 <para>
44012 <indexterm role="option">
44013 <primary><option>file_must_exist</option></primary>
44014 </indexterm>
44015 </para>
44016 <informaltable frame="all">
44017 <tgroup cols="4" colsep="0" rowsep="0">
44018 <colspec colwidth="8*" align="left"/>
44019 <colspec colwidth="6*" align="center"/>
44020 <colspec colwidth="6*" align="center"/>
44021 <colspec colwidth="6*" align="right"/>
44022 <tbody>
44023 <row>
44024 <entry><option>file_must_exist</option></entry>
44025 <entry>Use: <emphasis>appendfile</emphasis></entry>
44026 <entry>Type: <emphasis>boolean</emphasis></entry>
44027 <entry>Default: <emphasis>false</emphasis></entry>
44028 </row>
44029 </tbody>
44030 </tgroup>
44031 </informaltable>
44032 <para>
44033 If this option is true, the file specified by the <option>file</option> option must exist.
44034 A temporary error occurs if it does not, causing delivery to be deferred.
44035 If this option is false, the file is created if it does not exist.
44036 </para>
44037 <para>
44038 <indexterm role="option">
44039 <primary><option>lock_fcntl_timeout</option></primary>
44040 </indexterm>
44041 </para>
44042 <informaltable frame="all">
44043 <tgroup cols="4" colsep="0" rowsep="0">
44044 <colspec colwidth="8*" align="left"/>
44045 <colspec colwidth="6*" align="center"/>
44046 <colspec colwidth="6*" align="center"/>
44047 <colspec colwidth="6*" align="right"/>
44048 <tbody>
44049 <row>
44050 <entry><option>lock_fcntl_timeout</option></entry>
44051 <entry>Use: <emphasis>appendfile</emphasis></entry>
44052 <entry>Type: <emphasis>time</emphasis></entry>
44053 <entry>Default: <emphasis>0s</emphasis></entry>
44054 </row>
44055 </tbody>
44056 </tgroup>
44057 </informaltable>
44058 <para>
44059 <indexterm role="concept">
44060 <primary>timeout</primary>
44061 <secondary>mailbox locking</secondary>
44062 </indexterm>
44063 <indexterm role="concept">
44064 <primary>mailbox</primary>
44065 <secondary>locking, blocking and non-blocking</secondary>
44066 </indexterm>
44067 <indexterm role="concept">
44068 <primary>locking files</primary>
44069 </indexterm>
44070 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
44071 when locking an open mailbox file. If the call fails, the delivery process
44072 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
44073 Non-blocking calls are used so that the file is not kept open during the wait
44074 for the lock; the reason for this is to make it as safe as possible for
44075 deliveries over NFS in the case when processes might be accessing an NFS
44076 mailbox without using a lock file. This should not be done, but
44077 misunderstandings and hence misconfigurations are not unknown.
44078 </para>
44079 <para>
44080 On a busy system, however, the performance of a non-blocking lock approach is
44081 not as good as using a blocking lock with a timeout. In this case, the waiting
44082 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
44083 and can proceed as soon as the previous lock holder releases it.
44084 </para>
44085 <para>
44086 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
44087 timeout, are used. There may still be some retrying: the maximum number of
44088 retries is
44089 </para>
44090 <literallayout class="monospaced">
44091 (lock_retries * lock_interval) / lock_fcntl_timeout
44092 </literallayout>
44093 <para>
44094 rounded up to the next whole number. In other words, the total time during
44095 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
44096 <option>lock_fcntl_timeout</option> is set very large.
44097 </para>
44098 <para>
44099 You should consider setting this option if you are getting a lot of delayed
44100 local deliveries because of errors of the form
44101 </para>
44102 <literallayout class="monospaced">
44103 failed to lock mailbox /some/file (fcntl)
44104 </literallayout>
44105 <para>
44106 <indexterm role="option">
44107 <primary><option>lock_flock_timeout</option></primary>
44108 </indexterm>
44109 </para>
44110 <informaltable frame="all">
44111 <tgroup cols="4" colsep="0" rowsep="0">
44112 <colspec colwidth="8*" align="left"/>
44113 <colspec colwidth="6*" align="center"/>
44114 <colspec colwidth="6*" align="center"/>
44115 <colspec colwidth="6*" align="right"/>
44116 <tbody>
44117 <row>
44118 <entry><option>lock_flock_timeout</option></entry>
44119 <entry>Use: <emphasis>appendfile</emphasis></entry>
44120 <entry>Type: <emphasis>time</emphasis></entry>
44121 <entry>Default: <emphasis>0s</emphasis></entry>
44122 </row>
44123 </tbody>
44124 </tgroup>
44125 </informaltable>
44126 <para>
44127 This timeout applies to file locking when using <function>flock()</function> (see
44128 <option>use_flock</option>); the timeout operates in a similar manner to
44129 <option>lock_fcntl_timeout</option>.
44130 </para>
44131 <para>
44132 <indexterm role="option">
44133 <primary><option>lock_interval</option></primary>
44134 </indexterm>
44135 </para>
44136 <informaltable frame="all">
44137 <tgroup cols="4" colsep="0" rowsep="0">
44138 <colspec colwidth="8*" align="left"/>
44139 <colspec colwidth="6*" align="center"/>
44140 <colspec colwidth="6*" align="center"/>
44141 <colspec colwidth="6*" align="right"/>
44142 <tbody>
44143 <row>
44144 <entry><option>lock_interval</option></entry>
44145 <entry>Use: <emphasis>appendfile</emphasis></entry>
44146 <entry>Type: <emphasis>time</emphasis></entry>
44147 <entry>Default: <emphasis>3s</emphasis></entry>
44148 </row>
44149 </tbody>
44150 </tgroup>
44151 </informaltable>
44152 <para>
44153 This specifies the time to wait between attempts to lock the file. See below
44154 for details of locking.
44155 </para>
44156 <para>
44157 <indexterm role="option">
44158 <primary><option>lock_retries</option></primary>
44159 </indexterm>
44160 </para>
44161 <informaltable frame="all">
44162 <tgroup cols="4" colsep="0" rowsep="0">
44163 <colspec colwidth="8*" align="left"/>
44164 <colspec colwidth="6*" align="center"/>
44165 <colspec colwidth="6*" align="center"/>
44166 <colspec colwidth="6*" align="right"/>
44167 <tbody>
44168 <row>
44169 <entry><option>lock_retries</option></entry>
44170 <entry>Use: <emphasis>appendfile</emphasis></entry>
44171 <entry>Type: <emphasis>integer</emphasis></entry>
44172 <entry>Default: <emphasis>10</emphasis></entry>
44173 </row>
44174 </tbody>
44175 </tgroup>
44176 </informaltable>
44177 <para>
44178 This specifies the maximum number of attempts to lock the file. A value of zero
44179 is treated as 1. See below for details of locking.
44180 </para>
44181 <para>
44182 <indexterm role="option">
44183 <primary><option>lockfile_mode</option></primary>
44184 </indexterm>
44185 </para>
44186 <informaltable frame="all">
44187 <tgroup cols="4" colsep="0" rowsep="0">
44188 <colspec colwidth="8*" align="left"/>
44189 <colspec colwidth="6*" align="center"/>
44190 <colspec colwidth="6*" align="center"/>
44191 <colspec colwidth="6*" align="right"/>
44192 <tbody>
44193 <row>
44194 <entry><option>lockfile_mode</option></entry>
44195 <entry>Use: <emphasis>appendfile</emphasis></entry>
44196 <entry>Type: <emphasis>octal integer</emphasis></entry>
44197 <entry>Default: <emphasis>0600</emphasis></entry>
44198 </row>
44199 </tbody>
44200 </tgroup>
44201 </informaltable>
44202 <para>
44203 This specifies the mode of the created lock file, when a lock file is being
44204 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
44205 </para>
44206 <para>
44207 <indexterm role="option">
44208 <primary><option>lockfile_timeout</option></primary>
44209 </indexterm>
44210 </para>
44211 <informaltable frame="all">
44212 <tgroup cols="4" colsep="0" rowsep="0">
44213 <colspec colwidth="8*" align="left"/>
44214 <colspec colwidth="6*" align="center"/>
44215 <colspec colwidth="6*" align="center"/>
44216 <colspec colwidth="6*" align="right"/>
44217 <tbody>
44218 <row>
44219 <entry><option>lockfile_timeout</option></entry>
44220 <entry>Use: <emphasis>appendfile</emphasis></entry>
44221 <entry>Type: <emphasis>time</emphasis></entry>
44222 <entry>Default: <emphasis>30m</emphasis></entry>
44223 </row>
44224 </tbody>
44225 </tgroup>
44226 </informaltable>
44227 <para>
44228 <indexterm role="concept">
44229 <primary>timeout</primary>
44230 <secondary>mailbox locking</secondary>
44231 </indexterm>
44232 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
44233 exists and is older than this value, it is assumed to have been left behind by
44234 accident, and Exim attempts to remove it.
44235 </para>
44236 <para>
44237 <indexterm role="option">
44238 <primary><option>mailbox_filecount</option></primary>
44239 </indexterm>
44240 </para>
44241 <informaltable frame="all">
44242 <tgroup cols="4" colsep="0" rowsep="0">
44243 <colspec colwidth="8*" align="left"/>
44244 <colspec colwidth="6*" align="center"/>
44245 <colspec colwidth="6*" align="center"/>
44246 <colspec colwidth="6*" align="right"/>
44247 <tbody>
44248 <row>
44249 <entry><option>mailbox_filecount</option></entry>
44250 <entry>Use: <emphasis>appendfile</emphasis></entry>
44251 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44252 <entry>Default: <emphasis>unset</emphasis></entry>
44253 </row>
44254 </tbody>
44255 </tgroup>
44256 </informaltable>
44257 <para>
44258 <indexterm role="concept">
44259 <primary>mailbox</primary>
44260 <secondary>specifying size of</secondary>
44261 </indexterm>
44262 <indexterm role="concept">
44263 <primary>size</primary>
44264 <secondary>of mailbox</secondary>
44265 </indexterm>
44266 If this option is set, it is expanded, and the result is taken as the current
44267 number of files in the mailbox. It must be a decimal number, optionally
44268 followed by K or M. This provides a way of obtaining this information from an
44269 external source that maintains the data.
44270 </para>
44271 <para>
44272 <indexterm role="option">
44273 <primary><option>mailbox_size</option></primary>
44274 </indexterm>
44275 </para>
44276 <informaltable frame="all">
44277 <tgroup cols="4" colsep="0" rowsep="0">
44278 <colspec colwidth="8*" align="left"/>
44279 <colspec colwidth="6*" align="center"/>
44280 <colspec colwidth="6*" align="center"/>
44281 <colspec colwidth="6*" align="right"/>
44282 <tbody>
44283 <row>
44284 <entry><option>mailbox_size</option></entry>
44285 <entry>Use: <emphasis>appendfile</emphasis></entry>
44286 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44287 <entry>Default: <emphasis>unset</emphasis></entry>
44288 </row>
44289 </tbody>
44290 </tgroup>
44291 </informaltable>
44292 <para>
44293 <indexterm role="concept">
44294 <primary>mailbox</primary>
44295 <secondary>specifying size of</secondary>
44296 </indexterm>
44297 <indexterm role="concept">
44298 <primary>size</primary>
44299 <secondary>of mailbox</secondary>
44300 </indexterm>
44301 If this option is set, it is expanded, and the result is taken as the current
44302 size the mailbox. It must be a decimal number, optionally followed by K or M.
44303 This provides a way of obtaining this information from an external source that
44304 maintains the data. This is likely to be helpful for maildir deliveries where
44305 it is computationally expensive to compute the size of a mailbox.
44306 </para>
44307 <para>
44308 <indexterm role="option">
44309 <primary><option>maildir_format</option></primary>
44310 </indexterm>
44311 </para>
44312 <informaltable frame="all">
44313 <tgroup cols="4" colsep="0" rowsep="0">
44314 <colspec colwidth="8*" align="left"/>
44315 <colspec colwidth="6*" align="center"/>
44316 <colspec colwidth="6*" align="center"/>
44317 <colspec colwidth="6*" align="right"/>
44318 <tbody>
44319 <row>
44320 <entry><option>maildir_format</option></entry>
44321 <entry>Use: <emphasis>appendfile</emphasis></entry>
44322 <entry>Type: <emphasis>boolean</emphasis></entry>
44323 <entry>Default: <emphasis>false</emphasis></entry>
44324 </row>
44325 </tbody>
44326 </tgroup>
44327 </informaltable>
44328 <para>
44329 <indexterm role="concept">
44330 <primary>maildir format</primary>
44331 <secondary>specifying</secondary>
44332 </indexterm>
44333 If this option is set with the <option>directory</option> option, the delivery is into a new
44334 file, in the <quote>maildir</quote> format that is used by other mail software. When the
44335 transport is activated directly from a <command>redirect</command> router (for example, the
44336 <command>address_file</command> transport in the default configuration), setting
44337 <option>maildir_format</option> causes the path received from the router to be treated as a
44338 directory, whether or not it ends with <literal>/</literal>. This option is available only if
44339 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
44340 <xref linkend="SECTmaildirdelivery"/> below for further details.
44341 </para>
44342 <para>
44343 <indexterm role="option">
44344 <primary><option>maildir_quota_directory_regex</option></primary>
44345 </indexterm>
44346 </para>
44347 <informaltable frame="all">
44348 <tgroup cols="4" colsep="0" rowsep="0">
44349 <colspec colwidth="8*" align="left"/>
44350 <colspec colwidth="6*" align="center"/>
44351 <colspec colwidth="6*" align="center"/>
44352 <colspec colwidth="6*" align="right"/>
44353 <tbody>
44354 <row>
44355 <entry><option>maildir_quota_directory_regex</option></entry>
44356 <entry>Use: <emphasis>appendfile</emphasis></entry>
44357 <entry>Type: <emphasis>string</emphasis></entry>
44358 <entry>Default: <emphasis>See below</emphasis></entry>
44359 </row>
44360 </tbody>
44361 </tgroup>
44362 </informaltable>
44363 <para>
44364 <indexterm role="concept">
44365 <primary>maildir format</primary>
44366 <secondary>quota; directories included in</secondary>
44367 </indexterm>
44368 <indexterm role="concept">
44369 <primary>quota</primary>
44370 <secondary>maildir; directories included in</secondary>
44371 </indexterm>
44372 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
44373 a regular expression for specifying directories, relative to the quota
44374 directory (see <option>quota_directory</option>), that should be included in the quota
44375 calculation. The default value is:
44376 </para>
44377 <literallayout class="monospaced">
44378 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
44379 </literallayout>
44380 <para>
44381 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
44382 (directories whose names begin with a dot). If you want to exclude the
44383 <filename>Trash</filename>
44384 folder from the count (as some sites do), you need to change this setting to
44385 </para>
44386 <literallayout class="monospaced">
44387 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
44388 </literallayout>
44389 <para>
44390 This uses a negative lookahead in the regular expression to exclude the
44391 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
44392 calculations, quota processing is bypassed for any messages that are delivered
44393 directly into that directory.
44394 </para>
44395 <para>
44396 <indexterm role="option">
44397 <primary><option>maildir_retries</option></primary>
44398 </indexterm>
44399 </para>
44400 <informaltable frame="all">
44401 <tgroup cols="4" colsep="0" rowsep="0">
44402 <colspec colwidth="8*" align="left"/>
44403 <colspec colwidth="6*" align="center"/>
44404 <colspec colwidth="6*" align="center"/>
44405 <colspec colwidth="6*" align="right"/>
44406 <tbody>
44407 <row>
44408 <entry><option>maildir_retries</option></entry>
44409 <entry>Use: <emphasis>appendfile</emphasis></entry>
44410 <entry>Type: <emphasis>integer</emphasis></entry>
44411 <entry>Default: <emphasis>10</emphasis></entry>
44412 </row>
44413 </tbody>
44414 </tgroup>
44415 </informaltable>
44416 <para>
44417 This option specifies the number of times to retry when writing a file in
44418 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
44419 </para>
44420 <para>
44421 <indexterm role="option">
44422 <primary><option>maildir_tag</option></primary>
44423 </indexterm>
44424 </para>
44425 <informaltable frame="all">
44426 <tgroup cols="4" colsep="0" rowsep="0">
44427 <colspec colwidth="8*" align="left"/>
44428 <colspec colwidth="6*" align="center"/>
44429 <colspec colwidth="6*" align="center"/>
44430 <colspec colwidth="6*" align="right"/>
44431 <tbody>
44432 <row>
44433 <entry><option>maildir_tag</option></entry>
44434 <entry>Use: <emphasis>appendfile</emphasis></entry>
44435 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44436 <entry>Default: <emphasis>unset</emphasis></entry>
44437 </row>
44438 </tbody>
44439 </tgroup>
44440 </informaltable>
44441 <para>
44442 This option applies only to deliveries in maildir format, and is described in
44443 section <xref linkend="SECTmaildirdelivery"/> below.
44444 </para>
44445 <para>
44446 <indexterm role="option">
44447 <primary><option>maildir_use_size_file</option></primary>
44448 </indexterm>
44449 </para>
44450 <informaltable frame="all">
44451 <tgroup cols="4" colsep="0" rowsep="0">
44452 <colspec colwidth="8*" align="left"/>
44453 <colspec colwidth="6*" align="center"/>
44454 <colspec colwidth="6*" align="center"/>
44455 <colspec colwidth="6*" align="right"/>
44456 <tbody>
44457 <row>
44458 <entry><option>maildir_use_size_file</option></entry>
44459 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
44460 <entry>Type: <emphasis>boolean</emphasis></entry>
44461 <entry>Default: <emphasis>false</emphasis></entry>
44462 </row>
44463 </tbody>
44464 </tgroup>
44465 </informaltable>
44466 <para>
44467 <indexterm role="concept">
44468 <primary>maildir format</primary>
44469 <secondary><filename>maildirsize</filename> file</secondary>
44470 </indexterm>
44471 The result of string expansion for this option must be a valid boolean value.
44472 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
44473 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
44474 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
44475 value is zero. See <option>maildir_quota_directory_regex</option> above and section
44476 <xref linkend="SECTmaildirdelivery"/> below for further details.
44477 </para>
44478 <para>
44479 <indexterm role="option">
44480 <primary><option>maildirfolder_create_regex</option></primary>
44481 </indexterm>
44482 </para>
44483 <informaltable frame="all">
44484 <tgroup cols="4" colsep="0" rowsep="0">
44485 <colspec colwidth="8*" align="left"/>
44486 <colspec colwidth="6*" align="center"/>
44487 <colspec colwidth="6*" align="center"/>
44488 <colspec colwidth="6*" align="right"/>
44489 <tbody>
44490 <row>
44491 <entry><option>maildirfolder_create_regex</option></entry>
44492 <entry>Use: <emphasis>appendfile</emphasis></entry>
44493 <entry>Type: <emphasis>string</emphasis></entry>
44494 <entry>Default: <emphasis>unset</emphasis></entry>
44495 </row>
44496 </tbody>
44497 </tgroup>
44498 </informaltable>
44499 <para>
44500 <indexterm role="concept">
44501 <primary>maildir format</primary>
44502 <secondary><filename>maildirfolder</filename> file</secondary>
44503 </indexterm>
44504 <indexterm role="concept">
44505 <primary><filename>maildirfolder</filename>, creating</primary>
44506 </indexterm>
44507 The value of this option is a regular expression. If it is unset, it has no
44508 effect. Otherwise, before a maildir delivery takes place, the pattern is
44509 matched against the name of the maildir directory, that is, the directory
44510 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
44511 delivery. If there is a match, Exim checks for the existence of a file called
44512 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
44513 See section <xref linkend="SECTmaildirdelivery"/> for more details.
44514 </para>
44515 <para>
44516 <indexterm role="option">
44517 <primary><option>mailstore_format</option></primary>
44518 </indexterm>
44519 </para>
44520 <informaltable frame="all">
44521 <tgroup cols="4" colsep="0" rowsep="0">
44522 <colspec colwidth="8*" align="left"/>
44523 <colspec colwidth="6*" align="center"/>
44524 <colspec colwidth="6*" align="center"/>
44525 <colspec colwidth="6*" align="right"/>
44526 <tbody>
44527 <row>
44528 <entry><option>mailstore_format</option></entry>
44529 <entry>Use: <emphasis>appendfile</emphasis></entry>
44530 <entry>Type: <emphasis>boolean</emphasis></entry>
44531 <entry>Default: <emphasis>false</emphasis></entry>
44532 </row>
44533 </tbody>
44534 </tgroup>
44535 </informaltable>
44536 <para>
44537 <indexterm role="concept">
44538 <primary>mailstore format</primary>
44539 <secondary>specifying</secondary>
44540 </indexterm>
44541 If this option is set with the <option>directory</option> option, the delivery is into two
44542 new files in  <quote>mailstore</quote> format. The option is available only if
44543 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
44544 below for further details.
44545 </para>
44546 <para>
44547 <indexterm role="option">
44548 <primary><option>mailstore_prefix</option></primary>
44549 </indexterm>
44550 </para>
44551 <informaltable frame="all">
44552 <tgroup cols="4" colsep="0" rowsep="0">
44553 <colspec colwidth="8*" align="left"/>
44554 <colspec colwidth="6*" align="center"/>
44555 <colspec colwidth="6*" align="center"/>
44556 <colspec colwidth="6*" align="right"/>
44557 <tbody>
44558 <row>
44559 <entry><option>mailstore_prefix</option></entry>
44560 <entry>Use: <emphasis>appendfile</emphasis></entry>
44561 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44562 <entry>Default: <emphasis>unset</emphasis></entry>
44563 </row>
44564 </tbody>
44565 </tgroup>
44566 </informaltable>
44567 <para>
44568 This option applies only to deliveries in mailstore format, and is described in
44569 section <xref linkend="SECTopdir"/> below.
44570 </para>
44571 <para>
44572 <indexterm role="option">
44573 <primary><option>mailstore_suffix</option></primary>
44574 </indexterm>
44575 </para>
44576 <informaltable frame="all">
44577 <tgroup cols="4" colsep="0" rowsep="0">
44578 <colspec colwidth="8*" align="left"/>
44579 <colspec colwidth="6*" align="center"/>
44580 <colspec colwidth="6*" align="center"/>
44581 <colspec colwidth="6*" align="right"/>
44582 <tbody>
44583 <row>
44584 <entry><option>mailstore_suffix</option></entry>
44585 <entry>Use: <emphasis>appendfile</emphasis></entry>
44586 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44587 <entry>Default: <emphasis>unset</emphasis></entry>
44588 </row>
44589 </tbody>
44590 </tgroup>
44591 </informaltable>
44592 <para>
44593 This option applies only to deliveries in mailstore format, and is described in
44594 section <xref linkend="SECTopdir"/> below.
44595 </para>
44596 <para>
44597 <indexterm role="option">
44598 <primary><option>mbx_format</option></primary>
44599 </indexterm>
44600 </para>
44601 <informaltable frame="all">
44602 <tgroup cols="4" colsep="0" rowsep="0">
44603 <colspec colwidth="8*" align="left"/>
44604 <colspec colwidth="6*" align="center"/>
44605 <colspec colwidth="6*" align="center"/>
44606 <colspec colwidth="6*" align="right"/>
44607 <tbody>
44608 <row>
44609 <entry><option>mbx_format</option></entry>
44610 <entry>Use: <emphasis>appendfile</emphasis></entry>
44611 <entry>Type: <emphasis>boolean</emphasis></entry>
44612 <entry>Default: <emphasis>false</emphasis></entry>
44613 </row>
44614 </tbody>
44615 </tgroup>
44616 </informaltable>
44617 <para>
44618 <indexterm role="concept">
44619 <primary>locking files</primary>
44620 </indexterm>
44621 <indexterm role="concept">
44622 <primary>file</primary>
44623 <secondary>locking</secondary>
44624 </indexterm>
44625 <indexterm role="concept">
44626 <primary>file</primary>
44627 <secondary>MBX format</secondary>
44628 </indexterm>
44629 <indexterm role="concept">
44630 <primary>MBX format, specifying</primary>
44631 </indexterm>
44632 This option is available only if Exim has been compiled with SUPPORT_MBX
44633 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
44634 the message is appended to the mailbox file in MBX format instead of
44635 traditional Unix format. This format is supported by Pine4 and its associated
44636 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
44637 </para>
44638 <para>
44639 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
44640 automatically changed by the use of <option>mbx_format</option>. They should normally be set
44641 empty when using MBX format, so this option almost always appears in this
44642 combination:
44643 </para>
44644 <literallayout class="monospaced">
44645 mbx_format = true
44646 message_prefix =
44647 message_suffix =
44648 </literallayout>
44649 <para>
44650 If none of the locking options are mentioned in the configuration,
44651 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
44652 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
44653 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
44654 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
44655 should not be used if any program that does not use this form of locking is
44656 going to access the mailbox, nor should it be used if the mailbox file is NFS
44657 mounted, because it works only when the mailbox is accessed from a single host.
44658 </para>
44659 <para>
44660 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
44661 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
44662 (this means for the whole of a Pine or IMAP session), Exim will not be able to
44663 append messages to it.
44664 </para>
44665 <para>
44666 <indexterm role="option">
44667 <primary><option>message_prefix</option></primary>
44668 </indexterm>
44669 </para>
44670 <informaltable frame="all">
44671 <tgroup cols="4" colsep="0" rowsep="0">
44672 <colspec colwidth="8*" align="left"/>
44673 <colspec colwidth="6*" align="center"/>
44674 <colspec colwidth="6*" align="center"/>
44675 <colspec colwidth="6*" align="right"/>
44676 <tbody>
44677 <row>
44678 <entry><option>message_prefix</option></entry>
44679 <entry>Use: <emphasis>appendfile</emphasis></entry>
44680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44681 <entry>Default: <emphasis>see below</emphasis></entry>
44682 </row>
44683 </tbody>
44684 </tgroup>
44685 </informaltable>
44686 <para>
44687 <indexterm role="concept">
44688 <primary><quote>From</quote> line</primary>
44689 </indexterm>
44690 The string specified here is expanded and output at the start of every message.
44691 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
44692 in which case it is:
44693 </para>
44694 <literallayout class="monospaced">
44695 message_prefix = "From ${if def:return_path{$return_path}\
44696   {MAILER-DAEMON}} $tod_bsdinbox\n"
44697 </literallayout>
44698 <para>
44699 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44700 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
44701 </para>
44702 <para>
44703 <indexterm role="option">
44704 <primary><option>message_suffix</option></primary>
44705 </indexterm>
44706 </para>
44707 <informaltable frame="all">
44708 <tgroup cols="4" colsep="0" rowsep="0">
44709 <colspec colwidth="8*" align="left"/>
44710 <colspec colwidth="6*" align="center"/>
44711 <colspec colwidth="6*" align="center"/>
44712 <colspec colwidth="6*" align="right"/>
44713 <tbody>
44714 <row>
44715 <entry><option>message_suffix</option></entry>
44716 <entry>Use: <emphasis>appendfile</emphasis></entry>
44717 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44718 <entry>Default: <emphasis>see below</emphasis></entry>
44719 </row>
44720 </tbody>
44721 </tgroup>
44722 </informaltable>
44723 <para>
44724 The string specified here is expanded and output at the end of every message.
44725 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
44726 in which case it is a single newline character. The suffix can be suppressed by
44727 setting
44728 </para>
44729 <literallayout class="monospaced">
44730 message_suffix =
44731 </literallayout>
44732 <para>
44733 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
44734 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
44735 </para>
44736 <para>
44737 <indexterm role="option">
44738 <primary><option>mode</option></primary>
44739 </indexterm>
44740 </para>
44741 <informaltable frame="all">
44742 <tgroup cols="4" colsep="0" rowsep="0">
44743 <colspec colwidth="8*" align="left"/>
44744 <colspec colwidth="6*" align="center"/>
44745 <colspec colwidth="6*" align="center"/>
44746 <colspec colwidth="6*" align="right"/>
44747 <tbody>
44748 <row>
44749 <entry><option>mode</option></entry>
44750 <entry>Use: <emphasis>appendfile</emphasis></entry>
44751 <entry>Type: <emphasis>octal integer</emphasis></entry>
44752 <entry>Default: <emphasis>0600</emphasis></entry>
44753 </row>
44754 </tbody>
44755 </tgroup>
44756 </informaltable>
44757 <para>
44758 If the output file is created, it is given this mode. If it already exists and
44759 has wider permissions, they are reduced to this mode. If it has narrower
44760 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
44761 if the delivery is the result of a <option>save</option> command in a filter file specifying
44762 a particular mode, the mode of the output file is always forced to take that
44763 value, and this option is ignored.
44764 </para>
44765 <para>
44766 <indexterm role="option">
44767 <primary><option>mode_fail_narrower</option></primary>
44768 </indexterm>
44769 </para>
44770 <informaltable frame="all">
44771 <tgroup cols="4" colsep="0" rowsep="0">
44772 <colspec colwidth="8*" align="left"/>
44773 <colspec colwidth="6*" align="center"/>
44774 <colspec colwidth="6*" align="center"/>
44775 <colspec colwidth="6*" align="right"/>
44776 <tbody>
44777 <row>
44778 <entry><option>mode_fail_narrower</option></entry>
44779 <entry>Use: <emphasis>appendfile</emphasis></entry>
44780 <entry>Type: <emphasis>boolean</emphasis></entry>
44781 <entry>Default: <emphasis>true</emphasis></entry>
44782 </row>
44783 </tbody>
44784 </tgroup>
44785 </informaltable>
44786 <para>
44787 This option applies in the case when an existing mailbox file has a narrower
44788 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
44789 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
44790 continues with the delivery attempt, using the existing mode of the file.
44791 </para>
44792 <para>
44793 <indexterm role="option">
44794 <primary><option>notify_comsat</option></primary>
44795 </indexterm>
44796 </para>
44797 <informaltable frame="all">
44798 <tgroup cols="4" colsep="0" rowsep="0">
44799 <colspec colwidth="8*" align="left"/>
44800 <colspec colwidth="6*" align="center"/>
44801 <colspec colwidth="6*" align="center"/>
44802 <colspec colwidth="6*" align="right"/>
44803 <tbody>
44804 <row>
44805 <entry><option>notify_comsat</option></entry>
44806 <entry>Use: <emphasis>appendfile</emphasis></entry>
44807 <entry>Type: <emphasis>boolean</emphasis></entry>
44808 <entry>Default: <emphasis>false</emphasis></entry>
44809 </row>
44810 </tbody>
44811 </tgroup>
44812 </informaltable>
44813 <para>
44814 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
44815 successful delivery to a user mailbox. This is the daemon that notifies logged
44816 on users about incoming mail.
44817 </para>
44818 <para>
44819 <indexterm role="option">
44820 <primary><option>quota</option></primary>
44821 </indexterm>
44822 </para>
44823 <informaltable frame="all">
44824 <tgroup cols="4" colsep="0" rowsep="0">
44825 <colspec colwidth="8*" align="left"/>
44826 <colspec colwidth="6*" align="center"/>
44827 <colspec colwidth="6*" align="center"/>
44828 <colspec colwidth="6*" align="right"/>
44829 <tbody>
44830 <row>
44831 <entry><option>quota</option></entry>
44832 <entry>Use: <emphasis>appendfile</emphasis></entry>
44833 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44834 <entry>Default: <emphasis>unset</emphasis></entry>
44835 </row>
44836 </tbody>
44837 </tgroup>
44838 </informaltable>
44839 <para>
44840 <indexterm role="concept">
44841 <primary>quota</primary>
44842 <secondary>imposed by Exim</secondary>
44843 </indexterm>
44844 This option imposes a limit on the size of the file to which Exim is appending,
44845 or to the total space used in the directory tree when the <option>directory</option> option
44846 is set. In the latter case, computation of the space used is expensive, because
44847 all the files in the directory (and any sub-directories) have to be
44848 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
44849 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
44850 have no shell access to their mailboxes).
44851 </para>
44852 <para>
44853 As there is no interlock against two simultaneous deliveries into a
44854 multi-file mailbox, it is possible for the quota to be overrun in this case.
44855 For single-file mailboxes, of course, an interlock is a necessity.
44856 </para>
44857 <para>
44858 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
44859 may be a lot less than the actual amount of disk space allocated to the file.
44860 If the sizes of a number of files are being added up, the rounding effect can
44861 become quite noticeable, especially on systems that have large block sizes.
44862 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
44863 the obvious value which users understand most easily.
44864 </para>
44865 <para>
44866 The value of the option is expanded, and must then be a numerical value
44867 (decimal point allowed), optionally followed by one of the letters K, M, or G,
44868 for kilobytes, megabytes, or gigabytes, optionally followed by a slash
44869 and further option modifiers. If Exim is running on a system with
44870 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
44871 be handled.
44872 </para>
44873 <para>
44874 The option modifier <option>no_check</option> can be used to force delivery even if the over
44875 quota condition is met. The quota gets updated as usual.
44876 </para>
44877 <para>
44878 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
44879 </para>
44880 <para>
44881 The expansion happens while Exim is running as root, before it changes uid for
44882 the delivery. This means that files that are inaccessible to the end user can
44883 be used to hold quota values that are looked up in the expansion. When delivery
44884 fails because this quota is exceeded, the handling of the error is as for
44885 system quota failures.
44886 </para>
44887 <para>
44888 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
44889 mailbox to the specified maximum size, though the value is not accurate to the
44890 last byte, owing to separator lines and additional headers that may get added
44891 during message delivery. When a mailbox is nearly full, large messages may get
44892 refused even though small ones are accepted, because the size of the current
44893 message is added to the quota when the check is made. This behaviour can be
44894 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
44895 for exceeding the quota does not include the current message. Thus, deliveries
44896 continue until the quota has been exceeded; thereafter, no further messages are
44897 delivered. See also <option>quota_warn_threshold</option>.
44898 </para>
44899 <para>
44900 <indexterm role="option">
44901 <primary><option>quota_directory</option></primary>
44902 </indexterm>
44903 </para>
44904 <informaltable frame="all">
44905 <tgroup cols="4" colsep="0" rowsep="0">
44906 <colspec colwidth="8*" align="left"/>
44907 <colspec colwidth="6*" align="center"/>
44908 <colspec colwidth="6*" align="center"/>
44909 <colspec colwidth="6*" align="right"/>
44910 <tbody>
44911 <row>
44912 <entry><option>quota_directory</option></entry>
44913 <entry>Use: <emphasis>appendfile</emphasis></entry>
44914 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44915 <entry>Default: <emphasis>unset</emphasis></entry>
44916 </row>
44917 </tbody>
44918 </tgroup>
44919 </informaltable>
44920 <para>
44921 This option defines the directory to check for quota purposes when delivering
44922 into individual files. The default is the delivery directory, or, if a file
44923 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
44924 delivery directory.
44925 </para>
44926 <para>
44927 <indexterm role="option">
44928 <primary><option>quota_filecount</option></primary>
44929 </indexterm>
44930 </para>
44931 <informaltable frame="all">
44932 <tgroup cols="4" colsep="0" rowsep="0">
44933 <colspec colwidth="8*" align="left"/>
44934 <colspec colwidth="6*" align="center"/>
44935 <colspec colwidth="6*" align="center"/>
44936 <colspec colwidth="6*" align="right"/>
44937 <tbody>
44938 <row>
44939 <entry><option>quota_filecount</option></entry>
44940 <entry>Use: <emphasis>appendfile</emphasis></entry>
44941 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44942 <entry>Default: <emphasis>0</emphasis></entry>
44943 </row>
44944 </tbody>
44945 </tgroup>
44946 </informaltable>
44947 <para>
44948 This option applies when the <option>directory</option> option is set. It limits the total
44949 number of files in the directory (compare the inode limit in system quotas). It
44950 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
44951 failure causes delivery to be deferred. A value of zero is interpreted as
44952 <quote>no quota</quote>.
44953 </para>
44954 <para>
44955 The option modifier <option>no_check</option> can be used to force delivery even if the over
44956 quota condition is met. The quota gets updated as usual.
44957 </para>
44958 <para>
44959 <indexterm role="option">
44960 <primary><option>quota_is_inclusive</option></primary>
44961 </indexterm>
44962 </para>
44963 <informaltable frame="all">
44964 <tgroup cols="4" colsep="0" rowsep="0">
44965 <colspec colwidth="8*" align="left"/>
44966 <colspec colwidth="6*" align="center"/>
44967 <colspec colwidth="6*" align="center"/>
44968 <colspec colwidth="6*" align="right"/>
44969 <tbody>
44970 <row>
44971 <entry><option>quota_is_inclusive</option></entry>
44972 <entry>Use: <emphasis>appendfile</emphasis></entry>
44973 <entry>Type: <emphasis>boolean</emphasis></entry>
44974 <entry>Default: <emphasis>true</emphasis></entry>
44975 </row>
44976 </tbody>
44977 </tgroup>
44978 </informaltable>
44979 <para>
44980 See <option>quota</option> above.
44981 </para>
44982 <para>
44983 <indexterm role="option">
44984 <primary><option>quota_size_regex</option></primary>
44985 </indexterm>
44986 </para>
44987 <informaltable frame="all">
44988 <tgroup cols="4" colsep="0" rowsep="0">
44989 <colspec colwidth="8*" align="left"/>
44990 <colspec colwidth="6*" align="center"/>
44991 <colspec colwidth="6*" align="center"/>
44992 <colspec colwidth="6*" align="right"/>
44993 <tbody>
44994 <row>
44995 <entry><option>quota_size_regex</option></entry>
44996 <entry>Use: <emphasis>appendfile</emphasis></entry>
44997 <entry>Type: <emphasis>string</emphasis></entry>
44998 <entry>Default: <emphasis>unset</emphasis></entry>
44999 </row>
45000 </tbody>
45001 </tgroup>
45002 </informaltable>
45003 <para>
45004 This option applies when one of the delivery modes that writes a separate file
45005 for each message is being used. When Exim wants to find the size of one of
45006 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
45007 If this is set to a regular expression that matches the filename, and it
45008 captures one string, that string is interpreted as a representation of the
45009 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
45010 </para>
45011 <para>
45012 This feature is useful only when users have no shell access to their mailboxes
45013 &ndash; otherwise they could defeat the quota simply by renaming the files. This
45014 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
45015 the file length to the filename. For example:
45016 </para>
45017 <literallayout class="monospaced">
45018 maildir_tag = ,S=$message_size
45019 quota_size_regex = ,S=(\d+)
45020 </literallayout>
45021 <para>
45022 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
45023 number of lines in the message.
45024 </para>
45025 <para>
45026 The regular expression should not assume that the length is at the end of the
45027 filename (even though <option>maildir_tag</option> puts it there) because maildir MUAs
45028 sometimes add other information onto the ends of message filenames.
45029 </para>
45030 <para>
45031 Section <xref linkend="SECID136"/> contains further information.
45032 </para>
45033 <para>
45034 This option should not be used when other message-handling software
45035 may duplicate messages by making hardlinks to the files.  When that is done Exim
45036 will count the message size once for each filename, in contrast with the actual
45037 disk usage.  When the option is not set, calculating total usage requires
45038 a system-call per file to get the size; the number of links is then available also
45039 as is used to adjust the effective size.
45040 </para>
45041 <para>
45042 <indexterm role="option">
45043 <primary><option>quota_warn_message</option></primary>
45044 </indexterm>
45045 </para>
45046 <informaltable frame="all">
45047 <tgroup cols="4" colsep="0" rowsep="0">
45048 <colspec colwidth="8*" align="left"/>
45049 <colspec colwidth="6*" align="center"/>
45050 <colspec colwidth="6*" align="center"/>
45051 <colspec colwidth="6*" align="right"/>
45052 <tbody>
45053 <row>
45054 <entry><option>quota_warn_message</option></entry>
45055 <entry>Use: <emphasis>appendfile</emphasis></entry>
45056 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45057 <entry>Default: <emphasis>see below</emphasis></entry>
45058 </row>
45059 </tbody>
45060 </tgroup>
45061 </informaltable>
45062 <para>
45063 See below for the use of this option. If it is not set when
45064 <option>quota_warn_threshold</option> is set, it defaults to
45065 </para>
45066 <literallayout class="monospaced">
45067 quota_warn_message = "\
45068   To: $local_part@$domain\n\
45069   Subject: Your mailbox\n\n\
45070   This message is automatically created \
45071   by mail delivery software.\n\n\
45072   The size of your mailbox has exceeded \
45073   a warning threshold that is\n\
45074   set by the system administrator.\n"
45075 </literallayout>
45076 <para>
45077 <indexterm role="option">
45078 <primary><option>quota_warn_threshold</option></primary>
45079 </indexterm>
45080 </para>
45081 <informaltable frame="all">
45082 <tgroup cols="4" colsep="0" rowsep="0">
45083 <colspec colwidth="8*" align="left"/>
45084 <colspec colwidth="6*" align="center"/>
45085 <colspec colwidth="6*" align="center"/>
45086 <colspec colwidth="6*" align="right"/>
45087 <tbody>
45088 <row>
45089 <entry><option>quota_warn_threshold</option></entry>
45090 <entry>Use: <emphasis>appendfile</emphasis></entry>
45091 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45092 <entry>Default: <emphasis>0</emphasis></entry>
45093 </row>
45094 </tbody>
45095 </tgroup>
45096 </informaltable>
45097 <para>
45098 <indexterm role="concept">
45099 <primary>quota</primary>
45100 <secondary>warning threshold</secondary>
45101 </indexterm>
45102 <indexterm role="concept">
45103 <primary>mailbox</primary>
45104 <secondary>size warning</secondary>
45105 </indexterm>
45106 <indexterm role="concept">
45107 <primary>size</primary>
45108 <secondary>of mailbox</secondary>
45109 </indexterm>
45110 This option is expanded in the same way as <option>quota</option> (see above). If the
45111 resulting value is greater than zero, and delivery of the message causes the
45112 size of the file or total space in the directory tree to cross the given
45113 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
45114 may be specified as a percentage of it by following the value with a percent
45115 sign. For example:
45116 </para>
45117 <literallayout class="monospaced">
45118 quota = 10M
45119 quota_warn_threshold = 75%
45120 </literallayout>
45121 <para>
45122 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
45123 percent sign is ignored.
45124 </para>
45125 <para>
45126 The warning message itself is specified by the <option>quota_warn_message</option> option,
45127 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
45128 warning message. These do not necessarily have to include the recipient(s) of
45129 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
45130 can include any other header lines that you want. If you do not include a
45131 <emphasis>From:</emphasis> line, the default is:
45132 </para>
45133 <literallayout class="monospaced">
45134 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
45135 </literallayout>
45136 <para>
45137 <indexterm role="option">
45138 <primary><option>errors_reply_to</option></primary>
45139 </indexterm>
45140 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
45141 option.
45142 </para>
45143 <para>
45144 The <option>quota</option> option does not have to be set in order to use this option; they
45145 are independent of one another except when the threshold is specified as a
45146 percentage.
45147 </para>
45148 <para>
45149 <indexterm role="option">
45150 <primary><option>use_bsmtp</option></primary>
45151 </indexterm>
45152 </para>
45153 <informaltable frame="all">
45154 <tgroup cols="4" colsep="0" rowsep="0">
45155 <colspec colwidth="8*" align="left"/>
45156 <colspec colwidth="6*" align="center"/>
45157 <colspec colwidth="6*" align="center"/>
45158 <colspec colwidth="6*" align="right"/>
45159 <tbody>
45160 <row>
45161 <entry><option>use_bsmtp</option></entry>
45162 <entry>Use: <emphasis>appendfile</emphasis></entry>
45163 <entry>Type: <emphasis>boolean</emphasis></entry>
45164 <entry>Default: <emphasis>false</emphasis></entry>
45165 </row>
45166 </tbody>
45167 </tgroup>
45168 </informaltable>
45169 <para>
45170 <indexterm role="concept">
45171 <primary>envelope from</primary>
45172 </indexterm>
45173 <indexterm role="concept">
45174 <primary>envelope sender</primary>
45175 </indexterm>
45176 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
45177 format, with the envelope sender and recipient(s) included as SMTP commands. If
45178 you want to include a leading HELO command with such messages, you can do
45179 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
45180 for details of batch SMTP.
45181 </para>
45182 <para>
45183 <indexterm role="option">
45184 <primary><option>use_crlf</option></primary>
45185 </indexterm>
45186 </para>
45187 <informaltable frame="all">
45188 <tgroup cols="4" colsep="0" rowsep="0">
45189 <colspec colwidth="8*" align="left"/>
45190 <colspec colwidth="6*" align="center"/>
45191 <colspec colwidth="6*" align="center"/>
45192 <colspec colwidth="6*" align="right"/>
45193 <tbody>
45194 <row>
45195 <entry><option>use_crlf</option></entry>
45196 <entry>Use: <emphasis>appendfile</emphasis></entry>
45197 <entry>Type: <emphasis>boolean</emphasis></entry>
45198 <entry>Default: <emphasis>false</emphasis></entry>
45199 </row>
45200 </tbody>
45201 </tgroup>
45202 </informaltable>
45203 <para>
45204 <indexterm role="concept">
45205 <primary>carriage return</primary>
45206 </indexterm>
45207 <indexterm role="concept">
45208 <primary>linefeed</primary>
45209 </indexterm>
45210 This option causes lines to be terminated with the two-character CRLF sequence
45211 (carriage return, linefeed) instead of just a linefeed character. In the case
45212 of batched SMTP, the byte sequence written to the file is then an exact image
45213 of what would be sent down a real SMTP connection.
45214 </para>
45215 <para>
45216 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
45217 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
45218 in Berkeley-style mailboxes) are written verbatim, so must contain their own
45219 carriage return characters if these are needed. In cases where these options
45220 have non-empty defaults, the values end with a single linefeed, so they must be
45221 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
45222 </para>
45223 <para>
45224 <indexterm role="option">
45225 <primary><option>use_fcntl_lock</option></primary>
45226 </indexterm>
45227 </para>
45228 <informaltable frame="all">
45229 <tgroup cols="4" colsep="0" rowsep="0">
45230 <colspec colwidth="8*" align="left"/>
45231 <colspec colwidth="6*" align="center"/>
45232 <colspec colwidth="6*" align="center"/>
45233 <colspec colwidth="6*" align="right"/>
45234 <tbody>
45235 <row>
45236 <entry><option>use_fcntl_lock</option></entry>
45237 <entry>Use: <emphasis>appendfile</emphasis></entry>
45238 <entry>Type: <emphasis>boolean</emphasis></entry>
45239 <entry>Default: <emphasis>see below</emphasis></entry>
45240 </row>
45241 </tbody>
45242 </tgroup>
45243 </informaltable>
45244 <para>
45245 This option controls the use of the <function>fcntl()</function> function to lock a file for
45246 exclusive use when a message is being appended. It is set by default unless
45247 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
45248 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
45249 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
45250 </para>
45251 <para>
45252 <indexterm role="option">
45253 <primary><option>use_flock_lock</option></primary>
45254 </indexterm>
45255 </para>
45256 <informaltable frame="all">
45257 <tgroup cols="4" colsep="0" rowsep="0">
45258 <colspec colwidth="8*" align="left"/>
45259 <colspec colwidth="6*" align="center"/>
45260 <colspec colwidth="6*" align="center"/>
45261 <colspec colwidth="6*" align="right"/>
45262 <tbody>
45263 <row>
45264 <entry><option>use_flock_lock</option></entry>
45265 <entry>Use: <emphasis>appendfile</emphasis></entry>
45266 <entry>Type: <emphasis>boolean</emphasis></entry>
45267 <entry>Default: <emphasis>false</emphasis></entry>
45268 </row>
45269 </tbody>
45270 </tgroup>
45271 </informaltable>
45272 <para>
45273 This option is provided to support the use of <function>flock()</function> for file locking, for
45274 the few situations where it is needed. Most modern operating systems support
45275 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
45276 each other. Exim uses <function>fcntl()</function> locking by default.
45277 </para>
45278 <para>
45279 This option is required only if you are using an operating system where
45280 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
45281 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
45282 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
45283 </para>
45284 <para>
45285 <indexterm role="concept">
45286 <primary>Solaris</primary>
45287 <secondary><function>flock()</function> support</secondary>
45288 </indexterm>
45289 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
45290 have it (and some, I think, provide a not quite right version built on top of
45291 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
45292 the ability to use it, and any attempt to do so will cause a configuration
45293 error.
45294 </para>
45295 <para>
45296 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
45297 is just being mapped onto <function>fcntl()</function> by the OS).
45298 </para>
45299 <para>
45300 <indexterm role="option">
45301 <primary><option>use_lockfile</option></primary>
45302 </indexterm>
45303 </para>
45304 <informaltable frame="all">
45305 <tgroup cols="4" colsep="0" rowsep="0">
45306 <colspec colwidth="8*" align="left"/>
45307 <colspec colwidth="6*" align="center"/>
45308 <colspec colwidth="6*" align="center"/>
45309 <colspec colwidth="6*" align="right"/>
45310 <tbody>
45311 <row>
45312 <entry><option>use_lockfile</option></entry>
45313 <entry>Use: <emphasis>appendfile</emphasis></entry>
45314 <entry>Type: <emphasis>boolean</emphasis></entry>
45315 <entry>Default: <emphasis>see below</emphasis></entry>
45316 </row>
45317 </tbody>
45318 </tgroup>
45319 </informaltable>
45320 <para>
45321 If this option is turned off, Exim does not attempt to create a lock file when
45322 appending to a mailbox file. In this situation, the only locking is by
45323 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
45324 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
45325 <function>fcntl()</function> rather than a lock file, and even then only when you are not
45326 delivering over NFS from more than one host.
45327 </para>
45328 <para>
45329 <indexterm role="concept">
45330 <primary>NFS</primary>
45331 <secondary>lock file</secondary>
45332 </indexterm>
45333 In order to append to an NFS file safely from more than one host, it is
45334 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
45335 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
45336 file corruption.
45337 </para>
45338 <para>
45339 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
45340 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
45341 except when <option>mbx_format</option> is set.
45342 </para>
45343 <para>
45344 <indexterm role="option">
45345 <primary><option>use_mbx_lock</option></primary>
45346 </indexterm>
45347 </para>
45348 <informaltable frame="all">
45349 <tgroup cols="4" colsep="0" rowsep="0">
45350 <colspec colwidth="8*" align="left"/>
45351 <colspec colwidth="6*" align="center"/>
45352 <colspec colwidth="6*" align="center"/>
45353 <colspec colwidth="6*" align="right"/>
45354 <tbody>
45355 <row>
45356 <entry><option>use_mbx_lock</option></entry>
45357 <entry>Use: <emphasis>appendfile</emphasis></entry>
45358 <entry>Type: <emphasis>boolean</emphasis></entry>
45359 <entry>Default: <emphasis>see below</emphasis></entry>
45360 </row>
45361 </tbody>
45362 </tgroup>
45363 </informaltable>
45364 <para>
45365 This option is available only if Exim has been compiled with SUPPORT_MBX
45366 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
45367 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
45368 of the locking options are mentioned in the configuration. The locking rules
45369 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
45370 the IMAP4 and POP daemons that come with it (see the discussion below). The
45371 rules allow for shared access to the mailbox. However, this kind of locking
45372 does not work when the mailbox is NFS mounted.
45373 </para>
45374 <para>
45375 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
45376 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
45377 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
45378 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
45379 </para>
45380 </section>
45381 <section id="SECTopappend">
45382 <title>Operational details for appending</title>
45383 <para>
45384 <indexterm role="concept">
45385 <primary>appending to a file</primary>
45386 </indexterm>
45387 <indexterm role="concept">
45388 <primary>file</primary>
45389 <secondary>appending</secondary>
45390 </indexterm>
45391 Before appending to a file, the following preparations are made:
45392 </para>
45393 <itemizedlist>
45394 <listitem>
45395 <para>
45396 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
45397 return is given.
45398 </para>
45399 </listitem>
45400 <listitem>
45401 <para>
45402 <indexterm role="concept">
45403 <primary>directory creation</primary>
45404 </indexterm>
45405 If any directories on the file&#x2019;s path are missing, Exim creates them if the
45406 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
45407 <option>directory_mode</option> option.
45408 </para>
45409 </listitem>
45410 <listitem>
45411 <para>
45412 If <option>file_format</option> is set, the format of an existing file is checked. If this
45413 indicates that a different transport should be used, control is passed to that
45414 transport.
45415 </para>
45416 </listitem>
45417 <listitem>
45418 <para>
45419 <indexterm role="concept">
45420 <primary>file</primary>
45421 <secondary>locking</secondary>
45422 </indexterm>
45423 <indexterm role="concept">
45424 <primary>locking files</primary>
45425 </indexterm>
45426 <indexterm role="concept">
45427 <primary>NFS</primary>
45428 <secondary>lock file</secondary>
45429 </indexterm>
45430 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
45431 reliably over NFS, as follows:
45432 </para>
45433 <orderedlist numeration="arabic">
45434 <listitem>
45435 <para>
45436 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
45437 current time, primary host name, and process id added, by opening for writing
45438 as a new file. If this fails with an access error, delivery is deferred.
45439 </para>
45440 </listitem>
45441 <listitem>
45442 <para>
45443 Close the hitching post file, and hard link it to the lock filename.
45444 </para>
45445 </listitem>
45446 <listitem>
45447 <para>
45448 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
45449 Unlink the hitching post name.
45450 </para>
45451 </listitem>
45452 <listitem>
45453 <para>
45454 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
45455 then unlink hitching post name. If the number of links is exactly two, creation
45456 of the lock file succeeded but something (for example, an NFS server crash and
45457 restart) caused this fact not to be communicated to the <function>link()</function> call.
45458 </para>
45459 </listitem>
45460 <listitem>
45461 <para>
45462 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
45463 up to <option>lock_retries</option> times. However, since any program that writes to a
45464 mailbox should complete its task very quickly, it is reasonable to time out old
45465 lock files that are normally the result of user agent and system crashes. If an
45466 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
45467 it before trying again.
45468 </para>
45469 </listitem>
45470 </orderedlist>
45471 </listitem>
45472 <listitem>
45473 <para>
45474 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
45475 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
45476 than non-existence, delivery is deferred.
45477 </para>
45478 </listitem>
45479 <listitem>
45480 <para>
45481 <indexterm role="concept">
45482 <primary>symbolic link</primary>
45483 <secondary>to mailbox</secondary>
45484 </indexterm>
45485 <indexterm role="concept">
45486 <primary>mailbox</primary>
45487 <secondary>symbolic link</secondary>
45488 </indexterm>
45489 If the file does exist and is a symbolic link, delivery is deferred, unless the
45490 <option>allow_symlink</option> option is set, in which case the ownership of the link is
45491 checked, and then <function>stat()</function> is called to find out about the real file, which
45492 is then subjected to the checks below. The check on the top-level link
45493 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
45494 directory, though allowing symbolic links in this case is definitely not a good
45495 idea. If there is a chain of symbolic links, the intermediate ones are not
45496 checked.
45497 </para>
45498 </listitem>
45499 <listitem>
45500 <para>
45501 If the file already exists but is not a regular file, or if the file&#x2019;s owner
45502 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
45503 different from the user and group under which the delivery is running,
45504 delivery is deferred.
45505 </para>
45506 </listitem>
45507 <listitem>
45508 <para>
45509 If the file&#x2019;s permissions are more generous than specified, they are reduced.
45510 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
45511 is set false, in which case the delivery is tried using the existing
45512 permissions.
45513 </para>
45514 </listitem>
45515 <listitem>
45516 <para>
45517 The file&#x2019;s inode number is saved, and the file is then opened for appending.
45518 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
45519 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
45520 </para>
45521 </listitem>
45522 <listitem>
45523 <para>
45524 If the file is opened successfully, check that the inode number hasn&#x2019;t
45525 changed, that it is still a regular file, and that the owner and permissions
45526 have not changed. If anything is wrong, defer delivery and freeze the message.
45527 </para>
45528 </listitem>
45529 <listitem>
45530 <para>
45531 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
45532 option is set. Otherwise, check that the file is being created in a permitted
45533 directory if the <option>create_file</option> option is set (deferring on failure), and then
45534 open for writing as a new file, with the O_EXCL and O_CREAT options,
45535 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
45536 set). In this case, which can happen if the link points to a non-existent file,
45537 the file is opened for writing using O_CREAT but not O_EXCL, because
45538 that prevents link following.
45539 </para>
45540 </listitem>
45541 <listitem>
45542 <para>
45543 <indexterm role="concept">
45544 <primary>loop</primary>
45545 <secondary>while file testing</secondary>
45546 </indexterm>
45547 If opening fails because the file exists, obey the tests given above for
45548 existing files. However, to avoid looping in a situation where the file is
45549 being continuously created and destroyed, the exists/not-exists loop is broken
45550 after 10 repetitions, and the message is then frozen.
45551 </para>
45552 </listitem>
45553 <listitem>
45554 <para>
45555 If opening fails with any other error, defer delivery.
45556 </para>
45557 </listitem>
45558 <listitem>
45559 <para>
45560 <indexterm role="concept">
45561 <primary>file</primary>
45562 <secondary>locking</secondary>
45563 </indexterm>
45564 <indexterm role="concept">
45565 <primary>locking files</primary>
45566 </indexterm>
45567 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
45568 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
45569 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
45570 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
45571 file, and an exclusive lock on the file whose name is
45572 </para>
45573 <literallayout class="monospaced">
45574 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
45575 </literallayout>
45576 <para>
45577 using the device and inode numbers of the open mailbox file, in accordance with
45578 the MBX locking rules. This file is created with a mode that is specified by
45579 the <option>lockfile_mode</option> option.
45580 </para>
45581 <para>
45582 If Exim fails to lock the file, there are two possible courses of action,
45583 depending on the value of the locking timeout. This is obtained from
45584 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
45585 </para>
45586 <para>
45587 If the timeout value is zero, the file is closed, Exim waits for
45588 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
45589 to lock it again. This happens up to <option>lock_retries</option> times, after which the
45590 delivery is deferred.
45591 </para>
45592 <para>
45593 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
45594 <function>flock()</function> are used (with the given timeout), so there has already been some
45595 waiting involved by the time locking fails. Nevertheless, Exim does not give up
45596 immediately. It retries up to
45597 </para>
45598 <literallayout class="monospaced">
45599 (lock_retries * lock_interval) / &lt;timeout&gt;
45600 </literallayout>
45601 <para>
45602 times (rounded up).
45603 </para>
45604 </listitem>
45605 </itemizedlist>
45606 <para>
45607 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
45608 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
45609 </para>
45610 </section>
45611 <section id="SECTopdir">
45612 <title>Operational details for delivery to a new file</title>
45613 <para>
45614 <indexterm role="concept">
45615 <primary>delivery</primary>
45616 <secondary>to single file</secondary>
45617 </indexterm>
45618 <indexterm role="concept">
45619 <primary><quote>From</quote> line</primary>
45620 </indexterm>
45621 When the <option>directory</option> option is set instead of <option>file</option>, each message is
45622 delivered into a newly-created file or set of files. When <command>appendfile</command> is
45623 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
45624 <option>directory</option> is normally set, because the path for delivery is supplied by the
45625 router. (See for example, the <command>address_file</command> transport in the default
45626 configuration.) In this case, delivery is to a new file if either the path name
45627 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
45628 </para>
45629 <para>
45630 No locking is required while writing the message to a new file, so the various
45631 locking options of the transport are ignored. The <quote>From</quote> line that by default
45632 separates messages in a single file is not normally needed, nor is the escaping
45633 of message lines that start with <quote>From</quote>, and there is no need to ensure a
45634 newline at the end of each message. Consequently, the default values for
45635 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
45636 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
45637 </para>
45638 <para>
45639 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
45640 the files in the delivery directory by default. However, you can specify a
45641 different directory by setting <option>quota_directory</option>. Also, for maildir
45642 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
45643 </para>
45644 <para>
45645 <indexterm role="concept">
45646 <primary>maildir format</primary>
45647 </indexterm>
45648 <indexterm role="concept">
45649 <primary>mailstore format</primary>
45650 </indexterm>
45651 There are three different ways in which delivery to individual files can be
45652 done, controlled by the settings of the <option>maildir_format</option> and
45653 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
45654 formats is not included in the binary unless SUPPORT_MAILDIR or
45655 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
45656 </para>
45657 <para>
45658 <indexterm role="concept">
45659 <primary>directory creation</primary>
45660 </indexterm>
45661 In all three cases an attempt is made to create the directory and any necessary
45662 sub-directories if they do not exist, provided that the <option>create_directory</option>
45663 option is set (the default). The location of a created directory can be
45664 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
45665 the <option>directory_mode</option> option. If creation fails, or if the
45666 <option>create_directory</option> option is not set when creation is required, delivery is
45667 deferred.
45668 </para>
45669 </section>
45670 <section id="SECTmaildirdelivery">
45671 <title>Maildir delivery</title>
45672 <para>
45673 <indexterm role="concept">
45674 <primary>maildir format</primary>
45675 <secondary>description of</secondary>
45676 </indexterm>
45677 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
45678 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
45679 directory that is defined by the <option>directory</option> option (the <quote>delivery
45680 directory</quote>). If the delivery is successful, the file is renamed into the
45681 <filename>new</filename> subdirectory.
45682 </para>
45683 <para>
45684 In the filename, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
45685 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
45686 Exim checks that the time-of-day clock has moved on by at least one microsecond
45687 before terminating the delivery process. This guarantees uniqueness for the
45688 filename. However, as a precaution, Exim calls <function>stat()</function> for the file before
45689 opening it. If any response other than ENOENT (does not exist) is given,
45690 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
45691 </para>
45692 <para>
45693 Before Exim carries out a maildir delivery, it ensures that subdirectories
45694 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
45695 do not exist, Exim tries to create them and any superior directories in their
45696 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
45697 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
45698 contains matches the delivery directory, Exim also ensures that a file called
45699 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
45700 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
45701 </para>
45702 <para>
45703 These features make it possible to use Exim to create all the necessary files
45704 and directories in a maildir mailbox, including subdirectories for maildir++
45705 folders. Consider this example:
45706 </para>
45707 <literallayout class="monospaced">
45708 maildir_format = true
45709 directory = /var/mail/$local_part_data\
45710            ${if eq{$local_part_suffix}{}{}\
45711            {/.${substr_1:$local_part_suffix}}}
45712 maildirfolder_create_regex = /\.[^/]+$
45713 </literallayout>
45714 <para>
45715 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
45716 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
45717 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
45718 not match this name, so Exim will not look for or create the file
45719 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
45720 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
45721 </para>
45722 <para>
45723 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
45724 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
45725 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
45726 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
45727 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
45728 </para>
45729 <para>
45730 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
45731 not inadvertently match the toplevel maildir directory, because a
45732 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
45733 </para>
45734 <para>
45735 <indexterm role="concept">
45736 <primary>quota</primary>
45737 <secondary>in maildir delivery</secondary>
45738 </indexterm>
45739 <indexterm role="concept">
45740 <primary>maildir++</primary>
45741 </indexterm>
45742 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
45743 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
45744 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
45745 Exim assumes the directory is a maildir++ folder directory, which is one level
45746 down from the user&#x2019;s top level mailbox directory. This causes it to start at
45747 the parent directory instead of the current directory when calculating the
45748 amount of space used.
45749 </para>
45750 <para>
45751 One problem with delivering into a multi-file mailbox is that it is
45752 computationally expensive to compute the size of the mailbox for quota
45753 checking. Various approaches have been taken to reduce the amount of work
45754 needed. The next two sections describe two of them. A third alternative is to
45755 use some external process for maintaining the size data, and use the expansion
45756 of the <option>mailbox_size</option> option as a way of importing it into Exim.
45757 </para>
45758 </section>
45759 <section id="SECID135">
45760 <title>Using tags to record message sizes</title>
45761 <para>
45762 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
45763 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
45764 tag is added to its name. However, if adding the tag takes the length of the
45765 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
45766 the tag is dropped and the maildir file is created with no tag.
45767 </para>
45768 <para>
45769 <indexterm role="variable">
45770 <primary><varname>$message_size</varname></primary>
45771 </indexterm>
45772 Tags can be used to encode the size of files in their names; see
45773 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
45774 happens after the message has been written. The value of the <varname>$message_size</varname>
45775 variable is set to the number of bytes actually written. If the expansion is
45776 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
45777 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
45778 Non-printing characters in the string are ignored; if the resulting string is
45779 empty, it is ignored. If it starts with an alphanumeric character, a leading
45780 colon is inserted; this default has not proven to be the path that popular
45781 maildir implementations have chosen (but changing it in Exim would break
45782 backwards compatibility).
45783 </para>
45784 <para>
45785 For one common implementation, you might set:
45786 </para>
45787 <literallayout class="monospaced">
45788 maildir_tag = ,S=${message_size}
45789 </literallayout>
45790 <para>
45791 but you should check the documentation of the other software to be sure.
45792 </para>
45793 <para>
45794 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
45795 as this allows Exim to extract the size from your tag, instead of having to
45796 <function>stat()</function> each message file.
45797 </para>
45798 </section>
45799 <section id="SECID136">
45800 <title>Using a maildirsize file</title>
45801 <para>
45802 <indexterm role="concept">
45803 <primary>quota</primary>
45804 <secondary>in maildir delivery</secondary>
45805 </indexterm>
45806 <indexterm role="concept">
45807 <primary>maildir format</primary>
45808 <secondary><filename>maildirsize</filename> file</secondary>
45809 </indexterm>
45810 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
45811 storing quota and message size information in a file called <filename>maildirsize</filename>
45812 within the toplevel maildir directory. If this file does not exist, Exim
45813 creates it, setting the quota from the <option>quota</option> option of the transport. If
45814 the maildir directory itself does not exist, it is created before any attempt
45815 to write a <filename>maildirsize</filename> file.
45816 </para>
45817 <para>
45818 The <filename>maildirsize</filename> file is used to hold information about the sizes of
45819 messages in the maildir, thus speeding up quota calculations. The quota value
45820 in the file is just a cache; if the quota is changed in the transport, the new
45821 value overrides the cached value when the next message is delivered. The cache
45822 is maintained for the benefit of other programs that access the maildir and
45823 need to know the quota.
45824 </para>
45825 <para>
45826 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
45827 file is maintained (with a zero quota setting), but no quota is imposed.
45828 </para>
45829 <para>
45830 A regular expression is available for controlling which directories in the
45831 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
45832 See the description of the <option>maildir_quota_directory_regex</option> option above for
45833 details.
45834 </para>
45835 </section>
45836 <section id="SECID137">
45837 <title>Mailstore delivery</title>
45838 <para>
45839 <indexterm role="concept">
45840 <primary>mailstore format</primary>
45841 <secondary>description of</secondary>
45842 </indexterm>
45843 If the <option>mailstore_format</option> option is true, each message is written as two
45844 files in the given directory. A unique base name is constructed from the
45845 message id and the current delivery process, and the files that are written use
45846 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
45847 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
45848 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
45849 </para>
45850 <para>
45851 During delivery, the envelope is first written to a file with the suffix
45852 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
45853 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
45854 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
45855 file before accessing either of them. An alternative approach is to wait for
45856 the absence of a <filename>.tmp</filename> file.
45857 </para>
45858 <para>
45859 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
45860 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
45861 the sender address on one line, then all the recipient addresses, one per line.
45862 There can be more than one recipient only if the <option>batch_max</option> option is set
45863 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
45864 appended to the file, followed by a newline if it does not end with one.
45865 </para>
45866 <para>
45867 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
45868 failure, it is ignored. Other expansion errors are treated as serious
45869 configuration errors, and delivery is deferred. The variable
45870 <varname>$mailstore_basename</varname> is available for use during these expansions.
45871 </para>
45872 </section>
45873 <section id="SECID138">
45874 <title>Non-special new file delivery</title>
45875 <para>
45876 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
45877 file is created directly in the named directory. For example, when delivering
45878 messages into files in batched SMTP format for later delivery to some host (see
45879 section <xref linkend="SECTbatchSMTP"/>), a setting such as
45880 </para>
45881 <literallayout class="monospaced">
45882 directory = /var/bsmtp/$host
45883 </literallayout>
45884 <para>
45885 might be used. A message is written to a file with a temporary name, which is
45886 then renamed when the delivery is complete. The final name is obtained by
45887 expanding the contents of the <option>directory_file</option> option.
45888 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
45889 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
45890 </para>
45891 </section>
45892 </chapter>
45893
45894 <chapter id="CHID8">
45895 <title>The autoreply transport</title>
45896 <para>
45897 <indexterm role="concept" id="IIDauttra1" class="startofrange">
45898 <primary>transports</primary>
45899 <secondary><command>autoreply</command></secondary>
45900 </indexterm>
45901 <indexterm role="concept" id="IIDauttra2" class="startofrange">
45902 <primary><command>autoreply</command> transport</primary>
45903 </indexterm>
45904 The <command>autoreply</command> transport is not a true transport in that it does not cause
45905 the message to be transmitted. Instead, it generates a new mail message as an
45906 automatic reply to the incoming message. <emphasis>References:</emphasis> and
45907 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
45908 to the rules in RFCs 2822 and 3834, respectively.
45909 </para>
45910 <para>
45911 If the router that passes the message to this transport does not have the
45912 <option>unseen</option> option set, the original message (for the current recipient) is not
45913 delivered anywhere. However, when the <option>unseen</option> option is set on the router
45914 that passes the message to this transport, routing of the address continues, so
45915 another router can set up a normal message delivery.
45916 </para>
45917 <para>
45918 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
45919 <quote>vacation</quote> message being the standard example. However, it can also be run
45920 directly from a router like any other transport. To reduce the possibility of
45921 message cascades, messages created by the <command>autoreply</command> transport always have
45922 empty envelope sender addresses, like bounce messages.
45923 </para>
45924 <para>
45925 The parameters of the message to be sent can be specified in the configuration
45926 by options described below. However, these are used only when the address
45927 passed to the transport does not contain its own reply information. When the
45928 transport is run as a consequence of a
45929 <option>mail</option>
45930 or <option>vacation</option> command in a filter file, the parameters of the message are
45931 supplied by the filter, and passed with the address. The transport&#x2019;s options
45932 that define the message are then ignored (so they are not usually set in this
45933 case). The message is specified entirely by the filter or by the transport; it
45934 is never built from a mixture of options. However, the <option>file_optional</option>,
45935 <option>mode</option>, and <option>return_message</option> options apply in all cases.
45936 </para>
45937 <para>
45938 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
45939 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
45940 gid of the user, and with appropriate current and home directories (see chapter
45941 <xref linkend="CHAPenvironment"/>).
45942 </para>
45943 <para>
45944 There is a subtle difference between routing a message to a <command>pipe</command> transport
45945 that generates some text to be returned to the sender, and routing it to an
45946 <command>autoreply</command> transport. This difference is noticeable only if more than one
45947 address from the same message is so handled. In the case of a pipe, the
45948 separate outputs from the different addresses are gathered up and returned to
45949 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
45950 message is generated for each address that is passed to it.
45951 </para>
45952 <para>
45953 Non-printing characters are not permitted in the header lines generated for the
45954 message that <command>autoreply</command> creates, with the exception of newlines that are
45955 immediately followed by white space. If any non-printing characters are found,
45956 the transport defers.
45957 Whether characters with the top bit set count as printing characters or not is
45958 controlled by the <option>print_topbitchars</option> global option.
45959 </para>
45960 <para>
45961 If any of the generic options for manipulating headers (for example,
45962 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
45963 of the original message that is included in the generated message when
45964 <option>return_message</option> is set. They do not apply to the generated message itself.
45965 </para>
45966 <para>
45967 <indexterm role="variable">
45968 <primary><varname>$sender_address</varname></primary>
45969 </indexterm>
45970 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
45971 the message, indicating that there were no recipients, it does not treat this
45972 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
45973 is empty (because the incoming message is a bounce message) do not cause
45974 problems. They are just discarded.
45975 </para>
45976 <section id="SECID139">
45977 <title>Private options for autoreply</title>
45978 <para>
45979 <indexterm role="concept">
45980 <primary>options</primary>
45981 <secondary><command>autoreply</command> transport</secondary>
45982 </indexterm>
45983 </para>
45984 <para>
45985 <indexterm role="option">
45986 <primary><option>bcc</option></primary>
45987 </indexterm>
45988 </para>
45989 <informaltable frame="all">
45990 <tgroup cols="4" colsep="0" rowsep="0">
45991 <colspec colwidth="8*" align="left"/>
45992 <colspec colwidth="6*" align="center"/>
45993 <colspec colwidth="6*" align="center"/>
45994 <colspec colwidth="6*" align="right"/>
45995 <tbody>
45996 <row>
45997 <entry><option>bcc</option></entry>
45998 <entry>Use: <emphasis>autoreply</emphasis></entry>
45999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46000 <entry>Default: <emphasis>unset</emphasis></entry>
46001 </row>
46002 </tbody>
46003 </tgroup>
46004 </informaltable>
46005 <para>
46006 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
46007 message when the message is specified by the transport.
46008 </para>
46009 <para>
46010 <indexterm role="option">
46011 <primary><option>cc</option></primary>
46012 </indexterm>
46013 </para>
46014 <informaltable frame="all">
46015 <tgroup cols="4" colsep="0" rowsep="0">
46016 <colspec colwidth="8*" align="left"/>
46017 <colspec colwidth="6*" align="center"/>
46018 <colspec colwidth="6*" align="center"/>
46019 <colspec colwidth="6*" align="right"/>
46020 <tbody>
46021 <row>
46022 <entry><option>cc</option></entry>
46023 <entry>Use: <emphasis>autoreply</emphasis></entry>
46024 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46025 <entry>Default: <emphasis>unset</emphasis></entry>
46026 </row>
46027 </tbody>
46028 </tgroup>
46029 </informaltable>
46030 <para>
46031 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
46032 when the message is specified by the transport.
46033 </para>
46034 <para>
46035 <indexterm role="option">
46036 <primary><option>file</option></primary>
46037 </indexterm>
46038 </para>
46039 <informaltable frame="all">
46040 <tgroup cols="4" colsep="0" rowsep="0">
46041 <colspec colwidth="8*" align="left"/>
46042 <colspec colwidth="6*" align="center"/>
46043 <colspec colwidth="6*" align="center"/>
46044 <colspec colwidth="6*" align="right"/>
46045 <tbody>
46046 <row>
46047 <entry><option>file</option></entry>
46048 <entry>Use: <emphasis>autoreply</emphasis></entry>
46049 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46050 <entry>Default: <emphasis>unset</emphasis></entry>
46051 </row>
46052 </tbody>
46053 </tgroup>
46054 </informaltable>
46055 <para>
46056 The contents of the file are sent as the body of the message when the message
46057 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
46058 string comes first.
46059 </para>
46060 <para>
46061 <indexterm role="option">
46062 <primary><option>file_expand</option></primary>
46063 </indexterm>
46064 </para>
46065 <informaltable frame="all">
46066 <tgroup cols="4" colsep="0" rowsep="0">
46067 <colspec colwidth="8*" align="left"/>
46068 <colspec colwidth="6*" align="center"/>
46069 <colspec colwidth="6*" align="center"/>
46070 <colspec colwidth="6*" align="right"/>
46071 <tbody>
46072 <row>
46073 <entry><option>file_expand</option></entry>
46074 <entry>Use: <emphasis>autoreply</emphasis></entry>
46075 <entry>Type: <emphasis>boolean</emphasis></entry>
46076 <entry>Default: <emphasis>false</emphasis></entry>
46077 </row>
46078 </tbody>
46079 </tgroup>
46080 </informaltable>
46081 <para>
46082 If this is set, the contents of the file named by the <option>file</option> option are
46083 subjected to string expansion as they are added to the message.
46084 </para>
46085 <para>
46086 <indexterm role="option">
46087 <primary><option>file_optional</option></primary>
46088 </indexterm>
46089 </para>
46090 <informaltable frame="all">
46091 <tgroup cols="4" colsep="0" rowsep="0">
46092 <colspec colwidth="8*" align="left"/>
46093 <colspec colwidth="6*" align="center"/>
46094 <colspec colwidth="6*" align="center"/>
46095 <colspec colwidth="6*" align="right"/>
46096 <tbody>
46097 <row>
46098 <entry><option>file_optional</option></entry>
46099 <entry>Use: <emphasis>autoreply</emphasis></entry>
46100 <entry>Type: <emphasis>boolean</emphasis></entry>
46101 <entry>Default: <emphasis>false</emphasis></entry>
46102 </row>
46103 </tbody>
46104 </tgroup>
46105 </informaltable>
46106 <para>
46107 If this option is true, no error is generated if the file named by the <option>file</option>
46108 option or passed with the address does not exist or cannot be read.
46109 </para>
46110 <para>
46111 <indexterm role="option">
46112 <primary><option>from</option></primary>
46113 </indexterm>
46114 </para>
46115 <informaltable frame="all">
46116 <tgroup cols="4" colsep="0" rowsep="0">
46117 <colspec colwidth="8*" align="left"/>
46118 <colspec colwidth="6*" align="center"/>
46119 <colspec colwidth="6*" align="center"/>
46120 <colspec colwidth="6*" align="right"/>
46121 <tbody>
46122 <row>
46123 <entry><option>from</option></entry>
46124 <entry>Use: <emphasis>autoreply</emphasis></entry>
46125 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46126 <entry>Default: <emphasis>unset</emphasis></entry>
46127 </row>
46128 </tbody>
46129 </tgroup>
46130 </informaltable>
46131 <para>
46132 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
46133 specified by the transport.
46134 </para>
46135 <para>
46136 <indexterm role="option">
46137 <primary><option>headers</option></primary>
46138 </indexterm>
46139 </para>
46140 <informaltable frame="all">
46141 <tgroup cols="4" colsep="0" rowsep="0">
46142 <colspec colwidth="8*" align="left"/>
46143 <colspec colwidth="6*" align="center"/>
46144 <colspec colwidth="6*" align="center"/>
46145 <colspec colwidth="6*" align="right"/>
46146 <tbody>
46147 <row>
46148 <entry><option>headers</option></entry>
46149 <entry>Use: <emphasis>autoreply</emphasis></entry>
46150 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46151 <entry>Default: <emphasis>unset</emphasis></entry>
46152 </row>
46153 </tbody>
46154 </tgroup>
46155 </informaltable>
46156 <para>
46157 This specifies additional RFC 2822 headers that are to be added to the message
46158 when the message is specified by the transport. Several can be given by using
46159 <quote>\n</quote> to separate them. There is no check on the format.
46160 </para>
46161 <para>
46162 <indexterm role="option">
46163 <primary><option>log</option></primary>
46164 </indexterm>
46165 </para>
46166 <informaltable frame="all">
46167 <tgroup cols="4" colsep="0" rowsep="0">
46168 <colspec colwidth="8*" align="left"/>
46169 <colspec colwidth="6*" align="center"/>
46170 <colspec colwidth="6*" align="center"/>
46171 <colspec colwidth="6*" align="right"/>
46172 <tbody>
46173 <row>
46174 <entry><option>log</option></entry>
46175 <entry>Use: <emphasis>autoreply</emphasis></entry>
46176 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46177 <entry>Default: <emphasis>unset</emphasis></entry>
46178 </row>
46179 </tbody>
46180 </tgroup>
46181 </informaltable>
46182 <para>
46183 This option names a file in which a record of every message sent is logged when
46184 the message is specified by the transport.
46185 </para>
46186 <para>
46187 <indexterm role="option">
46188 <primary><option>mode</option></primary>
46189 </indexterm>
46190 </para>
46191 <informaltable frame="all">
46192 <tgroup cols="4" colsep="0" rowsep="0">
46193 <colspec colwidth="8*" align="left"/>
46194 <colspec colwidth="6*" align="center"/>
46195 <colspec colwidth="6*" align="center"/>
46196 <colspec colwidth="6*" align="right"/>
46197 <tbody>
46198 <row>
46199 <entry><option>mode</option></entry>
46200 <entry>Use: <emphasis>autoreply</emphasis></entry>
46201 <entry>Type: <emphasis>octal integer</emphasis></entry>
46202 <entry>Default: <emphasis>0600</emphasis></entry>
46203 </row>
46204 </tbody>
46205 </tgroup>
46206 </informaltable>
46207 <para>
46208 If either the log file or the <quote>once</quote> file has to be created, this mode is
46209 used.
46210 </para>
46211 <para>
46212 <indexterm role="option">
46213 <primary><option>never_mail</option></primary>
46214 </indexterm>
46215 </para>
46216 <informaltable frame="all">
46217 <tgroup cols="4" colsep="0" rowsep="0">
46218 <colspec colwidth="8*" align="left"/>
46219 <colspec colwidth="6*" align="center"/>
46220 <colspec colwidth="6*" align="center"/>
46221 <colspec colwidth="6*" align="right"/>
46222 <tbody>
46223 <row>
46224 <entry><option>never_mail</option></entry>
46225 <entry>Use: <emphasis>autoreply</emphasis></entry>
46226 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
46227 <entry>Default: <emphasis>unset</emphasis></entry>
46228 </row>
46229 </tbody>
46230 </tgroup>
46231 </informaltable>
46232 <para>
46233 If any run of the transport creates a message with a recipient that matches any
46234 item in the list, that recipient is quietly discarded. If all recipients are
46235 discarded, no message is created. This applies both when the recipients are
46236 generated by a filter and when they are specified in the transport.
46237 </para>
46238 <para>
46239 <indexterm role="option">
46240 <primary><option>once</option></primary>
46241 </indexterm>
46242 </para>
46243 <informaltable frame="all">
46244 <tgroup cols="4" colsep="0" rowsep="0">
46245 <colspec colwidth="8*" align="left"/>
46246 <colspec colwidth="6*" align="center"/>
46247 <colspec colwidth="6*" align="center"/>
46248 <colspec colwidth="6*" align="right"/>
46249 <tbody>
46250 <row>
46251 <entry><option>once</option></entry>
46252 <entry>Use: <emphasis>autoreply</emphasis></entry>
46253 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46254 <entry>Default: <emphasis>unset</emphasis></entry>
46255 </row>
46256 </tbody>
46257 </tgroup>
46258 </informaltable>
46259 <para>
46260 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
46261 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
46262 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
46263 </para>
46264 <para>
46265 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
46266 By default, if <option>once</option> is set to a non-empty filename, the message
46267 is not sent if a potential recipient is already listed in the database.
46268 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
46269 message is sent if that much time has elapsed since a message was last sent to
46270 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
46271 prevents a message from being sent a second time &ndash; in this case, zero means
46272 infinity.
46273 </para>
46274 <para>
46275 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
46276 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
46277 greater than zero, it changes the way Exim implements the <option>once</option> option.
46278 Instead of using a DBM file to record every recipient it sends to, it uses a
46279 regular file, whose size will never get larger than the given value.
46280 </para>
46281 <para>
46282 In the file, Exim keeps a linear list of recipient addresses and the times at
46283 which they were sent messages. If the file is full when a new address needs to
46284 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
46285 means that a given recipient may receive multiple messages, but at
46286 unpredictable intervals that depend on the rate of turnover of addresses in the
46287 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
46288 </para>
46289 <para>
46290 <indexterm role="option">
46291 <primary><option>once_file_size</option></primary>
46292 </indexterm>
46293 </para>
46294 <informaltable frame="all">
46295 <tgroup cols="4" colsep="0" rowsep="0">
46296 <colspec colwidth="8*" align="left"/>
46297 <colspec colwidth="6*" align="center"/>
46298 <colspec colwidth="6*" align="center"/>
46299 <colspec colwidth="6*" align="right"/>
46300 <tbody>
46301 <row>
46302 <entry><option>once_file_size</option></entry>
46303 <entry>Use: <emphasis>autoreply</emphasis></entry>
46304 <entry>Type: <emphasis>integer</emphasis></entry>
46305 <entry>Default: <emphasis>0</emphasis></entry>
46306 </row>
46307 </tbody>
46308 </tgroup>
46309 </informaltable>
46310 <para>
46311 See <option>once</option> above.
46312 </para>
46313 <para>
46314 <indexterm role="option">
46315 <primary><option>once_repeat</option></primary>
46316 </indexterm>
46317 </para>
46318 <informaltable frame="all">
46319 <tgroup cols="4" colsep="0" rowsep="0">
46320 <colspec colwidth="8*" align="left"/>
46321 <colspec colwidth="6*" align="center"/>
46322 <colspec colwidth="6*" align="center"/>
46323 <colspec colwidth="6*" align="right"/>
46324 <tbody>
46325 <row>
46326 <entry><option>once_repeat</option></entry>
46327 <entry>Use: <emphasis>autoreply</emphasis></entry>
46328 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
46329 <entry>Default: <emphasis>0s</emphasis></entry>
46330 </row>
46331 </tbody>
46332 </tgroup>
46333 </informaltable>
46334 <para>
46335 See <option>once</option> above.
46336 After expansion, the value of this option must be a valid time value.
46337 </para>
46338 <para>
46339 <indexterm role="option">
46340 <primary><option>reply_to</option></primary>
46341 </indexterm>
46342 </para>
46343 <informaltable frame="all">
46344 <tgroup cols="4" colsep="0" rowsep="0">
46345 <colspec colwidth="8*" align="left"/>
46346 <colspec colwidth="6*" align="center"/>
46347 <colspec colwidth="6*" align="center"/>
46348 <colspec colwidth="6*" align="right"/>
46349 <tbody>
46350 <row>
46351 <entry><option>reply_to</option></entry>
46352 <entry>Use: <emphasis>autoreply</emphasis></entry>
46353 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46354 <entry>Default: <emphasis>unset</emphasis></entry>
46355 </row>
46356 </tbody>
46357 </tgroup>
46358 </informaltable>
46359 <para>
46360 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
46361 specified by the transport.
46362 </para>
46363 <para>
46364 <indexterm role="option">
46365 <primary><option>return_message</option></primary>
46366 </indexterm>
46367 </para>
46368 <informaltable frame="all">
46369 <tgroup cols="4" colsep="0" rowsep="0">
46370 <colspec colwidth="8*" align="left"/>
46371 <colspec colwidth="6*" align="center"/>
46372 <colspec colwidth="6*" align="center"/>
46373 <colspec colwidth="6*" align="right"/>
46374 <tbody>
46375 <row>
46376 <entry><option>return_message</option></entry>
46377 <entry>Use: <emphasis>autoreply</emphasis></entry>
46378 <entry>Type: <emphasis>boolean</emphasis></entry>
46379 <entry>Default: <emphasis>false</emphasis></entry>
46380 </row>
46381 </tbody>
46382 </tgroup>
46383 </informaltable>
46384 <para>
46385 If this is set, a copy of the original message is returned with the new
46386 message, subject to the maximum size set in the <option>return_size_limit</option> global
46387 configuration option.
46388 </para>
46389 <para>
46390 <indexterm role="option">
46391 <primary><option>subject</option></primary>
46392 </indexterm>
46393 </para>
46394 <informaltable frame="all">
46395 <tgroup cols="4" colsep="0" rowsep="0">
46396 <colspec colwidth="8*" align="left"/>
46397 <colspec colwidth="6*" align="center"/>
46398 <colspec colwidth="6*" align="center"/>
46399 <colspec colwidth="6*" align="right"/>
46400 <tbody>
46401 <row>
46402 <entry><option>subject</option></entry>
46403 <entry>Use: <emphasis>autoreply</emphasis></entry>
46404 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46405 <entry>Default: <emphasis>unset</emphasis></entry>
46406 </row>
46407 </tbody>
46408 </tgroup>
46409 </informaltable>
46410 <para>
46411 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
46412 specified by the transport. It is tempting to quote the original subject in
46413 automatic responses. For example:
46414 </para>
46415 <literallayout class="monospaced">
46416 subject = Re: $h_subject:
46417 </literallayout>
46418 <para>
46419 There is a danger in doing this, however. It may allow a third party to
46420 subscribe your users to an opt-in mailing list, provided that the list accepts
46421 bounce messages as subscription confirmations. Well-managed lists require a
46422 non-bounce message to confirm a subscription, so the danger is relatively
46423 small.
46424 </para>
46425 <para>
46426 <indexterm role="option">
46427 <primary><option>text</option></primary>
46428 </indexterm>
46429 </para>
46430 <informaltable frame="all">
46431 <tgroup cols="4" colsep="0" rowsep="0">
46432 <colspec colwidth="8*" align="left"/>
46433 <colspec colwidth="6*" align="center"/>
46434 <colspec colwidth="6*" align="center"/>
46435 <colspec colwidth="6*" align="right"/>
46436 <tbody>
46437 <row>
46438 <entry><option>text</option></entry>
46439 <entry>Use: <emphasis>autoreply</emphasis></entry>
46440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46441 <entry>Default: <emphasis>unset</emphasis></entry>
46442 </row>
46443 </tbody>
46444 </tgroup>
46445 </informaltable>
46446 <para>
46447 This specifies a single string to be used as the body of the message when the
46448 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
46449 the text comes first.
46450 </para>
46451 <para>
46452 <indexterm role="option">
46453 <primary><option>to</option></primary>
46454 </indexterm>
46455 </para>
46456 <informaltable frame="all">
46457 <tgroup cols="4" colsep="0" rowsep="0">
46458 <colspec colwidth="8*" align="left"/>
46459 <colspec colwidth="6*" align="center"/>
46460 <colspec colwidth="6*" align="center"/>
46461 <colspec colwidth="6*" align="right"/>
46462 <tbody>
46463 <row>
46464 <entry><option>to</option></entry>
46465 <entry>Use: <emphasis>autoreply</emphasis></entry>
46466 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46467 <entry>Default: <emphasis>unset</emphasis></entry>
46468 </row>
46469 </tbody>
46470 </tgroup>
46471 </informaltable>
46472 <para>
46473 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
46474 when the message is specified by the transport.
46475 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
46476 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
46477 </para>
46478 </section>
46479 </chapter>
46480
46481 <chapter id="CHAPLMTP">
46482 <title>The lmtp transport</title>
46483 <para>
46484 <indexterm role="concept">
46485 <primary>transports</primary>
46486 <secondary><command>lmtp</command></secondary>
46487 </indexterm>
46488 <indexterm role="concept">
46489 <primary><command>lmtp</command> transport</primary>
46490 </indexterm>
46491 <indexterm role="concept">
46492 <primary>LMTP</primary>
46493 <secondary>over a pipe</secondary>
46494 </indexterm>
46495 <indexterm role="concept">
46496 <primary>LMTP</primary>
46497 <secondary>over a socket</secondary>
46498 </indexterm>
46499 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
46500 specified command
46501 or by interacting with a Unix domain socket.
46502 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
46503 transports. Exim also has support for using LMTP over TCP/IP; this is
46504 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
46505 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
46506 has it commented out. You need to ensure that
46507 </para>
46508 <literallayout class="monospaced">
46509 TRANSPORT_LMTP=yes
46510 </literallayout>
46511 <para>
46512 <indexterm role="concept">
46513 <primary>options</primary>
46514 <secondary><command>lmtp</command> transport</secondary>
46515 </indexterm>
46516 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
46517 included in the Exim binary. The private options of the <command>lmtp</command> transport are
46518 as follows:
46519 </para>
46520 <para>
46521 <indexterm role="option">
46522 <primary><option>batch_id</option></primary>
46523 </indexterm>
46524 </para>
46525 <informaltable frame="all">
46526 <tgroup cols="4" colsep="0" rowsep="0">
46527 <colspec colwidth="8*" align="left"/>
46528 <colspec colwidth="6*" align="center"/>
46529 <colspec colwidth="6*" align="center"/>
46530 <colspec colwidth="6*" align="right"/>
46531 <tbody>
46532 <row>
46533 <entry><option>batch_id</option></entry>
46534 <entry>Use: <emphasis>lmtp</emphasis></entry>
46535 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46536 <entry>Default: <emphasis>unset</emphasis></entry>
46537 </row>
46538 </tbody>
46539 </tgroup>
46540 </informaltable>
46541 <para>
46542 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
46543 </para>
46544 <para>
46545 <indexterm role="option">
46546 <primary><option>batch_max</option></primary>
46547 </indexterm>
46548 </para>
46549 <informaltable frame="all">
46550 <tgroup cols="4" colsep="0" rowsep="0">
46551 <colspec colwidth="8*" align="left"/>
46552 <colspec colwidth="6*" align="center"/>
46553 <colspec colwidth="6*" align="center"/>
46554 <colspec colwidth="6*" align="right"/>
46555 <tbody>
46556 <row>
46557 <entry><option>batch_max</option></entry>
46558 <entry>Use: <emphasis>lmtp</emphasis></entry>
46559 <entry>Type: <emphasis>integer</emphasis></entry>
46560 <entry>Default: <emphasis>1</emphasis></entry>
46561 </row>
46562 </tbody>
46563 </tgroup>
46564 </informaltable>
46565 <para>
46566 This limits the number of addresses that can be handled in a single delivery.
46567 Most LMTP servers can handle several addresses at once, so it is normally a
46568 good idea to increase this value. See the description of local delivery
46569 batching in chapter <xref linkend="CHAPbatching"/>.
46570 </para>
46571 <para>
46572 <indexterm role="option">
46573 <primary><option>command</option></primary>
46574 </indexterm>
46575 </para>
46576 <informaltable frame="all">
46577 <tgroup cols="4" colsep="0" rowsep="0">
46578 <colspec colwidth="8*" align="left"/>
46579 <colspec colwidth="6*" align="center"/>
46580 <colspec colwidth="6*" align="center"/>
46581 <colspec colwidth="6*" align="right"/>
46582 <tbody>
46583 <row>
46584 <entry><option>command</option></entry>
46585 <entry>Use: <emphasis>lmtp</emphasis></entry>
46586 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46587 <entry>Default: <emphasis>unset</emphasis></entry>
46588 </row>
46589 </tbody>
46590 </tgroup>
46591 </informaltable>
46592 <para>
46593 This option must be set if <option>socket</option> is not set. The string is a command which
46594 is run in a separate process. It is split up into a command name and list of
46595 arguments, each of which is separately expanded (so expansion cannot change the
46596 number of arguments). The command is run directly, not via a shell. The message
46597 is passed to the new process using the standard input and output to operate the
46598 LMTP protocol.
46599 </para>
46600 <para>
46601 <indexterm role="option">
46602 <primary><option>ignore_quota</option></primary>
46603 </indexterm>
46604 </para>
46605 <informaltable frame="all">
46606 <tgroup cols="4" colsep="0" rowsep="0">
46607 <colspec colwidth="8*" align="left"/>
46608 <colspec colwidth="6*" align="center"/>
46609 <colspec colwidth="6*" align="center"/>
46610 <colspec colwidth="6*" align="right"/>
46611 <tbody>
46612 <row>
46613 <entry><option>ignore_quota</option></entry>
46614 <entry>Use: <emphasis>lmtp</emphasis></entry>
46615 <entry>Type: <emphasis>boolean</emphasis></entry>
46616 <entry>Default: <emphasis>false</emphasis></entry>
46617 </row>
46618 </tbody>
46619 </tgroup>
46620 </informaltable>
46621 <para>
46622 <indexterm role="concept">
46623 <primary>LMTP</primary>
46624 <secondary>ignoring quota errors</secondary>
46625 </indexterm>
46626 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
46627 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
46628 in its response to the LHLO command.
46629 </para>
46630 <para>
46631 <indexterm role="option">
46632 <primary><option>socket</option></primary>
46633 </indexterm>
46634 </para>
46635 <informaltable frame="all">
46636 <tgroup cols="4" colsep="0" rowsep="0">
46637 <colspec colwidth="8*" align="left"/>
46638 <colspec colwidth="6*" align="center"/>
46639 <colspec colwidth="6*" align="center"/>
46640 <colspec colwidth="6*" align="right"/>
46641 <tbody>
46642 <row>
46643 <entry><option>socket</option></entry>
46644 <entry>Use: <emphasis>lmtp</emphasis></entry>
46645 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46646 <entry>Default: <emphasis>unset</emphasis></entry>
46647 </row>
46648 </tbody>
46649 </tgroup>
46650 </informaltable>
46651 <para>
46652 This option must be set if <option>command</option> is not set. The result of expansion must
46653 be the name of a Unix domain socket. The transport connects to the socket and
46654 delivers the message to it using the LMTP protocol.
46655 </para>
46656 <para>
46657 <indexterm role="option">
46658 <primary><option>timeout</option></primary>
46659 </indexterm>
46660 </para>
46661 <informaltable frame="all">
46662 <tgroup cols="4" colsep="0" rowsep="0">
46663 <colspec colwidth="8*" align="left"/>
46664 <colspec colwidth="6*" align="center"/>
46665 <colspec colwidth="6*" align="center"/>
46666 <colspec colwidth="6*" align="right"/>
46667 <tbody>
46668 <row>
46669 <entry><option>timeout</option></entry>
46670 <entry>Use: <emphasis>lmtp</emphasis></entry>
46671 <entry>Type: <emphasis>time</emphasis></entry>
46672 <entry>Default: <emphasis>5m</emphasis></entry>
46673 </row>
46674 </tbody>
46675 </tgroup>
46676 </informaltable>
46677 <para>
46678 The transport is aborted if the created process or Unix domain socket does not
46679 respond to LMTP commands or message input within this timeout. Delivery
46680 is deferred, and will be tried again later. Here is an example of a typical
46681 LMTP transport:
46682 </para>
46683 <literallayout class="monospaced">
46684 lmtp:
46685   driver = lmtp
46686   command = /some/local/lmtp/delivery/program
46687   batch_max = 20
46688   user = exim
46689 </literallayout>
46690 <para>
46691 This delivers up to 20 addresses at a time, in a mixture of domains if
46692 necessary, running as the user <emphasis>exim</emphasis>.
46693 </para>
46694 </chapter>
46695
46696 <chapter id="CHAPpipetransport">
46697 <title>The pipe transport</title>
46698 <para>
46699 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
46700 <primary>transports</primary>
46701 <secondary><command>pipe</command></secondary>
46702 </indexterm>
46703 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
46704 <primary><command>pipe</command> transport</primary>
46705 </indexterm>
46706 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
46707 running in another process. One example is the use of <command>pipe</command> as a
46708 pseudo-remote transport for passing messages to some other delivery mechanism
46709 (such as UUCP). Another is the use by individual users to automatically process
46710 their incoming messages. The <command>pipe</command> transport can be used in one of the
46711 following ways:
46712 </para>
46713 <itemizedlist>
46714 <listitem>
46715 <para>
46716 <indexterm role="variable">
46717 <primary><varname>$local_part</varname></primary>
46718 </indexterm>
46719 A router routes one address to a transport in the normal way, and the
46720 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
46721 contains the local part of the address (as usual), and the command that is run
46722 is specified by the <option>command</option> option on the transport.
46723 </para>
46724 </listitem>
46725 <listitem>
46726 <para>
46727 <indexterm role="variable">
46728 <primary><varname>$pipe_addresses</varname></primary>
46729 </indexterm>
46730 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
46731 transport can handle more than one address in a single run. In this case, when
46732 more than one address is routed to the transport, <varname>$local_part</varname> is not set
46733 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
46734 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
46735 that are routed to the transport.
46736 </para>
46737 </listitem>
46738 <listitem>
46739 <para>
46740 <indexterm role="variable">
46741 <primary><varname>$address_pipe</varname></primary>
46742 </indexterm>
46743 A router redirects an address directly to a pipe command (for example, from an
46744 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
46745 pipe command, and the <option>command</option> option on the transport is ignored unless
46746 <option>force_command</option> is set. If only one address is being transported
46747 (<option>batch_max</option> is not greater than one, or only one address was redirected to
46748 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
46749 </para>
46750 </listitem>
46751 </itemizedlist>
46752 <para>
46753 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
46754 deliver messages over pipes using the LMTP interactive protocol. This is
46755 implemented by the <command>lmtp</command> transport.
46756 </para>
46757 <para>
46758 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
46759 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
46760 other cases, the uid and gid have to be specified explicitly, either on the
46761 transport or on the router that handles the address. Current and <quote>home</quote>
46762 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
46763 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
46764 for a discussion of local delivery batching.
46765 </para>
46766 <para revisionflag="changed">
46767 <indexterm role="concept">
46768 <primary>tainted data</primary>
46769 <secondary>in pipe command</secondary>
46770 </indexterm>
46771 <indexterm role="concept">
46772 <primary>pipe</primary>
46773 <secondary>tainted data</secondary>
46774 </indexterm>
46775 Tainted data may not be used for the command name.
46776 </para>
46777 <section id="SECID140">
46778 <title>Concurrent delivery</title>
46779 <para>
46780 If two messages arrive at almost the same time, and both are routed to a pipe
46781 delivery, the two pipe transports may be run concurrently. You must ensure that
46782 any pipe commands you set up are robust against this happening. If the commands
46783 write to a file, the <option>exim_lock</option> utility might be of use.
46784 Alternatively the <option>max_parallel</option> option could be used with a value
46785 of "1" to enforce serialization.
46786 </para>
46787 </section>
46788 <section id="SECID141">
46789 <title>Returned status and data</title>
46790 <para>
46791 <indexterm role="concept">
46792 <primary><command>pipe</command> transport</primary>
46793 <secondary>returned data</secondary>
46794 </indexterm>
46795 If the command exits with a non-zero return code, the delivery is deemed to
46796 have failed, unless either the <option>ignore_status</option> option is set (in which case
46797 the return code is treated as zero), or the return code is one of those listed
46798 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
46799 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
46800 logged, but are not included in the bounce message, which merely contains
46801 <quote>local delivery failed</quote>.
46802 </para>
46803 <para>
46804 If the command exits on a signal and the <option>freeze_signal</option> option is set then
46805 the message will be frozen in the queue. If that option is not set, a bounce
46806 will be sent as normal.
46807 </para>
46808 <para>
46809 If the return code is greater than 128 and the command being run is a shell
46810 script, it normally means that the script was terminated by a signal whose
46811 value is the return code minus 128. The <option>freeze_signal</option> option does not
46812 apply in this case.
46813 </para>
46814 <para>
46815 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
46816 return code is set to 127. This is the value that a shell returns if it is
46817 asked to run a non-existent command. The wording for the log line suggests that
46818 a non-existent command may be the problem.
46819 </para>
46820 <para>
46821 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
46822 set and the command produces any output on its standard output or standard
46823 error streams, the command is considered to have failed, even if it gave a zero
46824 return code or if <option>ignore_status</option> is set. The output from the command is
46825 included as part of the bounce message. The <option>return_fail_output</option> option is
46826 similar, except that output is returned only when the command exits with a
46827 failure return code, that is, a value other than zero or a code that matches
46828 <option>temp_errors</option>.
46829 </para>
46830 </section>
46831 <section id="SECThowcommandrun">
46832 <title>How the command is run</title>
46833 <para>
46834 <indexterm role="concept">
46835 <primary><command>pipe</command> transport</primary>
46836 <secondary>path for command</secondary>
46837 </indexterm>
46838 The command line is (by default) broken down into a command name and arguments
46839 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
46840 <option>restrict_to_path</option> options can be used to restrict the commands that may be
46841 run.
46842 </para>
46843 <para>
46844 <indexterm role="concept">
46845 <primary>quoting</primary>
46846 <secondary>in pipe command</secondary>
46847 </indexterm>
46848 Unquoted arguments are delimited by white space. If an argument appears in
46849 double quotes, backslash is interpreted as an escape character in the usual
46850 way. If an argument appears in single quotes, no escaping is done.
46851 </para>
46852 <para>
46853 String expansion is applied to the command line except when it comes from a
46854 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
46855 expansion is applied to each argument in turn rather than to the whole line.
46856 For this reason, any string expansion item that contains white space must be
46857 quoted so as to be contained within a single argument. A setting such as
46858 </para>
46859 <literallayout class="monospaced">
46860 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
46861 </literallayout>
46862 <para>
46863 will not work, because the expansion item gets split between several
46864 arguments. You have to write
46865 </para>
46866 <literallayout class="monospaced">
46867 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
46868 </literallayout>
46869 <para>
46870 to ensure that it is all in one argument. The expansion is done in this way,
46871 argument by argument, so that the number of arguments cannot be changed as a
46872 result of expansion, and quotes or backslashes in inserted variables do not
46873 interact with external quoting. However, this leads to problems if you want to
46874 generate multiple arguments (or the command name plus arguments) from a single
46875 expansion. In this situation, the simplest solution is to use a shell. For
46876 example:
46877 </para>
46878 <literallayout class="monospaced">
46879 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
46880 </literallayout>
46881 <para>
46882 <indexterm role="concept">
46883 <primary>transport</primary>
46884 <secondary>filter</secondary>
46885 </indexterm>
46886 <indexterm role="concept">
46887 <primary>filter</primary>
46888 <secondary>transport filter</secondary>
46889 </indexterm>
46890 <indexterm role="variable">
46891 <primary><varname>$pipe_addresses</varname></primary>
46892 </indexterm>
46893 Special handling takes place when an argument consists of precisely the text
46894 <literal>$pipe_addresses</literal> (no quotes).
46895 This is not a general expansion variable; the only
46896 place this string is recognized is when it appears as an argument for a pipe or
46897 transport filter command. It causes each address that is being handled to be
46898 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
46899 avoids any problems with spaces or shell metacharacters, and is of use when a
46900 <command>pipe</command> transport is handling groups of addresses in a batch.
46901 </para>
46902 <para>
46903 If <option>force_command</option> is enabled on the transport, special handling takes place
46904 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
46905 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
46906 argument is inserted in the argument list at that point
46907 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
46908 the only item in the argument; in fact, if it were then <option>force_command</option>
46909 should behave as a no-op.  Rather, it should be used to adjust the command
46910 run while preserving the argument vector separation.
46911 </para>
46912 <para>
46913 After splitting up into arguments and expansion, the resulting command is run
46914 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
46915 message that is being delivered is supplied on the standard input, and the
46916 standard output and standard error are both connected to a single pipe that is
46917 read by Exim. The <option>max_output</option> option controls how much output the command
46918 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
46919 control what is done with it.
46920 </para>
46921 <para>
46922 Not running the command under a shell (by default) lessens the security risks
46923 in cases when a command from a user&#x2019;s filter file is built out of data that was
46924 taken from an incoming message. If a shell is required, it can of course be
46925 explicitly specified as the command to be run. However, there are circumstances
46926 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
46927 under a shell and cannot easily be modified. To allow for these cases, there is
46928 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
46929 works. Instead of breaking up the command line as just described, it expands it
46930 as a single string and passes the result to <filename>/bin/sh</filename>. The
46931 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
46932 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
46933 </para>
46934 </section>
46935 <section id="SECTpipeenv">
46936 <title>Environment variables</title>
46937 <para>
46938 <indexterm role="concept">
46939 <primary><command>pipe</command> transport</primary>
46940 <secondary>environment for command</secondary>
46941 </indexterm>
46942 <indexterm role="concept">
46943 <primary>environment</primary>
46944 <secondary><command>pipe</command> transport</secondary>
46945 </indexterm>
46946 The environment variables listed below are set up when the command is invoked.
46947 This list is a compromise for maximum compatibility with other MTAs. Note that
46948 the <option>environment</option> option can be used to add additional variables to this
46949 environment. The environment for the <command>pipe</command> transport is not subject
46950 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
46951 </para>
46952 <literallayout>
46953 <literal>DOMAIN            </literal>   the domain of the address
46954 <literal>HOME              </literal>   the home directory, if set
46955 <literal>HOST              </literal>   the host name when called from a router (see below)
46956 <literal>LOCAL_PART        </literal>   see below
46957 <literal>LOCAL_PART_PREFIX </literal>   see below
46958 <literal>LOCAL_PART_SUFFIX </literal>   see below
46959 <literal>LOGNAME           </literal>   see below
46960 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
46961 <literal>PATH              </literal>   as specified by the <option>path</option> option below
46962 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
46963 <literal>RECIPIENT         </literal>   the complete recipient address
46964 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
46965 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
46966 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
46967 <literal>USER              </literal>   see below
46968 </literallayout>
46969 <para>
46970 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
46971 router, LOCAL_PART is set to the local part of the address. When it is
46972 called as a result of a forward or alias expansion, LOCAL_PART is set to
46973 the local part of the address that was expanded. In both cases, any affixes are
46974 removed from the local part, and made available in LOCAL_PART_PREFIX and
46975 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
46976 same value as LOCAL_PART for compatibility with other MTAs.
46977 </para>
46978 <para>
46979 <indexterm role="concept">
46980 <primary>HOST</primary>
46981 </indexterm>
46982 HOST is set only when a <command>pipe</command> transport is called from a router that
46983 associates hosts with an address, typically when using <command>pipe</command> as a
46984 pseudo-remote transport. HOST is set to the first host name specified by
46985 the router.
46986 </para>
46987 <para>
46988 <indexterm role="concept">
46989 <primary>HOME</primary>
46990 </indexterm>
46991 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
46992 for the HOME environment variable. Otherwise, a home directory may be set
46993 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
46994 user&#x2019;s home directory if <option>check_local_user</option> is set.
46995 </para>
46996 </section>
46997 <section id="SECID142">
46998 <title>Private options for pipe</title>
46999 <para>
47000 <indexterm role="concept">
47001 <primary>options</primary>
47002 <secondary><command>pipe</command> transport</secondary>
47003 </indexterm>
47004 </para>
47005 <para>
47006 <indexterm role="option">
47007 <primary><option>allow_commands</option></primary>
47008 </indexterm>
47009 </para>
47010 <informaltable frame="all">
47011 <tgroup cols="4" colsep="0" rowsep="0">
47012 <colspec colwidth="8*" align="left"/>
47013 <colspec colwidth="6*" align="center"/>
47014 <colspec colwidth="6*" align="center"/>
47015 <colspec colwidth="6*" align="right"/>
47016 <tbody>
47017 <row>
47018 <entry><option>allow_commands</option></entry>
47019 <entry>Use: <emphasis>pipe</emphasis></entry>
47020 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
47021 <entry>Default: <emphasis>unset</emphasis></entry>
47022 </row>
47023 </tbody>
47024 </tgroup>
47025 </informaltable>
47026 <para>
47027 <indexterm role="concept">
47028 <primary><command>pipe</command> transport</primary>
47029 <secondary>permitted commands</secondary>
47030 </indexterm>
47031 The string is expanded, and is then interpreted as a colon-separated list of
47032 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
47033 permitted are those in the <option>allow_commands</option> list. They need not be absolute
47034 paths; the <option>path</option> option is still used for relative paths. If
47035 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
47036 in the <option>allow_commands</option> list, or a name without any slashes that is found on
47037 the path. In other words, if neither <option>allow_commands</option> nor
47038 <option>restrict_to_path</option> is set, there is no restriction on the command, but
47039 otherwise only commands that are permitted by one or the other are allowed. For
47040 example, if
47041 </para>
47042 <literallayout class="monospaced">
47043 allow_commands = /usr/bin/vacation
47044 </literallayout>
47045 <para>
47046 and <option>restrict_to_path</option> is not set, the only permitted command is
47047 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
47048 <option>use_shell</option> is set.
47049 </para>
47050 <para>
47051 <indexterm role="option">
47052 <primary><option>batch_id</option></primary>
47053 </indexterm>
47054 </para>
47055 <informaltable frame="all">
47056 <tgroup cols="4" colsep="0" rowsep="0">
47057 <colspec colwidth="8*" align="left"/>
47058 <colspec colwidth="6*" align="center"/>
47059 <colspec colwidth="6*" align="center"/>
47060 <colspec colwidth="6*" align="right"/>
47061 <tbody>
47062 <row>
47063 <entry><option>batch_id</option></entry>
47064 <entry>Use: <emphasis>pipe</emphasis></entry>
47065 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47066 <entry>Default: <emphasis>unset</emphasis></entry>
47067 </row>
47068 </tbody>
47069 </tgroup>
47070 </informaltable>
47071 <para>
47072 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
47073 </para>
47074 <para>
47075 <indexterm role="option">
47076 <primary><option>batch_max</option></primary>
47077 </indexterm>
47078 </para>
47079 <informaltable frame="all">
47080 <tgroup cols="4" colsep="0" rowsep="0">
47081 <colspec colwidth="8*" align="left"/>
47082 <colspec colwidth="6*" align="center"/>
47083 <colspec colwidth="6*" align="center"/>
47084 <colspec colwidth="6*" align="right"/>
47085 <tbody>
47086 <row>
47087 <entry><option>batch_max</option></entry>
47088 <entry>Use: <emphasis>pipe</emphasis></entry>
47089 <entry>Type: <emphasis>integer</emphasis></entry>
47090 <entry>Default: <emphasis>1</emphasis></entry>
47091 </row>
47092 </tbody>
47093 </tgroup>
47094 </informaltable>
47095 <para>
47096 This limits the number of addresses that can be handled in a single delivery.
47097 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
47098 </para>
47099 <para>
47100 <indexterm role="option">
47101 <primary><option>check_string</option></primary>
47102 </indexterm>
47103 </para>
47104 <informaltable frame="all">
47105 <tgroup cols="4" colsep="0" rowsep="0">
47106 <colspec colwidth="8*" align="left"/>
47107 <colspec colwidth="6*" align="center"/>
47108 <colspec colwidth="6*" align="center"/>
47109 <colspec colwidth="6*" align="right"/>
47110 <tbody>
47111 <row>
47112 <entry><option>check_string</option></entry>
47113 <entry>Use: <emphasis>pipe</emphasis></entry>
47114 <entry>Type: <emphasis>string</emphasis></entry>
47115 <entry>Default: <emphasis>unset</emphasis></entry>
47116 </row>
47117 </tbody>
47118 </tgroup>
47119 </informaltable>
47120 <para>
47121 As <command>pipe</command> writes the message, the start of each line is tested for matching
47122 <option>check_string</option>, and if it does, the initial matching characters are replaced
47123 by the contents of <option>escape_string</option>, provided both are set. The value of
47124 <option>check_string</option> is a literal string, not a regular expression, and the case of
47125 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
47126 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
47127 the SMTP escaping protocol. Any settings made in the configuration file are
47128 ignored.
47129 </para>
47130 <para>
47131 <indexterm role="option">
47132 <primary><option>command</option></primary>
47133 </indexterm>
47134 </para>
47135 <informaltable frame="all">
47136 <tgroup cols="4" colsep="0" rowsep="0">
47137 <colspec colwidth="8*" align="left"/>
47138 <colspec colwidth="6*" align="center"/>
47139 <colspec colwidth="6*" align="center"/>
47140 <colspec colwidth="6*" align="right"/>
47141 <tbody>
47142 <row>
47143 <entry><option>command</option></entry>
47144 <entry>Use: <emphasis>pipe</emphasis></entry>
47145 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47146 <entry>Default: <emphasis>unset</emphasis></entry>
47147 </row>
47148 </tbody>
47149 </tgroup>
47150 </informaltable>
47151 <para>
47152 This option need not be set when <command>pipe</command> is being used to deliver to pipes
47153 obtained directly from address redirections. In other cases, the option must be
47154 set, to provide a command to be run. It need not yield an absolute path (see
47155 the <option>path</option> option below). The command is split up into separate arguments by
47156 Exim, and each argument is separately expanded, as described in section
47157 <xref linkend="SECThowcommandrun"/> above.
47158 </para>
47159 <para>
47160 <indexterm role="option">
47161 <primary><option>environment</option></primary>
47162 </indexterm>
47163 </para>
47164 <informaltable frame="all">
47165 <tgroup cols="4" colsep="0" rowsep="0">
47166 <colspec colwidth="8*" align="left"/>
47167 <colspec colwidth="6*" align="center"/>
47168 <colspec colwidth="6*" align="center"/>
47169 <colspec colwidth="6*" align="right"/>
47170 <tbody>
47171 <row>
47172 <entry><option>environment</option></entry>
47173 <entry>Use: <emphasis>pipe</emphasis></entry>
47174 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47175 <entry>Default: <emphasis>unset</emphasis></entry>
47176 </row>
47177 </tbody>
47178 </tgroup>
47179 </informaltable>
47180 <para>
47181 <indexterm role="concept">
47182 <primary><command>pipe</command> transport</primary>
47183 <secondary>environment for command</secondary>
47184 </indexterm>
47185 <indexterm role="concept">
47186 <primary>environment</primary>
47187 <secondary><command>pipe</command> transport</secondary>
47188 </indexterm>
47189 This option is used to add additional variables to the environment in which the
47190 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
47191 a string which is expanded, and then interpreted as a colon-separated list of
47192 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
47193 </para>
47194 <para>
47195 <indexterm role="option">
47196 <primary><option>escape_string</option></primary>
47197 </indexterm>
47198 </para>
47199 <informaltable frame="all">
47200 <tgroup cols="4" colsep="0" rowsep="0">
47201 <colspec colwidth="8*" align="left"/>
47202 <colspec colwidth="6*" align="center"/>
47203 <colspec colwidth="6*" align="center"/>
47204 <colspec colwidth="6*" align="right"/>
47205 <tbody>
47206 <row>
47207 <entry><option>escape_string</option></entry>
47208 <entry>Use: <emphasis>pipe</emphasis></entry>
47209 <entry>Type: <emphasis>string</emphasis></entry>
47210 <entry>Default: <emphasis>unset</emphasis></entry>
47211 </row>
47212 </tbody>
47213 </tgroup>
47214 </informaltable>
47215 <para>
47216 See <option>check_string</option> above.
47217 </para>
47218 <para>
47219 <indexterm role="option">
47220 <primary><option>freeze_exec_fail</option></primary>
47221 </indexterm>
47222 </para>
47223 <informaltable frame="all">
47224 <tgroup cols="4" colsep="0" rowsep="0">
47225 <colspec colwidth="8*" align="left"/>
47226 <colspec colwidth="6*" align="center"/>
47227 <colspec colwidth="6*" align="center"/>
47228 <colspec colwidth="6*" align="right"/>
47229 <tbody>
47230 <row>
47231 <entry><option>freeze_exec_fail</option></entry>
47232 <entry>Use: <emphasis>pipe</emphasis></entry>
47233 <entry>Type: <emphasis>boolean</emphasis></entry>
47234 <entry>Default: <emphasis>false</emphasis></entry>
47235 </row>
47236 </tbody>
47237 </tgroup>
47238 </informaltable>
47239 <para>
47240 <indexterm role="concept">
47241 <primary>exec failure</primary>
47242 </indexterm>
47243 <indexterm role="concept">
47244 <primary>failure of exec</primary>
47245 </indexterm>
47246 <indexterm role="concept">
47247 <primary><command>pipe</command> transport</primary>
47248 <secondary>failure of exec</secondary>
47249 </indexterm>
47250 Failure to exec the command in a pipe transport is by default treated like
47251 any other failure while running the command. However, if <option>freeze_exec_fail</option>
47252 is set, failure to exec is treated specially, and causes the message to be
47253 frozen, whatever the setting of <option>ignore_status</option>.
47254 </para>
47255 <para>
47256 <indexterm role="option">
47257 <primary><option>freeze_signal</option></primary>
47258 </indexterm>
47259 </para>
47260 <informaltable frame="all">
47261 <tgroup cols="4" colsep="0" rowsep="0">
47262 <colspec colwidth="8*" align="left"/>
47263 <colspec colwidth="6*" align="center"/>
47264 <colspec colwidth="6*" align="center"/>
47265 <colspec colwidth="6*" align="right"/>
47266 <tbody>
47267 <row>
47268 <entry><option>freeze_signal</option></entry>
47269 <entry>Use: <emphasis>pipe</emphasis></entry>
47270 <entry>Type: <emphasis>boolean</emphasis></entry>
47271 <entry>Default: <emphasis>false</emphasis></entry>
47272 </row>
47273 </tbody>
47274 </tgroup>
47275 </informaltable>
47276 <para>
47277 <indexterm role="concept">
47278 <primary>signal exit</primary>
47279 </indexterm>
47280 <indexterm role="concept">
47281 <primary><command>pipe</command> transport</primary>
47282 <secondary>,</secondary>
47283 </indexterm>
47284 Normally if the process run by a command in a pipe transport exits on a signal,
47285 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
47286 frozen in Exim&#x2019;s queue instead.
47287 </para>
47288 <para>
47289 <indexterm role="option">
47290 <primary><option>force_command</option></primary>
47291 </indexterm>
47292 </para>
47293 <informaltable frame="all">
47294 <tgroup cols="4" colsep="0" rowsep="0">
47295 <colspec colwidth="8*" align="left"/>
47296 <colspec colwidth="6*" align="center"/>
47297 <colspec colwidth="6*" align="center"/>
47298 <colspec colwidth="6*" align="right"/>
47299 <tbody>
47300 <row>
47301 <entry><option>force_command</option></entry>
47302 <entry>Use: <emphasis>pipe</emphasis></entry>
47303 <entry>Type: <emphasis>boolean</emphasis></entry>
47304 <entry>Default: <emphasis>false</emphasis></entry>
47305 </row>
47306 </tbody>
47307 </tgroup>
47308 </informaltable>
47309 <para>
47310 <indexterm role="concept">
47311 <primary>force command</primary>
47312 </indexterm>
47313 <indexterm role="concept">
47314 <primary><command>pipe</command> transport</primary>
47315 <secondary>,</secondary>
47316 </indexterm>
47317 Normally when a router redirects an address directly to a pipe command
47318 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
47319 is set, the <option>command</option> option will used. This is especially
47320 useful for forcing a wrapper or additional argument to be added to the
47321 command. For example:
47322 </para>
47323 <literallayout class="monospaced">
47324 command = /usr/bin/remote_exec myhost -- $address_pipe
47325 force_command
47326 </literallayout>
47327 <para>
47328 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
47329 <option>force_command</option> is set, expanding out to the original argument vector as
47330 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
47331 </para>
47332 <para>
47333 <indexterm role="option">
47334 <primary><option>ignore_status</option></primary>
47335 </indexterm>
47336 </para>
47337 <informaltable frame="all">
47338 <tgroup cols="4" colsep="0" rowsep="0">
47339 <colspec colwidth="8*" align="left"/>
47340 <colspec colwidth="6*" align="center"/>
47341 <colspec colwidth="6*" align="center"/>
47342 <colspec colwidth="6*" align="right"/>
47343 <tbody>
47344 <row>
47345 <entry><option>ignore_status</option></entry>
47346 <entry>Use: <emphasis>pipe</emphasis></entry>
47347 <entry>Type: <emphasis>boolean</emphasis></entry>
47348 <entry>Default: <emphasis>false</emphasis></entry>
47349 </row>
47350 </tbody>
47351 </tgroup>
47352 </informaltable>
47353 <para>
47354 If this option is true, the status returned by the subprocess that is set up to
47355 run the command is ignored, and Exim behaves as if zero had been returned.
47356 Otherwise, a non-zero status or termination by signal causes an error return
47357 from the transport unless the status value is one of those listed in
47358 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
47359 </para>
47360 <para>
47361 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
47362 See the <option>timeout_defer</option> option for how timeouts are handled.
47363 </para>
47364 <para>
47365 <indexterm role="option">
47366 <primary><option>log_defer_output</option></primary>
47367 </indexterm>
47368 </para>
47369 <informaltable frame="all">
47370 <tgroup cols="4" colsep="0" rowsep="0">
47371 <colspec colwidth="8*" align="left"/>
47372 <colspec colwidth="6*" align="center"/>
47373 <colspec colwidth="6*" align="center"/>
47374 <colspec colwidth="6*" align="right"/>
47375 <tbody>
47376 <row>
47377 <entry><option>log_defer_output</option></entry>
47378 <entry>Use: <emphasis>pipe</emphasis></entry>
47379 <entry>Type: <emphasis>boolean</emphasis></entry>
47380 <entry>Default: <emphasis>false</emphasis></entry>
47381 </row>
47382 </tbody>
47383 </tgroup>
47384 </informaltable>
47385 <para>
47386 <indexterm role="concept">
47387 <primary><command>pipe</command> transport</primary>
47388 <secondary>logging output</secondary>
47389 </indexterm>
47390 If this option is set, and the status returned by the command is
47391 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
47392 and any output was produced on stdout or stderr, the first line of it is
47393 written to the main log.
47394 </para>
47395 <para>
47396 <indexterm role="option">
47397 <primary><option>log_fail_output</option></primary>
47398 </indexterm>
47399 </para>
47400 <informaltable frame="all">
47401 <tgroup cols="4" colsep="0" rowsep="0">
47402 <colspec colwidth="8*" align="left"/>
47403 <colspec colwidth="6*" align="center"/>
47404 <colspec colwidth="6*" align="center"/>
47405 <colspec colwidth="6*" align="right"/>
47406 <tbody>
47407 <row>
47408 <entry><option>log_fail_output</option></entry>
47409 <entry>Use: <emphasis>pipe</emphasis></entry>
47410 <entry>Type: <emphasis>boolean</emphasis></entry>
47411 <entry>Default: <emphasis>false</emphasis></entry>
47412 </row>
47413 </tbody>
47414 </tgroup>
47415 </informaltable>
47416 <para>
47417 If this option is set, and the command returns any output on stdout or
47418 stderr, and also ends with a return code that is neither zero nor one of
47419 the return codes listed in <option>temp_errors</option> (that is, the delivery
47420 failed), the first line of output is written to the main log. This
47421 option and <option>log_output</option> are mutually exclusive.  Only one of them may
47422 be set.
47423 </para>
47424 <para>
47425 <indexterm role="option">
47426 <primary><option>log_output</option></primary>
47427 </indexterm>
47428 </para>
47429 <informaltable frame="all">
47430 <tgroup cols="4" colsep="0" rowsep="0">
47431 <colspec colwidth="8*" align="left"/>
47432 <colspec colwidth="6*" align="center"/>
47433 <colspec colwidth="6*" align="center"/>
47434 <colspec colwidth="6*" align="right"/>
47435 <tbody>
47436 <row>
47437 <entry><option>log_output</option></entry>
47438 <entry>Use: <emphasis>pipe</emphasis></entry>
47439 <entry>Type: <emphasis>boolean</emphasis></entry>
47440 <entry>Default: <emphasis>false</emphasis></entry>
47441 </row>
47442 </tbody>
47443 </tgroup>
47444 </informaltable>
47445 <para>
47446 If this option is set and the command returns any output on stdout or
47447 stderr, the first line of output is written to the main log, whatever
47448 the return code. This option and <option>log_fail_output</option> are mutually
47449 exclusive. Only one of them may be set.
47450 </para>
47451 <para>
47452 <indexterm role="option">
47453 <primary><option>max_output</option></primary>
47454 </indexterm>
47455 </para>
47456 <informaltable frame="all">
47457 <tgroup cols="4" colsep="0" rowsep="0">
47458 <colspec colwidth="8*" align="left"/>
47459 <colspec colwidth="6*" align="center"/>
47460 <colspec colwidth="6*" align="center"/>
47461 <colspec colwidth="6*" align="right"/>
47462 <tbody>
47463 <row>
47464 <entry><option>max_output</option></entry>
47465 <entry>Use: <emphasis>pipe</emphasis></entry>
47466 <entry>Type: <emphasis>integer</emphasis></entry>
47467 <entry>Default: <emphasis>20K</emphasis></entry>
47468 </row>
47469 </tbody>
47470 </tgroup>
47471 </informaltable>
47472 <para>
47473 This specifies the maximum amount of output that the command may produce on its
47474 standard output and standard error file combined. If the limit is exceeded, the
47475 process running the command is killed. This is intended as a safety measure to
47476 catch runaway processes. The limit is applied independently of the settings of
47477 the options that control what is done with such output (for example,
47478 <option>return_output</option>). Because of buffering effects, the amount of output may
47479 exceed the limit by a small amount before Exim notices.
47480 </para>
47481 <para>
47482 <indexterm role="option">
47483 <primary><option>message_prefix</option></primary>
47484 </indexterm>
47485 </para>
47486 <informaltable frame="all">
47487 <tgroup cols="4" colsep="0" rowsep="0">
47488 <colspec colwidth="8*" align="left"/>
47489 <colspec colwidth="6*" align="center"/>
47490 <colspec colwidth="6*" align="center"/>
47491 <colspec colwidth="6*" align="right"/>
47492 <tbody>
47493 <row>
47494 <entry><option>message_prefix</option></entry>
47495 <entry>Use: <emphasis>pipe</emphasis></entry>
47496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47497 <entry>Default: <emphasis>see below</emphasis></entry>
47498 </row>
47499 </tbody>
47500 </tgroup>
47501 </informaltable>
47502 <para>
47503 The string specified here is expanded and output at the start of every message.
47504 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
47505 </para>
47506 <literallayout class="monospaced">
47507 message_prefix = \
47508   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
47509   ${tod_bsdinbox}\n
47510 </literallayout>
47511 <para>
47512 <indexterm role="concept">
47513 <primary>Cyrus</primary>
47514 </indexterm>
47515 <indexterm role="concept">
47516 <primary><option>tmail</option></primary>
47517 </indexterm>
47518 <indexterm role="concept">
47519 <primary><quote>From</quote> line</primary>
47520 </indexterm>
47521 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
47522 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
47523 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
47524 setting
47525 </para>
47526 <literallayout class="monospaced">
47527 message_prefix =
47528 </literallayout>
47529 <para>
47530 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
47531 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
47532 </para>
47533 <para>
47534 <indexterm role="option">
47535 <primary><option>message_suffix</option></primary>
47536 </indexterm>
47537 </para>
47538 <informaltable frame="all">
47539 <tgroup cols="4" colsep="0" rowsep="0">
47540 <colspec colwidth="8*" align="left"/>
47541 <colspec colwidth="6*" align="center"/>
47542 <colspec colwidth="6*" align="center"/>
47543 <colspec colwidth="6*" align="right"/>
47544 <tbody>
47545 <row>
47546 <entry><option>message_suffix</option></entry>
47547 <entry>Use: <emphasis>pipe</emphasis></entry>
47548 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47549 <entry>Default: <emphasis>see below</emphasis></entry>
47550 </row>
47551 </tbody>
47552 </tgroup>
47553 </informaltable>
47554 <para>
47555 The string specified here is expanded and output at the end of every message.
47556 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
47557 The suffix can be suppressed by setting
47558 </para>
47559 <literallayout class="monospaced">
47560 message_suffix =
47561 </literallayout>
47562 <para>
47563 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
47564 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
47565 </para>
47566 <para>
47567 <indexterm role="option">
47568 <primary><option>path</option></primary>
47569 </indexterm>
47570 </para>
47571 <informaltable frame="all">
47572 <tgroup cols="4" colsep="0" rowsep="0">
47573 <colspec colwidth="8*" align="left"/>
47574 <colspec colwidth="6*" align="center"/>
47575 <colspec colwidth="6*" align="center"/>
47576 <colspec colwidth="6*" align="right"/>
47577 <tbody>
47578 <row>
47579 <entry><option>path</option></entry>
47580 <entry>Use: <emphasis>pipe</emphasis></entry>
47581 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47582 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
47583 </row>
47584 </tbody>
47585 </tgroup>
47586 </informaltable>
47587 <para>
47588 This option is expanded and
47589 specifies the string that is set up in the PATH environment
47590 variable of the subprocess.
47591 If the <option>command</option> option does not yield an absolute path name, the command is
47592 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
47593 apply to a command specified as a transport filter.
47594 </para>
47595 <para>
47596 <indexterm role="option">
47597 <primary><option>permit_coredump</option></primary>
47598 </indexterm>
47599 </para>
47600 <informaltable frame="all">
47601 <tgroup cols="4" colsep="0" rowsep="0">
47602 <colspec colwidth="8*" align="left"/>
47603 <colspec colwidth="6*" align="center"/>
47604 <colspec colwidth="6*" align="center"/>
47605 <colspec colwidth="6*" align="right"/>
47606 <tbody>
47607 <row>
47608 <entry><option>permit_coredump</option></entry>
47609 <entry>Use: <emphasis>pipe</emphasis></entry>
47610 <entry>Type: <emphasis>boolean</emphasis></entry>
47611 <entry>Default: <emphasis>false</emphasis></entry>
47612 </row>
47613 </tbody>
47614 </tgroup>
47615 </informaltable>
47616 <para>
47617 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
47618 a core-dump of a pipe command, enable this command.  This enables core-dumps
47619 during delivery and affects both the Exim binary and the pipe command run.
47620 It is recommended that this option remain off unless and until you have a need
47621 for it and that this only be enabled when needed, as the risk of excessive
47622 resource consumption can be quite high.  Note also that Exim is typically
47623 installed as a setuid binary and most operating systems will inhibit coredumps
47624 of these by default, so further OS-specific action may be required.
47625 </para>
47626 <para>
47627 <indexterm role="option">
47628 <primary><option>pipe_as_creator</option></primary>
47629 </indexterm>
47630 </para>
47631 <informaltable frame="all">
47632 <tgroup cols="4" colsep="0" rowsep="0">
47633 <colspec colwidth="8*" align="left"/>
47634 <colspec colwidth="6*" align="center"/>
47635 <colspec colwidth="6*" align="center"/>
47636 <colspec colwidth="6*" align="right"/>
47637 <tbody>
47638 <row>
47639 <entry><option>pipe_as_creator</option></entry>
47640 <entry>Use: <emphasis>pipe</emphasis></entry>
47641 <entry>Type: <emphasis>boolean</emphasis></entry>
47642 <entry>Default: <emphasis>false</emphasis></entry>
47643 </row>
47644 </tbody>
47645 </tgroup>
47646 </informaltable>
47647 <para>
47648 <indexterm role="concept">
47649 <primary>uid (user id)</primary>
47650 <secondary>local delivery</secondary>
47651 </indexterm>
47652 If the generic <option>user</option> option is not set and this option is true, the delivery
47653 process is run under the uid that was in force when Exim was originally called
47654 to accept the message. If the group id is not otherwise set (via the generic
47655 <option>group</option> option), the gid that was in force when Exim was originally called to
47656 accept the message is used.
47657 </para>
47658 <para>
47659 <indexterm role="option">
47660 <primary><option>restrict_to_path</option></primary>
47661 </indexterm>
47662 </para>
47663 <informaltable frame="all">
47664 <tgroup cols="4" colsep="0" rowsep="0">
47665 <colspec colwidth="8*" align="left"/>
47666 <colspec colwidth="6*" align="center"/>
47667 <colspec colwidth="6*" align="center"/>
47668 <colspec colwidth="6*" align="right"/>
47669 <tbody>
47670 <row>
47671 <entry><option>restrict_to_path</option></entry>
47672 <entry>Use: <emphasis>pipe</emphasis></entry>
47673 <entry>Type: <emphasis>boolean</emphasis></entry>
47674 <entry>Default: <emphasis>false</emphasis></entry>
47675 </row>
47676 </tbody>
47677 </tgroup>
47678 </informaltable>
47679 <para>
47680 When this option is set, any command name not listed in <option>allow_commands</option> must
47681 contain no slashes. The command is searched for only in the directories listed
47682 in the <option>path</option> option. This option is intended for use in the case when a pipe
47683 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
47684 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
47685 </para>
47686 <para>
47687 <indexterm role="option">
47688 <primary><option>return_fail_output</option></primary>
47689 </indexterm>
47690 </para>
47691 <informaltable frame="all">
47692 <tgroup cols="4" colsep="0" rowsep="0">
47693 <colspec colwidth="8*" align="left"/>
47694 <colspec colwidth="6*" align="center"/>
47695 <colspec colwidth="6*" align="center"/>
47696 <colspec colwidth="6*" align="right"/>
47697 <tbody>
47698 <row>
47699 <entry><option>return_fail_output</option></entry>
47700 <entry>Use: <emphasis>pipe</emphasis></entry>
47701 <entry>Type: <emphasis>boolean</emphasis></entry>
47702 <entry>Default: <emphasis>false</emphasis></entry>
47703 </row>
47704 </tbody>
47705 </tgroup>
47706 </informaltable>
47707 <para>
47708 If this option is true, and the command produced any output and ended with a
47709 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
47710 is, the delivery failed), the output is returned in the bounce message.
47711 However, if the message has a null sender (that is, it is itself a bounce
47712 message), output from the command is discarded. This option and
47713 <option>return_output</option> are mutually exclusive. Only one of them may be set.
47714 </para>
47715 <para>
47716 <indexterm role="option">
47717 <primary><option>return_output</option></primary>
47718 </indexterm>
47719 </para>
47720 <informaltable frame="all">
47721 <tgroup cols="4" colsep="0" rowsep="0">
47722 <colspec colwidth="8*" align="left"/>
47723 <colspec colwidth="6*" align="center"/>
47724 <colspec colwidth="6*" align="center"/>
47725 <colspec colwidth="6*" align="right"/>
47726 <tbody>
47727 <row>
47728 <entry><option>return_output</option></entry>
47729 <entry>Use: <emphasis>pipe</emphasis></entry>
47730 <entry>Type: <emphasis>boolean</emphasis></entry>
47731 <entry>Default: <emphasis>false</emphasis></entry>
47732 </row>
47733 </tbody>
47734 </tgroup>
47735 </informaltable>
47736 <para>
47737 If this option is true, and the command produced any output, the delivery is
47738 deemed to have failed whatever the return code from the command, and the output
47739 is returned in the bounce message. Otherwise, the output is just discarded.
47740 However, if the message has a null sender (that is, it is a bounce message),
47741 output from the command is always discarded, whatever the setting of this
47742 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
47743 of them may be set.
47744 </para>
47745 <para>
47746 <indexterm role="option">
47747 <primary><option>temp_errors</option></primary>
47748 </indexterm>
47749 </para>
47750 <informaltable frame="all">
47751 <tgroup cols="4" colsep="0" rowsep="0">
47752 <colspec colwidth="8*" align="left"/>
47753 <colspec colwidth="6*" align="center"/>
47754 <colspec colwidth="6*" align="center"/>
47755 <colspec colwidth="6*" align="right"/>
47756 <tbody>
47757 <row>
47758 <entry><option>temp_errors</option></entry>
47759 <entry>Use: <emphasis>pipe</emphasis></entry>
47760 <entry>Type: <emphasis>string list</emphasis></entry>
47761 <entry>Default: <emphasis>see below</emphasis></entry>
47762 </row>
47763 </tbody>
47764 </tgroup>
47765 </informaltable>
47766 <para>
47767 <indexterm role="concept">
47768 <primary><command>pipe</command> transport</primary>
47769 <secondary>temporary failure</secondary>
47770 </indexterm>
47771 This option contains either a colon-separated list of numbers, or a single
47772 asterisk. If <option>ignore_status</option> is false
47773 and <option>return_output</option> is not set,
47774 and the command exits with a non-zero return code, the failure is treated as
47775 temporary and the delivery is deferred if the return code matches one of the
47776 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
47777 codes are treated as permanent errors. The default setting contains the codes
47778 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
47779 compiled on a system that does not define these macros, it assumes values of 75
47780 and 73, respectively.
47781 </para>
47782 <para>
47783 <indexterm role="option">
47784 <primary><option>timeout</option></primary>
47785 </indexterm>
47786 </para>
47787 <informaltable frame="all">
47788 <tgroup cols="4" colsep="0" rowsep="0">
47789 <colspec colwidth="8*" align="left"/>
47790 <colspec colwidth="6*" align="center"/>
47791 <colspec colwidth="6*" align="center"/>
47792 <colspec colwidth="6*" align="right"/>
47793 <tbody>
47794 <row>
47795 <entry><option>timeout</option></entry>
47796 <entry>Use: <emphasis>pipe</emphasis></entry>
47797 <entry>Type: <emphasis>time</emphasis></entry>
47798 <entry>Default: <emphasis>1h</emphasis></entry>
47799 </row>
47800 </tbody>
47801 </tgroup>
47802 </informaltable>
47803 <para>
47804 If the command fails to complete within this time, it is killed. This normally
47805 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
47806 specifies no timeout. In order to ensure that any subprocesses created by the
47807 command are also killed, Exim makes the initial process a process group leader,
47808 and kills the whole process group on a timeout. However, this can be defeated
47809 if one of the processes starts a new process group.
47810 </para>
47811 <para>
47812 <indexterm role="option">
47813 <primary><option>timeout_defer</option></primary>
47814 </indexterm>
47815 </para>
47816 <informaltable frame="all">
47817 <tgroup cols="4" colsep="0" rowsep="0">
47818 <colspec colwidth="8*" align="left"/>
47819 <colspec colwidth="6*" align="center"/>
47820 <colspec colwidth="6*" align="center"/>
47821 <colspec colwidth="6*" align="right"/>
47822 <tbody>
47823 <row>
47824 <entry><option>timeout_defer</option></entry>
47825 <entry>Use: <emphasis>pipe</emphasis></entry>
47826 <entry>Type: <emphasis>boolean</emphasis></entry>
47827 <entry>Default: <emphasis>false</emphasis></entry>
47828 </row>
47829 </tbody>
47830 </tgroup>
47831 </informaltable>
47832 <para>
47833 A timeout in a <command>pipe</command> transport, either in the command that the transport
47834 runs, or in a transport filter that is associated with it, is by default
47835 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
47836 is set true, both kinds of timeout become temporary errors, causing the
47837 delivery to be deferred.
47838 </para>
47839 <para>
47840 <indexterm role="option">
47841 <primary><option>umask</option></primary>
47842 </indexterm>
47843 </para>
47844 <informaltable frame="all">
47845 <tgroup cols="4" colsep="0" rowsep="0">
47846 <colspec colwidth="8*" align="left"/>
47847 <colspec colwidth="6*" align="center"/>
47848 <colspec colwidth="6*" align="center"/>
47849 <colspec colwidth="6*" align="right"/>
47850 <tbody>
47851 <row>
47852 <entry><option>umask</option></entry>
47853 <entry>Use: <emphasis>pipe</emphasis></entry>
47854 <entry>Type: <emphasis>octal integer</emphasis></entry>
47855 <entry>Default: <emphasis>022</emphasis></entry>
47856 </row>
47857 </tbody>
47858 </tgroup>
47859 </informaltable>
47860 <para>
47861 This specifies the umask setting for the subprocess that runs the command.
47862 </para>
47863 <para>
47864 <indexterm role="option">
47865 <primary><option>use_bsmtp</option></primary>
47866 </indexterm>
47867 </para>
47868 <informaltable frame="all">
47869 <tgroup cols="4" colsep="0" rowsep="0">
47870 <colspec colwidth="8*" align="left"/>
47871 <colspec colwidth="6*" align="center"/>
47872 <colspec colwidth="6*" align="center"/>
47873 <colspec colwidth="6*" align="right"/>
47874 <tbody>
47875 <row>
47876 <entry><option>use_bsmtp</option></entry>
47877 <entry>Use: <emphasis>pipe</emphasis></entry>
47878 <entry>Type: <emphasis>boolean</emphasis></entry>
47879 <entry>Default: <emphasis>false</emphasis></entry>
47880 </row>
47881 </tbody>
47882 </tgroup>
47883 </informaltable>
47884 <para>
47885 <indexterm role="concept">
47886 <primary>envelope sender</primary>
47887 </indexterm>
47888 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
47889 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
47890 commands. If you want to include a leading HELO command with such messages,
47891 you can do so by setting the <option>message_prefix</option> option. See section
47892 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
47893 </para>
47894 <para>
47895 <indexterm role="option">
47896 <primary><option>use_classresources</option></primary>
47897 </indexterm>
47898 </para>
47899 <informaltable frame="all">
47900 <tgroup cols="4" colsep="0" rowsep="0">
47901 <colspec colwidth="8*" align="left"/>
47902 <colspec colwidth="6*" align="center"/>
47903 <colspec colwidth="6*" align="center"/>
47904 <colspec colwidth="6*" align="right"/>
47905 <tbody>
47906 <row>
47907 <entry><option>use_classresources</option></entry>
47908 <entry>Use: <emphasis>pipe</emphasis></entry>
47909 <entry>Type: <emphasis>boolean</emphasis></entry>
47910 <entry>Default: <emphasis>false</emphasis></entry>
47911 </row>
47912 </tbody>
47913 </tgroup>
47914 </informaltable>
47915 <para>
47916 <indexterm role="concept">
47917 <primary>class resources (BSD)</primary>
47918 </indexterm>
47919 This option is available only when Exim is running on FreeBSD, NetBSD, or
47920 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
47921 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
47922 limits for the uid under which the pipe is to run are obtained from the login
47923 class database.
47924 </para>
47925 <para>
47926 <indexterm role="option">
47927 <primary><option>use_crlf</option></primary>
47928 </indexterm>
47929 </para>
47930 <informaltable frame="all">
47931 <tgroup cols="4" colsep="0" rowsep="0">
47932 <colspec colwidth="8*" align="left"/>
47933 <colspec colwidth="6*" align="center"/>
47934 <colspec colwidth="6*" align="center"/>
47935 <colspec colwidth="6*" align="right"/>
47936 <tbody>
47937 <row>
47938 <entry><option>use_crlf</option></entry>
47939 <entry>Use: <emphasis>pipe</emphasis></entry>
47940 <entry>Type: <emphasis>boolean</emphasis></entry>
47941 <entry>Default: <emphasis>false</emphasis></entry>
47942 </row>
47943 </tbody>
47944 </tgroup>
47945 </informaltable>
47946 <para>
47947 <indexterm role="concept">
47948 <primary>carriage return</primary>
47949 </indexterm>
47950 <indexterm role="concept">
47951 <primary>linefeed</primary>
47952 </indexterm>
47953 This option causes lines to be terminated with the two-character CRLF sequence
47954 (carriage return, linefeed) instead of just a linefeed character. In the case
47955 of batched SMTP, the byte sequence written to the pipe is then an exact image
47956 of what would be sent down a real SMTP connection.
47957 </para>
47958 <para>
47959 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
47960 written verbatim, so must contain their own carriage return characters if these
47961 are needed. When <option>use_bsmtp</option> is not set, the default values for both
47962 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
47963 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
47964 </para>
47965 <para>
47966 <indexterm role="option">
47967 <primary><option>use_shell</option></primary>
47968 </indexterm>
47969 </para>
47970 <informaltable frame="all">
47971 <tgroup cols="4" colsep="0" rowsep="0">
47972 <colspec colwidth="8*" align="left"/>
47973 <colspec colwidth="6*" align="center"/>
47974 <colspec colwidth="6*" align="center"/>
47975 <colspec colwidth="6*" align="right"/>
47976 <tbody>
47977 <row>
47978 <entry><option>use_shell</option></entry>
47979 <entry>Use: <emphasis>pipe</emphasis></entry>
47980 <entry>Type: <emphasis>boolean</emphasis></entry>
47981 <entry>Default: <emphasis>false</emphasis></entry>
47982 </row>
47983 </tbody>
47984 </tgroup>
47985 </informaltable>
47986 <para>
47987 <indexterm role="variable">
47988 <primary><varname>$pipe_addresses</varname></primary>
47989 </indexterm>
47990 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
47991 instead of being run directly from the transport, as described in section
47992 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
47993 where the command is expected to be run under a shell and cannot easily be
47994 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
47995 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
47996 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
47997 its <option>-c</option> option.
47998 </para>
47999 </section>
48000 <section id="SECID143">
48001 <title>Using an external local delivery agent</title>
48002 <para>
48003 <indexterm role="concept">
48004 <primary>local delivery</primary>
48005 <secondary>using an external agent</secondary>
48006 </indexterm>
48007 <indexterm role="concept">
48008 <primary><emphasis>procmail</emphasis></primary>
48009 </indexterm>
48010 <indexterm role="concept">
48011 <primary>external local delivery</primary>
48012 </indexterm>
48013 <indexterm role="concept">
48014 <primary>delivery</primary>
48015 <secondary><emphasis>procmail</emphasis></secondary>
48016 </indexterm>
48017 <indexterm role="concept">
48018 <primary>delivery</primary>
48019 <secondary>by external agent</secondary>
48020 </indexterm>
48021 The <command>pipe</command> transport can be used to pass all messages that require local
48022 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
48023 this, care must be taken to ensure that the pipe is run under an appropriate
48024 uid and gid. In some configurations one wants this to be a uid that is trusted
48025 by the delivery agent to supply the correct sender of the message. It may be
48026 necessary to recompile or reconfigure the delivery agent so that it trusts an
48027 appropriate user. The following is an example transport and router
48028 configuration for <option>procmail</option>:
48029 </para>
48030 <literallayout class="monospaced">
48031 # transport
48032 procmail_pipe:
48033   driver = pipe
48034   command = /usr/local/bin/procmail -d $local_part_data
48035   return_path_add
48036   delivery_date_add
48037   envelope_to_add
48038   check_string = "From "
48039   escape_string = "&gt;From "
48040   umask = 077
48041   user = $local_part_data
48042   group = mail
48043
48044 # router
48045 procmail:
48046   driver = accept
48047   check_local_user
48048   transport = procmail_pipe
48049 </literallayout>
48050 <para>
48051 In this example, the pipe is run as the local user, but with the group set to
48052 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
48053 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
48054 user to supply a correct sender address. If you do not specify either a
48055 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
48056 home directory is the user&#x2019;s home directory by default.
48057 </para>
48058 <para>
48059 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
48060 </para>
48061 <literallayout class="monospaced">
48062 IFS=" "
48063 </literallayout>
48064 <para>
48065 as shown in some <option>procmail</option> documentation, because Exim does not by default
48066 use a shell to run pipe commands.
48067 </para>
48068 <para>
48069 <indexterm role="concept">
48070 <primary>Cyrus</primary>
48071 </indexterm>
48072 The next example shows a transport and a router for a system where local
48073 deliveries are handled by the Cyrus IMAP server.
48074 </para>
48075 <literallayout class="monospaced">
48076 # transport
48077 local_delivery_cyrus:
48078   driver = pipe
48079   command = /usr/cyrus/bin/deliver \
48080             -m ${substr_1:$local_part_suffix} -- $local_part
48081   user = cyrus
48082   group = mail
48083   return_output
48084   log_output
48085   message_prefix =
48086   message_suffix =
48087
48088 # router
48089 local_user_cyrus:
48090   driver = accept
48091   check_local_user
48092   local_part_suffix = .*
48093   transport = local_delivery_cyrus
48094 </literallayout>
48095 <para>
48096 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
48097 <option>return_output</option> to cause any text written by Cyrus to be returned to the
48098 sender.
48099 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
48100 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
48101 </para>
48102 </section>
48103 </chapter>
48104
48105 <chapter id="CHAPsmtptrans">
48106 <title>The smtp transport</title>
48107 <para>
48108 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
48109 <primary>transports</primary>
48110 <secondary><command>smtp</command></secondary>
48111 </indexterm>
48112 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
48113 <primary><command>smtp</command> transport</primary>
48114 </indexterm>
48115 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
48116 or LMTP protocol. The list of hosts to try can either be taken from the address
48117 that is being processed (having been set up by the router), or specified
48118 explicitly for the transport. Timeout and retry processing (see chapter
48119 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
48120 </para>
48121 <section id="SECID144">
48122 <title>Multiple messages on a single connection</title>
48123 <para>
48124 The sending of multiple messages over a single TCP/IP connection can arise in
48125 two ways:
48126 </para>
48127 <itemizedlist>
48128 <listitem>
48129 <para>
48130 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
48131 routed to the same host, more than one copy of the message has to be sent to
48132 that host. In this situation, multiple copies may be sent in a single run of
48133 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
48134 does when it has too many addresses to send in one message also depends on the
48135 value of the global <option>remote_max_parallel</option> option. Details are given in
48136 section <xref linkend="SECToutSMTPTCP"/>.)
48137 </para>
48138 </listitem>
48139 <listitem>
48140 <para>
48141 <indexterm role="concept">
48142 <primary>hints database</primary>
48143 <secondary>remembering routing</secondary>
48144 </indexterm>
48145 When a message has been successfully delivered over a TCP/IP connection, Exim
48146 looks in its hints database to see if there are any other messages awaiting a
48147 connection to the same host. If there are, a new delivery process is started
48148 for one of them, and the current TCP/IP connection is passed on to it. The new
48149 process may in turn send multiple copies and possibly create yet another
48150 process.
48151 </para>
48152 </listitem>
48153 </itemizedlist>
48154 <para>
48155 For each copy sent over the same TCP/IP connection, a sequence counter is
48156 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
48157 no further messages are sent over that connection.
48158 </para>
48159 </section>
48160 <section id="SECID145">
48161 <title>Use of the $host and $host_address variables</title>
48162 <para>
48163 <indexterm role="variable">
48164 <primary><varname>$host</varname></primary>
48165 </indexterm>
48166 <indexterm role="variable">
48167 <primary><varname>$host_address</varname></primary>
48168 </indexterm>
48169 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
48170 <varname>$host_address</varname> are the name and IP address of the first host on the host list
48171 passed by the router. However, when the transport is about to connect to a
48172 specific host, and while it is connected to that host, <varname>$host</varname> and
48173 <varname>$host_address</varname> are set to the values for that host. These are the values
48174 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
48175 <option>serialize_hosts</option>, and the various TLS options are expanded.
48176 </para>
48177 </section>
48178 <section id="usecippeer">
48179 <title>Use of $tls_cipher and $tls_peerdn</title>
48180 <para>
48181 <indexterm role="variable">
48182 <primary><varname>$tls_bits</varname></primary>
48183 </indexterm>
48184 <indexterm role="variable">
48185 <primary><varname>$tls_cipher</varname></primary>
48186 </indexterm>
48187 <indexterm role="variable">
48188 <primary><varname>$tls_peerdn</varname></primary>
48189 </indexterm>
48190 <indexterm role="variable">
48191 <primary><varname>$tls_sni</varname></primary>
48192 </indexterm>
48193 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
48194 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
48195 are the values that were set when the message was received.
48196 These are the values that are used for options that are expanded before any
48197 SMTP connections are made. Just before each connection is made, these four
48198 variables are emptied. If TLS is subsequently started, they are set to the
48199 appropriate values for the outgoing connection, and these are the values that
48200 are in force when any authenticators are run and when the
48201 <option>authenticated_sender</option> option is expanded.
48202 </para>
48203 <para>
48204 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
48205 and will be removed in a future release.
48206 </para>
48207 </section>
48208 <section id="SECID146">
48209 <title>Private options for smtp</title>
48210 <para>
48211 <indexterm role="concept">
48212 <primary>options</primary>
48213 <secondary><command>smtp</command> transport</secondary>
48214 </indexterm>
48215 The private options of the <command>smtp</command> transport are as follows:
48216 </para>
48217 <para>
48218 <indexterm role="option">
48219 <primary><option>address_retry_include_sender</option></primary>
48220 </indexterm>
48221 </para>
48222 <informaltable frame="all">
48223 <tgroup cols="4" colsep="0" rowsep="0">
48224 <colspec colwidth="8*" align="left"/>
48225 <colspec colwidth="6*" align="center"/>
48226 <colspec colwidth="6*" align="center"/>
48227 <colspec colwidth="6*" align="right"/>
48228 <tbody>
48229 <row>
48230 <entry><option>address_retry_include_sender</option></entry>
48231 <entry>Use: <emphasis>smtp</emphasis></entry>
48232 <entry>Type: <emphasis>boolean</emphasis></entry>
48233 <entry>Default: <emphasis>true</emphasis></entry>
48234 </row>
48235 </tbody>
48236 </tgroup>
48237 </informaltable>
48238 <para>
48239 <indexterm role="concept">
48240 <primary>4<emphasis>xx</emphasis> responses</primary>
48241 <secondary>retrying after</secondary>
48242 </indexterm>
48243 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
48244 is the combination of sender and recipient that is delayed in subsequent queue
48245 runs until the retry time is reached. You can delay the recipient without
48246 reference to the sender (which is what earlier versions of Exim did), by
48247 setting <option>address_retry_include_sender</option> false. However, this can lead to
48248 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
48249 </para>
48250 <para>
48251 <indexterm role="option">
48252 <primary><option>allow_localhost</option></primary>
48253 </indexterm>
48254 </para>
48255 <informaltable frame="all">
48256 <tgroup cols="4" colsep="0" rowsep="0">
48257 <colspec colwidth="8*" align="left"/>
48258 <colspec colwidth="6*" align="center"/>
48259 <colspec colwidth="6*" align="center"/>
48260 <colspec colwidth="6*" align="right"/>
48261 <tbody>
48262 <row>
48263 <entry><option>allow_localhost</option></entry>
48264 <entry>Use: <emphasis>smtp</emphasis></entry>
48265 <entry>Type: <emphasis>boolean</emphasis></entry>
48266 <entry>Default: <emphasis>false</emphasis></entry>
48267 </row>
48268 </tbody>
48269 </tgroup>
48270 </informaltable>
48271 <para>
48272 <indexterm role="concept">
48273 <primary>local host</primary>
48274 <secondary>sending to</secondary>
48275 </indexterm>
48276 <indexterm role="concept">
48277 <primary>fallback</primary>
48278 <secondary>hosts specified on transport</secondary>
48279 </indexterm>
48280 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
48281 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
48282 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
48283 the delivery anyway. This should be used only in special cases when the
48284 configuration ensures that no looping will result (for example, a differently
48285 configured Exim is listening on the port to which the message is sent).
48286 </para>
48287 <para>
48288 <indexterm role="option">
48289 <primary><option>authenticated_sender</option></primary>
48290 </indexterm>
48291 </para>
48292 <informaltable frame="all">
48293 <tgroup cols="4" colsep="0" rowsep="0">
48294 <colspec colwidth="8*" align="left"/>
48295 <colspec colwidth="6*" align="center"/>
48296 <colspec colwidth="6*" align="center"/>
48297 <colspec colwidth="6*" align="right"/>
48298 <tbody>
48299 <row>
48300 <entry><option>authenticated_sender</option></entry>
48301 <entry>Use: <emphasis>smtp</emphasis></entry>
48302 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48303 <entry>Default: <emphasis>unset</emphasis></entry>
48304 </row>
48305 </tbody>
48306 </tgroup>
48307 </informaltable>
48308 <para>
48309 <indexterm role="concept">
48310 <primary>Cyrus</primary>
48311 </indexterm>
48312 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
48313 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
48314 overriding any existing authenticated sender value. If the string expansion is
48315 forced to fail, the option is ignored. Other expansion failures cause delivery
48316 to be deferred. If the result of expansion is an empty string, that is also
48317 ignored.
48318 </para>
48319 <para>
48320 The expansion happens after the outgoing connection has been made and TLS
48321 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
48322 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
48323 particular connection.
48324 </para>
48325 <para>
48326 If the SMTP session is not authenticated, the expansion of
48327 <option>authenticated_sender</option> still happens (and can cause the delivery to be
48328 deferred if it fails), but no AUTH= item is added to MAIL commands
48329 unless <option>authenticated_sender_force</option> is true.
48330 </para>
48331 <para>
48332 This option allows you to use the <command>smtp</command> transport in LMTP mode to
48333 deliver mail to Cyrus IMAP and provide the proper local part as the
48334 <quote>authenticated sender</quote>, via a setting such as:
48335 </para>
48336 <literallayout class="monospaced">
48337 authenticated_sender = $local_part
48338 </literallayout>
48339 <para>
48340 This removes the need for IMAP subfolders to be assigned special ACLs to
48341 allow direct delivery to those subfolders.
48342 </para>
48343 <para>
48344 Because of expected uses such as that just described for Cyrus (when no
48345 domain is involved), there is no checking on the syntax of the provided
48346 value.
48347 </para>
48348 <para>
48349 <indexterm role="option">
48350 <primary><option>authenticated_sender_force</option></primary>
48351 </indexterm>
48352 </para>
48353 <informaltable frame="all">
48354 <tgroup cols="4" colsep="0" rowsep="0">
48355 <colspec colwidth="8*" align="left"/>
48356 <colspec colwidth="6*" align="center"/>
48357 <colspec colwidth="6*" align="center"/>
48358 <colspec colwidth="6*" align="right"/>
48359 <tbody>
48360 <row>
48361 <entry><option>authenticated_sender_force</option></entry>
48362 <entry>Use: <emphasis>smtp</emphasis></entry>
48363 <entry>Type: <emphasis>boolean</emphasis></entry>
48364 <entry>Default: <emphasis>false</emphasis></entry>
48365 </row>
48366 </tbody>
48367 </tgroup>
48368 </informaltable>
48369 <para>
48370 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
48371 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
48372 authenticated as a client.
48373 </para>
48374 <para>
48375 <indexterm role="option">
48376 <primary><option>command_timeout</option></primary>
48377 </indexterm>
48378 </para>
48379 <informaltable frame="all">
48380 <tgroup cols="4" colsep="0" rowsep="0">
48381 <colspec colwidth="8*" align="left"/>
48382 <colspec colwidth="6*" align="center"/>
48383 <colspec colwidth="6*" align="center"/>
48384 <colspec colwidth="6*" align="right"/>
48385 <tbody>
48386 <row>
48387 <entry><option>command_timeout</option></entry>
48388 <entry>Use: <emphasis>smtp</emphasis></entry>
48389 <entry>Type: <emphasis>time</emphasis></entry>
48390 <entry>Default: <emphasis>5m</emphasis></entry>
48391 </row>
48392 </tbody>
48393 </tgroup>
48394 </informaltable>
48395 <para>
48396 This sets a timeout for receiving a response to an SMTP command that has been
48397 sent out. It is also used when waiting for the initial banner line from the
48398 remote host. Its value must not be zero.
48399 </para>
48400 <para>
48401 <indexterm role="option">
48402 <primary><option>connect_timeout</option></primary>
48403 </indexterm>
48404 </para>
48405 <informaltable frame="all">
48406 <tgroup cols="4" colsep="0" rowsep="0">
48407 <colspec colwidth="8*" align="left"/>
48408 <colspec colwidth="6*" align="center"/>
48409 <colspec colwidth="6*" align="center"/>
48410 <colspec colwidth="6*" align="right"/>
48411 <tbody>
48412 <row>
48413 <entry><option>connect_timeout</option></entry>
48414 <entry>Use: <emphasis>smtp</emphasis></entry>
48415 <entry>Type: <emphasis>time</emphasis></entry>
48416 <entry>Default: <emphasis>5m</emphasis></entry>
48417 </row>
48418 </tbody>
48419 </tgroup>
48420 </informaltable>
48421 <para>
48422 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
48423 to a remote host. A setting of zero allows the system timeout (typically
48424 several minutes) to act. To have any effect, the value of this option must be
48425 less than the system timeout. However, it has been observed that on some
48426 systems there is no system timeout, which is why the default value for this
48427 option is 5 minutes, a value recommended by RFC 1123.
48428 </para>
48429 <para>
48430 <indexterm role="option">
48431 <primary><option>connection_max_messages</option></primary>
48432 </indexterm>
48433 </para>
48434 <informaltable frame="all">
48435 <tgroup cols="4" colsep="0" rowsep="0">
48436 <colspec colwidth="8*" align="left"/>
48437 <colspec colwidth="6*" align="center"/>
48438 <colspec colwidth="6*" align="center"/>
48439 <colspec colwidth="6*" align="right"/>
48440 <tbody>
48441 <row>
48442 <entry><option>connection_max_messages</option></entry>
48443 <entry>Use: <emphasis>smtp</emphasis></entry>
48444 <entry>Type: <emphasis>integer</emphasis></entry>
48445 <entry>Default: <emphasis>500</emphasis></entry>
48446 </row>
48447 </tbody>
48448 </tgroup>
48449 </informaltable>
48450 <para>
48451 <indexterm role="concept">
48452 <primary>SMTP</primary>
48453 <secondary>passed connection</secondary>
48454 </indexterm>
48455 <indexterm role="concept">
48456 <primary>SMTP</primary>
48457 <secondary>multiple deliveries</secondary>
48458 </indexterm>
48459 <indexterm role="concept">
48460 <primary>multiple SMTP deliveries</primary>
48461 </indexterm>
48462 This controls the maximum number of separate message deliveries that are sent
48463 over a single TCP/IP connection. If the value is zero, there is no limit.
48464 For testing purposes, this value can be overridden by the <option>-oB</option> command line
48465 option.
48466 </para>
48467 <para>
48468 <indexterm role="option">
48469 <primary><option>dane_require_tls_ciphers</option></primary>
48470 </indexterm>
48471 </para>
48472 <informaltable frame="all">
48473 <tgroup cols="4" colsep="0" rowsep="0">
48474 <colspec colwidth="8*" align="left"/>
48475 <colspec colwidth="6*" align="center"/>
48476 <colspec colwidth="6*" align="center"/>
48477 <colspec colwidth="6*" align="right"/>
48478 <tbody>
48479 <row>
48480 <entry><option>dane_require_tls_ciphers</option></entry>
48481 <entry>Use: <emphasis>smtp</emphasis></entry>
48482 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48483 <entry>Default: <emphasis>unset</emphasis></entry>
48484 </row>
48485 </tbody>
48486 </tgroup>
48487 </informaltable>
48488 <para>
48489 <indexterm role="concept">
48490 <primary>TLS</primary>
48491 <secondary>requiring specific ciphers for DANE</secondary>
48492 </indexterm>
48493 <indexterm role="concept">
48494 <primary>cipher</primary>
48495 <secondary>requiring specific</secondary>
48496 </indexterm>
48497 <indexterm role="concept">
48498 <primary>DANE</primary>
48499 <secondary>TLS ciphers</secondary>
48500 </indexterm>
48501 This option may be used to override <option>tls_require_ciphers</option> for connections
48502 where DANE has been determined to be in effect.
48503 If not set, then <option>tls_require_ciphers</option> will be used.
48504 Normal SMTP delivery is not able to make strong demands of TLS cipher
48505 configuration, because delivery will fall back to plaintext.  Once DANE has
48506 been determined to be in effect, there is no plaintext fallback and making the
48507 TLS cipherlist configuration stronger will increase security, rather than
48508 counter-intuitively decreasing it.
48509 If the option expands to be empty or is forced to fail, then it will
48510 be treated as unset and <option>tls_require_ciphers</option> will be used instead.
48511 </para>
48512 <para>
48513 <indexterm role="option">
48514 <primary><option>data_timeout</option></primary>
48515 </indexterm>
48516 </para>
48517 <informaltable frame="all">
48518 <tgroup cols="4" colsep="0" rowsep="0">
48519 <colspec colwidth="8*" align="left"/>
48520 <colspec colwidth="6*" align="center"/>
48521 <colspec colwidth="6*" align="center"/>
48522 <colspec colwidth="6*" align="right"/>
48523 <tbody>
48524 <row>
48525 <entry><option>data_timeout</option></entry>
48526 <entry>Use: <emphasis>smtp</emphasis></entry>
48527 <entry>Type: <emphasis>time</emphasis></entry>
48528 <entry>Default: <emphasis>5m</emphasis></entry>
48529 </row>
48530 </tbody>
48531 </tgroup>
48532 </informaltable>
48533 <para>
48534 This sets a timeout for the transmission of each block in the data portion of
48535 the message. As a result, the overall timeout for a message depends on the size
48536 of the message. Its value must not be zero. See also <option>final_timeout</option>.
48537 </para>
48538 <para>
48539 <indexterm role="option">
48540 <primary><option>dkim_canon</option></primary>
48541 </indexterm>
48542 </para>
48543 <informaltable frame="all">
48544 <tgroup cols="4" colsep="0" rowsep="0">
48545 <colspec colwidth="8*" align="left"/>
48546 <colspec colwidth="6*" align="center"/>
48547 <colspec colwidth="6*" align="center"/>
48548 <colspec colwidth="6*" align="right"/>
48549 <tbody>
48550 <row>
48551 <entry><option>dkim_canon</option></entry>
48552 <entry>Use: <emphasis>smtp</emphasis></entry>
48553 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48554 <entry>Default: <emphasis>unset</emphasis></entry>
48555 </row>
48556 </tbody>
48557 </tgroup>
48558 </informaltable>
48559 <para>
48560 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48561 <indexterm role="option">
48562 <primary><option>unset</option></primary>
48563 </indexterm>
48564 </para>
48565 <informaltable frame="all">
48566 <tgroup cols="4" colsep="0" rowsep="0">
48567 <colspec colwidth="8*" align="left"/>
48568 <colspec colwidth="6*" align="center"/>
48569 <colspec colwidth="6*" align="center"/>
48570 <colspec colwidth="6*" align="right"/>
48571 <tbody>
48572 <row>
48573 <entry><option>dkim_domain</option></entry>
48574 <entry>Use: <emphasis>smtp</emphasis></entry>
48575 <entry>Type: <emphasis>string</emphasis></entry>
48576 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
48577 </row>
48578 </tbody>
48579 </tgroup>
48580 </informaltable>
48581 <para>
48582 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48583 <indexterm role="option">
48584 <primary><option>dkim_hash</option></primary>
48585 </indexterm>
48586 </para>
48587 <informaltable frame="all">
48588 <tgroup cols="4" colsep="0" rowsep="0">
48589 <colspec colwidth="8*" align="left"/>
48590 <colspec colwidth="6*" align="center"/>
48591 <colspec colwidth="6*" align="center"/>
48592 <colspec colwidth="6*" align="right"/>
48593 <tbody>
48594 <row>
48595 <entry><option>dkim_hash</option></entry>
48596 <entry>Use: <emphasis>smtp</emphasis></entry>
48597 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48598 <entry>Default: <emphasis>sha256</emphasis></entry>
48599 </row>
48600 </tbody>
48601 </tgroup>
48602 </informaltable>
48603 <para>
48604 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48605 <indexterm role="option">
48606 <primary><option>dkim_identity</option></primary>
48607 </indexterm>
48608 </para>
48609 <informaltable frame="all">
48610 <tgroup cols="4" colsep="0" rowsep="0">
48611 <colspec colwidth="8*" align="left"/>
48612 <colspec colwidth="6*" align="center"/>
48613 <colspec colwidth="6*" align="center"/>
48614 <colspec colwidth="6*" align="right"/>
48615 <tbody>
48616 <row>
48617 <entry><option>dkim_identity</option></entry>
48618 <entry>Use: <emphasis>smtp</emphasis></entry>
48619 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48620 <entry>Default: <emphasis>unset</emphasis></entry>
48621 </row>
48622 </tbody>
48623 </tgroup>
48624 </informaltable>
48625 <para>
48626 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48627 <indexterm role="option">
48628 <primary><option>dkim_private_key</option></primary>
48629 </indexterm>
48630 </para>
48631 <informaltable frame="all">
48632 <tgroup cols="4" colsep="0" rowsep="0">
48633 <colspec colwidth="8*" align="left"/>
48634 <colspec colwidth="6*" align="center"/>
48635 <colspec colwidth="6*" align="center"/>
48636 <colspec colwidth="6*" align="right"/>
48637 <tbody>
48638 <row>
48639 <entry><option>dkim_private_key</option></entry>
48640 <entry>Use: <emphasis>smtp</emphasis></entry>
48641 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48642 <entry>Default: <emphasis>unset</emphasis></entry>
48643 </row>
48644 </tbody>
48645 </tgroup>
48646 </informaltable>
48647 <para>
48648 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48649 <indexterm role="option">
48650 <primary><option>dkim_selector</option></primary>
48651 </indexterm>
48652 </para>
48653 <informaltable frame="all">
48654 <tgroup cols="4" colsep="0" rowsep="0">
48655 <colspec colwidth="8*" align="left"/>
48656 <colspec colwidth="6*" align="center"/>
48657 <colspec colwidth="6*" align="center"/>
48658 <colspec colwidth="6*" align="right"/>
48659 <tbody>
48660 <row>
48661 <entry><option>dkim_selector</option></entry>
48662 <entry>Use: <emphasis>smtp</emphasis></entry>
48663 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48664 <entry>Default: <emphasis>unset</emphasis></entry>
48665 </row>
48666 </tbody>
48667 </tgroup>
48668 </informaltable>
48669 <para>
48670 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48671 <indexterm role="option">
48672 <primary><option>dkim_strict</option></primary>
48673 </indexterm>
48674 </para>
48675 <informaltable frame="all">
48676 <tgroup cols="4" colsep="0" rowsep="0">
48677 <colspec colwidth="8*" align="left"/>
48678 <colspec colwidth="6*" align="center"/>
48679 <colspec colwidth="6*" align="center"/>
48680 <colspec colwidth="6*" align="right"/>
48681 <tbody>
48682 <row>
48683 <entry><option>dkim_strict</option></entry>
48684 <entry>Use: <emphasis>smtp</emphasis></entry>
48685 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48686 <entry>Default: <emphasis>unset</emphasis></entry>
48687 </row>
48688 </tbody>
48689 </tgroup>
48690 </informaltable>
48691 <para>
48692 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48693 <indexterm role="option">
48694 <primary><option>dkim_sign_headers</option></primary>
48695 </indexterm>
48696 </para>
48697 <informaltable frame="all">
48698 <tgroup cols="4" colsep="0" rowsep="0">
48699 <colspec colwidth="8*" align="left"/>
48700 <colspec colwidth="6*" align="center"/>
48701 <colspec colwidth="6*" align="center"/>
48702 <colspec colwidth="6*" align="right"/>
48703 <tbody>
48704 <row>
48705 <entry><option>dkim_sign_headers</option></entry>
48706 <entry>Use: <emphasis>smtp</emphasis></entry>
48707 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48708 <entry>Default: <emphasis>per RFC</emphasis></entry>
48709 </row>
48710 </tbody>
48711 </tgroup>
48712 </informaltable>
48713 <para>
48714 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48715 <indexterm role="option">
48716 <primary><option>dkim_timestamps</option></primary>
48717 </indexterm>
48718 </para>
48719 <informaltable frame="all">
48720 <tgroup cols="4" colsep="0" rowsep="0">
48721 <colspec colwidth="8*" align="left"/>
48722 <colspec colwidth="6*" align="center"/>
48723 <colspec colwidth="6*" align="center"/>
48724 <colspec colwidth="6*" align="right"/>
48725 <tbody>
48726 <row>
48727 <entry><option>dkim_timestamps</option></entry>
48728 <entry>Use: <emphasis>smtp</emphasis></entry>
48729 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48730 <entry>Default: <emphasis>unset</emphasis></entry>
48731 </row>
48732 </tbody>
48733 </tgroup>
48734 </informaltable>
48735 <para>
48736 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
48737 </para>
48738 <para>
48739 <indexterm role="option">
48740 <primary><option>delay_after_cutoff</option></primary>
48741 </indexterm>
48742 </para>
48743 <informaltable frame="all">
48744 <tgroup cols="4" colsep="0" rowsep="0">
48745 <colspec colwidth="8*" align="left"/>
48746 <colspec colwidth="6*" align="center"/>
48747 <colspec colwidth="6*" align="center"/>
48748 <colspec colwidth="6*" align="right"/>
48749 <tbody>
48750 <row>
48751 <entry><option>delay_after_cutoff</option></entry>
48752 <entry>Use: <emphasis>smtp</emphasis></entry>
48753 <entry>Type: <emphasis>boolean</emphasis></entry>
48754 <entry>Default: <emphasis>true</emphasis></entry>
48755 </row>
48756 </tbody>
48757 </tgroup>
48758 </informaltable>
48759 <para>
48760 <indexterm role="concept">
48761 <primary>final cutoff</primary>
48762 <secondary>retries, controlling</secondary>
48763 </indexterm>
48764 <indexterm role="concept">
48765 <primary>retry</primary>
48766 <secondary>final cutoff</secondary>
48767 </indexterm>
48768 This option controls what happens when all remote IP addresses for a given
48769 domain have been inaccessible for so long that they have passed their retry
48770 cutoff times.
48771 </para>
48772 <para>
48773 In the default state, if the next retry time has not been reached for any of
48774 them, the address is bounced without trying any deliveries. In other words,
48775 Exim delays retrying an IP address after the final cutoff time until a new
48776 retry time is reached, and can therefore bounce an address without ever trying
48777 a delivery, when machines have been down for a long time. Some people are
48778 unhappy at this prospect, so...
48779 </para>
48780 <para>
48781 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
48782 addresses are past their final cutoff time, Exim tries to deliver to those
48783 IP addresses that have not been tried since the message arrived. If there are
48784 none, of if they all fail, the address is bounced. In other words, it does not
48785 delay when a new message arrives, but immediately tries those expired IP
48786 addresses that haven&#x2019;t been tried since the message arrived. If there is a
48787 continuous stream of messages for the dead hosts, unsetting
48788 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
48789 to them.
48790 </para>
48791 <para>
48792 <indexterm role="option">
48793 <primary><option>dns_qualify_single</option></primary>
48794 </indexterm>
48795 </para>
48796 <informaltable frame="all">
48797 <tgroup cols="4" colsep="0" rowsep="0">
48798 <colspec colwidth="8*" align="left"/>
48799 <colspec colwidth="6*" align="center"/>
48800 <colspec colwidth="6*" align="center"/>
48801 <colspec colwidth="6*" align="right"/>
48802 <tbody>
48803 <row>
48804 <entry><option>dns_qualify_single</option></entry>
48805 <entry>Use: <emphasis>smtp</emphasis></entry>
48806 <entry>Type: <emphasis>boolean</emphasis></entry>
48807 <entry>Default: <emphasis>true</emphasis></entry>
48808 </row>
48809 </tbody>
48810 </tgroup>
48811 </informaltable>
48812 <para>
48813 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
48814 and the <option>gethostbyname</option> option is false,
48815 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
48816 in chapter <xref linkend="CHAPdnslookup"/> for more details.
48817 </para>
48818 <para>
48819 <indexterm role="option">
48820 <primary><option>dns_search_parents</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>dns_search_parents</option></entry>
48832 <entry>Use: <emphasis>smtp</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 the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
48841 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
48842 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
48843 details.
48844 </para>
48845 <para>
48846 <indexterm role="option">
48847 <primary><option>dnssec_request_domains</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>dnssec_request_domains</option></entry>
48859 <entry>Use: <emphasis>smtp</emphasis></entry>
48860 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
48861 <entry>Default: <emphasis>*</emphasis></entry>
48862 </row>
48863 </tbody>
48864 </tgroup>
48865 </informaltable>
48866 <para>
48867 <indexterm role="concept">
48868 <primary>MX record</primary>
48869 <secondary>security</secondary>
48870 </indexterm>
48871 <indexterm role="concept">
48872 <primary>DNSSEC</primary>
48873 <secondary>MX lookup</secondary>
48874 </indexterm>
48875 <indexterm role="concept">
48876 <primary>security</primary>
48877 <secondary>MX lookup</secondary>
48878 </indexterm>
48879 <indexterm role="concept">
48880 <primary>DNS</primary>
48881 <secondary>DNSSEC</secondary>
48882 </indexterm>
48883 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
48884 the dnssec request bit set. Setting this transport option is only useful if the
48885 transport overrides or sets the host names. See the <option>dnssec_request_domains</option>
48886 router option.
48887 </para>
48888 <para>
48889 <indexterm role="option">
48890 <primary><option>dnssec_require_domains</option></primary>
48891 </indexterm>
48892 </para>
48893 <informaltable frame="all">
48894 <tgroup cols="4" colsep="0" rowsep="0">
48895 <colspec colwidth="8*" align="left"/>
48896 <colspec colwidth="6*" align="center"/>
48897 <colspec colwidth="6*" align="center"/>
48898 <colspec colwidth="6*" align="right"/>
48899 <tbody>
48900 <row>
48901 <entry><option>dnssec_require_domains</option></entry>
48902 <entry>Use: <emphasis>smtp</emphasis></entry>
48903 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
48904 <entry>Default: <emphasis>unset</emphasis></entry>
48905 </row>
48906 </tbody>
48907 </tgroup>
48908 </informaltable>
48909 <para>
48910 <indexterm role="concept">
48911 <primary>MX record</primary>
48912 <secondary>security</secondary>
48913 </indexterm>
48914 <indexterm role="concept">
48915 <primary>DNSSEC</primary>
48916 <secondary>MX lookup</secondary>
48917 </indexterm>
48918 <indexterm role="concept">
48919 <primary>security</primary>
48920 <secondary>MX lookup</secondary>
48921 </indexterm>
48922 <indexterm role="concept">
48923 <primary>DNS</primary>
48924 <secondary>DNSSEC</secondary>
48925 </indexterm>
48926 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
48927 the dnssec request bit set.  Setting this transport option is only
48928 useful if the transport overrides or sets the host names. See the
48929 <option>dnssec_require_domains</option> router option.
48930 </para>
48931 <para>
48932 <indexterm role="option">
48933 <primary><option>dscp</option></primary>
48934 </indexterm>
48935 </para>
48936 <informaltable frame="all">
48937 <tgroup cols="4" colsep="0" rowsep="0">
48938 <colspec colwidth="8*" align="left"/>
48939 <colspec colwidth="6*" align="center"/>
48940 <colspec colwidth="6*" align="center"/>
48941 <colspec colwidth="6*" align="right"/>
48942 <tbody>
48943 <row>
48944 <entry><option>dscp</option></entry>
48945 <entry>Use: <emphasis>smtp</emphasis></entry>
48946 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48947 <entry>Default: <emphasis>unset</emphasis></entry>
48948 </row>
48949 </tbody>
48950 </tgroup>
48951 </informaltable>
48952 <para>
48953 <indexterm role="concept">
48954 <primary>DCSP</primary>
48955 <secondary>outbound</secondary>
48956 </indexterm>
48957 This option causes the DSCP value associated with a socket to be set to one
48958 of a number of fixed strings or to numeric value.
48959 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
48960 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
48961 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
48962 </para>
48963 <para>
48964 The outbound packets from Exim will be marked with this value in the header
48965 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
48966 that these values will have any effect, not be stripped by networking
48967 equipment, or do much of anything without cooperation with your Network
48968 Engineer and those of all network operators between the source and destination.
48969 </para>
48970 <para>
48971 <indexterm role="option">
48972 <primary><option>fallback_hosts</option></primary>
48973 </indexterm>
48974 </para>
48975 <informaltable frame="all">
48976 <tgroup cols="4" colsep="0" rowsep="0">
48977 <colspec colwidth="8*" align="left"/>
48978 <colspec colwidth="6*" align="center"/>
48979 <colspec colwidth="6*" align="center"/>
48980 <colspec colwidth="6*" align="right"/>
48981 <tbody>
48982 <row>
48983 <entry><option>fallback_hosts</option></entry>
48984 <entry>Use: <emphasis>smtp</emphasis></entry>
48985 <entry>Type: <emphasis>string list</emphasis></entry>
48986 <entry>Default: <emphasis>unset</emphasis></entry>
48987 </row>
48988 </tbody>
48989 </tgroup>
48990 </informaltable>
48991 <para>
48992 <indexterm role="concept">
48993 <primary>fallback</primary>
48994 <secondary>hosts specified on transport</secondary>
48995 </indexterm>
48996 String expansion is not applied to this option. The argument must be a
48997 colon-separated list of host names or IP addresses, optionally also including
48998 port numbers, though the separator can be changed, as described in section
48999 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
49000 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
49001 in section <xref linkend="SECTformatonehostitem"/>.
49002 </para>
49003 <para>
49004 Fallback hosts can also be specified on routers, which associate them with the
49005 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
49006 <option>fallback_hosts</option> specified on the transport is used only if the address does
49007 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
49008 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
49009 However, <option>hosts_randomize</option> does apply to fallback host lists.
49010 </para>
49011 <para>
49012 If Exim is unable to deliver to any of the hosts for a particular address, and
49013 the errors are not permanent rejections, the address is put on a separate
49014 transport queue with its host list replaced by the fallback hosts, unless the
49015 address was routed via MX records and the current host was in the original MX
49016 list. In that situation, the fallback host list is not used.
49017 </para>
49018 <para>
49019 Once normal deliveries are complete, the fallback queue is delivered by
49020 re-running the same transports with the new host lists. If several failing
49021 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
49022 copy of the message is sent.
49023 </para>
49024 <para>
49025 The resolution of the host names on the fallback list is controlled by the
49026 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
49027 both to cases when the host list comes with the address and when it is taken
49028 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
49029 fails</quote> facility.
49030 </para>
49031 <para>
49032 <indexterm role="option">
49033 <primary><option>final_timeout</option></primary>
49034 </indexterm>
49035 </para>
49036 <informaltable frame="all">
49037 <tgroup cols="4" colsep="0" rowsep="0">
49038 <colspec colwidth="8*" align="left"/>
49039 <colspec colwidth="6*" align="center"/>
49040 <colspec colwidth="6*" align="center"/>
49041 <colspec colwidth="6*" align="right"/>
49042 <tbody>
49043 <row>
49044 <entry><option>final_timeout</option></entry>
49045 <entry>Use: <emphasis>smtp</emphasis></entry>
49046 <entry>Type: <emphasis>time</emphasis></entry>
49047 <entry>Default: <emphasis>10m</emphasis></entry>
49048 </row>
49049 </tbody>
49050 </tgroup>
49051 </informaltable>
49052 <para>
49053 This is the timeout that applies while waiting for the response to the final
49054 line containing just <quote>.</quote> that terminates a message. Its value must not be
49055 zero.
49056 </para>
49057 <para>
49058 <indexterm role="option">
49059 <primary><option>gethostbyname</option></primary>
49060 </indexterm>
49061 </para>
49062 <informaltable frame="all">
49063 <tgroup cols="4" colsep="0" rowsep="0">
49064 <colspec colwidth="8*" align="left"/>
49065 <colspec colwidth="6*" align="center"/>
49066 <colspec colwidth="6*" align="center"/>
49067 <colspec colwidth="6*" align="right"/>
49068 <tbody>
49069 <row>
49070 <entry><option>gethostbyname</option></entry>
49071 <entry>Use: <emphasis>smtp</emphasis></entry>
49072 <entry>Type: <emphasis>boolean</emphasis></entry>
49073 <entry>Default: <emphasis>false</emphasis></entry>
49074 </row>
49075 </tbody>
49076 </tgroup>
49077 </informaltable>
49078 <para>
49079 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
49080 being used, names are looked up using <function>gethostbyname()</function>
49081 (or <function>getipnodebyname()</function> when available)
49082 instead of using the DNS. Of course, that function may in fact use the DNS, but
49083 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
49084 </para>
49085 <para>
49086 <indexterm role="option">
49087 <primary><option>gnutls_compat_mode</option></primary>
49088 </indexterm>
49089 </para>
49090 <informaltable frame="all">
49091 <tgroup cols="4" colsep="0" rowsep="0">
49092 <colspec colwidth="8*" align="left"/>
49093 <colspec colwidth="6*" align="center"/>
49094 <colspec colwidth="6*" align="center"/>
49095 <colspec colwidth="6*" align="right"/>
49096 <tbody>
49097 <row>
49098 <entry><option>gnutls_compat_mode</option></entry>
49099 <entry>Use: <emphasis>smtp</emphasis></entry>
49100 <entry>Type: <emphasis>boolean</emphasis></entry>
49101 <entry>Default: <emphasis>unset</emphasis></entry>
49102 </row>
49103 </tbody>
49104 </tgroup>
49105 </informaltable>
49106 <para>
49107 This option controls whether GnuTLS is used in compatibility mode in an Exim
49108 server. This reduces security slightly, but improves interworking with older
49109 implementations of TLS.
49110 </para>
49111 <para>
49112 <indexterm role="option">
49113 <primary><option>helo_data</option></primary>
49114 </indexterm>
49115 </para>
49116 <informaltable frame="all">
49117 <tgroup cols="4" colsep="0" rowsep="0">
49118 <colspec colwidth="8*" align="left"/>
49119 <colspec colwidth="6*" align="center"/>
49120 <colspec colwidth="6*" align="center"/>
49121 <colspec colwidth="6*" align="right"/>
49122 <tbody>
49123 <row>
49124 <entry><option>helo_data</option></entry>
49125 <entry>Use: <emphasis>smtp</emphasis></entry>
49126 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49127 <entry>Default: <emphasis>see below</emphasis></entry>
49128 </row>
49129 </tbody>
49130 </tgroup>
49131 </informaltable>
49132 <para>
49133 <indexterm role="concept">
49134 <primary>HELO</primary>
49135 <secondary>argument, setting</secondary>
49136 </indexterm>
49137 <indexterm role="concept">
49138 <primary>EHLO</primary>
49139 <secondary>argument, setting</secondary>
49140 </indexterm>
49141 <indexterm role="concept">
49142 <primary>LHLO argument setting</primary>
49143 </indexterm>
49144 The value of this option is expanded after a connection to a another host has
49145 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
49146 command that starts the outgoing SMTP or LMTP session. The default value of the
49147 option is:
49148 </para>
49149 <literallayout class="monospaced">
49150 $primary_hostname
49151 </literallayout>
49152 <para>
49153 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
49154 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
49155 <varname>$sending_port</varname> are set to the local IP address and port number that are being
49156 used. These variables can be used to generate different values for different
49157 servers or different local IP addresses. For example, if you want the string
49158 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
49159 interface address, you could use this:
49160 </para>
49161 <literallayout class="monospaced">
49162 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
49163   {$primary_hostname}}
49164 </literallayout>
49165 <para>
49166 The use of <option>helo_data</option> applies both to sending messages and when doing
49167 callouts.
49168 </para>
49169 <para>
49170 <indexterm role="option">
49171 <primary><option>hosts</option></primary>
49172 </indexterm>
49173 </para>
49174 <informaltable frame="all">
49175 <tgroup cols="4" colsep="0" rowsep="0">
49176 <colspec colwidth="8*" align="left"/>
49177 <colspec colwidth="6*" align="center"/>
49178 <colspec colwidth="6*" align="center"/>
49179 <colspec colwidth="6*" align="right"/>
49180 <tbody>
49181 <row>
49182 <entry><option>hosts</option></entry>
49183 <entry>Use: <emphasis>smtp</emphasis></entry>
49184 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
49185 <entry>Default: <emphasis>unset</emphasis></entry>
49186 </row>
49187 </tbody>
49188 </tgroup>
49189 </informaltable>
49190 <para>
49191 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
49192 finds the hosts by looking up the address domain in the DNS, or by
49193 <command>manualroute</command>, which has lists of hosts in its configuration. However,
49194 email addresses can be passed to the <command>smtp</command> transport by any router, and not
49195 all of them can provide an associated list of hosts.
49196 </para>
49197 <para>
49198 The <option>hosts</option> option specifies a list of hosts to be used if the address being
49199 processed does not have any hosts associated with it. The hosts specified by
49200 <option>hosts</option> are also used, whether or not the address has its own hosts, if
49201 <option>hosts_override</option> is set.
49202 </para>
49203 <para>
49204 The string is first expanded, before being interpreted as a colon-separated
49205 list of host names or IP addresses, possibly including port numbers. The
49206 separator may be changed to something other than colon, as described in section
49207 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
49208 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
49209 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
49210 of the <command>manualroute</command> router is not available here.
49211 </para>
49212 <para>
49213 If the expansion fails, delivery is deferred. Unless the failure was caused by
49214 the inability to complete a lookup, the error is logged to the panic log as
49215 well as the main log. Host names are looked up either by searching directly for
49216 address records in the DNS or by calling <function>gethostbyname()</function> (or
49217 <function>getipnodebyname()</function> when available), depending on the setting of the
49218 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
49219 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
49220 address are used.
49221 </para>
49222 <para>
49223 During delivery, the hosts are tried in order, subject to their retry status,
49224 unless <option>hosts_randomize</option> is set.
49225 </para>
49226 <para>
49227 <indexterm role="option">
49228 <primary><option>hosts_avoid_esmtp</option></primary>
49229 </indexterm>
49230 </para>
49231 <informaltable frame="all">
49232 <tgroup cols="4" colsep="0" rowsep="0">
49233 <colspec colwidth="8*" align="left"/>
49234 <colspec colwidth="6*" align="center"/>
49235 <colspec colwidth="6*" align="center"/>
49236 <colspec colwidth="6*" align="right"/>
49237 <tbody>
49238 <row>
49239 <entry><option>hosts_avoid_esmtp</option></entry>
49240 <entry>Use: <emphasis>smtp</emphasis></entry>
49241 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49242 <entry>Default: <emphasis>unset</emphasis></entry>
49243 </row>
49244 </tbody>
49245 </tgroup>
49246 </informaltable>
49247 <para>
49248 <indexterm role="concept">
49249 <primary>ESMTP, avoiding use of</primary>
49250 </indexterm>
49251 <indexterm role="concept">
49252 <primary>HELO</primary>
49253 <secondary>forcing use of</secondary>
49254 </indexterm>
49255 <indexterm role="concept">
49256 <primary>EHLO</primary>
49257 <secondary>avoiding use of</secondary>
49258 </indexterm>
49259 <indexterm role="concept">
49260 <primary>PIPELINING</primary>
49261 <secondary>avoiding the use of</secondary>
49262 </indexterm>
49263 This option is for use with broken hosts that announce ESMTP facilities (for
49264 example, PIPELINING) and then fail to implement them properly. When a host
49265 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
49266 start of the SMTP session. This means that it cannot use any of the ESMTP
49267 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
49268 </para>
49269 <para>
49270 <indexterm role="option">
49271 <primary><option>hosts_avoid_pipelining</option></primary>
49272 </indexterm>
49273 </para>
49274 <informaltable frame="all">
49275 <tgroup cols="4" colsep="0" rowsep="0">
49276 <colspec colwidth="8*" align="left"/>
49277 <colspec colwidth="6*" align="center"/>
49278 <colspec colwidth="6*" align="center"/>
49279 <colspec colwidth="6*" align="right"/>
49280 <tbody>
49281 <row>
49282 <entry><option>hosts_avoid_pipelining</option></entry>
49283 <entry>Use: <emphasis>smtp</emphasis></entry>
49284 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49285 <entry>Default: <emphasis>unset</emphasis></entry>
49286 </row>
49287 </tbody>
49288 </tgroup>
49289 </informaltable>
49290 <para>
49291 <indexterm role="concept">
49292 <primary>PIPELINING</primary>
49293 <secondary>avoiding the use of</secondary>
49294 </indexterm>
49295 <indexterm role="concept">
49296 <primary>ESMTP extensions</primary>
49297 <secondary>PIPELINING</secondary>
49298 </indexterm>
49299 Exim will not use the ESMTP PIPELINING extension when delivering to any host
49300 that matches this list, even if the server host advertises PIPELINING support.
49301 </para>
49302 <para>
49303 <indexterm role="option">
49304 <primary><option>hosts_pipe_connect</option></primary>
49305 </indexterm>
49306 </para>
49307 <informaltable frame="all">
49308 <tgroup cols="4" colsep="0" rowsep="0">
49309 <colspec colwidth="8*" align="left"/>
49310 <colspec colwidth="6*" align="center"/>
49311 <colspec colwidth="6*" align="center"/>
49312 <colspec colwidth="6*" align="right"/>
49313 <tbody>
49314 <row>
49315 <entry><option>hosts_pipe_connect</option></entry>
49316 <entry>Use: <emphasis>smtp</emphasis></entry>
49317 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49318 <entry>Default: <emphasis>unset</emphasis></entry>
49319 </row>
49320 </tbody>
49321 </tgroup>
49322 </informaltable>
49323 <para>
49324 <indexterm role="concept">
49325 <primary>pipelining</primary>
49326 <secondary>early connection</secondary>
49327 </indexterm>
49328 <indexterm role="concept">
49329 <primary>pipelining</primary>
49330 <secondary>PIPE_CONNECT</secondary>
49331 </indexterm>
49332 If Exim is built with the SUPPORT_PIPE_CONNECT build option
49333 this option controls which to hosts the facility watched for
49334 and recorded, and used for subsequent connections.
49335 </para>
49336 <para>
49337 The retry hints database is used for the record,
49338 and records are subject to the <option>retry_data_expire</option> option.
49339 When used, the pipelining saves on roundtrip times.
49340 It also turns SMTP into a client-first protocol
49341 so combines well with TCP Fast Open.
49342 </para>
49343 <para>
49344 See also the <option>pipelining_connect_advertise_hosts</option> main option.
49345 </para>
49346 <para>
49347 Note:
49348 When the facility is used, the transport <option>helo_data</option> option
49349 will be expanded before the <varname>$sending_ip_address</varname> variable
49350 is filled in.
49351 A check is made for the use of that variable, without the
49352 presence of a <quote>def:</quote> test on it, but suitably complex coding
49353 can avoid the check and produce unexpected results.
49354 You have been warned.
49355 </para>
49356 <para>
49357 <indexterm role="option">
49358 <primary><option>hosts_avoid_tls</option></primary>
49359 </indexterm>
49360 </para>
49361 <informaltable frame="all">
49362 <tgroup cols="4" colsep="0" rowsep="0">
49363 <colspec colwidth="8*" align="left"/>
49364 <colspec colwidth="6*" align="center"/>
49365 <colspec colwidth="6*" align="center"/>
49366 <colspec colwidth="6*" align="right"/>
49367 <tbody>
49368 <row>
49369 <entry><option>hosts_avoid_tls</option></entry>
49370 <entry>Use: <emphasis>smtp</emphasis></entry>
49371 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49372 <entry>Default: <emphasis>unset</emphasis></entry>
49373 </row>
49374 </tbody>
49375 </tgroup>
49376 </informaltable>
49377 <para>
49378 <indexterm role="concept">
49379 <primary>TLS</primary>
49380 <secondary>avoiding for certain hosts</secondary>
49381 </indexterm>
49382 Exim will not try to start a TLS session when delivering to any host that
49383 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
49384 </para>
49385 <para>
49386 <indexterm role="option">
49387 <primary><option>hosts_verify_avoid_tls</option></primary>
49388 </indexterm>
49389 </para>
49390 <informaltable frame="all">
49391 <tgroup cols="4" colsep="0" rowsep="0">
49392 <colspec colwidth="8*" align="left"/>
49393 <colspec colwidth="6*" align="center"/>
49394 <colspec colwidth="6*" align="center"/>
49395 <colspec colwidth="6*" align="right"/>
49396 <tbody>
49397 <row>
49398 <entry><option>hosts_verify_avoid_tls</option></entry>
49399 <entry>Use: <emphasis>smtp</emphasis></entry>
49400 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49401 <entry>Default: <emphasis>unset</emphasis></entry>
49402 </row>
49403 </tbody>
49404 </tgroup>
49405 </informaltable>
49406 <para>
49407 <indexterm role="concept">
49408 <primary>TLS</primary>
49409 <secondary>avoiding for certain hosts</secondary>
49410 </indexterm>
49411 Exim will not try to start a TLS session for a verify callout,
49412 or when delivering in cutthrough mode,
49413 to any host that matches this list.
49414 </para>
49415 <para>
49416 <indexterm role="option">
49417 <primary><option>hosts_max_try</option></primary>
49418 </indexterm>
49419 </para>
49420 <informaltable frame="all">
49421 <tgroup cols="4" colsep="0" rowsep="0">
49422 <colspec colwidth="8*" align="left"/>
49423 <colspec colwidth="6*" align="center"/>
49424 <colspec colwidth="6*" align="center"/>
49425 <colspec colwidth="6*" align="right"/>
49426 <tbody>
49427 <row>
49428 <entry><option>hosts_max_try</option></entry>
49429 <entry>Use: <emphasis>smtp</emphasis></entry>
49430 <entry>Type: <emphasis>integer</emphasis></entry>
49431 <entry>Default: <emphasis>5</emphasis></entry>
49432 </row>
49433 </tbody>
49434 </tgroup>
49435 </informaltable>
49436 <para>
49437 <indexterm role="concept">
49438 <primary>host</primary>
49439 <secondary>maximum number to try</secondary>
49440 </indexterm>
49441 <indexterm role="concept">
49442 <primary>limit</primary>
49443 <secondary>number of hosts tried</secondary>
49444 </indexterm>
49445 <indexterm role="concept">
49446 <primary>limit</primary>
49447 <secondary>number of MX tried</secondary>
49448 </indexterm>
49449 <indexterm role="concept">
49450 <primary>MX record</primary>
49451 <secondary>maximum tried</secondary>
49452 </indexterm>
49453 This option limits the number of IP addresses that are tried for any one
49454 delivery in cases where there are temporary delivery errors. Section
49455 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
49456 </para>
49457 <para>
49458 <indexterm role="option">
49459 <primary><option>hosts_max_try_hardlimit</option></primary>
49460 </indexterm>
49461 </para>
49462 <informaltable frame="all">
49463 <tgroup cols="4" colsep="0" rowsep="0">
49464 <colspec colwidth="8*" align="left"/>
49465 <colspec colwidth="6*" align="center"/>
49466 <colspec colwidth="6*" align="center"/>
49467 <colspec colwidth="6*" align="right"/>
49468 <tbody>
49469 <row>
49470 <entry><option>hosts_max_try_hardlimit</option></entry>
49471 <entry>Use: <emphasis>smtp</emphasis></entry>
49472 <entry>Type: <emphasis>integer</emphasis></entry>
49473 <entry>Default: <emphasis>50</emphasis></entry>
49474 </row>
49475 </tbody>
49476 </tgroup>
49477 </informaltable>
49478 <para>
49479 This is an additional check on the maximum number of IP addresses that Exim
49480 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
49481 why it exists.
49482 </para>
49483 <para>
49484 <indexterm role="option">
49485 <primary><option>hosts_nopass_tls</option></primary>
49486 </indexterm>
49487 </para>
49488 <informaltable frame="all">
49489 <tgroup cols="4" colsep="0" rowsep="0">
49490 <colspec colwidth="8*" align="left"/>
49491 <colspec colwidth="6*" align="center"/>
49492 <colspec colwidth="6*" align="center"/>
49493 <colspec colwidth="6*" align="right"/>
49494 <tbody>
49495 <row>
49496 <entry><option>hosts_nopass_tls</option></entry>
49497 <entry>Use: <emphasis>smtp</emphasis></entry>
49498 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49499 <entry>Default: <emphasis>unset</emphasis></entry>
49500 </row>
49501 </tbody>
49502 </tgroup>
49503 </informaltable>
49504 <para>
49505 <indexterm role="concept">
49506 <primary>TLS</primary>
49507 <secondary>passing connection</secondary>
49508 </indexterm>
49509 <indexterm role="concept">
49510 <primary>multiple SMTP deliveries</primary>
49511 </indexterm>
49512 <indexterm role="concept">
49513 <primary>TLS</primary>
49514 <secondary>multiple message deliveries</secondary>
49515 </indexterm>
49516 For any host that matches this list, a connection on which a TLS session has
49517 been started will not be passed to a new delivery process for sending another
49518 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
49519 explanation of when this might be needed.
49520 </para>
49521 <para>
49522 <indexterm role="option">
49523 <primary><option>hosts_noproxy_tls</option></primary>
49524 </indexterm>
49525 </para>
49526 <informaltable frame="all">
49527 <tgroup cols="4" colsep="0" rowsep="0">
49528 <colspec colwidth="8*" align="left"/>
49529 <colspec colwidth="6*" align="center"/>
49530 <colspec colwidth="6*" align="center"/>
49531 <colspec colwidth="6*" align="right"/>
49532 <tbody>
49533 <row>
49534 <entry><option>hosts_noproxy_tls</option></entry>
49535 <entry>Use: <emphasis>smtp</emphasis></entry>
49536 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49537 <entry>Default: <emphasis>unset</emphasis></entry>
49538 </row>
49539 </tbody>
49540 </tgroup>
49541 </informaltable>
49542 <para>
49543 <indexterm role="concept">
49544 <primary>TLS</primary>
49545 <secondary>passing connection</secondary>
49546 </indexterm>
49547 <indexterm role="concept">
49548 <primary>multiple SMTP deliveries</primary>
49549 </indexterm>
49550 <indexterm role="concept">
49551 <primary>TLS</primary>
49552 <secondary>multiple message deliveries</secondary>
49553 </indexterm>
49554 For any host that matches this list, a TLS session which has
49555 been started will not be passed to a new delivery process for sending another
49556 message on the same session.
49557 </para>
49558 <para>
49559 The traditional implementation closes down TLS and re-starts it in the new
49560 process, on the same open TCP connection, for each successive message
49561 sent.  If permitted by this option a pipe to to the new process is set up
49562 instead, and the original process maintains the TLS connection and proxies
49563 the SMTP connection from and to the new process and any subsequents.
49564 The new process has no access to TLS information, so cannot include it in
49565 logging.
49566 </para>
49567 <para>
49568 <indexterm role="option">
49569 <primary><option>hosts_override</option></primary>
49570 </indexterm>
49571 </para>
49572 <informaltable frame="all">
49573 <tgroup cols="4" colsep="0" rowsep="0">
49574 <colspec colwidth="8*" align="left"/>
49575 <colspec colwidth="6*" align="center"/>
49576 <colspec colwidth="6*" align="center"/>
49577 <colspec colwidth="6*" align="right"/>
49578 <tbody>
49579 <row>
49580 <entry><option>hosts_override</option></entry>
49581 <entry>Use: <emphasis>smtp</emphasis></entry>
49582 <entry>Type: <emphasis>boolean</emphasis></entry>
49583 <entry>Default: <emphasis>false</emphasis></entry>
49584 </row>
49585 </tbody>
49586 </tgroup>
49587 </informaltable>
49588 <para>
49589 If this option is set and the <option>hosts</option> option is also set, any hosts that are
49590 attached to the address are ignored, and instead the hosts specified by the
49591 <option>hosts</option> option are always used. This option does not apply to
49592 <option>fallback_hosts</option>.
49593 </para>
49594 <para>
49595 <indexterm role="option">
49596 <primary><option>hosts_randomize</option></primary>
49597 </indexterm>
49598 </para>
49599 <informaltable frame="all">
49600 <tgroup cols="4" colsep="0" rowsep="0">
49601 <colspec colwidth="8*" align="left"/>
49602 <colspec colwidth="6*" align="center"/>
49603 <colspec colwidth="6*" align="center"/>
49604 <colspec colwidth="6*" align="right"/>
49605 <tbody>
49606 <row>
49607 <entry><option>hosts_randomize</option></entry>
49608 <entry>Use: <emphasis>smtp</emphasis></entry>
49609 <entry>Type: <emphasis>boolean</emphasis></entry>
49610 <entry>Default: <emphasis>false</emphasis></entry>
49611 </row>
49612 </tbody>
49613 </tgroup>
49614 </informaltable>
49615 <para>
49616 <indexterm role="concept">
49617 <primary>randomized host list</primary>
49618 </indexterm>
49619 <indexterm role="concept">
49620 <primary>host</primary>
49621 <secondary>list of; randomized</secondary>
49622 </indexterm>
49623 <indexterm role="concept">
49624 <primary>fallback</primary>
49625 <secondary>randomized hosts</secondary>
49626 </indexterm>
49627 If this option is set, and either the list of hosts is taken from the
49628 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
49629 were not obtained from MX records (this includes fallback hosts from the
49630 router), and were not randomized by the router, the order of trying the hosts
49631 is randomized each time the transport runs. Randomizing the order of a host
49632 list can be used to do crude load sharing.
49633 </para>
49634 <para>
49635 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
49636 order is separately randomized. This makes it possible to set up MX-like
49637 behaviour. The boundaries between groups are indicated by an item that is just
49638 <literal>+</literal> in the host list. For example:
49639 </para>
49640 <literallayout class="monospaced">
49641 hosts = host1:host2:host3:+:host4:host5
49642 </literallayout>
49643 <para>
49644 The order of the first three hosts and the order of the last two hosts is
49645 randomized for each use, but the first three always end up before the last two.
49646 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
49647 </para>
49648 <para>
49649 <indexterm role="option">
49650 <primary><option>hosts_require_auth</option></primary>
49651 </indexterm>
49652 </para>
49653 <informaltable frame="all">
49654 <tgroup cols="4" colsep="0" rowsep="0">
49655 <colspec colwidth="8*" align="left"/>
49656 <colspec colwidth="6*" align="center"/>
49657 <colspec colwidth="6*" align="center"/>
49658 <colspec colwidth="6*" align="right"/>
49659 <tbody>
49660 <row>
49661 <entry><option>hosts_require_auth</option></entry>
49662 <entry>Use: <emphasis>smtp</emphasis></entry>
49663 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49664 <entry>Default: <emphasis>unset</emphasis></entry>
49665 </row>
49666 </tbody>
49667 </tgroup>
49668 </informaltable>
49669 <para>
49670 <indexterm role="concept">
49671 <primary>authentication</primary>
49672 <secondary>required by client</secondary>
49673 </indexterm>
49674 This option provides a list of servers for which authentication must succeed
49675 before Exim will try to transfer a message. If authentication fails for
49676 servers which are not in this list, Exim tries to send unauthenticated. If
49677 authentication fails for one of these servers, delivery is deferred. This
49678 temporary error is detectable in the retry rules, so it can be turned into a
49679 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
49680 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
49681 </para>
49682 <para>
49683 <indexterm role="option">
49684 <primary><option>hosts_request_ocsp</option></primary>
49685 </indexterm>
49686 </para>
49687 <informaltable frame="all">
49688 <tgroup cols="4" colsep="0" rowsep="0">
49689 <colspec colwidth="8*" align="left"/>
49690 <colspec colwidth="6*" align="center"/>
49691 <colspec colwidth="6*" align="center"/>
49692 <colspec colwidth="6*" align="right"/>
49693 <tbody>
49694 <row>
49695 <entry><option>hosts_request_ocsp</option></entry>
49696 <entry>Use: <emphasis>smtp</emphasis></entry>
49697 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49698 <entry>Default: <emphasis>*</emphasis></entry>
49699 </row>
49700 </tbody>
49701 </tgroup>
49702 </informaltable>
49703 <para>
49704 <indexterm role="concept">
49705 <primary>TLS</primary>
49706 <secondary>requiring for certain servers</secondary>
49707 </indexterm>
49708 Exim will request a Certificate Status on a
49709 TLS session for any host that matches this list.
49710 <option>tls_verify_certificates</option> should also be set for the transport.
49711 </para>
49712 <para>
49713 <indexterm role="option">
49714 <primary><option>hosts_require_dane</option></primary>
49715 </indexterm>
49716 </para>
49717 <informaltable frame="all">
49718 <tgroup cols="4" colsep="0" rowsep="0">
49719 <colspec colwidth="8*" align="left"/>
49720 <colspec colwidth="6*" align="center"/>
49721 <colspec colwidth="6*" align="center"/>
49722 <colspec colwidth="6*" align="right"/>
49723 <tbody>
49724 <row>
49725 <entry><option>hosts_require_dane</option></entry>
49726 <entry>Use: <emphasis>smtp</emphasis></entry>
49727 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49728 <entry>Default: <emphasis>unset</emphasis></entry>
49729 </row>
49730 </tbody>
49731 </tgroup>
49732 </informaltable>
49733 <para>
49734 <indexterm role="concept">
49735 <primary>DANE</primary>
49736 <secondary>transport options</secondary>
49737 </indexterm>
49738 <indexterm role="concept">
49739 <primary>DANE</primary>
49740 <secondary>requiring for certain servers</secondary>
49741 </indexterm>
49742 If built with DANE support, Exim  will require that a DNSSEC-validated
49743 TLSA record is present for any host matching the list,
49744 and that a DANE-verified TLS connection is made. See
49745 the <option>dnssec_request_domains</option> router and transport options.
49746 There will be no fallback to in-clear communication.
49747 See section <xref linkend="SECDANE"/>.
49748 </para>
49749 <para>
49750 <indexterm role="option">
49751 <primary><option>hosts_require_ocsp</option></primary>
49752 </indexterm>
49753 </para>
49754 <informaltable frame="all">
49755 <tgroup cols="4" colsep="0" rowsep="0">
49756 <colspec colwidth="8*" align="left"/>
49757 <colspec colwidth="6*" align="center"/>
49758 <colspec colwidth="6*" align="center"/>
49759 <colspec colwidth="6*" align="right"/>
49760 <tbody>
49761 <row>
49762 <entry><option>hosts_require_ocsp</option></entry>
49763 <entry>Use: <emphasis>smtp</emphasis></entry>
49764 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49765 <entry>Default: <emphasis>unset</emphasis></entry>
49766 </row>
49767 </tbody>
49768 </tgroup>
49769 </informaltable>
49770 <para>
49771 <indexterm role="concept">
49772 <primary>TLS</primary>
49773 <secondary>requiring for certain servers</secondary>
49774 </indexterm>
49775 Exim will request, and check for a valid Certificate Status being given, on a
49776 TLS session for any host that matches this list.
49777 <option>tls_verify_certificates</option> should also be set for the transport.
49778 </para>
49779 <para>
49780 <indexterm role="option">
49781 <primary><option>hosts_require_tls</option></primary>
49782 </indexterm>
49783 </para>
49784 <informaltable frame="all">
49785 <tgroup cols="4" colsep="0" rowsep="0">
49786 <colspec colwidth="8*" align="left"/>
49787 <colspec colwidth="6*" align="center"/>
49788 <colspec colwidth="6*" align="center"/>
49789 <colspec colwidth="6*" align="right"/>
49790 <tbody>
49791 <row>
49792 <entry><option>hosts_require_tls</option></entry>
49793 <entry>Use: <emphasis>smtp</emphasis></entry>
49794 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49795 <entry>Default: <emphasis>unset</emphasis></entry>
49796 </row>
49797 </tbody>
49798 </tgroup>
49799 </informaltable>
49800 <para>
49801 <indexterm role="concept">
49802 <primary>TLS</primary>
49803 <secondary>requiring for certain servers</secondary>
49804 </indexterm>
49805 Exim will insist on using a TLS session when delivering to any host that
49806 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
49807 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
49808 incoming messages, use an appropriate ACL.
49809 </para>
49810 <para>
49811 <indexterm role="option">
49812 <primary><option>hosts_try_auth</option></primary>
49813 </indexterm>
49814 </para>
49815 <informaltable frame="all">
49816 <tgroup cols="4" colsep="0" rowsep="0">
49817 <colspec colwidth="8*" align="left"/>
49818 <colspec colwidth="6*" align="center"/>
49819 <colspec colwidth="6*" align="center"/>
49820 <colspec colwidth="6*" align="right"/>
49821 <tbody>
49822 <row>
49823 <entry><option>hosts_try_auth</option></entry>
49824 <entry>Use: <emphasis>smtp</emphasis></entry>
49825 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49826 <entry>Default: <emphasis>unset</emphasis></entry>
49827 </row>
49828 </tbody>
49829 </tgroup>
49830 </informaltable>
49831 <para>
49832 <indexterm role="concept">
49833 <primary>authentication</primary>
49834 <secondary>optional in client</secondary>
49835 </indexterm>
49836 This option provides a list of servers to which, provided they announce
49837 authentication support, Exim will attempt to authenticate as a client when it
49838 connects. If authentication fails, Exim will try to transfer the message
49839 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
49840 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
49841 </para>
49842 <para>
49843 <indexterm role="option">
49844 <primary><option>hosts_try_chunking</option></primary>
49845 </indexterm>
49846 </para>
49847 <informaltable frame="all">
49848 <tgroup cols="4" colsep="0" rowsep="0">
49849 <colspec colwidth="8*" align="left"/>
49850 <colspec colwidth="6*" align="center"/>
49851 <colspec colwidth="6*" align="center"/>
49852 <colspec colwidth="6*" align="right"/>
49853 <tbody>
49854 <row>
49855 <entry><option>hosts_try_chunking</option></entry>
49856 <entry>Use: <emphasis>smtp</emphasis></entry>
49857 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49858 <entry>Default: <emphasis>*</emphasis></entry>
49859 </row>
49860 </tbody>
49861 </tgroup>
49862 </informaltable>
49863 <para>
49864 <indexterm role="concept">
49865 <primary>CHUNKING</primary>
49866 <secondary>enabling, in client</secondary>
49867 </indexterm>
49868 <indexterm role="concept">
49869 <primary>BDAT</primary>
49870 <secondary>SMTP command</secondary>
49871 </indexterm>
49872 <indexterm role="concept">
49873 <primary>RFC 3030</primary>
49874 <secondary>CHUNKING</secondary>
49875 </indexterm>
49876 This option provides a list of servers to which, provided they announce
49877 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
49878 </para>
49879 <para revisionflag="changed">
49880 Unless DKIM signing is being done,
49881 </para>
49882 <para>
49883 BDAT will not be used in conjunction with a transport filter.
49884 </para>
49885 <para>
49886 <indexterm role="option">
49887 <primary><option>hosts_try_dane</option></primary>
49888 </indexterm>
49889 </para>
49890 <informaltable frame="all">
49891 <tgroup cols="4" colsep="0" rowsep="0">
49892 <colspec colwidth="8*" align="left"/>
49893 <colspec colwidth="6*" align="center"/>
49894 <colspec colwidth="6*" align="center"/>
49895 <colspec colwidth="6*" align="right"/>
49896 <tbody>
49897 <row>
49898 <entry><option>hosts_try_dane</option></entry>
49899 <entry>Use: <emphasis>smtp</emphasis></entry>
49900 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49901 <entry>Default: <emphasis>*</emphasis></entry>
49902 </row>
49903 </tbody>
49904 </tgroup>
49905 </informaltable>
49906 <para>
49907 <indexterm role="concept">
49908 <primary>DANE</primary>
49909 <secondary>transport options</secondary>
49910 </indexterm>
49911 <indexterm role="concept">
49912 <primary>DANE</primary>
49913 <secondary>attempting for certain servers</secondary>
49914 </indexterm>
49915 </para>
49916 <para revisionflag="changed">
49917 If built with DANE support, Exim  will look up a
49918 TLSA record for any host matching the list,
49919 If one is found and that lookup was DNSSEC-validated,
49920 then Exim requires that a DANE-verified TLS connection is made for that host;
49921 there will be no fallback to in-clear communication.
49922 </para>
49923 <para>
49924 See the <option>dnssec_request_domains</option> router and transport options.
49925 See section <xref linkend="SECDANE"/>.
49926 </para>
49927 <para>
49928 <indexterm role="option">
49929 <primary><option>hosts_try_fastopen</option></primary>
49930 </indexterm>
49931 </para>
49932 <informaltable frame="all">
49933 <tgroup cols="4" colsep="0" rowsep="0">
49934 <colspec colwidth="8*" align="left"/>
49935 <colspec colwidth="6*" align="center"/>
49936 <colspec colwidth="6*" align="center"/>
49937 <colspec colwidth="6*" align="right"/>
49938 <tbody>
49939 <row>
49940 <entry><option>hosts_try_fastopen</option></entry>
49941 <entry>Use: <emphasis>smtp</emphasis></entry>
49942 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49943 <entry>Default: <emphasis>*</emphasis></entry>
49944 </row>
49945 </tbody>
49946 </tgroup>
49947 </informaltable>
49948 <para>
49949 <indexterm role="concept">
49950 <primary>fast open, TCP</primary>
49951 <secondary>enabling, in client</secondary>
49952 </indexterm>
49953 <indexterm role="concept">
49954 <primary>TCP Fast Open</primary>
49955 <secondary>enabling, in client</secondary>
49956 </indexterm>
49957 <indexterm role="concept">
49958 <primary>RFC 7413</primary>
49959 <secondary>TCP Fast Open</secondary>
49960 </indexterm>
49961 This option provides a list of servers to which, provided
49962 the facility is supported by this system, Exim will attempt to
49963 perform a TCP Fast Open.
49964 No data is sent on the SYN segment but, if the remote server also
49965 supports the facility, it can send its SMTP banner immediately after
49966 the SYN,ACK segment.  This can save up to one round-trip time.
49967 </para>
49968 <para>
49969 The facility is only active for previously-contacted servers,
49970 as the initiator must present a cookie in the SYN segment.
49971 </para>
49972 <para>
49973 On (at least some) current Linux distributions the facility must be enabled
49974 in the kernel by the sysadmin before the support is usable.
49975 There is no option for control of the server side; if the system supports
49976 it it is always enabled.  Note that lengthy operations in the connect ACL,
49977 such as DNSBL lookups, will still delay the emission of the SMTP banner.
49978 </para>
49979 <para>
49980 <indexterm role="option">
49981 <primary><option>hosts_try_prdr</option></primary>
49982 </indexterm>
49983 </para>
49984 <informaltable frame="all">
49985 <tgroup cols="4" colsep="0" rowsep="0">
49986 <colspec colwidth="8*" align="left"/>
49987 <colspec colwidth="6*" align="center"/>
49988 <colspec colwidth="6*" align="center"/>
49989 <colspec colwidth="6*" align="right"/>
49990 <tbody>
49991 <row>
49992 <entry><option>hosts_try_prdr</option></entry>
49993 <entry>Use: <emphasis>smtp</emphasis></entry>
49994 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
49995 <entry>Default: <emphasis>*</emphasis></entry>
49996 </row>
49997 </tbody>
49998 </tgroup>
49999 </informaltable>
50000 <para>
50001 <indexterm role="concept">
50002 <primary>PRDR</primary>
50003 <secondary>enabling, optional in client</secondary>
50004 </indexterm>
50005 <indexterm role="concept">
50006 <primary>ESMTP extensions</primary>
50007 <secondary>PRDR</secondary>
50008 </indexterm>
50009 This option provides a list of servers to which, provided they announce
50010 PRDR support, Exim will attempt to negotiate PRDR
50011 for multi-recipient messages.
50012 The option can usually be left as default.
50013 </para>
50014 <para>
50015 <indexterm role="option">
50016 <primary><option>interface</option></primary>
50017 </indexterm>
50018 </para>
50019 <informaltable frame="all">
50020 <tgroup cols="4" colsep="0" rowsep="0">
50021 <colspec colwidth="8*" align="left"/>
50022 <colspec colwidth="6*" align="center"/>
50023 <colspec colwidth="6*" align="center"/>
50024 <colspec colwidth="6*" align="right"/>
50025 <tbody>
50026 <row>
50027 <entry><option>interface</option></entry>
50028 <entry>Use: <emphasis>smtp</emphasis></entry>
50029 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
50030 <entry>Default: <emphasis>unset</emphasis></entry>
50031 </row>
50032 </tbody>
50033 </tgroup>
50034 </informaltable>
50035 <para>
50036 <indexterm role="concept">
50037 <primary>bind IP address</primary>
50038 </indexterm>
50039 <indexterm role="concept">
50040 <primary>IP address</primary>
50041 <secondary>binding</secondary>
50042 </indexterm>
50043 <indexterm role="variable">
50044 <primary><varname>$host</varname></primary>
50045 </indexterm>
50046 <indexterm role="variable">
50047 <primary><varname>$host_address</varname></primary>
50048 </indexterm>
50049 This option specifies which interface to bind to when making an outgoing SMTP
50050 call. The value is an IP address, not an interface name such as
50051 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
50052 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
50053 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
50054 outgoing interface address. There is no variable that contains an outgoing
50055 interface address because, unless it is set by this option, its value is
50056 unknown.
50057 </para>
50058 <para>
50059 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
50060 <varname>$host_address</varname> refer to the host to which a connection is about to be made
50061 during the expansion of the string. Forced expansion failure, or an empty
50062 string result causes the option to be ignored. Otherwise, after expansion, the
50063 string must be a list of IP addresses, colon-separated by default, but the
50064 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
50065 For example:
50066 </para>
50067 <literallayout class="monospaced">
50068 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
50069 </literallayout>
50070 <para>
50071 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
50072 connection. If none of them are the correct type, the option is ignored. If
50073 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
50074 interface to use if the host has more than one.
50075 </para>
50076 <para>
50077 <indexterm role="option">
50078 <primary><option>keepalive</option></primary>
50079 </indexterm>
50080 </para>
50081 <informaltable frame="all">
50082 <tgroup cols="4" colsep="0" rowsep="0">
50083 <colspec colwidth="8*" align="left"/>
50084 <colspec colwidth="6*" align="center"/>
50085 <colspec colwidth="6*" align="center"/>
50086 <colspec colwidth="6*" align="right"/>
50087 <tbody>
50088 <row>
50089 <entry><option>keepalive</option></entry>
50090 <entry>Use: <emphasis>smtp</emphasis></entry>
50091 <entry>Type: <emphasis>boolean</emphasis></entry>
50092 <entry>Default: <emphasis>true</emphasis></entry>
50093 </row>
50094 </tbody>
50095 </tgroup>
50096 </informaltable>
50097 <para>
50098 <indexterm role="concept">
50099 <primary>keepalive</primary>
50100 <secondary>on outgoing connection</secondary>
50101 </indexterm>
50102 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
50103 connections. When set, it causes the kernel to probe idle connections
50104 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
50105 of the connection should send a acknowledgment if the connection is still okay
50106 or a reset if the connection has been aborted. The reason for doing this is
50107 that it has the beneficial effect of freeing up certain types of connection
50108 that can get stuck when the remote host is disconnected without tidying up the
50109 TCP/IP call properly. The keepalive mechanism takes several hours to detect
50110 unreachable hosts.
50111 </para>
50112 <para>
50113 <indexterm role="option">
50114 <primary><option>lmtp_ignore_quota</option></primary>
50115 </indexterm>
50116 </para>
50117 <informaltable frame="all">
50118 <tgroup cols="4" colsep="0" rowsep="0">
50119 <colspec colwidth="8*" align="left"/>
50120 <colspec colwidth="6*" align="center"/>
50121 <colspec colwidth="6*" align="center"/>
50122 <colspec colwidth="6*" align="right"/>
50123 <tbody>
50124 <row>
50125 <entry><option>lmtp_ignore_quota</option></entry>
50126 <entry>Use: <emphasis>smtp</emphasis></entry>
50127 <entry>Type: <emphasis>boolean</emphasis></entry>
50128 <entry>Default: <emphasis>false</emphasis></entry>
50129 </row>
50130 </tbody>
50131 </tgroup>
50132 </informaltable>
50133 <para>
50134 <indexterm role="concept">
50135 <primary>LMTP</primary>
50136 <secondary>ignoring quota errors</secondary>
50137 </indexterm>
50138 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
50139 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
50140 has advertised support for IGNOREQUOTA in its response to the LHLO command.
50141 </para>
50142 <para>
50143 <indexterm role="option">
50144 <primary><option>max_rcpt</option></primary>
50145 </indexterm>
50146 </para>
50147 <informaltable frame="all">
50148 <tgroup cols="4" colsep="0" rowsep="0">
50149 <colspec colwidth="8*" align="left"/>
50150 <colspec colwidth="6*" align="center"/>
50151 <colspec colwidth="6*" align="center"/>
50152 <colspec colwidth="6*" align="right"/>
50153 <tbody>
50154 <row>
50155 <entry><option>max_rcpt</option></entry>
50156 <entry>Use: <emphasis>smtp</emphasis></entry>
50157 <entry>Type: <emphasis>integer</emphasis></entry>
50158 <entry>Default: <emphasis>100</emphasis></entry>
50159 </row>
50160 </tbody>
50161 </tgroup>
50162 </informaltable>
50163 <para>
50164 <indexterm role="concept">
50165 <primary>RCPT</primary>
50166 <secondary>maximum number of outgoing</secondary>
50167 </indexterm>
50168 This option limits the number of RCPT commands that are sent in a single
50169 SMTP message transaction. Each set of addresses is treated independently, and
50170 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
50171 permits this.
50172 </para>
50173 <para>
50174 <indexterm role="option">
50175 <primary><option>multi_domain</option></primary>
50176 </indexterm>
50177 </para>
50178 <informaltable frame="all">
50179 <tgroup cols="4" colsep="0" rowsep="0">
50180 <colspec colwidth="8*" align="left"/>
50181 <colspec colwidth="6*" align="center"/>
50182 <colspec colwidth="6*" align="center"/>
50183 <colspec colwidth="6*" align="right"/>
50184 <tbody>
50185 <row>
50186 <entry><option>multi_domain</option></entry>
50187 <entry>Use: <emphasis>smtp</emphasis></entry>
50188 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
50189 <entry>Default: <emphasis>true</emphasis></entry>
50190 </row>
50191 </tbody>
50192 </tgroup>
50193 </informaltable>
50194 <para>
50195 <indexterm role="variable">
50196 <primary><varname>$domain</varname></primary>
50197 </indexterm>
50198 When this option is set, the <command>smtp</command> transport can handle a number of
50199 addresses containing a mixture of different domains provided they all resolve
50200 to the same list of hosts. Turning the option off restricts the transport to
50201 handling only one domain at a time. This is useful if you want to use
50202 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
50203 is a single domain involved in a remote delivery.
50204 </para>
50205 <para>
50206 It is expanded per-address and can depend on any of
50207 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
50208 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
50209 </para>
50210 <para>
50211 <indexterm role="option">
50212 <primary><option>port</option></primary>
50213 </indexterm>
50214 </para>
50215 <informaltable frame="all">
50216 <tgroup cols="4" colsep="0" rowsep="0">
50217 <colspec colwidth="8*" align="left"/>
50218 <colspec colwidth="6*" align="center"/>
50219 <colspec colwidth="6*" align="center"/>
50220 <colspec colwidth="6*" align="right"/>
50221 <tbody>
50222 <row>
50223 <entry><option>port</option></entry>
50224 <entry>Use: <emphasis>smtp</emphasis></entry>
50225 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50226 <entry>Default: <emphasis>see below</emphasis></entry>
50227 </row>
50228 </tbody>
50229 </tgroup>
50230 </informaltable>
50231 <para>
50232 <indexterm role="concept">
50233 <primary>port</primary>
50234 <secondary>sending TCP/IP</secondary>
50235 </indexterm>
50236 <indexterm role="concept">
50237 <primary>TCP/IP</primary>
50238 <secondary>setting outgoing port</secondary>
50239 </indexterm>
50240 This option specifies the TCP/IP port on the server to which Exim connects.
50241 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
50242 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
50243 The name was changed to minimize confusion with the outgoing port. There is no
50244 variable that contains an outgoing port.
50245 </para>
50246 <para>
50247 If the value of this option begins with a digit it is taken as a port number;
50248 otherwise it is looked up using <function>getservbyname()</function>. The default value is
50249 normally <quote>smtp</quote>,
50250 but if <option>protocol</option> is set to <quote>lmtp</quote> the default is <quote>lmtp</quote>
50251 and if <option>protocol</option> is set to <quote>smtps</quote> the default is <quote>smtps</quote>.
50252 If the expansion fails, or if a port number cannot be found, delivery
50253 is deferred.
50254 </para>
50255 <para>
50256 Note that at least one Linux distribution has been seen failing
50257 to put <quote>smtps</quote> in its <quote>/etc/services</quote> file, resulting is such deferrals.
50258 </para>
50259 <para>
50260 <indexterm role="option">
50261 <primary><option>protocol</option></primary>
50262 </indexterm>
50263 </para>
50264 <informaltable frame="all">
50265 <tgroup cols="4" colsep="0" rowsep="0">
50266 <colspec colwidth="8*" align="left"/>
50267 <colspec colwidth="6*" align="center"/>
50268 <colspec colwidth="6*" align="center"/>
50269 <colspec colwidth="6*" align="right"/>
50270 <tbody>
50271 <row>
50272 <entry><option>protocol</option></entry>
50273 <entry>Use: <emphasis>smtp</emphasis></entry>
50274 <entry>Type: <emphasis>string</emphasis></entry>
50275 <entry>Default: <emphasis>smtp</emphasis></entry>
50276 </row>
50277 </tbody>
50278 </tgroup>
50279 </informaltable>
50280 <para>
50281 <indexterm role="concept">
50282 <primary>LMTP</primary>
50283 <secondary>over TCP/IP</secondary>
50284 </indexterm>
50285 <indexterm role="concept">
50286 <primary>ssmtp protocol</primary>
50287 <secondary>outbound</secondary>
50288 </indexterm>
50289 <indexterm role="concept">
50290 <primary>TLS</primary>
50291 <secondary>SSL-on-connect outbound</secondary>
50292 </indexterm>
50293 <indexterm role="variable">
50294 <primary><varname>$port</varname></primary>
50295 </indexterm>
50296 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
50297 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
50298 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
50299 deliveries into closed message stores. Exim also has support for running LMTP
50300 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
50301 </para>
50302 <para>
50303 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
50304 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
50305 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
50306 The Internet standards bodies used to strongly discourage use of this mode,
50307 but as of RFC 8314 it is perferred over STARTTLS for message submission
50308 (as distinct from MTA-MTA communication).
50309 </para>
50310 <para>
50311 <indexterm role="option">
50312 <primary><option>retry_include_ip_address</option></primary>
50313 </indexterm>
50314 </para>
50315 <informaltable frame="all">
50316 <tgroup cols="4" colsep="0" rowsep="0">
50317 <colspec colwidth="8*" align="left"/>
50318 <colspec colwidth="6*" align="center"/>
50319 <colspec colwidth="6*" align="center"/>
50320 <colspec colwidth="6*" align="right"/>
50321 <tbody>
50322 <row>
50323 <entry><option>retry_include_ip_address</option></entry>
50324 <entry>Use: <emphasis>smtp</emphasis></entry>
50325 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
50326 <entry>Default: <emphasis>true</emphasis></entry>
50327 </row>
50328 </tbody>
50329 </tgroup>
50330 </informaltable>
50331 <para>
50332 Exim normally includes both the host name and the IP address in the key it
50333 constructs for indexing retry data after a temporary delivery failure. This
50334 means that when one of several IP addresses for a host is failing, it gets
50335 tried periodically (controlled by the retry rules), but use of the other IP
50336 addresses is not affected.
50337 </para>
50338 <para>
50339 However, in some dialup environments hosts are assigned a different IP address
50340 each time they connect. In this situation the use of the IP address as part of
50341 the retry key leads to undesirable behaviour. Setting this option false causes
50342 Exim to use only the host name.
50343 Since it is expanded it can be made to depend on the host or domain.
50344 </para>
50345 <para>
50346 <indexterm role="option">
50347 <primary><option>serialize_hosts</option></primary>
50348 </indexterm>
50349 </para>
50350 <informaltable frame="all">
50351 <tgroup cols="4" colsep="0" rowsep="0">
50352 <colspec colwidth="8*" align="left"/>
50353 <colspec colwidth="6*" align="center"/>
50354 <colspec colwidth="6*" align="center"/>
50355 <colspec colwidth="6*" align="right"/>
50356 <tbody>
50357 <row>
50358 <entry><option>serialize_hosts</option></entry>
50359 <entry>Use: <emphasis>smtp</emphasis></entry>
50360 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50361 <entry>Default: <emphasis>unset</emphasis></entry>
50362 </row>
50363 </tbody>
50364 </tgroup>
50365 </informaltable>
50366 <para>
50367 <indexterm role="concept">
50368 <primary>serializing connections</primary>
50369 </indexterm>
50370 <indexterm role="concept">
50371 <primary>host</primary>
50372 <secondary>serializing connections</secondary>
50373 </indexterm>
50374 Because Exim operates in a distributed manner, if several messages for the same
50375 host arrive at around the same time, more than one simultaneous connection to
50376 the remote host can occur. This is not usually a problem except when there is a
50377 slow link between the hosts. In that situation it may be helpful to restrict
50378 Exim to one connection at a time. This can be done by setting
50379 <option>serialize_hosts</option> to match the relevant hosts.
50380 </para>
50381 <para>
50382 <indexterm role="concept">
50383 <primary>hints database</primary>
50384 <secondary>serializing deliveries to a host</secondary>
50385 </indexterm>
50386 Exim implements serialization by means of a hints database in which a record is
50387 written whenever a process connects to one of the restricted hosts. The record
50388 is deleted when the connection is completed. Obviously there is scope for
50389 records to get left lying around if there is a system or program crash. To
50390 guard against this, Exim ignores any records that are more than six hours old.
50391 </para>
50392 <para>
50393 If you set up this kind of serialization, you should also arrange to delete the
50394 relevant hints database whenever your system reboots. The names of the files
50395 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
50396 may be one or two files, depending on the type of DBM in use. The same files
50397 are used for ETRN serialization.
50398 </para>
50399 <para>
50400 See also the <option>max_parallel</option> generic transport option.
50401 </para>
50402 <para>
50403 <indexterm role="option">
50404 <primary><option>size_addition</option></primary>
50405 </indexterm>
50406 </para>
50407 <informaltable frame="all">
50408 <tgroup cols="4" colsep="0" rowsep="0">
50409 <colspec colwidth="8*" align="left"/>
50410 <colspec colwidth="6*" align="center"/>
50411 <colspec colwidth="6*" align="center"/>
50412 <colspec colwidth="6*" align="right"/>
50413 <tbody>
50414 <row>
50415 <entry><option>size_addition</option></entry>
50416 <entry>Use: <emphasis>smtp</emphasis></entry>
50417 <entry>Type: <emphasis>integer</emphasis></entry>
50418 <entry>Default: <emphasis>1024</emphasis></entry>
50419 </row>
50420 </tbody>
50421 </tgroup>
50422 </informaltable>
50423 <para>
50424 <indexterm role="concept">
50425 <primary>SIZE</primary>
50426 <secondary>ESMTP extension</secondary>
50427 </indexterm>
50428 <indexterm role="concept">
50429 <primary>message</primary>
50430 <secondary>size issue for transport filter</secondary>
50431 </indexterm>
50432 <indexterm role="concept">
50433 <primary>size</primary>
50434 <secondary>of message</secondary>
50435 </indexterm>
50436 <indexterm role="concept">
50437 <primary>transport</primary>
50438 <secondary>filter</secondary>
50439 </indexterm>
50440 <indexterm role="concept">
50441 <primary>filter</primary>
50442 <secondary>transport filter</secondary>
50443 </indexterm>
50444 If a remote SMTP server indicates that it supports the SIZE option of the
50445 MAIL command, Exim uses this to pass over the message size at the start of
50446 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
50447 sends, to allow for headers and other text that may be added during delivery by
50448 configuration options or in a transport filter. It may be necessary to increase
50449 this if a lot of text is added to messages.
50450 </para>
50451 <para>
50452 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
50453 the use of the SIZE option altogether.
50454 </para>
50455 <para>
50456 <indexterm role="option">
50457 <primary><option>socks_proxy</option></primary>
50458 </indexterm>
50459 </para>
50460 <informaltable frame="all">
50461 <tgroup cols="4" colsep="0" rowsep="0">
50462 <colspec colwidth="8*" align="left"/>
50463 <colspec colwidth="6*" align="center"/>
50464 <colspec colwidth="6*" align="center"/>
50465 <colspec colwidth="6*" align="right"/>
50466 <tbody>
50467 <row>
50468 <entry><option>socks_proxy</option></entry>
50469 <entry>Use: <emphasis>smtp</emphasis></entry>
50470 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50471 <entry>Default: <emphasis>unset</emphasis></entry>
50472 </row>
50473 </tbody>
50474 </tgroup>
50475 </informaltable>
50476 <para>
50477 <indexterm role="concept">
50478 <primary>proxy</primary>
50479 <secondary>SOCKS</secondary>
50480 </indexterm>
50481 This option enables use of SOCKS proxies for connections made by the
50482 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
50483 </para>
50484 <para>
50485 <indexterm role="option">
50486 <primary><option>tls_certificate</option></primary>
50487 </indexterm>
50488 </para>
50489 <informaltable frame="all">
50490 <tgroup cols="4" colsep="0" rowsep="0">
50491 <colspec colwidth="8*" align="left"/>
50492 <colspec colwidth="6*" align="center"/>
50493 <colspec colwidth="6*" align="center"/>
50494 <colspec colwidth="6*" align="right"/>
50495 <tbody>
50496 <row>
50497 <entry><option>tls_certificate</option></entry>
50498 <entry>Use: <emphasis>smtp</emphasis></entry>
50499 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50500 <entry>Default: <emphasis>unset</emphasis></entry>
50501 </row>
50502 </tbody>
50503 </tgroup>
50504 </informaltable>
50505 <para>
50506 <indexterm role="concept">
50507 <primary>TLS</primary>
50508 <secondary>client certificate, location of</secondary>
50509 </indexterm>
50510 <indexterm role="concept">
50511 <primary>certificate</primary>
50512 <secondary>client, location of</secondary>
50513 </indexterm>
50514 <indexterm role="variable">
50515 <primary><varname>$host</varname></primary>
50516 </indexterm>
50517 <indexterm role="variable">
50518 <primary><varname>$host_address</varname></primary>
50519 </indexterm>
50520 The value of this option must be the absolute path to a file which contains the
50521 client&#x2019;s certificate, for possible use when sending a message over an encrypted
50522 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
50523 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
50524 details of TLS.
50525 </para>
50526 <para>
50527 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
50528 certificate when sending messages as a client. The global option of the same
50529 name specifies the certificate for Exim as a server; it is not automatically
50530 assumed that the same certificate should be used when Exim is operating as a
50531 client.
50532 </para>
50533 <para>
50534 <indexterm role="option">
50535 <primary><option>tls_crl</option></primary>
50536 </indexterm>
50537 </para>
50538 <informaltable frame="all">
50539 <tgroup cols="4" colsep="0" rowsep="0">
50540 <colspec colwidth="8*" align="left"/>
50541 <colspec colwidth="6*" align="center"/>
50542 <colspec colwidth="6*" align="center"/>
50543 <colspec colwidth="6*" align="right"/>
50544 <tbody>
50545 <row>
50546 <entry><option>tls_crl</option></entry>
50547 <entry>Use: <emphasis>smtp</emphasis></entry>
50548 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50549 <entry>Default: <emphasis>unset</emphasis></entry>
50550 </row>
50551 </tbody>
50552 </tgroup>
50553 </informaltable>
50554 <para>
50555 <indexterm role="concept">
50556 <primary>TLS</primary>
50557 <secondary>client certificate revocation list</secondary>
50558 </indexterm>
50559 <indexterm role="concept">
50560 <primary>certificate</primary>
50561 <secondary>revocation list for client</secondary>
50562 </indexterm>
50563 This option specifies a certificate revocation list. The expanded value must
50564 be the name of a file that contains a CRL in PEM format.
50565 </para>
50566 <para>
50567 <indexterm role="option">
50568 <primary><option>tls_dh_min_bits</option></primary>
50569 </indexterm>
50570 </para>
50571 <informaltable frame="all">
50572 <tgroup cols="4" colsep="0" rowsep="0">
50573 <colspec colwidth="8*" align="left"/>
50574 <colspec colwidth="6*" align="center"/>
50575 <colspec colwidth="6*" align="center"/>
50576 <colspec colwidth="6*" align="right"/>
50577 <tbody>
50578 <row>
50579 <entry><option>tls_dh_min_bits</option></entry>
50580 <entry>Use: <emphasis>smtp</emphasis></entry>
50581 <entry>Type: <emphasis>integer</emphasis></entry>
50582 <entry>Default: <emphasis>1024</emphasis></entry>
50583 </row>
50584 </tbody>
50585 </tgroup>
50586 </informaltable>
50587 <para>
50588 <indexterm role="concept">
50589 <primary>TLS</primary>
50590 <secondary>Diffie-Hellman minimum acceptable size</secondary>
50591 </indexterm>
50592 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
50593 key agreement is negotiated, the server will provide a large prime number
50594 for use.  This option establishes the minimum acceptable size of that number.
50595 If the parameter offered by the server is too small, then the TLS handshake
50596 will fail.
50597 </para>
50598 <para>
50599 Only supported when using GnuTLS.
50600 </para>
50601 <para>
50602 <indexterm role="option">
50603 <primary><option>tls_privatekey</option></primary>
50604 </indexterm>
50605 </para>
50606 <informaltable frame="all">
50607 <tgroup cols="4" colsep="0" rowsep="0">
50608 <colspec colwidth="8*" align="left"/>
50609 <colspec colwidth="6*" align="center"/>
50610 <colspec colwidth="6*" align="center"/>
50611 <colspec colwidth="6*" align="right"/>
50612 <tbody>
50613 <row>
50614 <entry><option>tls_privatekey</option></entry>
50615 <entry>Use: <emphasis>smtp</emphasis></entry>
50616 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50617 <entry>Default: <emphasis>unset</emphasis></entry>
50618 </row>
50619 </tbody>
50620 </tgroup>
50621 </informaltable>
50622 <para>
50623 <indexterm role="concept">
50624 <primary>TLS</primary>
50625 <secondary>client private key, location of</secondary>
50626 </indexterm>
50627 <indexterm role="variable">
50628 <primary><varname>$host</varname></primary>
50629 </indexterm>
50630 <indexterm role="variable">
50631 <primary><varname>$host_address</varname></primary>
50632 </indexterm>
50633 The value of this option must be the absolute path to a file which contains the
50634 client&#x2019;s private key. This is used when sending a message over an encrypted
50635 connection using a client certificate. The values of <varname>$host</varname> and
50636 <varname>$host_address</varname> are set to the name and address of the server during the
50637 expansion. If this option is unset, or the expansion is forced to fail, or the
50638 result is an empty string, the private key is assumed to be in the same file as
50639 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
50640 </para>
50641 <para>
50642 <indexterm role="option">
50643 <primary><option>tls_require_ciphers</option></primary>
50644 </indexterm>
50645 </para>
50646 <informaltable frame="all">
50647 <tgroup cols="4" colsep="0" rowsep="0">
50648 <colspec colwidth="8*" align="left"/>
50649 <colspec colwidth="6*" align="center"/>
50650 <colspec colwidth="6*" align="center"/>
50651 <colspec colwidth="6*" align="right"/>
50652 <tbody>
50653 <row>
50654 <entry><option>tls_require_ciphers</option></entry>
50655 <entry>Use: <emphasis>smtp</emphasis></entry>
50656 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50657 <entry>Default: <emphasis>unset</emphasis></entry>
50658 </row>
50659 </tbody>
50660 </tgroup>
50661 </informaltable>
50662 <para>
50663 <indexterm role="concept">
50664 <primary>TLS</primary>
50665 <secondary>requiring specific ciphers</secondary>
50666 </indexterm>
50667 <indexterm role="concept">
50668 <primary>cipher</primary>
50669 <secondary>requiring specific</secondary>
50670 </indexterm>
50671 <indexterm role="variable">
50672 <primary><varname>$host</varname></primary>
50673 </indexterm>
50674 <indexterm role="variable">
50675 <primary><varname>$host_address</varname></primary>
50676 </indexterm>
50677 The value of this option must be a list of permitted cipher suites, for use
50678 when setting up an outgoing encrypted connection. (There is a global option of
50679 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
50680 <varname>$host_address</varname> are set to the name and address of the server during the
50681 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
50682 is used in different ways by OpenSSL and GnuTLS (see sections
50683 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
50684 ciphers is a preference order.
50685 </para>
50686 <para>
50687 <indexterm role="option">
50688 <primary><option>tls_sni</option></primary>
50689 </indexterm>
50690 </para>
50691 <informaltable frame="all">
50692 <tgroup cols="4" colsep="0" rowsep="0">
50693 <colspec colwidth="8*" align="left"/>
50694 <colspec colwidth="6*" align="center"/>
50695 <colspec colwidth="6*" align="center"/>
50696 <colspec colwidth="6*" align="right"/>
50697 <tbody>
50698 <row>
50699 <entry><option>tls_sni</option></entry>
50700 <entry>Use: <emphasis>smtp</emphasis></entry>
50701 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50702 <entry>Default: <emphasis>unset</emphasis></entry>
50703 </row>
50704 </tbody>
50705 </tgroup>
50706 </informaltable>
50707 <para>
50708 <indexterm role="concept">
50709 <primary>TLS</primary>
50710 <secondary>Server Name Indication</secondary>
50711 </indexterm>
50712 <indexterm role="variable">
50713 <primary><varname>$tls_sni</varname></primary>
50714 </indexterm>
50715 If this option is set
50716 </para>
50717 <para revisionflag="changed">
50718 and the connection is not DANE-validated
50719 </para>
50720 <para>
50721 then it sets the $tls_out_sni variable and causes any
50722 TLS session to pass this value as the Server Name Indication extension to
50723 the remote side, which can be used by the remote side to select an appropriate
50724 certificate and private key for the session.
50725 </para>
50726 <para>
50727 See <xref linkend="SECTtlssni"/> for more information.
50728 </para>
50729 <para>
50730 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
50731 TLS extensions.
50732 </para>
50733 <para>
50734 <indexterm role="option">
50735 <primary><option>tls_tempfail_tryclear</option></primary>
50736 </indexterm>
50737 </para>
50738 <informaltable frame="all">
50739 <tgroup cols="4" colsep="0" rowsep="0">
50740 <colspec colwidth="8*" align="left"/>
50741 <colspec colwidth="6*" align="center"/>
50742 <colspec colwidth="6*" align="center"/>
50743 <colspec colwidth="6*" align="right"/>
50744 <tbody>
50745 <row>
50746 <entry><option>tls_tempfail_tryclear</option></entry>
50747 <entry>Use: <emphasis>smtp</emphasis></entry>
50748 <entry>Type: <emphasis>boolean</emphasis></entry>
50749 <entry>Default: <emphasis>true</emphasis></entry>
50750 </row>
50751 </tbody>
50752 </tgroup>
50753 </informaltable>
50754 <para>
50755 <indexterm role="concept">
50756 <primary>4<emphasis>xx</emphasis> responses</primary>
50757 <secondary>to STARTTLS</secondary>
50758 </indexterm>
50759 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
50760 setting up a TLS session, this option determines whether or not Exim should try
50761 to deliver the message unencrypted. If it is set false, delivery to the
50762 current host is deferred; if there are other hosts, they are tried. If this
50763 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
50764 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
50765 TLS negotiation fails, Exim closes the current connection (because it is in an
50766 unknown state), opens a new one to the same host, and then tries the delivery
50767 in clear.
50768 </para>
50769 <para>
50770 <indexterm role="option">
50771 <primary><option>tls_try_verify_hosts</option></primary>
50772 </indexterm>
50773 </para>
50774 <informaltable frame="all">
50775 <tgroup cols="4" colsep="0" rowsep="0">
50776 <colspec colwidth="8*" align="left"/>
50777 <colspec colwidth="6*" align="center"/>
50778 <colspec colwidth="6*" align="center"/>
50779 <colspec colwidth="6*" align="right"/>
50780 <tbody>
50781 <row>
50782 <entry><option>tls_try_verify_hosts</option></entry>
50783 <entry>Use: <emphasis>smtp</emphasis></entry>
50784 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50785 <entry>Default: <emphasis>*</emphasis></entry>
50786 </row>
50787 </tbody>
50788 </tgroup>
50789 </informaltable>
50790 <para>
50791 <indexterm role="concept">
50792 <primary>TLS</primary>
50793 <secondary>server certificate verification</secondary>
50794 </indexterm>
50795 <indexterm role="concept">
50796 <primary>certificate</primary>
50797 <secondary>verification of server</secondary>
50798 </indexterm>
50799 This option gives a list of hosts for which, on encrypted connections,
50800 certificate verification will be tried but need not succeed.
50801 The <option>tls_verify_certificates</option> option must also be set.
50802 Note that unless the host is in this list
50803 TLS connections will be denied to hosts using self-signed certificates
50804 when <option>tls_verify_certificates</option> is matched.
50805 The <varname>$tls_out_certificate_verified</varname> variable is set when
50806 certificate verification succeeds.
50807 </para>
50808 <para>
50809 <indexterm role="option">
50810 <primary><option>tls_verify_cert_hostnames</option></primary>
50811 </indexterm>
50812 </para>
50813 <informaltable frame="all">
50814 <tgroup cols="4" colsep="0" rowsep="0">
50815 <colspec colwidth="8*" align="left"/>
50816 <colspec colwidth="6*" align="center"/>
50817 <colspec colwidth="6*" align="center"/>
50818 <colspec colwidth="6*" align="right"/>
50819 <tbody>
50820 <row>
50821 <entry><option>tls_verify_cert_hostnames</option></entry>
50822 <entry>Use: <emphasis>smtp</emphasis></entry>
50823 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50824 <entry>Default: <emphasis>*</emphasis></entry>
50825 </row>
50826 </tbody>
50827 </tgroup>
50828 </informaltable>
50829 <para>
50830 <indexterm role="concept">
50831 <primary>TLS</primary>
50832 <secondary>server certificate hostname verification</secondary>
50833 </indexterm>
50834 <indexterm role="concept">
50835 <primary>certificate</primary>
50836 <secondary>verification of server</secondary>
50837 </indexterm>
50838 This option give a list of hosts for which,
50839 while verifying the server certificate,
50840 checks will be included on the host name
50841 (note that this will generally be the result of a DNS MX lookup)
50842 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
50843 limited to being the initial component of a 3-or-more component FQDN.
50844 </para>
50845 <para>
50846 There is no equivalent checking on client certificates.
50847 </para>
50848 <para>
50849 <indexterm role="option">
50850 <primary><option>tls_verify_certificates</option></primary>
50851 </indexterm>
50852 </para>
50853 <informaltable frame="all">
50854 <tgroup cols="4" colsep="0" rowsep="0">
50855 <colspec colwidth="8*" align="left"/>
50856 <colspec colwidth="6*" align="center"/>
50857 <colspec colwidth="6*" align="center"/>
50858 <colspec colwidth="6*" align="right"/>
50859 <tbody>
50860 <row>
50861 <entry><option>tls_verify_certificates</option></entry>
50862 <entry>Use: <emphasis>smtp</emphasis></entry>
50863 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50864 <entry>Default: <emphasis>system</emphasis></entry>
50865 </row>
50866 </tbody>
50867 </tgroup>
50868 </informaltable>
50869 <para>
50870 <indexterm role="concept">
50871 <primary>TLS</primary>
50872 <secondary>server certificate verification</secondary>
50873 </indexterm>
50874 <indexterm role="concept">
50875 <primary>certificate</primary>
50876 <secondary>verification of server</secondary>
50877 </indexterm>
50878 <indexterm role="variable">
50879 <primary><varname>$host</varname></primary>
50880 </indexterm>
50881 <indexterm role="variable">
50882 <primary><varname>$host_address</varname></primary>
50883 </indexterm>
50884 The value of this option must be either the
50885 word "system"
50886 or the absolute path to
50887 a file or directory containing permitted certificates for servers,
50888 for use when setting up an encrypted connection.
50889 </para>
50890 <para>
50891 The "system" value for the option will use a location compiled into the SSL library.
50892 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
50893 is taken as empty and an explicit location
50894 must be specified.
50895 </para>
50896 <para>
50897 The use of a directory for the option value is not available for GnuTLS versions
50898 preceding 3.3.6 and a single file must be used.
50899 </para>
50900 <para>
50901 With OpenSSL the certificates specified
50902 explicitly
50903 either by file or directory
50904 are added to those given by the system default location.
50905 </para>
50906 <para>
50907 The values of <varname>$host</varname> and
50908 <varname>$host_address</varname> are set to the name and address of the server during the
50909 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
50910 </para>
50911 <para>
50912 For back-compatibility,
50913 if neither tls_verify_hosts nor tls_try_verify_hosts are set
50914 (a single-colon empty list counts as being set)
50915 and certificate verification fails the TLS connection is closed.
50916 </para>
50917 <para>
50918 <indexterm role="option">
50919 <primary><option>tls_verify_hosts</option></primary>
50920 </indexterm>
50921 </para>
50922 <informaltable frame="all">
50923 <tgroup cols="4" colsep="0" rowsep="0">
50924 <colspec colwidth="8*" align="left"/>
50925 <colspec colwidth="6*" align="center"/>
50926 <colspec colwidth="6*" align="center"/>
50927 <colspec colwidth="6*" align="right"/>
50928 <tbody>
50929 <row>
50930 <entry><option>tls_verify_hosts</option></entry>
50931 <entry>Use: <emphasis>smtp</emphasis></entry>
50932 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50933 <entry>Default: <emphasis>unset</emphasis></entry>
50934 </row>
50935 </tbody>
50936 </tgroup>
50937 </informaltable>
50938 <para>
50939 <indexterm role="concept">
50940 <primary>TLS</primary>
50941 <secondary>server certificate verification</secondary>
50942 </indexterm>
50943 <indexterm role="concept">
50944 <primary>certificate</primary>
50945 <secondary>verification of server</secondary>
50946 </indexterm>
50947 This option gives a list of hosts for which, on encrypted connections,
50948 certificate verification must succeed.
50949 The <option>tls_verify_certificates</option> option must also be set.
50950 If both this option and <option>tls_try_verify_hosts</option> are unset
50951 operation is as if this option selected all hosts.
50952 </para>
50953 <para>
50954 <indexterm role="option">
50955 <primary><option>utf8_downconvert</option></primary>
50956 </indexterm>
50957 </para>
50958 <informaltable frame="all">
50959 <tgroup cols="4" colsep="0" rowsep="0">
50960 <colspec colwidth="8*" align="left"/>
50961 <colspec colwidth="6*" align="center"/>
50962 <colspec colwidth="6*" align="center"/>
50963 <colspec colwidth="6*" align="right"/>
50964 <tbody>
50965 <row>
50966 <entry><option>utf8_downconvert</option></entry>
50967 <entry>Use: <emphasis>smtp</emphasis></entry>
50968 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
50969 <entry>Default: <emphasis>-1</emphasis></entry>
50970 </row>
50971 </tbody>
50972 </tgroup>
50973 </informaltable>
50974 <para>
50975 <indexterm role="concept">
50976 <primary>utf8</primary>
50977 <secondary>address downconversion</secondary>
50978 </indexterm>
50979 <indexterm role="concept">
50980 <primary>i18n</primary>
50981 <secondary>utf8 address downconversion</secondary>
50982 </indexterm>
50983 If built with internationalization support,
50984 this option controls conversion of UTF-8 in message envelope addresses
50985 to a-label form.
50986 If, after expansion, the value is 1, 0, or -1 then this value overrides
50987 any value previously set for the message.  Otherwise, any previously
50988 set value is used.  To permit use of a previous value,
50989 set this option to an empty string.
50990 For details on the values see section <xref linkend="SECTi18nMTA"/>.
50991 </para>
50992 </section>
50993 <section id="SECTvalhosmax">
50994 <title>How the limits for the number of hosts to try are used</title>
50995 <para>
50996 <indexterm role="concept">
50997 <primary>host</primary>
50998 <secondary>maximum number to try</secondary>
50999 </indexterm>
51000 <indexterm role="concept">
51001 <primary>limit</primary>
51002 <secondary>hosts; maximum number tried</secondary>
51003 </indexterm>
51004 There are two options that are concerned with the number of hosts that are
51005 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
51006 <option>hosts_max_try_hardlimit</option>.
51007 </para>
51008 <para>
51009 The <option>hosts_max_try</option> option limits the number of hosts that are tried
51010 for a single delivery. However, despite the term <quote>host</quote> in its name, the
51011 option actually applies to each IP address independently. In other words, a
51012 multihomed host is treated as several independent hosts, just as it is for
51013 retrying.
51014 </para>
51015 <para>
51016 Many of the larger ISPs have multiple MX records which often point to
51017 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
51018 created as a result of routing one of these domains.
51019 </para>
51020 <para>
51021 Trying every single IP address on such a long list does not seem sensible; if
51022 several at the top of the list fail, it is reasonable to assume there is some
51023 problem that is likely to affect all of them. Roughly speaking, the value of
51024 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
51025 delivery. However, the logic cannot be quite that simple.
51026 </para>
51027 <para>
51028 Firstly, IP addresses that are skipped because their retry times have not
51029 arrived do not count, and in addition, addresses that are past their retry
51030 limits are also not counted, even when they are tried. This means that when
51031 some IP addresses are past their retry limits, more than the value of
51032 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
51033 that all IP addresses are considered before timing out an email address (but
51034 see below for an exception).
51035 </para>
51036 <para>
51037 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
51038 list to see if there is a subsequent host with a different (higher valued) MX.
51039 If there is, that host is considered next, and the current IP address is used
51040 but not counted. This behaviour helps in the case of a domain with a retry rule
51041 that hardly ever delays any hosts, as is now explained:
51042 </para>
51043 <para>
51044 Consider the case of a long list of hosts with one MX value, and a few with a
51045 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
51046 hosts at the top of the list are tried at first. With the default retry rule,
51047 which specifies increasing retry times, the higher MX hosts are eventually
51048 tried when those at the top of the list are skipped because they have not
51049 reached their retry times.
51050 </para>
51051 <para>
51052 However, it is common practice to put a fixed short retry time on domains for
51053 large ISPs, on the grounds that their servers are rarely down for very long.
51054 Unfortunately, these are exactly the domains that tend to resolve to long lists
51055 of hosts. The short retry time means that the lowest MX hosts are tried every
51056 time. The attempts may be in a different order because of random sorting, but
51057 without the special MX check, the higher MX hosts would never be tried until
51058 all the lower MX hosts had timed out (which might be several days), because
51059 there are always some lower MX hosts that have reached their retry times. With
51060 the special check, Exim considers at least one IP address from each MX value at
51061 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
51062 reached.
51063 </para>
51064 <para>
51065 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
51066 particular, Exim normally eventually tries all the IP addresses before timing
51067 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
51068 reasonable thing to do. Recently, however, some lunatic DNS configurations have
51069 been set up with hundreds of IP addresses for some domains. It can
51070 take a very long time indeed for an address to time out in these cases.
51071 </para>
51072 <para>
51073 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
51074 Exim never tries more than this number of IP addresses; if it hits this limit
51075 and they are all timed out, the email address is bounced, even though not all
51076 possible IP addresses have been tried.
51077 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
51078 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
51079 </para>
51080 </section>
51081 </chapter>
51082
51083 <chapter id="CHAPrewrite">
51084 <title>Address rewriting</title>
51085 <para>
51086 <indexterm role="concept" id="IIDaddrew" class="startofrange">
51087 <primary>rewriting</primary>
51088 <secondary>addresses</secondary>
51089 </indexterm>
51090 There are some circumstances in which Exim automatically rewrites domains in
51091 addresses. The two most common are when an address is given without a domain
51092 (referred to as an <quote>unqualified address</quote>) or when an address contains an
51093 abbreviated domain that is expanded by DNS lookup.
51094 </para>
51095 <para>
51096 Unqualified envelope addresses are accepted only for locally submitted
51097 messages, or for messages that are received from hosts matching
51098 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
51099 appropriate. Unqualified addresses in header lines are qualified if they are in
51100 locally submitted messages, or messages from hosts that are permitted to send
51101 unqualified envelope addresses. Otherwise, unqualified addresses in header
51102 lines are neither qualified nor rewritten.
51103 </para>
51104 <para>
51105 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
51106 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
51107 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
51108 do this. The new RFCs do not contain this suggestion.
51109 </para>
51110 <section id="SECID147">
51111 <title>Explicitly configured address rewriting</title>
51112 <para>
51113 This chapter describes the rewriting rules that can be used in the
51114 main rewrite section of the configuration file, and also in the generic
51115 <option>headers_rewrite</option> option that can be set on any transport.
51116 </para>
51117 <para>
51118 Some people believe that configured address rewriting is a Mortal Sin.
51119 Others believe that life is not possible without it. Exim provides the
51120 facility; you do not have to use it.
51121 </para>
51122 <para>
51123 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
51124 configuration file are applied to addresses in incoming messages, both envelope
51125 addresses and addresses in header lines. Each rule specifies the types of
51126 address to which it applies.
51127 </para>
51128 <para>
51129 Whether or not addresses in header lines are rewritten depends on the origin of
51130 the headers and the type of rewriting. Global rewriting, that is, rewriting
51131 rules from the rewrite section of the configuration file, is applied only to
51132 those headers that were received with the message. Header lines that are added
51133 by ACLs or by a system filter or by individual routers or transports (which
51134 are specific to individual recipient addresses) are not rewritten by the global
51135 rules.
51136 </para>
51137 <para>
51138 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
51139 applies all headers except those added by routers and transports. That is, as
51140 well as the headers that were received with the message, it also applies to
51141 headers that were added by an ACL or a system filter.
51142 </para>
51143 <para>
51144 In general, rewriting addresses from your own system or domain has some
51145 legitimacy. Rewriting other addresses should be done only with great care and
51146 in special circumstances. The author of Exim believes that rewriting should be
51147 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
51148 Although it can sometimes be used as a routing tool, this is very strongly
51149 discouraged.
51150 </para>
51151 <para>
51152 There are two commonly encountered circumstances where rewriting is used, as
51153 illustrated by these examples:
51154 </para>
51155 <itemizedlist>
51156 <listitem>
51157 <para>
51158 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
51159 exchange mail with each other behind a firewall, but there is only a single
51160 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
51161 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
51162 </para>
51163 </listitem>
51164 <listitem>
51165 <para>
51166 A host rewrites the local parts of its own users so that, for example,
51167 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
51168 </para>
51169 </listitem>
51170 </itemizedlist>
51171 </section>
51172 <section id="SECID148">
51173 <title>When does rewriting happen?</title>
51174 <para>
51175 <indexterm role="concept">
51176 <primary>rewriting</primary>
51177 <secondary>timing of</secondary>
51178 </indexterm>
51179 <indexterm role="concept">
51180 <primary>access control lists (ACLs)</primary>
51181 <secondary>rewriting addresses in</secondary>
51182 </indexterm>
51183 Configured address rewriting can take place at several different stages of a
51184 message&#x2019;s processing.
51185 </para>
51186 <para>
51187 <indexterm role="variable">
51188 <primary><varname>$sender_address</varname></primary>
51189 </indexterm>
51190 At the start of an ACL for MAIL, the sender address may have been rewritten
51191 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
51192 ordinary rewrite rules have yet been applied. If, however, the sender address
51193 is verified in the ACL, it is rewritten before verification, and remains
51194 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
51195 rewritten address. This also applies if sender verification happens in a
51196 RCPT ACL. Otherwise, when the sender address is not verified, it is
51197 rewritten as soon as a message&#x2019;s header lines have been received.
51198 </para>
51199 <para>
51200 <indexterm role="variable">
51201 <primary><varname>$domain</varname></primary>
51202 </indexterm>
51203 <indexterm role="variable">
51204 <primary><varname>$local_part</varname></primary>
51205 </indexterm>
51206 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
51207 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
51208 rewrite rules have yet been applied to it. However, the behaviour is different
51209 from the sender address when a recipient is verified. The address is rewritten
51210 for the verification, but the rewriting is not remembered at this stage. The
51211 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
51212 as they were before (that is, they contain the unrewritten &ndash; except for
51213 SMTP-time rewriting &ndash; address).
51214 </para>
51215 <para>
51216 As soon as a message&#x2019;s header lines have been received, all the envelope
51217 recipient addresses are permanently rewritten, and rewriting is also applied to
51218 the addresses in the header lines (if configured). This happens before adding
51219 any header lines that were specified in MAIL or RCPT ACLs, and
51220 <indexterm role="concept">
51221 <primary><function>local_scan()</function> function</primary>
51222 <secondary>address rewriting; timing of</secondary>
51223 </indexterm>
51224 before the DATA ACL and <function>local_scan()</function> functions are run.
51225 </para>
51226 <para>
51227 When an address is being routed, either for delivery or for verification,
51228 rewriting is applied immediately to child addresses that are generated by
51229 redirection, unless <option>no_rewrite</option> is set on the router.
51230 </para>
51231 <para>
51232 <indexterm role="concept">
51233 <primary>envelope from</primary>
51234 </indexterm>
51235 <indexterm role="concept">
51236 <primary>envelope sender</primary>
51237 <secondary>rewriting at transport time</secondary>
51238 </indexterm>
51239 <indexterm role="concept">
51240 <primary>rewriting</primary>
51241 <secondary>at transport time</secondary>
51242 </indexterm>
51243 <indexterm role="concept">
51244 <primary>header lines</primary>
51245 <secondary>rewriting at transport time</secondary>
51246 </indexterm>
51247 At transport time, additional rewriting of addresses in header lines can be
51248 specified by setting the generic <option>headers_rewrite</option> option on a transport.
51249 This option contains rules that are identical in form to those in the rewrite
51250 section of the configuration file. They are applied to the original message
51251 header lines and any that were added by ACLs or a system filter. They are not
51252 applied to header lines that are added by routers or the transport.
51253 </para>
51254 <para>
51255 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
51256 transport option. However, it is not possible to rewrite envelope recipients at
51257 transport time.
51258 </para>
51259 </section>
51260 <section id="SECID149">
51261 <title>Testing the rewriting rules that apply on input</title>
51262 <para>
51263 <indexterm role="concept">
51264 <primary>rewriting</primary>
51265 <secondary>testing</secondary>
51266 </indexterm>
51267 <indexterm role="concept">
51268 <primary>testing</primary>
51269 <secondary>rewriting</secondary>
51270 </indexterm>
51271 Exim&#x2019;s input rewriting configuration appears in a part of the runtime
51272 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
51273 <option>-brw</option> command line option. This takes an address (which can be a full RFC
51274 2822 address) as its argument. The output is a list of how the address would be
51275 transformed by the rewriting rules for each of the different places it might
51276 appear in an incoming message, that is, for each different header and for the
51277 envelope sender and recipient fields. For example,
51278 </para>
51279 <literallayout class="monospaced">
51280 exim -brw ph10@exim.workshop.example
51281 </literallayout>
51282 <para>
51283 might produce the output
51284 </para>
51285 <literallayout class="monospaced">
51286 sender: Philip.Hazel@exim.workshop.example
51287 from: Philip.Hazel@exim.workshop.example
51288 to: ph10@exim.workshop.example
51289 cc: ph10@exim.workshop.example
51290 bcc: ph10@exim.workshop.example
51291 reply-to: Philip.Hazel@exim.workshop.example
51292 env-from: Philip.Hazel@exim.workshop.example
51293 env-to: ph10@exim.workshop.example
51294 </literallayout>
51295 <para>
51296 which shows that rewriting has been set up for that address when used in any of
51297 the source fields, but not when it appears as a recipient address. At the
51298 present time, there is no equivalent way of testing rewriting rules that are
51299 set for a particular transport.
51300 </para>
51301 </section>
51302 <section id="SECID150">
51303 <title>Rewriting rules</title>
51304 <para>
51305 <indexterm role="concept">
51306 <primary>rewriting</primary>
51307 <secondary>rules</secondary>
51308 </indexterm>
51309 The rewrite section of the configuration file consists of lines of rewriting
51310 rules in the form
51311 </para>
51312 <literallayout>
51313 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
51314 </literallayout>
51315 <para>
51316 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
51317 transport option are given as a colon-separated list. Each item in the list
51318 takes the same form as a line in the main rewriting configuration (except that
51319 any colons must be doubled, of course).
51320 </para>
51321 <para>
51322 The formats of source patterns and replacement strings are described below.
51323 Each is terminated by white space, unless enclosed in double quotes, in which
51324 case normal quoting conventions apply inside the quotes. The flags are single
51325 characters which may appear in any order. Spaces and tabs between them are
51326 ignored.
51327 </para>
51328 <para>
51329 For each address that could potentially be rewritten, the rules are scanned in
51330 order, and replacements for the address from earlier rules can themselves be
51331 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
51332 </para>
51333 <para>
51334 The order in which addresses are rewritten is undefined, may change between
51335 releases, and must not be relied on, with one exception: when a message is
51336 received, the envelope sender is always rewritten first, before any header
51337 lines are rewritten. For example, the replacement string for a rewrite of an
51338 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
51339 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
51340 that the envelope sender has already been rewritten.
51341 </para>
51342 <para>
51343 <indexterm role="variable">
51344 <primary><varname>$domain</varname></primary>
51345 </indexterm>
51346 <indexterm role="variable">
51347 <primary><varname>$local_part</varname></primary>
51348 </indexterm>
51349 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
51350 string to refer to the address that is being rewritten. Note that lookup-driven
51351 rewriting can be done by a rule of the form
51352 </para>
51353 <literallayout class="monospaced">
51354 *@*   ${lookup ...
51355 </literallayout>
51356 <para>
51357 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
51358 refer to the address that is being rewritten.
51359 </para>
51360 </section>
51361 <section id="SECID151">
51362 <title>Rewriting patterns</title>
51363 <para>
51364 <indexterm role="concept">
51365 <primary>rewriting</primary>
51366 <secondary>patterns</secondary>
51367 </indexterm>
51368 <indexterm role="concept">
51369 <primary>address list</primary>
51370 <secondary>in a rewriting pattern</secondary>
51371 </indexterm>
51372 The source pattern in a rewriting rule is any item which may appear in an
51373 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
51374 single-item address list, which means that it is expanded before being tested
51375 against the address. As always, if you use a regular expression as a pattern,
51376 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
51377 facility to suppress string expansion within the regular expression.
51378 </para>
51379 <para>
51380 Domains in patterns should be given in lower case. Local parts in patterns are
51381 case-sensitive. If you want to do case-insensitive matching of local parts, you
51382 can use a regular expression that starts with <literal>^(?i)</literal>.
51383 </para>
51384 <para>
51385 <indexterm role="concept">
51386 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
51387 <secondary>in rewriting rules</secondary>
51388 </indexterm>
51389 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
51390 depending on the type of match which occurred. These can be used in the
51391 replacement string to insert portions of the incoming address. <varname>$0</varname> always
51392 refers to the complete incoming address. When a regular expression is used, the
51393 numerical variables are set from its capturing subexpressions. For other types
51394 of pattern they are set as follows:
51395 </para>
51396 <itemizedlist>
51397 <listitem>
51398 <para>
51399 If a local part or domain starts with an asterisk, the numerical variables
51400 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
51401 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
51402 pattern
51403 </para>
51404 <literallayout class="monospaced">
51405 *queen@*.fict.example
51406 </literallayout>
51407 <para>
51408 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
51409 </para>
51410 <literallayout class="monospaced">
51411 $0 = hearts-queen@wonderland.fict.example
51412 $1 = hearts-
51413 $2 = wonderland
51414 </literallayout>
51415 <para>
51416 Note that if the local part does not start with an asterisk, but the domain
51417 does, it is <varname>$1</varname> that contains the wild part of the domain.
51418 </para>
51419 </listitem>
51420 <listitem>
51421 <para>
51422 If the domain part of the pattern is a partial lookup, the wild and fixed parts
51423 of the domain are placed in the next available numerical variables. Suppose,
51424 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
51425 rewriting rule of the form
51426 </para>
51427 <literallayout>
51428 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
51429 </literallayout>
51430 <para>
51431 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
51432 </para>
51433 <literallayout class="monospaced">
51434 $1 = foo
51435 $2 = bar
51436 $3 = baz.example
51437 </literallayout>
51438 <para>
51439 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
51440 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
51441 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
51442 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
51443 whole domain. For non-partial domain lookups, no numerical variables are set.
51444 </para>
51445 </listitem>
51446 </itemizedlist>
51447 </section>
51448 <section id="SECID152">
51449 <title>Rewriting replacements</title>
51450 <para>
51451 <indexterm role="concept">
51452 <primary>rewriting</primary>
51453 <secondary>replacements</secondary>
51454 </indexterm>
51455 If the replacement string for a rule is a single asterisk, addresses that
51456 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
51457 rewriting rules are scanned. For example,
51458 </para>
51459 <literallayout class="monospaced">
51460 hatta@lookingglass.fict.example  *  f
51461 </literallayout>
51462 <para>
51463 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
51464 <emphasis>From:</emphasis> headers.
51465 </para>
51466 <para>
51467 <indexterm role="variable">
51468 <primary><varname>$domain</varname></primary>
51469 </indexterm>
51470 <indexterm role="variable">
51471 <primary><varname>$local_part</varname></primary>
51472 </indexterm>
51473 If the replacement string is not a single asterisk, it is expanded, and must
51474 yield a fully qualified address. Within the expansion, the variables
51475 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
51476 Any letters they contain retain their original case &ndash; they are not lower
51477 cased. The numerical variables are set up according to the type of pattern that
51478 matched the address, as described above. If the expansion is forced to fail by
51479 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
51480 current rule is abandoned, but subsequent rules may take effect. Any other
51481 expansion failure causes the entire rewriting operation to be abandoned, and an
51482 entry written to the panic log.
51483 </para>
51484 </section>
51485 <section id="SECID153">
51486 <title>Rewriting flags</title>
51487 <para>
51488 There are three different kinds of flag that may appear on rewriting rules:
51489 </para>
51490 <itemizedlist>
51491 <listitem>
51492 <para>
51493 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
51494 c, f, h, r, s, t.
51495 </para>
51496 </listitem>
51497 <listitem>
51498 <para>
51499 A flag that specifies rewriting at SMTP time: S.
51500 </para>
51501 </listitem>
51502 <listitem>
51503 <para>
51504 Flags that control the rewriting process: Q, q, R, w.
51505 </para>
51506 </listitem>
51507 </itemizedlist>
51508 <para>
51509 For rules that are part of the <option>headers_rewrite</option> generic transport option,
51510 E, F, T, and S are not permitted.
51511 </para>
51512 </section>
51513 <section id="SECID154">
51514 <title>Flags specifying which headers and envelope addresses to rewrite</title>
51515 <para>
51516 <indexterm role="concept">
51517 <primary>rewriting</primary>
51518 <secondary>flags</secondary>
51519 </indexterm>
51520 If none of the following flag letters, nor the <quote>S</quote> flag (see section
51521 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
51522 and to both the sender and recipient fields of the envelope, whereas a
51523 transport-time rewriting rule just applies to all headers. Otherwise, the
51524 rewriting rule is skipped unless the relevant addresses are being processed.
51525 </para>
51526 <literallayout>
51527 <literal>E</literal>       rewrite all envelope fields
51528 <literal>F</literal>       rewrite the envelope From field
51529 <literal>T</literal>       rewrite the envelope To field
51530 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
51531 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
51532 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
51533 <literal>h</literal>       rewrite all headers
51534 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
51535 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
51536 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
51537 </literallayout>
51538 <para>
51539 "All headers" means all of the headers listed above that can be selected
51540 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
51541 other headers such as <emphasis>Subject:</emphasis> etc.
51542 </para>
51543 <para>
51544 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
51545 restrict this to special known cases in your own domains.
51546 </para>
51547 </section>
51548 <section id="SECTrewriteS">
51549 <title>The SMTP-time rewriting flag</title>
51550 <para>
51551 <indexterm role="concept">
51552 <primary>SMTP</primary>
51553 <secondary>rewriting malformed addresses</secondary>
51554 </indexterm>
51555 <indexterm role="concept">
51556 <primary>RCPT</primary>
51557 <secondary>rewriting argument of</secondary>
51558 </indexterm>
51559 <indexterm role="concept">
51560 <primary>MAIL</primary>
51561 <secondary>rewriting argument of</secondary>
51562 </indexterm>
51563 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
51564 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
51565 before any other processing; even before syntax checking. The pattern is
51566 required to be a regular expression, and it is matched against the whole of the
51567 data for the command, including any surrounding angle brackets.
51568 </para>
51569 <para>
51570 <indexterm role="variable">
51571 <primary><varname>$domain</varname></primary>
51572 </indexterm>
51573 <indexterm role="variable">
51574 <primary><varname>$local_part</varname></primary>
51575 </indexterm>
51576 This form of rewrite rule allows for the handling of addresses that are not
51577 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
51578 input). Because the input is not required to be a syntactically valid address,
51579 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
51580 expansion of the replacement string. The result of rewriting replaces the
51581 original address in the MAIL or RCPT command.
51582 </para>
51583 </section>
51584 <section id="SECID155">
51585 <title>Flags controlling the rewriting process</title>
51586 <para>
51587 There are four flags which control the way the rewriting process works. These
51588 take effect only when a rule is invoked, that is, when the address is of the
51589 correct type (matches the flags) and matches the pattern:
51590 </para>
51591 <itemizedlist>
51592 <listitem>
51593 <para>
51594 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
51595 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
51596 absence of <quote>Q</quote> the rewritten address must always include a domain.
51597 </para>
51598 </listitem>
51599 <listitem>
51600 <para>
51601 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
51602 even if no rewriting actually takes place because of a <quote>fail</quote> in the
51603 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
51604 (does not match the flags) or does not match the pattern.
51605 </para>
51606 </listitem>
51607 <listitem>
51608 <para>
51609 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
51610 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
51611 rewriting once it fails to match (after at least one successful rewrite).
51612 </para>
51613 </listitem>
51614 <listitem>
51615 <para>
51616 <indexterm role="concept">
51617 <primary>rewriting</primary>
51618 <secondary>whole addresses</secondary>
51619 </indexterm>
51620 When an address in a header is rewritten, the rewriting normally applies only
51621 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
51622 left unchanged. For example, rewriting might change
51623 </para>
51624 <literallayout class="monospaced">
51625 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
51626 </literallayout>
51627 <para>
51628 into
51629 </para>
51630 <literallayout class="monospaced">
51631 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
51632 </literallayout>
51633 <para>
51634 <indexterm role="concept">
51635 <primary>RFC 2047</primary>
51636 </indexterm>
51637 Sometimes there is a need to replace the whole address item, and this can be
51638 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
51639 causes an address in a header line to be rewritten, the entire address is
51640 replaced, not just the working part. The replacement must be a complete RFC
51641 2822 address, including the angle brackets if necessary. If text outside angle
51642 brackets contains a character whose value is greater than 126 or less than 32
51643 (except for tab), the text is encoded according to RFC 2047. The character set
51644 is taken from <option>headers_charset</option>, which gets its default at build time.
51645 </para>
51646 <para>
51647 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
51648 rewritten, all but the working part of the replacement address is discarded.
51649 </para>
51650 </listitem>
51651 </itemizedlist>
51652 </section>
51653 <section id="SECID156">
51654 <title>Rewriting examples</title>
51655 <para>
51656 Here is an example of the two common rewriting paradigms:
51657 </para>
51658 <literallayout class="monospaced">
51659 *@*.hitch.fict.example  $1@hitch.fict.example
51660 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
51661                      {$value}fail}@hitch.fict.example bctfrF
51662 </literallayout>
51663 <para>
51664 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
51665 the string expansion to fail if the lookup does not succeed. In this context it
51666 has the effect of leaving the original address unchanged, but Exim goes on to
51667 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
51668 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
51669 explicitly, which would cause the rewritten address to be the same as before,
51670 at the cost of a small bit of processing. Not supplying either of these is an
51671 error, since the rewritten address would then contain no local part.
51672 </para>
51673 <para>
51674 The first example above replaces the domain with a superior, more general
51675 domain. This may not be desirable for certain local parts. If the rule
51676 </para>
51677 <literallayout class="monospaced">
51678 root@*.hitch.fict.example  *
51679 </literallayout>
51680 <para>
51681 were inserted before the first rule, rewriting would be suppressed for the
51682 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
51683 </para>
51684 <para>
51685 Rewriting can be made conditional on a number of tests, by making use of
51686 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
51687 messages that originate outside the local host:
51688 </para>
51689 <literallayout class="monospaced">
51690 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
51691                          {$1@hitch.fict.example}fail}"
51692 </literallayout>
51693 <para>
51694 The replacement string is quoted in this example because it contains white
51695 space.
51696 </para>
51697 <para>
51698 <indexterm role="concept">
51699 <primary>rewriting</primary>
51700 <secondary>bang paths</secondary>
51701 </indexterm>
51702 <indexterm role="concept">
51703 <primary>bang paths</primary>
51704 <secondary>rewriting</secondary>
51705 </indexterm>
51706 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
51707 an address it treats it as an unqualified local part which it qualifies with
51708 the local qualification domain (if the source of the message is local or if the
51709 remote host is permitted to send unqualified addresses). Rewriting can
51710 sometimes be used to handle simple bang paths with a fixed number of
51711 components. For example, the rule
51712 </para>
51713 <literallayout class="monospaced">
51714 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
51715 </literallayout>
51716 <para>
51717 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
51718 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
51719 a global rewriting rule for envelope addresses. It can provide a backdoor
51720 method for using your system as a relay, because the incoming addresses appear
51721 to be local. If the bang path addresses are received via SMTP, it is safer to
51722 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
51723 can be done on the rewritten addresses.
51724 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
51725 </para>
51726 </section>
51727 </chapter>
51728
51729 <chapter id="CHAPretry">
51730 <title>Retry configuration</title>
51731 <para>
51732 <indexterm role="concept" id="IIDretconf1" class="startofrange">
51733 <primary>retry</primary>
51734 <secondary>configuration, description of</secondary>
51735 </indexterm>
51736 <indexterm role="concept" id="IIDregconf2" class="startofrange">
51737 <primary>configuration file</primary>
51738 <secondary>retry section</secondary>
51739 </indexterm>
51740 The <quote>retry</quote> section of the runtime configuration file contains a list of
51741 retry rules that control how often Exim tries to deliver messages that cannot
51742 be delivered at the first attempt. If there are no retry rules (the section is
51743 empty or not present), there are no retries. In this situation, temporary
51744 errors are treated as permanent. The default configuration contains a single,
51745 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
51746 line option can be used to test which retry rule will be used for a given
51747 address, domain and error.
51748 </para>
51749 <para>
51750 The most common cause of retries is temporary failure to deliver to a remote
51751 host because the host is down, or inaccessible because of a network problem.
51752 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
51753 address) basis, not on a per-message basis. Thus, if one message has recently
51754 been delayed, delivery of a new message to the same host is not immediately
51755 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
51756 log selector is set, the message
51757 <indexterm role="concept">
51758 <primary>retry</primary>
51759 <secondary>time not reached</secondary>
51760 </indexterm>
51761 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
51762 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
51763 the handling of errors during remote deliveries.
51764 </para>
51765 <para>
51766 Retry processing applies to routing as well as to delivering, except as covered
51767 in the next paragraph. The retry rules do not distinguish between these
51768 actions. It is not possible, for example, to specify different behaviour for
51769 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
51770 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
51771 added complication, so did not implement it. However, although they share the
51772 same retry rule, the actual retry times for routing and transporting a given
51773 domain are maintained independently.
51774 </para>
51775 <para>
51776 When a delivery is not part of a queue run (typically an immediate delivery on
51777 receipt of a message), the routers are always run, and local deliveries are
51778 always attempted, even if retry times are set for them. This makes for better
51779 behaviour if one particular message is causing problems (for example, causing
51780 quota overflow, or provoking an error in a filter file). If such a delivery
51781 suffers a temporary failure, the retry data is updated as normal, and
51782 subsequent delivery attempts from queue runs occur only when the retry time for
51783 the local address is reached.
51784 </para>
51785 <section id="SECID157">
51786 <title>Changing retry rules</title>
51787 <para>
51788 If you change the retry rules in your configuration, you should consider
51789 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
51790 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
51791 always safe; that is why they are called <quote>hints</quote>.
51792 </para>
51793 <para>
51794 The hints retry data contains suggested retry times based on the previous
51795 rules. In the case of a long-running problem with a remote host, it might
51796 record the fact that the host has timed out. If your new rules increase the
51797 timeout time for such a host, you should definitely remove the old retry data
51798 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
51799 messages that it should now be retaining.
51800 </para>
51801 </section>
51802 <section id="SECID158">
51803 <title>Format of retry rules</title>
51804 <para>
51805 <indexterm role="concept">
51806 <primary>retry</primary>
51807 <secondary>rules</secondary>
51808 </indexterm>
51809 Each retry rule occupies one line and consists of three or four parts,
51810 separated by white space: a pattern, an error name, an optional list of sender
51811 addresses, and a list of retry parameters. The pattern and sender lists must be
51812 enclosed in double quotes if they contain white space. The rules are searched
51813 in order until one is found where the pattern, error name, and sender list (if
51814 present) match the failing host or address, the error that occurred, and the
51815 message&#x2019;s sender, respectively.
51816 </para>
51817 <para>
51818 The pattern is any single item that may appear in an address list (see section
51819 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
51820 which means that it is expanded before being tested against the address that
51821 has been delayed. A negated address list item is permitted. Address
51822 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
51823 which makes it possible for many retry rules to start with just a domain. For
51824 example,
51825 </para>
51826 <literallayout class="monospaced">
51827 lookingglass.fict.example        *  F,24h,30m;
51828 </literallayout>
51829 <para>
51830 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
51831 whereas
51832 </para>
51833 <literallayout class="monospaced">
51834 alice@lookingglass.fict.example  *  F,24h,30m;
51835 </literallayout>
51836 <para>
51837 applies only to temporary failures involving the local part <option>alice</option>.
51838 In practice, almost all rules start with a domain name pattern without a local
51839 part.
51840 </para>
51841 <para>
51842 <indexterm role="concept">
51843 <primary>regular expressions</primary>
51844 <secondary>in retry rules</secondary>
51845 </indexterm>
51846 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
51847 must match a complete address, not just a domain, because that is how regular
51848 expressions work in address lists.
51849 </para>
51850 <literallayout>
51851 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
51852 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
51853 </literallayout>
51854 </section>
51855 <section id="SECID159">
51856 <title>Choosing which retry rule to use for address errors</title>
51857 <para>
51858 When Exim is looking for a retry rule after a routing attempt has failed (for
51859 example, after a DNS timeout), each line in the retry configuration is tested
51860 against the complete address only if <option>retry_use_local_part</option> is set for the
51861 router. Otherwise, only the domain is used, except when matching against a
51862 regular expression, when the local part of the address is replaced with <quote>*</quote>.
51863 A domain on its own can match a domain pattern, or a pattern that starts with
51864 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
51865 <option>check_local_user</option> is true, and false for other routers.
51866 </para>
51867 <para>
51868 Similarly, when Exim is looking for a retry rule after a local delivery has
51869 failed (for example, after a mailbox full error), each line in the retry
51870 configuration is tested against the complete address only if
51871 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
51872 local transports).
51873 </para>
51874 <para>
51875 <indexterm role="concept">
51876 <primary>4<emphasis>xx</emphasis> responses</primary>
51877 <secondary>retry rules for</secondary>
51878 </indexterm>
51879 However, when Exim is looking for a retry rule after a remote delivery attempt
51880 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
51881 whole address is always used as the key when searching the retry rules. The
51882 rule that is found is used to create a retry time for the combination of the
51883 failing address and the message&#x2019;s sender. It is the combination of sender and
51884 recipient that is delayed in subsequent queue runs until its retry time is
51885 reached. You can delay the recipient without regard to the sender by setting
51886 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
51887 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
51888 commands.
51889 </para>
51890 </section>
51891 <section id="SECID160">
51892 <title>Choosing which retry rule to use for host and message errors</title>
51893 <para>
51894 For a temporary error that is not related to an individual address (for
51895 example, a connection timeout), each line in the retry configuration is checked
51896 twice. First, the name of the remote host is used as a domain name (preceded by
51897 <quote>*@</quote> when matching a regular expression). If this does not match the line,
51898 the domain from the email address is tried in a similar fashion. For example,
51899 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
51900 </para>
51901 <literallayout class="monospaced">
51902 a.b.c.example  MX  5  x.y.z.example
51903                MX  6  p.q.r.example
51904                MX  7  m.n.o.example
51905 </literallayout>
51906 <para>
51907 and the retry rules are
51908 </para>
51909 <literallayout class="monospaced">
51910 p.q.r.example    *      F,24h,30m;
51911 a.b.c.example    *      F,4d,45m;
51912 </literallayout>
51913 <para>
51914 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
51915 first rule matches neither the host nor the domain, so Exim looks at the second
51916 rule. This does not match the host, but it does match the domain, so it is used
51917 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
51918 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
51919 first retry rule is used, because it matches the host.
51920 </para>
51921 <para>
51922 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
51923 first rule to determine retry times, but for all the other hosts for the domain
51924 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
51925 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
51926 </para>
51927 <para>
51928 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
51929 However, if a message is routed directly to an IP address without the use of a
51930 host name, for example, if a <command>manualroute</command> router contains a setting such as:
51931 </para>
51932 <literallayout class="monospaced">
51933 route_list = *.a.example  192.168.34.23
51934 </literallayout>
51935 <para>
51936 then the <quote>host name</quote> that is used when searching for a retry rule is the
51937 textual form of the IP address.
51938 </para>
51939 </section>
51940 <section id="SECID161">
51941 <title>Retry rules for specific errors</title>
51942 <para>
51943 <indexterm role="concept">
51944 <primary>retry</primary>
51945 <secondary>specific errors; specifying</secondary>
51946 </indexterm>
51947 The second field in a retry rule is the name of a particular error, or an
51948 asterisk, which matches any error. The errors that can be tested for are:
51949 </para>
51950 <variablelist>
51951 <varlistentry>
51952 <term><option>auth_failed</option></term>
51953 <listitem>
51954 <para>
51955 Authentication failed when trying to send to a host in the
51956 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
51957 </para>
51958 </listitem></varlistentry>
51959 <varlistentry>
51960 <term><option>data_4xx</option></term>
51961 <listitem>
51962 <para>
51963 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
51964 after the command, or after sending the message&#x2019;s data.
51965 </para>
51966 </listitem></varlistentry>
51967 <varlistentry>
51968 <term><option>mail_4xx</option></term>
51969 <listitem>
51970 <para>
51971 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
51972 </para>
51973 </listitem></varlistentry>
51974 <varlistentry>
51975 <term><option>rcpt_4xx</option></term>
51976 <listitem>
51977 <para>
51978 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
51979 </para>
51980 </listitem></varlistentry>
51981 </variablelist>
51982 <para>
51983 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
51984 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
51985 recognize 452 errors given to RCPT commands for addresses in a certain domain,
51986 and have retries every ten minutes with a one-hour timeout, you could set up a
51987 retry rule of this form:
51988 </para>
51989 <literallayout class="monospaced">
51990 the.domain.name  rcpt_452   F,1h,10m
51991 </literallayout>
51992 <para>
51993 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
51994 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
51995 </para>
51996 <variablelist>
51997 <varlistentry>
51998 <term><option>lost_connection</option></term>
51999 <listitem>
52000 <para>
52001 A server unexpectedly closed the SMTP connection. There may, of course,
52002 legitimate reasons for this (host died, network died), but if it repeats a lot
52003 for the same host, it indicates something odd.
52004 </para>
52005 </listitem></varlistentry>
52006 <varlistentry>
52007 <term><option>lookup</option></term>
52008 <listitem>
52009 <para>
52010 A DNS lookup for a host failed.
52011 Note that a <option>dnslookup</option> router will need to have matched
52012 its <option>fail_defer_domains</option> option for this retry type to be usable.
52013 Also note that a <option>manualroute</option> router will probably need
52014 its <option>host_find_failed</option> option set to <option>defer</option>.
52015 </para>
52016 </listitem></varlistentry>
52017 <varlistentry>
52018 <term><option>refused_MX</option></term>
52019 <listitem>
52020 <para>
52021 A connection to a host obtained from an MX record was refused.
52022 </para>
52023 </listitem></varlistentry>
52024 <varlistentry>
52025 <term><option>refused_A</option></term>
52026 <listitem>
52027 <para>
52028 A connection to a host not obtained from an MX record was refused.
52029 </para>
52030 </listitem></varlistentry>
52031 <varlistentry>
52032 <term><option>refused</option></term>
52033 <listitem>
52034 <para>
52035 A connection was refused.
52036 </para>
52037 </listitem></varlistentry>
52038 <varlistentry>
52039 <term><option>timeout_connect_MX</option></term>
52040 <listitem>
52041 <para>
52042 A connection attempt to a host obtained from an MX record timed out.
52043 </para>
52044 </listitem></varlistentry>
52045 <varlistentry>
52046 <term><option>timeout_connect_A</option></term>
52047 <listitem>
52048 <para>
52049 A connection attempt to a host not obtained from an MX record timed out.
52050 </para>
52051 </listitem></varlistentry>
52052 <varlistentry>
52053 <term><option>timeout_connect</option></term>
52054 <listitem>
52055 <para>
52056 A connection attempt timed out.
52057 </para>
52058 </listitem></varlistentry>
52059 <varlistentry>
52060 <term><option>timeout_MX</option></term>
52061 <listitem>
52062 <para>
52063 There was a timeout while connecting or during an SMTP session with a host
52064 obtained from an MX record.
52065 </para>
52066 </listitem></varlistentry>
52067 <varlistentry>
52068 <term><option>timeout_A</option></term>
52069 <listitem>
52070 <para>
52071 There was a timeout while connecting or during an SMTP session with a host not
52072 obtained from an MX record.
52073 </para>
52074 </listitem></varlistentry>
52075 <varlistentry>
52076 <term><option>timeout</option></term>
52077 <listitem>
52078 <para>
52079 There was a timeout while connecting or during an SMTP session.
52080 </para>
52081 </listitem></varlistentry>
52082 <varlistentry>
52083 <term><option>tls_required</option></term>
52084 <listitem>
52085 <para>
52086 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
52087 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
52088 to STARTTLS, or there was a problem setting up the TLS connection.
52089 </para>
52090 </listitem></varlistentry>
52091 <varlistentry>
52092 <term><option>quota</option></term>
52093 <listitem>
52094 <para>
52095 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
52096 transport.
52097 </para>
52098 </listitem></varlistentry>
52099 <varlistentry>
52100 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
52101 <listitem>
52102 <para>
52103 <indexterm role="concept">
52104 <primary>quota</primary>
52105 <secondary>error testing in retry rule</secondary>
52106 </indexterm>
52107 <indexterm role="concept">
52108 <primary>retry</primary>
52109 <secondary>quota error testing</secondary>
52110 </indexterm>
52111 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
52112 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
52113 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
52114 for four days.
52115 </para>
52116 </listitem></varlistentry>
52117 </variablelist>
52118 <para>
52119 <indexterm role="concept">
52120 <primary>mailbox</primary>
52121 <secondary>time of last read</secondary>
52122 </indexterm>
52123 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
52124 timeouts when the mailbox is full and is not being read by its owner. Ideally,
52125 it should be based on the last time that the user accessed the mailbox.
52126 However, it is not always possible to determine this. Exim uses the following
52127 heuristic rules:
52128 </para>
52129 <itemizedlist>
52130 <listitem>
52131 <para>
52132 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
52133 used. As no new messages are being delivered (because the mailbox is over
52134 quota), Exim does not access the file, so this is the time of last user access.
52135 </para>
52136 </listitem>
52137 <listitem>
52138 <para>
52139 <indexterm role="concept">
52140 <primary>maildir format</primary>
52141 <secondary>time of last read</secondary>
52142 </indexterm>
52143 For a maildir delivery, the time of last modification of the <filename>new</filename>
52144 subdirectory is used. As the mailbox is over quota, no new files are created in
52145 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
52146 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
52147 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
52148 time that is used is therefore the last time that the user read a new message.
52149 </para>
52150 </listitem>
52151 <listitem>
52152 <para>
52153 For other kinds of multi-file mailbox, the time of last access cannot be
52154 obtained, so a retry rule that uses this type of error field is never matched.
52155 </para>
52156 </listitem>
52157 </itemizedlist>
52158 <para>
52159 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
52160 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
52161 when a local delivery is deferred because a partition is full (the ENOSPC
52162 error).
52163 </para>
52164 </section>
52165 <section id="SECID162">
52166 <title>Retry rules for specified senders</title>
52167 <para>
52168 <indexterm role="concept">
52169 <primary>retry</primary>
52170 <secondary>rules; sender-specific</secondary>
52171 </indexterm>
52172 You can specify retry rules that apply only when the failing message has a
52173 specific sender. In particular, this can be used to define retry rules that
52174 apply only to bounce messages. The third item in a retry rule can be of this
52175 form:
52176 </para>
52177 <literallayout>
52178 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
52179 </literallayout>
52180 <para>
52181 The retry timings themselves are then the fourth item. For example:
52182 </para>
52183 <literallayout class="monospaced">
52184 *   rcpt_4xx   senders=:   F,1h,30m
52185 </literallayout>
52186 <para>
52187 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
52188 host. If the address list contains white space, it must be enclosed in quotes.
52189 For example:
52190 </para>
52191 <literallayout class="monospaced">
52192 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
52193 </literallayout>
52194 <para>
52195 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
52196 (which do not depend on the recipient). The reason is that the sender is used
52197 only to match the retry rule. Once the rule has been found for a host error,
52198 its contents are used to set a retry time for the host, and this will apply to
52199 all messages, not just those with specific senders.
52200 </para>
52201 <para>
52202 When testing retry rules using <option>-brt</option>, you can supply a sender using the
52203 <option>-f</option> command line option, like this:
52204 </para>
52205 <literallayout class="monospaced">
52206 exim -f "" -brt user@dom.ain
52207 </literallayout>
52208 <para>
52209 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
52210 list is never matched.
52211 </para>
52212 </section>
52213 <section id="SECID163">
52214 <title>Retry parameters</title>
52215 <para>
52216 <indexterm role="concept">
52217 <primary>retry</primary>
52218 <secondary>parameters in rules</secondary>
52219 </indexterm>
52220 The third (or fourth, if a senders list is present) field in a retry rule is a
52221 sequence of retry parameter sets, separated by semicolons. Each set consists of
52222 </para>
52223 <literallayout>
52224 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
52225 </literallayout>
52226 <para>
52227 The letter identifies the algorithm for computing a new retry time; the cutoff
52228 time is the time beyond which this algorithm no longer applies, and the
52229 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
52230 time that the first failure for the domain (combined with the local part if
52231 relevant) was detected, not from the time the message was received.
52232 </para>
52233 <para>
52234 <indexterm role="concept">
52235 <primary>retry</primary>
52236 <secondary>algorithms</secondary>
52237 </indexterm>
52238 <indexterm role="concept">
52239 <primary>retry</primary>
52240 <secondary>fixed intervals</secondary>
52241 </indexterm>
52242 <indexterm role="concept">
52243 <primary>retry</primary>
52244 <secondary>increasing intervals</secondary>
52245 </indexterm>
52246 <indexterm role="concept">
52247 <primary>retry</primary>
52248 <secondary>random intervals</secondary>
52249 </indexterm>
52250 The available algorithms are:
52251 </para>
52252 <itemizedlist>
52253 <listitem>
52254 <para>
52255 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
52256 the interval.
52257 </para>
52258 </listitem>
52259 <listitem>
52260 <para>
52261 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
52262 specifies a starting value for the interval, and the second a multiplier, which
52263 is used to increase the size of the interval at each retry.
52264 </para>
52265 </listitem>
52266 <listitem>
52267 <para>
52268 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
52269 retry, the previous interval is multiplied by the factor in order to get a
52270 maximum for the next interval. The minimum interval is the first argument of
52271 the parameter, and an actual interval is chosen randomly between them. Such a
52272 rule has been found to be helpful in cluster configurations when all the
52273 members of the cluster restart at once, and may therefore synchronize their
52274 queue processing times.
52275 </para>
52276 </listitem>
52277 </itemizedlist>
52278 <para>
52279 When computing the next retry time, the algorithm definitions are scanned in
52280 order until one whose cutoff time has not yet passed is reached. This is then
52281 used to compute a new retry time that is later than the current time. In the
52282 case of fixed interval retries, this simply means adding the interval to the
52283 current time. For geometrically increasing intervals, retry intervals are
52284 computed from the rule&#x2019;s parameters until one that is greater than the previous
52285 interval is found. The main configuration variable
52286 <indexterm role="concept">
52287 <primary>limit</primary>
52288 <secondary>retry interval</secondary>
52289 </indexterm>
52290 <indexterm role="concept">
52291 <primary>retry</primary>
52292 <secondary>interval, maximum</secondary>
52293 </indexterm>
52294 <indexterm role="option">
52295 <primary><option>retry_interval_max</option></primary>
52296 </indexterm>
52297 <option>retry_interval_max</option> limits the maximum interval between retries. It
52298 cannot be set greater than <literal>24h</literal>, which is its default value.
52299 </para>
52300 <para>
52301 A single remote domain may have a number of hosts associated with it, and each
52302 host may have more than one IP address. Retry algorithms are selected on the
52303 basis of the domain name, but are applied to each IP address independently. If,
52304 for example, a host has two IP addresses and one is unusable, Exim will
52305 generate retry times for it and will not try to use it until its next retry
52306 time comes. Thus the good IP address is likely to be tried first most of the
52307 time.
52308 </para>
52309 <para>
52310 <indexterm role="concept">
52311 <primary>hints database</primary>
52312 <secondary>use for retrying</secondary>
52313 </indexterm>
52314 Retry times are hints rather than promises. Exim does not make any attempt to
52315 run deliveries exactly at the computed times. Instead, a queue runner process
52316 starts delivery processes for delayed messages periodically, and these attempt
52317 new deliveries only for those addresses that have passed their next retry time.
52318 If a new message arrives for a deferred address, an immediate delivery attempt
52319 occurs only if the address has passed its retry time. In the absence of new
52320 messages, the minimum time between retries is the interval between queue runner
52321 processes. There is not much point in setting retry times of five minutes if
52322 your queue runners happen only once an hour, unless there are a significant
52323 number of incoming messages (which might be the case on a system that is
52324 sending everything to a smart host, for example).
52325 </para>
52326 <para>
52327 The data in the retry hints database can be inspected by using the
52328 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
52329 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
52330 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
52331 are for the hosts associated with a particular mail domain, and also for local
52332 deliveries that have been deferred.
52333 </para>
52334 </section>
52335 <section id="SECID164">
52336 <title>Retry rule examples</title>
52337 <para>
52338 Here are some example retry rules:
52339 </para>
52340 <literallayout class="monospaced">
52341 alice@wonderland.fict.example quota_5d  F,7d,3h
52342 wonderland.fict.example       quota_5d
52343 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
52344 lookingglass.fict.example     *         F,24h,30m;
52345 *                 refused_A   F,2h,20m;
52346 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
52347 </literallayout>
52348 <para>
52349 The first rule sets up special handling for mail to
52350 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
52351 mailbox has not been read for at least 5 days. Retries continue every three
52352 hours for 7 days. The second rule handles over-quota errors for all other local
52353 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
52354 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
52355 fail are bounced immediately if the mailbox has not been read for at least 5
52356 days.
52357 </para>
52358 <para>
52359 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
52360 happen every 15 minutes for an hour, then with geometrically increasing
52361 intervals until two days have passed since a delivery first failed. After the
52362 first hour there is a delay of one hour, then two hours, then four hours, and
52363 so on (this is a rather extreme example).
52364 </para>
52365 <para>
52366 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
52367 They happen every 30 minutes for 24 hours only. The remaining two rules handle
52368 all other domains, with special action for connection refusal from hosts that
52369 were not obtained from an MX record.
52370 </para>
52371 <para>
52372 The final rule in a retry configuration should always have asterisks in the
52373 first two fields so as to provide a general catch-all for any addresses that do
52374 not have their own special handling. This example tries every 15 minutes for 2
52375 hours, then with intervals starting at one hour and increasing by a factor of
52376 1.5 up to 16 hours, then every 8 hours up to 5 days.
52377 </para>
52378 </section>
52379 <section id="SECID165">
52380 <title>Timeout of retry data</title>
52381 <para>
52382 <indexterm role="concept">
52383 <primary>timeout</primary>
52384 <secondary>of retry data</secondary>
52385 </indexterm>
52386 <indexterm role="option">
52387 <primary><option>retry_data_expire</option></primary>
52388 </indexterm>
52389 <indexterm role="concept">
52390 <primary>hints database</primary>
52391 <secondary>data expiry</secondary>
52392 </indexterm>
52393 <indexterm role="concept">
52394 <primary>retry</primary>
52395 <secondary>timeout of data</secondary>
52396 </indexterm>
52397 Exim timestamps the data that it writes to its retry hints database. When it
52398 consults the data during a delivery it ignores any that is older than the value
52399 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
52400 been tried for 7 days, Exim will try to deliver to it immediately a message
52401 arrives, and if that fails, it will calculate a retry time as if it were
52402 failing for the first time.
52403 </para>
52404 <para>
52405 This improves the behaviour for messages routed to rarely-used hosts such as MX
52406 backups. If such a host was down at one time, and happens to be down again when
52407 Exim tries a month later, using the old retry data would imply that it had been
52408 down all the time, which is not a justified assumption.
52409 </para>
52410 <para>
52411 If a host really is permanently dead, this behaviour causes a burst of retries
52412 every now and again, but only if messages routed to it are rare. If there is a
52413 message at least once every 7 days the retry data never expires.
52414 </para>
52415 </section>
52416 <section id="SECID166">
52417 <title>Long-term failures</title>
52418 <para>
52419 <indexterm role="concept">
52420 <primary>delivery failure, long-term</primary>
52421 </indexterm>
52422 <indexterm role="concept">
52423 <primary>retry</primary>
52424 <secondary>after long-term failure</secondary>
52425 </indexterm>
52426 Special processing happens when an email address has been failing for so long
52427 that the cutoff time for the last algorithm is reached. For example, using the
52428 default retry rule:
52429 </para>
52430 <literallayout class="monospaced">
52431 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
52432 </literallayout>
52433 <para>
52434 the cutoff time is four days. Reaching the retry cutoff is independent of how
52435 long any specific message has been failing; it is the length of continuous
52436 failure for the recipient address that counts.
52437 </para>
52438 <para>
52439 When the cutoff time is reached for a local delivery, or for all the IP
52440 addresses associated with a remote delivery, a subsequent delivery failure
52441 causes Exim to give up on the address, and a bounce message is generated.
52442 In order to cater for new messages that use the failing address, a next retry
52443 time is still computed from the final algorithm, and is used as follows:
52444 </para>
52445 <para>
52446 For local deliveries, one delivery attempt is always made for any subsequent
52447 messages. If this delivery fails, the address fails immediately. The
52448 post-cutoff retry time is not used.
52449 </para>
52450 <para>
52451 <indexterm role="concept">
52452 <primary>final cutoff</primary>
52453 <secondary>retries, controlling</secondary>
52454 </indexterm>
52455 <indexterm role="concept">
52456 <primary>retry</primary>
52457 <secondary>final cutoff</secondary>
52458 </indexterm>
52459 If the delivery is remote, there are two possibilities, controlled by the
52460 <indexterm role="option">
52461 <primary><option>delay_after_cutoff</option></primary>
52462 </indexterm>
52463 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
52464 default. Until the post-cutoff retry time for one of the IP addresses,
52465 as set by the <option>retry_data_expire</option> option, is
52466 reached, the failing email address is bounced immediately, without a delivery
52467 attempt taking place. After that time, one new delivery attempt is made to
52468 those IP addresses that are past their retry times, and if that still fails,
52469 the address is bounced and new retry times are computed.
52470 </para>
52471 <para>
52472 In other words, when all the hosts for a given email address have been failing
52473 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
52474 times is reached. Then it tries once, and bounces if that attempt fails. This
52475 behaviour ensures that few resources are wasted in repeatedly trying to deliver
52476 to a broken destination, but if the host does recover, Exim will eventually
52477 notice.
52478 </para>
52479 <para>
52480 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
52481 addresses are past their final cutoff time, Exim tries to deliver to those IP
52482 addresses that have not been tried since the message arrived. If there are
52483 no suitable IP addresses, or if they all fail, the address is bounced. In other
52484 words, it does not delay when a new message arrives, but tries the expired
52485 addresses immediately, unless they have been tried since the message arrived.
52486 If there is a continuous stream of messages for the failing domains, setting
52487 <option>delay_after_cutoff</option> false means that there will be many more attempts to
52488 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
52489 true.
52490 </para>
52491 </section>
52492 <section id="SECID167">
52493 <title>Deliveries that work intermittently</title>
52494 <para>
52495 <indexterm role="concept">
52496 <primary>retry</primary>
52497 <secondary>intermittently working deliveries</secondary>
52498 </indexterm>
52499 Some additional logic is needed to cope with cases where a host is
52500 intermittently available, or when a message has some attribute that prevents
52501 its delivery when others to the same address get through. In this situation,
52502 because some messages are successfully delivered, the <quote>retry clock</quote> for the
52503 host or address keeps getting reset by the successful deliveries, and so
52504 failing messages remain in the queue for ever because the cutoff time is never
52505 reached.
52506 </para>
52507 <para>
52508 Two exceptional actions are applied to prevent this happening. The first
52509 applies to errors that are related to a message rather than a remote host.
52510 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
52511 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
52512 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
52513 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
52514 is used when scanning the retry rules to decide when to try next and when to
52515 time out the address.
52516 </para>
52517 <para>
52518 The exceptional second action applies in all cases. If a message has been on
52519 the queue for longer than the cutoff time of any applicable retry rule for a
52520 given address, a delivery is attempted for that address, even if it is not yet
52521 time, and if this delivery fails, the address is timed out. A new retry time is
52522 not computed in this case, so that other messages for the same address are
52523 considered immediately.
52524 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
52525 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
52526 </para>
52527 </section>
52528 </chapter>
52529
52530 <chapter id="CHAPSMTPAUTH">
52531 <title>SMTP authentication</title>
52532 <para>
52533 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
52534 <primary>SMTP</primary>
52535 <secondary>authentication configuration</secondary>
52536 </indexterm>
52537 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
52538 <primary>authentication</primary>
52539 </indexterm>
52540 The <quote>authenticators</quote> section of Exim&#x2019;s runtime configuration is concerned
52541 with SMTP authentication. This facility is an extension to the SMTP protocol,
52542 described in RFC 2554, which allows a client SMTP host to authenticate itself
52543 to a server. This is a common way for a server to recognize clients that are
52544 permitted to use it as a relay. SMTP authentication is not of relevance to the
52545 transfer of mail between servers that have no managerial connection with each
52546 other.
52547 </para>
52548 <para revisionflag="changed">
52549 The name of an authenticator is limited to be 64 ASCII characters long;
52550 prior to Exim 4.95 names would be silently truncated at this length, but now
52551 it is enforced.
52552 </para>
52553 <para>
52554 <indexterm role="concept">
52555 <primary>AUTH</primary>
52556 <secondary>description of</secondary>
52557 </indexterm>
52558 <indexterm role="concept">
52559 <primary>ESMTP extensions</primary>
52560 <secondary>AUTH</secondary>
52561 </indexterm>
52562 Very briefly, the way SMTP authentication works is as follows:
52563 </para>
52564 <itemizedlist>
52565 <listitem>
52566 <para>
52567 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
52568 the client&#x2019;s EHLO command.
52569 </para>
52570 </listitem>
52571 <listitem>
52572 <para>
52573 The client issues an AUTH command, naming a specific mechanism. The command
52574 may, optionally, contain some authentication data.
52575 </para>
52576 </listitem>
52577 <listitem>
52578 <para>
52579 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
52580 appropriate responses. In simple authentication mechanisms, the challenges are
52581 just prompts for user names and passwords. The server does not have to issue
52582 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
52583 with the AUTH command.
52584 </para>
52585 </listitem>
52586 <listitem>
52587 <para>
52588 The server either accepts or denies authentication.
52589 </para>
52590 </listitem>
52591 <listitem>
52592 <para>
52593 If authentication succeeds, the client may optionally make use of the AUTH
52594 option on the MAIL command to pass an authenticated sender in subsequent
52595 mail transactions. Authentication lasts for the remainder of the SMTP
52596 connection.
52597 </para>
52598 </listitem>
52599 <listitem>
52600 <para>
52601 If authentication fails, the client may give up, or it may try a different
52602 authentication mechanism, or it may try transferring mail over the
52603 unauthenticated connection.
52604 </para>
52605 </listitem>
52606 </itemizedlist>
52607 <para>
52608 If you are setting up a client, and want to know which authentication
52609 mechanisms the server supports, you can use Telnet to connect to port 25 (the
52610 SMTP port) on the server, and issue an EHLO command. The response to this
52611 includes the list of supported mechanisms. For example:
52612 </para>
52613 <literallayout>
52614 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
52615 <literal>Trying 192.168.34.25...</literal>
52616 <literal>Connected to server.example.</literal>
52617 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
52618 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
52619 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
52620 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
52621 <literal>250-SIZE 52428800</literal>
52622 <literal>250-PIPELINING</literal>
52623 <literal>250-AUTH PLAIN</literal>
52624 <literal>250 HELP</literal>
52625 </literallayout>
52626 <para>
52627 The second-last line of this example output shows that the server supports
52628 authentication using the PLAIN mechanism. In Exim, the different authentication
52629 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
52630 routers and transports, which authenticators are included in the binary is
52631 controlled by build-time definitions. The following are currently available,
52632 included by setting
52633 </para>
52634 <literallayout class="monospaced">
52635 AUTH_CRAM_MD5=yes
52636 AUTH_CYRUS_SASL=yes
52637 AUTH_DOVECOT=yes
52638 AUTH_EXTERNAL=yes
52639 AUTH_GSASL=yes
52640 AUTH_HEIMDAL_GSSAPI=yes
52641 AUTH_PLAINTEXT=yes
52642 AUTH_SPA=yes
52643 AUTH_TLS=yes
52644 </literallayout>
52645 <para>
52646 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
52647 authentication mechanism (RFC 2195), and the second provides an interface to
52648 the Cyrus SASL authentication library.
52649 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
52650 work via a socket interface.
52651 The fourth provides for negotiation of authentication done via non-SMTP means,
52652 as defined by RFC 4422 Appendix A.
52653 The fifth provides an interface to the GNU SASL authentication library, which
52654 provides mechanisms but typically not data sources.
52655 The sixth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
52656 supporting setting a server keytab.
52657 The seventh can be configured to support
52658 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
52659 not formally documented, but used by several MUAs.
52660 The eighth authenticator
52661 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
52662 The last is an Exim authenticator but not an SMTP one;
52663 instead it can use information from a TLS negotiation.
52664 </para>
52665 <para>
52666 The authenticators are configured using the same syntax as other drivers (see
52667 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
52668 authentication section need be present in the configuration file. Each
52669 authenticator can in principle have both server and client functions. When Exim
52670 is receiving SMTP mail, it is acting as a server; when it is sending out
52671 messages over SMTP, it is acting as a client. Authenticator configuration
52672 options are provided for use in both these circumstances.
52673 </para>
52674 <para>
52675 To make it clear which options apply to which situation, the prefixes
52676 <option>server_</option> and <option>client_</option> are used on option names that are specific to
52677 either the server or the client function, respectively. Server and client
52678 functions are disabled if none of their options are set. If an authenticator is
52679 to be used for both server and client functions, a single definition, using
52680 both sets of options, is required. For example:
52681 </para>
52682 <literallayout class="monospaced">
52683 cram:
52684   driver = cram_md5
52685   public_name = CRAM-MD5
52686   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
52687   client_name = ph10
52688   client_secret = secret2
52689 </literallayout>
52690 <para>
52691 The <option>server_</option> option is used when Exim is acting as a server, and the
52692 <option>client_</option> options when it is acting as a client.
52693 </para>
52694 <para>
52695 Descriptions of the individual authenticators are given in subsequent chapters.
52696 The remainder of this chapter covers the generic options for the
52697 authenticators, followed by general discussion of the way authentication works
52698 in Exim.
52699 </para>
52700 <para>
52701 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
52702 per-mechanism basis.  Please read carefully to determine which variables hold
52703 account labels such as usercodes and which hold passwords or other
52704 authenticating data.
52705 </para>
52706 <para>
52707 Note that some mechanisms support two different identifiers for accounts: the
52708 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
52709 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
52710 Conceptually, authentication data such as passwords are tied to the identifier
52711 used to authenticate; servers may have rules to permit one user to act as a
52712 second user, so that after login the session is treated as though that second
52713 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
52714 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
52715 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
52716 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
52717 choose to honour.
52718 </para>
52719 <para>
52720 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
52721 to a client to help it select an account and credentials to use.  In some
52722 mechanisms, the client and server provably agree on the realm, but clients
52723 typically can not treat the realm as secure data to be blindly trusted.
52724 </para>
52725 <section id="SECID168">
52726 <title>Generic options for authenticators</title>
52727 <para>
52728 <indexterm role="concept">
52729 <primary>authentication</primary>
52730 <secondary>generic options</secondary>
52731 </indexterm>
52732 <indexterm role="concept">
52733 <primary>options</primary>
52734 <secondary>generic; for authenticators</secondary>
52735 </indexterm>
52736 </para>
52737 <para>
52738 <indexterm role="option">
52739 <primary><option>client_condition</option></primary>
52740 </indexterm>
52741 </para>
52742 <informaltable frame="all">
52743 <tgroup cols="4" colsep="0" rowsep="0">
52744 <colspec colwidth="8*" align="left"/>
52745 <colspec colwidth="6*" align="center"/>
52746 <colspec colwidth="6*" align="center"/>
52747 <colspec colwidth="6*" align="right"/>
52748 <tbody>
52749 <row>
52750 <entry><option>client_condition</option></entry>
52751 <entry>Use: <emphasis>authenticators</emphasis></entry>
52752 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52753 <entry>Default: <emphasis>unset</emphasis></entry>
52754 </row>
52755 </tbody>
52756 </tgroup>
52757 </informaltable>
52758 <para>
52759 When Exim is authenticating as a client, it skips any authenticator whose
52760 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
52761 used, for example, to skip plain text authenticators when the connection is not
52762 encrypted by a setting such as:
52763 </para>
52764 <literallayout class="monospaced">
52765 client_condition = ${if !eq{$tls_out_cipher}{}}
52766 </literallayout>
52767 <para>
52768 <indexterm role="option">
52769 <primary><option>client_set_id</option></primary>
52770 </indexterm>
52771 </para>
52772 <informaltable frame="all">
52773 <tgroup cols="4" colsep="0" rowsep="0">
52774 <colspec colwidth="8*" align="left"/>
52775 <colspec colwidth="6*" align="center"/>
52776 <colspec colwidth="6*" align="center"/>
52777 <colspec colwidth="6*" align="right"/>
52778 <tbody>
52779 <row>
52780 <entry><option>client_set_id</option></entry>
52781 <entry>Use: <emphasis>authenticators</emphasis></entry>
52782 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52783 <entry>Default: <emphasis>unset</emphasis></entry>
52784 </row>
52785 </tbody>
52786 </tgroup>
52787 </informaltable>
52788 <para>
52789 When client authentication succeeds, this condition is expanded; the
52790 result is used in the log lines for outbound messages.
52791 Typically it will be the user name used for authentication.
52792 </para>
52793 <para>
52794 <indexterm role="option">
52795 <primary><option>driver</option></primary>
52796 </indexterm>
52797 </para>
52798 <informaltable frame="all">
52799 <tgroup cols="4" colsep="0" rowsep="0">
52800 <colspec colwidth="8*" align="left"/>
52801 <colspec colwidth="6*" align="center"/>
52802 <colspec colwidth="6*" align="center"/>
52803 <colspec colwidth="6*" align="right"/>
52804 <tbody>
52805 <row>
52806 <entry><option>driver</option></entry>
52807 <entry>Use: <emphasis>authenticators</emphasis></entry>
52808 <entry>Type: <emphasis>string</emphasis></entry>
52809 <entry>Default: <emphasis>unset</emphasis></entry>
52810 </row>
52811 </tbody>
52812 </tgroup>
52813 </informaltable>
52814 <para>
52815 This option must always be set. It specifies which of the available
52816 authenticators is to be used.
52817 </para>
52818 <para>
52819 <indexterm role="option">
52820 <primary><option>public_name</option></primary>
52821 </indexterm>
52822 </para>
52823 <informaltable frame="all">
52824 <tgroup cols="4" colsep="0" rowsep="0">
52825 <colspec colwidth="8*" align="left"/>
52826 <colspec colwidth="6*" align="center"/>
52827 <colspec colwidth="6*" align="center"/>
52828 <colspec colwidth="6*" align="right"/>
52829 <tbody>
52830 <row>
52831 <entry><option>public_name</option></entry>
52832 <entry>Use: <emphasis>authenticators</emphasis></entry>
52833 <entry>Type: <emphasis>string</emphasis></entry>
52834 <entry>Default: <emphasis>unset</emphasis></entry>
52835 </row>
52836 </tbody>
52837 </tgroup>
52838 </informaltable>
52839 <para>
52840 This option specifies the name of the authentication mechanism that the driver
52841 implements, and by which it is known to the outside world. These names should
52842 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
52843 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
52844 defaults to the driver&#x2019;s instance name.
52845 </para>
52846 <para>
52847 <indexterm role="option">
52848 <primary><option>server_advertise_condition</option></primary>
52849 </indexterm>
52850 </para>
52851 <informaltable frame="all">
52852 <tgroup cols="4" colsep="0" rowsep="0">
52853 <colspec colwidth="8*" align="left"/>
52854 <colspec colwidth="6*" align="center"/>
52855 <colspec colwidth="6*" align="center"/>
52856 <colspec colwidth="6*" align="right"/>
52857 <tbody>
52858 <row>
52859 <entry><option>server_advertise_condition</option></entry>
52860 <entry>Use: <emphasis>authenticators</emphasis></entry>
52861 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52862 <entry>Default: <emphasis>unset</emphasis></entry>
52863 </row>
52864 </tbody>
52865 </tgroup>
52866 </informaltable>
52867 <para>
52868 When a server is about to advertise an authentication mechanism, the condition
52869 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
52870 mechanism is not advertised.
52871 If the expansion fails, the mechanism is not advertised. If the failure was not
52872 forced, and was not caused by a lookup defer, the incident is logged.
52873 See section <xref linkend="SECTauthexiser"/> below for further discussion.
52874 </para>
52875 <para>
52876 <indexterm role="option">
52877 <primary><option>server_condition</option></primary>
52878 </indexterm>
52879 </para>
52880 <informaltable frame="all">
52881 <tgroup cols="4" colsep="0" rowsep="0">
52882 <colspec colwidth="8*" align="left"/>
52883 <colspec colwidth="6*" align="center"/>
52884 <colspec colwidth="6*" align="center"/>
52885 <colspec colwidth="6*" align="right"/>
52886 <tbody>
52887 <row>
52888 <entry><option>server_condition</option></entry>
52889 <entry>Use: <emphasis>authenticators</emphasis></entry>
52890 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52891 <entry>Default: <emphasis>unset</emphasis></entry>
52892 </row>
52893 </tbody>
52894 </tgroup>
52895 </informaltable>
52896 <para>
52897 This option must be set for a <option>plaintext</option> server authenticator, where it
52898 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
52899 for details.
52900 </para>
52901 <para>
52902 For the <command>gsasl</command> authenticator, this option is required for various
52903 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
52904 </para>
52905 <para>
52906 For the other authenticators, <option>server_condition</option> can be used as an additional
52907 authentication or authorization mechanism that is applied after the other
52908 authenticator conditions succeed. If it is set, it is expanded when the
52909 authenticator would otherwise return a success code. If the expansion is forced
52910 to fail, authentication fails. Any other expansion failure causes a temporary
52911 error code to be returned. If the result of a successful expansion is an empty
52912 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
52913 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
52914 other result, a temporary error code is returned, with the expanded string as
52915 the error text.
52916 </para>
52917 <para>
52918 <indexterm role="option">
52919 <primary><option>server_debug_print</option></primary>
52920 </indexterm>
52921 </para>
52922 <informaltable frame="all">
52923 <tgroup cols="4" colsep="0" rowsep="0">
52924 <colspec colwidth="8*" align="left"/>
52925 <colspec colwidth="6*" align="center"/>
52926 <colspec colwidth="6*" align="center"/>
52927 <colspec colwidth="6*" align="right"/>
52928 <tbody>
52929 <row>
52930 <entry><option>server_debug_print</option></entry>
52931 <entry>Use: <emphasis>authenticators</emphasis></entry>
52932 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52933 <entry>Default: <emphasis>unset</emphasis></entry>
52934 </row>
52935 </tbody>
52936 </tgroup>
52937 </informaltable>
52938 <para>
52939 If this option is set and authentication debugging is enabled (see the <option>-d</option>
52940 command line option), the string is expanded and included in the debugging
52941 output when the authenticator is run as a server. This can help with checking
52942 out the values of variables.
52943 If expansion of the string fails, the error message is written to the debugging
52944 output, and Exim carries on processing.
52945 </para>
52946 <para>
52947 <indexterm role="option">
52948 <primary><option>server_set_id</option></primary>
52949 </indexterm>
52950 </para>
52951 <informaltable frame="all">
52952 <tgroup cols="4" colsep="0" rowsep="0">
52953 <colspec colwidth="8*" align="left"/>
52954 <colspec colwidth="6*" align="center"/>
52955 <colspec colwidth="6*" align="center"/>
52956 <colspec colwidth="6*" align="right"/>
52957 <tbody>
52958 <row>
52959 <entry><option>server_set_id</option></entry>
52960 <entry>Use: <emphasis>authenticators</emphasis></entry>
52961 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52962 <entry>Default: <emphasis>unset</emphasis></entry>
52963 </row>
52964 </tbody>
52965 </tgroup>
52966 </informaltable>
52967 <para>
52968 <indexterm role="variable">
52969 <primary><varname>$authenticated_id</varname></primary>
52970 </indexterm>
52971 <indexterm role="variable">
52972 <primary><varname>$authenticated_fail_id</varname></primary>
52973 </indexterm>
52974 When an Exim server successfully authenticates a client, this string is
52975 expanded using data from the authentication, and preserved for any incoming
52976 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
52977 lines for incoming messages. For example, a user/password authenticator
52978 configuration might preserve the user name that was used to authenticate, and
52979 refer to it subsequently during delivery of the message.
52980 On a failing authentication the expansion result is instead saved in
52981 the <varname>$authenticated_fail_id</varname> variable.
52982 If expansion fails, the option is ignored.
52983 </para>
52984 <para>
52985 <indexterm role="option">
52986 <primary><option>server_mail_auth_condition</option></primary>
52987 </indexterm>
52988 </para>
52989 <informaltable frame="all">
52990 <tgroup cols="4" colsep="0" rowsep="0">
52991 <colspec colwidth="8*" align="left"/>
52992 <colspec colwidth="6*" align="center"/>
52993 <colspec colwidth="6*" align="center"/>
52994 <colspec colwidth="6*" align="right"/>
52995 <tbody>
52996 <row>
52997 <entry><option>server_mail_auth_condition</option></entry>
52998 <entry>Use: <emphasis>authenticators</emphasis></entry>
52999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53000 <entry>Default: <emphasis>unset</emphasis></entry>
53001 </row>
53002 </tbody>
53003 </tgroup>
53004 </informaltable>
53005 <para>
53006 This option allows a server to discard authenticated sender addresses supplied
53007 as part of MAIL commands in SMTP connections that are authenticated by the
53008 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
53009 as part of the authentication process; instead its (unexpanded) value is
53010 remembered for later use.
53011 How it is used is described in the following section.
53012 </para>
53013 </section>
53014 <section id="SECTauthparamail">
53015 <title>The AUTH parameter on MAIL commands</title>
53016 <para>
53017 <indexterm role="concept">
53018 <primary>authentication</primary>
53019 <secondary>sender; authenticated</secondary>
53020 </indexterm>
53021 <indexterm role="concept">
53022 <primary>AUTH</primary>
53023 <secondary>on MAIL command</secondary>
53024 </indexterm>
53025 When a client supplied an AUTH= item on a MAIL command, Exim applies
53026 the following checks before accepting it as the authenticated sender of the
53027 message:
53028 </para>
53029 <itemizedlist>
53030 <listitem>
53031 <para>
53032 If the connection is not using extended SMTP (that is, HELO was used rather
53033 than EHLO), the use of AUTH= is a syntax error.
53034 </para>
53035 </listitem>
53036 <listitem>
53037 <para>
53038 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
53039 </para>
53040 </listitem>
53041 <listitem>
53042 <para>
53043 <indexterm role="variable">
53044 <primary><varname>$authenticated_sender</varname></primary>
53045 </indexterm>
53046 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
53047 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
53048 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
53049 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
53050 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
53051 given for the MAIL command.
53052 </para>
53053 </listitem>
53054 <listitem>
53055 <para>
53056 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
53057 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
53058 authenticated.
53059 </para>
53060 </listitem>
53061 <listitem>
53062 <para>
53063 If the AUTH= value was accepted by either of the two previous rules, and
53064 the client has authenticated, and the authenticator has a setting for the
53065 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
53066 valued that was saved from the authenticator is expanded. If the expansion
53067 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
53068 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
53069 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
53070 message.
53071 </para>
53072 </listitem>
53073 </itemizedlist>
53074 <para>
53075 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
53076 hosts to which Exim authenticates as a client. Do not confuse this value with
53077 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
53078 process, and which is not usually a complete email address.
53079 </para>
53080 <para>
53081 <indexterm role="variable">
53082 <primary><varname>$sender_address</varname></primary>
53083 </indexterm>
53084 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
53085 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
53086 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
53087 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
53088 ACL is run.
53089 </para>
53090 </section>
53091 <section id="SECTauthexiser">
53092 <title>Authentication on an Exim server</title>
53093 <para>
53094 <indexterm role="concept">
53095 <primary>authentication</primary>
53096 <secondary>on an Exim server</secondary>
53097 </indexterm>
53098 When Exim receives an EHLO command, it advertises the public names of those
53099 authenticators that are configured as servers, subject to the following
53100 conditions:
53101 </para>
53102 <itemizedlist>
53103 <listitem>
53104 <para>
53105 The client host must match <option>auth_advertise_hosts</option> (default *).
53106 </para>
53107 </listitem>
53108 <listitem>
53109 <para>
53110 It the <option>server_advertise_condition</option> option is set, its expansion must not
53111 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
53112 </para>
53113 </listitem>
53114 </itemizedlist>
53115 <para>
53116 The order in which the authenticators are defined controls the order in which
53117 the mechanisms are advertised.
53118 </para>
53119 <para>
53120 Some mail clients (for example, some versions of Netscape) require the user to
53121 provide a name and password for authentication whenever AUTH is advertised,
53122 even though authentication may not in fact be needed (for example, Exim may be
53123 set up to allow unconditional relaying from the client by an IP address check).
53124 You can make such clients more friendly by not advertising AUTH to them.
53125 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
53126 that runs for RCPT) to relay without authentication, you should set
53127 </para>
53128 <literallayout class="monospaced">
53129 auth_advertise_hosts = ! 10.9.8.0/24
53130 </literallayout>
53131 <para>
53132 so that no authentication mechanisms are advertised to them.
53133 </para>
53134 <para>
53135 The <option>server_advertise_condition</option> controls the advertisement of individual
53136 authentication mechanisms. For example, it can be used to restrict the
53137 advertisement of a particular mechanism to encrypted connections, by a setting
53138 such as:
53139 </para>
53140 <literallayout class="monospaced">
53141 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
53142 </literallayout>
53143 <para>
53144 <indexterm role="variable">
53145 <primary><varname>$tls_in_cipher</varname></primary>
53146 </indexterm>
53147 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
53148 yields <quote>yes</quote>, which allows the advertisement to happen.
53149 </para>
53150 <para>
53151 When an Exim server receives an AUTH command from a client, it rejects it
53152 immediately if AUTH was not advertised in response to an earlier EHLO
53153 command. This is the case if
53154 </para>
53155 <itemizedlist>
53156 <listitem>
53157 <para>
53158 The client host does not match <option>auth_advertise_hosts</option>; or
53159 </para>
53160 </listitem>
53161 <listitem>
53162 <para>
53163 No authenticators are configured with server options; or
53164 </para>
53165 </listitem>
53166 <listitem>
53167 <para>
53168 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
53169 server authenticators.
53170 </para>
53171 </listitem>
53172 </itemizedlist>
53173 <para>
53174 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
53175 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
53176 AUTH is accepted from any client host.
53177 </para>
53178 <para>
53179 If AUTH is not rejected by the ACL, Exim searches its configuration for a
53180 server authentication mechanism that was advertised in response to EHLO and
53181 that matches the one named in the AUTH command. If it finds one, it runs
53182 the appropriate authentication protocol, and authentication either succeeds or
53183 fails. If there is no matching advertised mechanism, the AUTH command is
53184 rejected with a 504 error.
53185 </para>
53186 <para>
53187 <indexterm role="variable">
53188 <primary><varname>$received_protocol</varname></primary>
53189 </indexterm>
53190 <indexterm role="variable">
53191 <primary><varname>$sender_host_authenticated</varname></primary>
53192 </indexterm>
53193 When a message is received from an authenticated host, the value of
53194 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
53195 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
53196 public name) of the authenticator driver that successfully authenticated the
53197 client from which the message was received. This variable is empty if there was
53198 no successful authentication.
53199 </para>
53200 <para>
53201 <indexterm role="concept">
53202 <primary>authentication</primary>
53203 <secondary>expansion item</secondary>
53204 </indexterm>
53205 Successful authentication sets up information used by the
53206 <option>authresults</option> expansion item.
53207 </para>
53208 </section>
53209 <section id="SECID169">
53210 <title>Testing server authentication</title>
53211 <para>
53212 <indexterm role="concept">
53213 <primary>authentication</primary>
53214 <secondary>testing a server</secondary>
53215 </indexterm>
53216 <indexterm role="concept">
53217 <primary>AUTH</primary>
53218 <secondary>testing a server</secondary>
53219 </indexterm>
53220 <indexterm role="concept">
53221 <primary>base64 encoding</primary>
53222 <secondary>creating authentication test data</secondary>
53223 </indexterm>
53224 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
53225 configurations. The data for the AUTH command has to be sent using base64
53226 encoding. A quick way to produce such data for testing is the following Perl
53227 script:
53228 </para>
53229 <literallayout class="monospaced">
53230 use MIME::Base64;
53231 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
53232 </literallayout>
53233 <para>
53234 <indexterm role="concept">
53235 <primary>binary zero</primary>
53236 <secondary>in authentication data</secondary>
53237 </indexterm>
53238 This interprets its argument as a Perl string, and then encodes it. The
53239 interpretation as a Perl string allows binary zeros, which are required for
53240 some kinds of authentication, to be included in the data. For example, a
53241 command line to run this script on such data might be
53242 </para>
53243 <literallayout class="monospaced">
53244 encode '\0user\0password'
53245 </literallayout>
53246 <para>
53247 Note the use of single quotes to prevent the shell interpreting the
53248 backslashes, so that they can be interpreted by Perl to specify characters
53249 whose code value is zero.
53250 </para>
53251 <para>
53252 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
53253 digit, you must use three zeros instead of one after the leading backslash. If
53254 you do not, the octal digit that starts your string will be incorrectly
53255 interpreted as part of the code for the first character.
53256 </para>
53257 <para>
53258 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
53259 specially, you must use a Perl escape to prevent them being misinterpreted. For
53260 example, a command such as
53261 </para>
53262 <literallayout class="monospaced">
53263 encode '\0user@domain.com\0pas$$word'
53264 </literallayout>
53265 <para>
53266 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
53267 </para>
53268 <para>
53269 If you have the <option>mimencode</option> command installed, another way to do produce
53270 base64-encoded strings is to run the command
53271 </para>
53272 <literallayout class="monospaced">
53273 echo -e -n `\0user\0password' | mimencode
53274 </literallayout>
53275 <para>
53276 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
53277 in the argument, and the <option>-n</option> option specifies no newline at the end of its
53278 output. However, not all versions of <option>echo</option> recognize these options, so you
53279 should check your version before relying on this suggestion.
53280 </para>
53281 </section>
53282 <section id="SECID170">
53283 <title>Authentication by an Exim client</title>
53284 <para>
53285 <indexterm role="concept">
53286 <primary>authentication</primary>
53287 <secondary>on an Exim client</secondary>
53288 </indexterm>
53289 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
53290 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
53291 announces support for authentication, and the host matches an entry in either
53292 of these options, Exim (as a client) tries to authenticate as follows:
53293 </para>
53294 <itemizedlist>
53295 <listitem>
53296 <para>
53297 For each authenticator that is configured as a client, in the order in which
53298 they are defined in the configuration, it searches the authentication
53299 mechanisms announced by the server for one whose name matches the public name
53300 of the authenticator.
53301 </para>
53302 </listitem>
53303 <listitem>
53304 <para>
53305 <indexterm role="variable">
53306 <primary><varname>$host</varname></primary>
53307 </indexterm>
53308 <indexterm role="variable">
53309 <primary><varname>$host_address</varname></primary>
53310 </indexterm>
53311 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
53312 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
53313 that the client might do. They are set to the server&#x2019;s name and IP address. If
53314 any expansion is forced to fail, the authentication attempt is abandoned, and
53315 Exim moves on to the next authenticator. Otherwise an expansion failure causes
53316 delivery to be deferred.
53317 </para>
53318 </listitem>
53319 <listitem>
53320 <para>
53321 If the result of the authentication attempt is a temporary error or a timeout,
53322 Exim abandons trying to send the message to the host for the moment. It will
53323 try again later. If there are any backup hosts available, they are tried in the
53324 usual way.
53325 </para>
53326 </listitem>
53327 <listitem>
53328 <para>
53329 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
53330 carries on searching the list of authenticators and tries another one if
53331 possible. If all authentication attempts give permanent errors, or if there are
53332 no attempts because no mechanisms match (or option expansions force failure),
53333 what happens depends on whether the host matches <option>hosts_require_auth</option> or
53334 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
53335 delivery is deferred. The error can be detected in the retry rules, and thereby
53336 turned into a permanent error if you wish. In the second case, Exim tries to
53337 deliver the message unauthenticated.
53338 </para>
53339 </listitem>
53340 </itemizedlist>
53341 <para>
53342 Note that the hostlist test for whether to do authentication can be
53343 confused if name-IP lookups change between the time the peer is decided
53344 upon and the time that the transport runs.  For example, with a manualroute
53345 router given a host name, and with DNS "round-robin" used by that name: if
53346 the local resolver cache times out between the router and the transport
53347 running, the transport may get an IP for the name for its authentication
53348 check which does not match the connection peer IP.
53349 No authentication will then be done, despite the names being identical.
53350 </para>
53351 <para>
53352 For such cases use a separate transport which always authenticates.
53353 </para>
53354 <para>
53355 <indexterm role="concept">
53356 <primary>AUTH</primary>
53357 <secondary>on MAIL command</secondary>
53358 </indexterm>
53359 When Exim has authenticated itself to a remote server, it adds the AUTH
53360 parameter to the MAIL commands it sends, if it has an authenticated sender for
53361 the message. If the message came from a remote host, the authenticated sender
53362 is the one that was receiving on an incoming MAIL command, provided that the
53363 incoming connection was authenticated and the <option>server_mail_auth</option> condition
53364 allowed the authenticated sender to be retained. If a local process calls Exim
53365 to send a message, the sender address that is built from the login name and
53366 <option>qualify_domain</option> is treated as authenticated. However, if the
53367 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
53368 the authenticated sender that was received with the message.
53369 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
53370 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
53371 </para>
53372 </section>
53373 </chapter>
53374
53375 <chapter id="CHAPplaintext">
53376 <title>The plaintext authenticator</title>
53377 <para>
53378 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
53379 <primary><command>plaintext</command> authenticator</primary>
53380 </indexterm>
53381 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
53382 <primary>authenticators</primary>
53383 <secondary><command>plaintext</command></secondary>
53384 </indexterm>
53385 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
53386 LOGIN authentication mechanisms, both of which transfer authentication data as
53387 plain (unencrypted) text (though base64 encoded). The use of plain text is a
53388 security risk; you are strongly advised to insist on the use of SMTP encryption
53389 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
53390 use unencrypted plain text, you should not use the same passwords for SMTP
53391 connections as you do for login accounts.
53392 </para>
53393 <section id="SECTplain_TLS">
53394 <title>Avoiding cleartext use</title>
53395 <para>
53396 The following generic option settings will disable <command>plaintext</command> authenticators when
53397 TLS is not being used:
53398 </para>
53399 <literallayout class="monospaced">
53400   server_advertise_condition = ${if def:tls_in_cipher }
53401   client_condition =           ${if def:tls_out_cipher}
53402 </literallayout>
53403 <para>
53404 <emphasis role="bold">Note</emphasis>: a plaintext SMTP AUTH done inside TLS is not vulnerable to casual snooping,
53405 but is still vulnerable to a Man In The Middle attack unless certificates
53406 (including their names) have been properly verified.
53407 </para>
53408 </section>
53409 <section id="SECID171">
53410 <title>Plaintext server options</title>
53411 <para>
53412 <indexterm role="concept">
53413 <primary>options</primary>
53414 <secondary><command>plaintext</command> authenticator (server)</secondary>
53415 </indexterm>
53416 When configured as a server, <command>plaintext</command> uses the following options:
53417 </para>
53418 <para>
53419 <indexterm role="option">
53420 <primary><option>server_condition</option></primary>
53421 </indexterm>
53422 </para>
53423 <informaltable frame="all">
53424 <tgroup cols="4" colsep="0" rowsep="0">
53425 <colspec colwidth="8*" align="left"/>
53426 <colspec colwidth="6*" align="center"/>
53427 <colspec colwidth="6*" align="center"/>
53428 <colspec colwidth="6*" align="right"/>
53429 <tbody>
53430 <row>
53431 <entry><option>server_condition</option></entry>
53432 <entry>Use: <emphasis>authenticators</emphasis></entry>
53433 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53434 <entry>Default: <emphasis>unset</emphasis></entry>
53435 </row>
53436 </tbody>
53437 </tgroup>
53438 </informaltable>
53439 <para>
53440 This is actually a global authentication option, but it must be set in order to
53441 configure the <command>plaintext</command> driver as a server. Its use is described below.
53442 </para>
53443 <para>
53444 <indexterm role="option">
53445 <primary><option>server_prompts</option></primary>
53446 </indexterm>
53447 </para>
53448 <informaltable frame="all">
53449 <tgroup cols="4" colsep="0" rowsep="0">
53450 <colspec colwidth="8*" align="left"/>
53451 <colspec colwidth="6*" align="center"/>
53452 <colspec colwidth="6*" align="center"/>
53453 <colspec colwidth="6*" align="right"/>
53454 <tbody>
53455 <row>
53456 <entry><option>server_prompts</option></entry>
53457 <entry>Use: <emphasis>plaintext</emphasis></entry>
53458 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
53459 <entry>Default: <emphasis>unset</emphasis></entry>
53460 </row>
53461 </tbody>
53462 </tgroup>
53463 </informaltable>
53464 <para>
53465 The contents of this option, after expansion, must be a colon-separated list of
53466 prompt strings. If expansion fails, a temporary authentication rejection is
53467 given.
53468 </para>
53469 </section>
53470 <section id="SECTplainserver">
53471 <title>Using plaintext in a server</title>
53472 <para>
53473 <indexterm role="concept">
53474 <primary>AUTH</primary>
53475 <secondary>in <command>plaintext</command> authenticator</secondary>
53476 </indexterm>
53477 <indexterm role="concept">
53478 <primary>binary zero</primary>
53479 <secondary>in <command>plaintext</command> authenticator</secondary>
53480 </indexterm>
53481 <indexterm role="concept">
53482 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53483 <secondary>in <command>plaintext</command> authenticator</secondary>
53484 </indexterm>
53485 <indexterm role="variable">
53486 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
53487 </indexterm>
53488 <indexterm role="concept">
53489 <primary>base64 encoding</primary>
53490 <secondary>in <command>plaintext</command> authenticator</secondary>
53491 </indexterm>
53492 </para>
53493 <para>
53494 When running as a server, <command>plaintext</command> performs the authentication test by
53495 expanding a string. The data sent by the client with the AUTH command, or in
53496 response to subsequent prompts, is base64 encoded, and so may contain any byte
53497 values when decoded. If any data is supplied with the command, it is treated as
53498 a list of strings, separated by NULs (binary zeros), the first three of which
53499 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
53500 (neither LOGIN nor PLAIN uses more than three strings).
53501 </para>
53502 <para>
53503 For compatibility with previous releases of Exim, the values are also placed in
53504 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
53505 variables for this purpose is now deprecated, as it can lead to confusion in
53506 string expansions that also use them for other things.
53507 </para>
53508 <para>
53509 If there are more strings in <option>server_prompts</option> than the number of strings
53510 supplied with the AUTH command, the remaining prompts are used to obtain more
53511 data. Each response from the client may be a list of NUL-separated strings.
53512 </para>
53513 <para>
53514 <indexterm role="variable">
53515 <primary><varname>$authenticated_id</varname></primary>
53516 </indexterm>
53517 Once a sufficient number of data strings have been received,
53518 <option>server_condition</option> is expanded. If the expansion is forced to fail,
53519 authentication fails. Any other expansion failure causes a temporary error code
53520 to be returned. If the result of a successful expansion is an empty string,
53521 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
53522 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
53523 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
53524 For any other result, a temporary error code is returned, with the expanded
53525 string as the error text.
53526 </para>
53527 <para>
53528 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
53529 password, be sure to make the authentication fail if the user is unknown.
53530 There are good and bad examples at the end of the next section.
53531 </para>
53532 </section>
53533 <section id="SECID172">
53534 <title>The PLAIN authentication mechanism</title>
53535 <para>
53536 <indexterm role="concept">
53537 <primary>PLAIN authentication mechanism</primary>
53538 </indexterm>
53539 <indexterm role="concept">
53540 <primary>authentication</primary>
53541 <secondary>PLAIN</secondary>
53542 </indexterm>
53543 <indexterm role="concept">
53544 <primary>binary zero</primary>
53545 <secondary>in <command>plaintext</command> authenticator</secondary>
53546 </indexterm>
53547 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
53548 sent as one item of data (that is, one combined string containing two NUL
53549 separators). The data is sent either as part of the AUTH command, or
53550 subsequently in response to an empty prompt from the server.
53551 </para>
53552 <para>
53553 The second and third strings are a user name and a corresponding password.
53554 Using a single fixed user name and password as an example, this could be
53555 configured as follows:
53556 </para>
53557 <literallayout class="monospaced">
53558 fixed_plain:
53559   driver = plaintext
53560   public_name = PLAIN
53561   server_prompts = :
53562   server_condition = \
53563     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
53564   server_set_id = $auth2
53565 </literallayout>
53566 <para>
53567 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
53568 are exactly what we want here, so they need not be specified. Obviously, if the
53569 password contains expansion-significant characters such as dollar, backslash,
53570 or closing brace, they have to be escaped.
53571 </para>
53572 <para>
53573 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
53574 the end of a string list are ignored). If all the data comes as part of the
53575 AUTH command, as is commonly the case, the prompt is not used. This
53576 authenticator is advertised in the response to EHLO as
53577 </para>
53578 <literallayout class="monospaced">
53579 250-AUTH PLAIN
53580 </literallayout>
53581 <para>
53582 and a client host can authenticate itself by sending the command
53583 </para>
53584 <literallayout class="monospaced">
53585 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
53586 </literallayout>
53587 <para>
53588 As this contains three strings (more than the number of prompts), no further
53589 data is required from the client. Alternatively, the client may just send
53590 </para>
53591 <literallayout class="monospaced">
53592 AUTH PLAIN
53593 </literallayout>
53594 <para>
53595 to initiate authentication, in which case the server replies with an empty
53596 prompt. The client must respond with the combined data string.
53597 </para>
53598 <para>
53599 The data string is base64 encoded, as required by the RFC. This example,
53600 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;
53601 represents a zero byte. This is split up into three strings, the first of which
53602 is empty. The <option>server_condition</option> option in the authenticator checks that the
53603 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
53604 </para>
53605 <para>
53606 Having just one fixed user name and password, as in this example, is not very
53607 realistic, though for a small organization with only a handful of
53608 authenticating clients it could make sense.
53609 </para>
53610 <para>
53611 A more sophisticated instance of this authenticator could use the user name in
53612 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
53613 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
53614 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
53615 This is an incorrect example:
53616 </para>
53617 <literallayout class="monospaced">
53618 server_condition = \
53619   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
53620 </literallayout>
53621 <para>
53622 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
53623 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
53624 incorrect? It works fine for existing users, but consider what happens if a
53625 non-existent user name is given. The lookup fails, but as no success/failure
53626 strings are given for the lookup, it yields an empty string. Thus, to defeat
53627 the authentication, all a client has to do is to supply a non-existent user
53628 name and an empty password. The correct way of writing this test is:
53629 </para>
53630 <literallayout class="monospaced">
53631 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
53632   {${if eq{$value}{$auth3}}} {false}}
53633 </literallayout>
53634 <para>
53635 In this case, if the lookup succeeds, the result is checked; if the lookup
53636 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
53637 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
53638 always fails if its second argument is empty. However, the second way of
53639 writing the test makes the logic clearer.
53640 </para>
53641 </section>
53642 <section id="SECID173">
53643 <title>The LOGIN authentication mechanism</title>
53644 <para>
53645 <indexterm role="concept">
53646 <primary>LOGIN authentication mechanism</primary>
53647 </indexterm>
53648 <indexterm role="concept">
53649 <primary>authentication</primary>
53650 <secondary>LOGIN</secondary>
53651 </indexterm>
53652 The LOGIN authentication mechanism is not documented in any RFC, but is in use
53653 in a number of programs. No data is sent with the AUTH command. Instead, a
53654 user name and password are supplied separately, in response to prompts. The
53655 plaintext authenticator can be configured to support this as in this example:
53656 </para>
53657 <literallayout class="monospaced">
53658 fixed_login:
53659   driver = plaintext
53660   public_name = LOGIN
53661   server_prompts = User Name : Password
53662   server_condition = \
53663     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
53664   server_set_id = $auth1
53665 </literallayout>
53666 <para>
53667 Because of the way plaintext operates, this authenticator accepts data supplied
53668 with the AUTH command (in contravention of the specification of LOGIN), but
53669 if the client does not supply it (as is the case for LOGIN clients), the prompt
53670 strings are used to obtain two data items.
53671 </para>
53672 <para>
53673 Some clients are very particular about the precise text of the prompts. For
53674 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
53675 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
53676 strings. It uses the <option>ldapauth</option> expansion condition to check the user
53677 name and password by binding to an LDAP server:
53678 </para>
53679 <literallayout class="monospaced">
53680 login:
53681   driver = plaintext
53682   public_name = LOGIN
53683   server_prompts = Username:: : Password::
53684   server_condition = ${if and{{ \
53685     !eq{}{$auth1} }{ \
53686     ldapauth{\
53687       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
53688       pass=${quote:$auth2} \
53689       ldap://ldap.example.org/} }} }
53690   server_set_id = uid=$auth1,ou=people,o=example.org
53691 </literallayout>
53692 <para>
53693 We have to check that the username is not empty before using it, because LDAP
53694 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
53695 operator to correctly quote the DN for authentication. However, the basic
53696 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
53697 correct one to use for the password, because quoting is needed only to make
53698 the password conform to the Exim syntax. At the LDAP level, the password is an
53699 uninterpreted string.
53700 </para>
53701 </section>
53702 <section id="SECID174">
53703 <title>Support for different kinds of authentication</title>
53704 <para>
53705 A number of string expansion features are provided for the purpose of
53706 interfacing to different ways of user authentication. These include checking
53707 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
53708 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
53709 <xref linkend="SECTexpcond"/>.
53710 </para>
53711 </section>
53712 <section id="SECID175">
53713 <title>Using plaintext in a client</title>
53714 <para>
53715 <indexterm role="concept">
53716 <primary>options</primary>
53717 <secondary><command>plaintext</command> authenticator (client)</secondary>
53718 </indexterm>
53719 The <command>plaintext</command> authenticator has two client options:
53720 </para>
53721 <para>
53722 <indexterm role="option">
53723 <primary><option>client_ignore_invalid_base64</option></primary>
53724 </indexterm>
53725 </para>
53726 <informaltable frame="all">
53727 <tgroup cols="4" colsep="0" rowsep="0">
53728 <colspec colwidth="8*" align="left"/>
53729 <colspec colwidth="6*" align="center"/>
53730 <colspec colwidth="6*" align="center"/>
53731 <colspec colwidth="6*" align="right"/>
53732 <tbody>
53733 <row>
53734 <entry><option>client_ignore_invalid_base64</option></entry>
53735 <entry>Use: <emphasis>plaintext</emphasis></entry>
53736 <entry>Type: <emphasis>boolean</emphasis></entry>
53737 <entry>Default: <emphasis>false</emphasis></entry>
53738 </row>
53739 </tbody>
53740 </tgroup>
53741 </informaltable>
53742 <para>
53743 If the client receives a server prompt that is not a valid base64 string,
53744 authentication is abandoned by default. However, if this option is set true,
53745 the error in the challenge is ignored and the client sends the response as
53746 usual.
53747 </para>
53748 <para>
53749 <indexterm role="option">
53750 <primary><option>client_send</option></primary>
53751 </indexterm>
53752 </para>
53753 <informaltable frame="all">
53754 <tgroup cols="4" colsep="0" rowsep="0">
53755 <colspec colwidth="8*" align="left"/>
53756 <colspec colwidth="6*" align="center"/>
53757 <colspec colwidth="6*" align="center"/>
53758 <colspec colwidth="6*" align="right"/>
53759 <tbody>
53760 <row>
53761 <entry><option>client_send</option></entry>
53762 <entry>Use: <emphasis>plaintext</emphasis></entry>
53763 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53764 <entry>Default: <emphasis>unset</emphasis></entry>
53765 </row>
53766 </tbody>
53767 </tgroup>
53768 </informaltable>
53769 <para>
53770 The string is a colon-separated list of authentication data strings. Each
53771 string is independently expanded before being sent to the server. The first
53772 string is sent with the AUTH command; any more strings are sent in response
53773 to prompts from the server. Before each string is expanded, the value of the
53774 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
53775 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
53776 way. Thus, the prompt that is received in response to sending the first string
53777 (with the AUTH command) can be used in the expansion of the second string, and
53778 so on. If an invalid base64 string is received when
53779 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
53780 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
53781 </para>
53782 <para>
53783 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
53784 splitting takes priority and happens first.
53785 </para>
53786 <para>
53787 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
53788 the data, further processing is applied to each string before it is sent. If
53789 there are any single circumflex characters in the string, they are converted to
53790 NULs. Should an actual circumflex be required as data, it must be doubled in
53791 the string.
53792 </para>
53793 <para>
53794 This is an example of a client configuration that implements the PLAIN
53795 authentication mechanism with a fixed user name and password:
53796 </para>
53797 <literallayout class="monospaced">
53798 fixed_plain:
53799   driver = plaintext
53800   public_name = PLAIN
53801   client_send = ^username^mysecret
53802 </literallayout>
53803 <para>
53804 The lack of colons means that the entire text is sent with the AUTH
53805 command, with the circumflex characters converted to NULs.
53806 </para>
53807 <para revisionflag="changed">
53808 Note that due to the ambiguity of parsing three consectutive circumflex characters
53809 there is no way to provide a password having a leading circumflex.
53810 </para>
53811 <para>
53812 A similar example
53813 that uses the LOGIN mechanism is:
53814 </para>
53815 <literallayout class="monospaced">
53816 fixed_login:
53817   driver = plaintext
53818   public_name = LOGIN
53819   client_send = : username : mysecret
53820 </literallayout>
53821 <para>
53822 The initial colon means that the first string is empty, so no data is sent with
53823 the AUTH command itself. The remaining strings are sent in response to
53824 prompts.
53825 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
53826 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
53827 </para>
53828 </section>
53829 </chapter>
53830
53831 <chapter id="CHID9">
53832 <title>The cram_md5 authenticator</title>
53833 <para>
53834 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
53835 <primary><command>cram_md5</command> authenticator</primary>
53836 </indexterm>
53837 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
53838 <primary>authenticators</primary>
53839 <secondary><command>cram_md5</command></secondary>
53840 </indexterm>
53841 <indexterm role="concept">
53842 <primary>CRAM-MD5 authentication mechanism</primary>
53843 </indexterm>
53844 <indexterm role="concept">
53845 <primary>authentication</primary>
53846 <secondary>CRAM-MD5</secondary>
53847 </indexterm>
53848 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
53849 sends a challenge string to the client, and the response consists of a user
53850 name and the CRAM-MD5 digest of the challenge string combined with a secret
53851 string (password) which is known to both server and client. Thus, the secret
53852 is not sent over the network as plain text, which makes this authenticator more
53853 secure than <command>plaintext</command>. However, the downside is that the secret has to be
53854 available in plain text at either end.
53855 </para>
53856 <section id="SECID176">
53857 <title>Using cram_md5 as a server</title>
53858 <para>
53859 <indexterm role="concept">
53860 <primary>options</primary>
53861 <secondary><command>cram_md5</command> authenticator (server)</secondary>
53862 </indexterm>
53863 This authenticator has one server option, which must be set to configure the
53864 authenticator as a server:
53865 </para>
53866 <para>
53867 <indexterm role="option">
53868 <primary><option>server_secret</option></primary>
53869 </indexterm>
53870 </para>
53871 <informaltable frame="all">
53872 <tgroup cols="4" colsep="0" rowsep="0">
53873 <colspec colwidth="8*" align="left"/>
53874 <colspec colwidth="6*" align="center"/>
53875 <colspec colwidth="6*" align="center"/>
53876 <colspec colwidth="6*" align="right"/>
53877 <tbody>
53878 <row>
53879 <entry><option>server_secret</option></entry>
53880 <entry>Use: <emphasis>cram_md5</emphasis></entry>
53881 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53882 <entry>Default: <emphasis>unset</emphasis></entry>
53883 </row>
53884 </tbody>
53885 </tgroup>
53886 </informaltable>
53887 <para>
53888 <indexterm role="concept">
53889 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53890 <secondary>in <command>cram_md5</command> authenticator</secondary>
53891 </indexterm>
53892 When the server receives the client&#x2019;s response, the user name is placed in
53893 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
53894 obtain the password for that user. The server then computes the CRAM-MD5 digest
53895 that the client should have sent, and checks that it received the correct
53896 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
53897 fails. If the expansion fails for some other reason, a temporary error code is
53898 returned to the client.
53899 </para>
53900 <para>
53901 For compatibility with previous releases of Exim, the user name is also placed
53902 in <varname>$1</varname>. However, the use of this variables for this purpose is now
53903 deprecated, as it can lead to confusion in string expansions that also use
53904 numeric variables for other things.
53905 </para>
53906 <para>
53907 For example, the following authenticator checks that the user name given by the
53908 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
53909 user name, authentication fails.
53910 </para>
53911 <literallayout class="monospaced">
53912 fixed_cram:
53913   driver = cram_md5
53914   public_name = CRAM-MD5
53915   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
53916   server_set_id = $auth1
53917 </literallayout>
53918 <para>
53919 <indexterm role="variable">
53920 <primary><varname>$authenticated_id</varname></primary>
53921 </indexterm>
53922 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
53923 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
53924 secret string in a file, using the user name as the key. For example:
53925 </para>
53926 <literallayout class="monospaced">
53927 lookup_cram:
53928   driver = cram_md5
53929   public_name = CRAM-MD5
53930   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
53931                   {$value}fail}
53932   server_set_id = $auth1
53933 </literallayout>
53934 <para>
53935 Note that this expansion explicitly forces failure if the lookup fails
53936 because <varname>$auth1</varname> contains an unknown user name.
53937 </para>
53938 <para>
53939 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
53940 using the relevant libraries, you need to know the realm to specify in the
53941 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
53942 realm, with:
53943 </para>
53944 <literallayout class="monospaced">
53945 cyrusless_crammd5:
53946   driver = cram_md5
53947   public_name = CRAM-MD5
53948   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
53949                   dbmjz{/etc/sasldb2}{$value}fail}
53950   server_set_id = $auth1
53951 </literallayout>
53952 </section>
53953 <section id="SECID177">
53954 <title>Using cram_md5 as a client</title>
53955 <para>
53956 <indexterm role="concept">
53957 <primary>options</primary>
53958 <secondary><command>cram_md5</command> authenticator (client)</secondary>
53959 </indexterm>
53960 When used as a client, the <command>cram_md5</command> authenticator has two options:
53961 </para>
53962 <para>
53963 <indexterm role="option">
53964 <primary><option>client_name</option></primary>
53965 </indexterm>
53966 </para>
53967 <informaltable frame="all">
53968 <tgroup cols="4" colsep="0" rowsep="0">
53969 <colspec colwidth="8*" align="left"/>
53970 <colspec colwidth="6*" align="center"/>
53971 <colspec colwidth="6*" align="center"/>
53972 <colspec colwidth="6*" align="right"/>
53973 <tbody>
53974 <row>
53975 <entry><option>client_name</option></entry>
53976 <entry>Use: <emphasis>cram_md5</emphasis></entry>
53977 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
53978 <entry>Default: <emphasis>the primary host name</emphasis></entry>
53979 </row>
53980 </tbody>
53981 </tgroup>
53982 </informaltable>
53983 <para>
53984 This string is expanded, and the result used as the user name data when
53985 computing the response to the server&#x2019;s challenge.
53986 </para>
53987 <para>
53988 <indexterm role="option">
53989 <primary><option>client_secret</option></primary>
53990 </indexterm>
53991 </para>
53992 <informaltable frame="all">
53993 <tgroup cols="4" colsep="0" rowsep="0">
53994 <colspec colwidth="8*" align="left"/>
53995 <colspec colwidth="6*" align="center"/>
53996 <colspec colwidth="6*" align="center"/>
53997 <colspec colwidth="6*" align="right"/>
53998 <tbody>
53999 <row>
54000 <entry><option>client_secret</option></entry>
54001 <entry>Use: <emphasis>cram_md5</emphasis></entry>
54002 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54003 <entry>Default: <emphasis>unset</emphasis></entry>
54004 </row>
54005 </tbody>
54006 </tgroup>
54007 </informaltable>
54008 <para>
54009 This option must be set for the authenticator to work as a client. Its value is
54010 expanded and the result used as the secret string when computing the response.
54011 </para>
54012 <para>
54013 <indexterm role="variable">
54014 <primary><varname>$host</varname></primary>
54015 </indexterm>
54016 <indexterm role="variable">
54017 <primary><varname>$host_address</varname></primary>
54018 </indexterm>
54019 Different user names and secrets can be used for different servers by referring
54020 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
54021 expansion string is treated as an indication that this authenticator is not
54022 prepared to handle this case. Exim moves on to the next configured client
54023 authenticator. Any other expansion failure causes Exim to give up trying to
54024 send the message to the current server.
54025 </para>
54026 <para>
54027 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
54028 strings, is:
54029 </para>
54030 <literallayout class="monospaced">
54031 fixed_cram:
54032   driver = cram_md5
54033   public_name = CRAM-MD5
54034   client_name = ph10
54035   client_secret = secret
54036 </literallayout>
54037 <para>
54038 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
54039 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
54040 </para>
54041 </section>
54042 </chapter>
54043
54044 <chapter id="CHID10">
54045 <title>The cyrus_sasl authenticator</title>
54046 <para>
54047 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
54048 <primary><command>cyrus_sasl</command> authenticator</primary>
54049 </indexterm>
54050 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
54051 <primary>authenticators</primary>
54052 <secondary><command>cyrus_sasl</command></secondary>
54053 </indexterm>
54054 <indexterm role="concept">
54055 <primary>Cyrus</primary>
54056 <secondary>SASL library</secondary>
54057 </indexterm>
54058 <indexterm role="concept">
54059 <primary>Kerberos</primary>
54060 </indexterm>
54061 The code for this authenticator was provided by Matthew Byng-Maddick while
54062 at A L Digital Ltd.
54063 </para>
54064 <para>
54065 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
54066 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
54067 Layer</quote>). This library supports a number of authentication mechanisms,
54068 including PLAIN and LOGIN, but also several others that Exim does not support
54069 directly. In particular, there is support for Kerberos authentication.
54070 </para>
54071 <para>
54072 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
54073 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
54074 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
54075 name of the driver to determine which mechanism to support.
54076 </para>
54077 <para>
54078 Where access to some kind of secret file is required, for example, in GSSAPI
54079 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
54080 user, and that the Cyrus SASL library has no way of escalating privileges
54081 by default. You may also find you need to set environment variables,
54082 depending on the driver you are using.
54083 </para>
54084 <para>
54085 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
54086 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
54087 Kerberos, note that because of limitations in the GSSAPI interface,
54088 changing the server keytab might need to be communicated down to the Kerberos
54089 layer independently. The mechanism for doing so is dependent upon the Kerberos
54090 implementation.
54091 </para>
54092 <para>
54093 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
54094 may be set to point to an alternative keytab file. Exim will pass this
54095 variable through from its own inherited environment when started as root or the
54096 Exim user. The keytab file needs to be readable by the Exim user.
54097 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
54098 environment variable.  In practice, for those releases, the Cyrus authenticator
54099 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
54100 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
54101 </para>
54102 <section id="SECID178">
54103 <title>Using cyrus_sasl as a server</title>
54104 <para>
54105 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
54106 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
54107 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
54108 use of this variable for this purpose is now deprecated, as it can lead to
54109 confusion in string expansions that also use numeric variables for other
54110 things.
54111 </para>
54112 <para>
54113 <indexterm role="option">
54114 <primary><option>server_hostname</option></primary>
54115 </indexterm>
54116 </para>
54117 <informaltable frame="all">
54118 <tgroup cols="4" colsep="0" rowsep="0">
54119 <colspec colwidth="8*" align="left"/>
54120 <colspec colwidth="6*" align="center"/>
54121 <colspec colwidth="6*" align="center"/>
54122 <colspec colwidth="6*" align="right"/>
54123 <tbody>
54124 <row>
54125 <entry><option>server_hostname</option></entry>
54126 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54127 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54128 <entry>Default: <emphasis>see below</emphasis></entry>
54129 </row>
54130 </tbody>
54131 </tgroup>
54132 </informaltable>
54133 <para>
54134 This option selects the hostname that is used when communicating with the
54135 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
54136 SASL plug-in what it does with this data.
54137 </para>
54138 <para>
54139 <indexterm role="option">
54140 <primary><option>server_mech</option></primary>
54141 </indexterm>
54142 </para>
54143 <informaltable frame="all">
54144 <tgroup cols="4" colsep="0" rowsep="0">
54145 <colspec colwidth="8*" align="left"/>
54146 <colspec colwidth="6*" align="center"/>
54147 <colspec colwidth="6*" align="center"/>
54148 <colspec colwidth="6*" align="right"/>
54149 <tbody>
54150 <row>
54151 <entry><option>server_mech</option></entry>
54152 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54153 <entry>Type: <emphasis>string</emphasis></entry>
54154 <entry>Default: <emphasis>see below</emphasis></entry>
54155 </row>
54156 </tbody>
54157 </tgroup>
54158 </informaltable>
54159 <para>
54160 This option selects the authentication mechanism this driver should use. The
54161 default is the value of the generic <option>public_name</option> option. This option allows
54162 you to use a different underlying mechanism from the advertised name. For
54163 example:
54164 </para>
54165 <literallayout class="monospaced">
54166 sasl:
54167   driver = cyrus_sasl
54168   public_name = X-ANYTHING
54169   server_mech = CRAM-MD5
54170   server_set_id = $auth1
54171 </literallayout>
54172 <para>
54173 <indexterm role="option">
54174 <primary><option>server_realm</option></primary>
54175 </indexterm>
54176 </para>
54177 <informaltable frame="all">
54178 <tgroup cols="4" colsep="0" rowsep="0">
54179 <colspec colwidth="8*" align="left"/>
54180 <colspec colwidth="6*" align="center"/>
54181 <colspec colwidth="6*" align="center"/>
54182 <colspec colwidth="6*" align="right"/>
54183 <tbody>
54184 <row>
54185 <entry><option>server_realm</option></entry>
54186 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54187 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54188 <entry>Default: <emphasis>unset</emphasis></entry>
54189 </row>
54190 </tbody>
54191 </tgroup>
54192 </informaltable>
54193 <para>
54194 This specifies the SASL realm that the server claims to be in.
54195 </para>
54196 <para>
54197 <indexterm role="option">
54198 <primary><option>server_service</option></primary>
54199 </indexterm>
54200 </para>
54201 <informaltable frame="all">
54202 <tgroup cols="4" colsep="0" rowsep="0">
54203 <colspec colwidth="8*" align="left"/>
54204 <colspec colwidth="6*" align="center"/>
54205 <colspec colwidth="6*" align="center"/>
54206 <colspec colwidth="6*" align="right"/>
54207 <tbody>
54208 <row>
54209 <entry><option>server_service</option></entry>
54210 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
54211 <entry>Type: <emphasis>string</emphasis></entry>
54212 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
54213 </row>
54214 </tbody>
54215 </tgroup>
54216 </informaltable>
54217 <para>
54218 This is the SASL service that the server claims to implement.
54219 </para>
54220 <para>
54221 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
54222 private options. All you need to do is to specify an appropriate mechanism as
54223 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
54224 PLAIN, you could have two authenticators as follows:
54225 </para>
54226 <literallayout class="monospaced">
54227 sasl_cram_md5:
54228   driver = cyrus_sasl
54229   public_name = CRAM-MD5
54230   server_set_id = $auth1
54231
54232 sasl_plain:
54233   driver = cyrus_sasl
54234   public_name = PLAIN
54235   server_set_id = $auth2
54236 </literallayout>
54237 <para>
54238 Cyrus SASL does implement the LOGIN authentication method, even though it is
54239 not a standard method. It is disabled by default in the source distribution,
54240 but it is present in many binary distributions.
54241 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
54242 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
54243 </para>
54244 </section>
54245 </chapter>
54246
54247 <chapter id="CHAPdovecot">
54248 <title>The dovecot authenticator</title>
54249 <para>
54250 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
54251 <primary><command>dovecot</command> authenticator</primary>
54252 </indexterm>
54253 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
54254 <primary>authenticators</primary>
54255 <secondary><command>dovecot</command></secondary>
54256 </indexterm>
54257 This authenticator is an interface to the authentication facility of the
54258 Dovecot 2 POP/IMAP server, which can support a number of authentication methods.
54259 Note that Dovecot must be configured to use auth-client not auth-userdb.
54260 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
54261 to use the same mechanisms for SMTP authentication. This is a server
54262 authenticator only. There is only one option:
54263 </para>
54264 <para>
54265 <indexterm role="option">
54266 <primary><option>server_socket</option></primary>
54267 </indexterm>
54268 </para>
54269 <informaltable frame="all">
54270 <tgroup cols="4" colsep="0" rowsep="0">
54271 <colspec colwidth="8*" align="left"/>
54272 <colspec colwidth="6*" align="center"/>
54273 <colspec colwidth="6*" align="center"/>
54274 <colspec colwidth="6*" align="right"/>
54275 <tbody>
54276 <row>
54277 <entry><option>server_socket</option></entry>
54278 <entry>Use: <emphasis>dovecot</emphasis></entry>
54279 <entry>Type: <emphasis>string</emphasis></entry>
54280 <entry>Default: <emphasis>unset</emphasis></entry>
54281 </row>
54282 </tbody>
54283 </tgroup>
54284 </informaltable>
54285 <para>
54286 This option must specify the UNIX socket that is the interface to Dovecot
54287 authentication. The <option>public_name</option> option must specify an authentication
54288 mechanism that Dovecot is configured to support. You can have several
54289 authenticators for different mechanisms. For example:
54290 </para>
54291 <literallayout class="monospaced">
54292 dovecot_plain:
54293   driver = dovecot
54294   public_name = PLAIN
54295   server_socket = /var/run/dovecot/auth-client
54296   server_set_id = $auth1
54297
54298 dovecot_ntlm:
54299   driver = dovecot
54300   public_name = NTLM
54301   server_socket = /var/run/dovecot/auth-client
54302   server_set_id = $auth1
54303 </literallayout>
54304 <para>
54305 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
54306 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
54307 option is passed in the Dovecot authentication command. If, for a TLS
54308 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
54309 option is passed. When authentication succeeds, the identity of the user
54310 who authenticated is placed in <varname>$auth1</varname>.
54311 </para>
54312 <para revisionflag="changed">
54313 The Dovecot configuration to match the above wil look
54314 something like:
54315 </para>
54316 <literallayout class="monospaced" revisionflag="changed">
54317 conf.d/10-master.conf :-
54318
54319 service auth {
54320 ...
54321 #SASL
54322   unix_listener auth-client {
54323     mode = 0660
54324     user = mail
54325   }
54326 ...
54327 }
54328
54329 conf.d/10-auth.conf :-
54330
54331 auth_mechanisms = plain login ntlm
54332 </literallayout>
54333 <para>
54334 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
54335 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
54336 </para>
54337 </chapter>
54338
54339 <chapter id="CHAPgsasl">
54340 <title>The gsasl authenticator</title>
54341 <para>
54342 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
54343 <primary><command>gsasl</command> authenticator</primary>
54344 </indexterm>
54345 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
54346 <primary>authenticators</primary>
54347 <secondary><command>gsasl</command></secondary>
54348 </indexterm>
54349 <indexterm role="concept">
54350 <primary>authentication</primary>
54351 <secondary>GNU SASL</secondary>
54352 </indexterm>
54353 <indexterm role="concept">
54354 <primary>authentication</primary>
54355 <secondary>SASL</secondary>
54356 </indexterm>
54357 <indexterm role="concept">
54358 <primary>authentication</primary>
54359 <secondary>EXTERNAL</secondary>
54360 </indexterm>
54361 <indexterm role="concept">
54362 <primary>authentication</primary>
54363 <secondary>ANONYMOUS</secondary>
54364 </indexterm>
54365 <indexterm role="concept">
54366 <primary>authentication</primary>
54367 <secondary>PLAIN</secondary>
54368 </indexterm>
54369 <indexterm role="concept">
54370 <primary>authentication</primary>
54371 <secondary>LOGIN</secondary>
54372 </indexterm>
54373 <indexterm role="concept">
54374 <primary>authentication</primary>
54375 <secondary>DIGEST-MD5</secondary>
54376 </indexterm>
54377 <indexterm role="concept">
54378 <primary>authentication</primary>
54379 <secondary>CRAM-MD5</secondary>
54380 </indexterm>
54381 <indexterm role="concept">
54382 <primary>authentication</primary>
54383 <secondary>SCRAM family</secondary>
54384 </indexterm>
54385 The <command>gsasl</command> authenticator provides integration for the GNU SASL
54386 library and the mechanisms it provides.  This is new as of the 4.80 release
54387 and there are a few areas where the library does not let Exim smoothly
54388 scale to handle future authentication mechanisms, so no guarantee can be
54389 made that any particular new authentication mechanism will be supported
54390 without code changes in Exim.
54391 </para>
54392 <para revisionflag="changed">
54393 The library is expected to add support in an upcoming
54394 realease for the SCRAM-SHA-256 method.
54395 The macro _HAVE_AUTH_GSASL_SCRAM_SHA_256 will be defined
54396 when this happens.
54397 </para>
54398 <para revisionflag="changed">
54399 <indexterm role="option">
54400 <primary><option>client_authz</option></primary>
54401 </indexterm>
54402 </para>
54403 <informaltable frame="all" revisionflag="changed">
54404 <tgroup cols="4" colsep="0" rowsep="0">
54405 <colspec colwidth="8*" align="left"/>
54406 <colspec colwidth="6*" align="center"/>
54407 <colspec colwidth="6*" align="center"/>
54408 <colspec colwidth="6*" align="right"/>
54409 <tbody>
54410 <row>
54411 <entry><option>client_authz</option></entry>
54412 <entry>Use: <emphasis>gsasl</emphasis></entry>
54413 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54414 <entry>Default: <emphasis>unset</emphasis></entry>
54415 </row>
54416 </tbody>
54417 </tgroup>
54418 </informaltable>
54419 <para revisionflag="changed">
54420 This option can be used to supply an <emphasis>authorization id</emphasis>
54421 which is different to the <emphasis>authentication_id</emphasis> provided
54422 by <option>client_username</option> option.
54423 If unset or (after expansion) empty it is not used,
54424 which is the common case.
54425 </para>
54426 <para revisionflag="changed">
54427 <indexterm role="option">
54428 <primary><option>client_channelbinding</option></primary>
54429 </indexterm>
54430 </para>
54431 <informaltable frame="all" revisionflag="changed">
54432 <tgroup cols="4" colsep="0" rowsep="0">
54433 <colspec colwidth="8*" align="left"/>
54434 <colspec colwidth="6*" align="center"/>
54435 <colspec colwidth="6*" align="center"/>
54436 <colspec colwidth="6*" align="right"/>
54437 <tbody>
54438 <row>
54439 <entry><option>client_channelbinding</option></entry>
54440 <entry>Use: <emphasis>gsasl</emphasis></entry>
54441 <entry>Type: <emphasis>boolean</emphasis></entry>
54442 <entry>Default: <emphasis>false</emphasis></entry>
54443 </row>
54444 </tbody>
54445 </tgroup>
54446 </informaltable>
54447 <para revisionflag="changed">
54448 See <option>server_channelbinding</option> below.
54449 </para>
54450 <para revisionflag="changed">
54451 <indexterm role="option">
54452 <primary><option>client_password</option></primary>
54453 </indexterm>
54454 </para>
54455 <informaltable frame="all" revisionflag="changed">
54456 <tgroup cols="4" colsep="0" rowsep="0">
54457 <colspec colwidth="8*" align="left"/>
54458 <colspec colwidth="6*" align="center"/>
54459 <colspec colwidth="6*" align="center"/>
54460 <colspec colwidth="6*" align="right"/>
54461 <tbody>
54462 <row>
54463 <entry><option>client_password</option></entry>
54464 <entry>Use: <emphasis>gsasl</emphasis></entry>
54465 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54466 <entry>Default: <emphasis>unset</emphasis></entry>
54467 </row>
54468 </tbody>
54469 </tgroup>
54470 </informaltable>
54471 <para revisionflag="changed">
54472 This option is exapanded before use, and should result in
54473 the password to be used, in clear.
54474 </para>
54475 <para revisionflag="changed">
54476 <indexterm role="option">
54477 <primary><option>client_username</option></primary>
54478 </indexterm>
54479 </para>
54480 <informaltable frame="all" revisionflag="changed">
54481 <tgroup cols="4" colsep="0" rowsep="0">
54482 <colspec colwidth="8*" align="left"/>
54483 <colspec colwidth="6*" align="center"/>
54484 <colspec colwidth="6*" align="center"/>
54485 <colspec colwidth="6*" align="right"/>
54486 <tbody>
54487 <row>
54488 <entry><option>client_username</option></entry>
54489 <entry>Use: <emphasis>gsasl</emphasis></entry>
54490 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54491 <entry>Default: <emphasis>unset</emphasis></entry>
54492 </row>
54493 </tbody>
54494 </tgroup>
54495 </informaltable>
54496 <para revisionflag="changed">
54497 This option is exapanded before use, and should result in
54498 the account name to be used.
54499 </para>
54500 <para revisionflag="changed">
54501 <indexterm role="option">
54502 <primary><option>client_spassword</option></primary>
54503 </indexterm>
54504 </para>
54505 <informaltable frame="all" revisionflag="changed">
54506 <tgroup cols="4" colsep="0" rowsep="0">
54507 <colspec colwidth="8*" align="left"/>
54508 <colspec colwidth="6*" align="center"/>
54509 <colspec colwidth="6*" align="center"/>
54510 <colspec colwidth="6*" align="right"/>
54511 <tbody>
54512 <row>
54513 <entry><option>client_spassword</option></entry>
54514 <entry>Use: <emphasis>gsasl</emphasis></entry>
54515 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54516 <entry>Default: <emphasis>unset</emphasis></entry>
54517 </row>
54518 </tbody>
54519 </tgroup>
54520 </informaltable>
54521 <para revisionflag="changed">
54522 If a SCRAM mechanism is being used and this option is set
54523 it is used in preference to <option>client_password</option>.
54524 The value after expansion should be
54525 a 40 (for SHA-1) or 64 (for SHA-256) character string
54526 with the PBKDF2-prepared password, hex-encoded.
54527 Note that this value will depend on the salt and iteration-count
54528 supplied by the server.
54529 </para>
54530 <para>
54531 <indexterm role="option">
54532 <primary><option>server_channelbinding</option></primary>
54533 </indexterm>
54534 </para>
54535 <informaltable frame="all">
54536 <tgroup cols="4" colsep="0" rowsep="0">
54537 <colspec colwidth="8*" align="left"/>
54538 <colspec colwidth="6*" align="center"/>
54539 <colspec colwidth="6*" align="center"/>
54540 <colspec colwidth="6*" align="right"/>
54541 <tbody>
54542 <row>
54543 <entry><option>server_channelbinding</option></entry>
54544 <entry>Use: <emphasis>gsasl</emphasis></entry>
54545 <entry>Type: <emphasis>boolean</emphasis></entry>
54546 <entry>Default: <emphasis>false</emphasis></entry>
54547 </row>
54548 </tbody>
54549 </tgroup>
54550 </informaltable>
54551 <para>
54552 Do not set this true and rely on the properties
54553 without consulting a cryptographic engineer.
54554 </para>
54555 <para>
54556 Some authentication mechanisms are able to use external context at both ends
54557 of the session to bind the authentication to that context, and fail the
54558 authentication process if that context differs.  Specifically, some TLS
54559 ciphersuites can provide identifying information about the cryptographic
54560 context.
54561 </para>
54562 <para>
54563 This should have meant that certificate identity and verification becomes a
54564 non-issue, as a man-in-the-middle attack will cause the correct client and
54565 server to see different identifiers and authentication will fail.
54566 </para>
54567 <para revisionflag="changed">
54568 This is
54569 only usable by mechanisms which support "channel binding"; at time of
54570 writing, that&#x2019;s the SCRAM family.
54571 When using this feature the "-PLUS" variants of the method names need to be used.
54572 </para>
54573 <para>
54574 This defaults off to ensure smooth upgrade across Exim releases, in case
54575 this option causes some clients to start failing.  Some future release
54576 of Exim might have switched the default to be true.
54577 </para>
54578 <para>
54579 However, Channel Binding in TLS has proven to be vulnerable in current versions.
54580 Do not plan to rely upon this feature for security, ever, without consulting
54581 with a subject matter expert (a cryptographic engineer).
54582 </para>
54583 <para>
54584 <indexterm role="option">
54585 <primary><option>server_hostname</option></primary>
54586 </indexterm>
54587 </para>
54588 <informaltable frame="all">
54589 <tgroup cols="4" colsep="0" rowsep="0">
54590 <colspec colwidth="8*" align="left"/>
54591 <colspec colwidth="6*" align="center"/>
54592 <colspec colwidth="6*" align="center"/>
54593 <colspec colwidth="6*" align="right"/>
54594 <tbody>
54595 <row>
54596 <entry><option>server_hostname</option></entry>
54597 <entry>Use: <emphasis>gsasl</emphasis></entry>
54598 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54599 <entry>Default: <emphasis>see below</emphasis></entry>
54600 </row>
54601 </tbody>
54602 </tgroup>
54603 </informaltable>
54604 <para>
54605 This option selects the hostname that is used when communicating with the
54606 library. The default value is <literal>$primary_hostname</literal>.
54607 Some mechanisms will use this data.
54608 </para>
54609 <para>
54610 <indexterm role="option">
54611 <primary><option>server_mech</option></primary>
54612 </indexterm>
54613 </para>
54614 <informaltable frame="all">
54615 <tgroup cols="4" colsep="0" rowsep="0">
54616 <colspec colwidth="8*" align="left"/>
54617 <colspec colwidth="6*" align="center"/>
54618 <colspec colwidth="6*" align="center"/>
54619 <colspec colwidth="6*" align="right"/>
54620 <tbody>
54621 <row>
54622 <entry><option>server_mech</option></entry>
54623 <entry>Use: <emphasis>gsasl</emphasis></entry>
54624 <entry>Type: <emphasis>string</emphasis></entry>
54625 <entry>Default: <emphasis>see below</emphasis></entry>
54626 </row>
54627 </tbody>
54628 </tgroup>
54629 </informaltable>
54630 <para>
54631 This option selects the authentication mechanism this driver should use. The
54632 default is the value of the generic <option>public_name</option> option. This option allows
54633 you to use a different underlying mechanism from the advertised name. For
54634 example:
54635 </para>
54636 <literallayout class="monospaced">
54637 sasl:
54638   driver = gsasl
54639   public_name = X-ANYTHING
54640   server_mech = CRAM-MD5
54641   server_set_id = $auth1
54642 </literallayout>
54643 <para>
54644 <indexterm role="option">
54645 <primary><option>server_password</option></primary>
54646 </indexterm>
54647 </para>
54648 <informaltable frame="all">
54649 <tgroup cols="4" colsep="0" rowsep="0">
54650 <colspec colwidth="8*" align="left"/>
54651 <colspec colwidth="6*" align="center"/>
54652 <colspec colwidth="6*" align="center"/>
54653 <colspec colwidth="6*" align="right"/>
54654 <tbody>
54655 <row>
54656 <entry><option>server_password</option></entry>
54657 <entry>Use: <emphasis>gsasl</emphasis></entry>
54658 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54659 <entry>Default: <emphasis>unset</emphasis></entry>
54660 </row>
54661 </tbody>
54662 </tgroup>
54663 </informaltable>
54664 <para>
54665 Various mechanisms need access to the cleartext password on the server, so
54666 that proof-of-possession can be demonstrated on the wire, without sending
54667 the password itself.
54668 </para>
54669 <para>
54670 The data available for lookup varies per mechanism.
54671 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
54672 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
54673 if available, else the empty string.
54674 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
54675 else the empty string.
54676 </para>
54677 <para>
54678 A forced failure will cause authentication to defer.
54679 </para>
54680 <para>
54681 If using this option, it may make sense to set the <option>server_condition</option>
54682 option to be simply "true".
54683 </para>
54684 <para>
54685 <indexterm role="option">
54686 <primary><option>server_realm</option></primary>
54687 </indexterm>
54688 </para>
54689 <informaltable frame="all">
54690 <tgroup cols="4" colsep="0" rowsep="0">
54691 <colspec colwidth="8*" align="left"/>
54692 <colspec colwidth="6*" align="center"/>
54693 <colspec colwidth="6*" align="center"/>
54694 <colspec colwidth="6*" align="right"/>
54695 <tbody>
54696 <row>
54697 <entry><option>server_realm</option></entry>
54698 <entry>Use: <emphasis>gsasl</emphasis></entry>
54699 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54700 <entry>Default: <emphasis>unset</emphasis></entry>
54701 </row>
54702 </tbody>
54703 </tgroup>
54704 </informaltable>
54705 <para>
54706 This specifies the SASL realm that the server claims to be in.
54707 Some mechanisms will use this data.
54708 </para>
54709 <para>
54710 <indexterm role="option">
54711 <primary><option>server_scram_iter</option></primary>
54712 </indexterm>
54713 </para>
54714 <informaltable frame="all">
54715 <tgroup cols="4" colsep="0" rowsep="0">
54716 <colspec colwidth="8*" align="left"/>
54717 <colspec colwidth="6*" align="center"/>
54718 <colspec colwidth="6*" align="center"/>
54719 <colspec colwidth="6*" align="right"/>
54720 <tbody>
54721 <row>
54722 <entry><option>server_scram_iter</option></entry>
54723 <entry>Use: <emphasis>gsasl</emphasis></entry>
54724 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54725 <entry>Default: <emphasis>4096</emphasis></entry>
54726 </row>
54727 </tbody>
54728 </tgroup>
54729 </informaltable>
54730 <para>
54731 This option provides data for the SCRAM family of mechanisms.
54732 </para>
54733 <para revisionflag="changed">
54734 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
54735 when this option is expanded.
54736 </para>
54737 <para revisionflag="changed">
54738 The result of expansion should be a decimal number,
54739 and represents both a lower-bound on the security, and
54740 a compute cost factor imposed on the client
54741 (if it does not cache results, or the server changes
54742 either the iteration count or the salt).
54743 A minimum value of 4096 is required by the standards
54744 for all current SCRAM mechanism variants.
54745 </para>
54746 <para>
54747 <indexterm role="option">
54748 <primary><option>server_scram_salt</option></primary>
54749 </indexterm>
54750 </para>
54751 <informaltable frame="all">
54752 <tgroup cols="4" colsep="0" rowsep="0">
54753 <colspec colwidth="8*" align="left"/>
54754 <colspec colwidth="6*" align="center"/>
54755 <colspec colwidth="6*" align="center"/>
54756 <colspec colwidth="6*" align="right"/>
54757 <tbody>
54758 <row>
54759 <entry><option>server_scram_salt</option></entry>
54760 <entry>Use: <emphasis>gsasl</emphasis></entry>
54761 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54762 <entry>Default: <emphasis>unset</emphasis></entry>
54763 </row>
54764 </tbody>
54765 </tgroup>
54766 </informaltable>
54767 <para>
54768 This option provides data for the SCRAM family of mechanisms.
54769 </para>
54770 <para revisionflag="changed">
54771 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
54772 when this option is expanded.
54773 The value should be a base64-encoded string,
54774 of random data typically 4-to-16 bytes long.
54775 If unset or empty after expansion the library will provides a value for the
54776 protocol conversation.
54777 </para>
54778 <para revisionflag="changed">
54779 <indexterm role="option">
54780 <primary><option>server_key</option></primary>
54781 </indexterm>
54782 </para>
54783 <informaltable frame="all" revisionflag="changed">
54784 <tgroup cols="4" colsep="0" rowsep="0">
54785 <colspec colwidth="8*" align="left"/>
54786 <colspec colwidth="6*" align="center"/>
54787 <colspec colwidth="6*" align="center"/>
54788 <colspec colwidth="6*" align="right"/>
54789 <tbody>
54790 <row>
54791 <entry><option>server_key</option></entry>
54792 <entry>Use: <emphasis>gsasl</emphasis></entry>
54793 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54794 <entry>Default: <emphasis>unset</emphasis></entry>
54795 </row>
54796 </tbody>
54797 </tgroup>
54798 </informaltable>
54799 <para revisionflag="changed">
54800 <indexterm role="option">
54801 <primary><option>server_skey</option></primary>
54802 </indexterm>
54803 </para>
54804 <informaltable frame="all" revisionflag="changed">
54805 <tgroup cols="4" colsep="0" rowsep="0">
54806 <colspec colwidth="8*" align="left"/>
54807 <colspec colwidth="6*" align="center"/>
54808 <colspec colwidth="6*" align="center"/>
54809 <colspec colwidth="6*" align="right"/>
54810 <tbody>
54811 <row>
54812 <entry><option>server_skey</option></entry>
54813 <entry>Use: <emphasis>gsasl</emphasis></entry>
54814 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54815 <entry>Default: <emphasis>unset</emphasis></entry>
54816 </row>
54817 </tbody>
54818 </tgroup>
54819 </informaltable>
54820 <para revisionflag="changed">
54821 These options can be used for the SCRAM family of mechanisms
54822 to provide stored information related to a password,
54823 the storage of which is preferable to plaintext.
54824 </para>
54825 <para revisionflag="changed">
54826 <option>server_key</option> is the value defined in the SCRAM standards as ServerKey;
54827 <option>server_skey</option> is StoredKey.
54828 </para>
54829 <para revisionflag="changed">
54830 They are only available for version 1.9.0 (or later) of the gsasl library.
54831 When this is so, the macros
54832 _OPT_AUTHENTICATOR_GSASL_SERVER_KEY
54833 and _HAVE_AUTH_GSASL_SCRAM_S_KEY
54834 will be defined.
54835 </para>
54836 <para revisionflag="changed">
54837 The <varname>$authN</varname> variables are available when these options are expanded.
54838 </para>
54839 <para revisionflag="changed">
54840 If set, the results of expansion should for each
54841 should be a 28 (for SHA-1) or 44 (for SHA-256) character string
54842 of base64-coded data, and will be used in preference to the
54843 <option>server_password</option> option.
54844 If unset or not of the right length, <option>server_password</option> will be used.
54845 </para>
54846 <para revisionflag="changed">
54847 The libgsasl library release includes a utility <emphasis>gsasl</emphasis> which can be used
54848 to generate these values.
54849 </para>
54850 <para>
54851 <indexterm role="option">
54852 <primary><option>server_service</option></primary>
54853 </indexterm>
54854 </para>
54855 <informaltable frame="all">
54856 <tgroup cols="4" colsep="0" rowsep="0">
54857 <colspec colwidth="8*" align="left"/>
54858 <colspec colwidth="6*" align="center"/>
54859 <colspec colwidth="6*" align="center"/>
54860 <colspec colwidth="6*" align="right"/>
54861 <tbody>
54862 <row>
54863 <entry><option>server_service</option></entry>
54864 <entry>Use: <emphasis>gsasl</emphasis></entry>
54865 <entry>Type: <emphasis>string</emphasis></entry>
54866 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
54867 </row>
54868 </tbody>
54869 </tgroup>
54870 </informaltable>
54871 <para>
54872 This is the SASL service that the server claims to implement.
54873 Some mechanisms will use this data.
54874 </para>
54875 <section id="SECTgsaslauthvar">
54876 <title><command>gsasl</command> auth variables</title>
54877 <para>
54878 <indexterm role="variable">
54879 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
54880 </indexterm>
54881 These may be set when evaluating specific options, as detailed above.
54882 They will also be set when evaluating <option>server_condition</option>.
54883 </para>
54884 <para>
54885 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
54886 meanings for these variables:
54887 </para>
54888 <itemizedlist>
54889 <listitem>
54890 <para>
54891 <indexterm role="variable">
54892 <primary><varname>$auth1</varname></primary>
54893 </indexterm>
54894 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
54895 </para>
54896 </listitem>
54897 <listitem>
54898 <para>
54899 <indexterm role="variable">
54900 <primary><varname>$auth2</varname></primary>
54901 </indexterm>
54902 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
54903 </para>
54904 </listitem>
54905 <listitem>
54906 <para>
54907 <indexterm role="variable">
54908 <primary><varname>$auth3</varname></primary>
54909 </indexterm>
54910 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
54911 </para>
54912 </listitem>
54913 </itemizedlist>
54914 <para>
54915 On a per-mechanism basis:
54916 </para>
54917 <itemizedlist>
54918 <listitem>
54919 <para>
54920 <indexterm role="concept">
54921 <primary>authentication</primary>
54922 <secondary>EXTERNAL</secondary>
54923 </indexterm>
54924 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
54925 the <option>server_condition</option> option must be present.
54926 </para>
54927 </listitem>
54928 <listitem>
54929 <para>
54930 <indexterm role="concept">
54931 <primary>authentication</primary>
54932 <secondary>ANONYMOUS</secondary>
54933 </indexterm>
54934 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
54935 the <option>server_condition</option> option must be present.
54936 </para>
54937 </listitem>
54938 <listitem>
54939 <para>
54940 <indexterm role="concept">
54941 <primary>authentication</primary>
54942 <secondary>GSSAPI</secondary>
54943 </indexterm>
54944 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
54945 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
54946 the <option>server_condition</option> option must be present.
54947 </para>
54948 </listitem>
54949 </itemizedlist>
54950 <para>
54951 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
54952 identifier; this is analogous to FTP anonymous authentication passing an
54953 email address, or software-identifier@, as the "password".
54954 </para>
54955 <para>
54956 An example showing the password having the realm specified in the callback
54957 and demonstrating a Cyrus SASL to GSASL migration approach is:
54958 </para>
54959 <literallayout class="monospaced">
54960 gsasl_cyrusless_crammd5:
54961   driver = gsasl
54962   public_name = CRAM-MD5
54963   server_realm = imap.example.org
54964   server_password = ${lookup{$auth1:$auth3:userPassword}\
54965                     dbmjz{/etc/sasldb2}{$value}fail}
54966   server_set_id = ${quote:$auth1}
54967   server_condition = yes
54968 </literallayout>
54969 </section>
54970 </chapter>
54971
54972 <chapter id="CHAPheimdalgss">
54973 <title>The heimdal_gssapi authenticator</title>
54974 <para>
54975 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
54976 <primary><command>heimdal_gssapi</command> authenticator</primary>
54977 </indexterm>
54978 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
54979 <primary>authenticators</primary>
54980 <secondary><command>heimdal_gssapi</command></secondary>
54981 </indexterm>
54982 <indexterm role="concept">
54983 <primary>authentication</primary>
54984 <secondary>GSSAPI</secondary>
54985 </indexterm>
54986 <indexterm role="concept">
54987 <primary>authentication</primary>
54988 <secondary>Kerberos</secondary>
54989 </indexterm>
54990 The <command>heimdal_gssapi</command> authenticator provides server integration for the
54991 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
54992 reliably.
54993 </para>
54994 <para>
54995 <indexterm role="option">
54996 <primary><option>server_hostname</option></primary>
54997 </indexterm>
54998 </para>
54999 <informaltable frame="all">
55000 <tgroup cols="4" colsep="0" rowsep="0">
55001 <colspec colwidth="8*" align="left"/>
55002 <colspec colwidth="6*" align="center"/>
55003 <colspec colwidth="6*" align="center"/>
55004 <colspec colwidth="6*" align="right"/>
55005 <tbody>
55006 <row>
55007 <entry><option>server_hostname</option></entry>
55008 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
55009 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55010 <entry>Default: <emphasis>see below</emphasis></entry>
55011 </row>
55012 </tbody>
55013 </tgroup>
55014 </informaltable>
55015 <para>
55016 This option selects the hostname that is used, with <option>server_service</option>,
55017 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
55018 identifier.  The default value is <literal>$primary_hostname</literal>.
55019 </para>
55020 <para>
55021 <indexterm role="option">
55022 <primary><option>server_keytab</option></primary>
55023 </indexterm>
55024 </para>
55025 <informaltable frame="all">
55026 <tgroup cols="4" colsep="0" rowsep="0">
55027 <colspec colwidth="8*" align="left"/>
55028 <colspec colwidth="6*" align="center"/>
55029 <colspec colwidth="6*" align="center"/>
55030 <colspec colwidth="6*" align="right"/>
55031 <tbody>
55032 <row>
55033 <entry><option>server_keytab</option></entry>
55034 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
55035 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55036 <entry>Default: <emphasis>unset</emphasis></entry>
55037 </row>
55038 </tbody>
55039 </tgroup>
55040 </informaltable>
55041 <para>
55042 If set, then Heimdal will not use the system default keytab (typically
55043 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
55044 The value should be a pathname, with no <quote>file:</quote> prefix.
55045 </para>
55046 <para>
55047 <indexterm role="option">
55048 <primary><option>server_service</option></primary>
55049 </indexterm>
55050 </para>
55051 <informaltable frame="all">
55052 <tgroup cols="4" colsep="0" rowsep="0">
55053 <colspec colwidth="8*" align="left"/>
55054 <colspec colwidth="6*" align="center"/>
55055 <colspec colwidth="6*" align="center"/>
55056 <colspec colwidth="6*" align="right"/>
55057 <tbody>
55058 <row>
55059 <entry><option>server_service</option></entry>
55060 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
55061 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55062 <entry>Default: <emphasis>smtp</emphasis></entry>
55063 </row>
55064 </tbody>
55065 </tgroup>
55066 </informaltable>
55067 <para>
55068 This option specifies the service identifier used, in conjunction with
55069 <option>server_hostname</option>, for building the identifier for finding credentials
55070 from the keytab.
55071 </para>
55072 <section id="SECTheimdalgssauthvar">
55073 <title><command>heimdal_gssapi</command> auth variables</title>
55074 <para>
55075 Beware that these variables will typically include a realm, thus will appear
55076 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
55077 not verified, so a malicious client can set it to anything.
55078 </para>
55079 <para>
55080 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
55081 Distribution Center.  Note that these are not quite email addresses.
55082 Each identifier is for a role, and so the left-hand-side may include a
55083 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
55084 </para>
55085 <para>
55086 <indexterm role="variable">
55087 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
55088 </indexterm>
55089 </para>
55090 <itemizedlist>
55091 <listitem>
55092 <para>
55093 <indexterm role="variable">
55094 <primary><varname>$auth1</varname></primary>
55095 </indexterm>
55096 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
55097 </para>
55098 </listitem>
55099 <listitem>
55100 <para>
55101 <indexterm role="variable">
55102 <primary><varname>$auth2</varname></primary>
55103 </indexterm>
55104 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
55105 authentication.  If that was empty, this will also be set to the
55106 GSS Display Name.
55107 </para>
55108 </listitem>
55109 </itemizedlist>
55110 </section>
55111 </chapter>
55112
55113 <chapter id="CHAPspa">
55114 <title>The spa authenticator</title>
55115 <para>
55116 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
55117 <primary><command>spa</command> authenticator</primary>
55118 </indexterm>
55119 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
55120 <primary>authenticators</primary>
55121 <secondary><command>spa</command></secondary>
55122 </indexterm>
55123 <indexterm role="concept">
55124 <primary>authentication</primary>
55125 <secondary>Microsoft Secure Password</secondary>
55126 </indexterm>
55127 <indexterm role="concept">
55128 <primary>authentication</primary>
55129 <secondary>NTLM</secondary>
55130 </indexterm>
55131 <indexterm role="concept">
55132 <primary>Microsoft Secure Password Authentication</primary>
55133 </indexterm>
55134 <indexterm role="concept">
55135 <primary>NTLM authentication</primary>
55136 </indexterm>
55137 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
55138 Password Authentication</emphasis> mechanism,
55139 which is also sometimes known as NTLM (NT LanMan). The code for client side of
55140 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
55141 taken from the Samba project (<emphasis role="bold"><ulink url="https://www.samba.org/">https://www.samba.org/</ulink></emphasis>). The code for the
55142 server side was subsequently contributed by Tom Kistner. The mechanism works as
55143 follows:
55144 </para>
55145 <itemizedlist>
55146 <listitem>
55147 <para>
55148 After the AUTH command has been accepted, the client sends an SPA
55149 authentication request based on the user name and optional domain.
55150 </para>
55151 </listitem>
55152 <listitem>
55153 <para>
55154 The server sends back a challenge.
55155 </para>
55156 </listitem>
55157 <listitem>
55158 <para>
55159 The client builds a challenge response which makes use of the user&#x2019;s password
55160 and sends it to the server, which then accepts or rejects it.
55161 </para>
55162 </listitem>
55163 </itemizedlist>
55164 <para>
55165 Encryption is used to protect the password in transit.
55166 </para>
55167 <section id="SECID179">
55168 <title>Using spa as a server</title>
55169 <para>
55170 <indexterm role="concept">
55171 <primary>options</primary>
55172 <secondary><command>spa</command> authenticator (server)</secondary>
55173 </indexterm>
55174 The <command>spa</command> authenticator has just one server option:
55175 </para>
55176 <para>
55177 <indexterm role="option">
55178 <primary><option>server_password</option></primary>
55179 </indexterm>
55180 </para>
55181 <informaltable frame="all">
55182 <tgroup cols="4" colsep="0" rowsep="0">
55183 <colspec colwidth="8*" align="left"/>
55184 <colspec colwidth="6*" align="center"/>
55185 <colspec colwidth="6*" align="center"/>
55186 <colspec colwidth="6*" align="right"/>
55187 <tbody>
55188 <row>
55189 <entry><option>server_password</option></entry>
55190 <entry>Use: <emphasis>spa</emphasis></entry>
55191 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55192 <entry>Default: <emphasis>unset</emphasis></entry>
55193 </row>
55194 </tbody>
55195 </tgroup>
55196 </informaltable>
55197 <para>
55198 <indexterm role="concept">
55199 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55200 <secondary>in <command>spa</command> authenticator</secondary>
55201 </indexterm>
55202 This option is expanded, and the result must be the cleartext password for the
55203 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
55204 compatibility with previous releases of Exim, the user name is also placed in
55205 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
55206 it can lead to confusion in string expansions that also use numeric variables
55207 for other things. For example:
55208 </para>
55209 <literallayout class="monospaced">
55210 spa:
55211   driver = spa
55212   public_name = NTLM
55213   server_password = \
55214     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
55215 </literallayout>
55216 <para>
55217 If the expansion is forced to fail, authentication fails. Any other expansion
55218 failure causes a temporary error code to be returned.
55219 </para>
55220 </section>
55221 <section id="SECID180">
55222 <title>Using spa as a client</title>
55223 <para>
55224 <indexterm role="concept">
55225 <primary>options</primary>
55226 <secondary><command>spa</command> authenticator (client)</secondary>
55227 </indexterm>
55228 The <command>spa</command> authenticator has the following client options:
55229 </para>
55230 <para>
55231 <indexterm role="option">
55232 <primary><option>client_domain</option></primary>
55233 </indexterm>
55234 </para>
55235 <informaltable frame="all">
55236 <tgroup cols="4" colsep="0" rowsep="0">
55237 <colspec colwidth="8*" align="left"/>
55238 <colspec colwidth="6*" align="center"/>
55239 <colspec colwidth="6*" align="center"/>
55240 <colspec colwidth="6*" align="right"/>
55241 <tbody>
55242 <row>
55243 <entry><option>client_domain</option></entry>
55244 <entry>Use: <emphasis>spa</emphasis></entry>
55245 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55246 <entry>Default: <emphasis>unset</emphasis></entry>
55247 </row>
55248 </tbody>
55249 </tgroup>
55250 </informaltable>
55251 <para>
55252 This option specifies an optional domain for the authentication.
55253 </para>
55254 <para>
55255 <indexterm role="option">
55256 <primary><option>client_password</option></primary>
55257 </indexterm>
55258 </para>
55259 <informaltable frame="all">
55260 <tgroup cols="4" colsep="0" rowsep="0">
55261 <colspec colwidth="8*" align="left"/>
55262 <colspec colwidth="6*" align="center"/>
55263 <colspec colwidth="6*" align="center"/>
55264 <colspec colwidth="6*" align="right"/>
55265 <tbody>
55266 <row>
55267 <entry><option>client_password</option></entry>
55268 <entry>Use: <emphasis>spa</emphasis></entry>
55269 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55270 <entry>Default: <emphasis>unset</emphasis></entry>
55271 </row>
55272 </tbody>
55273 </tgroup>
55274 </informaltable>
55275 <para>
55276 This option specifies the user&#x2019;s password, and must be set.
55277 </para>
55278 <para>
55279 <indexterm role="option">
55280 <primary><option>client_username</option></primary>
55281 </indexterm>
55282 </para>
55283 <informaltable frame="all">
55284 <tgroup cols="4" colsep="0" rowsep="0">
55285 <colspec colwidth="8*" align="left"/>
55286 <colspec colwidth="6*" align="center"/>
55287 <colspec colwidth="6*" align="center"/>
55288 <colspec colwidth="6*" align="right"/>
55289 <tbody>
55290 <row>
55291 <entry><option>client_username</option></entry>
55292 <entry>Use: <emphasis>spa</emphasis></entry>
55293 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55294 <entry>Default: <emphasis>unset</emphasis></entry>
55295 </row>
55296 </tbody>
55297 </tgroup>
55298 </informaltable>
55299 <para>
55300 This option specifies the user name, and must be set. Here is an example of a
55301 configuration of this authenticator for use with the mail servers at
55302 <emphasis>msn.com</emphasis>:
55303 </para>
55304 <literallayout class="monospaced">
55305 msn:
55306   driver = spa
55307   public_name = MSN
55308   client_username = msn/msn_username
55309   client_password = msn_plaintext_password
55310   client_domain = DOMAIN_OR_UNSET
55311 </literallayout>
55312 <para>
55313 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
55314 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
55315 </para>
55316 </section>
55317 </chapter>
55318
55319 <chapter id="CHAPexternauth">
55320 <title>The external authenticator</title>
55321 <para>
55322 <indexterm role="concept" id="IIDexternauth1" class="startofrange">
55323 <primary><command>external</command> authenticator</primary>
55324 </indexterm>
55325 <indexterm role="concept" id="IIDexternauth2" class="startofrange">
55326 <primary>authenticators</primary>
55327 <secondary><command>external</command></secondary>
55328 </indexterm>
55329 <indexterm role="concept">
55330 <primary>authentication</primary>
55331 <secondary>Client Certificate</secondary>
55332 </indexterm>
55333 <indexterm role="concept">
55334 <primary>authentication</primary>
55335 <secondary>X509</secondary>
55336 </indexterm>
55337 <indexterm role="concept">
55338 <primary>Certificate-based authentication</primary>
55339 </indexterm>
55340 The <command>external</command> authenticator provides support for
55341 authentication based on non-SMTP information.
55342 The specification is in RFC 4422 Appendix A
55343 (<emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc4422">https://tools.ietf.org/html/rfc4422</ulink></emphasis>).
55344 It is only a transport and negotiation mechanism;
55345 the process of authentication is entirely controlled
55346 by the server configuration.
55347 </para>
55348 <para>
55349 The client presents an identity in-clear.
55350 It is probably wise for a server to only advertise,
55351 and for clients to only attempt,
55352 this authentication method on a secure (eg. under TLS) connection.
55353 </para>
55354 <para>
55355 One possible use, compatible with the
55356 K-9 Mail Andoid client (<emphasis role="bold"><ulink url="https://k9mail.github.io/">https://k9mail.github.io/</ulink></emphasis>),
55357 is for using X509 client certificates.
55358 </para>
55359 <para>
55360 It thus overlaps in function with the TLS authenticator
55361 (see <xref linkend="CHAPtlsauth"/>)
55362 but is a full SMTP SASL authenticator
55363 rather than being implicit for TLS-connection carried
55364 client certificates only.
55365 </para>
55366 <para>
55367 The examples and discussion in this chapter assume that
55368 client-certificate authentication is being done.
55369 </para>
55370 <para>
55371 The client must present a certificate,
55372 for which it must have been requested via the
55373 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
55374 (see <xref linkend="CHAPTLS"/>).
55375 For authentication to be effective the certificate should be
55376 verifiable against a trust-anchor certificate known to the server.
55377 </para>
55378 <section id="SECTexternsoptions">
55379 <title>External options</title>
55380 <para>
55381 <indexterm role="concept">
55382 <primary>options</primary>
55383 <secondary><command>external</command> authenticator (server)</secondary>
55384 </indexterm>
55385 The <command>external</command> authenticator has two server options:
55386 </para>
55387 <para>
55388 <indexterm role="option">
55389 <primary><option>server_param2</option></primary>
55390 </indexterm>
55391 </para>
55392 <informaltable frame="all">
55393 <tgroup cols="4" colsep="0" rowsep="0">
55394 <colspec colwidth="8*" align="left"/>
55395 <colspec colwidth="6*" align="center"/>
55396 <colspec colwidth="6*" align="center"/>
55397 <colspec colwidth="6*" align="right"/>
55398 <tbody>
55399 <row>
55400 <entry><option>server_param2</option></entry>
55401 <entry>Use: <emphasis>external</emphasis></entry>
55402 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55403 <entry>Default: <emphasis>unset</emphasis></entry>
55404 </row>
55405 </tbody>
55406 </tgroup>
55407 </informaltable>
55408 <para>
55409 <indexterm role="option">
55410 <primary><option>server_param3</option></primary>
55411 </indexterm>
55412 </para>
55413 <informaltable frame="all">
55414 <tgroup cols="4" colsep="0" rowsep="0">
55415 <colspec colwidth="8*" align="left"/>
55416 <colspec colwidth="6*" align="center"/>
55417 <colspec colwidth="6*" align="center"/>
55418 <colspec colwidth="6*" align="right"/>
55419 <tbody>
55420 <row>
55421 <entry><option>server_param3</option></entry>
55422 <entry>Use: <emphasis>external</emphasis></entry>
55423 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55424 <entry>Default: <emphasis>unset</emphasis></entry>
55425 </row>
55426 </tbody>
55427 </tgroup>
55428 </informaltable>
55429 <para>
55430 <indexterm role="concept">
55431 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
55432 <secondary>in <command>external</command> authenticator</secondary>
55433 </indexterm>
55434 These options are expanded before the <option>server_condition</option> option
55435 and the result are placed in <varname>$auth2</varname> and <varname>$auth3</varname> resectively.
55436 If the expansion is forced to fail, authentication fails. Any other expansion
55437 failure causes a temporary error code to be returned.
55438 </para>
55439 <para>
55440 They can be used to clarify the coding of a complex <option>server_condition</option>.
55441 </para>
55442 </section>
55443 <section id="SECTexternserver">
55444 <title>Using external in a server</title>
55445 <para>
55446 <indexterm role="concept">
55447 <primary>AUTH</primary>
55448 <secondary>in <command>external</command> authenticator</secondary>
55449 </indexterm>
55450 <indexterm role="concept">
55451 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55452 <secondary>in <command>external</command> authenticator</secondary>
55453 </indexterm>
55454 <indexterm role="variable">
55455 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
55456 </indexterm>
55457 <indexterm role="concept">
55458 <primary>base64 encoding</primary>
55459 <secondary>in <command>external</command> authenticator</secondary>
55460 </indexterm>
55461 </para>
55462 <para>
55463 When running as a server, <command>external</command> performs the authentication test by
55464 expanding a string. The data sent by the client with the AUTH command, or in
55465 response to subsequent prompts, is base64 encoded, and so may contain any byte
55466 values when decoded. The decoded value is treated as
55467 an identity for authentication and
55468 placed in the expansion variable <varname>$auth1</varname>.
55469 </para>
55470 <para>
55471 For compatibility with previous releases of Exim, the value is also placed in
55472 the expansion variable <varname>$1</varname>. However, the use of this
55473 variable for this purpose is now deprecated, as it can lead to confusion in
55474 string expansions that also use them for other things.
55475 </para>
55476 <para>
55477 <indexterm role="variable">
55478 <primary><varname>$authenticated_id</varname></primary>
55479 </indexterm>
55480 Once an identity has been received,
55481 <option>server_condition</option> is expanded. If the expansion is forced to fail,
55482 authentication fails. Any other expansion failure causes a temporary error code
55483 to be returned. If the result of a successful expansion is an empty string,
55484 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
55485 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
55486 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
55487 For any other result, a temporary error code is returned, with the expanded
55488 string as the error text.
55489 </para>
55490 <para>
55491 Example:
55492 </para>
55493 <literallayout class="monospaced">
55494 ext_ccert_san_mail:
55495   driver =            external
55496   public_name =       EXTERNAL
55497
55498   server_advertise_condition = $tls_in_certificate_verified
55499   server_param2 =     ${certextract {subj_altname,mail,&gt;:} \
55500                                     {$tls_in_peercert}}
55501   server_condition =  ${if forany {$auth2} \
55502                             {eq {$item}{$auth1}}}
55503   server_set_id =     $auth1
55504 </literallayout>
55505 <para>
55506 This accepts a client certificate that is verifiable against any
55507 of your configured trust-anchors
55508 (which usually means the full set of public CAs)
55509 and which has a mail-SAN matching the claimed identity sent by the client.
55510 </para>
55511 <para>
55512 <emphasis role="bold">Note</emphasis>: up to TLS1.2, the client cert is on the wire in-clear, including the SAN.
55513 The account name is therefore guessable by an opponent.
55514 TLS 1.3 protects both server and client certificates, and is not vulnerable
55515 in this way.
55516 </para>
55517 </section>
55518 <section id="SECTexternclient">
55519 <title>Using external in a client</title>
55520 <para>
55521 <indexterm role="concept">
55522 <primary>options</primary>
55523 <secondary><command>external</command> authenticator (client)</secondary>
55524 </indexterm>
55525 The <command>external</command> authenticator has one client option:
55526 </para>
55527 <para>
55528 <indexterm role="option">
55529 <primary><option>client_send</option></primary>
55530 </indexterm>
55531 </para>
55532 <informaltable frame="all">
55533 <tgroup cols="4" colsep="0" rowsep="0">
55534 <colspec colwidth="8*" align="left"/>
55535 <colspec colwidth="6*" align="center"/>
55536 <colspec colwidth="6*" align="center"/>
55537 <colspec colwidth="6*" align="right"/>
55538 <tbody>
55539 <row>
55540 <entry><option>client_send</option></entry>
55541 <entry>Use: <emphasis>external</emphasis></entry>
55542 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55543 <entry>Default: <emphasis>unset</emphasis></entry>
55544 </row>
55545 </tbody>
55546 </tgroup>
55547 </informaltable>
55548 <para>
55549 This option is expanded and sent with the AUTH command as the
55550 identity being asserted.
55551 </para>
55552 <para>
55553 Example:
55554 </para>
55555 <literallayout class="monospaced">
55556 ext_ccert:
55557   driver =      external
55558   public_name = EXTERNAL
55559
55560   client_condition = ${if !eq{$tls_out_cipher}{}}
55561   client_send = myaccount@smarthost.example.net
55562 </literallayout>
55563 <para>
55564 <indexterm role="concept" startref="IIDexternauth1" class="endofrange"/>
55565 <indexterm role="concept" startref="IIDexternauth2" class="endofrange"/>
55566 </para>
55567 </section>
55568 </chapter>
55569
55570 <chapter id="CHAPtlsauth">
55571 <title>The tls authenticator</title>
55572 <para>
55573 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
55574 <primary><command>tls</command> authenticator</primary>
55575 </indexterm>
55576 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
55577 <primary>authenticators</primary>
55578 <secondary><command>tls</command></secondary>
55579 </indexterm>
55580 <indexterm role="concept">
55581 <primary>authentication</primary>
55582 <secondary>Client Certificate</secondary>
55583 </indexterm>
55584 <indexterm role="concept">
55585 <primary>authentication</primary>
55586 <secondary>X509</secondary>
55587 </indexterm>
55588 <indexterm role="concept">
55589 <primary>Certificate-based authentication</primary>
55590 </indexterm>
55591 The <command>tls</command> authenticator provides server support for
55592 authentication based on client certificates.
55593 </para>
55594 <para>
55595 It is not an SMTP authentication mechanism and is not
55596 advertised by the server as part of the SMTP EHLO response.
55597 It is an Exim authenticator in the sense that it affects
55598 the protocol element of the log line, can be tested for
55599 by the <option>authenticated</option> ACL condition, and can set
55600 the <varname>$authenticated_id</varname> variable.
55601 </para>
55602 <para>
55603 The client must present a verifiable certificate,
55604 for which it must have been requested via the
55605 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
55606 (see <xref linkend="CHAPTLS"/>).
55607 </para>
55608 <para>
55609 If an authenticator of this type is configured it is
55610 run before any SMTP-level communication is done,
55611 and can authenticate the connection.
55612 If it does, SMTP authentication is not offered.
55613 </para>
55614 <para>
55615 A maximum of one authenticator of this type may be present.
55616 </para>
55617 <para>
55618 <indexterm role="concept">
55619 <primary>options</primary>
55620 <secondary><command>tls</command> authenticator (server)</secondary>
55621 </indexterm>
55622 The <command>tls</command> authenticator has three server options:
55623 </para>
55624 <para>
55625 <indexterm role="option">
55626 <primary><option>server_param1</option></primary>
55627 </indexterm>
55628 </para>
55629 <informaltable frame="all">
55630 <tgroup cols="4" colsep="0" rowsep="0">
55631 <colspec colwidth="8*" align="left"/>
55632 <colspec colwidth="6*" align="center"/>
55633 <colspec colwidth="6*" align="center"/>
55634 <colspec colwidth="6*" align="right"/>
55635 <tbody>
55636 <row>
55637 <entry><option>server_param1</option></entry>
55638 <entry>Use: <emphasis>tls</emphasis></entry>
55639 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55640 <entry>Default: <emphasis>unset</emphasis></entry>
55641 </row>
55642 </tbody>
55643 </tgroup>
55644 </informaltable>
55645 <para>
55646 <indexterm role="concept">
55647 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
55648 <secondary>in <command>tls</command> authenticator</secondary>
55649 </indexterm>
55650 This option is expanded after the TLS negotiation and
55651 the result is placed in <varname>$auth1</varname>.
55652 If the expansion is forced to fail, authentication fails. Any other expansion
55653 failure causes a temporary error code to be returned.
55654 </para>
55655 <para>
55656 <indexterm role="option">
55657 <primary><option>server_param2</option></primary>
55658 </indexterm>
55659 </para>
55660 <informaltable frame="all">
55661 <tgroup cols="4" colsep="0" rowsep="0">
55662 <colspec colwidth="8*" align="left"/>
55663 <colspec colwidth="6*" align="center"/>
55664 <colspec colwidth="6*" align="center"/>
55665 <colspec colwidth="6*" align="right"/>
55666 <tbody>
55667 <row>
55668 <entry><option>server_param2</option></entry>
55669 <entry>Use: <emphasis>tls</emphasis></entry>
55670 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55671 <entry>Default: <emphasis>unset</emphasis></entry>
55672 </row>
55673 </tbody>
55674 </tgroup>
55675 </informaltable>
55676 <para>
55677 <indexterm role="option">
55678 <primary><option>server_param3</option></primary>
55679 </indexterm>
55680 </para>
55681 <informaltable frame="all">
55682 <tgroup cols="4" colsep="0" rowsep="0">
55683 <colspec colwidth="8*" align="left"/>
55684 <colspec colwidth="6*" align="center"/>
55685 <colspec colwidth="6*" align="center"/>
55686 <colspec colwidth="6*" align="right"/>
55687 <tbody>
55688 <row>
55689 <entry><option>server_param3</option></entry>
55690 <entry>Use: <emphasis>tls</emphasis></entry>
55691 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55692 <entry>Default: <emphasis>unset</emphasis></entry>
55693 </row>
55694 </tbody>
55695 </tgroup>
55696 </informaltable>
55697 <para>
55698 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
55699 </para>
55700 <para>
55701 <option>server_param1</option> may also be spelled <option>server_param</option>.
55702 </para>
55703 <para>
55704 Example:
55705 </para>
55706 <literallayout class="monospaced">
55707 tls:
55708   driver = tls
55709   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
55710                                     {$tls_in_peercert}}
55711   server_condition =  ${if and { {eq{$tls_in_certificate_verified}{1}} \
55712                                  {forany {$auth1} \
55713                             {!= {0} \
55714                                 {${lookup ldap{ldap:///\
55715                          mailname=${quote_ldap_dn:${lc:$item}},\
55716                          ou=users,LDAP_DC?mailid} {$value}{0} \
55717                        }    }  } }}}
55718   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
55719 </literallayout>
55720 <para>
55721 This accepts a client certificate that is verifiable against any
55722 of your configured trust-anchors
55723 (which usually means the full set of public CAs)
55724 and which has a SAN with a good account name.
55725 </para>
55726 <para>
55727 Note that, up to TLS1.2, the client cert is on the wire in-clear, including the SAN,
55728 The account name is therefore guessable by an opponent.
55729 TLS 1.3 protects both server and client certificates, and is not vulnerable
55730 in this way.
55731 Likewise, a traditional plaintext SMTP AUTH done inside TLS is not.
55732 </para>
55733 <para>
55734 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
55735 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
55736 </para>
55737 <para>
55738 Note that because authentication is traditionally an SMTP operation,
55739 the <option>authenticated</option> ACL condition cannot be used in
55740 a connect- or helo-ACL.
55741 </para>
55742 </chapter>
55743
55744 <chapter id="CHAPTLS">
55745 <title>Encrypted SMTP connections using TLS/SSL</title>
55746 <titleabbrev>Encrypted SMTP connections</titleabbrev>
55747 <para>
55748 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
55749 <primary>encryption</primary>
55750 <secondary>on SMTP connection</secondary>
55751 </indexterm>
55752 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
55753 <primary>SMTP</primary>
55754 <secondary>encryption</secondary>
55755 </indexterm>
55756 <indexterm role="concept">
55757 <primary>TLS</primary>
55758 <secondary>on SMTP connection</secondary>
55759 </indexterm>
55760 <indexterm role="concept">
55761 <primary>OpenSSL</primary>
55762 </indexterm>
55763 <indexterm role="concept">
55764 <primary>GnuTLS</primary>
55765 </indexterm>
55766 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
55767 Sockets Layer), is implemented by making use of the OpenSSL library or the
55768 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
55769 cryptographic code in the Exim distribution itself for implementing TLS. In
55770 order to use this feature you must install OpenSSL or GnuTLS, and then build a
55771 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
55772 You also need to understand the basic concepts of encryption at a managerial
55773 level, and in particular, the way that public keys, private keys, and
55774 certificates are used.
55775 </para>
55776 <para>
55777 RFC 3207 defines how SMTP connections can make use of encryption. Once a
55778 connection is established, the client issues a STARTTLS command. If the
55779 server accepts this, the client and the server negotiate an encryption
55780 mechanism. If the negotiation succeeds, the data that subsequently passes
55781 between them is encrypted.
55782 </para>
55783 <para>
55784 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
55785 and if so, what cipher suite is in use, whether the client supplied a
55786 certificate, and whether or not that certificate was verified. This makes it
55787 possible for an Exim server to deny or accept certain commands based on the
55788 encryption state.
55789 </para>
55790 <para>
55791 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
55792 disrupt TLS connections. You need to turn off SMTP scanning for these products
55793 in order to get TLS to work.
55794 </para>
55795 <section id="SECID284">
55796 <title>Support for the <quote>submissions</quote> (aka <quote>ssmtp</quote> and <quote>smtps</quote>) protocol</title>
55797 <para>
55798 <indexterm role="concept">
55799 <primary>submissions protocol</primary>
55800 </indexterm>
55801 <indexterm role="concept">
55802 <primary>ssmtp protocol</primary>
55803 </indexterm>
55804 <indexterm role="concept">
55805 <primary>smtps protocol</primary>
55806 </indexterm>
55807 <indexterm role="concept">
55808 <primary>SMTP</primary>
55809 <secondary>submissions protocol</secondary>
55810 </indexterm>
55811 <indexterm role="concept">
55812 <primary>SMTP</primary>
55813 <secondary>ssmtp protocol</secondary>
55814 </indexterm>
55815 <indexterm role="concept">
55816 <primary>SMTP</primary>
55817 <secondary>smtps protocol</secondary>
55818 </indexterm>
55819 The history of port numbers for TLS in SMTP is a little messy and has been
55820 contentious.  As of RFC 8314, the common practice of using the historically
55821 allocated port 465 for "email submission but with TLS immediately upon connect
55822 instead of using STARTTLS" is officially blessed by the IETF, and recommended
55823 by them in preference to STARTTLS.
55824 </para>
55825 <para>
55826 The name originally assigned to the port was <quote>ssmtp</quote> or <quote>smtps</quote>, but as
55827 clarity emerged over the dual roles of SMTP, for MX delivery and Email
55828 Submission, nomenclature has shifted.  The modern name is now <quote>submissions</quote>.
55829 </para>
55830 <para>
55831 This approach was, for a while, officially abandoned when encrypted SMTP was
55832 standardized, but many clients kept using it, even as the TCP port number was
55833 reassigned for other use.
55834 Thus you may encounter guidance claiming that you shouldn&#x2019;t enable use of
55835 this port.
55836 In practice, a number of mail-clients have only ever supported submissions,
55837 not submission with STARTTLS upgrade.
55838 Ideally, offer both submission (587) and submissions (465) service.
55839 </para>
55840 <para>
55841 Exim supports TLS-on-connect by means of the <option>tls_on_connect_ports</option>
55842 global option. Its value must be a list of port numbers;
55843 the most common use is expected to be:
55844 </para>
55845 <literallayout class="monospaced">
55846 tls_on_connect_ports = 465
55847 </literallayout>
55848 <para>
55849 The port numbers specified by this option apply to all SMTP connections, both
55850 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
55851 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
55852 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
55853 an extra port &ndash; rather, it specifies different behaviour on a port that is
55854 defined elsewhere.
55855 </para>
55856 <para>
55857 There is also a <option>-tls-on-connect</option> command line option. This overrides
55858 <option>tls_on_connect_ports</option>; it forces the TLS-only behaviour for all ports.
55859 </para>
55860 </section>
55861 <section id="SECTopenvsgnu">
55862 <title>OpenSSL vs GnuTLS</title>
55863 <para>
55864 <indexterm role="concept">
55865 <primary>TLS</primary>
55866 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
55867 </indexterm>
55868 TLS is supported in Exim using either the OpenSSL or GnuTLS library.
55869 To build Exim to use OpenSSL you need to set
55870 </para>
55871 <literallayout class="monospaced">
55872 USE_OPENSSL=yes
55873 </literallayout>
55874 <para>
55875 in Local/Makefile.
55876 </para>
55877 <para>
55878 To build Exim to use GnuTLS, you need to set
55879 </para>
55880 <literallayout class="monospaced">
55881 USE_GNUTLS=yes
55882 </literallayout>
55883 <para>
55884 in Local/Makefile.
55885 </para>
55886 <para>
55887 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
55888 include files and libraries for GnuTLS can be found.
55889 </para>
55890 <para>
55891 There are some differences in usage when using GnuTLS instead of OpenSSL:
55892 </para>
55893 <itemizedlist>
55894 <listitem>
55895 <para>
55896 The <option>tls_verify_certificates</option> option
55897 cannot be the path of a directory
55898 for GnuTLS versions before 3.3.6
55899 (for later versions, or OpenSSL, it can be either).
55900 </para>
55901 </listitem>
55902 <listitem>
55903 <para>
55904 The default value for <option>tls_dhparam</option> differs for historical reasons.
55905 </para>
55906 </listitem>
55907 <listitem>
55908 <para>
55909 <indexterm role="variable">
55910 <primary><varname>$tls_in_peerdn</varname></primary>
55911 </indexterm>
55912 <indexterm role="variable">
55913 <primary><varname>$tls_out_peerdn</varname></primary>
55914 </indexterm>
55915 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
55916 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
55917 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
55918 </para>
55919 </listitem>
55920 <listitem>
55921 <para>
55922 OpenSSL identifies cipher suites using hyphens as separators, for example:
55923 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
55924 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
55925 in a cipher list. To make life simpler, Exim changes underscores to hyphens
55926 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
55927 to handle its own older variants) when processing lists of cipher suites in the
55928 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
55929 option).
55930 </para>
55931 </listitem>
55932 <listitem>
55933 <para>
55934 The <option>tls_require_ciphers</option> options operate differently, as described in the
55935 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
55936 </para>
55937 </listitem>
55938 <listitem>
55939 <para>
55940 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
55941 When using OpenSSL, this option is ignored.
55942 (If an API is found to let OpenSSL be configured in this way,
55943 let the Exim Maintainers know and we&#x2019;ll likely use it).
55944 </para>
55945 </listitem>
55946 <listitem>
55947 <para>
55948 With GnuTLS, if an explicit list is used for the <option>tls_privatekey</option> main option
55949 main option, it must be ordered to match the <option>tls_certificate</option> list.
55950 </para>
55951 </listitem>
55952 <listitem>
55953 <para>
55954 Some other recently added features may only be available in one or the other.
55955 This should be documented with the feature.  If the documentation does not
55956 explicitly state that the feature is infeasible in the other TLS
55957 implementation, then patches are welcome.
55958 </para>
55959 </listitem>
55960 <listitem>
55961 <para revisionflag="changed">
55962 The output from "exim -bV" will show which (if any) support was included
55963 in the build.
55964 Also, the macro "_HAVE_OPENSSL" or "_HAVE_GNUTLS" will be defined.
55965 </para>
55966 </listitem>
55967 </itemizedlist>
55968 </section>
55969 <section id="SECTgnutlsparam">
55970 <title>GnuTLS parameter computation</title>
55971 <para>
55972 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
55973 an explicit path; if the latter, then the text about generation still applies,
55974 but not the chosen filename.
55975 By default, as of Exim 4.80 a hard-coded D-H prime is used.
55976 See the documentation of <option>tls_dhparam</option> for more information.
55977 </para>
55978 <para>
55979 GnuTLS uses D-H parameters that may take a substantial amount of time
55980 to compute. It is unreasonable to re-compute them for every TLS session.
55981 Therefore, Exim keeps this data in a file in its spool directory, called
55982 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
55983 of bits requested.
55984 The file is owned by the Exim user and is readable only by
55985 its owner. Every Exim process that start up GnuTLS reads the D-H
55986 parameters from this file. If the file does not exist, the first Exim process
55987 that needs it computes the data and writes it to a temporary file which is
55988 renamed once it is complete. It does not matter if several Exim processes do
55989 this simultaneously (apart from wasting a few resources). Once a file is in
55990 place, new Exim processes immediately start using it.
55991 </para>
55992 <para>
55993 For maximum security, the parameters that are stored in this file should be
55994 recalculated periodically, the frequency depending on your paranoia level.
55995 If you are avoiding using the fixed D-H primes published in RFCs, then you
55996 are concerned about some advanced attacks and will wish to do this; if you do
55997 not regenerate then you might as well stick to the standard primes.
55998 </para>
55999 <para>
56000 Arranging this is easy in principle; just delete the file when you want new
56001 values to be computed. However, there may be a problem. The calculation of new
56002 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
56003 If the system is not very active, <filename>/dev/random</filename> may delay returning data
56004 until enough randomness (entropy) is available. This may cause Exim to hang for
56005 a substantial amount of time, causing timeouts on incoming connections.
56006 </para>
56007 <para>
56008 The solution is to generate the parameters externally to Exim. They are stored
56009 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
56010 generated externally using the <command>certtool</command> command that is part of GnuTLS.
56011 </para>
56012 <para>
56013 To replace the parameters with new ones, instead of deleting the file
56014 and letting Exim re-create it, you can generate new parameters using
56015 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
56016 renaming. The relevant commands are something like this:
56017 </para>
56018 <literallayout class="monospaced">
56019 # ls
56020 [ look for file; assume gnutls-params-2236 is the most recent ]
56021 # rm -f new-params
56022 # touch new-params
56023 # chown exim:exim new-params
56024 # chmod 0600 new-params
56025 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
56026 # openssl dhparam -noout -text -in new-params | head
56027 [ check the first line, make sure it's not more than 2236;
56028   if it is, then go back to the start ("rm") and repeat
56029   until the size generated is at most the size requested ]
56030 # chmod 0400 new-params
56031 # mv new-params gnutls-params-2236
56032 </literallayout>
56033 <para>
56034 If Exim never has to generate the parameters itself, the possibility of
56035 stalling is removed.
56036 </para>
56037 <para>
56038 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
56039 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
56040 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
56041 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
56042 and Exim does so.  This attempt to remove Exim from TLS policy decisions
56043 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
56044 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
56045 which applies to all D-H usage, client or server.  If the value returned by
56046 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
56047 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
56048 limit, which is still much higher than Exim historically used.
56049 </para>
56050 <para>
56051 The filename and bits used will change as the GnuTLS maintainers change the
56052 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
56053 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
56054 2432 bits, while NSS is limited to 2236 bits.
56055 </para>
56056 <para>
56057 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
56058 increase the chance of the generated prime actually being within acceptable
56059 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
56060 procedure above.  There is no sane procedure available to Exim to double-check
56061 the size of the generated prime, so it might still be too large.
56062 </para>
56063 </section>
56064 <section id="SECTreqciphssl">
56065 <title>Requiring specific ciphers in OpenSSL</title>
56066 <para>
56067 <indexterm role="concept">
56068 <primary>TLS</primary>
56069 <secondary>requiring specific ciphers (OpenSSL)</secondary>
56070 </indexterm>
56071 <indexterm role="option">
56072 <primary><option>tls_require_ciphers</option></primary>
56073 <secondary>OpenSSL</secondary>
56074 </indexterm>
56075 There is a function in the OpenSSL library that can be passed a list of cipher
56076 suites before the cipher negotiation takes place. This specifies which ciphers
56077 are acceptable for TLS versions prior to 1.3.
56078 The list is colon separated and may contain names like
56079 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
56080 directly to this function call.
56081 Many systems will install the OpenSSL manual-pages, so you may have
56082 <emphasis>ciphers(1)</emphasis> available to you.
56083 The following quotation from the OpenSSL
56084 documentation specifies what forms of item are allowed in the cipher string:
56085 </para>
56086 <itemizedlist>
56087 <listitem>
56088 <para>
56089 It can consist of a single cipher suite such as RC4-SHA.
56090 </para>
56091 </listitem>
56092 <listitem>
56093 <para>
56094 It can represent a list of cipher suites containing a certain algorithm,
56095 or cipher suites of a certain type. For example SHA1 represents all
56096 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
56097 SSL v3 algorithms.
56098 </para>
56099 </listitem>
56100 <listitem>
56101 <para>
56102 Lists of cipher suites can be combined in a single cipher string using
56103 the + character. This is used as a logical and operation. For example
56104 SHA1+DES represents all cipher suites containing the SHA1 and the DES
56105 algorithms.
56106 </para>
56107 </listitem>
56108 </itemizedlist>
56109 <para>
56110 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
56111 <literal>-</literal> or <literal>+</literal>.
56112 </para>
56113 <itemizedlist>
56114 <listitem>
56115 <para>
56116 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
56117 ciphers deleted can never reappear in the list even if they are explicitly
56118 stated.
56119 </para>
56120 </listitem>
56121 <listitem>
56122 <para>
56123 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
56124 of the ciphers can be added again by later options.
56125 </para>
56126 </listitem>
56127 <listitem>
56128 <para>
56129 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
56130 option does not add any new ciphers; it just moves matching existing ones.
56131 </para>
56132 </listitem>
56133 </itemizedlist>
56134 <para>
56135 If none of these characters is present, the string is interpreted as
56136 a list of ciphers to be appended to the current preference list. If the list
56137 includes any ciphers already present they will be ignored: that is, they will
56138 not be moved to the end of the list.
56139 </para>
56140 <para>
56141 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
56142 string:
56143 </para>
56144 <literallayout class="monospaced">
56145 # note single-quotes to get ! past any shell history expansion
56146 $ openssl ciphers 'HIGH:!MD5:!SHA1'
56147 </literallayout>
56148 <para>
56149 This example will let the library defaults be permitted on the MX port, where
56150 there&#x2019;s probably no identity verification anyway, but ups the ante on the
56151 submission ports where the administrator might have some influence on the
56152 choice of clients used:
56153 </para>
56154 <literallayout class="monospaced">
56155 # OpenSSL variant; see man ciphers(1)
56156 tls_require_ciphers = ${if =={$received_port}{25}\
56157                            {DEFAULT}\
56158                            {HIGH:!MD5:!SHA1}}
56159 </literallayout>
56160 <para>
56161 This example will prefer ECDSA-authenticated ciphers over RSA ones:
56162 </para>
56163 <literallayout class="monospaced">
56164 tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT
56165 </literallayout>
56166 <para>
56167 For TLS version 1.3 the control available is less fine-grained
56168 and Exim does not provide access to it at present.
56169 The value of the <option>tls_require_ciphers</option> option is ignored when
56170 TLS version 1.3 is negotiated.
56171 </para>
56172 <para>
56173 As of writing the library default cipher suite list for TLSv1.3 is
56174 </para>
56175 <literallayout class="monospaced">
56176 TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
56177 </literallayout>
56178 </section>
56179 <section id="SECTreqciphgnu">
56180 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
56181 <para>
56182 <indexterm role="concept">
56183 <primary>GnuTLS</primary>
56184 <secondary>specifying parameters for</secondary>
56185 </indexterm>
56186 <indexterm role="concept">
56187 <primary>TLS</primary>
56188 <secondary>specifying ciphers (GnuTLS)</secondary>
56189 </indexterm>
56190 <indexterm role="concept">
56191 <primary>TLS</primary>
56192 <secondary>specifying key exchange methods (GnuTLS)</secondary>
56193 </indexterm>
56194 <indexterm role="concept">
56195 <primary>TLS</primary>
56196 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
56197 </indexterm>
56198 <indexterm role="concept">
56199 <primary>TLS</primary>
56200 <secondary>specifying protocols (GnuTLS)</secondary>
56201 </indexterm>
56202 <indexterm role="concept">
56203 <primary>TLS</primary>
56204 <secondary>specifying priority string (GnuTLS)</secondary>
56205 </indexterm>
56206 <indexterm role="option">
56207 <primary><option>tls_require_ciphers</option></primary>
56208 <secondary>GnuTLS</secondary>
56209 </indexterm>
56210 The GnuTLS library allows the caller to provide a "priority string", documented
56211 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
56212 ciphersuite specification in OpenSSL.
56213 </para>
56214 <para>
56215 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
56216 and controls both protocols and ciphers.
56217 </para>
56218 <para>
56219 The <option>tls_require_ciphers</option> option is available both as an global option,
56220 controlling how Exim behaves as a server, and also as an option of the
56221 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
56222 the value is string expanded.  The resulting string is not an Exim list and
56223 the string is given to the GnuTLS library, so that Exim does not need to be
56224 aware of future feature enhancements of GnuTLS.
56225 </para>
56226 <para>
56227 Documentation of the strings accepted may be found in the GnuTLS manual, under
56228 "Priority strings".  This is online as
56229 <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>,
56230 but beware that this relates to GnuTLS 3, which may be newer than the version
56231 installed on your system.  If you are using GnuTLS 3,
56232 then the example code
56233 <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>
56234 on that site can be used to test a given string.
56235 </para>
56236 <para>
56237 For example:
56238 </para>
56239 <literallayout class="monospaced">
56240 # Disable older versions of protocols
56241 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
56242 </literallayout>
56243 <para>
56244 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
56245 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
56246 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
56247 </para>
56248 <para>
56249 This example will let the library defaults be permitted on the MX port, where
56250 there&#x2019;s probably no identity verification anyway, and lowers security further
56251 by increasing compatibility; but this ups the ante on the submission ports
56252 where the administrator might have some influence on the choice of clients
56253 used:
56254 </para>
56255 <literallayout class="monospaced">
56256 # GnuTLS variant
56257 tls_require_ciphers = ${if =={$received_port}{25}\
56258                            {NORMAL:%COMPAT}\
56259                            {SECURE128}}
56260 </literallayout>
56261 </section>
56262 <section id="SECID182">
56263 <title>Configuring an Exim server to use TLS</title>
56264 <para>
56265 <indexterm role="concept">
56266 <primary>TLS</primary>
56267 <secondary>configuring an Exim server</secondary>
56268 </indexterm>
56269 <indexterm role="concept">
56270 <primary>ESMTP extensions</primary>
56271 <secondary>STARTTLS</secondary>
56272 </indexterm>
56273 When Exim has been built with TLS support, it advertises the availability of
56274 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
56275 but not to any others. The default value of this option is *, which means
56276 that STARTTLS is always advertised.  Set it to blank to never advertise;
56277 this is reasonable for systems that want to use TLS only as a client.
56278 </para>
56279 <para>
56280 If STARTTLS is to be used you
56281 need to set some other options in order to make TLS available.
56282 </para>
56283 <para>
56284 If a client issues a STARTTLS command and there is some configuration
56285 problem in the server, the command is rejected with a 454 error. If the client
56286 persists in trying to issue SMTP commands, all except QUIT are rejected
56287 with the error
56288 </para>
56289 <literallayout class="monospaced">
56290 554 Security failure
56291 </literallayout>
56292 <para>
56293 If a STARTTLS command is issued within an existing TLS session, it is
56294 rejected with a 554 error code.
56295 </para>
56296 <para>
56297 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
56298 must be set to match some hosts. The default is * which matches all hosts.
56299 </para>
56300 <para>
56301 If this is all you do, TLS encryption will be enabled but not authentication -
56302 meaning that the peer has no assurance it is actually you he is talking to.
56303 You gain protection from a passive sniffer listening on the wire but not
56304 from someone able to intercept the communication.
56305 </para>
56306 <para>
56307 Further protection requires some further configuration at the server end.
56308 </para>
56309 <para>
56310 To make TLS work you need to set, in the server,
56311 </para>
56312 <literallayout class="monospaced">
56313 tls_certificate = /some/file/name
56314 tls_privatekey = /some/file/name
56315 </literallayout>
56316 <para>
56317 These options are, in fact, expanded strings, so you can make them depend on
56318 the identity of the client that is connected if you wish. The first file
56319 contains the server&#x2019;s X509 certificate, and the second contains the private key
56320 that goes with it. These files need to be
56321 PEM format and readable by the Exim user, and must
56322 always be given as full path names.
56323 The key must not be password-protected.
56324 They can be the same file if both the
56325 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
56326 set, or if its expansion is forced to fail or results in an empty string, this
56327 is assumed to be the case. The certificate file may also contain intermediate
56328 certificates that need to be sent to the client to enable it to authenticate
56329 the server&#x2019;s certificate.
56330 </para>
56331 <para>
56332 For dual-stack (eg. RSA and ECDSA) configurations, these options can be
56333 colon-separated lists of file paths.  Ciphers using given authentication
56334 algorithms require the presence of a suitable certificate to supply the
56335 public-key.  The server selects among the certificates to present to the
56336 client depending on the selected cipher, hence the priority ordering for
56337 ciphers will affect which certificate is used.
56338 </para>
56339 <para>
56340 If you do not understand about certificates and keys, please try to find a
56341 source of this background information, which is not Exim-specific. (There are a
56342 few comments below in section <xref linkend="SECTcerandall"/>.)
56343 </para>
56344 <para>
56345 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
56346 they apply only in the case of a server. If you need to use a certificate in an
56347 Exim client, you must set the options of the same names in an <command>smtp</command>
56348 transport.
56349 </para>
56350 <para>
56351 With just these options, an Exim server will be able to use TLS. It does not
56352 require the client to have a certificate (but see below for how to insist on
56353 this). There is one other option that may be needed in other situations. If
56354 </para>
56355 <literallayout class="monospaced">
56356 tls_dhparam = /some/file/name
56357 </literallayout>
56358 <para>
56359 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
56360 with the parameters contained in the file.
56361 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
56362 available:
56363 </para>
56364 <literallayout class="monospaced">
56365 tls_dhparam = none
56366 </literallayout>
56367 <para>
56368 This may also be set to a string identifying a standard prime to be used for
56369 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
56370 used is <literal>ike23</literal>.  There are a few standard primes available, see the
56371 documentation for <option>tls_dhparam</option> for the complete list.
56372 </para>
56373 <para>
56374 See the command
56375 </para>
56376 <literallayout class="monospaced">
56377 openssl dhparam
56378 </literallayout>
56379 <para>
56380 for a way of generating file data.
56381 </para>
56382 <para>
56383 The strings supplied for these three options are expanded every time a client
56384 host connects. It is therefore possible to use different certificates and keys
56385 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
56386 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
56387 forced to fail, Exim behaves as if the option is not set.
56388 </para>
56389 <para>
56390 <indexterm role="concept">
56391 <primary>cipher</primary>
56392 <secondary>logging</secondary>
56393 </indexterm>
56394 <indexterm role="concept">
56395 <primary>log</primary>
56396 <secondary>TLS cipher</secondary>
56397 </indexterm>
56398 <indexterm role="variable">
56399 <primary><varname>$tls_in_cipher</varname></primary>
56400 </indexterm>
56401 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
56402 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
56403 incoming message (by default &ndash; you can, of course, change this), and it is
56404 also included in the log line that records a message&#x2019;s arrival, keyed by
56405 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
56406 condition can be used to test for specific cipher suites in ACLs.
56407 </para>
56408 <para>
56409 Once TLS has been established, the ACLs that run for subsequent SMTP commands
56410 can check the name of the cipher suite and vary their actions accordingly. The
56411 cipher suite names vary, depending on which TLS library is being used. For
56412 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
56413 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
56414 documentation for more details.
56415 </para>
56416 <para>
56417 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
56418 (again depending on the <option>tls_cipher</option> log selector).
56419 </para>
56420 </section>
56421 <section id="SECID183">
56422 <title>Requesting and verifying client certificates</title>
56423 <para>
56424 <indexterm role="concept">
56425 <primary>certificate</primary>
56426 <secondary>verification of client</secondary>
56427 </indexterm>
56428 <indexterm role="concept">
56429 <primary>TLS</primary>
56430 <secondary>client certificate verification</secondary>
56431 </indexterm>
56432 If you want an Exim server to request a certificate when negotiating a TLS
56433 session with a client, you must set either <option>tls_verify_hosts</option> or
56434 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
56435 apply to all TLS connections. For any host that matches one of these options,
56436 Exim requests a certificate as part of the setup of the TLS session. The
56437 contents of the certificate are verified by comparing it with a list of
56438 expected trust-anchors or certificates.
56439 These may be the system default set (depending on library version),
56440 an explicit file or,
56441 depending on library version, a directory, identified by
56442 <option>tls_verify_certificates</option>.
56443 </para>
56444 <para>
56445 A file can contain multiple certificates, concatenated end to end. If a
56446 directory is used
56447 (OpenSSL only),
56448 each certificate must be in a separate file, with a name (or a symbolic link)
56449 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
56450 certificate. You can compute the relevant hash by running the command
56451 </para>
56452 <literallayout class="monospaced">
56453 openssl x509 -hash -noout -in /cert/file
56454 </literallayout>
56455 <para>
56456 where <filename>/cert/file</filename> contains a single certificate.
56457 </para>
56458 <para>
56459 There is no checking of names of the client against the certificate
56460 Subject Name or Subject Alternate Names.
56461 </para>
56462 <para>
56463 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
56464 what happens if the client does not supply a certificate, or if the certificate
56465 does not match any of the certificates in the collection named by
56466 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
56467 attempt to set up a TLS session is aborted, and the incoming connection is
56468 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
56469 session continues. ACLs that run for subsequent SMTP commands can detect the
56470 fact that no certificate was verified, and vary their actions accordingly. For
56471 example, you can insist on a certificate before accepting a message for
56472 relaying, but not when the message is destined for local delivery.
56473 </para>
56474 <para>
56475 <indexterm role="variable">
56476 <primary><varname>$tls_in_peerdn</varname></primary>
56477 </indexterm>
56478 When a client supplies a certificate (whether it verifies or not), the value of
56479 the Distinguished Name of the certificate is made available in the variable
56480 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
56481 </para>
56482 <para>
56483 <indexterm role="concept">
56484 <primary>log</primary>
56485 <secondary>distinguished name</secondary>
56486 </indexterm>
56487 Because it is often a long text string, it is not included in the log line or
56488 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
56489 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
56490 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
56491 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
56492 </para>
56493 </section>
56494 <section id="SECID184">
56495 <title>Revoked certificates</title>
56496 <para>
56497 <indexterm role="concept">
56498 <primary>TLS</primary>
56499 <secondary>revoked certificates</secondary>
56500 </indexterm>
56501 <indexterm role="concept">
56502 <primary>revocation list</primary>
56503 </indexterm>
56504 <indexterm role="concept">
56505 <primary>certificate</primary>
56506 <secondary>revocation list</secondary>
56507 </indexterm>
56508 <indexterm role="concept">
56509 <primary>OCSP</primary>
56510 <secondary>stapling</secondary>
56511 </indexterm>
56512 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
56513 certificates are revoked. If you have such a list, you can pass it to an Exim
56514 server using the global option called <option>tls_crl</option> and to an Exim client using
56515 an identically named option for the <command>smtp</command> transport. In each case, the value
56516 of the option is expanded and must then be the name of a file that contains a
56517 CRL in PEM format.
56518 The downside is that clients have to periodically re-download a potentially huge
56519 file from every certificate authority they know of.
56520 </para>
56521 <para>
56522 The way with most moving parts at query time is Online Certificate
56523 Status Protocol (OCSP), where the client verifies the certificate
56524 against an OCSP server run by the CA.  This lets the CA track all
56525 usage of the certs.  It requires running software with access to the
56526 private key of the CA, to sign the responses to the OCSP queries.  OCSP
56527 is based on HTTP and can be proxied accordingly.
56528 </para>
56529 <para>
56530 The only widespread OCSP server implementation (known to this writer)
56531 comes as part of OpenSSL and aborts on an invalid request, such as
56532 connecting to the port and then disconnecting.  This requires
56533 re-entering the passphrase each time some random client does this.
56534 </para>
56535 <para>
56536 The third way is OCSP Stapling; in this, the server using a certificate
56537 issued by the CA periodically requests an OCSP proof of validity from
56538 the OCSP server, then serves it up inline as part of the TLS
56539 negotiation.   This approach adds no extra round trips, does not let the
56540 CA track users, scales well with number of certs issued by the CA and is
56541 resilient to temporary OCSP server failures, as long as the server
56542 starts retrying to fetch an OCSP proof some time before its current
56543 proof expires.  The downside is that it requires server support.
56544 </para>
56545 <para>
56546 Unless Exim is built with the support disabled,
56547 or with GnuTLS earlier than version 3.3.16 / 3.4.8
56548 support for OCSP stapling is included.
56549 </para>
56550 <para>
56551 There is a global option called <option>tls_ocsp_file</option>.
56552 The file specified therein is expected to be in DER format, and contain
56553 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
56554 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
56555 contains <literal>tls_in_sni</literal>, as per other TLS options.
56556 </para>
56557 <para>
56558 Exim does not at this time implement any support for fetching a new OCSP
56559 proof.  The burden is on the administrator to handle this, outside of
56560 Exim.  The file specified should be replaced atomically, so that the
56561 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
56562 on each connection, so a new file will be handled transparently on the
56563 next connection.
56564 </para>
56565 <para>
56566 When built with OpenSSL Exim will check for a valid next update timestamp
56567 in the OCSP proof; if not present, or if the proof has expired, it will be
56568 ignored.
56569 </para>
56570 <para>
56571 For the client to be able to verify the stapled OCSP the server must
56572 also supply, in its stapled information, any intermediate
56573 certificates for the chain leading to the OCSP proof from the signer
56574 of the server certificate.  There may be zero or one such. These
56575 intermediate certificates should be added to the server OCSP stapling
56576 file named by <option>tls_ocsp_file</option>.
56577 </para>
56578 <para>
56579 Note that the proof only covers the terminal server certificate,
56580 not any of the chain from CA to it.
56581 </para>
56582 <para>
56583 There is no current way to staple a proof for a client certificate.
56584 </para>
56585 <literallayout class="monospaced">
56586   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
56587   OCSP server is supplied.  The server URL may be included in the
56588   server certificate, if the CA is helpful.
56589
56590   One failure mode seen was the OCSP Signer cert expiring before the end
56591   of validity of the OCSP proof. The checking done by Exim/OpenSSL
56592   noted this as invalid overall, but the re-fetch script did not.
56593 </literallayout>
56594 </section>
56595 <section id="SECTclientTLS">
56596 <title>Configuring an Exim client to use TLS</title>
56597 <para>
56598 <indexterm role="concept">
56599 <primary>cipher</primary>
56600 <secondary>logging</secondary>
56601 </indexterm>
56602 <indexterm role="concept">
56603 <primary>log</primary>
56604 <secondary>TLS cipher</secondary>
56605 </indexterm>
56606 <indexterm role="concept">
56607 <primary>log</primary>
56608 <secondary>distinguished name</secondary>
56609 </indexterm>
56610 <indexterm role="concept">
56611 <primary>TLS</primary>
56612 <secondary>configuring an Exim client</secondary>
56613 </indexterm>
56614 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
56615 deliveries as well as to incoming, the latter one causing logging of the
56616 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
56617 within the <command>smtp</command> transport.
56618 </para>
56619 <para>
56620 <indexterm role="concept">
56621 <primary>ESMTP extensions</primary>
56622 <secondary>STARTTLS</secondary>
56623 </indexterm>
56624 It is not necessary to set any options to have TLS work in the <command>smtp</command>
56625 transport. If Exim is built with TLS support, and TLS is advertised by a
56626 server, the <command>smtp</command> transport always tries to start a TLS session. However,
56627 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
56628 transport) to a list of server hosts for which TLS should not be used.
56629 </para>
56630 <para>
56631 If you do not want Exim to attempt to send messages unencrypted when an attempt
56632 to set up an encrypted connection fails in any way, you can set
56633 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
56634 those hosts, delivery is always deferred if an encrypted connection cannot be
56635 set up. If there are any other hosts for the address, they are tried in the
56636 usual way.
56637 </para>
56638 <para>
56639 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
56640 the message unencrypted. It always does this if the response to STARTTLS is
56641 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
56642 session after a success response code, what happens is controlled by the
56643 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
56644 delivery to this host is deferred, and other hosts (if available) are tried. If
56645 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
56646 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
56647 negotiation fails, Exim closes the current connection (because it is in an
56648 unknown state), opens a new one to the same host, and then tries the delivery
56649 unencrypted.
56650 </para>
56651 <para>
56652 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
56653 transport provide the client with a certificate, which is passed to the server
56654 if it requests it. If the server is Exim, it will request a certificate only if
56655 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
56656 </para>
56657 <para>
56658 <emphasis role="bold">Note</emphasis>: Do not use a certificate which has the OCSP-must-staple extension,
56659 for client use (they are usable for server use).
56660 As the TLS protocol has no means for the client to staple before TLS 1.3 it will result
56661 in failed connections.
56662 </para>
56663 <para>
56664 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
56665 specifies a collection of expected server certificates.
56666 These may be
56667 the system default set (depending on library version),
56668 a file,
56669 or (depending on library version) a directory.
56670 The client verifies the server&#x2019;s certificate
56671 against this collection, taking into account any revoked certificates that are
56672 in the list defined by <option>tls_crl</option>.
56673 Failure to verify fails the TLS connection unless either of the
56674 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
56675 </para>
56676 <para>
56677 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
56678 certificate verification to the listed servers.  Verification either must
56679 or need not succeed respectively.
56680 </para>
56681 <para>
56682 The <option>tls_verify_cert_hostnames</option> option lists hosts for which additional
56683 name checks are made on the server certificate.
56684 </para>
56685 <para revisionflag="changed">
56686 The match against this list is, as per other Exim usage, the
56687 IP for the host.  That is most closely associated with the
56688 name on the DNS A (or AAAA) record for the host.
56689 However, the name that needs to be in the certificate
56690 is the one at the head of any CNAME chain leading to the A record.
56691 </para>
56692 <para>
56693 The option defaults to always checking.
56694 </para>
56695 <para>
56696 The <command>smtp</command> transport has two OCSP-related options:
56697 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
56698 is requested and required for the connection to proceed.  The default
56699 value is empty.
56700 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
56701 a Certificate Status is requested (but not necessarily verified).  The default
56702 value is "*" meaning that requests are made unless configured
56703 otherwise.
56704 </para>
56705 <para>
56706 The host(s) should also be in <option>hosts_require_tls</option>, and
56707 <option>tls_verify_certificates</option> configured for the transport,
56708 for OCSP to be relevant.
56709 </para>
56710 <para>
56711 If
56712 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
56713 list of permitted cipher suites. If either of these checks fails, delivery to
56714 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
56715 alternative hosts, if any.
56716 </para>
56717 <para>
56718  <emphasis role="bold">Note</emphasis>:
56719 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
56720 is operating as a client. Exim does not assume that a server certificate (set
56721 by the global options of the same name) should also be used when operating as a
56722 client.
56723 </para>
56724 <para>
56725 <indexterm role="variable">
56726 <primary><varname>$host</varname></primary>
56727 </indexterm>
56728 <indexterm role="variable">
56729 <primary><varname>$host_address</varname></primary>
56730 </indexterm>
56731 All the TLS options in the <command>smtp</command> transport are expanded before use, with
56732 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
56733 which the client is connected. Forced failure of an expansion causes Exim to
56734 behave as if the relevant option were unset.
56735 </para>
56736 <para>
56737 <indexterm role="variable">
56738 <primary><varname>$tls_out_bits</varname></primary>
56739 </indexterm>
56740 <indexterm role="variable">
56741 <primary><varname>$tls_out_cipher</varname></primary>
56742 </indexterm>
56743 <indexterm role="variable">
56744 <primary><varname>$tls_out_peerdn</varname></primary>
56745 </indexterm>
56746 <indexterm role="variable">
56747 <primary><varname>$tls_out_sni</varname></primary>
56748 </indexterm>
56749 Before an SMTP connection is established, the
56750 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
56751 variables are emptied. (Until the first connection, they contain the values
56752 that were set when the message was received.) If STARTTLS is subsequently
56753 successfully obeyed, these variables are set to the relevant values for the
56754 outgoing connection.
56755 </para>
56756 </section>
56757 <section id="SECTtlssni">
56758 <title>Use of TLS Server Name Indication</title>
56759 <para>
56760 <indexterm role="concept">
56761 <primary>TLS</primary>
56762 <secondary>Server Name Indication</secondary>
56763 </indexterm>
56764 <indexterm role="variable">
56765 <primary><varname>$tls_in_sni</varname></primary>
56766 </indexterm>
56767 <indexterm role="option">
56768 <primary><option>tls_in_sni</option></primary>
56769 </indexterm>
56770 With TLS1.0 or above, there is an extension mechanism by which extra
56771 information can be included at various points in the protocol.  One of these
56772 extensions, documented in RFC 6066 (and before that RFC 4366) is
56773 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
56774 client in the initial handshake, so that the server can examine the servername
56775 within and possibly choose to use different certificates and keys (and more)
56776 for this session.
56777 </para>
56778 <para>
56779 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
56780 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
56781 address.
56782 </para>
56783 <para>
56784 With SMTP to MX, there are the same problems here as in choosing the identity
56785 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
56786 provide the identity which you then cryptographically verify.  So this will
56787 be of limited use in that environment.
56788 </para>
56789 <para>
56790 With SMTP to Submission, there is a well-defined hostname which clients are
56791 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
56792 choose to include this information in the TLS negotiation.  If this becomes
56793 wide-spread, then hosters can choose to present different certificates to
56794 different clients.  Or even negotiate different cipher suites.
56795 </para>
56796 <para>
56797 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
56798 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
56799 nothing more to it.  Choosing a sensible value not derived insecurely is the
56800 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
56801 for the lifetime of the client connection (including during authentication).
56802 </para>
56803 <para revisionflag="changed">
56804 If DAVE validated the connection attempt then the value of the <option>tls_sni</option> option
56805 is forced to the domain part of the recipient address.
56806 </para>
56807 <para>
56808 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
56809 received from a client.
56810 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
56811 </para>
56812 <para>
56813 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
56814 option (prior to expansion) then the following options will be re-expanded
56815 during TLS session handshake, to permit alternative values to be chosen:
56816 </para>
56817 <itemizedlist>
56818 <listitem>
56819 <para>
56820 <option>tls_certificate</option>
56821 </para>
56822 </listitem>
56823 <listitem>
56824 <para>
56825 <option>tls_crl</option>
56826 </para>
56827 </listitem>
56828 <listitem>
56829 <para>
56830 <option>tls_privatekey</option>
56831 </para>
56832 </listitem>
56833 <listitem>
56834 <para>
56835 <option>tls_verify_certificates</option>
56836 </para>
56837 </listitem>
56838 <listitem>
56839 <para>
56840 <option>tls_ocsp_file</option>
56841 </para>
56842 </listitem>
56843 </itemizedlist>
56844 <para>
56845 Great care should be taken to deal with matters of case, various injection
56846 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
56847 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
56848 arbitrary unverified data provided prior to authentication.
56849 Further, the initial certificate is loaded before SNI has arrived, so
56850 an expansion for <option>tls_certificate</option> must have a default which is used
56851 when <varname>$tls_in_sni</varname> is empty.
56852 </para>
56853 <para>
56854 The Exim developers are proceeding cautiously and so far no other TLS options
56855 are re-expanded.
56856 </para>
56857 <para>
56858 When Exim is built against OpenSSL, OpenSSL must have been built with support
56859 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
56860 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
56861 see <literal>-servername</literal> in the output, then OpenSSL has support.
56862 </para>
56863 <para>
56864 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
56865 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
56866 built, then you have SNI support).
56867 </para>
56868 </section>
56869 <section id="SECTmulmessam">
56870 <title>Multiple messages on the same encrypted TCP/IP connection</title>
56871 <para>
56872 <indexterm role="concept">
56873 <primary>multiple SMTP deliveries with TLS</primary>
56874 </indexterm>
56875 <indexterm role="concept">
56876 <primary>TLS</primary>
56877 <secondary>multiple message deliveries</secondary>
56878 </indexterm>
56879 Exim sends multiple messages down the same TCP/IP connection by starting up
56880 an entirely new delivery process for each message, passing the socket from
56881 one process to the next. This implementation does not fit well with the use
56882 of TLS, because there is quite a lot of state information associated with a TLS
56883 connection, not just a socket identification. Passing all the state information
56884 to a new process is not feasible. Consequently, for sending using TLS Exim
56885 starts an additional proxy process for handling the encryption, piping the
56886 unencrypted data stream from and to the delivery processes.
56887 </para>
56888 <para>
56889 An older mode of operation can be enabled on a per-host basis by the
56890 <option>hosts_noproxy_tls</option> option on the <command>smtp</command> transport.  If the host matches
56891 this list the proxy process described above is not used; instead Exim
56892 shuts down an existing TLS session being run by the delivery process
56893 before passing the socket to a new process. The new process may then
56894 try to start a new TLS session, and if successful, may try to re-authenticate
56895 if AUTH is in use, before sending the next message.
56896 </para>
56897 <para>
56898 The RFC is not clear as to whether or not an SMTP session continues in clear
56899 after TLS has been shut down, or whether TLS may be restarted again later, as
56900 just described. However, if the server is Exim, this shutdown and
56901 reinitialization works. It is not known which (if any) other servers operate
56902 successfully if the client closes a TLS session and continues with unencrypted
56903 SMTP, but there are certainly some that do not work. For such servers, Exim
56904 should not pass the socket to another process, because the failure of the
56905 subsequent attempt to use it would cause Exim to record a temporary host error,
56906 and delay other deliveries to that host.
56907 </para>
56908 <para>
56909 To test for this case, Exim sends an EHLO command to the server after
56910 closing down the TLS session. If this fails in any way, the connection is
56911 closed instead of being passed to a new delivery process, but no retry
56912 information is recorded.
56913 </para>
56914 <para>
56915 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
56916 <command>smtp</command> transport to match those hosts for which Exim should not pass
56917 connections to new processes if TLS has been used.
56918 </para>
56919 </section>
56920 <section id="SECTcerandall">
56921 <title>Certificates and all that</title>
56922 <para>
56923 <indexterm role="concept">
56924 <primary>certificate</primary>
56925 <secondary>references to discussion</secondary>
56926 </indexterm>
56927 In order to understand fully how TLS works, you need to know about
56928 certificates, certificate signing, and certificate authorities.
56929 This is a large topic and an introductory guide is unsuitable for the Exim
56930 reference manual, so instead we provide pointers to existing documentation.
56931 </para>
56932 <para>
56933 The Apache web-server was for a long time the canonical guide, so their
56934 documentation is a good place to start; their SSL module&#x2019;s Introduction
56935 document is currently at
56936 </para>
56937 <literallayout>
56938 <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>
56939 </literallayout>
56940 <para>
56941 and their FAQ is at
56942 </para>
56943 <literallayout>
56944 <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>
56945 </literallayout>
56946 <para>
56947 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
56948 0-201-61598-3) in 2001, contains both introductory and more in-depth
56949 descriptions.
56950 More recently Ivan Ristić&#x2019;s book <emphasis>Bulletproof SSL and TLS</emphasis>,
56951 published by Feisty Duck (ISBN 978-1907117046) in 2013 is good.
56952 Ivan is the author of the popular TLS testing tools at
56953 <emphasis role="bold"><ulink url="https://www.ssllabs.com/">https://www.ssllabs.com/</ulink></emphasis>.
56954 </para>
56955 </section>
56956 <section id="SECID186">
56957 <title>Certificate chains</title>
56958 <para>
56959 The file named by <option>tls_certificate</option> may contain more than one
56960 certificate. This is useful in the case where the certificate that is being
56961 sent is validated by an intermediate certificate which the other end does
56962 not have. Multiple certificates must be in the correct order in the file.
56963 First the host&#x2019;s certificate itself, then the first intermediate
56964 certificate to validate the issuer of the host certificate, then the next
56965 intermediate certificate to validate the issuer of the first intermediate
56966 certificate, and so on, until finally (optionally) the root certificate.
56967 The root certificate must already be trusted by the recipient for
56968 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
56969 root certificate along with the rest makes it available for the user to
56970 install if the receiving end is a client MUA that can interact with a user.
56971 </para>
56972 <para>
56973 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
56974 even if your libraries allow loading them for use in Exim when acting as a
56975 server, increasingly clients will not accept such certificates.  The error
56976 diagnostics in such a case can be frustratingly vague.
56977 </para>
56978 </section>
56979 <section id="SECID187">
56980 <title>Self-signed certificates</title>
56981 <para>
56982 <indexterm role="concept">
56983 <primary>certificate</primary>
56984 <secondary>self-signed</secondary>
56985 </indexterm>
56986 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
56987 with OpenSSL, like this:
56988 </para>
56989 <literallayout class="monospaced">
56990 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
56991             -days 9999 -nodes
56992 </literallayout>
56993 <para>
56994 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
56995 delimited and so can be identified independently. The <option>-days</option> option
56996 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
56997 important: if you do not set it, the key is encrypted with a passphrase
56998 that you are prompted for, and any use that is made of the key causes more
56999 prompting for the passphrase. This is not helpful if you are going to use
57000 this certificate and key in an MTA, where prompting is not possible.
57001 </para>
57002 <para>
57003 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
57004 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
57005 the above command might produce a date in the past.  Think carefully about
57006 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
57007 of the certificate or reconsider your platform deployment.  (At time of
57008 writing, reducing the duration is the most likely choice, but the inexorable
57009 progression of time takes us steadily towards an era where this will not
57010 be a sensible resolution).
57011 </para>
57012 <para>
57013 A self-signed certificate made in this way is sufficient for testing, and
57014 may be adequate for all your requirements if you are mainly interested in
57015 encrypting transfers, and not in secure identification.
57016 </para>
57017 <para>
57018 However, many clients require that the certificate presented by the server be a
57019 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
57020 certificate. In this situation, the self-signed certificate described above
57021 must be installed on the client host as a trusted root <emphasis>certification
57022 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
57023 signed with that self-signed certificate.
57024 </para>
57025 <para>
57026 For information on creating self-signed CA certificates and using them to sign
57027 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
57028 Open-source PKI book, available online at
57029 <emphasis role="bold"><ulink url="https://sourceforge.net/projects/ospkibook/">https://sourceforge.net/projects/ospkibook/</ulink></emphasis>.
57030 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
57031 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
57032 </para>
57033 </section>
57034 <section id="SECDANE">
57035 <title>DANE</title>
57036 <para>
57037 <indexterm role="concept">
57038 <primary>DANE</primary>
57039 </indexterm>
57040 DNS-based Authentication of Named Entities, as applied to SMTP over TLS, provides assurance to a client that
57041 it is actually talking to the server it wants to rather than some attacker operating a Man In The Middle (MITM)
57042 operation.  The latter can terminate the TLS connection you make, and make another one to the server (so both
57043 you and the server still think you have an encrypted connection) and, if one of the "well known" set of
57044 Certificate Authorities has been suborned - something which *has* been seen already (2014), a verifiable
57045 certificate (if you&#x2019;re using normal root CAs, eg. the Mozilla set, as your trust anchors).
57046 </para>
57047 <para>
57048 What DANE does is replace the CAs with the DNS as the trust anchor.  The assurance is limited to a) the possibility
57049 that the DNS has been suborned, b) mistakes made by the admins of the target server.   The attack surface presented
57050 by (a) is thought to be smaller than that of the set of root CAs.
57051 </para>
57052 <para>
57053 It also allows the server to declare (implicitly) that connections to it should use TLS.  An MITM could simply
57054 fail to pass on a server&#x2019;s STARTTLS.
57055 </para>
57056 <para>
57057 DANE scales better than having to maintain (and communicate via side-channel) copies of server certificates
57058 for every possible target server.  It also scales (slightly) better than having to maintain on an SMTP
57059 client a copy of the standard CAs bundle.  It also means not having to pay a CA for certificates.
57060 </para>
57061 <para>
57062 DANE requires a server operator to do three things: 1) run DNSSEC.  This provides assurance to clients
57063 that DNS lookups they do for the server have not been tampered with.  The domain MX record applying
57064 to this server, its A record, its TLSA record and any associated CNAME records must all be covered by
57065 DNSSEC.
57066 2) add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
57067 3) offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records.
57068 </para>
57069 <para>
57070 There are no changes to Exim specific to server-side operation of DANE.
57071 Support for client-side operation of DANE can be included at compile time by defining SUPPORT_DANE=yes
57072 in <filename>Local/Makefile</filename>.
57073 If it has been included, the macro "_HAVE_DANE" will be defined.
57074 </para>
57075 <para>
57076 A TLSA record consist of 4 fields, the "Certificate Usage", the
57077 "Selector", the "Matching type", and the "Certificate Association Data".
57078 For a detailed description of the TLSA record see
57079 <emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc7671#page-5">RFC 7671</ulink></emphasis>.
57080 </para>
57081 <para>
57082 The TLSA record for the server may have "Certificate Usage" (1st) field of DANE-TA(2) or DANE-EE(3).
57083 These are the "Trust Anchor" and "End Entity" variants.
57084 The latter specifies the End Entity directly, i.e. the certificate involved is that of the server
57085 (and if only DANE-EE is used then it should be the sole one transmitted during the TLS handshake);
57086 this is appropriate for a single system, using a self-signed certificate.
57087 DANE-TA usage is effectively declaring a specific CA to be used; this might be a private CA or a public,
57088 well-known one.
57089 A private CA at simplest is just a self-signed certificate (with certain
57090 attributes) which is used to sign server certificates, but running one securely
57091 does require careful arrangement.
57092 With DANE-TA, as implemented in Exim and commonly in other MTAs,
57093 the server TLS handshake must transmit the entire certificate chain from CA to server-certificate.
57094 DANE-TA is commonly used for several services and/or servers, each having a TLSA query-domain CNAME record,
57095 all of which point to a single TLSA record.
57096 DANE-TA and DANE-EE can both be used together.
57097 </para>
57098 <para>
57099 Our recommendation is to use DANE with a certificate from a public CA,
57100 because this enables a variety of strategies for remote clients to verify
57101 your certificate.
57102 You can then publish information both via DANE and another technology,
57103 "MTA-STS", described below.
57104 </para>
57105 <para>
57106 When you use DANE-TA to publish trust anchor information, you ask entities
57107 outside your administrative control to trust the Certificate Authority for
57108 connections to you.
57109 If using a private CA then you should expect others to still apply the
57110 technical criteria they&#x2019;d use for a public CA to your certificates.
57111 In particular, you should probably try to follow current best practices for CA
57112 operation around hash algorithms and key sizes.
57113 Do not expect other organizations to lower their security expectations just
57114 because a particular profile might be reasonable for your own internal use.
57115 </para>
57116 <para>
57117 When this text was last updated, this in practice means to avoid use of SHA-1
57118 and MD5; if using RSA to use key sizes of at least 2048 bits (and no larger
57119 than 4096, for interoperability); to use keyUsage fields correctly; to use
57120 random serial numbers.
57121 The list of requirements is subject to change as best practices evolve.
57122 If you&#x2019;re not already using a private CA, or it doesn&#x2019;t meet these
57123 requirements, then we encourage you to avoid all these issues and use a public
57124 CA such as <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis> instead.
57125 </para>
57126 <para>
57127 The TLSA record should have a "Selector" (2nd) field of SPKI(1) and
57128 a "Matching Type" (3rd) field of SHA2-512(2).
57129 </para>
57130 <para>
57131 For the "Certificate Authority Data" (4th) field, commands like
57132 </para>
57133 <literallayout class="monospaced">
57134   openssl x509 -pubkey -noout &lt;certificate.pem \
57135   | openssl rsa -outform der -pubin 2&gt;/dev/null \
57136   | openssl sha512 \
57137   | awk '{print $2}'
57138 </literallayout>
57139 <para>
57140 are workable to create a hash of the certificate&#x2019;s public key.
57141 </para>
57142 <para>
57143 An example TLSA record for DANE-EE(3), SPKI(1), and SHA-512 (2) looks like
57144 </para>
57145 <literallayout class="monospaced">
57146   _25._tcp.mail.example.com. TLSA 3 1 2 8BA8A336E...
57147 </literallayout>
57148 <para>
57149 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>
57150 is useful for quickly generating TLSA records.
57151 </para>
57152 <para>
57153 For use with the DANE-TA model, server certificates must have a correct name (SubjectName or SubjectAltName).
57154 </para>
57155 <para>
57156 The Certificate issued by the CA published in the DANE-TA model should be
57157 issued using a strong hash algorithm.
57158 Exim, and importantly various other MTAs sending to you, will not
57159 re-enable hash algorithms which have been disabled by default in TLS
57160 libraries.
57161 This means no MD5 and no SHA-1.  SHA2-256 is the minimum for reliable
57162 interoperability (and probably the maximum too, in 2018).
57163 </para>
57164 <para>
57165 The use of OCSP-stapling should be considered, allowing for fast revocation of certificates (which would otherwise
57166 be limited by the DNS TTL on the TLSA records).  However, this is likely to only be usable with DANE-TA.  NOTE: the
57167 default of requesting OCSP for all hosts is modified iff DANE is in use, to:
57168 </para>
57169 <literallayout class="monospaced">
57170   hosts_request_ocsp = ${if or { {= {0}{$tls_out_tlsa_usage}} \
57171                                  {= {4}{$tls_out_tlsa_usage}} } \
57172                          {*}{}}
57173 </literallayout>
57174 <para>
57175 The (new) variable <varname>$tls_out_tlsa_usage</varname> is a bitfield with numbered bits set for TLSA record usage codes.
57176 The zero above means DANE was not in use, the four means that only DANE-TA usage TLSA records were
57177 found. If the definition of <option>hosts_request_ocsp</option> includes the
57178 string "tls_out_tlsa_usage", they are re-expanded in time to
57179 control the OCSP request.
57180 </para>
57181 <para>
57182 This modification of hosts_request_ocsp is only done if it has the default value of "*".  Admins who change it, and
57183 those who use <option>hosts_require_ocsp</option>, should consider the interaction with DANE in their OCSP settings.
57184 </para>
57185 <para>
57186 For client-side DANE there are three new smtp transport options, <option>hosts_try_dane</option>, <option>hosts_require_dane</option>
57187 and <option>dane_require_tls_ciphers</option>.
57188 The <quote>require</quote> variant will result in failure if the target host is not
57189 DNSSEC-secured. To get DNSSEC-secured hostname resolution, use
57190 the <option>dnssec_request_domains</option> router or transport option.
57191 </para>
57192 <para>
57193 DANE will only be usable if the target host has DNSSEC-secured MX, A and TLSA records.
57194 </para>
57195 <para>
57196 A TLSA lookup will be done if either of the above options match and the host-lookup succeeded using dnssec.
57197 If a TLSA lookup is done and succeeds, a DANE-verified TLS connection
57198 will be required for the host.  If it does not, the host will not
57199 be used; there is no fallback to non-DANE or non-TLS.
57200 </para>
57201 <para>
57202 If DANE is requested and usable, then the TLS cipher list configuration
57203 prefers to use the option <option>dane_require_tls_ciphers</option> and falls
57204 back to <option>tls_require_ciphers</option> only if that is unset.
57205 This lets you configure "decent crypto" for DANE and "better than nothing
57206 crypto" as the default.  Note though that while GnuTLS lets the string control
57207 which versions of TLS/SSL will be negotiated, OpenSSL does not and you&#x2019;re
57208 limited to ciphersuite constraints.
57209 </para>
57210 <para>
57211 If DANE is requested and useable (see above) the following transport options are ignored:
57212 </para>
57213 <literallayout class="monospaced">
57214   hosts_require_tls
57215   tls_verify_hosts
57216   tls_try_verify_hosts
57217   tls_verify_certificates
57218   tls_crl
57219   tls_verify_cert_hostnames
57220   tls_sni
57221 </literallayout>
57222 <para>
57223 If DANE is not usable, whether requested or not, and CA-anchored
57224 verification evaluation is wanted, the above variables should be set appropriately.
57225 </para>
57226 <para>
57227 The router and transport option <option>dnssec_request_domains</option> must not be
57228 set to <quote>never</quote>, and <option>dnssec_require_domains</option> is ignored.
57229 </para>
57230 <para>
57231 If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane".
57232 </para>
57233 <para>
57234 There is a new variable <varname>$tls_out_dane</varname> which will have "yes" if
57235 verification succeeded using DANE and "no" otherwise (only useful
57236 in combination with events; see <xref linkend="CHAPevents"/>),
57237 and a new variable <varname>$tls_out_tlsa_usage</varname> (detailed above).
57238 </para>
57239 <para>
57240 <indexterm role="concept">
57241 <primary>DANE</primary>
57242 <secondary>reporting</secondary>
57243 </indexterm>
57244 An event (see <xref linkend="CHAPevents"/>) of type "dane:fail" will be raised on failures
57245 to achieve DANE-verified connection, if one was either requested and offered, or
57246 required.  This is intended to support TLS-reporting as defined in
57247 <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>.
57248 The <varname>$event_data</varname> will be one of the Result Types defined in
57249 Section 4.3 of that document.
57250 </para>
57251 <para>
57252 Under GnuTLS, DANE is only supported from version 3.0.0 onwards.
57253 </para>
57254 <para>
57255 DANE is specified in published RFCs and decouples certificate authority trust
57256 selection from a "race to the bottom" of "you must trust everything for mail
57257 to get through".  There is an alternative technology called MTA-STS, which
57258 instead publishes MX trust anchor information on an HTTPS website.  At the
57259 time this text was last updated, MTA-STS was still a draft, not yet an RFC.
57260 Exim has no support for MTA-STS as a client, but Exim mail server operators
57261 can choose to publish information describing their TLS configuration using
57262 MTA-STS to let those clients who do use that protocol derive trust
57263 information.
57264 </para>
57265 <para>
57266 The MTA-STS design requires a certificate from a public Certificate Authority
57267 which is recognized by clients sending to you.
57268 That selection of which CAs are trusted by others is outside your control.
57269 </para>
57270 <para>
57271 The most interoperable course of action is probably to use
57272 <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis>, with automated certificate
57273 renewal; to publish the anchor information in DNSSEC-secured DNS via TLSA
57274 records for DANE clients (such as Exim and Postfix) and to publish anchor
57275 information for MTA-STS as well.  This is what is done for the <emphasis>exim.org</emphasis>
57276 domain itself (with caveats around occasionally broken MTA-STS because of
57277 incompatible specification changes prior to reaching RFC status).
57278 </para>
57279 </section>
57280 </chapter>
57281
57282 <chapter id="CHAPACL">
57283 <title>Access control lists</title>
57284 <para>
57285 <indexterm role="concept" id="IIDacl" class="startofrange">
57286 <primary>access control lists (ACLs)</primary>
57287 <secondary>description</secondary>
57288 </indexterm>
57289 <indexterm role="concept">
57290 <primary>control of incoming mail</primary>
57291 </indexterm>
57292 <indexterm role="concept">
57293 <primary>message</primary>
57294 <secondary>controlling incoming</secondary>
57295 </indexterm>
57296 <indexterm role="concept">
57297 <primary>policy control</primary>
57298 <secondary>access control lists</secondary>
57299 </indexterm>
57300 Access Control Lists (ACLs) are defined in a separate section of the runtime
57301 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
57302 name, terminated by a colon. Here is a complete ACL section that contains just
57303 one very small ACL:
57304 </para>
57305 <literallayout class="monospaced">
57306 begin acl
57307 small_acl:
57308   accept   hosts = one.host.only
57309 </literallayout>
57310 <para>
57311 You can have as many lists as you like in the ACL section, and the order in
57312 which they appear does not matter. The lists are self-terminating.
57313 </para>
57314 <para>
57315 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
57316 certain SMTP commands. This applies both to incoming TCP/IP connections, and
57317 when a local process submits a message using SMTP by specifying the <option>-bs</option>
57318 option. The most common use is for controlling which recipients are accepted
57319 in incoming messages. In addition, you can define an ACL that is used to check
57320 local non-SMTP messages. The default configuration file contains an example of
57321 a realistic ACL for checking RCPT commands. This is discussed in chapter
57322 <xref linkend="CHAPdefconfil"/>.
57323 </para>
57324 <section id="SECID188">
57325 <title>Testing ACLs</title>
57326 <para>
57327 The <option>-bh</option> command line option provides a way of testing your ACL
57328 configuration locally by running a fake SMTP session with which you interact.
57329 </para>
57330 </section>
57331 <section id="SECID189">
57332 <title>Specifying when ACLs are used</title>
57333 <para>
57334 <indexterm role="concept">
57335 <primary>access control lists (ACLs)</primary>
57336 <secondary>options for specifying</secondary>
57337 </indexterm>
57338 In order to cause an ACL to be used, you have to name it in one of the relevant
57339 options in the main part of the configuration. These options are:
57340 <indexterm role="concept">
57341 <primary>AUTH</primary>
57342 <secondary>ACL for</secondary>
57343 </indexterm>
57344 <indexterm role="concept">
57345 <primary>DATA</primary>
57346 <secondary>ACLs for</secondary>
57347 </indexterm>
57348 <indexterm role="concept">
57349 <primary>ETRN</primary>
57350 <secondary>ACL for</secondary>
57351 </indexterm>
57352 <indexterm role="concept">
57353 <primary>EXPN</primary>
57354 <secondary>ACL for</secondary>
57355 </indexterm>
57356 <indexterm role="concept">
57357 <primary>HELO</primary>
57358 <secondary>ACL for</secondary>
57359 </indexterm>
57360 <indexterm role="concept">
57361 <primary>EHLO</primary>
57362 <secondary>ACL for</secondary>
57363 </indexterm>
57364 <indexterm role="concept">
57365 <primary>DKIM</primary>
57366 <secondary>ACL for</secondary>
57367 </indexterm>
57368 <indexterm role="concept">
57369 <primary>MAIL</primary>
57370 <secondary>ACL for</secondary>
57371 </indexterm>
57372 <indexterm role="concept">
57373 <primary>QUIT, ACL for</primary>
57374 </indexterm>
57375 <indexterm role="concept">
57376 <primary>RCPT</primary>
57377 <secondary>ACL for</secondary>
57378 </indexterm>
57379 <indexterm role="concept">
57380 <primary>STARTTLS, ACL for</primary>
57381 </indexterm>
57382 <indexterm role="concept">
57383 <primary>VRFY</primary>
57384 <secondary>ACL for</secondary>
57385 </indexterm>
57386 <indexterm role="concept">
57387 <primary>SMTP</primary>
57388 <secondary>connection, ACL for</secondary>
57389 </indexterm>
57390 <indexterm role="concept">
57391 <primary>non-SMTP messages</primary>
57392 <secondary>ACLs for</secondary>
57393 </indexterm>
57394 <indexterm role="concept">
57395 <primary>MIME content scanning</primary>
57396 <secondary>ACL for</secondary>
57397 </indexterm>
57398 <indexterm role="concept">
57399 <primary>PRDR</primary>
57400 <secondary>ACL for</secondary>
57401 </indexterm>
57402 </para>
57403 <informaltable frame="none">
57404 <tgroup cols="2" colsep="0" rowsep="0">
57405 <colspec colwidth="140pt" align="left"/>
57406 <colspec colwidth="254pt" align="left"/>
57407 <tbody>
57408 <row>
57409 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
57410 <entry>ACL for non-SMTP messages</entry>
57411 </row>
57412 <row>
57413 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
57414 <entry>ACL for non-SMTP MIME parts</entry>
57415 </row>
57416 <row>
57417 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
57418 <entry>ACL at start of non-SMTP message</entry>
57419 </row>
57420 <row>
57421 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
57422 <entry>ACL for AUTH</entry>
57423 </row>
57424 <row>
57425 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
57426 <entry>ACL for start of SMTP connection</entry>
57427 </row>
57428 <row>
57429 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
57430 <entry>ACL after DATA is complete</entry>
57431 </row>
57432 <row>
57433 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
57434 <entry>ACL for each recipient, after DATA is complete</entry>
57435 </row>
57436 <row>
57437 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
57438 <entry>ACL for each DKIM signer</entry>
57439 </row>
57440 <row>
57441 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
57442 <entry>ACL for ETRN</entry>
57443 </row>
57444 <row>
57445 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
57446 <entry>ACL for EXPN</entry>
57447 </row>
57448 <row>
57449 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
57450 <entry>ACL for HELO or EHLO</entry>
57451 </row>
57452 <row>
57453 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
57454 <entry>ACL for MAIL</entry>
57455 </row>
57456 <row>
57457 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
57458 <entry>ACL for the AUTH parameter of MAIL</entry>
57459 </row>
57460 <row>
57461 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
57462 <entry>ACL for content-scanning MIME parts</entry>
57463 </row>
57464 <row>
57465 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
57466 <entry>ACL for non-QUIT terminations</entry>
57467 </row>
57468 <row>
57469 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
57470 <entry>ACL at start of DATA command</entry>
57471 </row>
57472 <row>
57473 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
57474 <entry>ACL for QUIT</entry>
57475 </row>
57476 <row>
57477 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
57478 <entry>ACL for RCPT</entry>
57479 </row>
57480 <row>
57481 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
57482 <entry>ACL for STARTTLS</entry>
57483 </row>
57484 <row>
57485 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
57486 <entry>ACL for VRFY</entry>
57487 </row>
57488 </tbody>
57489 </tgroup>
57490 </informaltable>
57491 <para>
57492 For example, if you set
57493 </para>
57494 <literallayout class="monospaced">
57495 acl_smtp_rcpt = small_acl
57496 </literallayout>
57497 <para>
57498 the little ACL defined above is used whenever Exim receives a RCPT command
57499 in an SMTP dialogue. The majority of policy tests on incoming messages can be
57500 done when RCPT commands arrive. A rejection of RCPT should cause the
57501 sending MTA to give up on the recipient address contained in the RCPT
57502 command, whereas rejection at other times may cause the client MTA to keep on
57503 trying to deliver the message. It is therefore recommended that you do as much
57504 testing as possible at RCPT time.
57505 </para>
57506 </section>
57507 <section id="SECID190">
57508 <title>The non-SMTP ACLs</title>
57509 <para>
57510 <indexterm role="concept">
57511 <primary>non-SMTP messages</primary>
57512 <secondary>ACLs for</secondary>
57513 </indexterm>
57514 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
57515 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
57516 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
57517 the state of the SMTP connection such as encryption and authentication) are not
57518 relevant and are forbidden in these ACLs. However, the sender and recipients
57519 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
57520 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
57521 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
57522 in any of these ACLs.
57523 </para>
57524 <para>
57525 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
57526 non-SMTP message, before any of the message has been read. (This is the
57527 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
57528 batched SMTP input, it runs after the DATA command has been reached. The
57529 result of this ACL is ignored; it cannot be used to reject a message. If you
57530 really need to, you could set a value in an ACL variable here and reject based
57531 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
57532 controls, and in particular, it can be used to set
57533 </para>
57534 <literallayout class="monospaced">
57535 control = suppress_local_fixups
57536 </literallayout>
57537 <para>
57538 This cannot be used in the other non-SMTP ACLs because by the time they are
57539 run, it is too late.
57540 </para>
57541 <para>
57542 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
57543 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
57544 </para>
57545 <para>
57546 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
57547 kind of rejection is treated as permanent, because there is no way of sending a
57548 temporary error for these kinds of message.
57549 </para>
57550 </section>
57551 <section id="SECID191">
57552 <title>The SMTP connect ACL</title>
57553 <para>
57554 <indexterm role="concept">
57555 <primary>SMTP</primary>
57556 <secondary>connection, ACL for</secondary>
57557 </indexterm>
57558 <indexterm role="option">
57559 <primary><option>smtp_banner</option></primary>
57560 </indexterm>
57561 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
57562 session, after the test specified by <option>host_reject_connection</option> (which is now
57563 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
57564 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
57565 the message override the banner message that is otherwise specified by the
57566 <option>smtp_banner</option> option.
57567 </para>
57568 </section>
57569 <section id="SECID192">
57570 <title>The EHLO/HELO ACL</title>
57571 <para>
57572 <indexterm role="concept">
57573 <primary>EHLO</primary>
57574 <secondary>ACL for</secondary>
57575 </indexterm>
57576 <indexterm role="concept">
57577 <primary>HELO</primary>
57578 <secondary>ACL for</secondary>
57579 </indexterm>
57580 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
57581 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
57582 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
57583 Note that a client may issue more than one EHLO or HELO command in an SMTP
57584 session, and indeed is required to issue a new EHLO or HELO after successfully
57585 setting up encryption following a STARTTLS command.
57586 </para>
57587 <para>
57588 Note also that a deny neither forces the client to go away nor means that
57589 mail will be refused on the connection.  Consider checking for
57590 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
57591 </para>
57592 <para>
57593 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
57594 modifier, the message may not contain more than one line (it will be truncated
57595 at the first newline and a panic logged if it does). Such a message cannot
57596 affect the EHLO options that are listed on the second and subsequent lines of
57597 an EHLO response.
57598 </para>
57599 </section>
57600 <section id="SECID193">
57601 <title>The DATA ACLs</title>
57602 <para>
57603 <indexterm role="concept">
57604 <primary>DATA</primary>
57605 <secondary>ACLs for</secondary>
57606 </indexterm>
57607 Two ACLs are associated with the DATA command, because it is two-stage
57608 command, with two responses being sent to the client.
57609 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
57610 is obeyed. This gives you control after all the RCPT commands, but before
57611 the message itself is received. It offers the opportunity to give a negative
57612 response to the DATA command before the data is transmitted. Header lines
57613 added by MAIL or RCPT ACLs are not visible at this time, but any that
57614 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
57615 </para>
57616 <para>
57617 You cannot test the contents of the message, for example, to verify addresses
57618 in the headers, at RCPT time or when the DATA command is received. Such
57619 tests have to appear in the ACL that is run after the message itself has been
57620 received, before the final response to the DATA command is sent. This is
57621 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
57622 associated with the DATA command.
57623 </para>
57624 <para>
57625 <indexterm role="concept">
57626 <primary>CHUNKING</primary>
57627 <secondary>BDAT command</secondary>
57628 </indexterm>
57629 <indexterm role="concept">
57630 <primary>BDAT</primary>
57631 <secondary>SMTP command</secondary>
57632 </indexterm>
57633 <indexterm role="concept">
57634 <primary>RFC 3030</primary>
57635 <secondary>CHUNKING</secondary>
57636 </indexterm>
57637 If CHUNKING was advertised and a BDAT command sequence is received,
57638 the <option>acl_smtp_predata</option> ACL is not run.
57639 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
57640 the data specified is received.
57641 </para>
57642 <para>
57643 For both of these ACLs, it is not possible to reject individual recipients. An
57644 error response rejects the entire message. Unfortunately, it is known that some
57645 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
57646 before or after the data) correctly &ndash; they keep the message on their queues
57647 and try again later, but that is their problem, though it does waste some of
57648 your resources.
57649 </para>
57650 <para>
57651 The <option>acl_smtp_data</option> ACL is run after
57652 the <option>acl_smtp_data_prdr</option>,
57653 the <option>acl_smtp_dkim</option>
57654 and the <option>acl_smtp_mime</option> ACLs.
57655 </para>
57656 </section>
57657 <section id="SECTDKIMACL">
57658 <title>The SMTP DKIM ACL</title>
57659 <para>
57660 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
57661 enabled (which is the default).
57662 </para>
57663 <para>
57664 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
57665 received, and is executed for each DKIM signature found in a message.  If not
57666 otherwise specified, the default action is to accept.
57667 </para>
57668 <para>
57669 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
57670 </para>
57671 <para>
57672 For details on the operation of DKIM, see section <xref linkend="SECDKIM"/>.
57673 </para>
57674 </section>
57675 <section id="SECID194">
57676 <title>The SMTP MIME ACL</title>
57677 <para>
57678 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
57679 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
57680 </para>
57681 <para>
57682 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
57683 </para>
57684 </section>
57685 <section id="SECTPRDRACL">
57686 <title>The SMTP PRDR ACL</title>
57687 <para>
57688 <indexterm role="concept">
57689 <primary>PRDR</primary>
57690 <secondary>ACL for</secondary>
57691 </indexterm>
57692 <indexterm role="option">
57693 <primary><option>prdr_enable</option></primary>
57694 </indexterm>
57695 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
57696 with PRDR support enabled (which is the default).
57697 It becomes active only when the PRDR feature is negotiated between
57698 client and server for a message, and more than one recipient
57699 has been accepted.
57700 </para>
57701 <para>
57702 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
57703 has been received, and is executed once for each recipient of the message
57704 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
57705 The test may accept, defer or deny for individual recipients.
57706 The <option>acl_smtp_data</option> will still be called after this ACL and
57707 can reject the message overall, even if this ACL has accepted it
57708 for some or all recipients.
57709 </para>
57710 <para>
57711 PRDR may be used to support per-user content filtering.  Without it
57712 one must defer any recipient after the first that has a different
57713 content-filter configuration.  With PRDR, the RCPT-time check
57714 <indexterm role="concept">
57715 <primary>PRDR</primary>
57716 <secondary>variable for</secondary>
57717 </indexterm>
57718 for this can be disabled when the variable <varname>$prdr_requested</varname>
57719 is <quote>yes</quote>.
57720 Any required difference in behaviour of the main DATA-time
57721 ACL should however depend on the PRDR-time ACL having run, as Exim
57722 will avoid doing so in some situations (e.g. single-recipient mails).
57723 </para>
57724 <para>
57725 See also the <option>prdr_enable</option> global option
57726 and the <option>hosts_try_prdr</option> smtp transport option.
57727 </para>
57728 <para>
57729 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
57730 If the ACL is not defined, processing completes as if
57731 the feature was not requested by the client.
57732 </para>
57733 </section>
57734 <section id="SECTQUITACL">
57735 <title>The QUIT ACL</title>
57736 <para>
57737 <indexterm role="concept">
57738 <primary>QUIT, ACL for</primary>
57739 </indexterm>
57740 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
57741 does not affect the response code to QUIT, which is always 221. Thus, the ACL
57742 does not in fact control any access.
57743 For this reason, it may only accept
57744 or warn as its final result.
57745 </para>
57746 <para>
57747 This ACL can be used for tasks such as custom logging at the end of an SMTP
57748 session. For example, you can use ACL variables in other ACLs to count
57749 messages, recipients, etc., and log the totals at QUIT time using one or
57750 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
57751 </para>
57752 <para>
57753 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
57754 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
57755 </para>
57756 <para>
57757 You do not need to have a final <option>accept</option>, but if you do, you can use a
57758 <option>message</option> modifier to specify custom text that is sent as part of the 221
57759 response to QUIT.
57760 </para>
57761 <para>
57762 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
57763 failure (for example, failure to open a log file, or when Exim is bombing out
57764 because it has detected an unrecoverable error), all SMTP commands from the
57765 client are given temporary error responses until QUIT is received or the
57766 connection is closed. In these special cases, the QUIT ACL does not run.
57767 </para>
57768 </section>
57769 <section id="SECTNOTQUITACL">
57770 <title>The not-QUIT ACL</title>
57771 <para>
57772 <indexterm role="variable">
57773 <primary><varname>$acl_smtp_notquit</varname></primary>
57774 </indexterm>
57775 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
57776 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
57777 trouble, such as being unable to write to its log files, this ACL is not run,
57778 because it might try to do things (such as write to log files) that make the
57779 situation even worse.
57780 </para>
57781 <para>
57782 Like the QUIT ACL, this ACL is provided to make it possible to do customized
57783 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
57784 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
57785 and <option>warn</option>.
57786 </para>
57787 <para>
57788 <indexterm role="variable">
57789 <primary><varname>$smtp_notquit_reason</varname></primary>
57790 </indexterm>
57791 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
57792 to a string that indicates the reason for the termination of the SMTP
57793 connection. The possible values are:
57794 </para>
57795 <informaltable frame="none">
57796 <tgroup cols="2" colsep="0" rowsep="0">
57797 <colspec colwidth="196pt" align="left"/>
57798 <colspec colwidth="254pt" align="left"/>
57799 <tbody>
57800 <row>
57801 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
57802 <entry>Another ACL issued a <option>drop</option> command</entry>
57803 </row>
57804 <row>
57805 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
57806 <entry>Too many unknown or non-mail commands</entry>
57807 </row>
57808 <row>
57809 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
57810 <entry>Timeout while reading SMTP commands</entry>
57811 </row>
57812 <row>
57813 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
57814 <entry>The SMTP connection has been lost</entry>
57815 </row>
57816 <row>
57817 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
57818 <entry>Timeout while reading message data</entry>
57819 </row>
57820 <row>
57821 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
57822 <entry>The <function>local_scan()</function> function crashed</entry>
57823 </row>
57824 <row>
57825 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
57826 <entry>The <function>local_scan()</function> function timed out</entry>
57827 </row>
57828 <row>
57829 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
57830 <entry>SIGTERM or SIGINT</entry>
57831 </row>
57832 <row>
57833 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
57834 <entry>SMTP synchronization error</entry>
57835 </row>
57836 <row>
57837 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
57838 <entry>TLS failed to start</entry>
57839 </row>
57840 </tbody>
57841 </tgroup>
57842 </informaltable>
57843 <para>
57844 In most cases when an SMTP connection is closed without having received QUIT,
57845 Exim sends an SMTP response message before actually closing the connection.
57846 With the exception of the <literal>acl-drop</literal> case, the default message can be
57847 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
57848 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
57849 used.
57850 </para>
57851 </section>
57852 <section id="SECID195">
57853 <title>Finding an ACL to use</title>
57854 <para>
57855 <indexterm role="concept">
57856 <primary>access control lists (ACLs)</primary>
57857 <secondary>finding which to use</secondary>
57858 </indexterm>
57859 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
57860 you can use different ACLs in different circumstances. For example,
57861 </para>
57862 <literallayout class="monospaced">
57863 acl_smtp_rcpt = ${if ={25}{$interface_port} \
57864                      {acl_check_rcpt} {acl_check_rcpt_submit} }
57865 </literallayout>
57866 <para>
57867 In the default configuration file there are some example settings for
57868 providing an RFC 4409 message <quote>submission</quote> service on port 587 and
57869 an RFC 8314 <quote>submissions</quote> service on port 465. You can use a string
57870 expansion like this to choose an ACL for MUAs on these ports which is
57871 more appropriate for this purpose than the default ACL on port 25.
57872 </para>
57873 <para>
57874 The expanded string does not have to be the name of an ACL in the
57875 configuration file; there are other possibilities. Having expanded the
57876 string, Exim searches for an ACL as follows:
57877 </para>
57878 <itemizedlist>
57879 <listitem>
57880 <para>
57881 If the string begins with a slash, Exim uses it as a filename, and reads its
57882 contents as an ACL. The lines are processed in the same way as lines in the
57883 Exim configuration file. In particular, continuation lines are supported, blank
57884 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
57885 If the file does not exist or cannot be read, an error occurs (typically
57886 causing a temporary failure of whatever caused the ACL to be run). For example:
57887 </para>
57888 <literallayout class="monospaced">
57889 acl_smtp_data = /etc/acls/\
57890   ${lookup{$sender_host_address}lsearch\
57891   {/etc/acllist}{$value}{default}}
57892 </literallayout>
57893 <para>
57894 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
57895 back to a default if the lookup fails. If an ACL is successfully read from a
57896 file, it is retained in memory for the duration of the Exim process, so that it
57897 can be re-used without having to re-read the file.
57898 </para>
57899 </listitem>
57900 <listitem>
57901 <para>
57902 If the string does not start with a slash, and does not contain any spaces,
57903 Exim searches the ACL section of the configuration for an ACL whose name
57904 matches the string.
57905 </para>
57906 </listitem>
57907 <listitem>
57908 <para>
57909 If no named ACL is found, or if the string contains spaces, Exim parses
57910 the string as an inline ACL. This can save typing in cases where you just
57911 want to have something like
57912 </para>
57913 <literallayout class="monospaced">
57914 acl_smtp_vrfy = accept
57915 </literallayout>
57916 <para>
57917 in order to allow free use of the VRFY command. Such a string may contain
57918 newlines; it is processed in the same way as an ACL that is read from a file.
57919 </para>
57920 </listitem>
57921 </itemizedlist>
57922 </section>
57923 <section id="SECID196">
57924 <title>ACL return codes</title>
57925 <para>
57926 <indexterm role="concept">
57927 <primary>access control lists (ACLs)</primary>
57928 <secondary>return codes</secondary>
57929 </indexterm>
57930 Except for the QUIT ACL, which does not affect the SMTP return code (see
57931 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
57932 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
57933 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
57934 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
57935 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
57936 This also causes a 4<emphasis>xx</emphasis> return code.
57937 </para>
57938 <para>
57939 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
57940 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
57941 submitters of non-SMTP messages.
57942 </para>
57943 <para>
57944 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
57945 has the effect of <quote>accept</quote>, but causes either the entire message or an
57946 individual recipient address to be discarded. In other words, it is a
57947 blackholing facility. Use it with care.
57948 </para>
57949 <para>
57950 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
57951 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
57952 RCPT ACL is to discard just the one recipient address. If there are no
57953 recipients left when the message&#x2019;s data is received, the DATA ACL is not
57954 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
57955 remaining recipients. The <quote>discard</quote> return is not permitted for the
57956 <option>acl_smtp_predata</option> ACL.
57957 </para>
57958 <para>
57959 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
57960 is done on the address and the result determines the SMTP response.
57961 </para>
57962 <para>
57963 <indexterm role="concept">
57964 <primary><function>local_scan()</function> function</primary>
57965 <secondary>when all recipients discarded</secondary>
57966 </indexterm>
57967 The <function>local_scan()</function> function is always run, even if there are no remaining
57968 recipients; it may create new recipients.
57969 </para>
57970 </section>
57971 <section id="SECID197">
57972 <title>Unset ACL options</title>
57973 <para>
57974 <indexterm role="concept">
57975 <primary>access control lists (ACLs)</primary>
57976 <secondary>unset options</secondary>
57977 </indexterm>
57978 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
57979 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
57980 not defined at all. For any defined ACL, the default action when control
57981 reaches the end of the ACL statements is <quote>deny</quote>.
57982 </para>
57983 <para>
57984 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
57985 these two are ACLs that are used only for their side effects. They cannot be
57986 used to accept or reject anything.
57987 </para>
57988 <para>
57989 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
57990 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
57991 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
57992 when the ACL is not defined is <quote>accept</quote>.
57993 </para>
57994 <para>
57995 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
57996 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
57997 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
57998 messages over an SMTP connection. For an example, see the ACL in the default
57999 configuration file.
58000 </para>
58001 </section>
58002 <section id="SECID198">
58003 <title>Data for message ACLs</title>
58004 <para>
58005 <indexterm role="concept">
58006 <primary>access control lists (ACLs)</primary>
58007 <secondary>data for message ACL</secondary>
58008 </indexterm>
58009 <indexterm role="variable">
58010 <primary><varname>$domain</varname></primary>
58011 </indexterm>
58012 <indexterm role="variable">
58013 <primary><varname>$local_part</varname></primary>
58014 </indexterm>
58015 <indexterm role="variable">
58016 <primary><varname>$sender_address</varname></primary>
58017 </indexterm>
58018 <indexterm role="variable">
58019 <primary><varname>$sender_host_address</varname></primary>
58020 </indexterm>
58021 <indexterm role="variable">
58022 <primary><varname>$smtp_command</varname></primary>
58023 </indexterm>
58024 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
58025 that contain information about the host and the message&#x2019;s sender (for example,
58026 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
58027 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
58028 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
58029 is available in <varname>$smtp_command</varname>.
58030 </para>
58031 <para>
58032 When an ACL for the AUTH parameter of MAIL is running, the variables that
58033 contain information about the host are set, but <varname>$sender_address</varname> is not yet
58034 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
58035 how it is used.
58036 </para>
58037 <para>
58038 <indexterm role="variable">
58039 <primary><varname>$message_size</varname></primary>
58040 </indexterm>
58041 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
58042 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
58043 that parameter is not given. The value is updated to the true message size by
58044 the time the final DATA ACL is run (after the message data has been
58045 received).
58046 </para>
58047 <para>
58048 <indexterm role="variable">
58049 <primary><varname>$rcpt_count</varname></primary>
58050 </indexterm>
58051 <indexterm role="variable">
58052 <primary><varname>$recipients_count</varname></primary>
58053 </indexterm>
58054 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
58055 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
58056 accepted, so while an ACL for RCPT is being processed, it contains the number
58057 of previously accepted recipients. At DATA time (for both the DATA ACLs),
58058 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
58059 <varname>$recipients_count</varname> contains the total number of accepted recipients.
58060 </para>
58061 </section>
58062 <section id="SECTdatfornon">
58063 <title>Data for non-message ACLs</title>
58064 <para>
58065 <indexterm role="concept">
58066 <primary>access control lists (ACLs)</primary>
58067 <secondary>data for non-message ACL</secondary>
58068 </indexterm>
58069 <indexterm role="variable">
58070 <primary><varname>$smtp_command_argument</varname></primary>
58071 </indexterm>
58072 <indexterm role="variable">
58073 <primary><varname>$smtp_command</varname></primary>
58074 </indexterm>
58075 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
58076 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
58077 and the entire SMTP command is available in <varname>$smtp_command</varname>.
58078 These variables can be tested using a <option>condition</option> condition. For example,
58079 here is an ACL for use with AUTH, which insists that either the session is
58080 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
58081 does not permit authentication methods that use cleartext passwords on
58082 unencrypted connections.
58083 </para>
58084 <literallayout class="monospaced">
58085 acl_check_auth:
58086   accept encrypted = *
58087   accept condition = ${if eq{${uc:$smtp_command_argument}}\
58088                      {CRAM-MD5}}
58089   deny   message   = TLS encryption or CRAM-MD5 required
58090 </literallayout>
58091 <para>
58092 (Another way of applying this restriction is to arrange for the authenticators
58093 that use cleartext passwords not to be advertised when the connection is not
58094 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
58095 option to do this.)
58096 </para>
58097 </section>
58098 <section id="SECID199">
58099 <title>Format of an ACL</title>
58100 <para>
58101 <indexterm role="concept">
58102 <primary>access control lists (ACLs)</primary>
58103 <secondary>format of</secondary>
58104 </indexterm>
58105 <indexterm role="concept">
58106 <primary>access control lists (ACLs)</primary>
58107 <secondary>verbs, definition of</secondary>
58108 </indexterm>
58109 An individual ACL consists of a number of statements. Each statement starts
58110 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
58111 Modifiers can change the way the verb operates, define error and log messages,
58112 set variables, insert delays, and vary the processing of accepted messages.
58113 </para>
58114 <para>
58115 If all the conditions are met, the verb is obeyed. The same condition may be
58116 used (with different arguments) more than once in the same statement. This
58117 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
58118 example:
58119 </para>
58120 <literallayout class="monospaced">
58121 deny  dnslists = list1.example
58122       dnslists = list2.example
58123 </literallayout>
58124 <para>
58125 If there are no conditions, the verb is always obeyed. Exim stops evaluating
58126 the conditions and modifiers when it reaches a condition that fails. What
58127 happens then depends on the verb (and in one case, on a special modifier). Not
58128 all the conditions make sense at every testing point. For example, you cannot
58129 test a sender address in the ACL that is run for a VRFY command.
58130 </para>
58131 </section>
58132 <section id="SECID200">
58133 <title>ACL verbs</title>
58134 <para>
58135 The ACL verbs are as follows:
58136 </para>
58137 <itemizedlist>
58138 <listitem>
58139 <para>
58140 <indexterm role="concept">
58141 <primary><option>accept</option> ACL verb</primary>
58142 </indexterm>
58143 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
58144 of the conditions are not met, what happens depends on whether <option>endpass</option>
58145 appears among the conditions (for syntax see below). If the failing condition
58146 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
58147 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
58148 check a RCPT command:
58149 </para>
58150 <literallayout class="monospaced">
58151 accept domains = +local_domains
58152        endpass
58153        verify = recipient
58154 </literallayout>
58155 <para>
58156 If the recipient domain does not match the <option>domains</option> condition, control
58157 passes to the next statement. If it does match, the recipient is verified, and
58158 the command is accepted if verification succeeds. However, if verification
58159 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
58160 <option>endpass</option>.
58161 </para>
58162 <para>
58163 The <option>endpass</option> feature has turned out to be confusing to many people, so its
58164 use is not recommended nowadays. It is always possible to rewrite an ACL so
58165 that <option>endpass</option> is not needed, and it is no longer used in the default
58166 configuration.
58167 </para>
58168 <para>
58169 <indexterm role="concept">
58170 <primary><option>message</option> ACL modifier</primary>
58171 <secondary>with <option>accept</option></secondary>
58172 </indexterm>
58173 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
58174 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
58175 (when an <option>accept</option> verb either accepts or passes control to the next
58176 statement), <option>message</option> can be used to vary the message that is sent when an
58177 SMTP command is accepted. For example, in a RCPT ACL you could have:
58178 </para>
58179 <literallayout>
58180 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
58181 <literal>        message = OK, I will allow you through today</literal>
58182 </literallayout>
58183 <para>
58184 You can specify an SMTP response code, optionally followed by an <quote>extended
58185 response code</quote> at the start of the message, but the first digit must be the
58186 same as would be sent by default, which is 2 for an <option>accept</option> verb.
58187 </para>
58188 <para>
58189 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
58190 an error message that is used when access is denied. This behaviour is retained
58191 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
58192 of <option>endpass</option>.
58193 </para>
58194 </listitem>
58195 <listitem>
58196 <para>
58197 <indexterm role="concept">
58198 <primary><option>defer</option> ACL verb</primary>
58199 </indexterm>
58200 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
58201 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
58202 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
58203 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
58204 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
58205 be used in any ACL, and even for a recipient it might be a simpler approach.
58206 </para>
58207 </listitem>
58208 <listitem>
58209 <para>
58210 <indexterm role="concept">
58211 <primary><option>deny</option> ACL verb</primary>
58212 </indexterm>
58213 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
58214 the conditions are not met, control is passed to the next ACL statement. For
58215 example,
58216 </para>
58217 <literallayout class="monospaced">
58218 deny dnslists = blackholes.mail-abuse.org
58219 </literallayout>
58220 <para>
58221 rejects commands from hosts that are on a DNS black list.
58222 </para>
58223 </listitem>
58224 <listitem>
58225 <para>
58226 <indexterm role="concept">
58227 <primary><option>discard</option> ACL verb</primary>
58228 </indexterm>
58229 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
58230 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
58231 that are concerned with receiving messages. When all the conditions are true,
58232 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
58233 recipients to be discarded. If it is used in an ACL for RCPT, just the one
58234 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
58235 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
58236 do not appear in the log line when the <option>received_recipients</option> log selector is set.
58237 </para>
58238 <para>
58239 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
58240 its contents are added to the line that is automatically written to the log.
58241 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
58242 </para>
58243 </listitem>
58244 <listitem>
58245 <para>
58246 <indexterm role="concept">
58247 <primary><option>drop</option> ACL verb</primary>
58248 </indexterm>
58249 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
58250 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
58251 </para>
58252 <literallayout class="monospaced">
58253 drop   condition = ${if &gt; {$rcpt_count}{20}}
58254        message   = I don't take more than 20 RCPTs
58255 </literallayout>
58256 <para>
58257 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
58258 The connection is always dropped after sending a 550 response.
58259 </para>
58260 </listitem>
58261 <listitem>
58262 <para>
58263 <indexterm role="concept">
58264 <primary><option>require</option> ACL verb</primary>
58265 </indexterm>
58266 <option>require</option>: If all the conditions are met, control is passed to the next ACL
58267 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
58268 example, when checking a RCPT command,
58269 </para>
58270 <literallayout class="monospaced">
58271 require message = Sender did not verify
58272         verify  = sender
58273 </literallayout>
58274 <para>
58275 passes control to subsequent statements only if the message&#x2019;s sender can be
58276 verified. Otherwise, it rejects the command. Note the positioning of the
58277 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
58278 discussed in section <xref linkend="SECTcondmodproc"/>.
58279 </para>
58280 </listitem>
58281 <listitem>
58282 <para>
58283 <indexterm role="concept">
58284 <primary><option>warn</option> ACL verb</primary>
58285 </indexterm>
58286 <option>warn</option>: If all the conditions are true, a line specified by the
58287 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
58288 to the next ACL statement. If any condition is false, the log line is not
58289 written. If an identical log line is requested several times in the same
58290 message, only one copy is actually written to the log. If you want to force
58291 duplicates to be written, use the <option>logwrite</option> modifier instead.
58292 </para>
58293 <para>
58294 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
58295 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
58296 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
58297 first failing condition. There is more about adding header lines in section
58298 <xref linkend="SECTaddheadacl"/>.
58299 </para>
58300 <para>
58301 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
58302 some sort of defer), the log line specified by <option>log_message</option> is not written.
58303 This does not include the case of a forced failure from a lookup, which
58304 is considered to be a successful completion. After a defer, no further
58305 conditions or modifiers in the <option>warn</option> statement are processed. The incident
58306 is logged, and the ACL continues to be processed, from the next statement
58307 onwards.
58308 </para>
58309 <para>
58310 <indexterm role="variable">
58311 <primary><varname>$acl_verify_message</varname></primary>
58312 </indexterm>
58313 When one of the <option>warn</option> conditions is an address verification that fails, the
58314 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
58315 want this logged, you must set it up explicitly. For example:
58316 </para>
58317 <literallayout class="monospaced">
58318 warn   !verify = sender
58319        log_message = sender verify failed: $acl_verify_message
58320 </literallayout>
58321 </listitem>
58322 </itemizedlist>
58323 <para>
58324 At the end of each ACL there is an implicit unconditional <option>deny</option>.
58325 </para>
58326 <para>
58327 As you can see from the examples above, the conditions and modifiers are
58328 written one to a line, with the first one on the same line as the verb, and
58329 subsequent ones on following lines. If you have a very long condition, you can
58330 continue it onto several physical lines by the usual backslash continuation
58331 mechanism. It is conventional to align the conditions vertically.
58332 </para>
58333 </section>
58334 <section id="SECTaclvariables">
58335 <title>ACL variables</title>
58336 <para>
58337 <indexterm role="concept">
58338 <primary>access control lists (ACLs)</primary>
58339 <secondary>variables</secondary>
58340 </indexterm>
58341 There are some special variables that can be set during ACL processing. They
58342 can be used to pass information between different ACLs, different invocations
58343 of the same ACL in the same SMTP connection, and between ACLs and the routers,
58344 transports, and filters that are used to deliver a message. The names of these
58345 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
58346 an underscore, but the remainder of the name can be any sequence of
58347 alphanumeric characters and underscores that you choose. There is no limit on
58348 the number of ACL variables. The two sets act as follows:
58349 </para>
58350 <itemizedlist>
58351 <listitem>
58352 <para>
58353 The values of those variables whose names begin with <varname>$acl_c</varname> persist
58354 throughout an SMTP connection. They are never reset. Thus, a value that is set
58355 while receiving one message is still available when receiving the next message
58356 on the same SMTP connection.
58357 </para>
58358 </listitem>
58359 <listitem>
58360 <para>
58361 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
58362 while a message is being received. They are reset afterwards. They are also
58363 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
58364 </para>
58365 </listitem>
58366 </itemizedlist>
58367 <para>
58368 When a message is accepted, the current values of all the ACL variables are
58369 preserved with the message and are subsequently made available at delivery
58370 time. The ACL variables are set by a modifier called <option>set</option>. For example:
58371 </para>
58372 <literallayout class="monospaced">
58373 accept hosts = whatever
58374        set acl_m4 = some value
58375 accept authenticated = *
58376        set acl_c_auth = yes
58377 </literallayout>
58378 <para>
58379 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
58380 be set. If you want to set a variable without taking any action, you can use a
58381 <option>warn</option> verb without any other modifiers or conditions.
58382 </para>
58383 <para>
58384 <indexterm role="option">
58385 <primary><option>strict_acl_vars</option></primary>
58386 </indexterm>
58387 What happens if a syntactically valid but undefined ACL variable is
58388 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
58389 false (the default), an empty string is substituted; if it is true, an
58390 error is generated.
58391 </para>
58392 <para>
58393 Versions of Exim before 4.64 have a limited set of numbered variables, but
58394 their names are compatible, so there is no problem with upgrading.
58395 </para>
58396 </section>
58397 <section id="SECTcondmodproc">
58398 <title>Condition and modifier processing</title>
58399 <para>
58400 <indexterm role="concept">
58401 <primary>access control lists (ACLs)</primary>
58402 <secondary>conditions; processing</secondary>
58403 </indexterm>
58404 <indexterm role="concept">
58405 <primary>access control lists (ACLs)</primary>
58406 <secondary>modifiers; processing</secondary>
58407 </indexterm>
58408 An exclamation mark preceding a condition negates its result. For example:
58409 </para>
58410 <literallayout class="monospaced">
58411 deny   domains = *.dom.example
58412       !verify  = recipient
58413 </literallayout>
58414 <para>
58415 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
58416 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
58417 negation can be used on the right-hand side of a condition. For example, these
58418 two statements are equivalent:
58419 </para>
58420 <literallayout class="monospaced">
58421 deny  hosts = !192.168.3.4
58422 deny !hosts =  192.168.3.4
58423 </literallayout>
58424 <para>
58425 However, for many conditions (<option>verify</option> being a good example), only left-hand
58426 side negation of the whole condition is possible.
58427 </para>
58428 <para>
58429 The arguments of conditions and modifiers are expanded. A forced failure
58430 of an expansion causes a condition to be ignored, that is, it behaves as if the
58431 condition is true. Consider these two statements:
58432 </para>
58433 <literallayout class="monospaced">
58434 accept  senders = ${lookup{$host_name}lsearch\
58435                   {/some/file}{$value}fail}
58436 accept  senders = ${lookup{$host_name}lsearch\
58437                   {/some/file}{$value}{}}
58438 </literallayout>
58439 <para>
58440 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
58441 the returned list is searched, but if the lookup fails the behaviour is
58442 different in the two cases. The <option>fail</option> in the first statement causes the
58443 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
58444 therefore succeeds. The second statement, however, generates an empty list when
58445 the lookup fails. No sender can match an empty list, so the condition fails,
58446 and therefore the <option>accept</option> also fails.
58447 </para>
58448 <para>
58449 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
58450 specify actions that are taken as the conditions for a statement are checked;
58451 others specify text for messages that are used when access is denied or a
58452 warning is generated. The <option>control</option> modifier affects the way an incoming
58453 message is handled.
58454 </para>
58455 <para>
58456 The positioning of the modifiers in an ACL statement is important, because the
58457 processing of a verb ceases as soon as its outcome is known. Only those
58458 modifiers that have already been encountered will take effect. For example,
58459 consider this use of the <option>message</option> modifier:
58460 </para>
58461 <literallayout class="monospaced">
58462 require message = Can't verify sender
58463         verify  = sender
58464         message = Can't verify recipient
58465         verify  = recipient
58466         message = This message cannot be used
58467 </literallayout>
58468 <para>
58469 If sender verification fails, Exim knows that the result of the statement is
58470 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
58471 so its text is used as the error message. If sender verification succeeds, but
58472 recipient verification fails, the second message is used. If recipient
58473 verification succeeds, the third message becomes <quote>current</quote>, but is never used
58474 because there are no more conditions to cause failure.
58475 </para>
58476 <para>
58477 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
58478 modifier that is used, because all the conditions must be true for rejection to
58479 happen. Specifying more than one <option>message</option> modifier does not make sense, and
58480 the message can even be specified after all the conditions. For example:
58481 </para>
58482 <literallayout class="monospaced">
58483 deny   hosts = ...
58484       !senders = *@my.domain.example
58485        message = Invalid sender from client host
58486 </literallayout>
58487 <para>
58488 The <quote>deny</quote> result does not happen until the end of the statement is reached,
58489 by which time Exim has set up the message.
58490 </para>
58491 </section>
58492 <section id="SECTACLmodi">
58493 <title>ACL modifiers</title>
58494 <para>
58495 <indexterm role="concept">
58496 <primary>access control lists (ACLs)</primary>
58497 <secondary>modifiers; list of</secondary>
58498 </indexterm>
58499 The ACL modifiers are as follows:
58500 </para>
58501 <variablelist>
58502 <varlistentry>
58503 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58504 <listitem>
58505 <para>
58506 This modifier specifies one or more header lines that are to be added to an
58507 incoming message, assuming, of course, that the message is ultimately
58508 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
58509 </para>
58510 </listitem></varlistentry>
58511 <varlistentry>
58512 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58513 <listitem>
58514 <para>
58515 <indexterm role="concept">
58516 <primary><option>continue</option> ACL modifier</primary>
58517 </indexterm>
58518 <indexterm role="concept">
58519 <primary>database</primary>
58520 <secondary>updating in ACL</secondary>
58521 </indexterm>
58522 This modifier does nothing of itself, and processing of the ACL always
58523 continues with the next condition or modifier. The value of <option>continue</option> is in
58524 the side effects of expanding its argument. Typically this could be used to
58525 update a database. It is really just a syntactic tidiness, to avoid having to
58526 write rather ugly lines like this:
58527 </para>
58528 <literallayout>
58529 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
58530 </literallayout>
58531 <para>
58532 Instead, all you need is
58533 </para>
58534 <literallayout>
58535 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
58536 </literallayout>
58537 </listitem></varlistentry>
58538 <varlistentry>
58539 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58540 <listitem>
58541 <para>
58542 <indexterm role="concept">
58543 <primary><option>control</option> ACL modifier</primary>
58544 </indexterm>
58545 This modifier affects the subsequent processing of the SMTP connection or of an
58546 incoming message that is accepted. The effect of the first type of control
58547 lasts for the duration of the connection, whereas the effect of the second type
58548 lasts only until the current message has been received. The message-specific
58549 controls always apply to the whole message, not to individual recipients,
58550 even if the <option>control</option> modifier appears in a RCPT ACL.
58551 </para>
58552 <para>
58553 As there are now quite a few controls that can be applied, they are described
58554 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
58555 in several different ways. For example:
58556 </para>
58557 <itemizedlist>
58558 <listitem>
58559 <para>
58560 It can be at the end of an <option>accept</option> statement:
58561 </para>
58562 <literallayout class="monospaced">
58563     accept  ...some conditions
58564             control = queue
58565 </literallayout>
58566 <para>
58567 In this case, the control is applied when this statement yields <quote>accept</quote>, in
58568 other words, when the conditions are all true.
58569 </para>
58570 </listitem>
58571 <listitem>
58572 <para>
58573 It can be in the middle of an <option>accept</option> statement:
58574 </para>
58575 <literallayout class="monospaced">
58576     accept  ...some conditions...
58577             control = queue
58578             ...some more conditions...
58579 </literallayout>
58580 <para>
58581 If the first set of conditions are true, the control is applied, even if the
58582 statement does not accept because one of the second set of conditions is false.
58583 In this case, some subsequent statement must yield <quote>accept</quote> for the control
58584 to be relevant.
58585 </para>
58586 </listitem>
58587 <listitem>
58588 <para>
58589 It can be used with <option>warn</option> to apply the control, leaving the
58590 decision about accepting or denying to a subsequent verb. For
58591 example:
58592 </para>
58593 <literallayout class="monospaced">
58594     warn    ...some conditions...
58595             control = freeze
58596     accept  ...
58597 </literallayout>
58598 <para>
58599 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
58600 <option>logwrite</option>, so it does not add anything to the message and does not write a
58601 log entry.
58602 </para>
58603 </listitem>
58604 <listitem>
58605 <para>
58606 If you want to apply a control unconditionally, you can use it with a
58607 <option>require</option> verb. For example:
58608 </para>
58609 <literallayout class="monospaced">
58610     require  control = no_multiline_responses
58611 </literallayout>
58612 </listitem>
58613 </itemizedlist>
58614 </listitem></varlistentry>
58615 <varlistentry>
58616 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
58617 <listitem>
58618 <para>
58619 <indexterm role="concept">
58620 <primary><option>delay</option> ACL modifier</primary>
58621 </indexterm>
58622 <indexterm role="option">
58623 <primary><option>-bh</option></primary>
58624 </indexterm>
58625 This modifier may appear in any ACL except notquit. It causes Exim to wait for
58626 the time interval before proceeding. However, when testing Exim using the
58627 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
58628 output instead). The time is given in the usual Exim notation, and the delay
58629 happens as soon as the modifier is processed. In an SMTP session, pending
58630 output is flushed before the delay is imposed.
58631 </para>
58632 <para>
58633 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
58634 example:
58635 </para>
58636 <literallayout class="monospaced">
58637 deny    ...some conditions...
58638         delay = 30s
58639 </literallayout>
58640 <para>
58641 The delay happens if all the conditions are true, before the statement returns
58642 <quote>deny</quote>. Compare this with:
58643 </para>
58644 <literallayout class="monospaced">
58645 deny    delay = 30s
58646         ...some conditions...
58647 </literallayout>
58648 <para>
58649 which waits for 30s before processing the conditions. The <option>delay</option> modifier
58650 can also be used with <option>warn</option> and together with <option>control</option>:
58651 </para>
58652 <literallayout class="monospaced">
58653 warn    ...some conditions...
58654         delay = 2m
58655         control = freeze
58656 accept  ...
58657 </literallayout>
58658 <para>
58659 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
58660 responses to several commands are no longer buffered and sent in one packet (as
58661 they would normally be) because all output is flushed before imposing the
58662 delay. This optimization is disabled so that a number of small delays do not
58663 appear to the client as one large aggregated delay that might provoke an
58664 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
58665 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
58666 </para>
58667 </listitem></varlistentry>
58668 <varlistentry>
58669 <term><emphasis role="bold">endpass</emphasis></term>
58670 <listitem>
58671 <para>
58672 <indexterm role="concept">
58673 <primary><option>endpass</option> ACL modifier</primary>
58674 </indexterm>
58675 This modifier, which has no argument, is recognized only in <option>accept</option> and
58676 <option>discard</option> statements. It marks the boundary between the conditions whose
58677 failure causes control to pass to the next statement, and the conditions whose
58678 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
58679 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
58680 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
58681 </para>
58682 </listitem></varlistentry>
58683 <varlistentry>
58684 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58685 <listitem>
58686 <para>
58687 <indexterm role="concept">
58688 <primary><option>log_message</option> ACL modifier</primary>
58689 </indexterm>
58690 This modifier sets up a message that is used as part of the log message if the
58691 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
58692 </para>
58693 <literallayout class="monospaced">
58694 require log_message = wrong cipher suite $tls_in_cipher
58695         encrypted   = DES-CBC3-SHA
58696 </literallayout>
58697 <para>
58698 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
58699 example:
58700 </para>
58701 <literallayout>
58702 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
58703 <literal>        log_message = Discarded $local_part@$domain because...</literal>
58704 </literallayout>
58705 <para>
58706 When access is denied, <option>log_message</option> adds to any underlying error message
58707 that may exist because of a condition failure. For example, while verifying a
58708 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
58709 message.
58710 </para>
58711 <para>
58712 The message may be defined before the conditions to which it applies, because
58713 the string expansion does not happen until Exim decides that access is to be
58714 denied. This means that any variables that are set by the condition are
58715 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
58716 variables are set after a DNS black list lookup succeeds. If the expansion of
58717 <option>log_message</option> fails, or if the result is an empty string, the modifier is
58718 ignored.
58719 </para>
58720 <para>
58721 <indexterm role="variable">
58722 <primary><varname>$acl_verify_message</varname></primary>
58723 </indexterm>
58724 If you want to use a <option>warn</option> statement to log the result of an address
58725 verification, you can use <varname>$acl_verify_message</varname> to include the verification
58726 error message.
58727 </para>
58728 <para>
58729 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
58730 the start of the logged message. If the same warning log message is requested
58731 more than once while receiving  a single email message, only one copy is
58732 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
58733 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
58734 is logged for a successful <option>warn</option> statement.
58735 </para>
58736 <para>
58737 If <option>log_message</option> is not present and there is no underlying error message (for
58738 example, from the failure of address verification), but <option>message</option> is present,
58739 the <option>message</option> text is used for logging rejections. However, if any text for
58740 logging contains newlines, only the first line is logged. In the absence of
58741 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
58742 logging rejections.
58743 </para>
58744 </listitem></varlistentry>
58745 <varlistentry>
58746 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
58747 <listitem>
58748 <para>
58749 <indexterm role="concept">
58750 <primary><option>log_reject_target</option> ACL modifier</primary>
58751 </indexterm>
58752 <indexterm role="concept">
58753 <primary>logging in ACL</primary>
58754 <secondary>specifying which log</secondary>
58755 </indexterm>
58756 This modifier makes it possible to specify which logs are used for messages
58757 about ACL rejections. Its argument is a colon-separated list of words that can
58758 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
58759 may be empty, in which case a rejection is not logged at all. For example, this
58760 ACL fragment writes no logging information when access is denied:
58761 </para>
58762 <literallayout>
58763 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
58764 <literal>     log_reject_target =</literal>
58765 </literallayout>
58766 <para>
58767 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
58768 permanent and temporary rejections. Its effect lasts for the rest of the
58769 current ACL.
58770 </para>
58771 </listitem></varlistentry>
58772 <varlistentry>
58773 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58774 <listitem>
58775 <para>
58776 <indexterm role="concept">
58777 <primary><option>logwrite</option> ACL modifier</primary>
58778 </indexterm>
58779 <indexterm role="concept">
58780 <primary>logging in ACL</primary>
58781 <secondary>immediate</secondary>
58782 </indexterm>
58783 This modifier writes a message to a log file as soon as it is encountered when
58784 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
58785 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
58786 access.) The <option>logwrite</option> modifier can be used to log special incidents in
58787 ACLs. For example:
58788 </para>
58789 <literallayout>
58790 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
58791 <literal>       control  = freeze</literal>
58792 <literal>       logwrite = froze message because ...</literal>
58793 </literallayout>
58794 <para>
58795 By default, the message is written to the main log. However, it may begin
58796 with a colon, followed by a comma-separated list of log names, and then
58797 another colon, to specify exactly which logs are to be written. For
58798 example:
58799 </para>
58800 <literallayout class="monospaced">
58801 logwrite = :main,reject: text for main and reject logs
58802 logwrite = :panic: text for panic log only
58803 </literallayout>
58804 </listitem></varlistentry>
58805 <varlistentry>
58806 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58807 <listitem>
58808 <para>
58809 <indexterm role="concept">
58810 <primary><option>message</option> ACL modifier</primary>
58811 </indexterm>
58812 This modifier sets up a text string that is expanded and used as a response
58813 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
58814 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
58815 there is some complication if <option>endpass</option> is involved; see the description of
58816 <option>accept</option> for details.)
58817 </para>
58818 <para>
58819 The expansion of the message happens at the time Exim decides that the ACL is
58820 to end, not at the time it processes <option>message</option>. If the expansion fails, or
58821 generates an empty string, the modifier is ignored. Here is an example where
58822 <option>message</option> must be specified first, because the ACL ends with a rejection if
58823 the <option>hosts</option> condition fails:
58824 </para>
58825 <literallayout class="monospaced">
58826 require  message = Host not recognized
58827          hosts = 10.0.0.0/8
58828 </literallayout>
58829 <para>
58830 (Once a condition has failed, no further conditions or modifiers are
58831 processed.)
58832 </para>
58833 <para>
58834 <indexterm role="concept">
58835 <primary>SMTP</primary>
58836 <secondary>error codes</secondary>
58837 </indexterm>
58838 <indexterm role="option">
58839 <primary><option>smtp_banner</option></primary>
58840 </indexterm>
58841 For ACLs that are triggered by SMTP commands, the message is returned as part
58842 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
58843 is meaningful only for SMTP, as no message is returned when a non-SMTP message
58844 is accepted. In the case of the connect ACL, accepting with a message modifier
58845 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
58846 accept message may not contain more than one line (otherwise it will be
58847 truncated at the first newline and a panic logged), and it cannot affect the
58848 EHLO options.
58849 </para>
58850 <para>
58851 When SMTP is involved, the message may begin with an overriding response code,
58852 consisting of three digits optionally followed by an <quote>extended response code</quote>
58853 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
58854 </para>
58855 <literallayout class="monospaced">
58856 deny  message = 599 1.2.3 Host not welcome
58857       hosts = 192.168.34.0/24
58858 </literallayout>
58859 <para>
58860 The first digit of the supplied response code must be the same as would be sent
58861 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
58862 access, but for the predata ACL, note that the default success code is 354, not
58863 2<emphasis>xx</emphasis>.
58864 </para>
58865 <para>
58866 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
58867 the message modifier cannot override the 221 response code.
58868 </para>
58869 <para>
58870 The text in a <option>message</option> modifier is literal; any quotes are taken as
58871 literals, but because the string is expanded, backslash escapes are processed
58872 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
58873 response.
58874 </para>
58875 <para>
58876 <indexterm role="variable">
58877 <primary><varname>$acl_verify_message</varname></primary>
58878 </indexterm>
58879 For ACLs that are called by an <option>acl =</option> ACL condition, the message is
58880 stored in <varname>$acl_verify_message</varname>, from which the calling ACL may use it.
58881 </para>
58882 <para>
58883 If <option>message</option> is used on a statement that verifies an address, the message
58884 specified overrides any message that is generated by the verification process.
58885 However, the original message is available in the variable
58886 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
58887 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
58888 routers to be passed back as part of the SMTP response, you should either not
58889 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
58890 </para>
58891 <para>
58892 For compatibility with previous releases of Exim, a <option>message</option> modifier that
58893 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
58894 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
58895 all the conditions are true, wherever it appears in an ACL command, whereas
58896 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
58897 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
58898 effect.
58899 </para>
58900 </listitem></varlistentry>
58901 <varlistentry>
58902 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58903 <listitem>
58904 <para>
58905 <indexterm role="concept">
58906 <primary><option>queue</option> ACL modifier</primary>
58907 </indexterm>
58908 <indexterm role="concept">
58909 <primary>named queues</primary>
58910 <secondary>selecting in ACL</secondary>
58911 </indexterm>
58912 This modifier specifies the use of a named queue for spool files
58913 for the message.
58914 It can only be used before the message is received (i.e. not in
58915 the DATA ACL).
58916 This could be used, for example, for known high-volume burst sources
58917 of traffic, or for quarantine of messages.
58918 Separate queue-runner processes will be needed for named queues.
58919 If the text after expansion is empty, the default queue is used.
58920 </para>
58921 </listitem></varlistentry>
58922 <varlistentry>
58923 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
58924 <listitem>
58925 <para>
58926 This modifier specifies one or more header names in a colon-separated list
58927  that are to be removed from an incoming message, assuming, of course, that
58928 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
58929 </para>
58930 </listitem></varlistentry>
58931 <varlistentry>
58932 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
58933 <listitem>
58934 <para>
58935 <indexterm role="concept">
58936 <primary><option>set</option> ACL modifier</primary>
58937 </indexterm>
58938 This modifier puts a value into one of the ACL variables (see section
58939 <xref linkend="SECTaclvariables"/>).
58940 </para>
58941 </listitem></varlistentry>
58942 <varlistentry>
58943 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
58944 <listitem>
58945 <para>
58946 <indexterm role="concept">
58947 <primary>UDP communications</primary>
58948 </indexterm>
58949 This modifier sends a UDP packet, for purposes such as statistics
58950 collection or behaviour monitoring. The parameters are expanded, and
58951 the result of the expansion must be a colon-separated list consisting
58952 of a destination server, port number, and the packet contents. The
58953 server can be specified as a host name or IPv4 or IPv6 address. The
58954 separator can be changed with the usual angle bracket syntax. For
58955 example, you might want to collect information on which hosts connect
58956 when:
58957 </para>
58958 <literallayout class="monospaced">
58959 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
58960              $tod_zulu $sender_host_address
58961 </literallayout>
58962 </listitem></varlistentry>
58963 </variablelist>
58964 </section>
58965 <section id="SECTcontrols">
58966 <title>Use of the control modifier</title>
58967 <para>
58968 <indexterm role="concept">
58969 <primary><option>control</option> ACL modifier</primary>
58970 </indexterm>
58971 The <option>control</option> modifier supports the following settings:
58972 </para>
58973 <variablelist>
58974 <varlistentry>
58975 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
58976 <listitem>
58977 <para>
58978 This modifier allows a client host to use the SMTP AUTH command even when it
58979 has not been advertised in response to EHLO. Furthermore, because there are
58980 apparently some really broken clients that do this, Exim will accept AUTH after
58981 HELO (rather than EHLO) when this control is set. It should be used only if you
58982 really need it, and you should limit its use to those broken clients that do
58983 not work without it. For example:
58984 </para>
58985 <literallayout class="monospaced">
58986 warn hosts   = 192.168.34.25
58987      control = allow_auth_unadvertised
58988 </literallayout>
58989 <para>
58990 Normally, when an Exim server receives an AUTH command, it checks the name of
58991 the authentication mechanism that is given in the command to ensure that it
58992 matches an advertised mechanism. When this control is set, the check that a
58993 mechanism has been advertised is bypassed. Any configured mechanism can be used
58994 by the client. This control is permitted only in the connection and HELO ACLs.
58995 </para>
58996 </listitem></varlistentry>
58997 <varlistentry>
58998 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
58999 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
59000 <listitem>
59001 <para>
59002 <indexterm role="concept">
59003 <primary>access control lists (ACLs)</primary>
59004 <secondary>case of local part in</secondary>
59005 </indexterm>
59006 <indexterm role="concept">
59007 <primary>case of local parts</primary>
59008 </indexterm>
59009 <indexterm role="variable">
59010 <primary><varname>$local_part</varname></primary>
59011 </indexterm>
59012 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
59013 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
59014 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
59015 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
59016 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
59017 is encountered.
59018 </para>
59019 <para>
59020 These controls affect only the current recipient. Moreover, they apply only to
59021 local part handling that takes place directly in the ACL (for example, as a key
59022 in lookups). If a test to verify the recipient is obeyed, the case-related
59023 handling of the local part during the verification is controlled by the router
59024 configuration (see the <option>caseful_local_part</option> generic router option).
59025 </para>
59026 <para>
59027 This facility could be used, for example, to add a spam score to local parts
59028 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
59029 spam score:
59030 </para>
59031 <literallayout class="monospaced">
59032 warn  control = caseful_local_part
59033       set acl_m4 = ${eval:\
59034                      $acl_m4 + \
59035                      ${if match{$local_part}{[A-Z]}{1}{0}}\
59036                     }
59037       control = caselower_local_part
59038 </literallayout>
59039 <para>
59040 Notice that we put back the lower cased version afterwards, assuming that
59041 is what is wanted for subsequent tests.
59042 </para>
59043 </listitem></varlistentry>
59044 <varlistentry>
59045 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
59046 <listitem>
59047 <para>
59048 <indexterm role="concept">
59049 <primary>access control lists (ACLs)</primary>
59050 <secondary>cutthrough routing</secondary>
59051 </indexterm>
59052 <indexterm role="concept">
59053 <primary>cutthrough</primary>
59054 <secondary>requesting</secondary>
59055 </indexterm>
59056 This option requests delivery be attempted while the item is being received.
59057 </para>
59058 <para>
59059 The option is usable in the RCPT ACL.
59060 If enabled for a message received via smtp and routed to an smtp transport,
59061 and only one transport, interface, destination host and port combination
59062 is used for all recipients of the message,
59063 then the delivery connection is made while the receiving connection is open
59064 and data is copied from one to the other.
59065 </para>
59066 <para>
59067 An attempt to set this option for any recipient but the first
59068 for a mail will be quietly ignored.
59069 If a recipient-verify callout
59070 (with use_sender)
59071 connection is subsequently
59072 requested in the same ACL it is held open and used for
59073 any subsequent recipients and the data,
59074 otherwise one is made after the initial RCPT ACL completes.
59075 </para>
59076 <para>
59077 Note that routers are used in verify mode,
59078 and cannot depend on content of received headers.
59079 Note also that headers cannot be
59080 modified by any of the post-data ACLs (DATA, MIME and DKIM).
59081 Headers may be modified by routers (subject to the above) and transports.
59082 The <emphasis>Received-By:</emphasis> header is generated as soon as the body reception starts,
59083 rather than the traditional time after the full message is received;
59084 this will affect the timestamp.
59085 </para>
59086 <para>
59087 All the usual ACLs are called; if one results in the message being
59088 rejected, all effort spent in delivery (including the costs on
59089 the ultimate destination) will be wasted.
59090 Note that in the case of data-time ACLs this includes the entire
59091 message body.
59092 </para>
59093 <para>
59094 Cutthrough delivery is not supported via transport-filters or when DKIM signing
59095 of outgoing messages is done, because it sends data to the ultimate destination
59096 before the entire message has been received from the source.
59097 It is not supported for messages received with the SMTP PRDR
59098 or CHUNKING
59099 options in use.
59100 </para>
59101 <para>
59102 Should the ultimate destination system positively accept or reject the mail,
59103 a corresponding indication is given to the source system and nothing is queued.
59104 If the item is successfully delivered in cutthrough mode
59105 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
59106 before the acceptance "&lt;=" line.
59107 </para>
59108 <para>
59109 If there is a temporary error the item is queued for later delivery in the
59110 usual fashion.
59111 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
59112 to the control; the default value is <quote>spool</quote> and the alternate value
59113 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
59114 and does not queue the message.
59115 Note that this is independent of any recipient verify conditions in the ACL.
59116 </para>
59117 <para>
59118 Delivery in this mode avoids the generation of a bounce mail to a
59119 (possibly faked)
59120 sender when the destination system is doing content-scan based rejection.
59121 </para>
59122 </listitem></varlistentry>
59123 <varlistentry>
59124 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
59125 <listitem>
59126 <para>
59127 <indexterm role="concept">
59128 <primary>access control lists (ACLs)</primary>
59129 <secondary>enabling debug logging</secondary>
59130 </indexterm>
59131 <indexterm role="concept">
59132 <primary>debugging</primary>
59133 <secondary>enabling from an ACL</secondary>
59134 </indexterm>
59135 This control turns on debug logging, almost as though Exim had been invoked
59136 with <literal>-d</literal>, with the output going to a new logfile in the usual logs directory,
59137 by default called <emphasis>debuglog</emphasis>.
59138 The filename can be adjusted with the <emphasis>tag</emphasis> option, which
59139 may access any variables already defined.  The logging may be adjusted with
59140 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
59141 option.
59142 Logging started this way may be stopped, and the file removed,
59143 with the <emphasis>kill</emphasis> option.
59144 Some examples (which depend on variables that don&#x2019;t exist in all
59145 contexts):
59146 </para>
59147 <literallayout class="monospaced">
59148       control = debug
59149       control = debug/tag=.$sender_host_address
59150       control = debug/opts=+expand+acl
59151       control = debug/tag=.$message_exim_id/opts=+expand
59152       control = debug/kill
59153 </literallayout>
59154 </listitem></varlistentry>
59155 <varlistentry>
59156 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
59157 <listitem>
59158 <para>
59159 <indexterm role="concept">
59160 <primary>disable DKIM verify</primary>
59161 </indexterm>
59162 <indexterm role="concept">
59163 <primary>DKIM</primary>
59164 <secondary>disable verify</secondary>
59165 </indexterm>
59166 This control turns off DKIM verification processing entirely.  For details on
59167 the operation and configuration of DKIM, see section <xref linkend="SECDKIM"/>.
59168 </para>
59169 </listitem></varlistentry>
59170 <varlistentry>
59171 <term><emphasis role="bold">control&nbsp;=&nbsp;dmarc_disable_verify</emphasis></term>
59172 <listitem>
59173 <para>
59174 <indexterm role="concept">
59175 <primary>disable DMARC verify</primary>
59176 </indexterm>
59177 <indexterm role="concept">
59178 <primary>DMARC</primary>
59179 <secondary>disable verify</secondary>
59180 </indexterm>
59181 This control turns off DMARC verification processing entirely.  For details on
59182 the operation and configuration of DMARC, see section <xref linkend="SECDMARC"/>.
59183 </para>
59184 </listitem></varlistentry>
59185 <varlistentry>
59186 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
59187 <listitem>
59188 <para>
59189 <indexterm role="concept">
59190 <primary>access control lists (ACLs)</primary>
59191 <secondary>setting DSCP value</secondary>
59192 </indexterm>
59193 <indexterm role="concept">
59194 <primary>DSCP</primary>
59195 <secondary>inbound</secondary>
59196 </indexterm>
59197 This option causes the DSCP value associated with the socket for the inbound
59198 connection to be adjusted to a given value, given as one of a number of fixed
59199 strings or to numeric value.
59200 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
59201 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
59202 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
59203 </para>
59204 <para>
59205 The outbound packets from Exim will be marked with this value in the header
59206 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
59207 that these values will have any effect, not be stripped by networking
59208 equipment, or do much of anything without cooperation with your Network
59209 Engineer and those of all network operators between the source and destination.
59210 </para>
59211 </listitem></varlistentry>
59212 <varlistentry>
59213 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
59214 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
59215 <listitem>
59216 <para>
59217 <indexterm role="concept">
59218 <primary>SMTP</primary>
59219 <secondary>synchronization checking</secondary>
59220 </indexterm>
59221 <indexterm role="concept">
59222 <primary>synchronization checking in SMTP</primary>
59223 </indexterm>
59224 These controls make it possible to be selective about when SMTP synchronization
59225 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
59226 state of the switch (it is true by default). See the description of this option
59227 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
59228 </para>
59229 <para>
59230 The effect of these two controls lasts for the remainder of the SMTP
59231 connection. They can appear in any ACL except the one for the non-SMTP
59232 messages. The most straightforward place to put them is in the ACL defined by
59233 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
59234 before the first synchronization check. The expected use is to turn off the
59235 synchronization checks for badly-behaved hosts that you nevertheless need to
59236 work with.
59237 </para>
59238 </listitem></varlistentry>
59239 <varlistentry>
59240 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
59241 <listitem>
59242 <para>
59243 <indexterm role="concept">
59244 <primary>fake defer</primary>
59245 </indexterm>
59246 <indexterm role="concept">
59247 <primary>defer, fake</primary>
59248 </indexterm>
59249 This control works in exactly the same way as <option>fakereject</option> (described below)
59250 except that it causes an SMTP 450 response after the message data instead of a
59251 550 response. You must take care when using <option>fakedefer</option> because it causes the
59252 messages to be duplicated when the sender retries. Therefore, you should not
59253 use <option>fakedefer</option> if the message is to be delivered normally.
59254 </para>
59255 </listitem></varlistentry>
59256 <varlistentry>
59257 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
59258 <listitem>
59259 <para>
59260 <indexterm role="concept">
59261 <primary>fake rejection</primary>
59262 </indexterm>
59263 <indexterm role="concept">
59264 <primary>rejection, fake</primary>
59265 </indexterm>
59266 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
59267 words, only when an SMTP message is being received. If Exim accepts the
59268 message, instead the final 250 response, a 550 rejection message is sent.
59269 However, Exim proceeds to deliver the message as normal. The control applies
59270 only to the current message, not to any subsequent ones that may be received in
59271 the same SMTP connection.
59272 </para>
59273 <para>
59274 The text for the 550 response is taken from the <option>control</option> modifier. If no
59275 message is supplied, the following is used:
59276 </para>
59277 <literallayout class="monospaced">
59278 550-Your message has been rejected but is being
59279 550-kept for evaluation.
59280 550-If it was a legitimate message, it may still be
59281 550 delivered to the target recipient(s).
59282 </literallayout>
59283 <para>
59284 This facility should be used with extreme caution.
59285 </para>
59286 </listitem></varlistentry>
59287 <varlistentry>
59288 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
59289 <listitem>
59290 <para>
59291 <indexterm role="concept">
59292 <primary>frozen messages</primary>
59293 <secondary>forcing in ACL</secondary>
59294 </indexterm>
59295 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
59296 other words, only when a message is being received. If the message is accepted,
59297 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
59298 current message, not to any subsequent ones that may be received in the same
59299 SMTP connection.
59300 </para>
59301 <para>
59302 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
59303 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
59304 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
59305 are obeyed for the current message have the <literal>/no_tell</literal> option.
59306 </para>
59307 </listitem></varlistentry>
59308 <varlistentry>
59309 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
59310 <listitem>
59311 <para>
59312 <indexterm role="concept">
59313 <primary>SMTP</primary>
59314 <secondary>output flushing, disabling for delay</secondary>
59315 </indexterm>
59316 Exim normally flushes SMTP output before implementing a delay in an ACL, to
59317 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
59318 use. This control, as long as it is encountered before the <option>delay</option> modifier,
59319 disables such output flushing.
59320 </para>
59321 </listitem></varlistentry>
59322 <varlistentry>
59323 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
59324 <listitem>
59325 <para>
59326 <indexterm role="concept">
59327 <primary>SMTP</primary>
59328 <secondary>output flushing, disabling for callout</secondary>
59329 </indexterm>
59330 Exim normally flushes SMTP output before performing a callout in an ACL, to
59331 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
59332 use. This control, as long as it is encountered before the <option>verify</option> condition
59333 that causes the callout, disables such output flushing.
59334 </para>
59335 </listitem></varlistentry>
59336 <varlistentry>
59337 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
59338 <listitem>
59339 <para>
59340 This control is available when Exim is compiled with the content scanning
59341 extension. Content scanning may require a copy of the current message, or parts
59342 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
59343 or spam scanner. Normally, such copies are deleted when they are no longer
59344 needed. If this control is set, the copies are not deleted. The control applies
59345 only to the current message, not to any subsequent ones that may be received in
59346 the same SMTP connection. It is provided for debugging purposes and is unlikely
59347 to be useful in production.
59348 </para>
59349 </listitem></varlistentry>
59350 <varlistentry>
59351 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
59352 <listitem>
59353 <para>
59354 <indexterm role="concept">
59355 <primary>multiline responses, suppressing</primary>
59356 </indexterm>
59357 This control is permitted for any ACL except the one for non-SMTP messages.
59358 It seems that there are broken clients in use that cannot handle multiline
59359 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
59360 </para>
59361 <para>
59362 If this control is set, multiline SMTP responses from ACL rejections are
59363 suppressed. One way of doing this would have been to put out these responses as
59364 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
59365 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
59366 responses might get close to that. So this facility, which is after all only a
59367 sop to broken clients, is implemented by doing two very easy things:
59368 </para>
59369 <itemizedlist>
59370 <listitem>
59371 <para>
59372 Extra information that is normally output as part of a rejection caused by
59373 sender verification failure is omitted. Only the final line (typically <quote>sender
59374 verification failed</quote>) is sent.
59375 </para>
59376 </listitem>
59377 <listitem>
59378 <para>
59379 If a <option>message</option> modifier supplies a multiline response, only the first
59380 line is output.
59381 </para>
59382 </listitem>
59383 </itemizedlist>
59384 <para>
59385 The setting of the switch can, of course, be made conditional on the
59386 calling host. Its effect lasts until the end of the SMTP connection.
59387 </para>
59388 </listitem></varlistentry>
59389 <varlistentry>
59390 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
59391 <listitem>
59392 <para>
59393 <indexterm role="concept">
59394 <primary>PIPELINING</primary>
59395 <secondary>suppressing advertising</secondary>
59396 </indexterm>
59397 <indexterm role="concept">
59398 <primary>ESMTP extensions</primary>
59399 <secondary>PIPELINING</secondary>
59400 </indexterm>
59401 This control turns off the advertising of the PIPELINING extension to SMTP in
59402 the current session. To be useful, it must be obeyed before Exim sends its
59403 response to an EHLO command. Therefore, it should normally appear in an ACL
59404 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
59405 <option>pipelining_advertise_hosts</option>.
59406 </para>
59407 </listitem></varlistentry>
59408 <varlistentry revisionflag="changed">
59409 <term><emphasis role="bold">control&nbsp;=&nbsp;queue/</emphasis>&lt;<emphasis>options</emphasis>&gt;*</term>
59410 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
59411 <listitem>
59412 <para revisionflag="changed">
59413 <indexterm role="option">
59414 <primary><option>queue</option></primary>
59415 </indexterm>
59416 <indexterm role="option">
59417 <primary><option>queue_only</option></primary>
59418 </indexterm>
59419 <indexterm role="concept">
59420 <primary>queueing incoming messages</primary>
59421 </indexterm>
59422 <indexterm role="concept">
59423 <primary>queueing</primary>
59424 <secondary>forcing in ACL</secondary>
59425 </indexterm>
59426 <indexterm role="concept">
59427 <primary>first pass routing</primary>
59428 </indexterm>
59429 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
59430 other words, only when a message is being received. If the message is accepted,
59431 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
59432 runner.
59433 If used with no options set,
59434 no immediate delivery process is started. In other words, it has the
59435 effect as the <option>queue_only</option> global option or <emphasis>-odq</emphasis> command-line option.
59436 </para>
59437 <para revisionflag="changed">
59438 If the <emphasis>first_pass_route</emphasis> option is given then
59439 the behaviour is like the command-line <emphasis>-oqds</emphasis> option;
59440 a delivery process is started which stops short of making
59441 any SMTP delivery.  The benefit is that the hints database will be updated for
59442 the message being waiting for a specific host, and a later queue run will be
59443 able to send all such messages on a single connection.
59444 </para>
59445 <para revisionflag="changed">
59446 The control only applies to the current message, not to any subsequent ones that
59447  may be received in the same SMTP connection.
59448 </para>
59449 </listitem></varlistentry>
59450 <varlistentry>
59451 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
59452 <listitem>
59453 <para>
59454 <indexterm role="concept">
59455 <primary>message</primary>
59456 <secondary>submission</secondary>
59457 </indexterm>
59458 <indexterm role="concept">
59459 <primary>submission mode</primary>
59460 </indexterm>
59461 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
59462 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
59463 the current message is a submission from a local MUA. In this case, Exim
59464 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
59465 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
59466 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
59467 late (the message has already been created).
59468 </para>
59469 <para>
59470 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
59471 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
59472 submission mode; the available options for this control are described there.
59473 The control applies only to the current message, not to any subsequent ones
59474 that may be received in the same SMTP connection.
59475 </para>
59476 </listitem></varlistentry>
59477 <varlistentry>
59478 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
59479 <listitem>
59480 <para>
59481 <indexterm role="concept">
59482 <primary>submission fixups, suppressing</primary>
59483 </indexterm>
59484 This control applies to locally submitted (non TCP/IP) messages, and is the
59485 complement of <literal>control = submission</literal>. It disables the fixups that are
59486 normally applied to locally-submitted messages. Specifically:
59487 </para>
59488 <itemizedlist>
59489 <listitem>
59490 <para>
59491 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
59492 dynamic version of <option>local_sender_retain</option>).
59493 </para>
59494 </listitem>
59495 <listitem>
59496 <para>
59497 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
59498 </para>
59499 </listitem>
59500 <listitem>
59501 <para>
59502 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
59503 </para>
59504 </listitem>
59505 </itemizedlist>
59506 <para>
59507 This control may be useful when a remotely-originated message is accepted,
59508 passed to some scanning program, and then re-submitted for delivery. It can be
59509 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
59510 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
59511 data is read.
59512 </para>
59513 <para>
59514 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
59515 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
59516 </para>
59517 </listitem></varlistentry>
59518 <varlistentry>
59519 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
59520 <listitem>
59521 <para>
59522 This control enables conversion of UTF-8 in message envelope addresses
59523 to a-label form.
59524 For details see section <xref linkend="SECTi18nMTA"/>.
59525 </para>
59526 </listitem></varlistentry>
59527 </variablelist>
59528 </section>
59529 <section id="SECTsummesfix">
59530 <title>Summary of message fixup control</title>
59531 <para>
59532 All four possibilities for message fixups can be specified:
59533 </para>
59534 <itemizedlist>
59535 <listitem>
59536 <para>
59537 Locally submitted, fixups applied: the default.
59538 </para>
59539 </listitem>
59540 <listitem>
59541 <para>
59542 Locally submitted, no fixups applied: use
59543 <literal>control = suppress_local_fixups</literal>.
59544 </para>
59545 </listitem>
59546 <listitem>
59547 <para>
59548 Remotely submitted, no fixups applied: the default.
59549 </para>
59550 </listitem>
59551 <listitem>
59552 <para>
59553 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
59554 </para>
59555 </listitem>
59556 </itemizedlist>
59557 </section>
59558 <section id="SECTaddheadacl">
59559 <title>Adding header lines in ACLs</title>
59560 <para>
59561 <indexterm role="concept">
59562 <primary>header lines</primary>
59563 <secondary>adding in an ACL</secondary>
59564 </indexterm>
59565 <indexterm role="concept">
59566 <primary>header lines</primary>
59567 <secondary>position of added lines</secondary>
59568 </indexterm>
59569 <indexterm role="concept">
59570 <primary><option>add_header</option> ACL modifier</primary>
59571 </indexterm>
59572 The <option>add_header</option> modifier can be used to add one or more extra header lines
59573 to an incoming message, as in this example:
59574 </para>
59575 <literallayout class="monospaced">
59576 warn dnslists = sbl.spamhaus.org : \
59577                 dialup.mail-abuse.org
59578      add_header = X-blacklisted-at: $dnslist_domain
59579 </literallayout>
59580 <para>
59581 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
59582 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
59583 receiving a message). The message must ultimately be accepted for
59584 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
59585 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
59586 RCPT ACL).
59587 </para>
59588 <para>
59589 Headers will not be added to the message if the modifier is used in
59590 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
59591 </para>
59592 <para>
59593 Leading and trailing newlines are removed from
59594 the data for the <option>add_header</option> modifier; if it then
59595 contains one or more newlines that
59596 are not followed by a space or a tab, it is assumed to contain multiple header
59597 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
59598 front of any line that is not a valid header line.
59599 </para>
59600 <para>
59601 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
59602 They are added to the message before processing the DATA and MIME ACLs.
59603 However, if an identical header line is requested more than once, only one copy
59604 is actually added to the message. Further header lines may be accumulated
59605 during the DATA and MIME ACLs, after which they are added to the message, again
59606 with duplicates suppressed. Thus, it is possible to add two identical header
59607 lines to an SMTP message, but only if one is added before DATA and one after.
59608 In the case of non-SMTP messages, new headers are accumulated during the
59609 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
59610 message is rejected after DATA or by the non-SMTP ACL, all added header lines
59611 are included in the entry that is written to the reject log.
59612 </para>
59613 <para>
59614 <indexterm role="concept">
59615 <primary>header lines</primary>
59616 <secondary>added; visibility of</secondary>
59617 </indexterm>
59618 Header lines are not visible in string expansions
59619 of message headers
59620 until they are added to the
59621 message. It follows that header lines defined in the MAIL, RCPT, and predata
59622 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
59623 header lines that are added by the DATA or MIME ACLs are not visible in those
59624 ACLs. Because of this restriction, you cannot use header lines as a way of
59625 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
59626 this, you can use ACL variables, as described in section
59627 <xref linkend="SECTaclvariables"/>.
59628 </para>
59629 <para>
59630 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
59631 </para>
59632 <para>
59633 The <option>add_header</option> modifier acts immediately as it is encountered during the
59634 processing of an ACL. Notice the difference between these two cases:
59635 </para>
59636 <literallayout>
59637 <literal>accept add_header = ADDED: some text</literal>
59638 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
59639
59640 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
59641 <literal>       add_header = ADDED: some text</literal>
59642 </literallayout>
59643 <para>
59644 In the first case, the header line is always added, whether or not the
59645 condition is true. In the second case, the header line is added only if the
59646 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
59647 ACL statement. All those that are encountered before a condition fails are
59648 honoured.
59649 </para>
59650 <para>
59651 <indexterm role="concept">
59652 <primary><option>warn</option> ACL verb</primary>
59653 </indexterm>
59654 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
59655 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
59656 effect only if all the conditions are true, even if it appears before some of
59657 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
59658 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
59659 are present on a <option>warn</option> verb, both are processed according to their
59660 specifications.
59661 </para>
59662 <para>
59663 By default, new header lines are added to a message at the end of the existing
59664 header lines. However, you can specify that any particular header line should
59665 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
59666 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
59667 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
59668 </para>
59669 <para>
59670 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
59671 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
59672 header line, respectively. (Header text cannot start with a colon, as there has
59673 to be a header name first.) For example:
59674 </para>
59675 <literallayout class="monospaced">
59676 warn add_header = \
59677        :after_received:X-My-Header: something or other...
59678 </literallayout>
59679 <para>
59680 If more than one header line is supplied in a single <option>add_header</option> modifier,
59681 each one is treated independently and can therefore be placed differently. If
59682 you add more than one line at the start, or after the Received: block, they end
59683 up in reverse order.
59684 </para>
59685 <para>
59686 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
59687 added in an ACL. It does NOT work for header lines that are added in a
59688 system filter or in a router or transport.
59689 </para>
59690 </section>
59691 <section id="SECTremoveheadacl">
59692 <title>Removing header lines in ACLs</title>
59693 <para>
59694 <indexterm role="concept">
59695 <primary>header lines</primary>
59696 <secondary>removing in an ACL</secondary>
59697 </indexterm>
59698 <indexterm role="concept">
59699 <primary>header lines</primary>
59700 <secondary>position of removed lines</secondary>
59701 </indexterm>
59702 <indexterm role="concept">
59703 <primary><option>remove_header</option> ACL modifier</primary>
59704 </indexterm>
59705 The <option>remove_header</option> modifier can be used to remove one or more header lines
59706 from an incoming message, as in this example:
59707 </para>
59708 <literallayout class="monospaced">
59709 warn   message        = Remove internal headers
59710        remove_header  = x-route-mail1 : x-route-mail2
59711 </literallayout>
59712 <para>
59713 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
59714 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
59715 receiving a message). The message must ultimately be accepted for
59716 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
59717 with any ACL verb, including <option>deny</option>, though this is really not useful for
59718 any verb that doesn&#x2019;t result in a delivered message.
59719 </para>
59720 <para>
59721 Headers will not be removed from the message if the modifier is used in
59722 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
59723 </para>
59724 <para>
59725 More than one header can be removed at the same time by using a colon separated
59726 list of header names. The header matching is case insensitive. Wildcards are
59727 not permitted, nor is list expansion performed, so you cannot use hostlists to
59728 create a list of headers, however both connection and message variable expansion
59729 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
59730 </para>
59731 <literallayout class="monospaced">
59732 warn   hosts           = +internal_hosts
59733        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
59734 warn   message         = Remove internal headers
59735        remove_header   = $acl_c_ihdrs
59736 </literallayout>
59737 <para>
59738 Header names for removal are accumulated during the MAIL, RCPT, and predata ACLs.
59739 Matching header lines are removed from the message before processing the DATA and MIME ACLs.
59740 If multiple header lines match, all are removed.
59741 There is no harm in attempting to remove the same header twice nor in removing
59742 a non-existent header. Further header lines to be removed may be accumulated
59743 during the DATA and MIME ACLs, after which they are removed from the message,
59744 if present. In the case of non-SMTP messages, headers to be removed are
59745 accumulated during the non-SMTP ACLs, and are removed from the message after
59746 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
59747 ACL, there really is no effect because there is no logging of what headers
59748 would have been removed.
59749 </para>
59750 <para>
59751 <indexterm role="concept">
59752 <primary>header lines</primary>
59753 <secondary>removed; visibility of</secondary>
59754 </indexterm>
59755 Header lines are not visible in string expansions until the DATA phase when it
59756 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
59757 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
59758 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
59759 this restriction, you cannot use header lines as a way of controlling data
59760 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
59761 you should instead use ACL variables, as described in section
59762 <xref linkend="SECTaclvariables"/>.
59763 </para>
59764 <para>
59765 The <option>remove_header</option> modifier acts immediately as it is encountered during the
59766 processing of an ACL. Notice the difference between these two cases:
59767 </para>
59768 <literallayout>
59769 <literal>accept remove_header = X-Internal</literal>
59770 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
59771
59772 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
59773 <literal>       remove_header = X-Internal</literal>
59774 </literallayout>
59775 <para>
59776 In the first case, the header line is always removed, whether or not the
59777 condition is true. In the second case, the header line is removed only if the
59778 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
59779 same ACL statement. All those that are encountered before a condition fails
59780 are honoured.
59781 </para>
59782 <para>
59783 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
59784 present during ACL processing. It does NOT remove header lines that are added
59785 in a system filter or in a router or transport.
59786 </para>
59787 </section>
59788 <section id="SECTaclconditions">
59789 <title>ACL conditions</title>
59790 <para>
59791 <indexterm role="concept">
59792 <primary>access control lists (ACLs)</primary>
59793 <secondary>conditions; list of</secondary>
59794 </indexterm>
59795 Some of the conditions listed in this section are available only when Exim is
59796 compiled with the content-scanning extension. They are included here briefly
59797 for completeness. More detailed descriptions can be found in the discussion on
59798 content scanning in chapter <xref linkend="CHAPexiscan"/>.
59799 </para>
59800 <para>
59801 Not all conditions are relevant in all circumstances. For example, testing
59802 senders and recipients does not make sense in an ACL that is being run as the
59803 result of the arrival of an ETRN command, and checks on message headers can be
59804 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
59805 can use the same condition (with different parameters) more than once in the
59806 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
59807 The conditions are as follows:
59808 </para>
59809 <variablelist>
59810 <varlistentry>
59811 <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>
59812 <listitem>
59813 <para>
59814 <indexterm role="concept">
59815 <primary>access control lists (ACLs)</primary>
59816 <secondary>nested</secondary>
59817 </indexterm>
59818 <indexterm role="concept">
59819 <primary>access control lists (ACLs)</primary>
59820 <secondary>indirect</secondary>
59821 </indexterm>
59822 <indexterm role="concept">
59823 <primary>access control lists (ACLs)</primary>
59824 <secondary>arguments</secondary>
59825 </indexterm>
59826 <indexterm role="concept">
59827 <primary><option>acl</option> ACL condition</primary>
59828 </indexterm>
59829 The possible values of the argument are the same as for the
59830 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
59831 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
59832 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
59833 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
59834 condition false. This means that further processing of the <option>warn</option> verb
59835 ceases, but processing of the ACL continues.
59836 </para>
59837 <para>
59838 If the argument is a named ACL, up to nine space-separated optional values
59839 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
59840 and $acl_narg is set to the count of values.
59841 Previous values of these variables are restored after the call returns.
59842 The name and values are expanded separately.
59843 Note that spaces in complex expansions which are used as arguments
59844 will act as argument separators.
59845 </para>
59846 <para>
59847 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
59848 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
59849 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
59850 conditions are tested.
59851 </para>
59852 <para>
59853 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
59854 loops. This condition allows you to use different ACLs in different
59855 circumstances. For example, different ACLs can be used to handle RCPT commands
59856 for different local users or different local domains.
59857 </para>
59858 </listitem></varlistentry>
59859 <varlistentry>
59860 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
59861 <listitem>
59862 <para>
59863 <indexterm role="concept">
59864 <primary><option>authenticated</option> ACL condition</primary>
59865 </indexterm>
59866 <indexterm role="concept">
59867 <primary>authentication</primary>
59868 <secondary>ACL checking</secondary>
59869 </indexterm>
59870 <indexterm role="concept">
59871 <primary>access control lists (ACLs)</primary>
59872 <secondary>testing for authentication</secondary>
59873 </indexterm>
59874 If the SMTP connection is not authenticated, the condition is false. Otherwise,
59875 the name of the authenticator is tested against the list. To test for
59876 authentication by any authenticator, you can set
59877 </para>
59878 <literallayout class="monospaced">
59879 authenticated = *
59880 </literallayout>
59881 </listitem></varlistentry>
59882 <varlistentry>
59883 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
59884 <listitem>
59885 <para>
59886 <indexterm role="concept">
59887 <primary><option>condition</option> ACL condition</primary>
59888 </indexterm>
59889 <indexterm role="concept">
59890 <primary>customizing</primary>
59891 <secondary>ACL condition</secondary>
59892 </indexterm>
59893 <indexterm role="concept">
59894 <primary>access control lists (ACLs)</primary>
59895 <secondary>customized test</secondary>
59896 </indexterm>
59897 <indexterm role="concept">
59898 <primary>access control lists (ACLs)</primary>
59899 <secondary>testing, customized</secondary>
59900 </indexterm>
59901 This feature allows you to make up custom conditions. If the result of
59902 expanding the string is an empty string, the number zero, or one of the strings
59903 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
59904 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
59905 any other value, some error is assumed to have occurred, and the ACL returns
59906 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
59907 ignored. The effect is to treat it as true, whether it is positive or
59908 negative.
59909 </para>
59910 </listitem></varlistentry>
59911 <varlistentry>
59912 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
59913 <listitem>
59914 <para>
59915 <indexterm role="concept">
59916 <primary><option>decode</option> ACL condition</primary>
59917 </indexterm>
59918 This condition is available only when Exim is compiled with the
59919 content-scanning extension, and it is allowed only in the ACL defined by
59920 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
59921 If all goes well, the condition is true. It is false only if there are
59922 problems such as a syntax error or a memory shortage. For more details, see
59923 chapter <xref linkend="CHAPexiscan"/>.
59924 </para>
59925 </listitem></varlistentry>
59926 <varlistentry>
59927 <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>
59928 <listitem>
59929 <para>
59930 <indexterm role="concept">
59931 <primary><option>dnslists</option> ACL condition</primary>
59932 </indexterm>
59933 <indexterm role="concept">
59934 <primary>DNS list</primary>
59935 <secondary>in ACL</secondary>
59936 </indexterm>
59937 <indexterm role="concept">
59938 <primary>black list (DNS)</primary>
59939 </indexterm>
59940 <indexterm role="concept">
59941 <primary>access control lists (ACLs)</primary>
59942 <secondary>testing a DNS list</secondary>
59943 </indexterm>
59944 This condition checks for entries in DNS black lists. These are also known as
59945 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
59946 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
59947 different variants of this condition to describe briefly here. See sections
59948 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
59949 </para>
59950 </listitem></varlistentry>
59951 <varlistentry>
59952 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
59953 <listitem>
59954 <para>
59955 <indexterm role="concept">
59956 <primary><option>domains</option> ACL condition</primary>
59957 </indexterm>
59958 <indexterm role="concept">
59959 <primary>domain</primary>
59960 <secondary>ACL checking</secondary>
59961 </indexterm>
59962 <indexterm role="concept">
59963 <primary>access control lists (ACLs)</primary>
59964 <secondary>testing a recipient domain</secondary>
59965 </indexterm>
59966 <indexterm role="variable">
59967 <primary><varname>$domain_data</varname></primary>
59968 </indexterm>
59969 This condition is relevant only after a RCPT command. It checks that the domain
59970 of the recipient address is in the domain list. If percent-hack processing is
59971 enabled, it is done before this test is done. If the check succeeds with a
59972 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
59973 <option>domains</option> test.
59974 </para>
59975 <para>
59976 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
59977 use <option>domains</option> in a DATA ACL.
59978 </para>
59979 </listitem></varlistentry>
59980 <varlistentry>
59981 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
59982 <listitem>
59983 <para>
59984 <indexterm role="concept">
59985 <primary><option>encrypted</option> ACL condition</primary>
59986 </indexterm>
59987 <indexterm role="concept">
59988 <primary>encryption</primary>
59989 <secondary>checking in an ACL</secondary>
59990 </indexterm>
59991 <indexterm role="concept">
59992 <primary>access control lists (ACLs)</primary>
59993 <secondary>testing for encryption</secondary>
59994 </indexterm>
59995 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
59996 name of the cipher suite in use is tested against the list. To test for
59997 encryption without testing for any specific cipher suite(s), set
59998 </para>
59999 <literallayout class="monospaced">
60000 encrypted = *
60001 </literallayout>
60002 </listitem></varlistentry>
60003 <varlistentry>
60004 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
60005 <listitem>
60006 <para>
60007 <indexterm role="concept">
60008 <primary><option>hosts</option> ACL condition</primary>
60009 </indexterm>
60010 <indexterm role="concept">
60011 <primary>host</primary>
60012 <secondary>ACL checking</secondary>
60013 </indexterm>
60014 <indexterm role="concept">
60015 <primary>access control lists (ACLs)</primary>
60016 <secondary>testing the client host</secondary>
60017 </indexterm>
60018 This condition tests that the calling host matches the host list. If you have
60019 name lookups or wildcarded host names and IP addresses in the same host list,
60020 you should normally put the IP addresses first. For example, you could have:
60021 </para>
60022 <literallayout class="monospaced">
60023 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
60024 </literallayout>
60025 <para>
60026 The lookup in this example uses the host name for its key. This is implied by
60027 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
60028 and it wouldn&#x2019;t matter which way round you had these two items.)
60029 </para>
60030 <para>
60031 The reason for the problem with host names lies in the left-to-right way that
60032 Exim processes lists. It can test IP addresses without doing any DNS lookups,
60033 but when it reaches an item that requires a host name, it fails if it cannot
60034 find a host name to compare with the pattern. If the above list is given in the
60035 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
60036 found, even if its IP address is 10.9.8.7.
60037 </para>
60038 <para>
60039 If you really do want to do the name check first, and still recognize the IP
60040 address even if the name lookup fails, you can rewrite the ACL like this:
60041 </para>
60042 <literallayout class="monospaced">
60043 accept hosts = dbm;/etc/friendly/hosts
60044 accept hosts = 10.9.8.7
60045 </literallayout>
60046 <para>
60047 The default action on failing to find the host name is to assume that the host
60048 is not in the list, so the first <option>accept</option> statement fails. The second
60049 statement can then check the IP address.
60050 </para>
60051 <para>
60052 <indexterm role="variable">
60053 <primary><varname>$host_data</varname></primary>
60054 </indexterm>
60055 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
60056 of the lookup is made available in the <varname>$host_data</varname> variable. This
60057 allows you, for example, to set up a statement like this:
60058 </para>
60059 <literallayout class="monospaced">
60060 deny  hosts = net-lsearch;/some/file
60061       message = $host_data
60062 </literallayout>
60063 <para>
60064 which gives a custom error message for each denied host.
60065 </para>
60066 </listitem></varlistentry>
60067 <varlistentry>
60068 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
60069 <listitem>
60070 <para>
60071 <indexterm role="concept">
60072 <primary><option>local_parts</option> ACL condition</primary>
60073 </indexterm>
60074 <indexterm role="concept">
60075 <primary>local part</primary>
60076 <secondary>ACL checking</secondary>
60077 </indexterm>
60078 <indexterm role="concept">
60079 <primary>access control lists (ACLs)</primary>
60080 <secondary>testing a local part</secondary>
60081 </indexterm>
60082 <indexterm role="variable">
60083 <primary><varname>$local_part_data</varname></primary>
60084 </indexterm>
60085 This condition is relevant only after a RCPT command. It checks that the local
60086 part of the recipient address is in the list. If percent-hack processing is
60087 enabled, it is done before this test. If the check succeeds with a lookup, the
60088 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
60089 the next <option>local_parts</option> test.
60090 </para>
60091 </listitem></varlistentry>
60092 <varlistentry>
60093 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
60094 <listitem>
60095 <para>
60096 <indexterm role="concept">
60097 <primary><option>malware</option> ACL condition</primary>
60098 </indexterm>
60099 <indexterm role="concept">
60100 <primary>access control lists (ACLs)</primary>
60101 <secondary>virus scanning</secondary>
60102 </indexterm>
60103 <indexterm role="concept">
60104 <primary>access control lists (ACLs)</primary>
60105 <secondary>scanning for viruses</secondary>
60106 </indexterm>
60107 This condition is available only when Exim is compiled with the
60108 content-scanning extension
60109 and only after a DATA command.
60110 It causes the incoming message to be scanned for
60111 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
60112 </para>
60113 </listitem></varlistentry>
60114 <varlistentry>
60115 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
60116 <listitem>
60117 <para>
60118 <indexterm role="concept">
60119 <primary><option>mime_regex</option> ACL condition</primary>
60120 </indexterm>
60121 <indexterm role="concept">
60122 <primary>access control lists (ACLs)</primary>
60123 <secondary>testing by regex matching</secondary>
60124 </indexterm>
60125 This condition is available only when Exim is compiled with the
60126 content-scanning extension, and it is allowed only in the ACL defined by
60127 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
60128 with any of the regular expressions. For details, see chapter
60129 <xref linkend="CHAPexiscan"/>.
60130 </para>
60131 </listitem></varlistentry>
60132 <varlistentry>
60133 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
60134 <listitem>
60135 <para>
60136 <indexterm role="concept">
60137 <primary>rate limiting</primary>
60138 </indexterm>
60139 This condition can be used to limit the rate at which a user or host submits
60140 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
60141 </para>
60142 </listitem></varlistentry>
60143 <varlistentry>
60144 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
60145 <listitem>
60146 <para>
60147 <indexterm role="concept">
60148 <primary><option>recipients</option> ACL condition</primary>
60149 </indexterm>
60150 <indexterm role="concept">
60151 <primary>recipient</primary>
60152 <secondary>ACL checking</secondary>
60153 </indexterm>
60154 <indexterm role="concept">
60155 <primary>access control lists (ACLs)</primary>
60156 <secondary>testing a recipient</secondary>
60157 </indexterm>
60158 This condition is relevant only after a RCPT command. It checks the entire
60159 recipient address against a list of recipients.
60160 </para>
60161 </listitem></varlistentry>
60162 <varlistentry>
60163 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
60164 <listitem>
60165 <para>
60166 <indexterm role="concept">
60167 <primary><option>regex</option> ACL condition</primary>
60168 </indexterm>
60169 <indexterm role="concept">
60170 <primary>access control lists (ACLs)</primary>
60171 <secondary>testing by regex matching</secondary>
60172 </indexterm>
60173 This condition is available only when Exim is compiled with the
60174 content-scanning extension, and is available only in the DATA, MIME, and
60175 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
60176 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
60177 </para>
60178 </listitem></varlistentry>
60179 <varlistentry>
60180 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
60181 <listitem>
60182 <para>
60183 <indexterm role="concept">
60184 <primary><option>sender_domains</option> ACL condition</primary>
60185 </indexterm>
60186 <indexterm role="concept">
60187 <primary>sender</primary>
60188 <secondary>ACL checking</secondary>
60189 </indexterm>
60190 <indexterm role="concept">
60191 <primary>access control lists (ACLs)</primary>
60192 <secondary>testing a sender domain</secondary>
60193 </indexterm>
60194 <indexterm role="variable">
60195 <primary><varname>$domain</varname></primary>
60196 </indexterm>
60197 <indexterm role="variable">
60198 <primary><varname>$sender_address_domain</varname></primary>
60199 </indexterm>
60200 This condition tests the domain of the sender of the message against the given
60201 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
60202 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
60203 of this condition. This is an exception to the general rule for testing domain
60204 lists. It is done this way so that, if this condition is used in an ACL for a
60205 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
60206 influence the sender checking.
60207 </para>
60208 <para>
60209 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
60210 relaying, because sender addresses are easily, and commonly, forged.
60211 </para>
60212 </listitem></varlistentry>
60213 <varlistentry>
60214 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
60215 <listitem>
60216 <para>
60217 <indexterm role="concept">
60218 <primary><option>senders</option> ACL condition</primary>
60219 </indexterm>
60220 <indexterm role="concept">
60221 <primary>sender</primary>
60222 <secondary>ACL checking</secondary>
60223 </indexterm>
60224 <indexterm role="concept">
60225 <primary>access control lists (ACLs)</primary>
60226 <secondary>testing a sender</secondary>
60227 </indexterm>
60228 This condition tests the sender of the message against the given list. To test
60229 for a bounce message, which has an empty sender, set
60230 </para>
60231 <literallayout class="monospaced">
60232 senders = :
60233 </literallayout>
60234 <para>
60235 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
60236 relaying, because sender addresses are easily, and commonly, forged.
60237 </para>
60238 </listitem></varlistentry>
60239 <varlistentry>
60240 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
60241 <listitem>
60242 <para>
60243 <indexterm role="concept">
60244 <primary><option>spam</option> ACL condition</primary>
60245 </indexterm>
60246 <indexterm role="concept">
60247 <primary>access control lists (ACLs)</primary>
60248 <secondary>scanning for spam</secondary>
60249 </indexterm>
60250 This condition is available only when Exim is compiled with the
60251 content-scanning extension. It causes the incoming message to be scanned by
60252 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
60253 </para>
60254 </listitem></varlistentry>
60255 <varlistentry>
60256 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
60257 <listitem>
60258 <para>
60259 <indexterm role="concept">
60260 <primary><option>verify</option> ACL condition</primary>
60261 </indexterm>
60262 <indexterm role="concept">
60263 <primary>TLS</primary>
60264 <secondary>client certificate verification</secondary>
60265 </indexterm>
60266 <indexterm role="concept">
60267 <primary>certificate</primary>
60268 <secondary>verification of client</secondary>
60269 </indexterm>
60270 <indexterm role="concept">
60271 <primary>access control lists (ACLs)</primary>
60272 <secondary>certificate verification</secondary>
60273 </indexterm>
60274 <indexterm role="concept">
60275 <primary>access control lists (ACLs)</primary>
60276 <secondary>testing a TLS certificate</secondary>
60277 </indexterm>
60278 This condition is true in an SMTP session if the session is encrypted, and a
60279 certificate was received from the client, and the certificate was verified. The
60280 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
60281 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
60282 </para>
60283 </listitem></varlistentry>
60284 <varlistentry>
60285 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
60286 <listitem>
60287 <para>
60288 <indexterm role="concept">
60289 <primary>CSA verification</primary>
60290 </indexterm>
60291 This condition checks whether the sending host (the client) is authorized to
60292 send email. Details of how this works are given in section
60293 <xref linkend="SECTverifyCSA"/>.
60294 </para>
60295 </listitem></varlistentry>
60296 <varlistentry>
60297 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
60298 <listitem>
60299 <para>
60300 <indexterm role="concept">
60301 <primary><option>verify</option> ACL condition</primary>
60302 </indexterm>
60303 <indexterm role="concept">
60304 <primary>access control lists (ACLs)</primary>
60305 <secondary>verifying header names only ASCII</secondary>
60306 </indexterm>
60307 <indexterm role="concept">
60308 <primary>header lines</primary>
60309 <secondary>verifying header names only ASCII</secondary>
60310 </indexterm>
60311 <indexterm role="concept">
60312 <primary>verifying</primary>
60313 <secondary>header names only ASCII</secondary>
60314 </indexterm>
60315 This condition is relevant only in an ACL that is run after a message has been
60316 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
60317 <option>acl_not_smtp</option>.  It checks all header names (not the content) to make sure
60318 there are no non-ASCII characters, also excluding control characters.  The
60319 allowable characters are decimal ASCII values 33 through 126.
60320 </para>
60321 <para>
60322 Exim itself will handle headers with non-ASCII characters, but it can cause
60323 problems for downstream applications, so this option will allow their
60324 detection and rejection in the DATA ACL&#x2019;s.
60325 </para>
60326 </listitem></varlistentry>
60327 <varlistentry>
60328 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60329 <listitem>
60330 <para>
60331 <indexterm role="concept">
60332 <primary><option>verify</option> ACL condition</primary>
60333 </indexterm>
60334 <indexterm role="concept">
60335 <primary>access control lists (ACLs)</primary>
60336 <secondary>verifying sender in the header</secondary>
60337 </indexterm>
60338 <indexterm role="concept">
60339 <primary>header lines</primary>
60340 <secondary>verifying the sender in</secondary>
60341 </indexterm>
60342 <indexterm role="concept">
60343 <primary>sender</primary>
60344 <secondary>verifying in header</secondary>
60345 </indexterm>
60346 <indexterm role="concept">
60347 <primary>verifying</primary>
60348 <secondary>sender in header</secondary>
60349 </indexterm>
60350 This condition is relevant only in an ACL that is run after a message has been
60351 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
60352 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
60353 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
60354 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
60355 However, an address that appears in one of these headers need not be an address
60356 that accepts bounce messages; only sender addresses in envelopes are required
60357 to accept bounces. Therefore, if you use the callout option on this check, you
60358 might want to arrange for a non-empty address in the MAIL command.
60359 </para>
60360 <para>
60361 Details of address verification and the options are given later, starting at
60362 section <xref linkend="SECTaddressverification"/> (callouts are described in section
60363 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
60364 condition to restrict it to bounce messages only:
60365 </para>
60366 <literallayout class="monospaced">
60367 deny    senders = :
60368        !verify  = header_sender
60369         message = A valid sender header is required for bounces
60370 </literallayout>
60371 </listitem></varlistentry>
60372 <varlistentry>
60373 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
60374 <listitem>
60375 <para>
60376 <indexterm role="concept">
60377 <primary><option>verify</option> ACL condition</primary>
60378 </indexterm>
60379 <indexterm role="concept">
60380 <primary>access control lists (ACLs)</primary>
60381 <secondary>verifying header syntax</secondary>
60382 </indexterm>
60383 <indexterm role="concept">
60384 <primary>header lines</primary>
60385 <secondary>verifying syntax</secondary>
60386 </indexterm>
60387 <indexterm role="concept">
60388 <primary>verifying</primary>
60389 <secondary>header syntax</secondary>
60390 </indexterm>
60391 This condition is relevant only in an ACL that is run after a message has been
60392 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
60393 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
60394 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
60395 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
60396 Unqualified addresses (local parts without domains) are
60397 permitted only in locally generated messages and from hosts that match
60398 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
60399 appropriate.
60400 </para>
60401 <para>
60402 Note that this condition is a syntax check only. However, a common spamming
60403 ploy used to be to send syntactically invalid headers such as
60404 </para>
60405 <literallayout class="monospaced">
60406 To: @
60407 </literallayout>
60408 <para>
60409 and this condition can be used to reject such messages, though they are not as
60410 common as they used to be.
60411 </para>
60412 </listitem></varlistentry>
60413 <varlistentry>
60414 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
60415 <listitem>
60416 <para>
60417 <indexterm role="concept">
60418 <primary><option>verify</option> ACL condition</primary>
60419 </indexterm>
60420 <indexterm role="concept">
60421 <primary>access control lists (ACLs)</primary>
60422 <secondary>verifying HELO/EHLO</secondary>
60423 </indexterm>
60424 <indexterm role="concept">
60425 <primary>HELO</primary>
60426 <secondary>verifying</secondary>
60427 </indexterm>
60428 <indexterm role="concept">
60429 <primary>EHLO</primary>
60430 <secondary>verifying</secondary>
60431 </indexterm>
60432 <indexterm role="concept">
60433 <primary>verifying</primary>
60434 <secondary>EHLO</secondary>
60435 </indexterm>
60436 <indexterm role="concept">
60437 <primary>verifying</primary>
60438 <secondary>HELO</secondary>
60439 </indexterm>
60440 This condition is true if a HELO or EHLO command has been received from the
60441 client host, and its contents have been verified. If there has been no previous
60442 attempt to verify the HELO/EHLO contents, it is carried out when this
60443 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
60444 <option>helo_try_verify_hosts</option> options for details of how to request verification
60445 independently of this condition, and for detail of the verification.
60446 </para>
60447 <para>
60448 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
60449 option), this condition is always true.
60450 </para>
60451 </listitem></varlistentry>
60452 <varlistentry>
60453 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60454 <listitem>
60455 <para>
60456 <indexterm role="concept">
60457 <primary>verifying</primary>
60458 <secondary>not blind</secondary>
60459 </indexterm>
60460 <indexterm role="concept">
60461 <primary>bcc recipients, verifying none</primary>
60462 </indexterm>
60463 This condition checks that there are no blind (bcc) recipients in the message.
60464 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
60465 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
60466 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
60467 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
60468 used only in a DATA or non-SMTP ACL.
60469 </para>
60470 <para>
60471 There is one possible option, <literal>case_insensitive</literal>.  If this is present then
60472 local parts are checked case-insensitively.
60473 </para>
60474 <para>
60475 There are, of course, many legitimate messages that make use of blind (bcc)
60476 recipients. This check should not be used on its own for blocking messages.
60477 </para>
60478 </listitem></varlistentry>
60479 <varlistentry>
60480 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60481 <listitem>
60482 <para>
60483 <indexterm role="concept">
60484 <primary><option>verify</option> ACL condition</primary>
60485 </indexterm>
60486 <indexterm role="concept">
60487 <primary>access control lists (ACLs)</primary>
60488 <secondary>verifying recipient</secondary>
60489 </indexterm>
60490 <indexterm role="concept">
60491 <primary>recipient</primary>
60492 <secondary>verifying</secondary>
60493 </indexterm>
60494 <indexterm role="concept">
60495 <primary>verifying</primary>
60496 <secondary>recipient</secondary>
60497 </indexterm>
60498 <indexterm role="variable">
60499 <primary><varname>$address_data</varname></primary>
60500 </indexterm>
60501 This condition is relevant only after a RCPT command. It verifies the current
60502 recipient. Details of address verification are given later, starting at section
60503 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
60504 of <varname>$address_data</varname> is the last value that was set while routing the address.
60505 This applies even if the verification fails. When an address that is being
60506 verified is redirected to a single address, verification continues with the new
60507 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
60508 value for the child address.
60509 </para>
60510 </listitem></varlistentry>
60511 <varlistentry>
60512 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60513 <listitem>
60514 <para>
60515 <indexterm role="concept">
60516 <primary><option>verify</option> ACL condition</primary>
60517 </indexterm>
60518 <indexterm role="concept">
60519 <primary>access control lists (ACLs)</primary>
60520 <secondary>verifying host reverse lookup</secondary>
60521 </indexterm>
60522 <indexterm role="concept">
60523 <primary>host</primary>
60524 <secondary>verifying reverse lookup</secondary>
60525 </indexterm>
60526 This condition ensures that a verified host name has been looked up from the IP
60527 address of the client host. (This may have happened already if the host name
60528 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
60529 Verification ensures that the host name obtained from a reverse DNS lookup, or
60530 one of its aliases, does, when it is itself looked up in the DNS, yield the
60531 original IP address.
60532 </para>
60533 <para>
60534 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
60535 DNS operation returns a temporary error, the verify condition succeeds.
60536 </para>
60537 <para>
60538 If this condition is used for a locally generated message (that is, when there
60539 is no client host involved), it always succeeds.
60540 </para>
60541 </listitem></varlistentry>
60542 <varlistentry>
60543 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60544 <listitem>
60545 <para>
60546 <indexterm role="concept">
60547 <primary><option>verify</option> ACL condition</primary>
60548 </indexterm>
60549 <indexterm role="concept">
60550 <primary>access control lists (ACLs)</primary>
60551 <secondary>verifying sender</secondary>
60552 </indexterm>
60553 <indexterm role="concept">
60554 <primary>sender</primary>
60555 <secondary>verifying</secondary>
60556 </indexterm>
60557 <indexterm role="concept">
60558 <primary>verifying</primary>
60559 <secondary>sender</secondary>
60560 </indexterm>
60561 This condition is relevant only after a MAIL or RCPT command, or after a
60562 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
60563 the message&#x2019;s sender is empty (that is, this is a bounce message), the
60564 condition is true. Otherwise, the sender address is verified.
60565 </para>
60566 <para>
60567 <indexterm role="variable">
60568 <primary><varname>$address_data</varname></primary>
60569 </indexterm>
60570 <indexterm role="variable">
60571 <primary><varname>$sender_address_data</varname></primary>
60572 </indexterm>
60573 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
60574 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
60575 value can be used in subsequent conditions and modifiers in the same ACL
60576 statement. It does not persist after the end of the current statement. If you
60577 want to preserve the value for longer, you can save it in an ACL variable.
60578 </para>
60579 <para>
60580 Details of verification are given later, starting at section
60581 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
60582 to avoid doing it more than once per message.
60583 </para>
60584 </listitem></varlistentry>
60585 <varlistentry>
60586 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60587 <listitem>
60588 <para>
60589 <indexterm role="concept">
60590 <primary><option>verify</option> ACL condition</primary>
60591 </indexterm>
60592 This is a variation of the previous option, in which a modified address is
60593 verified as a sender.
60594 </para>
60595 <para>
60596 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
60597 (eg. is generated from the received message)
60598 they must be protected from the options parsing by doubling:
60599 </para>
60600 <literallayout class="monospaced">
60601 verify = sender=${sg{${address:$h_sender:}}{/}{//}}
60602 </literallayout>
60603 </listitem></varlistentry>
60604 </variablelist>
60605 </section>
60606 <section id="SECTmorednslists">
60607 <title>Using DNS lists</title>
60608 <para>
60609 <indexterm role="concept">
60610 <primary>DNS list</primary>
60611 <secondary>in ACL</secondary>
60612 </indexterm>
60613 <indexterm role="concept">
60614 <primary>black list (DNS)</primary>
60615 </indexterm>
60616 <indexterm role="concept">
60617 <primary>access control lists (ACLs)</primary>
60618 <secondary>testing a DNS list</secondary>
60619 </indexterm>
60620 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
60621 is on at least one of a number of DNS lists by looking up the inverted IP
60622 address in one or more DNS domains. (Note that DNS list domains are not mail
60623 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
60624 special options instead.) For example, if the calling host&#x2019;s IP
60625 address is 192.168.62.43, and the ACL statement is
60626 </para>
60627 <literallayout class="monospaced">
60628 deny dnslists = blackholes.mail-abuse.org : \
60629                 dialups.mail-abuse.org
60630 </literallayout>
60631 <para>
60632 the following records are looked up:
60633 </para>
60634 <literallayout class="monospaced">
60635 43.62.168.192.blackholes.mail-abuse.org
60636 43.62.168.192.dialups.mail-abuse.org
60637 </literallayout>
60638 <para>
60639 As soon as Exim finds an existing DNS record, processing of the list stops.
60640 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
60641 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
60642 use two separate conditions:
60643 </para>
60644 <literallayout class="monospaced">
60645 deny dnslists = blackholes.mail-abuse.org
60646      dnslists = dialups.mail-abuse.org
60647 </literallayout>
60648 <para>
60649 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
60650 behaves as if the host does not match the list item, that is, as if the DNS
60651 record does not exist. If there are further items in the DNS list, they are
60652 processed.
60653 </para>
60654 <para>
60655 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
60656 (which is the most common usage), because it prevents a DNS failure from
60657 blocking mail. However, you can change this behaviour by putting one of the
60658 following special items in the list:
60659 </para>
60660 <literallayout>
60661 <literal>+include_unknown </literal>   behave as if the item is on the list
60662 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
60663 <literal>+defer_unknown   </literal>   give a temporary error
60664 </literallayout>
60665 <para>
60666 <indexterm role="concept">
60667 <primary><literal>+include_unknown</literal></primary>
60668 </indexterm>
60669 <indexterm role="concept">
60670 <primary><literal>+exclude_unknown</literal></primary>
60671 </indexterm>
60672 <indexterm role="concept">
60673 <primary><literal>+defer_unknown</literal></primary>
60674 </indexterm>
60675 Each of these applies to any subsequent items on the list. For example:
60676 </para>
60677 <literallayout class="monospaced">
60678 deny dnslists = +defer_unknown : foo.bar.example
60679 </literallayout>
60680 <para>
60681 Testing the list of domains stops as soon as a match is found. If you want to
60682 warn for one list and block for another, you can use two different statements:
60683 </para>
60684 <literallayout class="monospaced">
60685 deny  dnslists = blackholes.mail-abuse.org
60686 warn  dnslists = dialups.mail-abuse.org
60687       message  = X-Warn: sending host is on dialups list
60688 </literallayout>
60689 <para>
60690 <indexterm role="concept">
60691 <primary>caching</primary>
60692 <secondary>of dns lookup</secondary>
60693 </indexterm>
60694 <indexterm role="concept">
60695 <primary>DNS</primary>
60696 <secondary>TTL</secondary>
60697 </indexterm>
60698 DNS list lookups are cached by Exim for the duration of the SMTP session
60699 (but limited by the DNS return TTL value),
60700 so a lookup based on the IP address is done at most once for any incoming
60701 connection (assuming long-enough TTL).
60702 Exim does not share information between multiple incoming
60703 connections (but your local name server cache should be active).
60704 </para>
60705 <para>
60706 There are a number of DNS lists to choose from, some commercial, some free,
60707 or free for small deployments.  An overview can be found at
60708 <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>.
60709 </para>
60710 </section>
60711 <section id="SECID201">
60712 <title>Specifying the IP address for a DNS list lookup</title>
60713 <para>
60714 <indexterm role="concept">
60715 <primary>DNS list</primary>
60716 <secondary>keyed by explicit IP address</secondary>
60717 </indexterm>
60718 By default, the IP address that is used in a DNS list lookup is the IP address
60719 of the calling host. However, you can specify another IP address by listing it
60720 after the domain name, introduced by a slash. For example:
60721 </para>
60722 <literallayout class="monospaced">
60723 deny dnslists = black.list.tld/192.168.1.2
60724 </literallayout>
60725 <para>
60726 This feature is not very helpful with explicit IP addresses; it is intended for
60727 use with IP addresses that are looked up, for example, the IP addresses of the
60728 MX hosts or nameservers of an email sender address. For an example, see section
60729 <xref linkend="SECTmulkeyfor"/> below.
60730 </para>
60731 </section>
60732 <section id="SECID202">
60733 <title>DNS lists keyed on domain names</title>
60734 <para>
60735 <indexterm role="concept">
60736 <primary>DNS list</primary>
60737 <secondary>keyed by domain name</secondary>
60738 </indexterm>
60739 There are some lists that are keyed on domain names rather than inverted IP
60740 addresses (see, e.g., the <emphasis>domain based zones</emphasis> link at
60741 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
60742 with these lists. You can change the name that is looked up in a DNS list by
60743 listing it after the domain name, introduced by a slash. For example,
60744 </para>
60745 <literallayout class="monospaced">
60746 deny  dnslists = dsn.rfc-ignorant.org/$sender_address_domain
60747       message  = Sender's domain is listed at $dnslist_domain
60748 </literallayout>
60749 <para>
60750 This particular example is useful only in ACLs that are obeyed after the
60751 RCPT or DATA commands, when a sender address is available. If (for
60752 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
60753 up by this example is
60754 </para>
60755 <literallayout class="monospaced">
60756 tld.example.dsn.rfc-ignorant.org
60757 </literallayout>
60758 <para>
60759 A single <option>dnslists</option> condition can contain entries for both names and IP
60760 addresses. For example:
60761 </para>
60762 <literallayout class="monospaced">
60763 deny dnslists = sbl.spamhaus.org : \
60764                 dsn.rfc-ignorant.org/$sender_address_domain
60765 </literallayout>
60766 <para>
60767 The first item checks the sending host&#x2019;s IP address; the second checks a domain
60768 name. The whole condition is true if either of the DNS lookups succeeds.
60769 </para>
60770 </section>
60771 <section id="SECTmulkeyfor">
60772 <title>Multiple explicit keys for a DNS list</title>
60773 <para>
60774 <indexterm role="concept">
60775 <primary>DNS list</primary>
60776 <secondary>multiple keys for</secondary>
60777 </indexterm>
60778 The syntax described above for looking up explicitly-defined values (either
60779 names or IP addresses) in a DNS blacklist is a simplification. After the domain
60780 name for the DNS list, what follows the slash can in fact be a list of items.
60781 As with all lists in Exim, the default separator is a colon. However, because
60782 this is a sublist within the list of DNS blacklist domains, it is necessary
60783 either to double the separators like this:
60784 </para>
60785 <literallayout class="monospaced">
60786 dnslists = black.list.tld/name.1::name.2
60787 </literallayout>
60788 <para>
60789 or to change the separator character, like this:
60790 </para>
60791 <literallayout class="monospaced">
60792 dnslists = black.list.tld/&lt;;name.1;name.2
60793 </literallayout>
60794 <para>
60795 If an item in the list is an IP address, it is inverted before the DNS
60796 blacklist domain is appended. If it is not an IP address, no inversion
60797 occurs. Consider this condition:
60798 </para>
60799 <literallayout class="monospaced">
60800 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
60801 </literallayout>
60802 <para>
60803 The DNS lookups that occur are:
60804 </para>
60805 <literallayout class="monospaced">
60806 2.1.168.192.black.list.tld
60807 a.domain.black.list.tld
60808 </literallayout>
60809 <para>
60810 Once a DNS record has been found (that matches a specific IP return
60811 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
60812 are done. If there is a temporary DNS error, the rest of the sublist of domains
60813 or IP addresses is tried. A temporary error for the whole dnslists item occurs
60814 only if no other DNS lookup in this sublist succeeds. In other words, a
60815 successful lookup for any of the items in the sublist overrides a temporary
60816 error for a previous item.
60817 </para>
60818 <para>
60819 The ability to supply a list of items after the slash is in some sense just a
60820 syntactic convenience. These two examples have the same effect:
60821 </para>
60822 <literallayout class="monospaced">
60823 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
60824 dnslists = black.list.tld/a.domain::b.domain
60825 </literallayout>
60826 <para>
60827 However, when the data for the list is obtained from a lookup, the second form
60828 is usually much more convenient. Consider this example:
60829 </para>
60830 <literallayout class="monospaced">
60831 deny dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
60832                                    ${lookup dnsdb {&gt;|mxh=\
60833                                    $sender_address_domain} }} }
60834      message  = The mail servers for the domain \
60835                 $sender_address_domain \
60836                 are listed at $dnslist_domain ($dnslist_value); \
60837                 see $dnslist_text.
60838 </literallayout>
60839 <para>
60840 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
60841 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
60842 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
60843 of expanding the condition might be something like this:
60844 </para>
60845 <literallayout class="monospaced">
60846 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
60847 </literallayout>
60848 <para>
60849 Thus, this example checks whether or not the IP addresses of the sender
60850 domain&#x2019;s mail servers are on the Spamhaus black list.
60851 </para>
60852 <para>
60853 The key that was used for a successful DNS list lookup is put into the variable
60854 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
60855 </para>
60856 </section>
60857 <section id="SECID203">
60858 <title>Data returned by DNS lists</title>
60859 <para>
60860 <indexterm role="concept">
60861 <primary>DNS list</primary>
60862 <secondary>data returned from</secondary>
60863 </indexterm>
60864 DNS lists are constructed using address records in the DNS. The original RBL
60865 just used the address 127.0.0.1 on the right hand side of each record, but the
60866 RBL+ list and some other lists use a number of values with different meanings.
60867 The values used on the RBL+ list are:
60868 </para>
60869 <literallayout>
60870 127.1.0.1  RBL
60871 127.1.0.2  DUL
60872 127.1.0.3  DUL and RBL
60873 127.1.0.4  RSS
60874 127.1.0.5  RSS and RBL
60875 127.1.0.6  RSS and DUL
60876 127.1.0.7  RSS and DUL and RBL
60877 </literallayout>
60878 <para>
60879 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
60880 different values. Some DNS lists may return more than one address record;
60881 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
60882 </para>
60883 </section>
60884 <section id="SECID204">
60885 <title>Variables set from DNS lists</title>
60886 <para>
60887 <indexterm role="concept">
60888 <primary>expansion</primary>
60889 <secondary>variables, set from DNS list</secondary>
60890 </indexterm>
60891 <indexterm role="concept">
60892 <primary>DNS list</primary>
60893 <secondary>variables set from</secondary>
60894 </indexterm>
60895 <indexterm role="variable">
60896 <primary><varname>$dnslist_domain</varname></primary>
60897 </indexterm>
60898 <indexterm role="variable">
60899 <primary><varname>$dnslist_matched</varname></primary>
60900 </indexterm>
60901 <indexterm role="variable">
60902 <primary><varname>$dnslist_text</varname></primary>
60903 </indexterm>
60904 <indexterm role="variable">
60905 <primary><varname>$dnslist_value</varname></primary>
60906 </indexterm>
60907 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
60908 the name of the overall domain that matched (for example,
60909 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
60910 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
60911 the DNS record. When the key is an IP address, it is not reversed in
60912 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
60913 cases, for example:
60914 </para>
60915 <literallayout class="monospaced">
60916 deny dnslists = spamhaus.example
60917 </literallayout>
60918 <para>
60919 the key is also available in another variable (in this case,
60920 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
60921 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
60922 might generate a dnslists lookup like this:
60923 </para>
60924 <literallayout class="monospaced">
60925 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
60926 </literallayout>
60927 <para>
60928 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
60929 <literal>192.168.6.7</literal> (for example).
60930 </para>
60931 <para>
60932 If more than one address record is returned by the DNS lookup, all the IP
60933 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
60934 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
60935 record. For lists such as RBL+ the TXT record for a merged entry is often not
60936 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
60937 information.
60938 </para>
60939 <para>
60940 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
60941 &ndash; even if these appear before the condition in the ACL, they are not
60942 expanded until after it has failed. For example:
60943 </para>
60944 <literallayout class="monospaced">
60945 deny    hosts = !+local_networks
60946         message = $sender_host_address is listed \
60947                   at $dnslist_domain
60948         dnslists = rbl-plus.mail-abuse.example
60949 </literallayout>
60950 </section>
60951 <section id="SECTaddmatcon">
60952 <title>Additional matching conditions for DNS lists</title>
60953 <para>
60954 <indexterm role="concept">
60955 <primary>DNS list</primary>
60956 <secondary>matching specific returned data</secondary>
60957 </indexterm>
60958 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
60959 in order to restrict its action to DNS records with a matching right hand side.
60960 For example,
60961 </para>
60962 <literallayout class="monospaced">
60963 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
60964 </literallayout>
60965 <para>
60966 rejects only those hosts that yield 127.0.0.2. Without this additional data,
60967 any address record is considered to be a match. For the moment, we assume
60968 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
60969 describes how multiple records are handled.
60970 </para>
60971 <para>
60972 More than one IP address may be given for checking, using a comma as a
60973 separator. These are alternatives &ndash; if any one of them matches, the
60974 <option>dnslists</option> condition is true. For example:
60975 </para>
60976 <literallayout class="monospaced">
60977 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
60978 </literallayout>
60979 <para>
60980 If you want to specify a constraining address list and also specify names or IP
60981 addresses to be looked up, the constraining address list must be specified
60982 first. For example:
60983 </para>
60984 <literallayout class="monospaced">
60985 deny dnslists = dsn.rfc-ignorant.org\
60986                 =127.0.0.2/$sender_address_domain
60987 </literallayout>
60988 <para>
60989 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
60990 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
60991 In other words, the listed addresses are used as bit masks. The comparison is
60992 true if all the bits in the mask are present in the address that is being
60993 tested. For example:
60994 </para>
60995 <literallayout class="monospaced">
60996 dnslists = a.b.c&amp;0.0.0.3
60997 </literallayout>
60998 <para>
60999 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
61000 want to test whether one bit or another bit is present (as opposed to both
61001 being present), you must use multiple values. For example:
61002 </para>
61003 <literallayout class="monospaced">
61004 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
61005 </literallayout>
61006 <para>
61007 matches if the final component of the address is an odd number or two times
61008 an odd number.
61009 </para>
61010 </section>
61011 <section id="SECID205">
61012 <title>Negated DNS matching conditions</title>
61013 <para>
61014 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
61015 condition. Whereas
61016 </para>
61017 <literallayout class="monospaced">
61018 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
61019 </literallayout>
61020 <para>
61021 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
61022 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
61023 </para>
61024 <literallayout class="monospaced">
61025 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
61026 </literallayout>
61027 <para>
61028 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
61029 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
61030 words, the result of the test is inverted if an exclamation mark appears before
61031 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
61032 </para>
61033 <para>
61034 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
61035 host, or address list (which is why the syntax is different).
61036 </para>
61037 <para>
61038 If you are using just one list, the negation syntax does not gain you much. The
61039 previous example is precisely equivalent to
61040 </para>
61041 <literallayout class="monospaced">
61042 deny  dnslists = a.b.c
61043      !dnslists = a.b.c=127.0.0.2,127.0.0.3
61044 </literallayout>
61045 <para>
61046 However, if you are using multiple lists, the negation syntax is clearer.
61047 Consider this example:
61048 </para>
61049 <literallayout class="monospaced">
61050 deny  dnslists = sbl.spamhaus.org : \
61051                  list.dsbl.org : \
61052                  dnsbl.njabl.org!=127.0.0.3 : \
61053                  relays.ordb.org
61054 </literallayout>
61055 <para>
61056 Using only positive lists, this would have to be:
61057 </para>
61058 <literallayout class="monospaced">
61059 deny  dnslists = sbl.spamhaus.org : \
61060                  list.dsbl.org
61061 deny  dnslists = dnsbl.njabl.org
61062      !dnslists = dnsbl.njabl.org=127.0.0.3
61063 deny  dnslists = relays.ordb.org
61064 </literallayout>
61065 <para>
61066 which is less clear, and harder to maintain.
61067 </para>
61068 </section>
61069 <section id="SECThanmuldnsrec">
61070 <title>Handling multiple DNS records from a DNS list</title>
61071 <para>
61072 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
61073 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
61074 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
61075 the match to specific results from the DNS lookup, there are two ways in which
61076 the checking can be handled. For example, consider the condition:
61077 </para>
61078 <literallayout class="monospaced">
61079 dnslists = a.b.c=127.0.0.1
61080 </literallayout>
61081 <para>
61082 What happens if the DNS lookup for the incoming IP address yields both
61083 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
61084 condition true because at least one given value was found, or is it false
61085 because at least one of the found values was not listed? And how does this
61086 affect negated conditions? Both possibilities are provided for with the help of
61087 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
61088 </para>
61089 <itemizedlist>
61090 <listitem>
61091 <para>
61092 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
61093 IP addresses matches one of the listed addresses. For the example above, the
61094 condition is true because 127.0.0.1 matches.
61095 </para>
61096 </listitem>
61097 <listitem>
61098 <para>
61099 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
61100 looked up IP addresses matches one of the listed addresses. If the condition is
61101 changed to:
61102 </para>
61103 <literallayout class="monospaced">
61104 dnslists = a.b.c==127.0.0.1
61105 </literallayout>
61106 <para>
61107 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
61108 false because 127.0.0.2 is not listed. You would need to have:
61109 </para>
61110 <literallayout class="monospaced">
61111 dnslists = a.b.c==127.0.0.1,127.0.0.2
61112 </literallayout>
61113 <para>
61114 for the condition to be true.
61115 </para>
61116 </listitem>
61117 </itemizedlist>
61118 <para>
61119 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
61120 the precise opposite of the behaviour above. Thus:
61121 </para>
61122 <itemizedlist>
61123 <listitem>
61124 <para>
61125 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
61126 addresses matches one of the listed addresses. Consider:
61127 </para>
61128 <literallayout class="monospaced">
61129 dnslists = a.b.c!&amp;0.0.0.1
61130 </literallayout>
61131 <para>
61132 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
61133 false because 127.0.0.1 matches.
61134 </para>
61135 </listitem>
61136 <listitem>
61137 <para>
61138 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
61139 looked up IP address that does not match. Consider:
61140 </para>
61141 <literallayout class="monospaced">
61142 dnslists = a.b.c!=&amp;0.0.0.1
61143 </literallayout>
61144 <para>
61145 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
61146 true, because 127.0.0.2 does not match. You would need to have:
61147 </para>
61148 <literallayout class="monospaced">
61149 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
61150 </literallayout>
61151 <para>
61152 for the condition to be false.
61153 </para>
61154 </listitem>
61155 </itemizedlist>
61156 <para>
61157 When the DNS lookup yields only a single IP address, there is no difference
61158 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
61159 </para>
61160 </section>
61161 <section id="SECTmordetinf">
61162 <title>Detailed information from merged DNS lists</title>
61163 <para>
61164 <indexterm role="concept">
61165 <primary>DNS list</primary>
61166 <secondary>information from merged</secondary>
61167 </indexterm>
61168 When the facility for restricting the matching IP values in a DNS list is used,
61169 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
61170 the true reason for rejection. This happens when lists are merged and the IP
61171 address in the A record is used to distinguish them; unfortunately there is
61172 only one TXT record. One way round this is not to use merged lists, but that
61173 can be inefficient because it requires multiple DNS lookups where one would do
61174 in the vast majority of cases when the host of interest is not on any of the
61175 lists.
61176 </para>
61177 <para>
61178 A less inefficient way of solving this problem is available. If
61179 two domain names, comma-separated, are given, the second is used first to
61180 do an initial check, making use of any IP value restrictions that are set.
61181 If there is a match, the first domain is used, without any IP value
61182 restrictions, to get the TXT record. As a byproduct of this, there is also
61183 a check that the IP being tested is indeed on the first list. The first
61184 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
61185 </para>
61186 <literallayout class="monospaced">
61187 deny   dnslists = \
61188          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
61189          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
61190        message  = \
61191          rejected because $sender_host_address is blacklisted \
61192          at $dnslist_domain\n$dnslist_text
61193 </literallayout>
61194 <para>
61195 For the first blacklist item, this starts by doing a lookup in
61196 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
61197 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
61198 value, and as long as something is found, it looks for the corresponding TXT
61199 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
61200 The second blacklist item is processed similarly.
61201 </para>
61202 <para>
61203 If you are interested in more than one merged list, the same list must be
61204 given several times, but because the results of the DNS lookups are cached,
61205 the DNS calls themselves are not repeated. For example:
61206 </para>
61207 <literallayout class="monospaced">
61208 deny dnslists = \
61209          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
61210          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
61211          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
61212          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
61213 </literallayout>
61214 <para>
61215 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
61216 values matches (or if no record is found), this is the only lookup that is
61217 done. Only if there is a match is one of the more specific lists consulted.
61218 </para>
61219 </section>
61220 <section id="SECTmorednslistslast">
61221 <title>DNS lists and IPv6</title>
61222 <para>
61223 <indexterm role="concept">
61224 <primary>IPv6</primary>
61225 <secondary>DNS black lists</secondary>
61226 </indexterm>
61227 <indexterm role="concept">
61228 <primary>DNS list</primary>
61229 <secondary>IPv6 usage</secondary>
61230 </indexterm>
61231 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
61232 nibble by nibble. For example, if the calling host&#x2019;s IP address is
61233 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
61234 </para>
61235 <literallayout class="monospaced">
61236 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
61237   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
61238 </literallayout>
61239 <para>
61240 (split over two lines here to fit on the page). Unfortunately, some of the DNS
61241 lists contain wildcard records, intended for IPv4, that interact badly with
61242 IPv6. For example, the DNS entry
61243 </para>
61244 <literallayout class="monospaced">
61245 *.3.some.list.example.    A    127.0.0.1
61246 </literallayout>
61247 <para>
61248 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
61249 Unfortunately, it also matches the entire 3::/4 IPv6 network.
61250 </para>
61251 <para>
61252 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
61253 <option>condition</option> condition, as in this example:
61254 </para>
61255 <literallayout class="monospaced">
61256 deny   condition = ${if isip4{$sender_host_address}}
61257        dnslists  = some.list.example
61258 </literallayout>
61259 <para>
61260 If an explicit key is being used for a DNS lookup and it may be an IPv6
61261 address you should specify alternate list separators for both the outer
61262 (DNS list name) list and inner (lookup keys) list:
61263 </para>
61264 <literallayout class="monospaced">
61265        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
61266 </literallayout>
61267 </section>
61268 <section id="SECTratelimiting">
61269 <title>Rate limiting incoming messages</title>
61270 <para>
61271 <indexterm role="concept">
61272 <primary>rate limiting</primary>
61273 <secondary>client sending</secondary>
61274 </indexterm>
61275 <indexterm role="concept">
61276 <primary>limiting client sending rates</primary>
61277 </indexterm>
61278 <indexterm role="option">
61279 <primary><option>smtp_ratelimit_*</option></primary>
61280 </indexterm>
61281 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
61282 which clients can send email. This is more powerful than the
61283 <option>smtp_ratelimit_*</option> options, because those options control the rate of
61284 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
61285 works across all connections (concurrent and sequential) from the same client
61286 host. The syntax of the <option>ratelimit</option> condition is:
61287 </para>
61288 <literallayout>
61289 <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;
61290 </literallayout>
61291 <para>
61292 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
61293 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
61294 </para>
61295 <para>
61296 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
61297 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
61298 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
61299 of <emphasis>p</emphasis>.
61300 </para>
61301 <para>
61302 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
61303 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
61304 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
61305 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
61306 send in each time interval. It also specifies the number of messages permitted
61307 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
61308 constant, you can allow a client to send more messages in a burst without
61309 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
61310 both small, messages must be sent at an even rate.
61311 </para>
61312 <para>
61313 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
61314 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
61315 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
61316 instructions when it is run with no arguments.
61317 </para>
61318 <para>
61319 The key is used to look up the data for calculating the client&#x2019;s average
61320 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
61321 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
61322 which means Exim computes the sending rate of each client host IP address.
61323 By changing the key you can change how Exim identifies clients for the purpose
61324 of ratelimiting. For example, to limit the sending rate of each authenticated
61325 user, independent of the computer they are sending from, set the key to
61326 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
61327 example, <varname>$authenticated_id</varname> is only meaningful if the client has
61328 authenticated (which you can check with the <option>authenticated</option> ACL condition).
61329 </para>
61330 <para>
61331 The lookup key does not have to identify clients: If you want to limit the
61332 rate at which a recipient receives messages, you can use the key
61333 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
61334 ACL.
61335 </para>
61336 <para>
61337 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
61338 specifies what Exim measures the rate of, for example, messages or recipients
61339 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
61340 <option>count=</option> options. You can also control when Exim updates the recorded rate
61341 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
61342 separated by a slash, like the other parameters. They may appear in any order.
61343 </para>
61344 <para>
61345 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
61346 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
61347 stored, so you can alter the configured maximum rate and Exim will still
61348 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
61349 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
61350 behaviour. The lookup key is not affected by changes to the update mode and
61351 the <option>count=</option> option.
61352 </para>
61353 </section>
61354 <section id="ratoptmea">
61355 <title>Ratelimit options for what is being measured</title>
61356 <para>
61357 <indexterm role="concept">
61358 <primary>rate limiting</primary>
61359 <secondary>per_* options</secondary>
61360 </indexterm>
61361 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
61362 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
61363 <option>acl_not_smtp_start</option> ACLs.
61364 </para>
61365 <para>
61366 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
61367 the default if none of the <option>per_*</option> options is specified. It can be used in
61368 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
61369 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
61370 </para>
61371 <para>
61372 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
61373 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
61374 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
61375 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
61376 in its MAIL command, which may be inaccurate or completely missing. You can
61377 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
61378 in kilobytes, megabytes, or gigabytes, respectively.
61379 </para>
61380 <para>
61381 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
61382 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
61383 <option>acl_smtp_mime</option>, <option>acl_smtp_data</option>, or <option>acl_smtp_rcpt</option> ACLs. In
61384 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
61385 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
61386 in either case the rate limiting engine will see a message with many
61387 recipients as a large high-speed burst.
61388 </para>
61389 <para>
61390 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
61391 number of different recipients that the client has sent messages to in the
61392 last time period. That is, if the client repeatedly sends messages to the same
61393 recipient, its measured rate is not increased. This option can only be used in
61394 <option>acl_smtp_rcpt</option>.
61395 </para>
61396 <para>
61397 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
61398 condition is processed. This can be used to limit the rate of any SMTP
61399 command. If it is used in multiple ACLs it can limit the aggregate rate of
61400 multiple different commands.
61401 </para>
61402 <para>
61403 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
61404 measured rate. For example, the <option>per_byte</option> option is equivalent to
61405 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
61406 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
61407 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
61408 </para>
61409 <para>
61410 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
61411 </para>
61412 </section>
61413 <section id="ratoptupd">
61414 <title>Ratelimit update modes</title>
61415 <para>
61416 <indexterm role="concept">
61417 <primary>rate limiting</primary>
61418 <secondary>reading data without updating</secondary>
61419 </indexterm>
61420 You can specify one of three options with the <option>ratelimit</option> condition to
61421 control when its database is updated. This section describes the <option>readonly</option>
61422 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
61423 </para>
61424 <para>
61425 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
61426 previously-computed rate to check against the limit.
61427 </para>
61428 <para>
61429 For example, you can test the client&#x2019;s sending rate and deny it access (when
61430 it is too fast) in the connect ACL. If the client passes this check then it
61431 can go on to send a message, in which case its recorded rate will be updated
61432 in the MAIL ACL. Subsequent connections from the same client will check this
61433 new rate.
61434 </para>
61435 <literallayout class="monospaced">
61436 acl_check_connect:
61437  deny ratelimit = 100 / 5m / readonly
61438       log_message = RATE CHECK: $sender_rate/$sender_rate_period \
61439                   (max $sender_rate_limit)
61440 # ...
61441 acl_check_mail:
61442  warn ratelimit = 100 / 5m / strict
61443       log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
61444                   (max $sender_rate_limit)
61445 </literallayout>
61446 <para>
61447 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
61448 processing a message then it may increase the client&#x2019;s measured rate more than
61449 it should. For example, this will happen if you check the <option>per_rcpt</option> option
61450 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
61451 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
61452 multiple update problems by using the <option>readonly</option> option on later ratelimit
61453 checks.
61454 </para>
61455 <para>
61456 The <option>per_*</option> options described above do not make sense in some ACLs. If you
61457 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
61458 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
61459 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
61460 next section) so you must specify the <option>readonly</option> option explicitly.
61461 </para>
61462 </section>
61463 <section id="ratoptfast">
61464 <title>Ratelimit options for handling fast clients</title>
61465 <para>
61466 <indexterm role="concept">
61467 <primary>rate limiting</primary>
61468 <secondary>strict and leaky modes</secondary>
61469 </indexterm>
61470 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
61471 engine can react in two possible ways, depending on the presence of the
61472 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
61473 counter-measures (such as rejecting the message) that may be specified by the
61474 rest of the ACL.
61475 </para>
61476 <para>
61477 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
61478 updated if it is above the limit. The effect of this is that Exim measures the
61479 client&#x2019;s average rate of successfully sent email,
61480 up to the given limit.
61481 This is appropriate if the countermeasure when the condition is true
61482 consists of refusing the message, and
61483 is generally the better choice if you have clients that retry automatically.
61484 If the action when true is anything more complex then this option is
61485 likely not what is wanted.
61486 </para>
61487 <para>
61488 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
61489 updated. The effect of this is that Exim measures the client&#x2019;s average rate
61490 of attempts to send email, which can be much higher than the maximum it is
61491 actually allowed. If the client is over the limit it may be subjected to
61492 counter-measures by the ACL. It must slow down and allow sufficient time to
61493 pass that its computed rate falls below the maximum before it can send email
61494 again. The time (the number of smoothing periods) it must wait and not
61495 attempt to send mail can be calculated with this formula:
61496 </para>
61497 <literallayout class="monospaced">
61498         ln(peakrate/maxrate)
61499 </literallayout>
61500 </section>
61501 <section id="ratoptuniq">
61502 <title>Limiting the rate of different events</title>
61503 <para>
61504 <indexterm role="concept">
61505 <primary>rate limiting</primary>
61506 <secondary>counting unique events</secondary>
61507 </indexterm>
61508 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
61509 rate of different events. For example, the <option>per_addr</option> option uses this
61510 mechanism to count the number of different recipients that the client has
61511 sent messages to in the last time period; it is equivalent to
61512 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
61513 measure the rate that a client uses different sender addresses with the
61514 options <literal>per_mail/unique=$sender_address</literal>.
61515 </para>
61516 <para>
61517 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
61518 has seen for that key. The whole set is thrown away when it is older than the
61519 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
61520 per period. In the <option>leaky</option> update mode, an event that causes the client to
61521 go over the limit is not added to the set, in the same way that the client&#x2019;s
61522 recorded rate is not updated in the same situation.
61523 </para>
61524 <para>
61525 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
61526 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
61527 rate.
61528 </para>
61529 <para>
61530 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
61531 other <option>ratelimit</option> options in order to store the event set. The number of
61532 unique values is potentially as large as the rate limit, so the extra space
61533 required increases with larger limits.
61534 </para>
61535 <para>
61536 The uniqueification is not perfect: there is a small probability that Exim
61537 will think a new event has happened before. If the sender&#x2019;s rate is less than
61538 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
61539 the measured rate can go above the limit, in which case Exim may under-count
61540 events by a significant margin. Fortunately, if the rate is high enough (2.7
61541 times the limit) that the false positive rate goes above 9%, then Exim will
61542 throw away the over-full event set before the measured rate falls below the
61543 limit. Therefore the only harm should be that exceptionally high sending rates
61544 are logged incorrectly; any countermeasures you configure will be as effective
61545 as intended.
61546 </para>
61547 </section>
61548 <section id="useratlim">
61549 <title>Using rate limiting</title>
61550 <para>
61551 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
61552 when the rate limit is exceeded. This might be anything from logging a warning
61553 (for example, while measuring existing sending rates in order to define
61554 policy), through time delays to slow down fast senders, up to rejecting the
61555 message. For example:
61556 </para>
61557 <literallayout class="monospaced">
61558 # Log all senders' rates
61559 warn ratelimit = 0 / 1h / strict
61560      log_message = Sender rate $sender_rate / $sender_rate_period
61561
61562 # Slow down fast senders; note the need to truncate $sender_rate
61563 # at the decimal point.
61564 warn ratelimit = 100 / 1h / per_rcpt / strict
61565      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
61566                    $sender_rate_limit }s
61567
61568 # Keep authenticated users under control
61569 deny authenticated = *
61570      ratelimit = 100 / 1d / strict / $authenticated_id
61571
61572 # System-wide rate limit
61573 defer ratelimit = 10 / 1s / $primary_hostname
61574       message = Sorry, too busy. Try again later.
61575
61576 # Restrict incoming rate from each host, with a default
61577 # set using a macro and special cases looked up in a table.
61578 defer ratelimit = ${lookup {$sender_host_address} \
61579                    cdb {DB/ratelimits.cdb} \
61580                    {$value} {RATELIMIT} }
61581       message = Sender rate exceeds $sender_rate_limit \
61582                messages per $sender_rate_period
61583 </literallayout>
61584 <para>
61585 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
61586 especially with the <option>per_rcpt</option> option, you may suffer from a performance
61587 bottleneck caused by locking on the ratelimit hints database. Apart from
61588 making your ACLs less complicated, you can reduce the problem by using a
61589 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
61590 this means that Exim will lose its hints data after a reboot (including retry
61591 hints, the callout cache, and ratelimit data).
61592 </para>
61593 </section>
61594 <section id="SECTaddressverification">
61595 <title>Address verification</title>
61596 <para>
61597 <indexterm role="concept">
61598 <primary>verifying address</primary>
61599 <secondary>options for</secondary>
61600 </indexterm>
61601 <indexterm role="concept">
61602 <primary>policy control</primary>
61603 <secondary>address verification</secondary>
61604 </indexterm>
61605 Several of the <option>verify</option> conditions described in section
61606 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
61607 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
61608 The verification conditions can be followed by options that modify the
61609 verification process. The options are separated from the keyword and from each
61610 other by slashes, and some of them contain parameters. For example:
61611 </para>
61612 <literallayout class="monospaced">
61613 verify = sender/callout
61614 verify = recipient/defer_ok/callout=10s,defer_ok
61615 </literallayout>
61616 <para>
61617 The first stage of address verification, which always happens, is to run the
61618 address through the routers, in <quote>verify mode</quote>. Routers can detect the
61619 difference between verification and routing for delivery, and their actions can
61620 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
61621 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
61622 The available options are as follows:
61623 </para>
61624 <itemizedlist>
61625 <listitem>
61626 <para>
61627 If the <option>callout</option> option is specified, successful routing to one or more
61628 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
61629 check. Callouts and their sub-options are discussed in the next section.
61630 </para>
61631 </listitem>
61632 <listitem>
61633 <para>
61634 If there is a defer error while doing verification routing, the ACL
61635 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
61636 options, the condition is forced to be true instead. Note that this is a main
61637 verification option as well as a suboption for callouts.
61638 </para>
61639 </listitem>
61640 <listitem>
61641 <para>
61642 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
61643 discusses the reporting of sender address verification failures.
61644 </para>
61645 </listitem>
61646 <listitem>
61647 <para>
61648 The <option>success_on_redirect</option> option causes verification always to succeed
61649 immediately after a successful redirection. By default, if a redirection
61650 generates just one address, that address is also verified. See further
61651 discussion in section <xref linkend="SECTredirwhilveri"/>.
61652 </para>
61653 </listitem>
61654 </itemizedlist>
61655 <para>
61656 <indexterm role="concept">
61657 <primary>verifying address</primary>
61658 <secondary>differentiating failures</secondary>
61659 </indexterm>
61660 <indexterm role="variable">
61661 <primary><varname>$recipient_verify_failure</varname></primary>
61662 </indexterm>
61663 <indexterm role="variable">
61664 <primary><varname>$sender_verify_failure</varname></primary>
61665 </indexterm>
61666 <indexterm role="variable">
61667 <primary><varname>$acl_verify_message</varname></primary>
61668 </indexterm>
61669 After an address verification failure, <varname>$acl_verify_message</varname> contains the
61670 error message that is associated with the failure. It can be preserved by
61671 coding like this:
61672 </para>
61673 <literallayout class="monospaced">
61674 warn  !verify = sender
61675        set acl_m0 = $acl_verify_message
61676 </literallayout>
61677 <para>
61678 If you are writing your own custom rejection message or log message when
61679 denying access, you can use this variable to include information about the
61680 verification failure.
61681 </para>
61682 <para>
61683 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
61684 appropriate) contains one of the following words:
61685 </para>
61686 <itemizedlist>
61687 <listitem>
61688 <para>
61689 <option>qualify</option>: The address was unqualified (no domain), and the message
61690 was neither local nor came from an exempted host.
61691 </para>
61692 </listitem>
61693 <listitem>
61694 <para>
61695 <option>route</option>: Routing failed.
61696 </para>
61697 </listitem>
61698 <listitem>
61699 <para>
61700 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
61701 occurred at or before the MAIL command (that is, on initial
61702 connection, HELO, or MAIL).
61703 </para>
61704 </listitem>
61705 <listitem>
61706 <para>
61707 <option>recipient</option>: The RCPT command in a callout was rejected.
61708 </para>
61709 </listitem>
61710 <listitem>
61711 <para>
61712 <option>postmaster</option>: The postmaster check in a callout was rejected.
61713 </para>
61714 </listitem>
61715 </itemizedlist>
61716 <para>
61717 The main use of these variables is expected to be to distinguish between
61718 rejections of MAIL and rejections of RCPT in callouts.
61719 </para>
61720 <para>
61721 The above variables may also be set after a <emphasis role="bold">successful</emphasis>
61722 address verification to:
61723 </para>
61724 <itemizedlist>
61725 <listitem>
61726 <para>
61727 <option>random</option>: A random local-part callout succeeded
61728 </para>
61729 </listitem>
61730 </itemizedlist>
61731 </section>
61732 <section id="SECTcallver">
61733 <title>Callout verification</title>
61734 <para>
61735 <indexterm role="concept">
61736 <primary>verifying address</primary>
61737 <secondary>by callout</secondary>
61738 </indexterm>
61739 <indexterm role="concept">
61740 <primary>callout</primary>
61741 <secondary>verification</secondary>
61742 </indexterm>
61743 <indexterm role="concept">
61744 <primary>SMTP</primary>
61745 <secondary>callout verification</secondary>
61746 </indexterm>
61747 For non-local addresses, routing verifies the domain, but is unable to do any
61748 checking of the local part. There are situations where some means of verifying
61749 the local part is desirable. One way this can be done is to make an SMTP
61750 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
61751 a subsequent host for a recipient address, to see if the host accepts the
61752 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
61753 sender address, the callback is not to the client host that is trying to
61754 deliver the message, but to one of the hosts that accepts incoming mail for the
61755 sender&#x2019;s domain.
61756 </para>
61757 <para>
61758 Exim does not do callouts by default. If you want them to happen, you must
61759 request them by setting appropriate options on the <option>verify</option> condition, as
61760 described below. This facility should be used with care, because it can add a
61761 lot of resource usage to the cost of verifying an address. However, Exim does
61762 cache the results of callouts, which helps to reduce the cost. Details of
61763 caching are in section <xref linkend="SECTcallvercache"/>.
61764 </para>
61765 <para>
61766 Recipient callouts are usually used only between hosts that are controlled by
61767 the same administration. For example, a corporate gateway host could use
61768 callouts to check for valid recipients on an internal mailserver. A successful
61769 callout does not guarantee that a real delivery to the address would succeed;
61770 on the other hand, a failing callout does guarantee that a delivery would fail.
61771 </para>
61772 <para>
61773 If the <option>callout</option> option is present on a condition that verifies an address, a
61774 second stage of verification occurs if the address is successfully routed to
61775 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
61776 <command>manualroute</command> router, where the router specifies the hosts. However, if a
61777 router that does not set up hosts routes to an <command>smtp</command> transport with a
61778 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
61779 <option>hosts_override</option> set, its hosts are always used, whether or not the router
61780 supplies a host list.
61781 Callouts are only supported on <command>smtp</command> transports.
61782 </para>
61783 <para>
61784 The port that is used is taken from the transport, if it is specified and is a
61785 remote transport. (For routers that do verification only, no transport need be
61786 specified.) Otherwise, the default SMTP port is used. If a remote transport
61787 specifies an outgoing interface, this is used; otherwise the interface is not
61788 specified. Likewise, the text that is used for the HELO command is taken from
61789 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
61790 <varname>$smtp_active_hostname</varname> is used.
61791 </para>
61792 <para>
61793 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
61794 test whether a bounce message could be delivered to the sender address. The
61795 following SMTP commands are sent:
61796 </para>
61797 <literallayout>
61798 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
61799 <literal>MAIL FROM:&lt;&gt;</literal>
61800 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
61801 <literal>QUIT</literal>
61802 </literallayout>
61803 <para>
61804 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
61805 set to <quote>lmtp</quote>.
61806 </para>
61807 <para>
61808 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
61809 settings.
61810 </para>
61811 <para>
61812 A recipient callout check is similar. By default, it also uses an empty address
61813 for the sender. This default is chosen because most hosts do not make use of
61814 the sender address when verifying a recipient. Using the same address means
61815 that a single cache entry can be used for each recipient. Some sites, however,
61816 do make use of the sender address when verifying. These are catered for by the
61817 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
61818 </para>
61819 <para>
61820 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
61821 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
61822 Exim tries the next host, if any. If there is a problem with all the remote
61823 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
61824 <option>callout</option> option is given, in which case the condition is forced to succeed.
61825 </para>
61826 <para>
61827 <indexterm role="concept">
61828 <primary>SMTP</primary>
61829 <secondary>output flushing, disabling for callout</secondary>
61830 </indexterm>
61831 A callout may take a little time. For this reason, Exim normally flushes SMTP
61832 output before performing a callout in an ACL, to avoid unexpected timeouts in
61833 clients when the SMTP PIPELINING extension is in use. The flushing can be
61834 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
61835 </para>
61836 </section>
61837 <section id="CALLaddparcall">
61838 <title>Additional parameters for callouts</title>
61839 <para>
61840 <indexterm role="concept">
61841 <primary>callout</primary>
61842 <secondary>additional parameters for</secondary>
61843 </indexterm>
61844 The <option>callout</option> option can be followed by an equals sign and a number of
61845 optional parameters, separated by commas. For example:
61846 </para>
61847 <literallayout class="monospaced">
61848 verify = recipient/callout=10s,defer_ok
61849 </literallayout>
61850 <para>
61851 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
61852 separate verify options, is retained for backwards compatibility, but is now
61853 deprecated. The additional parameters for <option>callout</option> are as follows:
61854 </para>
61855 <variablelist>
61856 <varlistentry>
61857 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
61858 <listitem>
61859 <para>
61860 <indexterm role="concept">
61861 <primary>callout</primary>
61862 <secondary>timeout, specifying</secondary>
61863 </indexterm>
61864 This specifies the timeout that applies for the callout attempt to each host.
61865 For example:
61866 </para>
61867 <literallayout class="monospaced">
61868 verify = sender/callout=5s
61869 </literallayout>
61870 <para>
61871 The default is 30 seconds. The timeout is used for each response from the
61872 remote host. It is also used for the initial connection, unless overridden by
61873 the <option>connect</option> parameter.
61874 </para>
61875 </listitem></varlistentry>
61876 <varlistentry>
61877 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
61878 <listitem>
61879 <para>
61880 <indexterm role="concept">
61881 <primary>callout</primary>
61882 <secondary>connection timeout, specifying</secondary>
61883 </indexterm>
61884 This parameter makes it possible to set a different (usually smaller) timeout
61885 for making the SMTP connection. For example:
61886 </para>
61887 <literallayout class="monospaced">
61888 verify = sender/callout=5s,connect=1s
61889 </literallayout>
61890 <para>
61891 If not specified, this timeout defaults to the general timeout value.
61892 </para>
61893 </listitem></varlistentry>
61894 <varlistentry>
61895 <term><emphasis role="bold">defer_ok</emphasis></term>
61896 <listitem>
61897 <para>
61898 <indexterm role="concept">
61899 <primary>callout</primary>
61900 <secondary>defer, action on</secondary>
61901 </indexterm>
61902 When this parameter is present, failure to contact any host, or any other kind
61903 of temporary error, is treated as success by the ACL. However, the cache is not
61904 updated in this circumstance.
61905 </para>
61906 </listitem></varlistentry>
61907 <varlistentry>
61908 <term><emphasis role="bold">fullpostmaster</emphasis></term>
61909 <listitem>
61910 <para>
61911 <indexterm role="concept">
61912 <primary>callout</primary>
61913 <secondary>full postmaster check</secondary>
61914 </indexterm>
61915 This operates like the <option>postmaster</option> option (see below), but if the check for
61916 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
61917 accordance with the specification in RFC 2821. The RFC states that the
61918 unqualified address <emphasis>postmaster</emphasis> should be accepted.
61919 </para>
61920 </listitem></varlistentry>
61921 <varlistentry>
61922 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
61923 <listitem>
61924 <para>
61925 <indexterm role="concept">
61926 <primary>callout</primary>
61927 <secondary>sender when verifying header</secondary>
61928 </indexterm>
61929 When verifying addresses in header lines using the <option>header_sender</option>
61930 verification option, Exim behaves by default as if the addresses are envelope
61931 sender addresses from a message. Callout verification therefore tests to see
61932 whether a bounce message could be delivered, by using an empty address in the
61933 MAIL command. However, it is arguable that these addresses might never be used
61934 as envelope senders, and could therefore justifiably reject bounce messages
61935 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
61936 address to use in the MAIL command. For example:
61937 </para>
61938 <literallayout class="monospaced">
61939 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
61940 </literallayout>
61941 <para>
61942 This parameter is available only for the <option>header_sender</option> verification option.
61943 </para>
61944 </listitem></varlistentry>
61945 <varlistentry>
61946 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
61947 <listitem>
61948 <para>
61949 <indexterm role="concept">
61950 <primary>callout</primary>
61951 <secondary>overall timeout, specifying</secondary>
61952 </indexterm>
61953 This parameter sets an overall timeout for performing a callout verification.
61954 For example:
61955 </para>
61956 <literallayout class="monospaced">
61957 verify = sender/callout=5s,maxwait=30s
61958 </literallayout>
61959 <para>
61960 This timeout defaults to four times the callout timeout for individual SMTP
61961 commands. The overall timeout applies when there is more than one host that can
61962 be tried. The timeout is checked before trying the next host. This prevents
61963 very long delays if there are a large number of hosts and all are timing out
61964 (for example, when network connections are timing out).
61965 </para>
61966 </listitem></varlistentry>
61967 <varlistentry>
61968 <term><emphasis role="bold">no_cache</emphasis></term>
61969 <listitem>
61970 <para>
61971 <indexterm role="concept">
61972 <primary>callout</primary>
61973 <secondary>cache, suppressing</secondary>
61974 </indexterm>
61975 <indexterm role="concept">
61976 <primary>caching callout, suppressing</primary>
61977 </indexterm>
61978 When this parameter is given, the callout cache is neither read nor updated.
61979 </para>
61980 </listitem></varlistentry>
61981 <varlistentry>
61982 <term><emphasis role="bold">postmaster</emphasis></term>
61983 <listitem>
61984 <para>
61985 <indexterm role="concept">
61986 <primary>callout</primary>
61987 <secondary>postmaster; checking</secondary>
61988 </indexterm>
61989 When this parameter is set, a successful callout check is followed by a similar
61990 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
61991 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
61992 the postmaster check is recorded in a cache record; if it is a failure, this is
61993 used to fail subsequent callouts for the domain without a connection being
61994 made, until the cache record expires.
61995 </para>
61996 </listitem></varlistentry>
61997 <varlistentry>
61998 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
61999 <listitem>
62000 <para>
62001 The postmaster check uses an empty sender in the MAIL command by default.
62002 You can use this parameter to do a postmaster check using a different address.
62003 For example:
62004 </para>
62005 <literallayout class="monospaced">
62006 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
62007 </literallayout>
62008 <para>
62009 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
62010 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
62011 </para>
62012 <literallayout class="monospaced">
62013 require  verify = sender/callout=postmaster_mailfrom=
62014 </literallayout>
62015 <para>
62016 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
62017 account of the sender address. It is assumed that either the empty address or
62018 a fixed non-empty address will be used. All that Exim remembers is that the
62019 postmaster check for the domain succeeded or failed.
62020 </para>
62021 </listitem></varlistentry>
62022 <varlistentry>
62023 <term><emphasis role="bold">random</emphasis></term>
62024 <listitem>
62025 <para>
62026 <indexterm role="concept">
62027 <primary>callout</primary>
62028 <secondary><quote>random</quote> check</secondary>
62029 </indexterm>
62030 When this parameter is set, before doing the normal callout check, Exim does a
62031 check for a <quote>random</quote> local part at the same domain. The local part is not
62032 really random &ndash; it is defined by the expansion of the option
62033 <option>callout_random_local_part</option>, which defaults to
62034 </para>
62035 <literallayout class="monospaced">
62036 $primary_hostname-$tod_epoch-testing
62037 </literallayout>
62038 <para>
62039 The idea here is to try to determine whether the remote host accepts all local
62040 parts without checking. If it does, there is no point in doing callouts for
62041 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
62042 a cache record, and used to force the current and subsequent callout checks to
62043 succeed without a connection being made, until the cache record expires.
62044 </para>
62045 </listitem></varlistentry>
62046 <varlistentry>
62047 <term><emphasis role="bold">use_postmaster</emphasis></term>
62048 <listitem>
62049 <para>
62050 <indexterm role="concept">
62051 <primary>callout</primary>
62052 <secondary>sender for recipient check</secondary>
62053 </indexterm>
62054 This parameter applies to recipient callouts only. For example:
62055 </para>
62056 <literallayout class="monospaced">
62057 deny  !verify = recipient/callout=use_postmaster
62058 </literallayout>
62059 <para>
62060 <indexterm role="variable">
62061 <primary><varname>$qualify_domain</varname></primary>
62062 </indexterm>
62063 It causes a non-empty postmaster address to be used in the MAIL command when
62064 performing the callout for the recipient, and also for a <quote>random</quote> check if
62065 that is configured. The local part of the address is <literal>postmaster</literal> and the
62066 domain is the contents of <varname>$qualify_domain</varname>.
62067 </para>
62068 </listitem></varlistentry>
62069 <varlistentry>
62070 <term><emphasis role="bold">use_sender</emphasis></term>
62071 <listitem>
62072 <para>
62073 This option applies to recipient callouts only. For example:
62074 </para>
62075 <literallayout class="monospaced">
62076 require  verify = recipient/callout=use_sender
62077 </literallayout>
62078 <para>
62079 It causes the message&#x2019;s actual sender address to be used in the MAIL
62080 command when performing the callout, instead of an empty address. There is no
62081 need to use this option unless you know that the called hosts make use of the
62082 sender when checking recipients. If used indiscriminately, it reduces the
62083 usefulness of callout caching.
62084 </para>
62085 </listitem></varlistentry>
62086 <varlistentry>
62087 <term><emphasis role="bold">hold</emphasis></term>
62088 <listitem>
62089 <para>
62090 This option applies to recipient callouts only. For example:
62091 </para>
62092 <literallayout class="monospaced">
62093 require  verify = recipient/callout=use_sender,hold
62094 </literallayout>
62095 <para>
62096 It causes the connection to be held open and used for any further recipients
62097 and for eventual delivery (should that be done quickly).
62098 Doing this saves on TCP and SMTP startup costs, and TLS costs also
62099 when that is used for the connections.
62100 The advantage is only gained if there are no callout cache hits
62101 (which could be enforced by the no_cache option),
62102 if the use_sender option is used,
62103 if neither the random nor the use_postmaster option is used,
62104 and if no other callouts intervene.
62105 </para>
62106 </listitem></varlistentry>
62107 </variablelist>
62108 <para>
62109 If you use any of the parameters that set a non-empty sender for the MAIL
62110 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
62111 <option>use_sender</option>), you should think about possible loops. Recipient checking is
62112 usually done between two hosts that are under the same management, and the host
62113 that receives the callouts is not normally configured to do callouts itself.
62114 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
62115 these circumstances.
62116 </para>
62117 <para>
62118 However, if you use a non-empty sender address for a callout to an arbitrary
62119 host, there is the likelihood that the remote host will itself initiate a
62120 callout check back to your host. As it is checking what appears to be a message
62121 sender, it is likely to use an empty address in MAIL, thus avoiding a
62122 callout loop. However, to be on the safe side it would be best to set up your
62123 own ACLs so that they do not do sender verification checks when the recipient
62124 is the address you use for header sender or postmaster callout checking.
62125 </para>
62126 <para>
62127 Another issue to think about when using non-empty senders for callouts is
62128 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
62129 by the sender/recipient combination; thus, for any given recipient, many more
62130 actual callouts are performed than when an empty sender or postmaster is used.
62131 </para>
62132 </section>
62133 <section id="SECTcallvercache">
62134 <title>Callout caching</title>
62135 <para>
62136 <indexterm role="concept">
62137 <primary>hints database</primary>
62138 <secondary>callout cache</secondary>
62139 </indexterm>
62140 <indexterm role="concept">
62141 <primary>callout</primary>
62142 <secondary>cache, description of</secondary>
62143 </indexterm>
62144 <indexterm role="concept">
62145 <primary>caching</primary>
62146 <secondary>callout</secondary>
62147 </indexterm>
62148 Exim caches the results of callouts in order to reduce the amount of resources
62149 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
62150 option. A hints database called <quote>callout</quote> is used for the cache. Two
62151 different record types are used: one records the result of a callout check for
62152 a specific address, and the other records information that applies to the
62153 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
62154 </para>
62155 <para>
62156 When an original callout fails, a detailed SMTP error message is given about
62157 the failure. However, for subsequent failures use the cache data, this message
62158 is not available.
62159 </para>
62160 <para>
62161 The expiry times for negative and positive address cache records are
62162 independent, and can be set by the global options <option>callout_negative_expire</option>
62163 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
62164 </para>
62165 <para>
62166 If a host gives a negative response to an SMTP connection, or rejects any
62167 commands up to and including
62168 </para>
62169 <literallayout class="monospaced">
62170 MAIL FROM:&lt;&gt;
62171 </literallayout>
62172 <para>
62173 (but not including the MAIL command with a non-empty address),
62174 any callout attempt is bound to fail. Exim remembers such failures in a
62175 domain cache record, which it uses to fail callouts for the domain without
62176 making new connections, until the domain record times out. There are two
62177 separate expiry times for domain cache records:
62178 <option>callout_domain_negative_expire</option> (default 3h) and
62179 <option>callout_domain_positive_expire</option> (default 7d).
62180 </para>
62181 <para>
62182 Domain records expire when the negative expiry time is reached if callouts
62183 cannot be made for the domain, or if the postmaster check failed.
62184 Otherwise, they expire when the positive expiry time is reached. This
62185 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
62186 will eventually be noticed.
62187 </para>
62188 <para>
62189 The callout caching mechanism is based on the domain of the address that is
62190 being tested. If the domain routes to several hosts, it is assumed that their
62191 behaviour will be the same.
62192 </para>
62193 </section>
62194 <section id="SECTsenaddver">
62195 <title>Sender address verification reporting</title>
62196 <para>
62197 <indexterm role="concept">
62198 <primary>verifying</primary>
62199 <secondary>suppressing error details</secondary>
62200 </indexterm>
62201 See section <xref linkend="SECTaddressverification"/> for a general discussion of
62202 verification. When sender verification fails in an ACL, the details of the
62203 failure are given as additional output lines before the 550 response to the
62204 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
62205 you might see:
62206 </para>
62207 <literallayout class="monospaced">
62208 MAIL FROM:&lt;xyz@abc.example&gt;
62209 250 OK
62210 RCPT TO:&lt;pqr@def.example&gt;
62211 550-Verification failed for &lt;xyz@abc.example&gt;
62212 550-Called:   192.168.34.43
62213 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
62214 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
62215 550 Sender verification failed
62216 </literallayout>
62217 <para>
62218 If more than one RCPT command fails in the same way, the details are given
62219 only for the first of them. However, some administrators do not want to send
62220 out this much information. You can suppress the details by adding
62221 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
62222 example:
62223 </para>
62224 <literallayout class="monospaced">
62225 verify = sender/no_details
62226 </literallayout>
62227 </section>
62228 <section id="SECTredirwhilveri">
62229 <title>Redirection while verifying</title>
62230 <para>
62231 <indexterm role="concept">
62232 <primary>verifying</primary>
62233 <secondary>redirection while</secondary>
62234 </indexterm>
62235 <indexterm role="concept">
62236 <primary>address redirection</primary>
62237 <secondary>while verifying</secondary>
62238 </indexterm>
62239 A dilemma arises when a local address is redirected by aliasing or forwarding
62240 during verification: should the generated addresses themselves be verified,
62241 or should the successful expansion of the original address be enough to verify
62242 it? By default, Exim takes the following pragmatic approach:
62243 </para>
62244 <itemizedlist>
62245 <listitem>
62246 <para>
62247 When an incoming address is redirected to just one child address, verification
62248 continues with the child address, and if that fails to verify, the original
62249 verification also fails.
62250 </para>
62251 </listitem>
62252 <listitem>
62253 <para>
62254 When an incoming address is redirected to more than one child address,
62255 verification does not continue. A success result is returned.
62256 </para>
62257 </listitem>
62258 </itemizedlist>
62259 <para>
62260 This seems the most reasonable behaviour for the common use of aliasing as a
62261 way of redirecting different local parts to the same mailbox. It means, for
62262 example, that a pair of alias entries of the form
62263 </para>
62264 <literallayout class="monospaced">
62265 A.Wol:   aw123
62266 aw123:   :fail: Gone away, no forwarding address
62267 </literallayout>
62268 <para>
62269 work as expected, with both local parts causing verification failure. When a
62270 redirection generates more than one address, the behaviour is more like a
62271 mailing list, where the existence of the alias itself is sufficient for
62272 verification to succeed.
62273 </para>
62274 <para>
62275 It is possible, however, to change the default behaviour so that all successful
62276 redirections count as successful verifications, however many new addresses are
62277 generated. This is specified by the <option>success_on_redirect</option> verification
62278 option. For example:
62279 </para>
62280 <literallayout class="monospaced">
62281 require verify = recipient/success_on_redirect/callout=10s
62282 </literallayout>
62283 <para>
62284 In this example, verification succeeds if a router generates a new address, and
62285 the callout does not occur, because no address was routed to a remote host.
62286 </para>
62287 <para>
62288 When verification is being tested via the <option>-bv</option> option, the treatment of
62289 redirections is as just described, unless the <option>-v</option> or any debugging option is
62290 also specified. In that case, full verification is done for every generated
62291 address and a report is output for each of them.
62292 </para>
62293 </section>
62294 <section id="SECTverifyCSA">
62295 <title>Client SMTP authorization (CSA)</title>
62296 <para>
62297 <indexterm role="concept">
62298 <primary>CSA</primary>
62299 <secondary>verifying</secondary>
62300 </indexterm>
62301 Client SMTP Authorization is a system that allows a site to advertise
62302 which machines are and are not permitted to send email. This is done by placing
62303 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
62304 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
62305 Authorization checks in Exim are performed by the ACL condition:
62306 </para>
62307 <literallayout class="monospaced">
62308 verify = csa
62309 </literallayout>
62310 <para>
62311 This fails if the client is not authorized. If there is a DNS problem, or if no
62312 valid CSA SRV record is found, or if the client is authorized, the condition
62313 succeeds. These three cases can be distinguished using the expansion variable
62314 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
62315 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
62316 be likely to cause problems for legitimate email.
62317 </para>
62318 <para>
62319 The error messages produced by the CSA code include slightly more
62320 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
62321 looking up the CSA SRV record, or problems looking up the CSA target
62322 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
62323 </para>
62324 <itemizedlist>
62325 <listitem>
62326 <para>
62327 The client&#x2019;s host name is explicitly not authorized.
62328 </para>
62329 </listitem>
62330 <listitem>
62331 <para>
62332 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
62333 </para>
62334 </listitem>
62335 <listitem>
62336 <para>
62337 The client&#x2019;s host name is authorized but it has no valid target IP addresses
62338 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
62339 </para>
62340 </listitem>
62341 <listitem>
62342 <para>
62343 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
62344 that all subdomains must be explicitly authorized.
62345 </para>
62346 </listitem>
62347 </itemizedlist>
62348 <para>
62349 The <option>csa</option> verification condition can take an argument which is the domain to
62350 use for the DNS query. The default is:
62351 </para>
62352 <literallayout class="monospaced">
62353 verify = csa/$sender_helo_name
62354 </literallayout>
62355 <para>
62356 This implementation includes an extension to CSA. If the query domain
62357 is an address literal such as [192.0.2.95], or if it is a bare IP
62358 address, Exim searches for CSA SRV records in the reverse DNS as if
62359 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
62360 meaningful to say:
62361 </para>
62362 <literallayout class="monospaced">
62363 verify = csa/$sender_host_address
62364 </literallayout>
62365 <para>
62366 In fact, this is the check that Exim performs if the client does not say HELO.
62367 This extension can be turned off by setting the main configuration option
62368 <option>dns_csa_use_reverse</option> to be false.
62369 </para>
62370 <para>
62371 If a CSA SRV record is not found for the domain itself, a search
62372 is performed through its parent domains for a record which might be
62373 making assertions about subdomains. The maximum depth of this search is limited
62374 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
62375 default. Exim does not look for CSA SRV records in a top level domain, so the
62376 default settings handle HELO domains as long as seven
62377 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
62378 of legitimate HELO domains.
62379 </para>
62380 <para>
62381 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
62382 direct SRV lookups, this is not sufficient because of the extra parent domain
62383 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
62384 addresses into lookups in the reverse DNS space. The result of a successful
62385 lookup such as:
62386 </para>
62387 <literallayout class="monospaced">
62388 ${lookup dnsdb {csa=$sender_helo_name}}
62389 </literallayout>
62390 <para>
62391 has two space-separated fields: an authorization code and a target host name.
62392 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
62393 authorization required but absent, or <quote>?</quote> for unknown.
62394 </para>
62395 </section>
62396 <section id="SECTverifyPRVS">
62397 <title>Bounce address tag validation</title>
62398 <para>
62399 <indexterm role="concept">
62400 <primary>BATV, verifying</primary>
62401 </indexterm>
62402 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
62403 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
62404 Genuine incoming bounce messages should therefore always be addressed to
62405 recipients that have a valid tag. This scheme is a way of detecting unwanted
62406 bounce messages caused by sender address forgeries (often called <quote>collateral
62407 spam</quote>), because the recipients of such messages do not include valid tags.
62408 </para>
62409 <para>
62410 There are two expansion items to help with the implementation of the BATV
62411 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
62412 the original envelope sender address by using a simple key to add a hash of the
62413 address and some time-based randomizing information. The <option>prvs</option> expansion
62414 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
62415 The syntax of these expansion items is described in section
62416 <xref linkend="SECTexpansionitems"/>.
62417 The validity period on signed addresses is seven days.
62418 </para>
62419 <para>
62420 As an example, suppose the secret per-address keys are stored in an MySQL
62421 database. A query to look up the key for an address could be defined as a macro
62422 like this:
62423 </para>
62424 <literallayout class="monospaced">
62425 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
62426                 WHERE sender='${quote_mysql:$prvscheck_address}'\
62427                 }{$value}}
62428 </literallayout>
62429 <para>
62430 Suppose also that the senders who make use of BATV are defined by an address
62431 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
62432 use this:
62433 </para>
62434 <literallayout class="monospaced">
62435 # Bounces: drop unsigned addresses for BATV senders
62436 deny senders = :
62437      recipients = +batv_senders
62438      message = This address does not send an unsigned reverse path
62439
62440 # Bounces: In case of prvs-signed address, check signature.
62441 deny senders = :
62442      condition  = ${prvscheck {$local_part@$domain}\
62443                   {PRVSCHECK_SQL}{1}}
62444      !condition = $prvscheck_result
62445      message = Invalid reverse path signature.
62446 </literallayout>
62447 <para>
62448 The first statement rejects recipients for bounce messages that are addressed
62449 to plain BATV sender addresses, because it is known that BATV senders do not
62450 send out messages with plain sender addresses. The second statement rejects
62451 recipients that are prvs-signed, but with invalid signatures (either because
62452 the key is wrong, or the signature has timed out).
62453 </para>
62454 <para>
62455 A non-prvs-signed address is not rejected by the second statement, because the
62456 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
62457 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
62458 the first argument is a syntactically valid prvs-signed address, the yield is
62459 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
62460 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
62461 of the checks (empty for failure, <quote>1</quote> for success).
62462 </para>
62463 <para>
62464 There is one more issue you must consider when implementing prvs-signing:
62465 you have to ensure that the routers accept prvs-signed addresses and
62466 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
62467 router to remove the signature with a configuration along these lines:
62468 </para>
62469 <literallayout class="monospaced">
62470 batv_redirect:
62471   driver = redirect
62472   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
62473 </literallayout>
62474 <para>
62475 This works because, if the third argument of <option>prvscheck</option> is empty, the result
62476 of the expansion of a prvs-signed address is the decoded value of the original
62477 address. This router should probably be the first of your routers that handles
62478 local addresses.
62479 </para>
62480 <para>
62481 To create BATV-signed addresses in the first place, a transport of this form
62482 can be used:
62483 </para>
62484 <literallayout class="monospaced">
62485 external_smtp_batv:
62486   driver = smtp
62487   return_path = ${prvs {$return_path} \
62488                        {${lookup mysql{SELECT \
62489                        secret FROM batv_prvs WHERE \
62490                        sender='${quote_mysql:$sender_address}'} \
62491                        {$value}fail}}}
62492 </literallayout>
62493 <para>
62494 If no key can be found for the existing return path, no signing takes place.
62495 </para>
62496 </section>
62497 <section id="SECTrelaycontrol">
62498 <title>Using an ACL to control relaying</title>
62499 <para>
62500 <indexterm role="concept">
62501 <primary>access control lists (ACLs)</primary>
62502 <secondary>relay control</secondary>
62503 </indexterm>
62504 <indexterm role="concept">
62505 <primary>relaying</primary>
62506 <secondary>control by ACL</secondary>
62507 </indexterm>
62508 <indexterm role="concept">
62509 <primary>policy control</primary>
62510 <secondary>relay control</secondary>
62511 </indexterm>
62512 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
62513 delivers it directly to another host as a result of a remote address contained
62514 within it. Redirecting a local address via an alias or forward file and then
62515 passing the message on to another host is not relaying,
62516 <indexterm role="concept">
62517 <primary><quote>percent hack</quote></primary>
62518 </indexterm>
62519 but a redirection as a result of the <quote>percent hack</quote> is.
62520 </para>
62521 <para>
62522 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
62523 A host which is acting as a gateway or an MX backup is concerned with incoming
62524 relaying from arbitrary hosts to a specific set of domains. On the other hand,
62525 a host which is acting as a smart host for a number of clients is concerned
62526 with outgoing relaying from those clients to the Internet at large. Often the
62527 same host is fulfilling both functions,
62528 but in principle these two kinds of relaying are entirely independent. What is
62529 not wanted is the transmission of mail from arbitrary remote hosts through your
62530 system to arbitrary domains.
62531 </para>
62532 <para>
62533 You can implement relay control by means of suitable statements in the ACL that
62534 runs for each RCPT command. For convenience, it is often easiest to use
62535 Exim&#x2019;s named list facility to define the domains and hosts involved. For
62536 example, suppose you want to do the following:
62537 </para>
62538 <itemizedlist>
62539 <listitem>
62540 <para>
62541 Deliver a number of domains to mailboxes on the local host (or process them
62542 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
62543 <emphasis>my.dom2.example</emphasis>.
62544 </para>
62545 </listitem>
62546 <listitem>
62547 <para>
62548 Relay mail for a number of other domains for which you are the secondary MX.
62549 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
62550 </para>
62551 </listitem>
62552 <listitem>
62553 <para>
62554 Relay mail from the hosts on your local LAN, to whatever domains are involved.
62555 Suppose your LAN is 192.168.45.0/24.
62556 </para>
62557 </listitem>
62558 </itemizedlist>
62559 <para>
62560 In the main part of the configuration, you put the following definitions:
62561 </para>
62562 <literallayout class="monospaced">
62563 domainlist local_domains    = my.dom1.example : my.dom2.example
62564 domainlist relay_to_domains = friend1.example : friend2.example
62565 hostlist   relay_from_hosts = 192.168.45.0/24
62566 </literallayout>
62567 <para>
62568 Now you can use these definitions in the ACL that is run for every RCPT
62569 command:
62570 </para>
62571 <literallayout class="monospaced">
62572 acl_check_rcpt:
62573   accept domains = +local_domains : +relay_to_domains
62574   accept hosts   = +relay_from_hosts
62575 </literallayout>
62576 <para>
62577 The first statement accepts any RCPT command that contains an address in
62578 the local or relay domains. For any other domain, control passes to the second
62579 statement, which accepts the command only if it comes from one of the relay
62580 hosts. In practice, you will probably want to make your ACL more sophisticated
62581 than this, for example, by including sender and recipient verification. The
62582 default configuration includes a more comprehensive example, which is described
62583 in chapter <xref linkend="CHAPdefconfil"/>.
62584 </para>
62585 </section>
62586 <section id="SECTcheralcon">
62587 <title>Checking a relay configuration</title>
62588 <para>
62589 <indexterm role="concept">
62590 <primary>relaying</primary>
62591 <secondary>checking control of</secondary>
62592 </indexterm>
62593 You can check the relay characteristics of your configuration in the same way
62594 that you can test any ACL behaviour for an incoming SMTP connection, by using
62595 the <option>-bh</option> option to run a fake SMTP session with which you interact.
62596 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
62597 </para>
62598 </section>
62599 </chapter>
62600
62601 <chapter id="CHAPexiscan">
62602 <title>Content scanning at ACL time</title>
62603 <para>
62604 <indexterm role="concept" id="IIDcosca" class="startofrange">
62605 <primary>content scanning</primary>
62606 <secondary>at ACL time</secondary>
62607 </indexterm>
62608 The extension of Exim to include content scanning at ACL time, formerly known
62609 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
62610 was integrated into the main source for Exim release 4.50, and Tom continues to
62611 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
62612 specification.
62613 </para>
62614 <para>
62615 It is also possible to scan the content of messages at other times. The
62616 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
62617 scanning after all the ACLs have run. A transport filter can be used to scan
62618 messages at delivery time (see the <option>transport_filter</option> option, described in
62619 chapter <xref linkend="CHAPtransportgeneric"/>).
62620 </para>
62621 <para>
62622 If you want to include the ACL-time content-scanning features when you compile
62623 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
62624 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
62625 </para>
62626 <itemizedlist>
62627 <listitem>
62628 <para>
62629 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
62630 for all MIME parts for SMTP and non-SMTP messages, respectively.
62631 </para>
62632 </listitem>
62633 <listitem>
62634 <para>
62635 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
62636 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
62637 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
62638 </para>
62639 </listitem>
62640 <listitem>
62641 <para>
62642 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
62643 of messages, or parts of messages, for debugging purposes.
62644 </para>
62645 </listitem>
62646 <listitem>
62647 <para>
62648 Additional expansion variables that are set in the new ACL and by the new
62649 conditions.
62650 </para>
62651 </listitem>
62652 <listitem>
62653 <para>
62654 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
62655 </para>
62656 </listitem>
62657 </itemizedlist>
62658 <para>
62659 Content-scanning is continually evolving, and new features are still being
62660 added. While such features are still unstable and liable to incompatible
62661 changes, they are made available in Exim by setting options whose names begin
62662 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
62663 this manual. You can find out about them by reading the file called
62664 <filename>doc/experimental.txt</filename>.
62665 </para>
62666 <para>
62667 All the content-scanning facilities work on a MBOX copy of the message that is
62668 temporarily created in a file called:
62669 </para>
62670 <literallayout>
62671 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
62672 </literallayout>
62673 <para>
62674 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
62675 expect an MBOX-like structure inside that file. The file is created when the
62676 first content scanning facility is called. Subsequent calls to content
62677 scanning conditions open the same file again. The directory is recursively
62678 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
62679 </para>
62680 <literallayout class="monospaced">
62681 control = no_mbox_unspool
62682 </literallayout>
62683 <para>
62684 has been encountered. When the MIME ACL decodes files, they are put into the
62685 same directory by default.
62686 </para>
62687 <section id="SECTscanvirus">
62688 <title>Scanning for viruses</title>
62689 <para>
62690 <indexterm role="concept">
62691 <primary>virus scanning</primary>
62692 </indexterm>
62693 <indexterm role="concept">
62694 <primary>content scanning</primary>
62695 <secondary>for viruses</secondary>
62696 </indexterm>
62697 <indexterm role="concept">
62698 <primary>content scanning</primary>
62699 <secondary>the <option>malware</option> condition</secondary>
62700 </indexterm>
62701 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
62702 It supports a <quote>generic</quote> interface to scanners called via the shell, and
62703 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
62704 in memory and thus are much faster.
62705 </para>
62706 <para>
62707 Since message data needs to have arrived,
62708 the condition may be only called in ACL defined by
62709 <option>acl_smtp_data</option>,
62710 <option>acl_smtp_data_prdr</option>,
62711 <option>acl_smtp_mime</option> or
62712 <option>acl_smtp_dkim</option>
62713 </para>
62714 <para>
62715 A timeout of 2 minutes is applied to a scanner call (by default);
62716 if it expires then a defer action is taken.
62717 </para>
62718 <para>
62719 <indexterm role="option">
62720 <primary><option>av_scanner</option></primary>
62721 </indexterm>
62722 You can set the <option>av_scanner</option> option in the main part of the configuration
62723 to specify which scanner to use, together with any additional options that
62724 are needed. The basic syntax is as follows:
62725 </para>
62726 <literallayout>
62727 <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>
62728 </literallayout>
62729 <para>
62730 If you do not set <option>av_scanner</option>, it defaults to
62731 </para>
62732 <literallayout class="monospaced">
62733 av_scanner = sophie:/var/run/sophie
62734 </literallayout>
62735 <para>
62736 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
62737 before use.
62738 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
62739 The following scanner types are supported in this release,
62740 though individual ones can be included or not at build time:
62741 </para>
62742 <variablelist>
62743 <varlistentry>
62744 <term><option>avast</option></term>
62745 <listitem>
62746 <para>
62747 <indexterm role="concept">
62748 <primary>virus scanners</primary>
62749 <secondary>avast</secondary>
62750 </indexterm>
62751 This is the scanner daemon of Avast. It has been tested with Avast Core
62752 Security (currently at version 2.2.0).
62753 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
62754 at <emphasis role="bold"><ulink url="https://www.avast.com/linux-server-antivirus">https://www.avast.com/linux-server-antivirus</ulink></emphasis>.
62755 This scanner type takes one option,
62756 which can be either a full path to a UNIX socket,
62757 or host and port specifiers separated by white space.
62758 The host may be a name or an IP address; the port is either a
62759 single number or a pair of numbers with a dash between.
62760 A list of options may follow. These options are interpreted on the
62761 Exim&#x2019;s side of the malware scanner, or are given on separate lines to
62762 the daemon as options before the main scan command.
62763 </para>
62764 <para>
62765 <indexterm role="concept">
62766 <primary><literal>pass_unscanned</literal></primary>
62767 <secondary>avast</secondary>
62768 </indexterm>
62769 If <literal>pass_unscanned</literal>
62770 is set, any files the Avast scanner can&#x2019;t scan (e.g.
62771 decompression bombs, or invalid archives) are considered clean. Use with
62772 care.
62773 </para>
62774 <para>
62775 For example:
62776 </para>
62777 <literallayout class="monospaced">
62778 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
62779 av_scanner = avast:/var/run/avast/scan.sock:pass_unscanned:FLAGS -fullfiles:SENSITIVITY -pup
62780 av_scanner = avast:192.168.2.22 5036
62781 </literallayout>
62782 <para>
62783 If you omit the argument, the default path
62784 <filename>/var/run/avast/scan.sock</filename>
62785 is used.
62786 If you use a remote host,
62787 you need to make Exim&#x2019;s spool directory available to it,
62788 as the scanner is passed a file path, not file contents.
62789 For information about available commands and their options you may use
62790 </para>
62791 <literallayout class="monospaced">
62792 $ socat UNIX:/var/run/avast/scan.sock STDIO:
62793     FLAGS
62794     SENSITIVITY
62795     PACK
62796 </literallayout>
62797 <para>
62798 If the scanner returns a temporary failure (e.g. license issues, or
62799 permission problems), the message is deferred and a paniclog entry is
62800 written.  The usual <literal>defer_ok</literal> option is available.
62801 </para>
62802 </listitem></varlistentry>
62803 <varlistentry>
62804 <term><option>aveserver</option></term>
62805 <listitem>
62806 <para>
62807 <indexterm role="concept">
62808 <primary>virus scanners</primary>
62809 <secondary>Kaspersky</secondary>
62810 </indexterm>
62811 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
62812 at <emphasis role="bold"><ulink url="https://www.kaspersky.com/">https://www.kaspersky.com/</ulink></emphasis>. This scanner type takes one option,
62813 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
62814 example:
62815 </para>
62816 <literallayout class="monospaced">
62817 av_scanner = aveserver:/var/run/aveserver
62818 </literallayout>
62819 </listitem></varlistentry>
62820 <varlistentry>
62821 <term><option>clamd</option></term>
62822 <listitem>
62823 <para>
62824 <indexterm role="concept">
62825 <primary>virus scanners</primary>
62826 <secondary>clamd</secondary>
62827 </indexterm>
62828 This daemon-type scanner is GPL and free. You can get it at
62829 <emphasis role="bold"><ulink url="https://www.clamav.net/">https://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
62830 unpack MIME containers, so it used to be recommended to unpack MIME attachments
62831 in the MIME ACL. This is no longer believed to be necessary.
62832 </para>
62833 <para>
62834 The options are a list of server specifiers, which may be
62835 a UNIX socket specification,
62836 a TCP socket specification,
62837 or a (global) option.
62838 </para>
62839 <para>
62840 A socket specification consists of a space-separated list.
62841 For a Unix socket the first element is a full path for the socket,
62842 for a TCP socket the first element is the IP address
62843 and the second a port number,
62844 Any further elements are per-server (non-global) options.
62845 These per-server options are supported:
62846 </para>
62847 <literallayout class="monospaced">
62848 retry=&lt;timespec&gt;  Retry on connect fail
62849 </literallayout>
62850 <para>
62851 The <literal>retry</literal> option specifies a time after which a single retry for
62852 a failed connect is made.  The default is to not retry.
62853 </para>
62854 <para>
62855 If a Unix socket file is specified, only one server is supported.
62856 </para>
62857 <para>
62858 Examples:
62859 </para>
62860 <literallayout class="monospaced">
62861 av_scanner = clamd:/opt/clamd/socket
62862 av_scanner = clamd:192.0.2.3 1234
62863 av_scanner = clamd:192.0.2.3 1234:local
62864 av_scanner = clamd:192.0.2.3 1234 retry=10s
62865 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
62866 </literallayout>
62867 <para>
62868 If the value of av_scanner points to a UNIX socket file or contains the
62869 <literal>local</literal>
62870 option, then the ClamAV interface will pass a filename containing the data
62871 to be scanned, which should normally result in less I/O happening and be
62872 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
62873 Exim does not assume that there is a common filesystem with the remote host.
62874 </para>
62875 <para>
62876 The final example shows that multiple TCP targets can be specified.  Exim will
62877 randomly use one for each incoming email (i.e. it load balances them).  Note
62878 that only TCP targets may be used if specifying a list of scanners; a UNIX
62879 socket cannot be mixed in with TCP targets.  If one of the servers becomes
62880 unavailable, Exim will try the remaining one(s) until it finds one that works.
62881 When a clamd server becomes unreachable, Exim will log a message.  Exim does
62882 not keep track of scanner state between multiple messages, and the scanner
62883 selection is random, so the message will get logged in the mainlog for each
62884 email that the down scanner gets chosen first (message wrapped to be readable):
62885 </para>
62886 <literallayout class="monospaced">
62887 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
62888    clamd: connection to localhost, port 3310 failed
62889    (Connection refused)
62890 </literallayout>
62891 <para>
62892 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
62893 contributing the code for this scanner.
62894 </para>
62895 </listitem></varlistentry>
62896 <varlistentry>
62897 <term><option>cmdline</option></term>
62898 <listitem>
62899 <para>
62900 <indexterm role="concept">
62901 <primary>virus scanners</primary>
62902 <secondary>command line interface</secondary>
62903 </indexterm>
62904 This is the keyword for the generic command line scanner interface. It can be
62905 used to attach virus scanners that are invoked from the shell. This scanner
62906 type takes 3 mandatory options:
62907 </para>
62908 <orderedlist numeration="arabic">
62909 <listitem>
62910 <para>
62911 The full path and name of the scanner binary, with all command line options,
62912 and a placeholder (<literal>%s</literal>) for the directory to scan.
62913 </para>
62914 </listitem>
62915 <listitem>
62916 <para>
62917 A regular expression to match against the STDOUT and STDERR output of the
62918 virus scanner. If the expression matches, a virus was found. You must make
62919 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
62920 the <quote>trigger</quote> expression.
62921 </para>
62922 </listitem>
62923 <listitem>
62924 <para>
62925 Another regular expression, containing exactly one pair of parentheses, to
62926 match the name of the virus found in the scanners output. This is called the
62927 <quote>name</quote> expression.
62928 </para>
62929 </listitem>
62930 </orderedlist>
62931 <para>
62932 For example, Sophos Sweep reports a virus on a line like this:
62933 </para>
62934 <literallayout class="monospaced">
62935 Virus 'W32/Magistr-B' found in file ./those.bat
62936 </literallayout>
62937 <para>
62938 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
62939 name expression, we want to extract the W32/Magistr-B string, so we can match
62940 for the single quotes left and right of it. Altogether, this makes the
62941 configuration setting:
62942 </para>
62943 <literallayout class="monospaced">
62944 av_scanner = cmdline:\
62945              /path/to/sweep -ss -all -rec -archive %s:\
62946              found in file:'(.+)'
62947 </literallayout>
62948 </listitem></varlistentry>
62949 <varlistentry>
62950 <term><option>drweb</option></term>
62951 <listitem>
62952 <para>
62953 <indexterm role="concept">
62954 <primary>virus scanners</primary>
62955 <secondary>DrWeb</secondary>
62956 </indexterm>
62957 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="https://www.sald.ru/">https://www.sald.ru/</ulink></emphasis>) interface
62958 takes one option,
62959 either a full path to a UNIX socket,
62960 or host and port specifiers separated by white space.
62961 The host may be a name or an IP address; the port is either a
62962 single number or a pair of numbers with a dash between.
62963 For example:
62964 </para>
62965 <literallayout class="monospaced">
62966 av_scanner = drweb:/var/run/drwebd.sock
62967 av_scanner = drweb:192.168.2.20 31337
62968 </literallayout>
62969 <para>
62970 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
62971 is used. Thanks to Alex Miller for contributing the code for this scanner.
62972 </para>
62973 </listitem></varlistentry>
62974 <varlistentry>
62975 <term><option>f-protd</option></term>
62976 <listitem>
62977 <para>
62978 <indexterm role="concept">
62979 <primary>virus scanners</primary>
62980 <secondary>f-protd</secondary>
62981 </indexterm>
62982 The f-protd scanner is accessed via HTTP over TCP.
62983 One argument is taken, being a space-separated hostname and port number
62984 (or port-range).
62985 For example:
62986 </para>
62987 <literallayout class="monospaced">
62988 av_scanner = f-protd:localhost 10200-10204
62989 </literallayout>
62990 <para>
62991 If you omit the argument, the default values shown above are used.
62992 </para>
62993 </listitem></varlistentry>
62994 <varlistentry>
62995 <term><option>f-prot6d</option></term>
62996 <listitem>
62997 <para>
62998 <indexterm role="concept">
62999 <primary>virus scanners</primary>
63000 <secondary>f-prot6d</secondary>
63001 </indexterm>
63002 The f-prot6d scanner is accessed using the FPSCAND protocol over TCP.
63003 One argument is taken, being a space-separated hostname and port number.
63004 For example:
63005 </para>
63006 <literallayout class="monospaced">
63007 av_scanner = f-prot6d:localhost 10200
63008 </literallayout>
63009 <para>
63010 If you omit the argument, the default values show above are used.
63011 </para>
63012 </listitem></varlistentry>
63013 <varlistentry>
63014 <term><option>fsecure</option></term>
63015 <listitem>
63016 <para>
63017 <indexterm role="concept">
63018 <primary>virus scanners</primary>
63019 <secondary>F-Secure</secondary>
63020 </indexterm>
63021 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="https://www.f-secure.com/">https://www.f-secure.com/</ulink></emphasis>) takes one
63022 argument which is the path to a UNIX socket. For example:
63023 </para>
63024 <literallayout class="monospaced">
63025 av_scanner = fsecure:/path/to/.fsav
63026 </literallayout>
63027 <para>
63028 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
63029 Thelmen for contributing the code for this scanner.
63030 </para>
63031 </listitem></varlistentry>
63032 <varlistentry>
63033 <term><option>kavdaemon</option></term>
63034 <listitem>
63035 <para>
63036 <indexterm role="concept">
63037 <primary>virus scanners</primary>
63038 <secondary>Kaspersky</secondary>
63039 </indexterm>
63040 This is the scanner daemon of Kaspersky Version 4. This version of the
63041 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
63042 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
63043 For example:
63044 </para>
63045 <literallayout class="monospaced">
63046 av_scanner = kavdaemon:/opt/AVP/AvpCtl
63047 </literallayout>
63048 <para>
63049 The default path is <filename>/var/run/AvpCtl</filename>.
63050 </para>
63051 </listitem></varlistentry>
63052 <varlistentry>
63053 <term><option>mksd</option></term>
63054 <listitem>
63055 <para>
63056 <indexterm role="concept">
63057 <primary>virus scanners</primary>
63058 <secondary>mksd</secondary>
63059 </indexterm>
63060 This was a daemon type scanner that is aimed mainly at Polish users,
63061 though some documentation was available in English.
63062 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>
63063 and this appears to be a candidate for removal from Exim, unless
63064 we are informed of other virus scanners which use the same protocol
63065 to integrate.
63066 The only option for this scanner type is
63067 the maximum number of processes used simultaneously to scan the attachments,
63068 provided that mksd has
63069 been run with at least the same number of child processes. For example:
63070 </para>
63071 <literallayout class="monospaced">
63072 av_scanner = mksd:2
63073 </literallayout>
63074 <para>
63075 You can safely omit this option (the default value is 1).
63076 </para>
63077 </listitem></varlistentry>
63078 <varlistentry>
63079 <term><option>sock</option></term>
63080 <listitem>
63081 <para>
63082 <indexterm role="concept">
63083 <primary>virus scanners</primary>
63084 <secondary>simple socket-connected</secondary>
63085 </indexterm>
63086 This is a general-purpose way of talking to simple scanner daemons
63087 running on the local machine.
63088 There are four options:
63089 an address (which may be an IP address and port, or the path of a Unix socket),
63090 a commandline to send (may include a single %s which will be replaced with
63091 the path to the mail file to be scanned),
63092 an RE to trigger on from the returned data,
63093 and an RE to extract malware_name from the returned data.
63094 For example:
63095 </para>
63096 <literallayout class="monospaced">
63097 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$
63098 </literallayout>
63099 <para>
63100 Note that surrounding whitespace is stripped from each option, meaning
63101 there is no way to specify a trailing newline.
63102 The socket specifier and both regular-expressions are required.
63103 Default for the commandline is <filename>%s\n</filename> (note this does have a trailing newline);
63104 specify an empty element to get this.
63105 </para>
63106 </listitem></varlistentry>
63107 <varlistentry>
63108 <term><option>sophie</option></term>
63109 <listitem>
63110 <para>
63111 <indexterm role="concept">
63112 <primary>virus scanners</primary>
63113 <secondary>Sophos and Sophie</secondary>
63114 </indexterm>
63115 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
63116 You can get Sophie at <emphasis role="bold"><ulink url="http://sophie.sourceforge.net/">http://sophie.sourceforge.net/</ulink></emphasis>. The only option
63117 for this scanner type is the path to the UNIX socket that Sophie uses for
63118 client communication. For example:
63119 </para>
63120 <literallayout class="monospaced">
63121 av_scanner = sophie:/tmp/sophie
63122 </literallayout>
63123 <para>
63124 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
63125 the option.
63126 </para>
63127 </listitem></varlistentry>
63128 </variablelist>
63129 <para>
63130 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
63131 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
63132 ACL.
63133 </para>
63134 <para>
63135 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
63136 makes it possible to use different scanners. See further below for an example.
63137 The <option>malware</option> condition caches its results, so when you use it multiple times
63138 for the same message, the actual scanning process is only carried out once.
63139 However, using expandable items in <option>av_scanner</option> disables this caching, in
63140 which case each use of the <option>malware</option> condition causes a new scan of the
63141 message.
63142 </para>
63143 <para>
63144 The <option>malware</option> condition takes a right-hand argument that is expanded before
63145 use and taken as a list, slash-separated by default.
63146 The first element can then be one of
63147 </para>
63148 <itemizedlist>
63149 <listitem>
63150 <para>
63151 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
63152 The condition succeeds if a virus was found, and fail otherwise. This is the
63153 recommended usage.
63154 </para>
63155 </listitem>
63156 <listitem>
63157 <para>
63158 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
63159 the condition fails immediately.
63160 </para>
63161 </listitem>
63162 <listitem>
63163 <para>
63164 A regular expression, in which case the message is scanned for viruses. The
63165 condition succeeds if a virus is found and its name matches the regular
63166 expression. This allows you to take special actions on certain types of virus.
63167 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
63168 unless the separator is changed (in the usual way <xref linkend="SECTlistsepchange"/>).
63169 </para>
63170 </listitem>
63171 </itemizedlist>
63172 <para>
63173 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
63174 messages even if there is a problem with the virus scanner.
63175 Otherwise, such a problem causes the ACL to defer.
63176 </para>
63177 <para>
63178 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
63179 specify a non-default timeout.  The default is two minutes.
63180 For example:
63181 </para>
63182 <literallayout class="monospaced">
63183 malware = * / defer_ok / tmo=10s
63184 </literallayout>
63185 <para>
63186 A timeout causes the ACL to defer.
63187 </para>
63188 <para>
63189 <indexterm role="variable">
63190 <primary><varname>$callout_address</varname></primary>
63191 </indexterm>
63192 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
63193 is set to record the actual address used.
63194 </para>
63195 <para>
63196 <indexterm role="variable">
63197 <primary><varname>$malware_name</varname></primary>
63198 </indexterm>
63199 When a virus is found, the condition sets up an expansion variable called
63200 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
63201 <option>message</option> modifier that specifies the error returned to the sender, and/or in
63202 logging data.
63203 </para>
63204 <para>
63205 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
63206 imposed by your anti-virus scanner.
63207 </para>
63208 <para>
63209 Here is a very simple scanning example:
63210 </para>
63211 <literallayout class="monospaced">
63212 deny malware = *
63213      message = This message contains malware ($malware_name)
63214 </literallayout>
63215 <para>
63216 The next example accepts messages when there is a problem with the scanner:
63217 </para>
63218 <literallayout class="monospaced">
63219 deny malware = */defer_ok
63220      message = This message contains malware ($malware_name)
63221 </literallayout>
63222 <para>
63223 The next example shows how to use an ACL variable to scan with both sophie and
63224 aveserver. It assumes you have set:
63225 </para>
63226 <literallayout class="monospaced">
63227 av_scanner = $acl_m0
63228 </literallayout>
63229 <para>
63230 in the main Exim configuration.
63231 </para>
63232 <literallayout class="monospaced">
63233 deny set acl_m0 = sophie
63234      malware = *
63235      message = This message contains malware ($malware_name)
63236
63237 deny set acl_m0 = aveserver
63238      malware = *
63239      message = This message contains malware ($malware_name)
63240 </literallayout>
63241 </section>
63242 <section id="SECTscanspamass">
63243 <title>Scanning with SpamAssassin and Rspamd</title>
63244 <para>
63245 <indexterm role="concept">
63246 <primary>content scanning</primary>
63247 <secondary>for spam</secondary>
63248 </indexterm>
63249 <indexterm role="concept">
63250 <primary>spam scanning</primary>
63251 </indexterm>
63252 <indexterm role="concept">
63253 <primary>SpamAssassin</primary>
63254 </indexterm>
63255 <indexterm role="concept">
63256 <primary>Rspamd</primary>
63257 </indexterm>
63258 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
63259 score and a report for the message.
63260 Support is also provided for Rspamd.
63261 </para>
63262 <para>
63263 For more information about installation and configuration of SpamAssassin or
63264 Rspamd refer to their respective websites at
63265 <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>
63266 </para>
63267 <para>
63268 SpamAssassin can be installed with CPAN by running:
63269 </para>
63270 <literallayout class="monospaced">
63271 perl -MCPAN -e 'install Mail::SpamAssassin'
63272 </literallayout>
63273 <para>
63274 SpamAssassin has its own set of configuration files. Please review its
63275 documentation to see how you can tweak it. The default installation should work
63276 nicely, however.
63277 </para>
63278 <para>
63279 <indexterm role="option">
63280 <primary><option>spamd_address</option></primary>
63281 </indexterm>
63282 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
63283 intend to use an instance running on the local host you do not need to set
63284 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
63285 you must set the <option>spamd_address</option> option in the global part of the Exim
63286 configuration as follows (example):
63287 </para>
63288 <literallayout class="monospaced">
63289 spamd_address = 192.168.99.45 783
63290 </literallayout>
63291 <para>
63292 The SpamAssassin protocol relies on a TCP half-close from the client.
63293 If your SpamAssassin client side is running a Linux system with an
63294 iptables firewall, consider setting
63295 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
63296 timeout, Exim uses when waiting for a response from the SpamAssassin
63297 server (currently defaulting to 120s).  With a lower value the Linux
63298 connection tracking may consider your half-closed connection as dead too
63299 soon.
63300 </para>
63301 <para>
63302 To use Rspamd (which by default listens on all local addresses
63303 on TCP port 11333)
63304 you should add <option>variant=rspamd</option> after the address/port pair, for example:
63305 </para>
63306 <literallayout class="monospaced">
63307 spamd_address = 127.0.0.1 11333 variant=rspamd
63308 </literallayout>
63309 <para>
63310 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
63311 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
63312 filename instead of an address/port pair:
63313 </para>
63314 <literallayout class="monospaced">
63315 spamd_address = /var/run/spamd_socket
63316 </literallayout>
63317 <para>
63318 You can have multiple <option>spamd</option> servers to improve scalability. These can
63319 reside on other hardware reachable over the network. To specify multiple
63320 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
63321 option, separated with colons (the separator can be changed in the usual way <xref linkend="SECTlistsepchange"/>):
63322 </para>
63323 <literallayout class="monospaced">
63324 spamd_address = 192.168.2.10 783 : \
63325                 192.168.2.11 783 : \
63326                 192.168.2.12 783
63327 </literallayout>
63328 <para>
63329 Up to 32 <option>spamd</option> servers are supported.
63330 When a server fails to respond to the connection attempt, all other
63331 servers are tried until one succeeds. If no server responds, the <option>spam</option>
63332 condition defers.
63333 </para>
63334 <para>
63335 Unix and TCP socket specifications may be mixed in any order.
63336 Each element of the list is a list itself, space-separated by default
63337 and changeable in the usual way (<xref linkend="SECTlistsepchange"/>);
63338 take care to not double the separator.
63339 </para>
63340 <para>
63341 For TCP socket specifications a host name or IP (v4 or v6, but
63342 subject to list-separator quoting rules) address can be used,
63343 and the port can be one or a dash-separated pair.
63344 In the latter case, the range is tried in strict order.
63345 </para>
63346 <para>
63347 Elements after the first for Unix sockets, or second for TCP socket,
63348 are options.
63349 The supported options are:
63350 </para>
63351 <literallayout class="monospaced">
63352 pri=&lt;priority&gt;      Selection priority
63353 weight=&lt;value&gt;      Selection bias
63354 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
63355 retry=&lt;timespec&gt;    Retry on connect fail
63356 tmo=&lt;timespec&gt;      Connection time limit
63357 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
63358 </literallayout>
63359 <para>
63360 The <literal>pri</literal> option specifies a priority for the server within the list,
63361 higher values being tried first.
63362 The default priority is 1.
63363 </para>
63364 <para>
63365 The <literal>weight</literal> option specifies a selection bias.
63366 Within a priority set
63367 servers are queried in a random fashion, weighted by this value.
63368 The default value for selection bias is 1.
63369 </para>
63370 <para>
63371 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
63372 in the local time zone; each element being one or more digits.
63373 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
63374 characters, may be omitted and will be taken as zero.
63375 </para>
63376 <para>
63377 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
63378 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
63379 </para>
63380 <para>
63381 The <literal>tmo</literal> option specifies an overall timeout for communication.
63382 The default value is two minutes.
63383 </para>
63384 <para>
63385 The <literal>retry</literal> option specifies a time after which a single retry for
63386 a failed connect is made.
63387 The default is to not retry.
63388 </para>
63389 <para>
63390 The <option>spamd_address</option> variable is expanded before use if it starts with
63391 a dollar sign. In this case, the expansion may return a string that is
63392 used as the list so that multiple spamd servers can be the result of an
63393 expansion.
63394 </para>
63395 <para>
63396 <indexterm role="variable">
63397 <primary><varname>$callout_address</varname></primary>
63398 </indexterm>
63399 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
63400 is set to record the actual address used.
63401 </para>
63402 </section>
63403 <section id="SECID206">
63404 <title>Calling SpamAssassin from an Exim ACL</title>
63405 <para>
63406 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
63407 </para>
63408 <literallayout class="monospaced">
63409 deny spam = joe
63410      message = This message was classified as SPAM
63411 </literallayout>
63412 <para>
63413 The right-hand side of the <option>spam</option> condition specifies a name. This is
63414 relevant if you have set up multiple SpamAssassin profiles. If you do not want
63415 to scan using a specific profile, but rather use the SpamAssassin system-wide
63416 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
63417 Rspamd does not use this setting. However, you must put something on the
63418 right-hand side.
63419 </para>
63420 <para>
63421 The name allows you to use per-domain or per-user antispam profiles in
63422 principle, but this is not straightforward in practice, because a message may
63423 have multiple recipients, not necessarily all in the same domain. Because the
63424 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
63425 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
63426 are not set.
63427 Careful enforcement of single-recipient messages
63428 (e.g. by responding with defer in the recipient ACL for all recipients
63429 after the first),
63430 or the use of PRDR,
63431 <indexterm role="concept">
63432 <primary>PRDR</primary>
63433 <secondary>use for per-user SpamAssassin profiles</secondary>
63434 </indexterm>
63435 are needed to use this feature.
63436 </para>
63437 <para>
63438 The right-hand side of the <option>spam</option> condition is expanded before being used, so
63439 you can put lookups or conditions there. When the right-hand side evaluates to
63440 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
63441 </para>
63442 <para>
63443 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
63444 large ones may cause significant performance degradation. As most spam messages
63445 are quite small, it is recommended that you do not scan the big ones. For
63446 example:
63447 </para>
63448 <literallayout class="monospaced">
63449 deny condition = ${if &lt; {$message_size}{10K}}
63450      spam = nobody
63451      message = This message was classified as SPAM
63452 </literallayout>
63453 <para>
63454 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
63455 SpamAssassin profile has been matched or exceeded. If you want to use the
63456 <option>spam</option> condition for its side effects (see the variables below), you can make
63457 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
63458 </para>
63459 <para>
63460 <indexterm role="concept">
63461 <primary>spam scanning</primary>
63462 <secondary>returned variables</secondary>
63463 </indexterm>
63464 When the <option>spam</option> condition is run, it sets up a number of expansion
63465 variables.
63466 Except for <varname>$spam_report</varname>,
63467 these variables are saved with the received message so are
63468 available for use at delivery time.
63469 </para>
63470 <variablelist>
63471 <varlistentry>
63472 <term><varname>$spam_score</varname></term>
63473 <listitem>
63474 <para>
63475 The spam score of the message, for example, <quote>3.4</quote> or <quote>30.5</quote>. This is useful
63476 for inclusion in log or reject messages.
63477 </para>
63478 </listitem></varlistentry>
63479 <varlistentry>
63480 <term><varname>$spam_score_int</varname></term>
63481 <listitem>
63482 <para>
63483 The spam score of the message, multiplied by ten, as an integer value. For
63484 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
63485 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
63486 The integer value is useful for numeric comparisons in conditions.
63487 </para>
63488 </listitem></varlistentry>
63489 <varlistentry>
63490 <term><varname>$spam_bar</varname></term>
63491 <listitem>
63492 <para>
63493 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
63494 integer part of the spam score value. A spam score of 4.4 would have a
63495 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
63496 headers, since MUAs can match on such strings. The maximum length of the
63497 spam bar is 50 characters.
63498 </para>
63499 </listitem></varlistentry>
63500 <varlistentry>
63501 <term><varname>$spam_report</varname></term>
63502 <listitem>
63503 <para>
63504 A multiline text table, containing the full SpamAssassin report for the
63505 message. Useful for inclusion in headers or reject messages.
63506 This variable is only usable in a DATA-time ACL.
63507 Beware that SpamAssassin may return non-ASCII characters, especially
63508 when running in country-specific locales, which are not legal
63509 unencoded in headers.
63510 </para>
63511 </listitem></varlistentry>
63512 <varlistentry>
63513 <term><varname>$spam_action</varname></term>
63514 <listitem>
63515 <para>
63516 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
63517 spam score versus threshold.
63518 For Rspamd, the recommended action.
63519 </para>
63520 </listitem></varlistentry>
63521 </variablelist>
63522 <para>
63523 The <option>spam</option> condition caches its results unless expansion in
63524 spamd_address was used. If you call it again with the same user name, it
63525 does not scan again, but rather returns the same values as before.
63526 </para>
63527 <para>
63528 The <option>spam</option> condition returns DEFER if there is any error while running
63529 the message through SpamAssassin or if the expansion of spamd_address
63530 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
63531 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
63532 spam condition, like this:
63533 </para>
63534 <literallayout class="monospaced">
63535 deny spam    = joe/defer_ok
63536      message = This message was classified as SPAM
63537 </literallayout>
63538 <para>
63539 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
63540 </para>
63541 <para>
63542 Here is a longer, commented example of the use of the <option>spam</option>
63543 condition:
63544 </para>
63545 <literallayout class="monospaced">
63546 # put headers in all messages (no matter if spam or not)
63547 warn  spam = nobody:true
63548       add_header = X-Spam-Score: $spam_score ($spam_bar)
63549       add_header = X-Spam-Report: $spam_report
63550
63551 # add second subject line with *SPAM* marker when message
63552 # is over threshold
63553 warn  spam = nobody
63554       add_header = Subject: *SPAM* $h_Subject:
63555
63556 # reject spam at high scores (&gt; 12)
63557 deny  spam = nobody:true
63558       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
63559       message = This message scored $spam_score spam points.
63560 </literallayout>
63561 </section>
63562 <section id="SECTscanmimepart">
63563 <title>Scanning MIME parts</title>
63564 <para>
63565 <indexterm role="concept">
63566 <primary>content scanning</primary>
63567 <secondary>MIME parts</secondary>
63568 </indexterm>
63569 <indexterm role="concept">
63570 <primary>MIME content scanning</primary>
63571 </indexterm>
63572 <indexterm role="option">
63573 <primary><option>acl_smtp_mime</option></primary>
63574 </indexterm>
63575 <indexterm role="option">
63576 <primary><option>acl_not_smtp_mime</option></primary>
63577 </indexterm>
63578 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
63579 each MIME part of an SMTP message, including multipart types, in the sequence
63580 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
63581 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
63582 options may both refer to the same ACL if you want the same processing in both
63583 cases.
63584 </para>
63585 <para>
63586 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
63587 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
63588 the case of a non-SMTP message. However, a MIME ACL is called only if the
63589 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
63590 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
63591 result code is sent to the client. In the case of an SMTP message, the
63592 <option>acl_smtp_data</option> ACL is not called when this happens.
63593 </para>
63594 <para>
63595 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
63596 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
63597 condition to match against the raw MIME part. You can also use the
63598 <option>mime_regex</option> condition to match against the decoded MIME part (see section
63599 <xref linkend="SECTscanregex"/>).
63600 </para>
63601 <para>
63602 At the start of a MIME ACL, a number of variables are set from the header
63603 information for the relevant MIME part. These are described below. The contents
63604 of the MIME part are not by default decoded into a disk file except for MIME
63605 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
63606 part into a disk file, you can use the <option>decode</option> condition. The general
63607 syntax is:
63608 </para>
63609 <literallayout>
63610 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
63611 </literallayout>
63612 <para>
63613 The right hand side is expanded before use. After expansion,
63614 the value can be:
63615 </para>
63616 <orderedlist numeration="arabic">
63617 <listitem>
63618 <para>
63619 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
63620 </para>
63621 </listitem>
63622 <listitem>
63623 <para>
63624 The string <quote>default</quote>. In that case, the file is put in the temporary
63625 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
63626 a sequential filename consisting of the message id and a sequence number. The
63627 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
63628 </para>
63629 </listitem>
63630 <listitem>
63631 <para>
63632 A full path name starting with a slash. If the full name is an existing
63633 directory, it is used as a replacement for the default directory. The filename
63634 is then sequentially assigned. If the path does not exist, it is used as
63635 the full path and filename.
63636 </para>
63637 </listitem>
63638 <listitem>
63639 <para>
63640 If the string does not start with a slash, it is used as the
63641 filename, and the default path is then used.
63642 </para>
63643 </listitem>
63644 </orderedlist>
63645 <para>
63646 The <option>decode</option> condition normally succeeds. It is only false for syntax
63647 errors or unusual circumstances such as memory shortages. You can easily decode
63648 a file with its original, proposed filename using
63649 </para>
63650 <literallayout class="monospaced">
63651 decode = $mime_filename
63652 </literallayout>
63653 <para>
63654 However, you should keep in mind that <varname>$mime_filename</varname> might contain
63655 anything. If you place files outside of the default path, they are not
63656 automatically unlinked.
63657 </para>
63658 <para>
63659 For RFC822 attachments (these are messages attached to messages, with a
63660 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
63661 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
63662 variable is set (see below). Attached messages are always decoded to disk
63663 before being checked, and the files are unlinked once the check is done.
63664 </para>
63665 <para>
63666 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
63667 used to match regular expressions against raw and decoded MIME parts,
63668 respectively. They are described in section <xref linkend="SECTscanregex"/>.
63669 </para>
63670 <para>
63671 <indexterm role="concept">
63672 <primary>MIME content scanning</primary>
63673 <secondary>returned variables</secondary>
63674 </indexterm>
63675 The following list describes all expansion variables that are
63676 available in the MIME ACL:
63677 </para>
63678 <variablelist>
63679 <varlistentry>
63680 <term><varname>$mime_anomaly_level</varname></term>
63681 <term><varname>$mime_anomaly_text</varname></term>
63682 <listitem>
63683 <para>
63684 <indexterm role="variable">
63685 <primary><varname>$mime_anomaly_level</varname></primary>
63686 </indexterm>
63687 <indexterm role="variable">
63688 <primary><varname>$mime_anomaly_text</varname></primary>
63689 </indexterm>
63690 If there are problems decoding, these variables contain information on
63691 the detected issue.
63692 </para>
63693 </listitem></varlistentry>
63694 <varlistentry>
63695 <term><varname>$mime_boundary</varname></term>
63696 <listitem>
63697 <para>
63698 <indexterm role="variable">
63699 <primary><varname>$mime_boundary</varname></primary>
63700 </indexterm>
63701 If the current part is a multipart (see <varname>$mime_is_multipart</varname> below), it should
63702 have a boundary string, which is stored in this variable. If the current part
63703 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
63704 contains the empty string.
63705 </para>
63706 </listitem></varlistentry>
63707 <varlistentry>
63708 <term><varname>$mime_charset</varname></term>
63709 <listitem>
63710 <para>
63711 <indexterm role="variable">
63712 <primary><varname>$mime_charset</varname></primary>
63713 </indexterm>
63714 This variable contains the character set identifier, if one was found in the
63715 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
63716 </para>
63717 <literallayout class="monospaced">
63718 us-ascii
63719 gb2312 (Chinese)
63720 iso-8859-1
63721 </literallayout>
63722 <para>
63723 Please note that this value is not normalized, so you should do matches
63724 case-insensitively.
63725 </para>
63726 </listitem></varlistentry>
63727 <varlistentry>
63728 <term><varname>$mime_content_description</varname></term>
63729 <listitem>
63730 <para>
63731 <indexterm role="variable">
63732 <primary><varname>$mime_content_description</varname></primary>
63733 </indexterm>
63734 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
63735 header. It can contain a human-readable description of the parts content. Some
63736 implementations repeat the filename for attachments here, but they are usually
63737 only used for display purposes.
63738 </para>
63739 </listitem></varlistentry>
63740 <varlistentry>
63741 <term><varname>$mime_content_disposition</varname></term>
63742 <listitem>
63743 <para>
63744 <indexterm role="variable">
63745 <primary><varname>$mime_content_disposition</varname></primary>
63746 </indexterm>
63747 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
63748 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
63749 </para>
63750 </listitem></varlistentry>
63751 <varlistentry>
63752 <term><varname>$mime_content_id</varname></term>
63753 <listitem>
63754 <para>
63755 <indexterm role="variable">
63756 <primary><varname>$mime_content_id</varname></primary>
63757 </indexterm>
63758 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
63759 This is a unique ID that can be used to reference a part from another part.
63760 </para>
63761 </listitem></varlistentry>
63762 <varlistentry>
63763 <term><varname>$mime_content_size</varname></term>
63764 <listitem>
63765 <para>
63766 <indexterm role="variable">
63767 <primary><varname>$mime_content_size</varname></primary>
63768 </indexterm>
63769 This variable is set only after the <option>decode</option> modifier (see above) has been
63770 successfully run. It contains the size of the decoded part in kilobytes. The
63771 size is always rounded up to full kilobytes, so only a completely empty part
63772 has a <varname>$mime_content_size</varname> of zero.
63773 </para>
63774 </listitem></varlistentry>
63775 <varlistentry>
63776 <term><varname>$mime_content_transfer_encoding</varname></term>
63777 <listitem>
63778 <para>
63779 <indexterm role="variable">
63780 <primary><varname>$mime_content_transfer_encoding</varname></primary>
63781 </indexterm>
63782 This variable contains the normalized content of the
63783 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
63784 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
63785 </para>
63786 </listitem></varlistentry>
63787 <varlistentry>
63788 <term><varname>$mime_content_type</varname></term>
63789 <listitem>
63790 <para>
63791 <indexterm role="variable">
63792 <primary><varname>$mime_content_type</varname></primary>
63793 </indexterm>
63794 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
63795 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
63796 are some examples of popular MIME types, as they may appear in this variable:
63797 </para>
63798 <literallayout class="monospaced">
63799 text/plain
63800 text/html
63801 application/octet-stream
63802 image/jpeg
63803 audio/midi
63804 </literallayout>
63805 <para>
63806 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
63807 empty string.
63808 </para>
63809 </listitem></varlistentry>
63810 <varlistentry>
63811 <term><varname>$mime_decoded_filename</varname></term>
63812 <listitem>
63813 <para>
63814 <indexterm role="variable">
63815 <primary><varname>$mime_decoded_filename</varname></primary>
63816 </indexterm>
63817 This variable is set only after the <option>decode</option> modifier (see above) has been
63818 successfully run. It contains the full path and filename of the file
63819 containing the decoded data.
63820 </para>
63821 </listitem></varlistentry>
63822 </variablelist>
63823 <para>
63824 <indexterm role="concept">
63825 <primary>RFC 2047</primary>
63826 </indexterm>
63827 </para>
63828 <variablelist>
63829 <varlistentry>
63830 <term><varname>$mime_filename</varname></term>
63831 <listitem>
63832 <para>
63833 <indexterm role="variable">
63834 <primary><varname>$mime_filename</varname></primary>
63835 </indexterm>
63836 This is perhaps the most important of the MIME variables. It contains a
63837 proposed filename for an attachment, if one was found in either the
63838 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
63839 RFC2047
63840 or RFC2231
63841 decoded, but no additional sanity checks are done.
63842  If no filename was
63843 found, this variable contains the empty string.
63844 </para>
63845 </listitem></varlistentry>
63846 <varlistentry>
63847 <term><varname>$mime_is_coverletter</varname></term>
63848 <listitem>
63849 <para>
63850 <indexterm role="variable">
63851 <primary><varname>$mime_is_coverletter</varname></primary>
63852 </indexterm>
63853 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
63854 attached data. It can be used to clamp down on flashy or unnecessarily encoded
63855 content in the cover letter, while not restricting attachments at all.
63856 </para>
63857 <para>
63858 The variable contains 1 (true) for a MIME part believed to be part of the
63859 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
63860 follows:
63861 </para>
63862 <orderedlist numeration="arabic">
63863 <listitem>
63864 <para>
63865 The outermost MIME part of a message is always a cover letter.
63866 </para>
63867 </listitem>
63868 <listitem>
63869 <para>
63870 If a multipart/alternative or multipart/related MIME part is a cover letter,
63871 so are all MIME subparts within that multipart.
63872 </para>
63873 </listitem>
63874 <listitem>
63875 <para>
63876 If any other multipart is a cover letter, the first subpart is a cover letter,
63877 and the rest are attachments.
63878 </para>
63879 </listitem>
63880 <listitem>
63881 <para>
63882 All parts contained within an attachment multipart are attachments.
63883 </para>
63884 </listitem>
63885 </orderedlist>
63886 <para>
63887 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
63888 alternative plain text), while allowing HTML files to be attached. HTML
63889 coverletter mail attached to non-HTML coverletter mail will also be allowed:
63890 </para>
63891 <literallayout class="monospaced">
63892 deny !condition = $mime_is_rfc822
63893      condition = $mime_is_coverletter
63894      condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
63895      message = HTML mail is not accepted here
63896 </literallayout>
63897 </listitem></varlistentry>
63898 <varlistentry>
63899 <term><varname>$mime_is_multipart</varname></term>
63900 <listitem>
63901 <para>
63902 <indexterm role="variable">
63903 <primary><varname>$mime_is_multipart</varname></primary>
63904 </indexterm>
63905 This variable has the value 1 (true) when the current part has the main type
63906 <quote>multipart</quote>, for example, <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
63907 Since multipart entities only serve as containers for other parts, you may not
63908 want to carry out specific actions on them.
63909 </para>
63910 </listitem></varlistentry>
63911 <varlistentry>
63912 <term><varname>$mime_is_rfc822</varname></term>
63913 <listitem>
63914 <para>
63915 <indexterm role="variable">
63916 <primary><varname>$mime_is_rfc822</varname></primary>
63917 </indexterm>
63918 This variable has the value 1 (true) if the current part is not a part of the
63919 checked message itself, but part of an attached message. Attached message
63920 decoding is fully recursive.
63921 </para>
63922 </listitem></varlistentry>
63923 <varlistentry>
63924 <term><varname>$mime_part_count</varname></term>
63925 <listitem>
63926 <para>
63927 <indexterm role="variable">
63928 <primary><varname>$mime_part_count</varname></primary>
63929 </indexterm>
63930 This variable is a counter that is raised for each processed MIME part. It
63931 starts at zero for the very first part (which is usually a multipart). The
63932 counter is per-message, so it is reset when processing RFC822 attachments (see
63933 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
63934 complete, so you can use it in the DATA ACL to determine the number of MIME
63935 parts of a message. For non-MIME messages, this variable contains the value -1.
63936 </para>
63937 </listitem></varlistentry>
63938 </variablelist>
63939 </section>
63940 <section id="SECTscanregex">
63941 <title>Scanning with regular expressions</title>
63942 <para>
63943 <indexterm role="concept">
63944 <primary>content scanning</primary>
63945 <secondary>with regular expressions</secondary>
63946 </indexterm>
63947 <indexterm role="concept">
63948 <primary>regular expressions</primary>
63949 <secondary>content scanning with</secondary>
63950 </indexterm>
63951 You can specify your own custom regular expression matches on the full body of
63952 the message, or on individual MIME parts.
63953 </para>
63954 <para>
63955 The <option>regex</option> condition takes one or more regular expressions as arguments and
63956 matches them against the full message (when called in the DATA ACL) or a raw
63957 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
63958 linewise, with a maximum line length of 32K characters. That means you cannot
63959 have multiline matches with the <option>regex</option> condition.
63960 </para>
63961 <para>
63962 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
63963 to 32K of decoded content (the whole content at once, not linewise). If the
63964 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
63965 is decoded automatically when <option>mime_regex</option> is executed (using default path
63966 and filename values). If the decoded data is larger than  32K, only the first
63967 32K characters are checked.
63968 </para>
63969 <para>
63970 The regular expressions are passed as a colon-separated list. To include a
63971 literal colon, you must double it. Since the whole right-hand side string is
63972 expanded before being used, you must also escape dollar signs and backslashes
63973 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
63974 Here is a simple example that contains two regular expressions:
63975 </para>
63976 <literallayout class="monospaced">
63977 deny regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
63978      message = contains blacklisted regex ($regex_match_string)
63979 </literallayout>
63980 <para>
63981 The conditions returns true if any one of the regular expressions matches. The
63982 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
63983 matching regular expression.
63984 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
63985 are set to any substrings captured by the regular expression.
63986 </para>
63987 <para>
63988 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
63989 CPU-intensive.
63990 </para>
63991 <para>
63992 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
63993 </para>
63994 </section>
63995 </chapter>
63996
63997 <chapter id="CHAPlocalscan">
63998 <title>Adding a local scan function to Exim</title>
63999 <titleabbrev>Local scan function</titleabbrev>
64000 <para>
64001 <indexterm role="concept" id="IIDlosca" class="startofrange">
64002 <primary><function>local_scan()</function> function</primary>
64003 <secondary>description of</secondary>
64004 </indexterm>
64005 <indexterm role="concept">
64006 <primary>customizing</primary>
64007 <secondary>input scan using C function</secondary>
64008 </indexterm>
64009 <indexterm role="concept">
64010 <primary>policy control</primary>
64011 <secondary>by local scan function</secondary>
64012 </indexterm>
64013 In these days of email worms, viruses, and ever-increasing spam, some sites
64014 want to apply a lot of checking to messages before accepting them.
64015 </para>
64016 <para>
64017 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
64018 passing messages to external virus and spam scanning software. You can also do
64019 a certain amount in Exim itself through string expansions and the <option>condition</option>
64020 condition in the ACL that runs after the SMTP DATA command or the ACL for
64021 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
64022 </para>
64023 <para>
64024 To allow for further customization to a site&#x2019;s own requirements, there is the
64025 possibility of linking Exim with a private message scanning function, written
64026 in C. If you want to run code that is written in something other than C, you
64027 can of course use a little C stub to call it.
64028 </para>
64029 <para>
64030 The local scan function is run once for every incoming message, at the point
64031 when Exim is just about to accept the message.
64032 It can therefore be used to control non-SMTP messages from local processes as
64033 well as messages arriving via SMTP.
64034 </para>
64035 <para>
64036 Exim applies a timeout to calls of the local scan function, and there is an
64037 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
64038 Zero means <quote>no timeout</quote>.
64039 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
64040 before calling the local scan function, so that the most common types of crash
64041 are caught. If the timeout is exceeded or one of those signals is caught, the
64042 incoming message is rejected with a temporary error if it is an SMTP message.
64043 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
64044 code. The incident is logged on the main and reject logs.
64045 </para>
64046 <section id="SECID207">
64047 <title>Building Exim to use a local scan function</title>
64048 <para>
64049 <indexterm role="concept">
64050 <primary><function>local_scan()</function> function</primary>
64051 <secondary>building Exim to use</secondary>
64052 </indexterm>
64053 To make use of the local scan function feature, you must tell Exim where your
64054 function is before building Exim, by setting
64055 both HAVE_LOCAL_SCAN and
64056 LOCAL_SCAN_SOURCE in your
64057 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
64058 directory, so you might set
64059 </para>
64060 <literallayout class="monospaced">
64061 HAVE_LOCAL_SCAN=yes
64062 LOCAL_SCAN_SOURCE=Local/local_scan.c
64063 </literallayout>
64064 <para>
64065 for example. The function must be called <function>local_scan()</function>;
64066 </para>
64067 <para revisionflag="changed">
64068 the source file(s) for it should first #define LOCAL_SCAN
64069 and then #include "local_scan.h".
64070 </para>
64071 <para>
64072 It is called by
64073 Exim after it has received a message, when the success return code is about to
64074 be sent. This is after all the ACLs have been run. The return code from your
64075 function controls whether the message is actually accepted or not. There is a
64076 commented template function (that just accepts the message) in the file
64077 _src/local_scan.c_.
64078 </para>
64079 <para>
64080 If you want to make use of Exim&#x2019;s runtime configuration file to set options
64081 for your <function>local_scan()</function> function, you must also set
64082 </para>
64083 <literallayout class="monospaced">
64084 LOCAL_SCAN_HAS_OPTIONS=yes
64085 </literallayout>
64086 <para>
64087 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
64088 </para>
64089 </section>
64090 <section id="SECTapiforloc">
64091 <title>API for local_scan()</title>
64092 <para>
64093 <indexterm role="concept">
64094 <primary><function>local_scan()</function> function</primary>
64095 <secondary>API description</secondary>
64096 </indexterm>
64097 <indexterm role="concept">
64098 <primary><option>dlfunc</option></primary>
64099 <secondary>API description</secondary>
64100 </indexterm>
64101 You must include this line near the start of your code:
64102 </para>
64103 <literallayout class="monospaced">
64104 #define LOCAL_SCAN
64105 #include "local_scan.h"
64106 </literallayout>
64107 <para>
64108 This header file defines a number of variables and other values, and the
64109 prototype for the function itself. Exim is coded to use unsigned char values
64110 almost exclusively, and one of the things this header defines is a shorthand
64111 for <literal>unsigned char</literal> called <literal>uschar</literal>.
64112 It also makes available the following macro definitions, to simplify casting character
64113 strings and pointers to character strings:
64114 </para>
64115 <literallayout class="monospaced">
64116 #define CS   (char *)
64117 #define CCS  (const char *)
64118 #define CSS  (char **)
64119 #define US   (unsigned char *)
64120 #define CUS  (const unsigned char *)
64121 #define USS  (unsigned char **)
64122 </literallayout>
64123 <para>
64124 The function prototype for <function>local_scan()</function> is:
64125 </para>
64126 <literallayout class="monospaced">
64127 extern int local_scan(int fd, uschar **return_text);
64128 </literallayout>
64129 <para>
64130 The arguments are as follows:
64131 </para>
64132 <itemizedlist>
64133 <listitem>
64134 <para>
64135 <option>fd</option> is a file descriptor for the file that contains the body of the message
64136 (the -D file). The file is open for reading and writing, but updating it is not
64137 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
64138 </para>
64139 <para>
64140 The descriptor is positioned at character 19 of the file, which is the first
64141 character of the body itself, because the first 19 characters are the message
64142 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
64143 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
64144 case this changes in some future version.
64145 </para>
64146 </listitem>
64147 <listitem>
64148 <para>
64149 <option>return_text</option> is an address which you can use to return a pointer to a text
64150 string at the end of the function. The value it points to on entry is NULL.
64151 </para>
64152 </listitem>
64153 </itemizedlist>
64154 <para>
64155 The function must return an <option>int</option> value which is one of the following macros:
64156 </para>
64157 <variablelist>
64158 <varlistentry>
64159 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
64160 <listitem>
64161 <para>
64162 <indexterm role="variable">
64163 <primary><varname>$local_scan_data</varname></primary>
64164 </indexterm>
64165 The message is accepted. If you pass back a string of text, it is saved with
64166 the message, and made available in the variable <varname>$local_scan_data</varname>. No
64167 newlines are permitted (if there are any, they are turned into spaces) and the
64168 maximum length of text is 1000 characters.
64169 </para>
64170 </listitem></varlistentry>
64171 <varlistentry>
64172 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
64173 <listitem>
64174 <para>
64175 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
64176 queued without immediate delivery, and is frozen.
64177 </para>
64178 </listitem></varlistentry>
64179 <varlistentry>
64180 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
64181 <listitem>
64182 <para>
64183 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
64184 queued without immediate delivery.
64185 </para>
64186 </listitem></varlistentry>
64187 <varlistentry>
64188 <term><literal>LOCAL_SCAN_REJECT</literal></term>
64189 <listitem>
64190 <para>
64191 The message is rejected; the returned text is used as an error message which is
64192 passed back to the sender and which is also logged. Newlines are permitted &ndash;
64193 they cause a multiline response for SMTP rejections, but are converted to
64194 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
64195 used.
64196 </para>
64197 </listitem></varlistentry>
64198 <varlistentry>
64199 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
64200 <listitem>
64201 <para>
64202 The message is temporarily rejected; the returned text is used as an error
64203 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
64204 problem</quote> is used.
64205 </para>
64206 </listitem></varlistentry>
64207 <varlistentry>
64208 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
64209 <listitem>
64210 <para>
64211 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
64212 message is not written to the reject log. It has the effect of unsetting the
64213 <option>rejected_header</option> log selector for just this rejection. If
64214 <option>rejected_header</option> is already unset (see the discussion of the
64215 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
64216 same as LOCAL_SCAN_REJECT.
64217 </para>
64218 </listitem></varlistentry>
64219 <varlistentry>
64220 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
64221 <listitem>
64222 <para>
64223 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
64224 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
64225 </para>
64226 </listitem></varlistentry>
64227 </variablelist>
64228 <para>
64229 If the message is not being received by interactive SMTP, rejections are
64230 reported by writing to <option>stderr</option> or by sending an email, as configured by the
64231 <option>-oe</option> command line options.
64232 </para>
64233 </section>
64234 <section id="SECTconoptloc">
64235 <title>Configuration options for local_scan()</title>
64236 <para>
64237 <indexterm role="concept">
64238 <primary><function>local_scan()</function> function</primary>
64239 <secondary>configuration options</secondary>
64240 </indexterm>
64241 It is possible to have option settings in the main configuration file
64242 that set values in static variables in the <function>local_scan()</function> module. If you
64243 want to do this, you must have the line
64244 </para>
64245 <literallayout class="monospaced">
64246 LOCAL_SCAN_HAS_OPTIONS=yes
64247 </literallayout>
64248 <para>
64249 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
64250 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
64251 file, you must define static variables to hold the option values, and a table
64252 to define them.
64253 </para>
64254 <para>
64255 The table must be a vector called <option>local_scan_options</option>, of type
64256 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
64257 and a pointer to the variable that holds the value. The entries must appear in
64258 alphabetical order. Following <option>local_scan_options</option> you must also define a
64259 variable called <option>local_scan_options_count</option> that contains the number of
64260 entries in the table. Here is a short example, showing two kinds of option:
64261 </para>
64262 <literallayout class="monospaced">
64263 static int my_integer_option = 42;
64264 static uschar *my_string_option = US"a default string";
64265
64266 optionlist local_scan_options[] = {
64267   { "my_integer", opt_int,       &amp;my_integer_option },
64268   { "my_string",  opt_stringptr, &amp;my_string_option }
64269 };
64270
64271 int local_scan_options_count =
64272   sizeof(local_scan_options)/sizeof(optionlist);
64273 </literallayout>
64274 <para>
64275 The values of the variables can now be changed from Exim&#x2019;s runtime
64276 configuration file by including a local scan section as in this example:
64277 </para>
64278 <literallayout class="monospaced">
64279 begin local_scan
64280 my_integer = 99
64281 my_string = some string of text...
64282 </literallayout>
64283 <para>
64284 The available types of option data are as follows:
64285 </para>
64286 <variablelist>
64287 <varlistentry>
64288 <term><emphasis role="bold">opt_bool</emphasis></term>
64289 <listitem>
64290 <para>
64291 This specifies a boolean (true/false) option. The address should point to a
64292 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
64293 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
64294 whether such a variable has been set at all, you can initialize it to
64295 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
64296 values.)
64297 </para>
64298 </listitem></varlistentry>
64299 <varlistentry>
64300 <term><emphasis role="bold">opt_fixed</emphasis></term>
64301 <listitem>
64302 <para>
64303 This specifies a fixed point number, such as is used for load averages.
64304 The address should point to a variable of type <literal>int</literal>. The value is stored
64305 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
64306 </para>
64307 </listitem></varlistentry>
64308 <varlistentry>
64309 <term><emphasis role="bold">opt_int</emphasis></term>
64310 <listitem>
64311 <para>
64312 This specifies an integer; the address should point to a variable of type
64313 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
64314 Exim.
64315 </para>
64316 </listitem></varlistentry>
64317 <varlistentry>
64318 <term><emphasis role="bold">opt_mkint</emphasis></term>
64319 <listitem>
64320 <para>
64321 This is the same as <option>opt_int</option>, except that when such a value is output in a
64322 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
64323 printed with the suffix K or M.
64324 </para>
64325 </listitem></varlistentry>
64326 <varlistentry>
64327 <term><emphasis role="bold">opt_octint</emphasis></term>
64328 <listitem>
64329 <para>
64330 This also specifies an integer, but the value is always interpreted as an
64331 octal integer, whether or not it starts with the digit zero, and it is
64332 always output in octal.
64333 </para>
64334 </listitem></varlistentry>
64335 <varlistentry>
64336 <term><emphasis role="bold">opt_stringptr</emphasis></term>
64337 <listitem>
64338 <para>
64339 This specifies a string value; the address must be a pointer to a
64340 variable that points to a string (for example, of type <literal>uschar *</literal>).
64341 </para>
64342 </listitem></varlistentry>
64343 <varlistentry>
64344 <term><emphasis role="bold">opt_time</emphasis></term>
64345 <listitem>
64346 <para>
64347 This specifies a time interval value. The address must point to a variable of
64348 type <literal>int</literal>. The value that is placed there is a number of seconds.
64349 </para>
64350 </listitem></varlistentry>
64351 </variablelist>
64352 <para>
64353 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
64354 out the values of all the <function>local_scan()</function> options.
64355 </para>
64356 </section>
64357 <section id="SECID208">
64358 <title>Available Exim variables</title>
64359 <para>
64360 <indexterm role="concept">
64361 <primary><function>local_scan()</function> function</primary>
64362 <secondary>available Exim variables</secondary>
64363 </indexterm>
64364 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
64365 are the only ones that are guaranteed to be maintained from release to release.
64366 Note, however, that you can obtain the value of any Exim expansion variable,
64367 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
64368 C variables are as follows:
64369 </para>
64370 <variablelist>
64371 <varlistentry>
64372 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
64373 <listitem>
64374 <para>
64375 This variable contains the number of lines in the message&#x2019;s body.
64376 It is not valid if the <option>spool_files_wireformat</option> option is used.
64377 </para>
64378 </listitem></varlistentry>
64379 <varlistentry>
64380 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
64381 <listitem>
64382 <para>
64383 This variable contains the number of binary zero bytes in the message&#x2019;s body.
64384 It is not valid if the <option>spool_files_wireformat</option> option is used.
64385 </para>
64386 </listitem></varlistentry>
64387 <varlistentry>
64388 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
64389 <listitem>
64390 <para>
64391 This variable is set to zero when no debugging is taking place. Otherwise, it
64392 is a bitmap of debugging selectors. Two bits are identified for use in
64393 <function>local_scan()</function>; they are defined as macros:
64394 </para>
64395 <itemizedlist>
64396 <listitem>
64397 <para>
64398 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
64399 testing option that is not privileged &ndash; any caller may set it. All the
64400 other selector bits can be set only by admin users.
64401 </para>
64402 </listitem>
64403 <listitem>
64404 <para>
64405 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
64406 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
64407 of debugging bits.
64408 </para>
64409 </listitem>
64410 </itemizedlist>
64411 <para>
64412 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
64413 selected, you should use code like this:
64414 </para>
64415 <literallayout class="monospaced">
64416 if ((debug_selector &amp; D_local_scan) != 0)
64417   debug_printf("xxx", ...);
64418 </literallayout>
64419 </listitem></varlistentry>
64420 <varlistentry>
64421 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
64422 <listitem>
64423 <para>
64424 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
64425 variable <option>expand_string_message</option> contains the error message, zero-terminated.
64426 </para>
64427 </listitem></varlistentry>
64428 <varlistentry>
64429 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
64430 <listitem>
64431 <para>
64432 A pointer to a chain of header lines. The <option>header_line</option> structure is
64433 discussed below.
64434 </para>
64435 </listitem></varlistentry>
64436 <varlistentry>
64437 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
64438 <listitem>
64439 <para>
64440 A pointer to the last of the header lines.
64441 </para>
64442 </listitem></varlistentry>
64443 <varlistentry>
64444 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
64445 <listitem>
64446 <para>
64447 The value of the <option>headers_charset</option> configuration option.
64448 </para>
64449 </listitem></varlistentry>
64450 <varlistentry>
64451 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
64452 <listitem>
64453 <para>
64454 This variable is TRUE during a host checking session that is initiated by the
64455 <option>-bh</option> command line option.
64456 </para>
64457 </listitem></varlistentry>
64458 <varlistentry>
64459 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
64460 <listitem>
64461 <para>
64462 The IP address of the interface that received the message, as a string. This
64463 is NULL for locally submitted messages.
64464 </para>
64465 </listitem></varlistentry>
64466 <varlistentry>
64467 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
64468 <listitem>
64469 <para>
64470 The port on which this message was received. When testing with the <option>-bh</option>
64471 command line option, the value of this variable is -1 unless a port has been
64472 specified via the <option>-oMi</option> option.
64473 </para>
64474 </listitem></varlistentry>
64475 <varlistentry>
64476 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
64477 <listitem>
64478 <para>
64479 This variable contains Exim&#x2019;s message id for the incoming message (the value of
64480 <varname>$message_exim_id</varname>) as a zero-terminated string.
64481 </para>
64482 </listitem></varlistentry>
64483 <varlistentry>
64484 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
64485 <listitem>
64486 <para>
64487 The name of the protocol by which the message was received.
64488 </para>
64489 </listitem></varlistentry>
64490 <varlistentry>
64491 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
64492 <listitem>
64493 <para>
64494 The number of accepted recipients.
64495 </para>
64496 </listitem></varlistentry>
64497 <varlistentry>
64498 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
64499 <listitem>
64500 <para>
64501 <indexterm role="concept">
64502 <primary>recipient</primary>
64503 <secondary>adding in local scan</secondary>
64504 </indexterm>
64505 <indexterm role="concept">
64506 <primary>recipient</primary>
64507 <secondary>removing in local scan</secondary>
64508 </indexterm>
64509 The list of accepted recipients, held in a vector of length
64510 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
64511 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
64512 below). You can delete recipients by removing them from the vector and
64513 adjusting the value in <option>recipients_count</option>. In particular, by setting
64514 <option>recipients_count</option> to zero you remove all recipients. If you then return the
64515 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
64516 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
64517 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
64518 </para>
64519 </listitem></varlistentry>
64520 <varlistentry>
64521 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
64522 <listitem>
64523 <para>
64524 The envelope sender address. For bounce messages this is the empty string.
64525 </para>
64526 </listitem></varlistentry>
64527 <varlistentry>
64528 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
64529 <listitem>
64530 <para>
64531 The IP address of the sending host, as a string. This is NULL for
64532 locally-submitted messages.
64533 </para>
64534 </listitem></varlistentry>
64535 <varlistentry>
64536 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
64537 <listitem>
64538 <para>
64539 The name of the authentication mechanism that was used, or NULL if the message
64540 was not received over an authenticated SMTP connection.
64541 </para>
64542 </listitem></varlistentry>
64543 <varlistentry>
64544 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
64545 <listitem>
64546 <para>
64547 The name of the sending host, if known.
64548 </para>
64549 </listitem></varlistentry>
64550 <varlistentry>
64551 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
64552 <listitem>
64553 <para>
64554 The port on the sending host.
64555 </para>
64556 </listitem></varlistentry>
64557 <varlistentry>
64558 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
64559 <listitem>
64560 <para>
64561 This variable is TRUE for all SMTP input, including BSMTP.
64562 </para>
64563 </listitem></varlistentry>
64564 <varlistentry>
64565 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
64566 <listitem>
64567 <para>
64568 This variable is TRUE for BSMTP input.
64569 </para>
64570 </listitem></varlistentry>
64571 <varlistentry>
64572 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
64573 <listitem>
64574 <para>
64575 The contents of this variable control which pool of memory is used for new
64576 requests. See section <xref linkend="SECTmemhanloc"/> for details.
64577 </para>
64578 </listitem></varlistentry>
64579 </variablelist>
64580 </section>
64581 <section id="SECID209">
64582 <title>Structure of header lines</title>
64583 <para>
64584 The <option>header_line</option> structure contains the members listed below.
64585 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
64586 (see below). You can cause header lines to be ignored (deleted) by setting
64587 their type to *.
64588 </para>
64589 <variablelist>
64590 <varlistentry>
64591 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
64592 <listitem>
64593 <para>
64594 A pointer to the next header line, or NULL for the last line.
64595 </para>
64596 </listitem></varlistentry>
64597 <varlistentry>
64598 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
64599 <listitem>
64600 <para>
64601 A code identifying certain headers that Exim recognizes. The codes are printing
64602 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
64603 Notice in particular that any header line whose type is * is not transmitted
64604 with the message. This flagging is used for header lines that have been
64605 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
64606 lines.) Effectively, * means <quote>deleted</quote>.
64607 </para>
64608 </listitem></varlistentry>
64609 <varlistentry>
64610 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
64611 <listitem>
64612 <para>
64613 The number of characters in the header line, including the terminating and any
64614 internal newlines.
64615 </para>
64616 </listitem></varlistentry>
64617 <varlistentry>
64618 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
64619 <listitem>
64620 <para>
64621 A pointer to the text of the header. It always ends with a newline, followed by
64622 a zero byte. Internal newlines are preserved.
64623 </para>
64624 </listitem></varlistentry>
64625 </variablelist>
64626 </section>
64627 <section id="SECID210">
64628 <title>Structure of recipient items</title>
64629 <para>
64630 The <option>recipient_item</option> structure contains these members:
64631 </para>
64632 <variablelist>
64633 <varlistentry>
64634 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
64635 <listitem>
64636 <para>
64637 This is a pointer to the recipient address as it was received.
64638 </para>
64639 </listitem></varlistentry>
64640 <varlistentry>
64641 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
64642 <listitem>
64643 <para>
64644 This is used in later Exim processing when top level addresses are created by
64645 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
64646 and must always contain -1 at this stage.
64647 </para>
64648 </listitem></varlistentry>
64649 <varlistentry>
64650 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
64651 <listitem>
64652 <para>
64653 If this value is not NULL, bounce messages caused by failing to deliver to the
64654 recipient are sent to the address it contains. In other words, it overrides the
64655 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
64656 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
64657 an unqualified address, Exim qualifies it using the domain from
64658 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
64659 is NULL for all recipients.
64660 </para>
64661 </listitem></varlistentry>
64662 </variablelist>
64663 </section>
64664 <section id="SECID211">
64665 <title>Available Exim functions</title>
64666 <para>
64667 <indexterm role="concept">
64668 <primary><function>local_scan()</function> function</primary>
64669 <secondary>available Exim functions</secondary>
64670 </indexterm>
64671 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
64672 These are the only ones that are guaranteed to be maintained from release to
64673 release:
64674 </para>
64675 <variablelist>
64676 <varlistentry>
64677 <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>
64678 <listitem>
64679 <para>
64680 This function creates a child process that runs the command specified by
64681 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
64682 be NULL if no environment variables are to be passed. A new umask is supplied
64683 for the process in <option>newumask</option>.
64684 </para>
64685 <para>
64686 Pipes to the standard input and output of the new process are set up
64687 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
64688 standard error is cloned to the standard output. If there are any file
64689 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
64690 argument is TRUE, the new process is made into a process group leader.
64691 </para>
64692 <para>
64693 The function returns the pid of the new process, or -1 if things go wrong.
64694 </para>
64695 </listitem></varlistentry>
64696 <varlistentry>
64697 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
64698 <listitem>
64699 <para>
64700 This function waits for a child process to terminate, or for a timeout (in
64701 seconds) to expire. A timeout value of zero means wait as long as it takes. The
64702 return value is as follows:
64703 </para>
64704 <itemizedlist>
64705 <listitem>
64706 <para>
64707 &gt;= 0
64708 </para>
64709 <para>
64710 The process terminated by a normal exit and the value is the process
64711 ending status.
64712 </para>
64713 </listitem>
64714 <listitem>
64715 <para>
64716 &lt; 0 and &gt; &ndash;256
64717 </para>
64718 <para>
64719 The process was terminated by a signal and the value is the negation of the
64720 signal number.
64721 </para>
64722 </listitem>
64723 <listitem>
64724 <para>
64725 &ndash;256
64726 </para>
64727 <para>
64728 The process timed out.
64729 </para>
64730 </listitem>
64731 <listitem>
64732 <para>
64733 &ndash;257
64734 </para>
64735 <para>
64736 The was some other error in wait(); <option>errno</option> is still set.
64737 </para>
64738 </listitem>
64739 </itemizedlist>
64740 </listitem></varlistentry>
64741 <varlistentry>
64742 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
64743 <listitem>
64744 <para>
64745 This function provide you with a means of submitting a new message to
64746 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
64747 want, but this packages it all up for you.) The function creates a pipe,
64748 forks a subprocess that is running
64749 </para>
64750 <literallayout class="monospaced">
64751 exim -t -oem -oi -f &lt;&gt;
64752 </literallayout>
64753 <para>
64754 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
64755 that is connected to the standard input. The yield of the function is the PID
64756 of the subprocess. You can then write a message to the file descriptor, with
64757 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
64758 </para>
64759 <para>
64760 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
64761 finish and to collect its ending status. A timeout value of zero is usually
64762 fine in this circumstance. Unless you have made a mistake with the recipient
64763 addresses, you should get a return code of zero.
64764 </para>
64765 </listitem></varlistentry>
64766 <varlistentry>
64767 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
64768 <listitem>
64769 <para>
64770 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
64771 that it runs is:
64772 </para>
64773 <literallayout>
64774 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
64775 </literallayout>
64776 <para>
64777 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
64778 </para>
64779 </listitem></varlistentry>
64780 <varlistentry>
64781 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
64782 <listitem>
64783 <para>
64784 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
64785 output is written to the standard error stream. If no debugging is selected,
64786 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
64787 conditional on the <literal>local_scan</literal> debug selector by coding like this:
64788 </para>
64789 <literallayout class="monospaced">
64790 if ((debug_selector &amp; D_local_scan) != 0)
64791   debug_printf("xxx", ...);
64792 </literallayout>
64793 </listitem></varlistentry>
64794 <varlistentry>
64795 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
64796 <listitem>
64797 <para>
64798 This is an interface to Exim&#x2019;s string expansion code. The return value is the
64799 expanded string, or NULL if there was an expansion failure.
64800 The C variable <option>expand_string_message</option> contains an error message after an
64801 expansion failure. If expansion does not change the string, the return value is
64802 the pointer to the input string. Otherwise, the return value points to a new
64803 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
64804 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
64805 </para>
64806 </listitem></varlistentry>
64807 <varlistentry>
64808 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
64809 <listitem>
64810 <para>
64811 This function allows you to an add additional header line at the end of the
64812 existing ones. The first argument is the type, and should normally be a space
64813 character. The second argument is a format string and any number of
64814 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
64815 if you want, and you must ensure that the string ends with a newline.
64816 </para>
64817 </listitem></varlistentry>
64818 <varlistentry>
64819 <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>
64820 <listitem>
64821 <para>
64822 This function adds a new header line at a specified point in the header
64823 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
64824 </para>
64825 <para>
64826 If <option>name</option> is NULL, the new header is added at the end of the chain if
64827 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
64828 NULL, the header lines are searched for the first non-deleted header that
64829 matches the name. If one is found, the new header is added before it if
64830 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
64831 found header and any adjacent subsequent ones with the same name (even if
64832 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
64833 option controls where the header is added. If it is true, addition is at the
64834 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
64835 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
64836 </para>
64837 <literallayout class="monospaced">
64838 header_add_at_position(TRUE, US"Received", TRUE,
64839   ' ', "X-xxx: ...");
64840 </literallayout>
64841 <para>
64842 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
64843 there may not be if <option>received_header_text</option> expands to an empty string.
64844 </para>
64845 </listitem></varlistentry>
64846 <varlistentry>
64847 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
64848 <listitem>
64849 <para>
64850 This function removes header lines. If <option>occurrence</option> is zero or negative, all
64851 occurrences of the header are removed. If occurrence is greater than zero, that
64852 particular instance of the header is removed. If no header(s) can be found that
64853 match the specification, the function does nothing.
64854 </para>
64855 </listitem></varlistentry>
64856 <varlistentry>
64857 <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>
64858 <listitem>
64859 <para>
64860 This function tests whether the given header has the given name. It is not just
64861 a string comparison, because white space is permitted between the name and the
64862 colon. If the <option>notdel</option> argument is true, a false return is forced for all
64863 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
64864 </para>
64865 <literallayout class="monospaced">
64866 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
64867 </literallayout>
64868 </listitem></varlistentry>
64869 <varlistentry>
64870 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
64871 <listitem>
64872 <para>
64873 <indexterm role="concept">
64874 <primary>base64 encoding</primary>
64875 <secondary>functions for <function>local_scan()</function> use</secondary>
64876 </indexterm>
64877 This function base64-encodes a string, which is passed by address and length.
64878 The text may contain bytes of any value, including zero. The result is passed
64879 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
64880 zero-terminated.
64881 </para>
64882 </listitem></varlistentry>
64883 <varlistentry>
64884 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
64885 <listitem>
64886 <para>
64887 This function decodes a base64-encoded string. Its arguments are a
64888 zero-terminated base64-encoded string and the address of a variable that is set
64889 to point to the result, which is in dynamic memory. The length of the decoded
64890 string is the yield of the function. If the input is invalid base64 data, the
64891 yield is -1. A zero byte is added to the end of the output string to make it
64892 easy to interpret as a C string (assuming it contains no zeros of its own). The
64893 added zero byte is not included in the returned count.
64894 </para>
64895 </listitem></varlistentry>
64896 <varlistentry>
64897 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
64898 <listitem>
64899 <para>
64900 This function checks for a match in a domain list. Domains are always
64901 matched caselessly. The return value is one of the following:
64902 </para>
64903 <literallayout>
64904 <literal>OK     </literal> match succeeded
64905 <literal>FAIL   </literal> match failed
64906 <literal>DEFER  </literal> match deferred
64907 </literallayout>
64908 <para>
64909 DEFER is usually caused by some kind of lookup defer, such as the
64910 inability to contact a database.
64911 </para>
64912 </listitem></varlistentry>
64913 <varlistentry>
64914 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
64915 <listitem>
64916 <para>
64917 This function checks for a match in a local part list. The third argument
64918 controls case-sensitivity. The return values are as for
64919 <emphasis>lss_match_domain()</emphasis>.
64920 </para>
64921 </listitem></varlistentry>
64922 <varlistentry>
64923 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
64924 <listitem>
64925 <para>
64926 This function checks for a match in an address list. The third argument
64927 controls the case-sensitivity of the local part match. The domain is always
64928 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
64929 </para>
64930 </listitem></varlistentry>
64931 <varlistentry>
64932 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
64933 <listitem>
64934 <para>
64935 This function checks for a match in a host list. The most common usage is
64936 expected to be
64937 </para>
64938 <literallayout class="monospaced">
64939 lss_match_host(sender_host_name, sender_host_address, ...)
64940 </literallayout>
64941 <para>
64942 <indexterm role="variable">
64943 <primary><varname>$sender_host_address</varname></primary>
64944 </indexterm>
64945 An empty address field matches an empty item in the host list. If the host name
64946 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
64947 looked up if a host name is required to match an item in the list. The return
64948 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
64949 returns ERROR in the case when it had to look up a host name, but the lookup
64950 failed.
64951 </para>
64952 </listitem></varlistentry>
64953 <varlistentry>
64954 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
64955 <listitem>
64956 <para>
64957 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
64958 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
64959 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
64960 them. It specifies to which log or logs the message is written. The remaining
64961 arguments are a format and relevant insertion arguments. The string should not
64962 contain any newlines, not even at the end.
64963 </para>
64964 </listitem></varlistentry>
64965 <varlistentry>
64966 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
64967 <listitem>
64968 <para>
64969 This function adds an additional recipient to the message. The first argument
64970 is the recipient address. If it is unqualified (has no domain), it is qualified
64971 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
64972 </para>
64973 <para>
64974 This function does not allow you to specify a private <option>errors_to</option> address (as
64975 described with the structure of <option>recipient_item</option> above), because it pre-dates
64976 the addition of that field to the structure. However, it is easy to add such a
64977 value afterwards. For example:
64978 </para>
64979 <literallayout class="monospaced">
64980  receive_add_recipient(US"monitor@mydom.example", -1);
64981  recipients_list[recipients_count-1].errors_to =
64982    US"postmaster@mydom.example";
64983 </literallayout>
64984 </listitem></varlistentry>
64985 <varlistentry>
64986 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
64987 <listitem>
64988 <para>
64989 This is a convenience function to remove a named recipient from the list of
64990 recipients. It returns true if a recipient was removed, and false if no
64991 matching recipient could be found. The argument must be a complete email
64992 address.
64993 </para>
64994 </listitem></varlistentry>
64995 </variablelist>
64996 <para>
64997 <indexterm role="concept">
64998 <primary>RFC 2047</primary>
64999 </indexterm>
65000 </para>
65001 <variablelist>
65002 <varlistentry>
65003 <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>
65004 <listitem>
65005 <para>
65006 This function decodes strings that are encoded according to RFC 2047. Typically
65007 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
65008 from the Q or B encoding into a byte-string. Then, if provided with the name of
65009 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
65010 made  to translate the result to the named character set. If this fails, the
65011 binary string is returned with an error message.
65012 </para>
65013 <para>
65014 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
65015 maximum MIME word length is enforced. The third argument is the target
65016 encoding, or NULL if no translation is wanted.
65017 </para>
65018 <para>
65019 <indexterm role="concept">
65020 <primary>binary zero</primary>
65021 <secondary>in RFC 2047 decoding</secondary>
65022 </indexterm>
65023 <indexterm role="concept">
65024 <primary>RFC 2047</primary>
65025 <secondary>binary zero in</secondary>
65026 </indexterm>
65027 If a binary zero is encountered in the decoded string, it is replaced by the
65028 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
65029 not be 0 because header lines are handled as zero-terminated strings.
65030 </para>
65031 <para>
65032 The function returns the result of processing the string, zero-terminated; if
65033 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
65034 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
65035 </para>
65036 <para>
65037 If an error is encountered, the function returns NULL and uses the <option>error</option>
65038 argument to return an error message. The variable pointed to by <option>error</option> is
65039 set to NULL if there is no error; it may be set non-NULL even when the function
65040 returns a non-NULL value if decoding was successful, but there was a problem
65041 with translation.
65042 </para>
65043 </listitem></varlistentry>
65044 <varlistentry>
65045 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
65046 <listitem>
65047 <para>
65048 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
65049 below.
65050 </para>
65051 </listitem></varlistentry>
65052 <varlistentry>
65053 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,BOOL,&nbsp;...)</emphasis></term>
65054 <listitem>
65055 <para>
65056 The arguments of this function are almost like <function>printf()</function>; it writes to the SMTP
65057 output stream. You should use this function only when there is an SMTP output
65058 stream, that is, when the incoming message is being received via interactive
65059 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
65060 is FALSE. If you want to test for an incoming message from another host (as
65061 opposed to a local process that used the <option>-bs</option> command line option), you can
65062 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
65063 is involved.
65064 </para>
65065 <para>
65066 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
65067 output function, so it can be used for all forms of SMTP connection.
65068 </para>
65069 <para>
65070 The second argument is used to request that the data be buffered
65071 (when TRUE) or flushed (along with any previously buffered, when FALSE).
65072 This is advisory only, but likely to save on system-calls and packets
65073 sent when a sequence of calls to the function are made.
65074 </para>
65075 <para>
65076 The argument was added in Exim version 4.90 - changing the API/ABI.
65077 Nobody noticed until 4.93 was imminent, at which point the
65078 ABI version number was incremented.
65079 </para>
65080 <para>
65081 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
65082 must start with an appropriate response code: 550 if you are going to return
65083 LOCAL_SCAN_REJECT, 451 if you are going to return
65084 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
65085 initial lines of a multi-line response, the code must be followed by a hyphen
65086 to indicate that the line is not the final response line. You must also ensure
65087 that the lines you write terminate with CRLF. For example:
65088 </para>
65089 <literallayout class="monospaced">
65090 smtp_printf("550-this is some extra info\r\n");
65091 return LOCAL_SCAN_REJECT;
65092 </literallayout>
65093 <para>
65094 Note that you can also create multi-line responses by including newlines in
65095 the data returned via the <option>return_text</option> argument. The added value of using
65096 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
65097 multiple output lines.
65098 </para>
65099 <para>
65100 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
65101 does not
65102 guarantee a flush of
65103 pending output, and therefore does not test
65104 the state of the stream. (In the main code of Exim, flushing and error
65105 detection is done when Exim is ready for the next SMTP input command.) If
65106 you want to flush the output and check for an error (for example, the
65107 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
65108 arguments. It flushes the output stream, and returns a non-zero value if there
65109 is an error.
65110 </para>
65111 </listitem></varlistentry>
65112 <varlistentry revisionflag="changed">
65113 <term><emphasis role="bold">void&nbsp;*store_get(int,BOOL)</emphasis></term>
65114 <listitem>
65115 <para revisionflag="changed">
65116 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
65117 chunk of memory whose size is given by the first argument.
65118 The second argument should be given as TRUE if the memory will be used for
65119 data possibly coming from an attacker (eg. the message content),
65120 FALSE if it is locally-sourced.
65121 Exim bombs out if it ever
65122 runs out of memory. See the next section for a discussion of memory handling.
65123 </para>
65124 </listitem></varlistentry>
65125 <varlistentry>
65126 <term><emphasis role="bold">void&nbsp;*store_get_perm(int,BOOL)</emphasis></term>
65127 <listitem>
65128 <para>
65129 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
65130 permanent pool. See the next section for a discussion of memory handling.
65131 </para>
65132 </listitem></varlistentry>
65133 <varlistentry>
65134 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
65135 <listitem>
65136 <para>
65137 See below.
65138 </para>
65139 </listitem></varlistentry>
65140 <varlistentry>
65141 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
65142 <listitem>
65143 <para>
65144 See below.
65145 </para>
65146 </listitem></varlistentry>
65147 <varlistentry>
65148 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
65149 <listitem>
65150 <para>
65151 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
65152 The first makes a copy of an entire string. The second copies up to a maximum
65153 number of characters, indicated by the second argument. The third uses a format
65154 and insertion arguments to create a new string. In each case, the result is a
65155 pointer to a new string in the current memory pool. See the next section for
65156 more discussion.
65157 </para>
65158 </listitem></varlistentry>
65159 </variablelist>
65160 </section>
65161 <section id="SECTmemhanloc">
65162 <title>More about Exim&#x2019;s memory handling</title>
65163 <para>
65164 <indexterm role="concept">
65165 <primary><function>local_scan()</function> function</primary>
65166 <secondary>memory handling</secondary>
65167 </indexterm>
65168 No function is provided for freeing memory, because that is never needed.
65169 The dynamic memory that Exim uses when receiving a message is automatically
65170 recycled if another message is received by the same process (this applies only
65171 to incoming SMTP connections &ndash; other input methods can supply only one
65172 message at a time). After receiving the last message, a reception process
65173 terminates.
65174 </para>
65175 <para>
65176 Because it is recycled, the normal dynamic memory cannot be used for holding
65177 data that must be preserved over a number of incoming messages on the same SMTP
65178 connection. However, Exim in fact uses two pools of dynamic memory; the second
65179 one is not recycled, and can be used for this purpose.
65180 </para>
65181 <para>
65182 If you want to allocate memory that remains available for subsequent messages
65183 in the same SMTP connection, you should set
65184 </para>
65185 <literallayout class="monospaced">
65186 store_pool = POOL_PERM
65187 </literallayout>
65188 <para>
65189 before calling the function that does the allocation. There is no need to
65190 restore the value if you do not need to; however, if you do want to revert to
65191 the normal pool, you can either restore the previous value of <option>store_pool</option> or
65192 set it explicitly to POOL_MAIN.
65193 </para>
65194 <para>
65195 The pool setting applies to all functions that get dynamic memory, including
65196 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
65197 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
65198 block of memory from the permanent pool while preserving the value of
65199 <option>store_pool</option>.
65200 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
65201 </para>
65202 </section>
65203 </chapter>
65204
65205 <chapter id="CHAPsystemfilter">
65206 <title>System-wide message filtering</title>
65207 <para>
65208 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
65209 <primary>filter</primary>
65210 <secondary>system filter</secondary>
65211 </indexterm>
65212 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
65213 <primary>filtering all mail</primary>
65214 </indexterm>
65215 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
65216 <primary>system filter</primary>
65217 </indexterm>
65218 The previous chapters (on ACLs and the local scan function) describe checks
65219 that can be applied to messages before they are accepted by a host. There is
65220 also a mechanism for checking messages once they have been received, but before
65221 they are delivered. This is called the <emphasis>system filter</emphasis>.
65222 </para>
65223 <para>
65224 The system filter operates in a similar manner to users&#x2019; filter files, but it
65225 is run just once per message (however many recipients the message has).
65226 It should not normally be used as a substitute for routing, because <option>deliver</option>
65227 commands in a system router provide new envelope recipient addresses.
65228 The system filter must be an Exim filter. It cannot be a Sieve filter.
65229 </para>
65230 <para>
65231 The system filter is run at the start of a delivery attempt, before any routing
65232 is done. If a message fails to be completely delivered at the first attempt,
65233 the system filter is run again at the start of every retry.
65234 If you want your filter to do something only once per message, you can make use
65235 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
65236 prevent it happening on retries.
65237 </para>
65238 <para>
65239 <indexterm role="variable">
65240 <primary><varname>$domain</varname></primary>
65241 </indexterm>
65242 <indexterm role="variable">
65243 <primary><varname>$local_part</varname></primary>
65244 </indexterm>
65245 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
65246 specific to individual recipient addresses, such as <varname>$local_part</varname> and
65247 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
65248 you want to run a centrally-specified filter for each recipient address
65249 independently, you can do so by setting up a suitable <command>redirect</command> router, as
65250 described in section <xref linkend="SECTperaddfil"/> below.
65251 </para>
65252 <section id="SECID212">
65253 <title>Specifying a system filter</title>
65254 <para>
65255 <indexterm role="concept">
65256 <primary>uid (user id)</primary>
65257 <secondary>system filter</secondary>
65258 </indexterm>
65259 <indexterm role="concept">
65260 <primary>gid (group id)</primary>
65261 <secondary>system filter</secondary>
65262 </indexterm>
65263 The name of the file that contains the system filter must be specified by
65264 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
65265 other than root, you must also set <option>system_filter_user</option> and
65266 <option>system_filter_group</option> as appropriate. For example:
65267 </para>
65268 <literallayout class="monospaced">
65269 system_filter = /etc/mail/exim.filter
65270 system_filter_user = exim
65271 </literallayout>
65272 <para>
65273 If a system filter generates any deliveries directly to files or pipes (via the
65274 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
65275 specified by setting <option>system_filter_file_transport</option> and
65276 <option>system_filter_pipe_transport</option>, respectively. Similarly,
65277 <option>system_filter_reply_transport</option> must be set to handle any messages generated
65278 by the <option>reply</option> command.
65279 </para>
65280 </section>
65281 <section id="SECID213">
65282 <title>Testing a system filter</title>
65283 <para>
65284 You can run simple tests of a system filter in the same way as for a user
65285 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
65286 are permitted only in system filters are recognized.
65287 </para>
65288 <para>
65289 If you want to test the combined effect of a system filter and a user filter,
65290 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
65291 </para>
65292 </section>
65293 <section id="SECID214">
65294 <title>Contents of a system filter</title>
65295 <para>
65296 The language used to specify system filters is the same as for users&#x2019; filter
65297 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
65298 mail filtering</emphasis>. However, there are some additional features that are
65299 available only in system filters; these are described in subsequent sections.
65300 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
65301 they cause errors.
65302 </para>
65303 <para>
65304 <indexterm role="concept">
65305 <primary>frozen messages</primary>
65306 <secondary>manual thaw; testing in filter</secondary>
65307 </indexterm>
65308 There are two special conditions which, though available in users&#x2019; filter
65309 files, are designed for use in system filters. The condition <option>first_delivery</option>
65310 is true only for the first attempt at delivering a message, and
65311 <option>manually_thawed</option> is true only if the message has been frozen, and
65312 subsequently thawed by an admin user. An explicit forced delivery counts as a
65313 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
65314 </para>
65315 <para>
65316 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
65317 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
65318 succeed, it will not be tried again.
65319 If you want Exim to retry an unseen delivery until it succeeds, you should
65320 arrange to set it up every time the filter runs.
65321 </para>
65322 <para>
65323 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
65324 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
65325 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
65326 to which users&#x2019; filter files can refer.
65327 </para>
65328 </section>
65329 <section id="SECID215">
65330 <title>Additional variable for system filters</title>
65331 <para>
65332 <indexterm role="variable">
65333 <primary><varname>$recipients</varname></primary>
65334 </indexterm>
65335 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
65336 of the message (separated by commas and white space), is available in system
65337 filters. It is not available in users&#x2019; filters for privacy reasons.
65338 </para>
65339 </section>
65340 <section id="SECID216">
65341 <title>Defer, freeze, and fail commands for system filters</title>
65342 <para>
65343 <indexterm role="concept">
65344 <primary>freezing messages</primary>
65345 </indexterm>
65346 <indexterm role="concept">
65347 <primary>message</primary>
65348 <secondary>freezing</secondary>
65349 </indexterm>
65350 <indexterm role="concept">
65351 <primary>message</primary>
65352 <secondary>forced failure</secondary>
65353 </indexterm>
65354 <indexterm role="concept">
65355 <primary><option>fail</option></primary>
65356 <secondary>in system filter</secondary>
65357 </indexterm>
65358 <indexterm role="concept">
65359 <primary><option>freeze</option> in system filter</primary>
65360 </indexterm>
65361 <indexterm role="concept">
65362 <primary><option>defer</option> in system filter</primary>
65363 </indexterm>
65364 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
65365 always available in system filters, but are not normally enabled in users&#x2019;
65366 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
65367 for the <command>redirect</command> router.) These commands can optionally be followed by the
65368 word <option>text</option> and a string containing an error message, for example:
65369 </para>
65370 <literallayout class="monospaced">
65371 fail text "this message looks like spam to me"
65372 </literallayout>
65373 <para>
65374 The keyword <option>text</option> is optional if the next character is a double quote.
65375 </para>
65376 <para>
65377 The <option>defer</option> command defers delivery of the original recipients of the
65378 message. The <option>fail</option> command causes all the original recipients to be failed,
65379 and a bounce message to be created. The <option>freeze</option> command suspends all
65380 delivery attempts for the original recipients. In all cases, any new deliveries
65381 that are specified by the filter are attempted as normal after the filter has
65382 run.
65383 </para>
65384 <para>
65385 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
65386 not manually frozen since. This means that automatic freezing by a system
65387 filter can be used as a way of checking out suspicious messages. If a message
65388 is found to be all right, manually unfreezing it allows it to be delivered.
65389 </para>
65390 <para>
65391 <indexterm role="concept">
65392 <primary>log</primary>
65393 <secondary><option>fail</option> command log line</secondary>
65394 </indexterm>
65395 <indexterm role="concept">
65396 <primary><option>fail</option></primary>
65397 <secondary>log line; reducing</secondary>
65398 </indexterm>
65399 The text given with a fail command is used as part of the bounce message as
65400 well as being written to the log. If the message is quite long, this can fill
65401 up a lot of log space when such failures are common. To reduce the size of the
65402 log message, Exim interprets the text in a special way if it starts with the
65403 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
65404 strings is written to the log, and the rest of the text is used in the bounce
65405 message. For example:
65406 </para>
65407 <literallayout class="monospaced">
65408 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
65409      because it contains attachments that we are \
65410      not prepared to receive."
65411 </literallayout>
65412 <para>
65413 <indexterm role="concept">
65414 <primary>loop</primary>
65415 <secondary>caused by <option>fail</option></secondary>
65416 </indexterm>
65417 Take great care with the <option>fail</option> command when basing the decision to fail on
65418 the contents of the message, because the bounce message will of course include
65419 the contents of the original message and will therefore trigger the <option>fail</option>
65420 command again (causing a mail loop) unless steps are taken to prevent this.
65421 Testing the <option>error_message</option> condition is one way to prevent this. You could
65422 use, for example
65423 </para>
65424 <literallayout class="monospaced">
65425 if $message_body contains "this is spam" and not error_message
65426 then fail text "spam is not wanted here" endif
65427 </literallayout>
65428 <para>
65429 though of course that might let through unwanted bounce messages. The
65430 alternative is clever checking of the body and/or headers to detect bounces
65431 generated by the filter.
65432 </para>
65433 <para>
65434 The interpretation of a system filter file ceases after a
65435 <option>defer</option>,
65436 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
65437 set up earlier in the filter file are honoured, so you can use a sequence such
65438 as
65439 </para>
65440 <literallayout class="monospaced">
65441 mail ...
65442 freeze
65443 </literallayout>
65444 <para>
65445 to send a specified message when the system filter is freezing (or deferring or
65446 failing) a message. The normal deliveries for the message do not, of course,
65447 take place.
65448 </para>
65449 </section>
65450 <section id="SECTaddremheasys">
65451 <title>Adding and removing headers in a system filter</title>
65452 <para>
65453 <indexterm role="concept">
65454 <primary>header lines</primary>
65455 <secondary>adding; in system filter</secondary>
65456 </indexterm>
65457 <indexterm role="concept">
65458 <primary>header lines</primary>
65459 <secondary>removing; in system filter</secondary>
65460 </indexterm>
65461 <indexterm role="concept">
65462 <primary>filter</primary>
65463 <secondary>header lines; adding/removing</secondary>
65464 </indexterm>
65465 Two filter commands that are available only in system filters are:
65466 </para>
65467 <literallayout class="monospaced">
65468 headers add &lt;string&gt;
65469 headers remove &lt;string&gt;
65470 </literallayout>
65471 <para>
65472 The argument for the <option>headers add</option> is a string that is expanded and then
65473 added to the end of the message&#x2019;s headers. It is the responsibility of the
65474 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
65475 space is ignored, and if the string is otherwise empty, or if the expansion is
65476 forced to fail, the command has no effect.
65477 </para>
65478 <para>
65479 You can use <quote>\n</quote> within the string, followed by white space, to specify
65480 continued header lines. More than one header may be added in one command by
65481 including <quote>\n</quote> within the string without any following white space. For
65482 example:
65483 </para>
65484 <literallayout class="monospaced">
65485 headers add "X-header-1: ....\n  \
65486              continuation of X-header-1 ...\n\
65487              X-header-2: ...."
65488 </literallayout>
65489 <para>
65490 Note that the header line continuation white space after the first newline must
65491 be placed before the backslash that continues the input string, because white
65492 space after input continuations is ignored.
65493 </para>
65494 <para>
65495 The argument for <option>headers remove</option> is a colon-separated list of header names.
65496 This command applies only to those headers that are stored with the message;
65497 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
65498 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
65499 header with the same name, they are all removed.
65500 </para>
65501 <para>
65502 The <option>headers</option> command in a system filter makes an immediate change to the set
65503 of header lines that was received with the message (with possible additions
65504 from ACL processing). Subsequent commands in the system filter operate on the
65505 modified set, which also forms the basis for subsequent message delivery.
65506 Unless further modified during routing or transporting, this set of headers is
65507 used for all recipients of the message.
65508 </para>
65509 <para>
65510 During routing and transporting, the variables that refer to the contents of
65511 header lines refer only to those lines that are in this set. Thus, header lines
65512 that are added by a system filter are visible to users&#x2019; filter files and to all
65513 routers and transports. This contrasts with the manipulation of header lines by
65514 routers and transports, which is not immediate, but which instead is saved up
65515 until the message is actually being written (see section
65516 <xref linkend="SECTheadersaddrem"/>).
65517 </para>
65518 <para>
65519 If the message is not delivered at the first attempt, header lines that were
65520 added by the system filter are stored with the message, and so are still
65521 present at the next delivery attempt. Header lines that were removed are still
65522 present, but marked <quote>deleted</quote> so that they are not transported with the
65523 message. For this reason, it is usual to make the <option>headers</option> command
65524 conditional on <option>first_delivery</option> so that the set of header lines is not
65525 modified more than once.
65526 </para>
65527 <para>
65528 Because header modification in a system filter acts immediately, you have to
65529 use an indirect approach if you want to modify the contents of a header line.
65530 For example:
65531 </para>
65532 <literallayout class="monospaced">
65533 headers add "Old-Subject: $h_subject:"
65534 headers remove "Subject"
65535 headers add "Subject: new subject (was: $h_old-subject:)"
65536 headers remove "Old-Subject"
65537 </literallayout>
65538 </section>
65539 <section id="SECID217">
65540 <title>Setting an errors address in a system filter</title>
65541 <para>
65542 <indexterm role="concept">
65543 <primary>envelope from</primary>
65544 </indexterm>
65545 <indexterm role="concept">
65546 <primary>envelope sender</primary>
65547 </indexterm>
65548 In a system filter, if a <option>deliver</option> command is followed by
65549 </para>
65550 <literallayout class="monospaced">
65551 errors_to &lt;some address&gt;
65552 </literallayout>
65553 <para>
65554 in order to change the envelope sender (and hence the error reporting) for that
65555 delivery, any address may be specified. (In a user filter, only the current
65556 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
65557 might use
65558 </para>
65559 <literallayout class="monospaced">
65560 unseen deliver monitor@spying.example errors_to root@local.example
65561 </literallayout>
65562 <para>
65563 to take a copy which would not be sent back to the normal error reporting
65564 address if its delivery failed.
65565 </para>
65566 </section>
65567 <section id="SECTperaddfil">
65568 <title>Per-address filtering</title>
65569 <para>
65570 <indexterm role="variable">
65571 <primary><varname>$domain</varname></primary>
65572 </indexterm>
65573 <indexterm role="variable">
65574 <primary><varname>$local_part</varname></primary>
65575 </indexterm>
65576 In contrast to the system filter, which is run just once per message for each
65577 delivery attempt, it is also possible to set up a system-wide filtering
65578 operation that runs once for each recipient address. In this case, variables
65579 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
65580 filter file could be made dependent on them. This is an example of a router
65581 which implements such a filter:
65582 </para>
65583 <literallayout class="monospaced">
65584 central_filter:
65585   check_local_user
65586   driver = redirect
65587   domains = +local_domains
65588   file = /central/filters/$local_part_data
65589   no_verify
65590   allow_filter
65591   allow_freeze
65592 </literallayout>
65593 <para>
65594 The filter is run in a separate process under its own uid. Therefore, either
65595 <option>check_local_user</option> must be set (as above), in which case the filter is run as
65596 the local user, or the <option>user</option> option must be used to specify which user to
65597 use. If both are set, <option>user</option> overrides.
65598 </para>
65599 <para>
65600 Care should be taken to ensure that none of the commands in the filter file
65601 specify a significant delivery if the message is to go on to be delivered to
65602 its intended recipient. The router will not then claim to have dealt with the
65603 address, so it will be passed on to subsequent routers to be delivered in the
65604 normal way.
65605 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
65606 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
65607 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
65608 </para>
65609 </section>
65610 </chapter>
65611
65612 <chapter id="CHAPmsgproc">
65613 <title>Message processing</title>
65614 <para>
65615 <indexterm role="concept" id="IIDmesproc" class="startofrange">
65616 <primary>message</primary>
65617 <secondary>general processing</secondary>
65618 </indexterm>
65619 Exim performs various transformations on the sender and recipient addresses of
65620 all messages that it handles, and also on the messages&#x2019; header lines. Some of
65621 these are optional and configurable, while others always take place. All of
65622 this processing, except rewriting as a result of routing, and the addition or
65623 removal of header lines while delivering, happens when a message is received,
65624 before it is placed on Exim&#x2019;s queue.
65625 </para>
65626 <para>
65627 Some of the automatic processing takes place by default only for
65628 <quote>locally-originated</quote> messages. This adjective is used to describe messages
65629 that are not received over TCP/IP, but instead are passed to an Exim process on
65630 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
65631 set up by the <option>-bs</option> command line option.
65632 </para>
65633 <para>
65634 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
65635 or ::1) are not considered to be locally-originated. Exim does not treat the
65636 loopback interface specially in any way.
65637 </para>
65638 <para>
65639 If you want the loopback interface to be treated specially, you must ensure
65640 that there are appropriate entries in your ACLs.
65641 </para>
65642 <section id="SECTsubmodnon">
65643 <title>Submission mode for non-local messages</title>
65644 <para>
65645 <indexterm role="concept">
65646 <primary>message</primary>
65647 <secondary>submission</secondary>
65648 </indexterm>
65649 <indexterm role="concept">
65650 <primary>submission mode</primary>
65651 </indexterm>
65652 Processing that happens automatically for locally-originated messages (unless
65653 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
65654 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
65655 state. Submission mode is set by the modifier
65656 </para>
65657 <literallayout class="monospaced">
65658 control = submission
65659 </literallayout>
65660 <para>
65661 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
65662 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
65663 a local submission, and is normally used when the source of the message is
65664 known to be an MUA running on a client host (as opposed to an MTA). For
65665 example, to set submission mode for messages originating on the IPv4 loopback
65666 interface, you could include the following in the MAIL ACL:
65667 </para>
65668 <literallayout class="monospaced">
65669 warn  hosts = 127.0.0.1
65670       control = submission
65671 </literallayout>
65672 <para>
65673 <indexterm role="concept">
65674 <primary><option>sender_retain</option> submission option</primary>
65675 </indexterm>
65676 There are some options that can be used when setting submission mode. A slash
65677 is used to separate options. For example:
65678 </para>
65679 <literallayout class="monospaced">
65680 control = submission/sender_retain
65681 </literallayout>
65682 <para>
65683 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
65684 true and <option>local_from_check</option> false for the current incoming message. The first
65685 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
65686 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
65687 authenticated sender. With this setting, Exim still fixes up messages by adding
65688 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
65689 attempt to check sender authenticity in header lines.
65690 </para>
65691 <para>
65692 When <option>sender_retain</option> is not set, a submission mode setting may specify a
65693 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
65694 example:
65695 </para>
65696 <literallayout class="monospaced">
65697 control = submission/domain=some.domain
65698 </literallayout>
65699 <para>
65700 The domain may be empty. How this value is used is described in sections
65701 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
65702 that allows you to specify the user&#x2019;s full name for inclusion in a created
65703 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
65704 </para>
65705 <literallayout class="monospaced">
65706 accept authenticated = *
65707        control = submission/domain=wonderland.example/\
65708                             name=${lookup {$authenticated_id} \
65709                                    lsearch {/etc/exim/namelist}}
65710 </literallayout>
65711 <para>
65712 Because the name may contain any characters, including slashes, the <option>name</option>
65713 option must be given last. The remainder of the string is used as the name. For
65714 the example above, if <filename>/etc/exim/namelist</filename> contains:
65715 </para>
65716 <literallayout class="monospaced">
65717 bigegg:  Humpty Dumpty
65718 </literallayout>
65719 <para>
65720 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
65721 line would be:
65722 </para>
65723 <literallayout class="monospaced">
65724 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
65725 </literallayout>
65726 <para>
65727 <indexterm role="concept">
65728 <primary>return path</primary>
65729 <secondary>in submission mode</secondary>
65730 </indexterm>
65731 By default, submission mode forces the return path to the same address as is
65732 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
65733 specified, the return path is also left unchanged.
65734 </para>
65735 <para>
65736 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
65737 ACL. This means that any sender checks performed before the fix-ups use the
65738 untrusted sender address specified by the user, not the trusted sender address
65739 specified by submission mode. Although this might be slightly unexpected, it
65740 does mean that you can configure ACL checks to spot that a user is trying to
65741 spoof another&#x2019;s address.
65742 </para>
65743 </section>
65744 <section id="SECTlineendings">
65745 <title>Line endings</title>
65746 <para>
65747 <indexterm role="concept">
65748 <primary>line endings</primary>
65749 </indexterm>
65750 <indexterm role="concept">
65751 <primary>carriage return</primary>
65752 </indexterm>
65753 <indexterm role="concept">
65754 <primary>linefeed</primary>
65755 </indexterm>
65756 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
65757 linefeed) is the line ending for messages transmitted over the Internet using
65758 SMTP over TCP/IP. However, within individual operating systems, different
65759 conventions are used. For example, Unix-like systems use just LF, but others
65760 use CRLF or just CR.
65761 </para>
65762 <para>
65763 Exim was designed for Unix-like systems, and internally, it stores messages
65764 using the system&#x2019;s convention of a single LF as a line terminator. When
65765 receiving a message, all line endings are translated to this standard format.
65766 Originally, it was thought that programs that passed messages directly to an
65767 MTA within an operating system would use that system&#x2019;s convention. Experience
65768 has shown that this is not the case; for example, there are Unix applications
65769 that use CRLF in this circumstance. For this reason, and for compatibility with
65770 other MTAs, the way Exim handles line endings for all messages is now as
65771 follows:
65772 </para>
65773 <itemizedlist>
65774 <listitem>
65775 <para>
65776 LF not preceded by CR is treated as a line ending.
65777 </para>
65778 </listitem>
65779 <listitem>
65780 <para>
65781 CR is treated as a line ending; if it is immediately followed by LF, the LF
65782 is ignored.
65783 </para>
65784 </listitem>
65785 <listitem>
65786 <para>
65787 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
65788 nor a local message in the state where a line containing only a dot is a
65789 terminator.
65790 </para>
65791 </listitem>
65792 <listitem>
65793 <para>
65794 If a bare CR is encountered within a header line, an extra space is added after
65795 the line terminator so as not to end the header line. The reasoning behind this
65796 is that bare CRs in header lines are most likely either to be mistakes, or
65797 people trying to play silly games.
65798 </para>
65799 </listitem>
65800 <listitem>
65801 <para>
65802 If the first header line received in a message ends with CRLF, a subsequent
65803 bare LF in a header line is treated in the same way as a bare CR in a header
65804 line.
65805 </para>
65806 </listitem>
65807 </itemizedlist>
65808 </section>
65809 <section id="SECID218">
65810 <title>Unqualified addresses</title>
65811 <para>
65812 <indexterm role="concept">
65813 <primary>unqualified addresses</primary>
65814 </indexterm>
65815 <indexterm role="concept">
65816 <primary>address</primary>
65817 <secondary>qualification</secondary>
65818 </indexterm>
65819 By default, Exim expects every envelope address it receives from an external
65820 host to be fully qualified. Unqualified addresses cause negative responses to
65821 SMTP commands. However, because SMTP is used as a means of transporting
65822 messages from MUAs running on personal workstations, there is sometimes a
65823 requirement to accept unqualified addresses from specific hosts or IP networks.
65824 </para>
65825 <para>
65826 Exim has two options that separately control which hosts may send unqualified
65827 sender or recipient addresses in SMTP commands, namely
65828 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
65829 cases, if an unqualified address is accepted, it is qualified by adding the
65830 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
65831 </para>
65832 <para>
65833 <indexterm role="option">
65834 <primary><option>qualify_domain</option></primary>
65835 </indexterm>
65836 <indexterm role="option">
65837 <primary><option>qualify_recipient</option></primary>
65838 </indexterm>
65839 Unqualified addresses in header lines are automatically qualified for messages
65840 that are locally originated, unless the <option>-bnq</option> option is given on the command
65841 line. For messages received over SMTP, unqualified addresses in header lines
65842 are qualified only if unqualified addresses are permitted in SMTP commands. In
65843 other words, such qualification is also controlled by
65844 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
65845 </para>
65846 </section>
65847 <section id="SECID219">
65848 <title>The UUCP From line</title>
65849 <para>
65850 <indexterm role="concept">
65851 <primary><quote>From</quote> line</primary>
65852 </indexterm>
65853 <indexterm role="concept">
65854 <primary>UUCP</primary>
65855 <secondary><quote>From</quote> line</secondary>
65856 </indexterm>
65857 <indexterm role="concept">
65858 <primary>sender</primary>
65859 <secondary>address</secondary>
65860 </indexterm>
65861 <indexterm role="option">
65862 <primary><option>uucp_from_pattern</option></primary>
65863 </indexterm>
65864 <indexterm role="option">
65865 <primary><option>uucp_from_sender</option></primary>
65866 </indexterm>
65867 <indexterm role="concept">
65868 <primary>envelope from</primary>
65869 </indexterm>
65870 <indexterm role="concept">
65871 <primary>envelope sender</primary>
65872 </indexterm>
65873 <indexterm role="concept">
65874 <primary>Sendmail compatibility</primary>
65875 <secondary><quote>From</quote> line</secondary>
65876 </indexterm>
65877 Messages that have come from UUCP (and some other applications) often begin
65878 with a line containing the envelope sender and a timestamp, following the word
65879 <quote>From</quote>. Examples of two common formats are:
65880 </para>
65881 <literallayout class="monospaced">
65882 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
65883 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
65884 </literallayout>
65885 <para>
65886 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
65887 Exim recognizes such lines at the start of messages that are submitted to it
65888 via the command line (that is, on the standard input). It does not recognize
65889 such lines in incoming SMTP messages, unless the sending host matches
65890 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
65891 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
65892 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
65893 default value matches the two common cases shown above and puts the address
65894 that follows <quote>From</quote> into <varname>$1</varname>.
65895 </para>
65896 <para>
65897 <indexterm role="concept">
65898 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
65899 <secondary>in <quote>From </quote> line handling</secondary>
65900 </indexterm>
65901 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
65902 a trusted user, the message&#x2019;s sender address is constructed by expanding the
65903 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
65904 then parsed as an RFC 2822 address. If there is no domain, the local part is
65905 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
65906 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
65907 </para>
65908 <para>
65909 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
65910 sender address is not changed. This is also the case for incoming SMTP messages
65911 that are permitted to contain <quote>From</quote> lines.
65912 </para>
65913 <para>
65914 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
65915 treated as a data line that starts the body of the message, as it is not valid
65916 as a header line. This also happens if a <quote>From</quote> line is present in an
65917 incoming SMTP message from a source that is not permitted to send them.
65918 </para>
65919 </section>
65920 <section id="SECID220">
65921 <title>Resent- header lines</title>
65922 <para>
65923 <indexterm role="concept">
65924 <primary><option>Resent-</option> header lines</primary>
65925 </indexterm>
65926 <indexterm role="concept">
65927 <primary>header lines</primary>
65928 <secondary>Resent-</secondary>
65929 </indexterm>
65930 RFC 2822 makes provision for sets of header lines starting with the string
65931 <literal>Resent-</literal> to be added to a message when it is resent by the original
65932 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
65933 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
65934 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
65935 </para>
65936 <blockquote>
65937 <para>
65938 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
65939 processing of replies or other such automatic actions on messages.</emphasis>
65940 </para>
65941 </blockquote>
65942 <para>
65943 This leaves things a bit vague as far as other processing actions such as
65944 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
65945 follows:
65946 </para>
65947 <itemizedlist>
65948 <listitem>
65949 <para>
65950 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
65951 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
65952 </para>
65953 </listitem>
65954 <listitem>
65955 <para>
65956 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
65957 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
65958 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
65959 </para>
65960 </listitem>
65961 <listitem>
65962 <para>
65963 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
65964 also removed.
65965 </para>
65966 </listitem>
65967 <listitem>
65968 <para>
65969 For a locally-submitted message,
65970 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
65971 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
65972 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
65973 included in log lines in this case.
65974 </para>
65975 </listitem>
65976 <listitem>
65977 <para>
65978 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
65979 <option>Resent-</option> header lines are present.
65980 </para>
65981 </listitem>
65982 </itemizedlist>
65983 </section>
65984 <section id="SECID221">
65985 <title>The Auto-Submitted: header line</title>
65986 <para>
65987 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
65988 includes the header line:
65989 </para>
65990 <literallayout class="monospaced">
65991 Auto-Submitted: auto-replied
65992 </literallayout>
65993 </section>
65994 <section id="SECID222">
65995 <title>The Bcc: header line</title>
65996 <para>
65997 <indexterm role="concept">
65998 <primary><emphasis>Bcc:</emphasis> header line</primary>
65999 </indexterm>
66000 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
66001 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
66002 extracting its addresses). If <option>-t</option> is not present on the command line, any
66003 existing <emphasis>Bcc:</emphasis> is not removed.
66004 </para>
66005 </section>
66006 <section id="SECID223">
66007 <title>The Date: header line</title>
66008 <para>
66009 <indexterm role="concept">
66010 <primary><emphasis>Date:</emphasis> header line</primary>
66011 </indexterm>
66012 <indexterm role="concept">
66013 <primary>header lines</primary>
66014 <secondary>Date:</secondary>
66015 </indexterm>
66016 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
66017 Exim adds one, using the current date and time, unless the
66018 <option>suppress_local_fixups</option> control has been specified.
66019 </para>
66020 </section>
66021 <section id="SECID224">
66022 <title>The Delivery-date: header line</title>
66023 <para>
66024 <indexterm role="concept">
66025 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
66026 </indexterm>
66027 <indexterm role="option">
66028 <primary><option>delivery_date_remove</option></primary>
66029 </indexterm>
66030 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
66031 set. Exim can be configured to add them to the final delivery of messages. (See
66032 the generic <option>delivery_date_add</option> transport option.) They should not be present
66033 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
66034 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
66035 messages.
66036 </para>
66037 </section>
66038 <section id="SECID225">
66039 <title>The Envelope-to: header line</title>
66040 <para>
66041 <indexterm role="concept">
66042 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
66043 </indexterm>
66044 <indexterm role="concept">
66045 <primary>header lines</primary>
66046 <secondary>Envelope-to:</secondary>
66047 </indexterm>
66048 <indexterm role="option">
66049 <primary><option>envelope_to_remove</option></primary>
66050 </indexterm>
66051 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
66052 Exim can be configured to add them to the final delivery of messages. (See the
66053 generic <option>envelope_to_add</option> transport option.) They should not be present in
66054 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
66055 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
66056 messages.
66057 </para>
66058 </section>
66059 <section id="SECTthefrohea">
66060 <title>The From: header line</title>
66061 <para>
66062 <indexterm role="concept">
66063 <primary><emphasis>From:</emphasis> header line</primary>
66064 </indexterm>
66065 <indexterm role="concept">
66066 <primary>header lines</primary>
66067 <secondary>From:</secondary>
66068 </indexterm>
66069 <indexterm role="concept">
66070 <primary>Sendmail compatibility</primary>
66071 <secondary><quote>From</quote> line</secondary>
66072 </indexterm>
66073 <indexterm role="concept">
66074 <primary>message</primary>
66075 <secondary>submission</secondary>
66076 </indexterm>
66077 <indexterm role="concept">
66078 <primary>submission mode</primary>
66079 </indexterm>
66080 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
66081 adds one if either of the following conditions is true:
66082 </para>
66083 <itemizedlist>
66084 <listitem>
66085 <para>
66086 The envelope sender address is not empty (that is, this is not a bounce
66087 message). The added header line copies the envelope sender address.
66088 </para>
66089 </listitem>
66090 <listitem>
66091 <para>
66092 <indexterm role="variable">
66093 <primary><varname>$authenticated_id</varname></primary>
66094 </indexterm>
66095 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
66096 </para>
66097 <orderedlist numeration="arabic">
66098 <listitem>
66099 <para>
66100 <indexterm role="variable">
66101 <primary><varname>$qualify_domain</varname></primary>
66102 </indexterm>
66103 If no domain is specified by the submission control, the local part is
66104 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
66105 </para>
66106 </listitem>
66107 <listitem>
66108 <para>
66109 If a non-empty domain is specified by the submission control, the local
66110 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
66111 </para>
66112 </listitem>
66113 <listitem>
66114 <para>
66115 If an empty domain is specified by the submission control,
66116 <varname>$authenticated_id</varname> is assumed to be the complete address.
66117 </para>
66118 </listitem>
66119 </orderedlist>
66120 </listitem>
66121 </itemizedlist>
66122 <para>
66123 A non-empty envelope sender takes precedence.
66124 </para>
66125 <para>
66126 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
66127 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
66128 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
66129 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
66130 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
66131 <option>unknown_login</option> configuration option). The address is qualified with
66132 <option>qualify_domain</option>.
66133 </para>
66134 <para>
66135 For compatibility with Sendmail, if an incoming, non-SMTP message has a
66136 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
66137 user, this is replaced by an address containing the user&#x2019;s login name and full
66138 name as described in section <xref linkend="SECTconstr"/>.
66139 </para>
66140 </section>
66141 <section id="SECID226">
66142 <title>The Message-ID: header line</title>
66143 <para>
66144 <indexterm role="concept">
66145 <primary><emphasis>Message-ID:</emphasis> header line</primary>
66146 </indexterm>
66147 <indexterm role="concept">
66148 <primary>header lines</primary>
66149 <secondary>Message-ID:</secondary>
66150 </indexterm>
66151 <indexterm role="concept">
66152 <primary>message</primary>
66153 <secondary>submission</secondary>
66154 </indexterm>
66155 <indexterm role="option">
66156 <primary><option>message_id_header_text</option></primary>
66157 </indexterm>
66158 If a locally-generated or submission-mode incoming message does not contain a
66159 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
66160 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
66161 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
66162 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
66163 message id, preceded by the letter E to ensure it starts with a letter, and
66164 followed by @ and the primary host name. Additional information can be included
66165 in this header line by setting the <option>message_id_header_text</option> and/or
66166 <option>message_id_header_domain</option> options.
66167 </para>
66168 </section>
66169 <section id="SECID227">
66170 <title>The Received: header line</title>
66171 <para>
66172 <indexterm role="concept">
66173 <primary><emphasis>Received:</emphasis> header line</primary>
66174 </indexterm>
66175 <indexterm role="concept">
66176 <primary>header lines</primary>
66177 <secondary>Received:</secondary>
66178 </indexterm>
66179 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
66180 contents are defined by the <option>received_header_text</option> configuration option, and
66181 Exim automatically adds a semicolon and a timestamp to the configured string.
66182 </para>
66183 <para>
66184 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
66185 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
66186 line is the time that the message started to be received. This is the value
66187 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
66188 </para>
66189 <para>
66190 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
66191 changed to the time of acceptance, which is (apart from a small delay while the
66192 -H spool file is written) the earliest time at which delivery could start.
66193 </para>
66194 </section>
66195 <section id="SECID228">
66196 <title>The References: header line</title>
66197 <para>
66198 <indexterm role="concept">
66199 <primary><emphasis>References:</emphasis> header line</primary>
66200 </indexterm>
66201 <indexterm role="concept">
66202 <primary>header lines</primary>
66203 <secondary>References:</secondary>
66204 </indexterm>
66205 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
66206 header line. This is constructed according to the rules that are described in
66207 section 3.64 of RFC 2822 (which states that replies should contain such a
66208 header line), and section 3.14 of RFC 3834 (which states that automatic
66209 responses are not different in this respect). However, because some mail
66210 processing software does not cope well with very long header lines, no more
66211 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
66212 incoming message. If there are more than 12, the first one and then the final
66213 11 are copied, before adding the message ID of the incoming message.
66214 </para>
66215 </section>
66216 <section id="SECID229">
66217 <title>The Return-path: header line</title>
66218 <para>
66219 <indexterm role="concept">
66220 <primary><emphasis>Return-path:</emphasis> header line</primary>
66221 </indexterm>
66222 <indexterm role="concept">
66223 <primary>header lines</primary>
66224 <secondary>Return-path:</secondary>
66225 </indexterm>
66226 <indexterm role="option">
66227 <primary><option>return_path_remove</option></primary>
66228 </indexterm>
66229 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
66230 it does the final delivery of messages. (See the generic <option>return_path_add</option>
66231 transport option.) Therefore, they should not be present in messages in
66232 transit. If the <option>return_path_remove</option> configuration option is set (the
66233 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
66234 </para>
66235 </section>
66236 <section id="SECTthesenhea">
66237 <title>The Sender: header line</title>
66238 <para>
66239 <indexterm role="concept">
66240 <primary><emphasis>Sender:</emphasis> header line</primary>
66241 </indexterm>
66242 <indexterm role="concept">
66243 <primary>message</primary>
66244 <secondary>submission</secondary>
66245 </indexterm>
66246 <indexterm role="concept">
66247 <primary>header lines</primary>
66248 <secondary>Sender:</secondary>
66249 </indexterm>
66250 For a locally-originated message from an untrusted user, Exim may remove an
66251 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
66252 these actions by setting the <option>local_sender_retain</option> option true, the
66253 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
66254 control setting.
66255 </para>
66256 <para>
66257 When a local message is received from an untrusted user and
66258 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
66259 control has not been set, a check is made to see if the address given in the
66260 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
66261 that is expected has the login name as the local part and the value of
66262 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
66263 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
66264 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
66265 line is added to the message.
66266 </para>
66267 <para>
66268 If you set <option>local_from_check</option> false, this checking does not occur. However,
66269 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
66270 <option>local_sender_retain</option> to be true. It is not possible to set both of these
66271 options true at the same time.
66272 </para>
66273 <para>
66274 <indexterm role="concept">
66275 <primary>submission mode</primary>
66276 </indexterm>
66277 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
66278 received over TCP/IP or for messages submitted by trusted users. However, when
66279 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
66280 not specified on the submission control, the following processing takes place:
66281 </para>
66282 <para>
66283 <indexterm role="variable">
66284 <primary><varname>$authenticated_id</varname></primary>
66285 </indexterm>
66286 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
66287 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
66288 created as follows:
66289 </para>
66290 <itemizedlist>
66291 <listitem>
66292 <para>
66293 <indexterm role="variable">
66294 <primary><varname>$qualify_domain</varname></primary>
66295 </indexterm>
66296 If no domain is specified by the submission control, the local part is
66297 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
66298 </para>
66299 </listitem>
66300 <listitem>
66301 <para>
66302 If a non-empty domain is specified by the submission control, the local part
66303 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
66304 </para>
66305 </listitem>
66306 <listitem>
66307 <para>
66308 If an empty domain is specified by the submission control,
66309 <varname>$authenticated_id</varname> is assumed to be the complete address.
66310 </para>
66311 </listitem>
66312 </itemizedlist>
66313 <para>
66314 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
66315 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
66316 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
66317 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
66318 </para>
66319 <para>
66320 <indexterm role="concept">
66321 <primary>return path</primary>
66322 <secondary>created from <emphasis>Sender:</emphasis></secondary>
66323 </indexterm>
66324 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
66325 the message (the envelope sender address) is changed to be the same address,
66326 except in the case of submission mode when <option>sender_retain</option> is specified.
66327 </para>
66328 </section>
66329 <section id="SECTheadersaddrem">
66330 <title>Adding and removing header lines in routers and transports</title>
66331 <para>
66332 <indexterm role="concept">
66333 <primary>header lines</primary>
66334 <secondary>adding; in router or transport</secondary>
66335 </indexterm>
66336 <indexterm role="concept">
66337 <primary>header lines</primary>
66338 <secondary>removing; in router or transport</secondary>
66339 </indexterm>
66340 When a message is delivered, the addition and removal of header lines can be
66341 specified in a system filter, or on any of the routers and transports that
66342 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
66343 modifying headers in a system filter. Header lines can also be added in an ACL
66344 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
66345 </para>
66346 <para>
66347 In contrast to what happens in a system filter, header modifications that are
66348 specified on routers and transports apply only to the particular recipient
66349 addresses that are being processed by those routers and transports. These
66350 changes do not actually take place until a copy of the message is being
66351 transported. Therefore, they do not affect the basic set of header lines, and
66352 they do not affect the values of the variables that refer to header lines.
66353 </para>
66354 <para>
66355 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
66356 the transport cannot refer to the modified header lines, because such
66357 expansions all occur before the message is actually transported.
66358 </para>
66359 <para>
66360 For both routers and transports, the argument of a <option>headers_add</option>
66361 option must be in the form of one or more RFC 2822 header lines, separated by
66362 newlines (coded as <quote>\n</quote>). For example:
66363 </para>
66364 <literallayout class="monospaced">
66365 headers_add = X-added-header: added by $primary_hostname\n\
66366               X-added-second: another added header line
66367 </literallayout>
66368 <para>
66369 Exim does not check the syntax of these added header lines.
66370 </para>
66371 <para>
66372 Multiple <option>headers_add</option> options for a single router or transport can be
66373 specified; the values will append to a single list of header lines.
66374 Each header-line is separately expanded.
66375 </para>
66376 <para>
66377 The argument of a <option>headers_remove</option> option must consist of a colon-separated
66378 list of header names. This is confusing, because header names themselves are
66379 often terminated by colons. In this case, the colons are the list separators,
66380 not part of the names. For example:
66381 </para>
66382 <literallayout class="monospaced">
66383 headers_remove = return-receipt-to:acknowledge-to
66384 </literallayout>
66385 <para>
66386 Multiple <option>headers_remove</option> options for a single router or transport can be
66387 specified; the arguments will append to a single header-names list.
66388 Each item is separately expanded.
66389 Note that colons in complex expansions which are used to
66390 form all or part of a <option>headers_remove</option> list
66391 will act as list separators.
66392 </para>
66393 <para>
66394 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
66395 items are expanded at routing time,
66396 and then associated with all addresses that are
66397 accepted by that router, and also with any new addresses that it generates. If
66398 an address passes through several routers as a result of aliasing or
66399 forwarding, the changes are cumulative.
66400 </para>
66401 <para>
66402 <indexterm role="option">
66403 <primary><option>unseen</option></primary>
66404 </indexterm>
66405 However, this does not apply to multiple routers that result from the use of
66406 the <option>unseen</option> option. Any header modifications that were specified by the
66407 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
66408 </para>
66409 <para>
66410 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
66411 settings cannot be delivered together in a batch, so a transport is always
66412 dealing with a set of addresses that have the same header-processing
66413 requirements.
66414 </para>
66415 <para>
66416 The transport starts by writing the original set of header lines that arrived
66417 with the message, possibly modified by the system filter. As it writes out
66418 these lines, it consults the list of header names that were attached to the
66419 recipient address(es) by <option>headers_remove</option> options in routers, and it also
66420 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
66421 names are on either of these lists are not written out. If there are multiple
66422 instances of any listed header, they are all skipped.
66423 </para>
66424 <para>
66425 After the remaining original header lines have been written, new header
66426 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
66427 the order in which they were attached to the address. These are followed by any
66428 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
66429 </para>
66430 <para>
66431 This way of handling header line modifications in routers and transports has
66432 the following consequences:
66433 </para>
66434 <itemizedlist>
66435 <listitem>
66436 <para>
66437 The original set of header lines, possibly modified by the system filter,
66438 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
66439 to it, at all times.
66440 </para>
66441 </listitem>
66442 <listitem>
66443 <para>
66444 Header lines that are added by a router&#x2019;s
66445 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
66446 expansion syntax in subsequent routers or the transport.
66447 </para>
66448 </listitem>
66449 <listitem>
66450 <para>
66451 Conversely, header lines that are specified for removal by <option>headers_remove</option>
66452 in a router remain visible to subsequent routers and the transport.
66453 </para>
66454 </listitem>
66455 <listitem>
66456 <para>
66457 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
66458 a later router or by a transport.
66459 </para>
66460 </listitem>
66461 <listitem>
66462 <para>
66463 An added header can refer to the contents of an original header that is to be
66464 removed, even it has the same name as the added header. For example:
66465 </para>
66466 <literallayout class="monospaced">
66467 headers_remove = subject
66468 headers_add = Subject: new subject (was: $h_subject:)
66469 </literallayout>
66470 </listitem>
66471 </itemizedlist>
66472 <para>
66473 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
66474 for a <command>redirect</command> router that has the <option>one_time</option> option set.
66475 </para>
66476 </section>
66477 <section id="SECTconstr">
66478 <title>Constructed addresses</title>
66479 <para>
66480 <indexterm role="concept">
66481 <primary>address</primary>
66482 <secondary>constructed</secondary>
66483 </indexterm>
66484 <indexterm role="concept">
66485 <primary>constructed address</primary>
66486 </indexterm>
66487 When Exim constructs a sender address for a locally-generated message, it uses
66488 the form
66489 </para>
66490 <literallayout>
66491 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
66492 </literallayout>
66493 <para>
66494 For example:
66495 </para>
66496 <literallayout class="monospaced">
66497 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
66498 </literallayout>
66499 <para>
66500 The user name is obtained from the <option>-F</option> command line option if set, or
66501 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
66502 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
66503 ampersand character, this is replaced by the login name with the first letter
66504 upper cased, as is conventional in a number of operating systems. See the
66505 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
66506 The <option>unknown_username</option> option can be used to specify user names in cases when
66507 there is no password file entry.
66508 </para>
66509 <para>
66510 <indexterm role="concept">
66511 <primary>RFC 2047</primary>
66512 </indexterm>
66513 In all cases, the user name is made to conform to RFC 2822 by quoting all or
66514 parts of it if necessary. In addition, if it contains any non-printing
66515 characters, it is encoded as described in RFC 2047, which defines a way of
66516 including non-ASCII characters in header lines. The value of the
66517 <option>headers_charset</option> option specifies the name of the encoding that is used (the
66518 characters are assumed to be in this encoding). The setting of
66519 <option>print_topbitchars</option> controls whether characters with the top bit set (that
66520 is, with codes greater than 127) count as printing characters or not.
66521 </para>
66522 </section>
66523 <section id="SECID230">
66524 <title>Case of local parts</title>
66525 <para>
66526 <indexterm role="concept">
66527 <primary>case of local parts</primary>
66528 </indexterm>
66529 <indexterm role="concept">
66530 <primary>local part</primary>
66531 <secondary>case of</secondary>
66532 </indexterm>
66533 RFC 2822 states that the case of letters in the local parts of addresses cannot
66534 be assumed to be non-significant. Exim preserves the case of local parts of
66535 addresses, but by default it uses a lower-cased form when it is routing,
66536 because on most Unix systems, usernames are in lower case and case-insensitive
66537 routing is required. However, any particular router can be made to use the
66538 original case for local parts by setting the <option>caseful_local_part</option> generic
66539 router option.
66540 </para>
66541 <para>
66542 <indexterm role="concept">
66543 <primary>mixed-case login names</primary>
66544 </indexterm>
66545 If you must have mixed-case user names on your system, the best way to proceed,
66546 assuming you want case-independent handling of incoming email, is to set up
66547 your first router to convert incoming local parts in your domains to the
66548 correct case by means of a file lookup. For example:
66549 </para>
66550 <literallayout class="monospaced">
66551 correct_case:
66552   driver = redirect
66553   domains = +local_domains
66554   data = ${lookup{$local_part}cdb\
66555               {/etc/usercased.cdb}{$value}fail}\
66556               @$domain
66557 </literallayout>
66558 <para>
66559 For this router, the local part is forced to lower case by the default action
66560 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
66561 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
66562 on any subsequent routers which process your domains, they will operate on
66563 local parts with the correct case in a case-sensitive manner.
66564 </para>
66565 </section>
66566 <section id="SECID231">
66567 <title>Dots in local parts</title>
66568 <para>
66569 <indexterm role="concept">
66570 <primary>dot</primary>
66571 <secondary>in local part</secondary>
66572 </indexterm>
66573 <indexterm role="concept">
66574 <primary>local part</primary>
66575 <secondary>dots in</secondary>
66576 </indexterm>
66577 RFC 2822 forbids empty components in local parts. That is, an unquoted local
66578 part may not begin or end with a dot, nor have two consecutive dots in the
66579 middle. However, it seems that many MTAs do not enforce this, so Exim permits
66580 empty components for compatibility.
66581 </para>
66582 </section>
66583 <section id="SECID232">
66584 <title>Rewriting addresses</title>
66585 <para>
66586 <indexterm role="concept">
66587 <primary>rewriting</primary>
66588 <secondary>addresses</secondary>
66589 </indexterm>
66590 Rewriting of sender and recipient addresses, and addresses in headers, can
66591 happen automatically, or as the result of configuration options, as described
66592 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
66593 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
66594 </para>
66595 <para>
66596 Automatic rewriting includes qualification, as mentioned above. The other case
66597 in which it can happen is when an incomplete non-local domain is given. The
66598 routing process may cause this to be expanded into the full domain name. For
66599 example, a header such as
66600 </para>
66601 <literallayout class="monospaced">
66602 To: hare@teaparty
66603 </literallayout>
66604 <para>
66605 might get rewritten as
66606 </para>
66607 <literallayout class="monospaced">
66608 To: hare@teaparty.wonderland.fict.example
66609 </literallayout>
66610 <para>
66611 Rewriting as a result of routing is the one kind of message processing that
66612 does not happen at input time, as it cannot be done until the address has
66613 been routed.
66614 </para>
66615 <para>
66616 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
66617 addresses have been routed, in case any of the headers get changed as a
66618 result of routing. However, doing this in practice would hold up many
66619 deliveries for unreasonable amounts of time, just because one address could not
66620 immediately be routed. Exim therefore does not delay other deliveries when
66621 routing of one or more addresses is deferred.
66622 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
66623 </para>
66624 </section>
66625 </chapter>
66626
66627 <chapter id="CHAPSMTP">
66628 <title>SMTP processing</title>
66629 <para>
66630 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
66631 <primary>SMTP</primary>
66632 <secondary>processing details</secondary>
66633 </indexterm>
66634 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
66635 <primary>LMTP</primary>
66636 <secondary>processing details</secondary>
66637 </indexterm>
66638 Exim supports a number of different ways of using the SMTP protocol, and its
66639 LMTP variant, which is an interactive protocol for transferring messages into a
66640 closed mail store application. This chapter contains details of how SMTP is
66641 processed. For incoming mail, the following are available:
66642 </para>
66643 <itemizedlist>
66644 <listitem>
66645 <para>
66646 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
66647 </para>
66648 </listitem>
66649 <listitem>
66650 <para>
66651 SMTP over the standard input and output (the <option>-bs</option> option);
66652 </para>
66653 </listitem>
66654 <listitem>
66655 <para>
66656 Batched SMTP on the standard input (the <option>-bS</option> option).
66657 </para>
66658 </listitem>
66659 </itemizedlist>
66660 <para>
66661 For mail delivery, the following are available:
66662 </para>
66663 <itemizedlist>
66664 <listitem>
66665 <para>
66666 SMTP over TCP/IP (the <command>smtp</command> transport);
66667 </para>
66668 </listitem>
66669 <listitem>
66670 <para>
66671 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
66672 <quote>lmtp</quote>);
66673 </para>
66674 </listitem>
66675 <listitem>
66676 <para>
66677 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
66678 transport);
66679 </para>
66680 </listitem>
66681 <listitem>
66682 <para>
66683 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
66684 the <option>use_bsmtp</option> option set).
66685 </para>
66686 </listitem>
66687 </itemizedlist>
66688 <para>
66689 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
66690 stored in or read from files (or pipes), in a format in which SMTP commands are
66691 used to contain the envelope information.
66692 </para>
66693 <section id="SECToutSMTPTCP">
66694 <title>Outgoing SMTP and LMTP over TCP/IP</title>
66695 <para>
66696 <indexterm role="concept">
66697 <primary>SMTP</primary>
66698 <secondary>outgoing over TCP/IP</secondary>
66699 </indexterm>
66700 <indexterm role="concept">
66701 <primary>outgoing SMTP over TCP/IP</primary>
66702 </indexterm>
66703 <indexterm role="concept">
66704 <primary>LMTP</primary>
66705 <secondary>over TCP/IP</secondary>
66706 </indexterm>
66707 <indexterm role="concept">
66708 <primary>outgoing LMTP over TCP/IP</primary>
66709 </indexterm>
66710 <indexterm role="concept">
66711 <primary>EHLO</primary>
66712 </indexterm>
66713 <indexterm role="concept">
66714 <primary>HELO</primary>
66715 </indexterm>
66716 <indexterm role="concept">
66717 <primary>SIZE</primary>
66718 <secondary>option on MAIL command</secondary>
66719 </indexterm>
66720 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
66721 The <option>protocol</option> option selects which protocol is to be used, but the actual
66722 processing is the same in both cases.
66723 </para>
66724 <para>
66725 <indexterm role="concept">
66726 <primary>ESMTP extensions</primary>
66727 <secondary>SIZE</secondary>
66728 </indexterm>
66729 If, in response to its EHLO command, Exim is told that the SIZE
66730 extension is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
66731 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
66732 <option>size_addition</option> option (default 1024) to allow for additions to the message
66733 such as per-transport header lines, or changes made in a
66734 <indexterm role="concept">
66735 <primary>transport</primary>
66736 <secondary>filter</secondary>
66737 </indexterm>
66738 <indexterm role="concept">
66739 <primary>filter</primary>
66740 <secondary>transport filter</secondary>
66741 </indexterm>
66742 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
66743 suppressed.
66744 </para>
66745 <para>
66746 If the remote server advertises support for PIPELINING, Exim uses the
66747 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
66748 required for the transaction.
66749 </para>
66750 <para>
66751 If the remote server advertises support for the STARTTLS command, and Exim
66752 was built to support TLS encryption, it tries to start a TLS session unless the
66753 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
66754 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
66755 is called for verification.
66756 </para>
66757 <para>
66758 If the remote server advertises support for the AUTH command, Exim scans
66759 the authenticators configuration for any suitable client settings, as described
66760 in chapter <xref linkend="CHAPSMTPAUTH"/>.
66761 </para>
66762 <para>
66763 <indexterm role="concept">
66764 <primary>carriage return</primary>
66765 </indexterm>
66766 <indexterm role="concept">
66767 <primary>linefeed</primary>
66768 </indexterm>
66769 Responses from the remote host are supposed to be terminated by CR followed by
66770 LF. However, there are known to be hosts that do not send CR characters, so in
66771 order to be able to interwork with such hosts, Exim treats LF on its own as a
66772 line terminator.
66773 </para>
66774 <para>
66775 If a message contains a number of different addresses, all those with the same
66776 characteristics (for example, the same envelope sender) that resolve to the
66777 same set of hosts, in the same order, are sent in a single SMTP transaction,
66778 even if they are for different domains, unless there are more than the setting
66779 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
66780 they are split into groups containing no more than <option>max_rcpt</option>s addresses
66781 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
66782 in parallel sessions. The order of hosts with identical MX values is not
66783 significant when checking whether addresses can be batched in this way.
66784 </para>
66785 <para>
66786 When the <command>smtp</command> transport suffers a temporary failure that is not
66787 message-related, Exim updates its transport-specific database, which contains
66788 records indexed by host name that remember which messages are waiting for each
66789 particular host. It also updates the retry database with new retry times.
66790 </para>
66791 <para>
66792 <indexterm role="concept">
66793 <primary>hints database</primary>
66794 <secondary>retry keys</secondary>
66795 </indexterm>
66796 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
66797 a multi-homed host is broken, it will soon be skipped most of the time.
66798 See the next section for more detail about error handling.
66799 </para>
66800 <para>
66801 <indexterm role="concept">
66802 <primary>SMTP</primary>
66803 <secondary>passed connection</secondary>
66804 </indexterm>
66805 <indexterm role="concept">
66806 <primary>SMTP</primary>
66807 <secondary>batching over TCP/IP</secondary>
66808 </indexterm>
66809 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
66810 looks in the hints database for the transport to see if there are any queued
66811 messages waiting for the host to which it is connected. If it finds one, it
66812 creates a new Exim process using the <option>-MC</option> option (which can only be used by
66813 a process running as root or the Exim user) and passes the TCP/IP socket to it
66814 so that it can deliver another message using the same socket. The new process
66815 does only those deliveries that are routed to the connected host, and may in
66816 turn pass the socket on to a third process, and so on.
66817 </para>
66818 <para>
66819 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
66820 limit the number of messages sent down a single TCP/IP connection.
66821 </para>
66822 <para>
66823 <indexterm role="concept">
66824 <primary>asterisk</primary>
66825 <secondary>after IP address</secondary>
66826 </indexterm>
66827 The second and subsequent messages delivered down an existing connection are
66828 identified in the main log by the addition of an asterisk after the closing
66829 square bracket of the IP address.
66830 </para>
66831 </section>
66832 <section id="SECToutSMTPerr">
66833 <title>Errors in outgoing SMTP</title>
66834 <para>
66835 <indexterm role="concept">
66836 <primary>error</primary>
66837 <secondary>in outgoing SMTP</secondary>
66838 </indexterm>
66839 <indexterm role="concept">
66840 <primary>SMTP</primary>
66841 <secondary>errors in outgoing</secondary>
66842 </indexterm>
66843 <indexterm role="concept">
66844 <primary>host</primary>
66845 <secondary>error</secondary>
66846 </indexterm>
66847 Three different kinds of error are recognized for outgoing SMTP: host errors,
66848 message errors, and recipient errors.
66849 </para>
66850 <variablelist>
66851 <varlistentry>
66852 <term><emphasis role="bold">Host errors</emphasis></term>
66853 <listitem>
66854 <para>
66855 A host error is not associated with a particular message or with a
66856 particular recipient of a message. The host errors are:
66857 </para>
66858 <itemizedlist>
66859 <listitem>
66860 <para>
66861 Connection refused or timed out,
66862 </para>
66863 </listitem>
66864 <listitem>
66865 <para>
66866 Any error response code on connection,
66867 </para>
66868 </listitem>
66869 <listitem>
66870 <para>
66871 Any error response code to EHLO or HELO,
66872 </para>
66873 </listitem>
66874 <listitem>
66875 <para>
66876 Loss of connection at any time, except after <quote>.</quote>,
66877 </para>
66878 </listitem>
66879 <listitem>
66880 <para>
66881 I/O errors at any time,
66882 </para>
66883 </listitem>
66884 <listitem>
66885 <para>
66886 Timeouts during the session, other than in response to MAIL, RCPT or
66887 the <quote>.</quote> at the end of the data.
66888 </para>
66889 </listitem>
66890 </itemizedlist>
66891 <para>
66892 For a host error, a permanent error response on connection, or in response to
66893 EHLO, causes all addresses routed to the host to be failed. Any other host
66894 error causes all addresses to be deferred, and retry data to be created for the
66895 host. It is not tried again, for any message, until its retry time arrives. If
66896 the current set of addresses are not all delivered in this run (to some
66897 alternative host), the message is added to the list of those waiting for this
66898 host, so if it is still undelivered when a subsequent successful delivery is
66899 made to the host, it will be sent down the same SMTP connection.
66900 </para>
66901 </listitem></varlistentry>
66902 <varlistentry>
66903 <term><emphasis role="bold">Message errors</emphasis></term>
66904 <listitem>
66905 <para>
66906 <indexterm role="concept">
66907 <primary>message</primary>
66908 <secondary>error</secondary>
66909 </indexterm>
66910 A message error is associated with a particular message when sent to a
66911 particular host, but not with a particular recipient of the message. The
66912 message errors are:
66913 </para>
66914 <itemizedlist>
66915 <listitem>
66916 <para>
66917 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
66918 the data,
66919 </para>
66920 </listitem>
66921 <listitem>
66922 <para>
66923 Timeout after MAIL,
66924 </para>
66925 </listitem>
66926 <listitem>
66927 <para>
66928 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
66929 timeout after the DATA command itself is treated as a host error, as is loss of
66930 connection at any other time.
66931 </para>
66932 </listitem>
66933 </itemizedlist>
66934 <para>
66935 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
66936 to be failed, and a delivery error report to be returned to the sender. A
66937 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
66938 addresses to be deferred. Retry data is not created for the host, but instead,
66939 a retry record for the combination of host plus message id is created. The
66940 message is not added to the list of those waiting for this host. This ensures
66941 that the failing message will not be sent to this host again until the retry
66942 time arrives. However, other messages that are routed to the host are not
66943 affected, so if it is some property of the message that is causing the error,
66944 it will not stop the delivery of other mail.
66945 </para>
66946 <para>
66947 If the remote host specified support for the SIZE parameter in its response
66948 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
66949 over-large message will cause a message error because the error arrives as a
66950 response to MAIL.
66951 </para>
66952 </listitem></varlistentry>
66953 <varlistentry>
66954 <term><emphasis role="bold">Recipient errors</emphasis></term>
66955 <listitem>
66956 <para>
66957 <indexterm role="concept">
66958 <primary>recipient</primary>
66959 <secondary>error</secondary>
66960 </indexterm>
66961 A recipient error is associated with a particular recipient of a message. The
66962 recipient errors are:
66963 </para>
66964 <itemizedlist>
66965 <listitem>
66966 <para>
66967 Any error response to RCPT,
66968 </para>
66969 </listitem>
66970 <listitem>
66971 <para>
66972 Timeout after RCPT.
66973 </para>
66974 </listitem>
66975 </itemizedlist>
66976 <para>
66977 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
66978 recipient address to be failed, and a bounce message to be returned to the
66979 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
66980 address to be deferred, and routing retry data to be created for it. This is
66981 used to delay processing of the address in subsequent queue runs, until its
66982 routing retry time arrives. This applies to all messages, but because it
66983 operates only in queue runs, one attempt will be made to deliver a new message
66984 to the failing address before the delay starts to operate. This ensures that,
66985 if the failure is really related to the message rather than the recipient
66986 (<quote>message too big for this recipient</quote> is a possible example), other messages
66987 have a chance of getting delivered. If a delivery to the address does succeed,
66988 the retry information gets cleared, so all stuck messages get tried again, and
66989 the retry clock is reset.
66990 </para>
66991 <para>
66992 The message is not added to the list of those waiting for this host. Use of the
66993 host for other messages is unaffected, and except in the case of a timeout,
66994 other recipients are processed independently, and may be successfully delivered
66995 in the current SMTP session. After a timeout it is of course impossible to
66996 proceed with the session, so all addresses get deferred. However, those other
66997 than the one that failed do not suffer any subsequent retry delays. Therefore,
66998 if one recipient is causing trouble, the others have a chance of getting
66999 through when a subsequent delivery attempt occurs before the failing
67000 recipient&#x2019;s retry time.
67001 </para>
67002 </listitem></varlistentry>
67003 </variablelist>
67004 <para>
67005 In all cases, if there are other hosts (or IP addresses) available for the
67006 current set of addresses (for example, from multiple MX records), they are
67007 tried in this run for any undelivered addresses, subject of course to their
67008 own retry data. In other words, recipient error retry data does not take effect
67009 until the next delivery attempt.
67010 </para>
67011 <para>
67012 Some hosts have been observed to give temporary error responses to every
67013 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
67014 would be nice if such circumstances could be recognized, and defer data for the
67015 host itself created, but this is not possible within the current Exim design.
67016 What actually happens is that retry data for every (host, message) combination
67017 is created.
67018 </para>
67019 <para>
67020 The reason that timeouts after MAIL and RCPT are treated specially is that
67021 these can sometimes arise as a result of the remote host&#x2019;s verification
67022 procedures. Exim makes this assumption, and treats them as if a temporary error
67023 response had been received. A timeout after <quote>.</quote> is treated specially because
67024 it is known that some broken implementations fail to recognize the end of the
67025 message if the last character of the last line is a binary zero. Thus, it is
67026 helpful to treat this case as a message error.
67027 </para>
67028 <para>
67029 Timeouts at other times are treated as host errors, assuming a problem with the
67030 host, or the connection to it. If a timeout after MAIL, RCPT,
67031 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
67032 the timeout is likely to occur at some other point in the dialogue, causing it
67033 then to be treated as a host error.
67034 </para>
67035 <para>
67036 There is experimental evidence that some MTAs drop the connection after the
67037 terminating <quote>.</quote> if they do not like the contents of the message for some
67038 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
67039 should be given. That is why Exim treats this case as a message rather than a
67040 host error, in order not to delay other messages to the same host.
67041 </para>
67042 </section>
67043 <section id="SECID233">
67044 <title>Incoming SMTP messages over TCP/IP</title>
67045 <para>
67046 <indexterm role="concept">
67047 <primary>SMTP</primary>
67048 <secondary>incoming over TCP/IP</secondary>
67049 </indexterm>
67050 <indexterm role="concept">
67051 <primary>incoming SMTP over TCP/IP</primary>
67052 </indexterm>
67053 <indexterm role="concept">
67054 <primary>inetd</primary>
67055 </indexterm>
67056 <indexterm role="concept">
67057 <primary>daemon</primary>
67058 </indexterm>
67059 Incoming SMTP messages can be accepted in one of two ways: by running a
67060 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
67061 <filename>/etc/inetd.conf</filename> should be like this:
67062 </para>
67063 <literallayout class="monospaced">
67064 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
67065 </literallayout>
67066 <para>
67067 Exim distinguishes between this case and the case of a locally running user
67068 agent using the <option>-bs</option> option by checking whether or not the standard input is
67069 a socket. When it is, either the port must be privileged (less than 1024), or
67070 the caller must be root or the Exim user. If any other user passes a socket
67071 with an unprivileged port number, Exim prints a message on the standard error
67072 stream and exits with an error code.
67073 </para>
67074 <para>
67075 By default, Exim does not make a log entry when a remote host connects or
67076 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
67077 unexpected. It can be made to write such log entries by setting the
67078 <option>smtp_connection</option> log selector.
67079 </para>
67080 <para>
67081 <indexterm role="concept">
67082 <primary>carriage return</primary>
67083 </indexterm>
67084 <indexterm role="concept">
67085 <primary>linefeed</primary>
67086 </indexterm>
67087 Commands from the remote host are supposed to be terminated by CR followed by
67088 LF. However, there are known to be hosts that do not send CR characters. In
67089 order to be able to interwork with such hosts, Exim treats LF on its own as a
67090 line terminator.
67091 Furthermore, because common code is used for receiving messages from all
67092 sources, a CR on its own is also interpreted as a line terminator. However, the
67093 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
67094 </para>
67095 <para>
67096 <indexterm role="concept">
67097 <primary>EHLO</primary>
67098 <secondary>invalid data</secondary>
67099 </indexterm>
67100 <indexterm role="concept">
67101 <primary>HELO</primary>
67102 <secondary>invalid data</secondary>
67103 </indexterm>
67104 One area that sometimes gives rise to problems concerns the EHLO or
67105 HELO commands. Some clients send syntactically invalid versions of these
67106 commands, which Exim rejects by default. (This is nothing to do with verifying
67107 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
67108 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
67109 match the broken hosts that send invalid commands.
67110 </para>
67111 <para>
67112 <indexterm role="concept">
67113 <primary>SIZE option on MAIL command</primary>
67114 </indexterm>
67115 <indexterm role="concept">
67116 <primary>MAIL</primary>
67117 <secondary>SIZE option</secondary>
67118 </indexterm>
67119 The amount of disk space available is checked whenever SIZE is received on
67120 a MAIL command, independently of whether <option>message_size_limit</option> or
67121 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
67122 false. A temporary error is given if there is not enough space. If
67123 <option>check_spool_space</option> is set, the check is for that amount of space plus the
67124 value given with SIZE, that is, it checks that the addition of the incoming
67125 message will not reduce the space below the threshold.
67126 </para>
67127 <para>
67128 When a message is successfully received, Exim includes the local message id in
67129 its response to the final <quote>.</quote> that terminates the data. If the remote host
67130 logs this text it can help with tracing what has happened to a message.
67131 </para>
67132 <para>
67133 The Exim daemon can limit the number of simultaneous incoming connections it is
67134 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
67135 number of simultaneous incoming connections from a single remote host (see the
67136 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
67137 rejected using the SMTP temporary error code 421.
67138 </para>
67139 <para>
67140 The Exim daemon does not rely on the SIGCHLD signal to detect when a
67141 subprocess has finished, as this can get lost at busy times. Instead, it looks
67142 for completed subprocesses every time it wakes up. Provided there are other
67143 things happening (new incoming calls, starts of queue runs), completed
67144 processes will be noticed and tidied away. On very quiet systems you may
67145 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
67146 it will be noticed when the daemon next wakes up.
67147 </para>
67148 <para>
67149 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
67150 and can also be set up to reject SMTP calls from non-reserved hosts at times of
67151 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
67152 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
67153 applies in both the daemon and <emphasis>inetd</emphasis> cases.
67154 </para>
67155 <para>
67156 Exim normally starts a delivery process for each message received, though this
67157 can be varied by means of the <option>-odq</option> command line option and the
67158 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
67159 number of simultaneously running delivery processes started in this way from
67160 SMTP input can be limited by the <option>smtp_accept_queue</option> and
67161 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
67162 subsequently received messages are just put on the input queue without starting
67163 a delivery process.
67164 </para>
67165 <para>
67166 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
67167 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
67168 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
67169 handled by an entirely independent Exim process. Control by load average is,
67170 however, available with <emphasis>inetd</emphasis>.
67171 </para>
67172 <para>
67173 Exim can be configured to verify addresses in incoming SMTP commands as they
67174 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
67175 to rewrite addresses at this time &ndash; before any syntax checking is done. See
67176 section <xref linkend="SECTrewriteS"/>.
67177 </para>
67178 <para>
67179 Exim can also be configured to limit the rate at which a client host submits
67180 MAIL and RCPT commands in a single SMTP session. See the
67181 <option>smtp_ratelimit_hosts</option> option.
67182 </para>
67183 </section>
67184 <section id="SECID234">
67185 <title>Unrecognized SMTP commands</title>
67186 <para>
67187 <indexterm role="concept">
67188 <primary>SMTP</primary>
67189 <secondary>unrecognized commands</secondary>
67190 </indexterm>
67191 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
67192 commands during a single SMTP connection, it drops the connection after sending
67193 the error response to the last command. The default value for
67194 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
67195 abuse that subvert web servers into making connections to SMTP ports; in these
67196 circumstances, a number of non-SMTP lines are sent first.
67197 </para>
67198 </section>
67199 <section id="SECID235">
67200 <title>Syntax and protocol errors in SMTP commands</title>
67201 <para>
67202 <indexterm role="concept">
67203 <primary>SMTP</primary>
67204 <secondary>syntax errors</secondary>
67205 </indexterm>
67206 <indexterm role="concept">
67207 <primary>SMTP</primary>
67208 <secondary>protocol errors</secondary>
67209 </indexterm>
67210 A syntax error is detected if an SMTP command is recognized, but there is
67211 something syntactically wrong with its data, for example, a malformed email
67212 address in a RCPT command. Protocol errors include invalid command
67213 sequencing such as RCPT before MAIL. If Exim receives more than
67214 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
67215 drops the connection after sending the error response to the last command. The
67216 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
67217 broken clients that loop sending bad commands (yes, it has been seen).
67218 </para>
67219 </section>
67220 <section id="SECID236">
67221 <title>Use of non-mail SMTP commands</title>
67222 <para>
67223 <indexterm role="concept">
67224 <primary>SMTP</primary>
67225 <secondary>non-mail commands</secondary>
67226 </indexterm>
67227 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
67228 DATA. Exim counts such commands, and drops the connection if there are too
67229 many of them in a single SMTP session. This action catches some
67230 denial-of-service attempts and things like repeated failing AUTHs, or a mad
67231 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
67232 defines what <quote>too many</quote> means. Its default value is 10.
67233 </para>
67234 <para>
67235 When a new message is expected, one occurrence of RSET is not counted. This
67236 allows a client to send one RSET between messages (this is not necessary,
67237 but some clients do it). Exim also allows one uncounted occurrence of HELO
67238 or EHLO, and one occurrence of STARTTLS between messages. After
67239 starting up a TLS session, another EHLO is expected, and so it too is not
67240 counted.
67241 </para>
67242 <para>
67243 The first occurrence of AUTH in a connection, or immediately following
67244 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
67245 RCPT, DATA, and QUIT are counted.
67246 </para>
67247 <para>
67248 You can control which hosts are subject to the limit set by
67249 <option>smtp_accept_max_nonmail</option> by setting
67250 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
67251 the limit apply to all hosts. This option means that you can exclude any
67252 specific badly-behaved hosts that you have to live with.
67253 </para>
67254 </section>
67255 <section id="SECID237">
67256 <title>The VRFY and EXPN commands</title>
67257 <para>
67258 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
67259 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
67260 appropriate) in order to decide whether the command should be accepted or not.
67261 </para>
67262 <para>
67263 <indexterm role="concept">
67264 <primary>VRFY</primary>
67265 <secondary>processing</secondary>
67266 </indexterm>
67267 When no ACL is defined for VRFY, or if it rejects without
67268 setting an explicit response code, the command is accepted
67269 (with a 252 SMTP response code)
67270 in order to support awkward clients that do a VRFY before every RCPT.
67271 When VRFY is accepted, it runs exactly the same code as when Exim is
67272 called with the <option>-bv</option> option, and returns 250/451/550
67273 SMTP response codes.
67274 </para>
67275 <para>
67276 <indexterm role="concept">
67277 <primary>EXPN</primary>
67278 <secondary>processing</secondary>
67279 </indexterm>
67280 If no ACL for EXPN is defined, the command is rejected.
67281 When EXPN is accepted, a single-level expansion of the address is done.
67282 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
67283 than a verification (the <option>-bv</option> option). If an unqualified local part is given
67284 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
67285 of VRFY and EXPN commands are logged on the main and reject logs, and
67286 VRFY verification failures are logged on the main log for consistency with
67287 RCPT failures.
67288 </para>
67289 </section>
67290 <section id="SECTETRN">
67291 <title>The ETRN command</title>
67292 <para>
67293 <indexterm role="concept">
67294 <primary>ETRN</primary>
67295 <secondary>processing</secondary>
67296 </indexterm>
67297 <indexterm role="concept">
67298 <primary>ESMTP extensions</primary>
67299 <secondary>ETRN</secondary>
67300 </indexterm>
67301 RFC 1985 describes an ESMTP command called ETRN that is designed to
67302 overcome the security problems of the TURN command (which has fallen into
67303 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
67304 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
67305 should be accepted or not. If no ACL is defined, the command is rejected.
67306 </para>
67307 <para>
67308 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
67309 delivery to certain hosts. As Exim does not organize its message queue by host,
67310 the only form of ETRN that is supported by default is the one where the
67311 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
67312 specific to the SMTP server. A valid ETRN command causes a run of Exim with
67313 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
67314 argument. For example,
67315 </para>
67316 <literallayout class="monospaced">
67317 ETRN #brigadoon
67318 </literallayout>
67319 <para>
67320 runs the command
67321 </para>
67322 <literallayout class="monospaced">
67323 exim -R brigadoon
67324 </literallayout>
67325 <para>
67326 which causes a delivery attempt on all messages with undelivered addresses
67327 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
67328 default), Exim prevents the simultaneous execution of more than one queue run
67329 for the same argument string as a result of an ETRN command. This stops
67330 a misbehaving client from starting more than one queue runner at once.
67331 </para>
67332 <para>
67333 <indexterm role="concept">
67334 <primary>hints database</primary>
67335 <secondary>ETRN serialization</secondary>
67336 </indexterm>
67337 Exim implements the serialization by means of a hints database in which a
67338 record is written whenever a process is started by ETRN, and deleted when
67339 the process completes. However, Exim does not keep the SMTP session waiting for
67340 the ETRN process to complete. Once ETRN is accepted, the client is sent
67341 a <quote>success</quote> return code. Obviously there is scope for hints records to get
67342 left lying around if there is a system or program crash. To guard against this,
67343 Exim ignores any records that are more than six hours old.
67344 </para>
67345 <para>
67346 <indexterm role="option">
67347 <primary><option>smtp_etrn_command</option></primary>
67348 </indexterm>
67349 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
67350 used. This specifies a command that is run whenever ETRN is received,
67351 whatever the form of its argument. For
67352 example:
67353 </para>
67354 <literallayout class="monospaced">
67355 smtp_etrn_command = /etc/etrn_command $domain \
67356                     $sender_host_address
67357 </literallayout>
67358 <para>
67359 <indexterm role="variable">
67360 <primary><varname>$domain</varname></primary>
67361 </indexterm>
67362 The string is split up into arguments which are independently expanded. The
67363 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
67364 and no syntax checking is done on the contents of this argument. Exim does not
67365 wait for the command to complete, so its status code is not checked. Exim runs
67366 under its own uid and gid when receiving incoming SMTP, so it is not possible
67367 for it to change them before running the command.
67368 </para>
67369 </section>
67370 <section id="SECID238">
67371 <title>Incoming local SMTP</title>
67372 <para>
67373 <indexterm role="concept">
67374 <primary>SMTP</primary>
67375 <secondary>local incoming</secondary>
67376 </indexterm>
67377 Some user agents use SMTP to pass messages to their local MTA using the
67378 standard input and output, as opposed to passing the envelope on the command
67379 line and writing the message to the standard input. This is supported by the
67380 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
67381 messages over TCP/IP (including the use of ACLs), except that the envelope
67382 sender given in a MAIL command is ignored unless the caller is trusted. In
67383 an ACL you can detect this form of SMTP input by testing for an empty host
67384 identification. It is common to have this as the first line in the ACL that
67385 runs for RCPT commands:
67386 </para>
67387 <literallayout class="monospaced">
67388 accept hosts = :
67389 </literallayout>
67390 <para>
67391 This accepts SMTP messages from local processes without doing any other tests.
67392 </para>
67393 </section>
67394 <section id="SECTbatchSMTP">
67395 <title>Outgoing batched SMTP</title>
67396 <para>
67397 <indexterm role="concept">
67398 <primary>SMTP</primary>
67399 <secondary>batched outgoing</secondary>
67400 </indexterm>
67401 <indexterm role="concept">
67402 <primary>batched SMTP output</primary>
67403 </indexterm>
67404 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
67405 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
67406 be output in BSMTP format. No SMTP responses are possible for this form of
67407 delivery. All it is doing is using SMTP commands as a way of transmitting the
67408 envelope along with the message.
67409 </para>
67410 <para>
67411 The message is written to the file or pipe preceded by the SMTP commands
67412 MAIL and RCPT, and followed by a line containing a single dot. Lines in
67413 the message that start with a dot have an extra dot added. The SMTP command
67414 HELO is not normally used. If it is required, the <option>message_prefix</option> option
67415 can be used to specify it.
67416 </para>
67417 <para>
67418 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
67419 one recipient address at a time by default. However, you can arrange for them
67420 to handle several addresses at once by setting the <option>batch_max</option> option. When
67421 this is done for BSMTP, messages may contain multiple RCPT commands. See
67422 chapter <xref linkend="CHAPbatching"/> for more details.
67423 </para>
67424 <para>
67425 <indexterm role="variable">
67426 <primary><varname>$host</varname></primary>
67427 </indexterm>
67428 When one or more addresses are routed to a BSMTP transport by a router that
67429 sets up a host list, the name of the first host on the list is available to the
67430 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
67431 router:
67432 </para>
67433 <literallayout class="monospaced">
67434 begin routers
67435 route_append:
67436   driver = manualroute
67437   transport = smtp_appendfile
67438   route_list = domain.example  batch.host.example
67439
67440 begin transports
67441 smtp_appendfile:
67442   driver = appendfile
67443   directory = /var/bsmtp/$host
67444   batch_max = 1000
67445   use_bsmtp
67446   user = exim
67447 </literallayout>
67448 <para>
67449 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
67450 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
67451 message (unless there are more than 1000 recipients).
67452 </para>
67453 </section>
67454 <section id="SECTincomingbatchedSMTP">
67455 <title>Incoming batched SMTP</title>
67456 <para>
67457 <indexterm role="concept">
67458 <primary>SMTP</primary>
67459 <secondary>batched incoming</secondary>
67460 </indexterm>
67461 <indexterm role="concept">
67462 <primary>batched SMTP input</primary>
67463 </indexterm>
67464 The <option>-bS</option> command line option causes Exim to accept one or more messages by
67465 reading SMTP on the standard input, but to generate no responses. If the caller
67466 is trusted, the senders in the MAIL commands are believed; otherwise the
67467 sender is always the caller of Exim. Unqualified senders and receivers are not
67468 rejected (there seems little point) but instead just get qualified. HELO
67469 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
67470 as NOOP; QUIT quits.
67471 </para>
67472 <para>
67473 Minimal policy checking is done for BSMTP input. Only the non-SMTP
67474 ACL is run in the same way as for non-SMTP local input.
67475 </para>
67476 <para>
67477 If an error is detected while reading a message, including a missing <quote>.</quote> at
67478 the end, Exim gives up immediately. It writes details of the error to the
67479 standard output in a stylized way that the calling program should be able to
67480 make some use of automatically, for example:
67481 </para>
67482 <literallayout class="monospaced">
67483 554 Unexpected end of file
67484 Transaction started in line 10
67485 Error detected in line 14
67486 </literallayout>
67487 <para>
67488 It writes a more verbose version, for human consumption, to the standard error
67489 file, for example:
67490 </para>
67491 <literallayout class="monospaced">
67492 An error was detected while processing a file of BSMTP input.
67493 The error message was:
67494
67495 501 '&gt;' missing at end of address
67496
67497 The SMTP transaction started in line 10.
67498 The error was detected in line 12.
67499 The SMTP command at fault was:
67500
67501 rcpt to:&lt;malformed@in.com.plete
67502
67503 1 previous message was successfully processed.
67504 The rest of the batch was abandoned.
67505 </literallayout>
67506 <para>
67507 The return code from Exim is zero only if there were no errors. It is 1 if some
67508 messages were accepted before an error was detected, and 2 if no messages were
67509 accepted.
67510 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
67511 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
67512 </para>
67513 </section>
67514 </chapter>
67515
67516 <chapter id="CHAPemsgcust">
67517 <title>Customizing bounce and warning messages</title>
67518 <titleabbrev>Customizing messages</titleabbrev>
67519 <para>
67520 When a message fails to be delivered, or remains in the queue for more than a
67521 configured amount of time, Exim sends a message to the original sender, or
67522 to an alternative configured address. The text of these messages is built into
67523 the code of Exim, but it is possible to change it, either by adding a single
67524 string, or by replacing each of the paragraphs by text supplied in a file.
67525 </para>
67526 <para>
67527 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
67528 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
67529 option. Exim also adds the line
67530 </para>
67531 <literallayout class="monospaced">
67532 Auto-Submitted: auto-generated
67533 </literallayout>
67534 <para>
67535 to all warning and bounce messages,
67536 </para>
67537 <section id="SECID239">
67538 <title>Customizing bounce messages</title>
67539 <para>
67540 <indexterm role="concept">
67541 <primary>customizing</primary>
67542 <secondary>bounce message</secondary>
67543 </indexterm>
67544 <indexterm role="concept">
67545 <primary>bounce message</primary>
67546 <secondary>customizing</secondary>
67547 </indexterm>
67548 If <option>bounce_message_text</option> is set, its contents are included in the default
67549 message immediately after <quote>This message was created automatically by mail
67550 delivery software.</quote> The string is not expanded. It is not used if
67551 <option>bounce_message_file</option> is set.
67552 </para>
67553 <para>
67554 When <option>bounce_message_file</option> is set, it must point to a template file for
67555 constructing error messages. The file consists of a series of text items,
67556 separated by lines consisting of exactly four asterisks. If the file cannot be
67557 opened, default text is used and a message is written to the main and panic
67558 logs. If any text item in the file is empty, default text is used for that
67559 item.
67560 </para>
67561 <para>
67562 <indexterm role="variable">
67563 <primary><varname>$bounce_recipient</varname></primary>
67564 </indexterm>
67565 <indexterm role="variable">
67566 <primary><varname>$bounce_return_size_limit</varname></primary>
67567 </indexterm>
67568 Each item of text that is read from the file is expanded, and there are two
67569 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
67570 the recipient of an error message while it is being created, and
67571 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
67572 option, rounded to a whole number.
67573 </para>
67574 <para>
67575 The items must appear in the file in the following order:
67576 </para>
67577 <itemizedlist>
67578 <listitem>
67579 <para>
67580 The first item is included in the headers, and should include at least a
67581 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
67582 </para>
67583 </listitem>
67584 <listitem>
67585 <para>
67586 The second item forms the start of the error message. After it, Exim lists the
67587 failing addresses with their error messages.
67588 </para>
67589 </listitem>
67590 <listitem>
67591 <para>
67592 The third item is used to introduce any text from pipe transports that is to be
67593 returned to the sender. It is omitted if there is no such text.
67594 </para>
67595 </listitem>
67596 <listitem>
67597 <para>
67598 The fourth, fifth and sixth items will be ignored and may be empty.
67599 The fields exist for back-compatibility
67600 </para>
67601 </listitem>
67602 </itemizedlist>
67603 <para>
67604 The default state (<option>bounce_message_file</option> unset) is equivalent to the
67605 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
67606 other lines have been split in order to fit them on the page:
67607 </para>
67608 <literallayout class="monospaced">
67609 Subject: Mail delivery failed
67610   ${if eq{$sender_address}{$bounce_recipient}
67611   {: returning message to sender}}
67612 ****
67613 This message was created automatically by mail delivery software.
67614
67615 A message ${if eq{$sender_address}{$bounce_recipient}
67616   {that you sent }{sent by
67617
67618 &lt;$sender_address&gt;
67619
67620 }}could not be delivered to all of its recipients.
67621 This is a permanent error. The following address(es) failed:
67622 ****
67623 The following text was generated during the delivery attempt(s):
67624 ****
67625 ------ This is a copy of the message, including all the headers.
67626   ------
67627 ****
67628 ------ The body of the message is $message_size characters long;
67629   only the first
67630 ------ $bounce_return_size_limit or so are included here.
67631 ****
67632 </literallayout>
67633 </section>
67634 <section id="SECTcustwarn">
67635 <title>Customizing warning messages</title>
67636 <para>
67637 <indexterm role="concept">
67638 <primary>customizing</primary>
67639 <secondary>warning message</secondary>
67640 </indexterm>
67641 <indexterm role="concept">
67642 <primary>warning of delay</primary>
67643 <secondary>customizing the message</secondary>
67644 </indexterm>
67645 The option <option>warn_message_file</option> can be pointed at a template file for use when
67646 warnings about message delays are created. In this case there are only three
67647 text sections:
67648 </para>
67649 <itemizedlist>
67650 <listitem>
67651 <para>
67652 The first item is included in the headers, and should include at least a
67653 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
67654 </para>
67655 </listitem>
67656 <listitem>
67657 <para>
67658 The second item forms the start of the warning message. After it, Exim lists
67659 the delayed addresses.
67660 </para>
67661 </listitem>
67662 <listitem>
67663 <para>
67664 The third item then ends the message.
67665 </para>
67666 </listitem>
67667 </itemizedlist>
67668 <para>
67669 The default state is equivalent to the following file, except that some lines
67670 have been split here, in order to fit them on the page:
67671 </para>
67672 <literallayout class="monospaced">
67673 Subject: Warning: message $message_exim_id delayed
67674   $warn_message_delay
67675 ****
67676 This message was created automatically by mail delivery software.
67677
67678 A message ${if eq{$sender_address}{$warn_message_recipients}
67679 {that you sent }{sent by
67680
67681 &lt;$sender_address&gt;
67682
67683 }}has not been delivered to all of its recipients after
67684 more than $warn_message_delay in the queue on $primary_hostname.
67685
67686 The message identifier is:     $message_exim_id
67687 The subject of the message is: $h_subject
67688 The date of the message is:    $h_date
67689
67690 The following address(es) have not yet been delivered:
67691 ****
67692 No action is required on your part. Delivery attempts will
67693 continue for some time, and this warning may be repeated at
67694 intervals if the message remains undelivered. Eventually the
67695 mail delivery software will give up, and when that happens,
67696 the message will be returned to you.
67697 </literallayout>
67698 <para>
67699 <indexterm role="variable">
67700 <primary><varname>$warn_message_delay</varname></primary>
67701 </indexterm>
67702 <indexterm role="variable">
67703 <primary><varname>$warn_message_recipients</varname></primary>
67704 </indexterm>
67705 However, in the default state the subject and date lines are omitted if no
67706 appropriate headers exist. During the expansion of this file,
67707 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
67708 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
67709 of recipients for the warning message. There may be more than one if there are
67710 multiple addresses with different <option>errors_to</option> settings on the routers that
67711 handled them.
67712 </para>
67713 </section>
67714 </chapter>
67715
67716 <chapter id="CHAPcomconreq">
67717 <title>Some common configuration settings</title>
67718 <para>
67719 This chapter discusses some configuration settings that seem to be fairly
67720 common. More examples and discussion can be found in the Exim book.
67721 </para>
67722 <section id="SECID240">
67723 <title>Sending mail to a smart host</title>
67724 <para>
67725 <indexterm role="concept">
67726 <primary>smart host</primary>
67727 <secondary>example router</secondary>
67728 </indexterm>
67729 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
67730 should replace the default <command>dnslookup</command> router with a router which does the
67731 routing explicitly:
67732 </para>
67733 <literallayout class="monospaced">
67734 send_to_smart_host:
67735   driver = manualroute
67736   route_list = !+local_domains smart.host.name
67737   transport = remote_smtp
67738 </literallayout>
67739 <para>
67740 You can use the smart host&#x2019;s IP address instead of the name if you wish.
67741 If you are using Exim only to submit messages to a smart host, and not for
67742 receiving incoming messages, you can arrange for it to do the submission
67743 synchronously by setting the <option>mua_wrapper</option> option (see chapter
67744 <xref linkend="CHAPnonqueueing"/>).
67745 </para>
67746 </section>
67747 <section id="SECTmailinglists">
67748 <title>Using Exim to handle mailing lists</title>
67749 <para>
67750 <indexterm role="concept">
67751 <primary>mailing lists</primary>
67752 </indexterm>
67753 Exim can be used to run simple mailing lists, but for large and/or complicated
67754 requirements, the use of additional specialized mailing list software such as
67755 Majordomo or Mailman is recommended.
67756 </para>
67757 <para>
67758 The <command>redirect</command> router can be used to handle mailing lists where each list
67759 is maintained in a separate file, which can therefore be managed by an
67760 independent manager. The <option>domains</option> router option can be used to run these
67761 lists in a separate domain from normal mail. For example:
67762 </para>
67763 <literallayout class="monospaced">
67764 lists:
67765   driver = redirect
67766   domains = lists.example
67767   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
67768   forbid_pipe
67769   forbid_file
67770   errors_to = ${quote_local_part:$local_part-request}@lists.example
67771   no_more
67772 </literallayout>
67773 <para>
67774 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
67775 in that domain, it looks for a file that matches the local part. If there is no
67776 such file, the router declines, but because <option>no_more</option> is set, no subsequent
67777 routers are tried, and so the whole delivery fails.
67778 </para>
67779 <para>
67780 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
67781 expanded into a filename or a pipe delivery, which is usually inappropriate in
67782 a mailing list.
67783 </para>
67784 <para>
67785 <indexterm role="option">
67786 <primary><option>errors_to</option></primary>
67787 </indexterm>
67788 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
67789 taken from a mailing list are to be sent to the given address rather than the
67790 original sender of the message. However, before acting on this, Exim verifies
67791 the error address, and ignores it if verification fails.
67792 </para>
67793 <para>
67794 For example, using the configuration above, mail sent to
67795 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
67796 <filename>/usr/lists/dicts</filename>, with error reports directed to
67797 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
67798 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
67799 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
67800 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
67801 or <option>local_part_suffix</option> options) to handle addresses of the form
67802 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
67803 </para>
67804 </section>
67805 <section id="SECID241">
67806 <title>Syntax errors in mailing lists</title>
67807 <para>
67808 <indexterm role="concept">
67809 <primary>mailing lists</primary>
67810 <secondary>syntax errors in</secondary>
67811 </indexterm>
67812 If an entry in redirection data contains a syntax error, Exim normally defers
67813 delivery of the original address. That means that a syntax error in a mailing
67814 list holds up all deliveries to the list. This may not be appropriate when a
67815 list is being maintained automatically from data supplied by users, and the
67816 addresses are not rigorously checked.
67817 </para>
67818 <para>
67819 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
67820 entries that fail to parse, noting the incident in the log. If in addition
67821 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
67822 whenever a broken address is skipped. It is usually appropriate to set
67823 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
67824 </para>
67825 </section>
67826 <section id="SECID242">
67827 <title>Re-expansion of mailing lists</title>
67828 <para>
67829 <indexterm role="concept">
67830 <primary>mailing lists</primary>
67831 <secondary>re-expansion of</secondary>
67832 </indexterm>
67833 Exim remembers every individual address to which a message has been delivered,
67834 in order to avoid duplication, but it normally stores only the original
67835 recipient addresses with a message. If all the deliveries to a mailing list
67836 cannot be done at the first attempt, the mailing list is re-expanded when the
67837 delivery is next tried. This means that alterations to the list are taken into
67838 account at each delivery attempt, so addresses that have been added to
67839 the list since the message arrived will therefore receive a copy of the
67840 message, even though it pre-dates their subscription.
67841 </para>
67842 <para>
67843 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
67844 on the <command>redirect</command> router. If this is done, any addresses generated by the
67845 router that fail to deliver at the first attempt are added to the message as
67846 <quote>top level</quote> addresses, and the parent address that generated them is marked
67847 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
67848 subsequent delivery attempts. The disadvantage of this is that if any of the
67849 failing addresses are incorrect, correcting them in the file has no effect on
67850 pre-existing messages.
67851 </para>
67852 <para>
67853 The original top-level address is remembered with each of the generated
67854 addresses, and is output in any log messages. However, any intermediate parent
67855 addresses are not recorded. This makes a difference to the log only if the
67856 <option>all_parents</option> selector is set, but for mailing lists there is normally only
67857 one level of expansion anyway.
67858 </para>
67859 </section>
67860 <section id="SECID243">
67861 <title>Closed mailing lists</title>
67862 <para>
67863 <indexterm role="concept">
67864 <primary>mailing lists</primary>
67865 <secondary>closed</secondary>
67866 </indexterm>
67867 The examples so far have assumed open mailing lists, to which anybody may
67868 send mail. It is also possible to set up closed lists, where mail is accepted
67869 from specified senders only. This is done by making use of the generic
67870 <option>senders</option> option to restrict the router that handles the list.
67871 </para>
67872 <para>
67873 The following example uses the same file as a list of recipients and as a list
67874 of permitted senders. It requires three routers:
67875 </para>
67876 <literallayout class="monospaced">
67877 lists_request:
67878   driver = redirect
67879   domains = lists.example
67880   local_part_suffix = -request
67881   local_parts = ${lookup {$local_part} dsearch,filter=file {/usr/lists}}
67882   file = /usr/lists/${local_part_data}-request
67883   no_more
67884
67885 lists_post:
67886   driver = redirect
67887   domains = lists.example
67888   senders = ${if exists {/usr/lists/$local_part}\
67889              {lsearch;/usr/lists/$local_part}{*}}
67890   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
67891   forbid_pipe
67892   forbid_file
67893   errors_to = ${quote_local_part:$local_part-request}@lists.example
67894   no_more
67895
67896 lists_closed:
67897   driver = redirect
67898   domains = lists.example
67899   allow_fail
67900   data = :fail: $local_part@lists.example is a closed mailing list
67901 </literallayout>
67902 <para>
67903 All three routers have the same <option>domains</option> setting, so for any other domains,
67904 they are all skipped. The first router runs only if the local part ends in
67905 <option>-request</option>. It handles messages to the list manager(s) by means of an open
67906 mailing list.
67907 </para>
67908 <para>
67909 The second router runs only if the <option>senders</option> precondition is satisfied. It
67910 checks for the existence of a list that corresponds to the local part, and then
67911 checks that the sender is on the list by means of a linear search. It is
67912 necessary to check for the existence of the file before trying to search it,
67913 because otherwise Exim thinks there is a configuration error. If the file does
67914 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
67915 means that the router runs, but because there is no list, declines, and
67916 <option>no_more</option> ensures that no further routers are run. The address fails with an
67917 <quote>unrouteable address</quote> error.
67918 </para>
67919 <para>
67920 The third router runs only if the second router is skipped, which happens when
67921 a mailing list exists, but the sender is not on it. This router forcibly fails
67922 the address, giving a suitable error message.
67923 </para>
67924 </section>
67925 <section id="SECTverp">
67926 <title>Variable Envelope Return Paths (VERP)</title>
67927 <para>
67928 <indexterm role="concept">
67929 <primary>VERP</primary>
67930 </indexterm>
67931 <indexterm role="concept">
67932 <primary>Variable Envelope Return Paths</primary>
67933 </indexterm>
67934 <indexterm role="concept">
67935 <primary>envelope from</primary>
67936 </indexterm>
67937 <indexterm role="concept">
67938 <primary>envelope sender</primary>
67939 </indexterm>
67940 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;
67941 are a way of helping mailing list administrators discover which subscription
67942 address is the cause of a particular delivery failure. The idea is to encode
67943 the original recipient address in the outgoing envelope sender address, so that
67944 if the message is forwarded by another host and then subsequently bounces, the
67945 original recipient can be extracted from the recipient address of the bounce.
67946 </para>
67947 <para>
67948 <indexterm role="option">
67949 <primary><option>errors_to</option></primary>
67950 </indexterm>
67951 <indexterm role="option">
67952 <primary><option>return_path</option></primary>
67953 </indexterm>
67954 Envelope sender addresses can be modified by Exim using two different
67955 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
67956 list examples), or the <option>return_path</option> option on a transport. The second of
67957 these is effective only if the message is successfully delivered to another
67958 host; it is not used for errors detected on the local host (see the description
67959 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
67960 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
67961 </para>
67962 <literallayout class="monospaced">
67963 verp_smtp:
67964   driver = smtp
67965   max_rcpt = 1
67966   return_path = \
67967     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
67968       {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
67969 </literallayout>
67970 <para>
67971 This has the effect of rewriting the return path (envelope sender) on outgoing
67972 SMTP messages, if the local part of the original return path ends in
67973 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
67974 local part and domain of the recipient into the return path. Suppose, for
67975 example, that a message whose return path has been set to
67976 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
67977 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
67978 rewritten as
67979 </para>
67980 <literallayout class="monospaced">
67981 somelist-request+subscriber=other.dom.example@your.dom.example
67982 </literallayout>
67983 <para>
67984 <indexterm role="variable">
67985 <primary><varname>$local_part</varname></primary>
67986 </indexterm>
67987 For this to work, you must tell Exim to send multiple copies of messages that
67988 have more than one recipient, so that each copy has just one recipient. This is
67989 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
67990 might be sent to several different recipients in the same domain, in which case
67991 <varname>$local_part</varname> is not available in the transport, because it is not unique.
67992 </para>
67993 <para>
67994 Unless your host is doing nothing but mailing list deliveries, you should
67995 probably use a separate transport for the VERP deliveries, so as not to use
67996 extra resources in making one-per-recipient copies for other deliveries. This
67997 can easily be done by expanding the <option>transport</option> option in the router:
67998 </para>
67999 <literallayout class="monospaced">
68000 dnslookup:
68001   driver = dnslookup
68002   domains = ! +local_domains
68003   transport = \
68004     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
68005       {verp_smtp}{remote_smtp}}
68006   no_more
68007 </literallayout>
68008 <para>
68009 If you want to change the return path using <option>errors_to</option> in a router instead
68010 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
68011 routers that handle mailing list addresses. This will ensure that all delivery
68012 errors, including those detected on the local host, are sent to the VERP
68013 address.
68014 </para>
68015 <para>
68016 On a host that does no local deliveries and has no manual routing, only the
68017 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
68018 SMTP deliveries. Every mailing list recipient has its own return path value,
68019 and so Exim must hand them to the transport one at a time. Here is an example
68020 of a <command>dnslookup</command> router that implements VERP:
68021 </para>
68022 <literallayout class="monospaced">
68023 verp_dnslookup:
68024   driver = dnslookup
68025   domains = ! +local_domains
68026   transport = remote_smtp
68027   errors_to = \
68028     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
68029      {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
68030   no_more
68031 </literallayout>
68032 <para>
68033 Before you start sending out messages with VERPed return paths, you must also
68034 configure Exim to accept the bounce messages that come back to those paths.
68035 Typically this is done by setting a <option>local_part_suffix</option> option for a
68036 router, and using this to route the messages to wherever you want to handle
68037 them.
68038 </para>
68039 <para>
68040 The overhead incurred in using VERP depends very much on the size of the
68041 message, the number of recipient addresses that resolve to the same remote
68042 host, and the speed of the connection over which the message is being sent. If
68043 a lot of addresses resolve to the same host and the connection is slow, sending
68044 a separate copy of the message for each address may take substantially longer
68045 than sending a single copy with many recipients (for which VERP cannot be
68046 used).
68047 </para>
68048 </section>
68049 <section id="SECTvirtualdomains">
68050 <title>Virtual domains</title>
68051 <para>
68052 <indexterm role="concept">
68053 <primary>virtual domains</primary>
68054 </indexterm>
68055 <indexterm role="concept">
68056 <primary>domain</primary>
68057 <secondary>virtual</secondary>
68058 </indexterm>
68059 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
68060 meanings:
68061 </para>
68062 <itemizedlist>
68063 <listitem>
68064 <para>
68065 A domain for which there are no real mailboxes; all valid local parts are
68066 aliases for other email addresses. Common examples are organizational
68067 top-level domains and <quote>vanity</quote> domains.
68068 </para>
68069 </listitem>
68070 <listitem>
68071 <para>
68072 One of a number of independent domains that are all handled by the same host,
68073 with mailboxes on that host, but where the mailbox owners do not necessarily
68074 have login accounts on that host.
68075 </para>
68076 </listitem>
68077 </itemizedlist>
68078 <para>
68079 The first usage is probably more common, and does seem more <quote>virtual</quote> than
68080 the second. This kind of domain can be handled in Exim with a straightforward
68081 aliasing router. One approach is to create a separate alias file for each
68082 virtual domain. Exim can test for the existence of the alias file to determine
68083 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
68084 to a router of this form:
68085 </para>
68086 <literallayout class="monospaced">
68087 virtual:
68088   driver = redirect
68089   domains = dsearch;/etc/mail/virtual
68090   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain_data}}
68091   no_more
68092 </literallayout>
68093 <para revisionflag="changed">
68094 The <option>domains</option> option specifies that the router is to be skipped, unless there
68095 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
68096 domain that is being processed.
68097 The <command>dsearch</command> lookup used results in an untainted version of <varname>$domain</varname>
68098 being placed into the <varname>$domain_data</varname> variable.
68099 </para>
68100 <para>
68101 When the router runs, it looks up the local
68102 part in the file to find a new address (or list of addresses). The <option>no_more</option>
68103 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
68104 string), Exim gives up on the address without trying any subsequent routers.
68105 </para>
68106 <para>
68107 This one router can handle all the virtual domains because the alias filenames
68108 follow a fixed pattern. Permissions can be arranged so that appropriate people
68109 can edit the different alias files. A successful aliasing operation results in
68110 a new envelope recipient address, which is then routed from scratch.
68111 </para>
68112 <para>
68113 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
68114 way. One approach is to create a file for each domain containing a list of
68115 valid local parts, and use it in a router like this:
68116 </para>
68117 <literallayout class="monospaced">
68118 my_domains:
68119   driver = accept
68120   domains = dsearch;/etc/mail/domains
68121   local_parts = lsearch;/etc/mail/domains/$domain
68122   transport = my_mailboxes
68123 </literallayout>
68124 <para>
68125 The address is accepted if there is a file for the domain, and the local part
68126 can be found in the file. The <option>domains</option> option is used to check for the
68127 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
68128 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
68129 because that option is tested after <option>local_parts</option>. The transport is as
68130 follows:
68131 </para>
68132 <literallayout class="monospaced">
68133 my_mailboxes:
68134   driver = appendfile
68135   file = /var/mail/$domain/$local_part_data
68136   user = mail
68137 </literallayout>
68138 <para>
68139 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
68140 required, to specify which uid is to be used for writing to the mailboxes.
68141 </para>
68142 <para>
68143 The configuration shown here is just one example of how you might support this
68144 requirement. There are many other ways this kind of configuration can be set
68145 up, for example, by using a database instead of separate files to hold all the
68146 information about the domains.
68147 </para>
68148 </section>
68149 <section id="SECTmulbox">
68150 <title>Multiple user mailboxes</title>
68151 <para>
68152 <indexterm role="concept">
68153 <primary>multiple mailboxes</primary>
68154 </indexterm>
68155 <indexterm role="concept">
68156 <primary>mailbox</primary>
68157 <secondary>multiple</secondary>
68158 </indexterm>
68159 <indexterm role="concept">
68160 <primary>local part</primary>
68161 <secondary>prefix</secondary>
68162 </indexterm>
68163 <indexterm role="concept">
68164 <primary>local part</primary>
68165 <secondary>suffix</secondary>
68166 </indexterm>
68167 Heavy email users often want to operate with multiple mailboxes, into which
68168 incoming mail is automatically sorted. A popular way of handling this is to
68169 allow users to use multiple sender addresses, so that replies can easily be
68170 identified. Users are permitted to add prefixes or suffixes to their local
68171 parts for this purpose. The wildcard facility of the generic router options
68172 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
68173 example, consider this router:
68174 </para>
68175 <literallayout class="monospaced">
68176 userforward:
68177   driver = redirect
68178   check_local_user
68179   file = $home/.forward
68180   local_part_suffix = -*
68181   local_part_suffix_optional
68182   allow_filter
68183 </literallayout>
68184 <para>
68185 <indexterm role="variable">
68186 <primary><varname>$local_part_suffix</varname></primary>
68187 </indexterm>
68188 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
68189 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
68190 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
68191 </para>
68192 <literallayout class="monospaced">
68193 if $local_part_suffix contains -special then
68194 save /home/$local_part/Mail/special
68195 endif
68196 </literallayout>
68197 <para>
68198 If the filter file does not exist, or does not deal with such addresses, they
68199 fall through to subsequent routers, and, assuming no subsequent use of the
68200 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
68201 control over which suffixes are valid.
68202 </para>
68203 <para>
68204 Alternatively, a suffix can be used to trigger the use of a different
68205 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
68206 another MTA:
68207 </para>
68208 <literallayout class="monospaced">
68209 userforward:
68210   driver = redirect
68211   check_local_user
68212   local_part_suffix = -*
68213   local_part_suffix_optional
68214   file = ${lookup {.forward$local_part_suffix} dsearch,ret=full {$home} {$value}fail}
68215   allow_filter
68216 </literallayout>
68217 <para>
68218 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
68219 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
68220 does not exist, or does not deal with the address, it is passed on to
68221 subsequent routers, which could, if required, look for an unqualified
68222 <filename>.forward</filename> file to use as a default.
68223 </para>
68224 </section>
68225 <section id="SECID244">
68226 <title>Simplified vacation processing</title>
68227 <para>
68228 <indexterm role="concept">
68229 <primary>vacation processing</primary>
68230 </indexterm>
68231 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
68232 a pipe command in a <filename>.forward</filename> file
68233 (see section <xref linkend="SECTspecitredli"/> for syntax details).
68234 This is prone to error by inexperienced users. There are two features of Exim
68235 that can be used to make this process simpler for users:
68236 </para>
68237 <itemizedlist>
68238 <listitem>
68239 <para>
68240 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
68241 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
68242 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
68243 <filename>.forward</filename> file are then much simpler. For example:
68244 </para>
68245 <literallayout class="monospaced">
68246 spqr, vacation-spqr
68247 </literallayout>
68248 </listitem>
68249 <listitem>
68250 <para>
68251 The <option>require_files</option> generic router option can be used to trigger a
68252 vacation delivery by checking for the existence of a certain file in the
68253 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
68254 ensure that the original delivery also proceeds. In this case, all the user has
68255 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
68256 message.
68257 </para>
68258 </listitem>
68259 </itemizedlist>
68260 <para>
68261 Another advantage of both these methods is that they both work even when the
68262 use of arbitrary pipes by users is locked out.
68263 </para>
68264 </section>
68265 <section id="SECID245">
68266 <title>Taking copies of mail</title>
68267 <para>
68268 <indexterm role="concept">
68269 <primary>message</primary>
68270 <secondary>copying every</secondary>
68271 </indexterm>
68272 Some installations have policies that require archive copies of all messages to
68273 be made. A single copy of each message can easily be taken by an appropriate
68274 command in a system filter, which could, for example, use a different file for
68275 each day&#x2019;s messages.
68276 </para>
68277 <para>
68278 There is also a shadow transport mechanism that can be used to take copies of
68279 messages that are successfully delivered by local transports, one copy per
68280 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
68281 notification of delivery by sites that insist on doing such things.
68282 </para>
68283 </section>
68284 <section id="SECID246">
68285 <title>Intermittently connected hosts</title>
68286 <para>
68287 <indexterm role="concept">
68288 <primary>intermittently connected hosts</primary>
68289 </indexterm>
68290 It has become quite common (because it is cheaper) for hosts to connect to the
68291 Internet periodically rather than remain connected all the time. The normal
68292 arrangement is that mail for such hosts accumulates on a system that is
68293 permanently connected.
68294 </para>
68295 <para>
68296 Exim was designed for use on permanently connected hosts, and so it is not
68297 particularly well-suited to use in an intermittently connected environment.
68298 Nevertheless there are some features that can be used.
68299 </para>
68300 </section>
68301 <section id="SECID247">
68302 <title>Exim on the upstream server host</title>
68303 <para>
68304 It is tempting to arrange for incoming mail for the intermittently connected
68305 host to remain in Exim&#x2019;s queue until the client connects. However, this
68306 approach does not scale very well. Two different kinds of waiting message are
68307 being mixed up in the same queue &ndash; those that cannot be delivered because of
68308 some temporary problem, and those that are waiting for their destination host
68309 to connect. This makes it hard to manage the queue, as well as wasting
68310 resources, because each queue runner scans the entire queue.
68311 </para>
68312 <para>
68313 A better approach is to separate off those messages that are waiting for an
68314 intermittently connected host. This can be done by delivering these messages
68315 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
68316 format, from where they are transmitted by other software when their
68317 destination connects. This makes it easy to collect all the mail for one host
68318 in a single directory, and to apply local timeout rules on a per-message basis
68319 if required.
68320 </para>
68321 <para>
68322 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
68323 you are doing this, you should configure Exim with a long retry period for the
68324 intermittent host. For example:
68325 </para>
68326 <literallayout class="monospaced">
68327 cheshire.wonderland.fict.example    *   F,5d,24h
68328 </literallayout>
68329 <para>
68330 This stops a lot of failed delivery attempts from occurring, but Exim remembers
68331 which messages it has queued up for that host. Once the intermittent host comes
68332 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
68333 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
68334 causes all the queued up messages to be delivered, often down a single SMTP
68335 connection. While the host remains connected, any new messages get delivered
68336 immediately.
68337 </para>
68338 <para>
68339 If the connecting hosts do not have fixed IP addresses, that is, if a host is
68340 issued with a different IP address each time it connects, Exim&#x2019;s retry
68341 mechanisms on the holding host get confused, because the IP address is normally
68342 used as part of the key string for holding retry information. This can be
68343 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
68344 Since this has disadvantages for permanently connected hosts, it is best to
68345 arrange a separate transport for the intermittently connected ones.
68346 </para>
68347 </section>
68348 <section id="SECID248">
68349 <title>Exim on the intermittently connected client host</title>
68350 <para>
68351 The value of <option>smtp_accept_queue_per_connection</option> should probably be
68352 increased, or even set to zero (that is, disabled) on the intermittently
68353 connected host, so that all incoming messages down a single connection get
68354 delivered immediately.
68355 </para>
68356 <para>
68357 <indexterm role="concept">
68358 <primary>SMTP</primary>
68359 <secondary>passed connection</secondary>
68360 </indexterm>
68361 <indexterm role="concept">
68362 <primary>SMTP</primary>
68363 <secondary>multiple deliveries</secondary>
68364 </indexterm>
68365 <indexterm role="concept">
68366 <primary>multiple SMTP deliveries</primary>
68367 </indexterm>
68368 <indexterm role="concept">
68369 <primary>first pass routing</primary>
68370 </indexterm>
68371 Mail waiting to be sent from an intermittently connected host will probably
68372 not have been routed, because without a connection DNS lookups are not
68373 possible. This means that if a normal queue run is done at connection time,
68374 each message is likely to be sent in a separate SMTP session. This can be
68375 avoided by starting the queue run with a command line option beginning with
68376 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
68377 first pass, routing is done but no deliveries take place. The second pass is a
68378 normal queue run; since all the messages have been previously routed, those
68379 destined for the same host are likely to get sent as multiple deliveries in a
68380 single SMTP connection.
68381 </para>
68382 </section>
68383 </chapter>
68384
68385 <chapter id="CHAPnonqueueing">
68386 <title>Using Exim as a non-queueing client</title>
68387 <titleabbrev>Exim as a non-queueing client</titleabbrev>
68388 <para>
68389 <indexterm role="concept">
68390 <primary>client, non-queueing</primary>
68391 </indexterm>
68392 <indexterm role="concept">
68393 <primary>smart host</primary>
68394 <secondary>suppressing queueing</secondary>
68395 </indexterm>
68396 On a personal computer, it is a common requirement for all
68397 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
68398 configured to operate that way, for all the popular operating systems.
68399 However, there are some MUAs for Unix-like systems that cannot be so
68400 configured: they submit messages using the command line interface of
68401 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
68402 messages this way.
68403 </para>
68404 <para>
68405 If the personal computer runs continuously, there is no problem, because it can
68406 run a conventional MTA that handles delivery to the smart host, and deal with
68407 any delays via its queueing mechanism. However, if the computer does not run
68408 continuously or runs different operating systems at different times, queueing
68409 email is not desirable.
68410 </para>
68411 <para>
68412 There is therefore a requirement for something that can provide the
68413 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
68414 any queueing or retrying facilities. Furthermore, the delivery to the smart
68415 host should be synchronous, so that if it fails, the sending MUA is immediately
68416 informed. In other words, we want something that extends an MUA that submits
68417 to a local MTA via the command line so that it behaves like one that submits
68418 to a remote smart host using TCP/SMTP.
68419 </para>
68420 <para>
68421 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
68422 that do this job. However, people have found them to be lacking in various
68423 ways. For instance, you might want to allow aliasing and forwarding to be done
68424 before sending a message to the smart host.
68425 </para>
68426 <para>
68427 Exim already had the necessary infrastructure for doing this job. Just a few
68428 tweaks were needed to make it behave as required, though it is somewhat of an
68429 overkill to use a fully-featured MTA for this purpose.
68430 </para>
68431 <para>
68432 <indexterm role="option">
68433 <primary><option>mua_wrapper</option></primary>
68434 </indexterm>
68435 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
68436 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
68437 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
68438 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
68439 compatible router and transport configuration. Typically there will be just one
68440 router and one transport, sending everything to a smart host.
68441 </para>
68442 <para>
68443 When run in MUA wrapping mode, the behaviour of Exim changes in the
68444 following ways:
68445 </para>
68446 <itemizedlist>
68447 <listitem>
68448 <para>
68449 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
68450 In other words, the only way to submit messages is via the command line.
68451 </para>
68452 </listitem>
68453 <listitem>
68454 <para>
68455 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
68456 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
68457 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
68458 does not finish until the delivery attempt is complete. If the delivery is
68459 successful, a zero return code is given.
68460 </para>
68461 </listitem>
68462 <listitem>
68463 <para>
68464 Address redirection is permitted, but the final routing for all addresses must
68465 be to the same remote transport, and to the same list of hosts. Furthermore,
68466 the return address (envelope sender) must be the same for all recipients, as
68467 must any added or deleted header lines. In other words, it must be possible to
68468 deliver the message in a single SMTP transaction, however many recipients there
68469 are.
68470 </para>
68471 </listitem>
68472 <listitem>
68473 <para>
68474 If these conditions are not met, or if routing any address results in a
68475 failure or defer status, or if Exim is unable to deliver all the recipients
68476 successfully to one of the smart hosts, delivery of the entire message fails.
68477 </para>
68478 </listitem>
68479 <listitem>
68480 <para>
68481 Because no queueing is allowed, all failures are treated as permanent; there
68482 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
68483 smart host. Furthermore, because only a single yes/no response can be given to
68484 the caller, it is not possible to deliver to some recipients and not others. If
68485 there is an error (temporary or permanent) for any recipient, all are failed.
68486 </para>
68487 </listitem>
68488 <listitem>
68489 <para>
68490 If more than one smart host is listed, Exim will try another host after a
68491 connection failure or a timeout, in the normal way. However, if this kind of
68492 failure happens for all the hosts, the delivery fails.
68493 </para>
68494 </listitem>
68495 <listitem>
68496 <para>
68497 When delivery fails, an error message is written to the standard error stream
68498 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
68499 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
68500 are ever generated.
68501 </para>
68502 </listitem>
68503 <listitem>
68504 <para>
68505 No retry data is maintained, and any retry rules are ignored.
68506 </para>
68507 </listitem>
68508 <listitem>
68509 <para>
68510 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
68511 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
68512 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
68513 </para>
68514 </listitem>
68515 </itemizedlist>
68516 <para>
68517 The overall effect is that Exim makes a single synchronous attempt to deliver
68518 the message, failing if there is any kind of problem. Because no local
68519 deliveries are done and no daemon can be run, Exim does not need root
68520 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
68521 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
68522 the advantages and disadvantages of running without root privilege.
68523 </para>
68524 </chapter>
68525
68526 <chapter id="CHAPlog">
68527 <title>Log files</title>
68528 <para>
68529 <indexterm role="concept" id="IIDloggen" class="startofrange">
68530 <primary>log</primary>
68531 <secondary>general description</secondary>
68532 </indexterm>
68533 <indexterm role="concept">
68534 <primary>log</primary>
68535 <secondary>types of</secondary>
68536 </indexterm>
68537 Exim writes three different logs, referred to as the main log, the reject log,
68538 and the panic log:
68539 </para>
68540 <itemizedlist>
68541 <listitem>
68542 <para>
68543 <indexterm role="concept">
68544 <primary>main log</primary>
68545 </indexterm>
68546 The main log records the arrival of each message and each delivery in a single
68547 line in each case. The format is as compact as possible, in an attempt to keep
68548 down the size of log files. Two-character flag sequences make it easy to pick
68549 out these lines. A number of other events are recorded in the main log. Some of
68550 them are optional, in which case the <option>log_selector</option> option controls whether
68551 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
68552 analysis of main log files, is provided in the Exim distribution (see section
68553 <xref linkend="SECTmailstat"/>).
68554 </para>
68555 </listitem>
68556 <listitem>
68557 <para>
68558 <indexterm role="concept">
68559 <primary>reject log</primary>
68560 </indexterm>
68561 The reject log records information from messages that are rejected as a result
68562 of a configuration option (that is, for policy reasons).
68563 The first line of each rejection is a copy of the line that is also written to
68564 the main log. Then, if the message&#x2019;s header has been read at the time the log
68565 is written, its contents are written to this log. Only the original header
68566 lines are available; header lines added by ACLs are not logged. You can use the
68567 reject log to check that your policy controls are working correctly; on a busy
68568 host this may be easier than scanning the main log for rejection messages. You
68569 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
68570 false.
68571 </para>
68572 </listitem>
68573 <listitem>
68574 <para>
68575 <indexterm role="concept">
68576 <primary>panic log</primary>
68577 </indexterm>
68578 <indexterm role="concept">
68579 <primary>system log</primary>
68580 </indexterm>
68581 When certain serious errors occur, Exim writes entries to its panic log. If the
68582 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
68583 are usually written to the main log as well, but can get lost amid the mass of
68584 other entries. The panic log should be empty under normal circumstances. It is
68585 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
68586 regularly, in order to become aware of any problems. When Exim cannot open its
68587 panic log, it tries as a last resort to write to the system log (syslog). This
68588 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
68589 message itself is written at priority LOG_CRIT.
68590 </para>
68591 </listitem>
68592 </itemizedlist>
68593 <para>
68594 Every log line starts with a timestamp, in the format shown in the following
68595 example. Note that many of the examples shown in this chapter are line-wrapped.
68596 In the log file, this would be all on one line:
68597 </para>
68598 <literallayout class="monospaced">
68599 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
68600   by QUIT
68601 </literallayout>
68602 <para>
68603 By default, the timestamps are in the local timezone. There are two
68604 ways of changing this:
68605 </para>
68606 <itemizedlist>
68607 <listitem>
68608 <para>
68609 You can set the <option>timezone</option> option to a different time zone; in particular, if
68610 you set
68611 </para>
68612 <literallayout class="monospaced">
68613 timezone = UTC
68614 </literallayout>
68615 <para>
68616 the timestamps will be in UTC (aka GMT).
68617 </para>
68618 </listitem>
68619 <listitem>
68620 <para>
68621 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
68622 example:
68623 </para>
68624 <literallayout class="monospaced">
68625 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
68626 </literallayout>
68627 </listitem>
68628 </itemizedlist>
68629 <para>
68630 <indexterm role="concept">
68631 <primary>log</primary>
68632 <secondary>process ids in</secondary>
68633 </indexterm>
68634 <indexterm role="concept">
68635 <primary>pid (process id)</primary>
68636 <secondary>in log lines</secondary>
68637 </indexterm>
68638 Exim does not include its process id in log lines by default, but you can
68639 request that it does so by specifying the <literal>pid</literal> log selector (see section
68640 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
68641 brackets, immediately after the time and date.
68642 </para>
68643 <section id="SECTwhelogwri">
68644 <title>Where the logs are written</title>
68645 <para>
68646 <indexterm role="concept">
68647 <primary>log</primary>
68648 <secondary>destination</secondary>
68649 </indexterm>
68650 <indexterm role="concept">
68651 <primary>log</primary>
68652 <secondary>to file</secondary>
68653 </indexterm>
68654 <indexterm role="concept">
68655 <primary>log</primary>
68656 <secondary>to syslog</secondary>
68657 </indexterm>
68658 <indexterm role="concept">
68659 <primary>syslog</primary>
68660 </indexterm>
68661 The logs may be written to local files, or to syslog, or both. However, it
68662 should be noted that many syslog implementations use UDP as a transport, and
68663 are therefore unreliable in the sense that messages are not guaranteed to
68664 arrive at the loghost, nor is the ordering of messages necessarily maintained.
68665 It has also been reported that on large log files (tens of megabytes) you may
68666 need to tweak syslog to prevent it syncing the file with each write &ndash; on
68667 Linux this has been seen to make syslog take 90% plus of CPU time.
68668 </para>
68669 <para>
68670 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
68671 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the runtime
68672 configuration. This latter string is expanded, so it can contain, for example,
68673 references to the host name:
68674 </para>
68675 <literallayout class="monospaced">
68676 log_file_path = /var/log/$primary_hostname/exim_%slog
68677 </literallayout>
68678 <para>
68679 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
68680 rather than at runtime, because then the setting is available right from the
68681 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
68682 before it has read the configuration file (for example, an error in the
68683 configuration file) it will not use the path you want, and may not be able to
68684 log at all.
68685 </para>
68686 <para>
68687 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
68688 list, currently limited to at most two items. This is one option where the
68689 facility for changing a list separator may not be used. The list must always be
68690 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
68691 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
68692 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
68693 implying the use of a default path.
68694 </para>
68695 <para>
68696 When Exim encounters an empty item in the list, it searches the list defined by
68697 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
68698 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
68699 mean <quote>use the path specified at build time</quote>. It no such item exists, log
68700 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
68701 equivalent to the setting:
68702 </para>
68703 <literallayout class="monospaced">
68704 log_file_path = $spool_directory/log/%slog
68705 </literallayout>
68706 <para>
68707 If you do not specify anything at build time or runtime,
68708 or if you unset the option at runtime (i.e. <literal>log_file_path = </literal>),
68709 that is where the logs are written.
68710 </para>
68711 <para>
68712 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log filenames
68713 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
68714 </para>
68715 <para>
68716 Here are some examples of possible settings:
68717 </para>
68718 <literallayout>
68719 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
68720 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
68721 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
68722 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
68723 </literallayout>
68724 <para>
68725 If there are more than two paths in the list, the first is used and a panic
68726 error is logged.
68727 </para>
68728 </section>
68729 <section id="SECID285">
68730 <title>Logging to local files that are periodically <quote>cycled</quote></title>
68731 <para>
68732 <indexterm role="concept">
68733 <primary>log</primary>
68734 <secondary>cycling local files</secondary>
68735 </indexterm>
68736 <indexterm role="concept">
68737 <primary>cycling logs</primary>
68738 </indexterm>
68739 <indexterm role="concept">
68740 <primary><emphasis>exicyclog</emphasis></primary>
68741 </indexterm>
68742 <indexterm role="concept">
68743 <primary>log</primary>
68744 <secondary>local files; writing to</secondary>
68745 </indexterm>
68746 Some operating systems provide centralized and standardized methods for cycling
68747 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
68748 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
68749 main and reject logs each time it is called. The maximum number of old logs to
68750 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
68751 </para>
68752 <para>
68753 An Exim delivery process opens the main log when it first needs to write to it,
68754 and it keeps the file open in case subsequent entries are required &ndash; for
68755 example, if a number of different deliveries are being done for the same
68756 message. However, remote SMTP deliveries can take a long time, and this means
68757 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
68758 something similar is being used to rename log files on a regular basis. To
68759 ensure that a switch of log files is noticed as soon as possible, Exim calls
68760 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
68761 does not exist, or its inode has changed, the old file is closed and Exim
68762 tries to open the main log from scratch. Thus, an old log file may remain open
68763 for quite some time, but no Exim processes should write to it once it has been
68764 renamed.
68765 </para>
68766 </section>
68767 <section id="SECTdatlogfil">
68768 <title>Datestamped log files</title>
68769 <para>
68770 <indexterm role="concept">
68771 <primary>log</primary>
68772 <secondary>datestamped files</secondary>
68773 </indexterm>
68774 Instead of cycling the main and reject log files by renaming them
68775 periodically, some sites like to use files whose names contain a datestamp,
68776 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
68777 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
68778 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
68779 point where the datestamp is required. For example:
68780 </para>
68781 <literallayout class="monospaced">
68782 log_file_path = /var/spool/exim/log/%slog-%D
68783 log_file_path = /var/log/exim-%s-%D.log
68784 log_file_path = /var/spool/exim/log/%D-%slog
68785 log_file_path = /var/log/exim/%s.%M
68786 </literallayout>
68787 <para>
68788 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
68789 examples of names generated by the above examples:
68790 </para>
68791 <literallayout class="monospaced">
68792 /var/spool/exim/log/mainlog-20021225
68793 /var/log/exim-reject-20021225.log
68794 /var/spool/exim/log/20021225-mainlog
68795 /var/log/exim/main.200212
68796 </literallayout>
68797 <para>
68798 When this form of log file is specified, Exim automatically switches to new
68799 files at midnight. It does not make any attempt to compress old logs; you
68800 will need to write your own script if you require this. You should not
68801 run <emphasis>exicyclog</emphasis> with this form of logging.
68802 </para>
68803 <para>
68804 The location of the panic log is also determined by <option>log_file_path</option>, but it
68805 is not datestamped, because rotation of the panic log does not make sense.
68806 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
68807 the string. In addition, if it immediately follows a slash, a following
68808 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
68809 character is removed. Thus, the four examples above would give these panic
68810 log names:
68811 </para>
68812 <literallayout class="monospaced">
68813 /var/spool/exim/log/paniclog
68814 /var/log/exim-panic.log
68815 /var/spool/exim/log/paniclog
68816 /var/log/exim/panic
68817 </literallayout>
68818 </section>
68819 <section id="SECID249">
68820 <title>Logging to syslog</title>
68821 <para>
68822 <indexterm role="concept">
68823 <primary>log</primary>
68824 <secondary>syslog; writing to</secondary>
68825 </indexterm>
68826 The use of syslog does not change what Exim logs or the format of its messages,
68827 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
68828 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
68829 that, the same strings are written to syslog as to log files. The syslog
68830 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
68831 by default, but you can change these by setting the <option>syslog_facility</option> and
68832 <option>syslog_processname</option> options, respectively. If Exim was compiled with
68833 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
68834 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
68835 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
68836 the time and host name to each line.
68837 The three log streams are mapped onto syslog priorities as follows:
68838 </para>
68839 <itemizedlist>
68840 <listitem>
68841 <para>
68842 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
68843 </para>
68844 </listitem>
68845 <listitem>
68846 <para>
68847 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
68848 </para>
68849 </listitem>
68850 <listitem>
68851 <para>
68852 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
68853 </para>
68854 </listitem>
68855 </itemizedlist>
68856 <para>
68857 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
68858 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
68859 these are routed by syslog to the same place. You can suppress this duplication
68860 by setting <option>syslog_duplication</option> false.
68861 </para>
68862 <para>
68863 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
68864 entries contain multiple lines when headers are included. To cope with both
68865 these cases, entries written to syslog are split into separate <function>syslog()</function>
68866 calls at each internal newline, and also after a maximum of
68867 870 data characters. (This allows for a total syslog line length of 1024, when
68868 additions such as timestamps are added.) If you are running a syslog
68869 replacement that can handle lines longer than the 1024 characters allowed by
68870 RFC 3164, you should set
68871 </para>
68872 <literallayout class="monospaced">
68873 SYSLOG_LONG_LINES=yes
68874 </literallayout>
68875 <para>
68876 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
68877 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
68878 </para>
68879 <para>
68880 To make it easy to re-assemble split lines later, each component of a split
68881 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;]
68882 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
68883 components in the entry. The / delimiter is used when the line was split
68884 because it was too long; if it was split because of an internal newline, the \
68885 delimiter is used. For example, supposing the length limit to be 50 instead of
68886 870, the following would be the result of a typical rejection message to
68887 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
68888 name, and pid as added by syslog:
68889 </para>
68890 <literallayout class="monospaced">
68891 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
68892 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
68893 [3/5]  when scanning for sender: missing or malformed lo
68894 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
68895 [5/5] mple&gt;)
68896 </literallayout>
68897 <para>
68898 The same error might cause the following lines to be written to <quote>rejectlog</quote>
68899 (LOG_NOTICE):
68900 </para>
68901 <literallayout class="monospaced">
68902 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
68903 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
68904 [3/18] er when scanning for sender: missing or malformed
68905 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
68906 [5\18] .example&gt;)
68907 [6\18] Recipients: ph10@some.domain.cam.example
68908 [7\18] P Received: from [127.0.0.1] (ident=ph10)
68909 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
68910 [9\18]        id 16RdAL-0006pc-00
68911 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
68912 [11\18] 09:43 +0100
68913 [12\18] F From: &lt;&gt;
68914 [13\18]   Subject: this is a test header
68915 [18\18]   X-something: this is another header
68916 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
68917 [16\18] le&gt;
68918 [17\18] B Bcc:
68919 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
68920 </literallayout>
68921 <para>
68922 Log lines that are neither too long nor contain newlines are written to syslog
68923 without modification.
68924 </para>
68925 <para>
68926 If only syslog is being used, the Exim monitor is unable to provide a log tail
68927 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
68928 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
68929 where it is.
68930 </para>
68931 </section>
68932 <section id="SECID250">
68933 <title>Log line flags</title>
68934 <para>
68935 One line is written to the main log for each message received, and for each
68936 successful, unsuccessful, and delayed delivery. These lines can readily be
68937 picked out by the distinctive two-character flags that immediately follow the
68938 timestamp. The flags are:
68939 </para>
68940 <literallayout>
68941 <literal>&lt;=</literal>     message arrival
68942 <literal>(=</literal>     message fakereject
68943 <literal>=&gt;</literal>     normal message delivery
68944 <literal>-&gt;</literal>     additional address in same delivery
68945 <literal>&gt;&gt;</literal>     cutthrough message delivery
68946 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
68947 <literal>**</literal>     delivery failed; address bounced
68948 <literal>==</literal>     delivery deferred; temporary problem
68949 </literallayout>
68950 </section>
68951 <section id="SECID251">
68952 <title>Logging message reception</title>
68953 <para>
68954 <indexterm role="concept">
68955 <primary>log</primary>
68956 <secondary>reception line</secondary>
68957 </indexterm>
68958 The format of the single-line entry in the main log that is written for every
68959 message received is shown in the basic example below, which is split over
68960 several lines in order to fit it on the page:
68961 </para>
68962 <literallayout class="monospaced">
68963 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
68964   H=mailer.fict.example [192.168.123.123] U=exim
68965   P=smtp S=5678 id=&lt;incoming message id&gt;
68966 </literallayout>
68967 <para>
68968 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
68969 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
68970 generated, this is followed by an item of the form
68971 </para>
68972 <literallayout class="monospaced">
68973 R=&lt;message id&gt;
68974 </literallayout>
68975 <para>
68976 which is a reference to the message that caused the bounce to be sent.
68977 </para>
68978 <para>
68979 <indexterm role="concept">
68980 <primary>HELO</primary>
68981 </indexterm>
68982 <indexterm role="concept">
68983 <primary>EHLO</primary>
68984 </indexterm>
68985 For messages from other hosts, the H and U fields identify the remote host and
68986 record the RFC 1413 identity of the user that sent the message, if one was
68987 received. The number given in square brackets is the IP address of the sending
68988 host. If there is a single, unparenthesized  host name in the H field, as
68989 above, it has been verified to correspond to the IP address (see the
68990 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
68991 by the remote host in the SMTP HELO or EHLO command, and has not been
68992 verified. If verification yields a different name to that given for HELO or
68993 EHLO, the verified name appears first, followed by the HELO or EHLO
68994 name in parentheses.
68995 </para>
68996 <para>
68997 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
68998 without brackets, in the HELO or EHLO command, leading to entries in
68999 the log containing text like these examples:
69000 </para>
69001 <literallayout class="monospaced">
69002 H=(10.21.32.43) [192.168.8.34]
69003 H=([10.21.32.43]) [192.168.8.34]
69004 </literallayout>
69005 <para>
69006 This can be confusing. Only the final address in square brackets can be relied
69007 on.
69008 </para>
69009 <para>
69010 For locally generated messages (that is, messages not received over TCP/IP),
69011 the H field is omitted, and the U field contains the login name of the caller
69012 of Exim.
69013 </para>
69014 <para>
69015 <indexterm role="concept">
69016 <primary>authentication</primary>
69017 <secondary>logging</secondary>
69018 </indexterm>
69019 <indexterm role="concept">
69020 <primary>AUTH</primary>
69021 <secondary>logging</secondary>
69022 </indexterm>
69023 For all messages, the P field specifies the protocol used to receive the
69024 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
69025 of incoming SMTP messages, the value indicates whether or not any SMTP
69026 extensions (ESMTP), encryption, or authentication were used. If the SMTP
69027 session was encrypted, there is an additional X field that records the cipher
69028 suite that was used.
69029 </para>
69030 <para>
69031 <indexterm role="concept">
69032 <primary>log</primary>
69033 <secondary>protocol</secondary>
69034 </indexterm>
69035 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
69036 hosts that have authenticated themselves using the SMTP AUTH command. The first
69037 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
69038 there is an additional item A= followed by the name of the authenticator that
69039 was used. If an authenticated identification was set up by the authenticator&#x2019;s
69040 <option>server_set_id</option> option, this is logged too, separated by a colon from the
69041 authenticator name.
69042 </para>
69043 <para>
69044 <indexterm role="concept">
69045 <primary>size</primary>
69046 <secondary>of message</secondary>
69047 </indexterm>
69048 The id field records the existing message id, if present. The size of the
69049 received message is given by the S field. When the message is delivered,
69050 headers may be removed or added, so that the size of delivered copies of the
69051 message may not correspond with this value (and indeed may be different to each
69052 other).
69053 </para>
69054 <para>
69055 The <option>log_selector</option> option can be used to request the logging of additional
69056 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
69057 </para>
69058 </section>
69059 <section id="SECID252">
69060 <title>Logging deliveries</title>
69061 <para>
69062 <indexterm role="concept">
69063 <primary>log</primary>
69064 <secondary>delivery line</secondary>
69065 </indexterm>
69066 The format of the single-line entry in the main log that is written for every
69067 delivery is shown in one of the examples below, for local and remote
69068 deliveries, respectively. Each example has been split into multiple lines in order
69069 to fit it on the page:
69070 </para>
69071 <literallayout class="monospaced">
69072 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
69073   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
69074 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
69075   monk@holistic.fict.example R=dnslookup T=remote_smtp
69076   H=holistic.fict.example [192.168.234.234]
69077 </literallayout>
69078 <para>
69079 For ordinary local deliveries, the original address is given in angle brackets
69080 after the final delivery address, which might be a pipe or a file. If
69081 intermediate address(es) exist between the original and the final address, the
69082 last of these is given in parentheses after the final address. The R and T
69083 fields record the router and transport that were used to process the address.
69084 </para>
69085 <para>
69086 If SMTP AUTH was used for the delivery there is an additional item A=
69087 followed by the name of the authenticator that was used.
69088 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
69089 option, this is logged too, separated by a colon from the authenticator name.
69090 </para>
69091 <para>
69092 If a shadow transport was run after a successful local delivery, the log line
69093 for the successful delivery has an item added on the end, of the form
69094 </para>
69095 <literallayout>
69096 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
69097 </literallayout>
69098 <para>
69099 If the shadow transport did not succeed, the error message is put in
69100 parentheses afterwards.
69101 </para>
69102 <para>
69103 <indexterm role="concept">
69104 <primary>asterisk</primary>
69105 <secondary>after IP address</secondary>
69106 </indexterm>
69107 When more than one address is included in a single delivery (for example, two
69108 SMTP RCPT commands in one transaction) the second and subsequent addresses are
69109 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
69110 down a single SMTP connection, an asterisk follows the IP address in the log
69111 lines for the second and subsequent messages.
69112 When two or more messages are delivered down a single TLS connection, the
69113 DNS and some TLS-related information logged for the first message delivered
69114 will not be present in the log lines for the second and subsequent messages.
69115 TLS cipher information is still available.
69116 </para>
69117 <para>
69118 <indexterm role="concept">
69119 <primary>delivery</primary>
69120 <secondary>cutthrough; logging</secondary>
69121 </indexterm>
69122 <indexterm role="concept">
69123 <primary>cutthrough</primary>
69124 <secondary>logging</secondary>
69125 </indexterm>
69126 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
69127 line precedes the reception line, since cutthrough waits for a possible
69128 rejection from the destination in case it can reject the sourced item.
69129 </para>
69130 <para>
69131 The generation of a reply message by a filter file gets logged as a
69132 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
69133 </para>
69134 <para>
69135 The <option>log_selector</option> option can be used to request the logging of additional
69136 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
69137 </para>
69138 </section>
69139 <section id="SECID253">
69140 <title>Discarded deliveries</title>
69141 <para>
69142 <indexterm role="concept">
69143 <primary>discarded messages</primary>
69144 </indexterm>
69145 <indexterm role="concept">
69146 <primary>message</primary>
69147 <secondary>discarded</secondary>
69148 </indexterm>
69149 <indexterm role="concept">
69150 <primary>delivery</primary>
69151 <secondary>discarded; logging</secondary>
69152 </indexterm>
69153 When a message is discarded as a result of the command <quote>seen finish</quote> being
69154 obeyed in a filter file which generates no deliveries, a log entry of the form
69155 </para>
69156 <literallayout class="monospaced">
69157 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
69158   &lt;low.club@bridge.example&gt; R=userforward
69159 </literallayout>
69160 <para>
69161 is written, to record why no deliveries are logged. When a message is discarded
69162 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
69163 </para>
69164 <literallayout class="monospaced">
69165 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
69166   &lt;hole@nowhere.example&gt; R=blackhole_router
69167 </literallayout>
69168 </section>
69169 <section id="SECID254">
69170 <title>Deferred deliveries</title>
69171 <para>
69172 When a delivery is deferred, a line of the following form is logged:
69173 </para>
69174 <literallayout class="monospaced">
69175 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
69176   R=dnslookup T=smtp defer (146): Connection refused
69177 </literallayout>
69178 <para>
69179 In the case of remote deliveries, the error is the one that was given for the
69180 last IP address that was tried. Details of individual SMTP failures are also
69181 written to the log, so the above line would be preceded by something like
69182 </para>
69183 <literallayout class="monospaced">
69184 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
69185   mail1.endrest.example [192.168.239.239]: Connection refused
69186 </literallayout>
69187 <para>
69188 When a deferred address is skipped because its retry time has not been reached,
69189 a message is written to the log, but this can be suppressed by setting an
69190 appropriate value in <option>log_selector</option>.
69191 </para>
69192 </section>
69193 <section id="SECID255">
69194 <title>Delivery failures</title>
69195 <para>
69196 <indexterm role="concept">
69197 <primary>delivery</primary>
69198 <secondary>failure; logging</secondary>
69199 </indexterm>
69200 If a delivery fails because an address cannot be routed, a line of the
69201 following form is logged:
69202 </para>
69203 <literallayout class="monospaced">
69204 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
69205   &lt;jim@trek99.example&gt;: unknown mail domain
69206 </literallayout>
69207 <para>
69208 If a delivery fails at transport time, the router and transport are shown, and
69209 the response from the remote host is included, as in this example:
69210 </para>
69211 <literallayout class="monospaced">
69212 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
69213   R=dnslookup T=remote_smtp: SMTP error from remote mailer
69214   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
69215   pbmail3.py.example [192.168.63.111]: 553 5.3.0
69216   &lt;ace400@pb.example&gt;...Addressee unknown
69217 </literallayout>
69218 <para>
69219 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
69220 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
69221 disabling PIPELINING. The log lines for all forms of delivery failure are
69222 flagged with <literal>**</literal>.
69223 </para>
69224 </section>
69225 <section id="SECID256">
69226 <title>Fake deliveries</title>
69227 <para>
69228 <indexterm role="concept">
69229 <primary>delivery</primary>
69230 <secondary>fake; logging</secondary>
69231 </indexterm>
69232 If a delivery does not actually take place because the <option>-N</option> option has been
69233 used to suppress it, a normal delivery line is written to the log, except that
69234 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
69235 </para>
69236 </section>
69237 <section id="SECID257">
69238 <title>Completion</title>
69239 <para>
69240 A line of the form
69241 </para>
69242 <literallayout class="monospaced">
69243 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
69244 </literallayout>
69245 <para>
69246 is written to the main log when a message is about to be removed from the spool
69247 at the end of its processing.
69248 </para>
69249 </section>
69250 <section id="SECID258">
69251 <title>Summary of Fields in Log Lines</title>
69252 <para>
69253 <indexterm role="concept">
69254 <primary>log</primary>
69255 <secondary>summary of fields</secondary>
69256 </indexterm>
69257 A summary of the field identifiers that are used in log lines is shown in
69258 the following table:
69259 </para>
69260 <literallayout>
69261 <literal>A   </literal>        authenticator name (and optional id and sender)
69262 <literal>C   </literal>        SMTP confirmation on delivery
69263 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
69264 <literal>CV  </literal>        certificate verification status
69265 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
69266 <literal>DKIM</literal>        domain verified in incoming message
69267 <literal>DN  </literal>        distinguished name from peer certificate
69268 <literal>DS  </literal>        DNSSEC secured lookups
69269 <literal>DT  </literal>        on <literal>=&gt;</literal>, <emphasis>==</emphasis> and <emphasis>**</emphasis> lines: time taken for, or to attempt, a delivery
69270 <literal>F   </literal>        sender address (on delivery lines)
69271 <literal>H   </literal>        host name and IP address
69272 <literal>I   </literal>        local interface used
69273 <literal>id  </literal>        message id (from header) for incoming message
69274 <literal>K   </literal>        CHUNKING extension used
69275 <literal>L   </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: PIPELINING extension used
69276 <literal>M8S </literal>        8BITMIME status for incoming message
69277 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
69278 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
69279 <literal>PRDR</literal>        PRDR extension used
69280 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
69281 <literal>Q   </literal>        alternate queue name
69282 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
69283 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
69284 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
69285 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
69286 <literal>RT  </literal>        on <literal>&lt;=</literal> lines: time taken for reception
69287 <literal>S   </literal>        size of message in bytes
69288 <literal>SNI </literal>        server name indication from TLS client hello
69289 <literal>ST  </literal>        shadow transport name
69290 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
69291 <literal>TFO </literal>        connection took advantage of TCP Fast Open
69292 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
69293 <literal>U   </literal>        local user or RFC 1413 identity
69294 <literal>X   </literal>        TLS cipher suite
69295 </literallayout>
69296 </section>
69297 <section id="SECID259">
69298 <title>Other log entries</title>
69299 <para>
69300 Various other types of log entry are written from time to time. Most should be
69301 self-explanatory. Among the more common are:
69302 </para>
69303 <itemizedlist>
69304 <listitem>
69305 <para>
69306 <indexterm role="concept">
69307 <primary>retry</primary>
69308 <secondary>time not reached</secondary>
69309 </indexterm>
69310 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
69311 during routing or local delivery, and the time to retry has not yet arrived.
69312 This message is not written to an individual message log file unless it happens
69313 during the first delivery attempt.
69314 </para>
69315 </listitem>
69316 <listitem>
69317 <para>
69318 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
69319 temporary errors during remote delivery, and the retry time has not yet arrived
69320 for any of the hosts to which it is routed.
69321 </para>
69322 </listitem>
69323 <listitem>
69324 <para>
69325 <indexterm role="concept">
69326 <primary>spool directory</primary>
69327 <secondary>file locked</secondary>
69328 </indexterm>
69329 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
69330 some other Exim process is already working on the message. This can be quite
69331 common if queue running processes are started at frequent intervals. The
69332 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
69333 doing.
69334 </para>
69335 </listitem>
69336 <listitem>
69337 <para>
69338 <indexterm role="concept">
69339 <primary>error</primary>
69340 <secondary>ignored</secondary>
69341 </indexterm>
69342 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
69343 message:
69344 </para>
69345 <orderedlist numeration="arabic">
69346 <listitem>
69347 <para>
69348 Exim failed to deliver a bounce message whose age was greater than
69349 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
69350 </para>
69351 </listitem>
69352 <listitem>
69353 <para>
69354 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
69355 failed. The delivery was discarded.
69356 </para>
69357 </listitem>
69358 <listitem>
69359 <para>
69360 A delivery set up by a router configured with
69361 </para>
69362 <literallayout class="monospaced">
69363     errors_to = &lt;&gt;
69364 </literallayout>
69365 <para>
69366 failed. The delivery was discarded.
69367 </para>
69368 </listitem>
69369 </orderedlist>
69370 </listitem>
69371 <listitem>
69372 <para>
69373 <indexterm role="concept">
69374 <primary>DKIM</primary>
69375 <secondary>log line</secondary>
69376 </indexterm>
69377 <emphasis>DKIM: d=</emphasis>&nbsp;&nbsp;Verbose results of a DKIM verification attempt, if enabled for
69378 logging and the message has a DKIM signature header.
69379 </para>
69380 </listitem>
69381 </itemizedlist>
69382 </section>
69383 <section id="SECTlogselector">
69384 <title>Reducing or increasing what is logged</title>
69385 <para>
69386 <indexterm role="concept">
69387 <primary>log</primary>
69388 <secondary>selectors</secondary>
69389 </indexterm>
69390 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
69391 default logging, or you can request additional logging. The value of
69392 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
69393 example:
69394 </para>
69395 <literallayout class="monospaced">
69396 log_selector = +arguments -retry_defer
69397 </literallayout>
69398 <para>
69399 The list of optional log items is in the following table, with the default
69400 selection marked by asterisks:
69401 </para>
69402 <literallayout>
69403 <literal> 8bitmime                   </literal>  received 8BITMIME status
69404 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
69405 <literal> address_rewrite            </literal>  address rewriting
69406 <literal> all_parents                </literal>  all parents in =&gt; lines
69407 <literal> arguments                  </literal>  command line arguments
69408 <literal>*connection_reject          </literal>  connection rejections
69409 <literal>*delay_delivery             </literal>  immediate delivery delayed
69410 <literal> deliver_time               </literal>  time taken to attempt delivery
69411 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
69412 <literal>*dkim                       </literal>  DKIM verified domain on &lt;= lines
69413 <literal> dkim_verbose               </literal>  separate full DKIM verification result line, per signature
69414 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
69415 <literal> dnssec                     </literal>  DNSSEC secured lookups
69416 <literal>*etrn                       </literal>  ETRN commands
69417 <literal>*host_lookup_failed         </literal>  as it says
69418 <literal> ident_timeout              </literal>  timeout for ident connection
69419 <literal> incoming_interface         </literal>  local interface on &lt;= and =&gt; lines
69420 <literal> incoming_port              </literal>  remote port on &lt;= lines
69421 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
69422 <literal> millisec                   </literal>  millisecond timestamps and RT,QT,DT,D times
69423 <literal>*msg_id                     </literal>  on &lt;= lines, Message-ID: header value
69424 <literal> msg_id_created             </literal>  on &lt;= lines, Message-ID: header value when one had to be added
69425 <literal> outgoing_interface         </literal>  local interface on =&gt; lines
69426 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
69427 <literal>*queue_run                  </literal>  start and end queue runs
69428 <literal> queue_time                 </literal>  time on queue for one recipient
69429 <literal> queue_time_overall         </literal>  time on queue for whole message
69430 <literal> pid                        </literal>  Exim process id
69431 <literal> pipelining                 </literal>  PIPELINING use, on &lt;= and =&gt; lines
69432 <literal> proxy                      </literal>  proxy address on &lt;= and =&gt; lines
69433 <literal> receive_time               </literal>  time taken to receive message
69434 <literal> received_recipients        </literal>  recipients on &lt;= lines
69435 <literal> received_sender            </literal>  sender on &lt;= lines
69436 <literal>*rejected_header            </literal>  header contents on reject log
69437 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
69438 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
69439 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
69440 <literal>*sender_verify_fail         </literal>  sender verification failures
69441 <literal>*size_reject                </literal>  rejection because too big
69442 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
69443 <literal>*smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
69444 <literal> smtp_connection            </literal>  incoming SMTP connections
69445 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
69446 <literal> smtp_mailauth              </literal>  AUTH argument to MAIL commands
69447 <literal> smtp_no_mail               </literal>  session with no MAIL commands
69448 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
69449 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
69450 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
69451 <literal>*tls_certificate_verified   </literal>  certificate verification status
69452 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
69453 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
69454 <literal> tls_sni                    </literal>  TLS SNI on &lt;= lines
69455 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
69456
69457 <literal> all                        </literal>  all of the above
69458 </literallayout>
69459 <para>
69460 See also the <option>slow_lookup_log</option> main configuration option,
69461 section <xref linkend="SECID99"/>
69462 </para>
69463 <para>
69464 More details on each of these items follows:
69465 </para>
69466 <itemizedlist>
69467 <listitem>
69468 <para>
69469 <indexterm role="concept">
69470 <primary>8BITMIME</primary>
69471 </indexterm>
69472 <indexterm role="concept">
69473 <primary>log</primary>
69474 <secondary>8BITMIME</secondary>
69475 </indexterm>
69476 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
69477 which may help in tracking down interoperability issues with ancient MTAs
69478 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
69479 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
69480 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
69481 </para>
69482 </listitem>
69483 <listitem>
69484 <para>
69485 <indexterm role="concept">
69486 <primary><option>warn</option> ACL verb</primary>
69487 <secondary>log when skipping</secondary>
69488 </indexterm>
69489 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
69490 its conditions cannot be evaluated, a log line to this effect is written if
69491 this log selector is set.
69492 </para>
69493 </listitem>
69494 <listitem>
69495 <para>
69496 <indexterm role="concept">
69497 <primary>log</primary>
69498 <secondary>rewriting</secondary>
69499 </indexterm>
69500 <indexterm role="concept">
69501 <primary>rewriting</primary>
69502 <secondary>logging</secondary>
69503 </indexterm>
69504 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
69505 rewrites, but not to rewrites in filters run as an unprivileged user (because
69506 such users cannot access the log).
69507 </para>
69508 </listitem>
69509 <listitem>
69510 <para>
69511 <indexterm role="concept">
69512 <primary>log</primary>
69513 <secondary>full parentage</secondary>
69514 </indexterm>
69515 <option>all_parents</option>: Normally only the original and final addresses are logged on
69516 delivery lines; with this selector, intermediate parents are given in
69517 parentheses between them.
69518 </para>
69519 </listitem>
69520 <listitem>
69521 <para>
69522 <indexterm role="concept">
69523 <primary>log</primary>
69524 <secondary>Exim arguments</secondary>
69525 </indexterm>
69526 <indexterm role="concept">
69527 <primary>Exim arguments, logging</primary>
69528 </indexterm>
69529 <option>arguments</option>: This causes Exim to write the arguments with which it was called
69530 to the main log, preceded by the current working directory. This is a debugging
69531 feature, added to make it easier to find out how certain MUAs call
69532 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
69533 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
69534 that are empty or that contain white space are quoted. Non-printing characters
69535 are shown as escape sequences. This facility cannot log unrecognized arguments,
69536 because the arguments are checked before the configuration file is read. The
69537 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
69538 between the caller and Exim.
69539 </para>
69540 </listitem>
69541 <listitem>
69542 <para>
69543 <indexterm role="concept">
69544 <primary>log</primary>
69545 <secondary>connection rejections</secondary>
69546 </indexterm>
69547 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
69548 connection is rejected, for whatever reason.
69549 </para>
69550 </listitem>
69551 <listitem>
69552 <para>
69553 <indexterm role="concept">
69554 <primary>log</primary>
69555 <secondary>delayed delivery</secondary>
69556 </indexterm>
69557 <indexterm role="concept">
69558 <primary>delayed delivery, logging</primary>
69559 </indexterm>
69560 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
69561 started for an incoming message because the load is too high or too many
69562 messages were received on one connection. Logging does not occur if no delivery
69563 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
69564 </para>
69565 </listitem>
69566 <listitem>
69567 <para>
69568 <indexterm role="concept">
69569 <primary>log</primary>
69570 <secondary>delivery duration</secondary>
69571 </indexterm>
69572 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
69573 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
69574 If millisecond logging is enabled, short times will be shown with greater
69575 precision, eg. <literal>DT=0.304s</literal>.
69576 </para>
69577 </listitem>
69578 <listitem>
69579 <para>
69580 <indexterm role="concept">
69581 <primary>log</primary>
69582 <secondary>message size on delivery</secondary>
69583 </indexterm>
69584 <indexterm role="concept">
69585 <primary>size</primary>
69586 <secondary>of message</secondary>
69587 </indexterm>
69588 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
69589 the <quote>=&gt;</quote> line, tagged with S=.
69590 </para>
69591 </listitem>
69592 <listitem>
69593 <para>
69594 <indexterm role="concept">
69595 <primary>log</primary>
69596 <secondary>DKIM verification</secondary>
69597 </indexterm>
69598 <indexterm role="concept">
69599 <primary>DKIM</primary>
69600 <secondary>verification logging</secondary>
69601 </indexterm>
69602 <option>dkim</option>: For message acceptance log lines, when an DKIM signature in the header
69603 verifies successfully a tag of DKIM is added, with one of the verified domains.
69604 </para>
69605 </listitem>
69606 <listitem>
69607 <para>
69608 <indexterm role="concept">
69609 <primary>log</primary>
69610 <secondary>DKIM verification</secondary>
69611 </indexterm>
69612 <indexterm role="concept">
69613 <primary>DKIM</primary>
69614 <secondary>verification logging</secondary>
69615 </indexterm>
69616 <option>dkim_verbose</option>: A log entry is written for each attempted DKIM verification.
69617 </para>
69618 </listitem>
69619 <listitem>
69620 <para>
69621 <indexterm role="concept">
69622 <primary>log</primary>
69623 <secondary>dnslist defer</secondary>
69624 </indexterm>
69625 <indexterm role="concept">
69626 <primary>DNS list</primary>
69627 <secondary>logging defer</secondary>
69628 </indexterm>
69629 <indexterm role="concept">
69630 <primary>black list (DNS)</primary>
69631 </indexterm>
69632 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
69633 DNS black list suffers a temporary error.
69634 </para>
69635 </listitem>
69636 <listitem>
69637 <para>
69638 <indexterm role="concept">
69639 <primary>log</primary>
69640 <secondary>dnssec</secondary>
69641 </indexterm>
69642 <indexterm role="concept">
69643 <primary>dnssec</primary>
69644 <secondary>logging</secondary>
69645 </indexterm>
69646 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
69647 dns lookups gave secure results a tag of DS is added.
69648 For acceptance this covers the reverse and forward lookups for host name verification.
69649 It does not cover helo-name verification.
69650 For delivery this covers the SRV, MX, A and/or AAAA lookups.
69651 </para>
69652 </listitem>
69653 <listitem>
69654 <para>
69655 <indexterm role="concept">
69656 <primary>log</primary>
69657 <secondary>ETRN commands</secondary>
69658 </indexterm>
69659 <indexterm role="concept">
69660 <primary>ETRN</primary>
69661 <secondary>logging</secondary>
69662 </indexterm>
69663 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
69664 is run to determine whether or not it is actually accepted. An invalid ETRN
69665 command, or one received within a message transaction is not logged by this
69666 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
69667 </para>
69668 </listitem>
69669 <listitem>
69670 <para>
69671 <indexterm role="concept">
69672 <primary>log</primary>
69673 <secondary>host lookup failure</secondary>
69674 </indexterm>
69675 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
69676 any addresses, or when a lookup of an IP address fails to find a host name, a
69677 log line is written. This logging does not apply to direct DNS lookups when
69678 routing email addresses, but it does apply to <quote>byname</quote> lookups.
69679 </para>
69680 </listitem>
69681 <listitem>
69682 <para>
69683 <indexterm role="concept">
69684 <primary>log</primary>
69685 <secondary>ident timeout</secondary>
69686 </indexterm>
69687 <indexterm role="concept">
69688 <primary>RFC 1413</primary>
69689 <secondary>logging timeout</secondary>
69690 </indexterm>
69691 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
69692 client&#x2019;s ident port times out.
69693 </para>
69694 </listitem>
69695 <listitem>
69696 <para>
69697 <indexterm role="concept">
69698 <primary>log</primary>
69699 <secondary>incoming interface</secondary>
69700 </indexterm>
69701 <indexterm role="concept">
69702 <primary>log</primary>
69703 <secondary>local interface</secondary>
69704 </indexterm>
69705 <indexterm role="concept">
69706 <primary>log</primary>
69707 <secondary>local address and port</secondary>
69708 </indexterm>
69709 <indexterm role="concept">
69710 <primary>TCP/IP</primary>
69711 <secondary>logging local address and port</secondary>
69712 </indexterm>
69713 <indexterm role="concept">
69714 <primary>interface</primary>
69715 <secondary>logging</secondary>
69716 </indexterm>
69717 <option>incoming_interface</option>: The interface on which a message was received is added
69718 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
69719 followed by a colon and the port number. The local interface and port are also
69720 added to other SMTP log lines, for example, <quote>SMTP connection from</quote>, to
69721 rejection lines, and (despite the name) to outgoing <quote>=&gt;</quote> and <quote>-&gt;</quote> lines.
69722 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
69723 </para>
69724 </listitem>
69725 <listitem>
69726 <para>
69727 <indexterm role="concept">
69728 <primary>log</primary>
69729 <secondary>incoming proxy address</secondary>
69730 </indexterm>
69731 <indexterm role="concept">
69732 <primary>proxy</primary>
69733 <secondary>logging proxy address</secondary>
69734 </indexterm>
69735 <indexterm role="concept">
69736 <primary>TCP/IP</primary>
69737 <secondary>logging proxy address</secondary>
69738 </indexterm>
69739 <option>proxy</option>: The internal (closest to the system running Exim) IP address
69740 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
69741 on a proxied connection
69742 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
69743 See <xref linkend="SECTproxyInbound"/> for more information.
69744 </para>
69745 </listitem>
69746 <listitem>
69747 <para>
69748 <indexterm role="concept">
69749 <primary>log</primary>
69750 <secondary>incoming remote port</secondary>
69751 </indexterm>
69752 <indexterm role="concept">
69753 <primary>port</primary>
69754 <secondary>logging remote</secondary>
69755 </indexterm>
69756 <indexterm role="concept">
69757 <primary>TCP/IP</primary>
69758 <secondary>logging incoming remote port</secondary>
69759 </indexterm>
69760 <indexterm role="variable">
69761 <primary><varname>$sender_fullhost</varname></primary>
69762 </indexterm>
69763 <indexterm role="variable">
69764 <primary><varname>$sender_rcvhost</varname></primary>
69765 </indexterm>
69766 <option>incoming_port</option>: The remote port number from which a message was received is
69767 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
69768 in square brackets, and separated from it by a colon. This is implemented by
69769 changing the value that is put in the <varname>$sender_fullhost</varname> and
69770 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
69771 important with the widening use of NAT (see RFC 2505).
69772 </para>
69773 </listitem>
69774 <listitem>
69775 <para>
69776 <indexterm role="concept">
69777 <primary>log</primary>
69778 <secondary>dropped connection</secondary>
69779 </indexterm>
69780 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
69781 connection is unexpectedly dropped.
69782 </para>
69783 </listitem>
69784 <listitem>
69785 <para>
69786 <indexterm role="concept">
69787 <primary>log</primary>
69788 <secondary>millisecond timestamps</secondary>
69789 </indexterm>
69790 <indexterm role="concept">
69791 <primary>millisecond</primary>
69792 <secondary>logging</secondary>
69793 </indexterm>
69794 <indexterm role="concept">
69795 <primary>timestamps</primary>
69796 <secondary>millisecond, in logs</secondary>
69797 </indexterm>
69798 <option>millisec</option>: Timestamps have a period and three decimal places of finer granularity
69799 appended to the seconds value.
69800 </para>
69801 </listitem>
69802 <listitem>
69803 <para>
69804 <indexterm role="concept">
69805 <primary>log</primary>
69806 <secondary>message id</secondary>
69807 </indexterm>
69808 <option>msg_id</option>: The value of the Message-ID: header.
69809 </para>
69810 </listitem>
69811 <listitem>
69812 <para>
69813 <option>msg_id_created</option>: The value of the Message-ID: header, when one had to be created.
69814 This will be either because the message is a bounce, or was submitted locally
69815 (submission mode) without one.
69816 The field identifier will have an asterix appended: <quote>id*=</quote>.
69817 </para>
69818 </listitem>
69819 <listitem>
69820 <para>
69821 <indexterm role="concept">
69822 <primary>log</primary>
69823 <secondary>outgoing interface</secondary>
69824 </indexterm>
69825 <indexterm role="concept">
69826 <primary>log</primary>
69827 <secondary>local interface</secondary>
69828 </indexterm>
69829 <indexterm role="concept">
69830 <primary>log</primary>
69831 <secondary>local address and port</secondary>
69832 </indexterm>
69833 <indexterm role="concept">
69834 <primary>TCP/IP</primary>
69835 <secondary>logging local address and port</secondary>
69836 </indexterm>
69837 <indexterm role="concept">
69838 <primary>interface</primary>
69839 <secondary>logging</secondary>
69840 </indexterm>
69841 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
69842 interface on which a message was sent is added to delivery lines as an I= tag
69843 followed by IP address in square brackets. You can disable this by turning
69844 off the <option>outgoing_interface</option> option.
69845 </para>
69846 </listitem>
69847 <listitem>
69848 <para>
69849 <indexterm role="concept">
69850 <primary>log</primary>
69851 <secondary>outgoing remote port</secondary>
69852 </indexterm>
69853 <indexterm role="concept">
69854 <primary>port</primary>
69855 <secondary>logging outgoing remote</secondary>
69856 </indexterm>
69857 <indexterm role="concept">
69858 <primary>TCP/IP</primary>
69859 <secondary>logging outgoing remote port</secondary>
69860 </indexterm>
69861 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
69862 containing =&gt; tags) following the IP address.
69863 The local port is also added if <option>incoming_interface</option> and
69864 <option>outgoing_interface</option> are both enabled.
69865 This option is not included in the default setting, because for most ordinary
69866 configurations, the remote port number is always 25 (the SMTP port), and the
69867 local port is a random ephemeral port.
69868 </para>
69869 </listitem>
69870 <listitem>
69871 <para>
69872 <indexterm role="concept">
69873 <primary>log</primary>
69874 <secondary>process ids in</secondary>
69875 </indexterm>
69876 <indexterm role="concept">
69877 <primary>pid (process id)</primary>
69878 <secondary>in log lines</secondary>
69879 </indexterm>
69880 <option>pid</option>: The current process id is added to every log line, in square brackets,
69881 immediately after the time and date.
69882 </para>
69883 </listitem>
69884 <listitem>
69885 <para>
69886 <indexterm role="concept">
69887 <primary>log</primary>
69888 <secondary>pipelining</secondary>
69889 </indexterm>
69890 <indexterm role="concept">
69891 <primary>pipelining</primary>
69892 <secondary>logging outgoing</secondary>
69893 </indexterm>
69894 <option>pipelining</option>: A field is added to delivery and accept
69895 log lines when the ESMTP PIPELINING extension was used.
69896 The field is a single "L".
69897 </para>
69898 <para>
69899 On accept lines, where PIPELINING was offered but not used by the client,
69900 the field has a minus appended.
69901 </para>
69902 <para>
69903 <indexterm role="concept">
69904 <primary>pipelining</primary>
69905 <secondary>early connection</secondary>
69906 </indexterm>
69907 If Exim is built with the SUPPORT_PIPE_CONNECT build option
69908 accept "L" fields have a period appended if the feature was
69909 offered but not used, or an asterisk appended if used.
69910 Delivery "L" fields have an asterisk appended if used.
69911 </para>
69912 </listitem>
69913 <listitem>
69914 <para>
69915 <indexterm role="concept">
69916 <primary>log</primary>
69917 <secondary>queue run</secondary>
69918 </indexterm>
69919 <indexterm role="concept">
69920 <primary>queue runner</primary>
69921 <secondary>logging</secondary>
69922 </indexterm>
69923 <option>queue_run</option>: The start and end of every queue run are logged.
69924 </para>
69925 </listitem>
69926 <listitem>
69927 <para>
69928 <indexterm role="concept">
69929 <primary>log</primary>
69930 <secondary>queue time</secondary>
69931 </indexterm>
69932 <option>queue_time</option>: The amount of time the message has been in the queue on the
69933 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
69934 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
69935 includes reception time as well as the delivery time for the current address.
69936 This means that it may be longer than the difference between the arrival and
69937 delivery log line times, because the arrival log line is not written until the
69938 message has been successfully received.
69939 If millisecond logging is enabled, short times will be shown with greater
69940 precision, eg. <literal>QT=1.578s</literal>.
69941 </para>
69942 </listitem>
69943 <listitem>
69944 <para>
69945 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
69946 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
69947 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
69948 message, so it includes reception time as well as the total delivery time.
69949 </para>
69950 </listitem>
69951 <listitem>
69952 <para>
69953 <indexterm role="concept">
69954 <primary>log</primary>
69955 <secondary>receive duration</secondary>
69956 </indexterm>
69957 <option>receive_time</option>: For each message, the amount of real time it has taken to
69958 perform the reception is logged as RT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>RT=1s</literal>.
69959 If millisecond logging is enabled, short times will be shown with greater
69960 precision, eg. <literal>RT=0.204s</literal>.
69961 </para>
69962 </listitem>
69963 <listitem>
69964 <para>
69965 <indexterm role="concept">
69966 <primary>log</primary>
69967 <secondary>recipients</secondary>
69968 </indexterm>
69969 <option>received_recipients</option>: The recipients of a message are listed in the main log
69970 as soon as the message is received. The list appears at the end of the log line
69971 that is written when a message is received, preceded by the word <quote>for</quote>. The
69972 addresses are listed after they have been qualified, but before any rewriting
69973 has taken place.
69974 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
69975 in the list.
69976 </para>
69977 </listitem>
69978 <listitem>
69979 <para>
69980 <indexterm role="concept">
69981 <primary>log</primary>
69982 <secondary>sender reception</secondary>
69983 </indexterm>
69984 <option>received_sender</option>: The unrewritten original sender of a message is added to
69985 the end of the log line that records the message&#x2019;s arrival, after the word
69986 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
69987 </para>
69988 </listitem>
69989 <listitem>
69990 <para>
69991 <indexterm role="concept">
69992 <primary>log</primary>
69993 <secondary>header lines for rejection</secondary>
69994 </indexterm>
69995 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
69996 rejection is written to the reject log, the complete header is added to the
69997 log. Header logging can be turned off individually for messages that are
69998 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
69999 </para>
70000 </listitem>
70001 <listitem>
70002 <para>
70003 <indexterm role="concept">
70004 <primary>log</primary>
70005 <secondary>retry defer</secondary>
70006 </indexterm>
70007 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
70008 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
70009 message is always omitted from individual message logs after the first delivery
70010 attempt.
70011 </para>
70012 </listitem>
70013 <listitem>
70014 <para>
70015 <indexterm role="concept">
70016 <primary>log</primary>
70017 <secondary>return path</secondary>
70018 </indexterm>
70019 <option>return_path_on_delivery</option>: The return path that is being transmitted with
70020 the message is included in delivery and bounce lines, using the tag P=.
70021 This is omitted if no delivery actually happens, for example, if routing fails,
70022 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
70023 </para>
70024 </listitem>
70025 <listitem>
70026 <para>
70027 <indexterm role="concept">
70028 <primary>log</primary>
70029 <secondary>sender on delivery</secondary>
70030 </indexterm>
70031 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
70032 and bounce line, tagged by F= (for <quote>from</quote>).
70033 This is the original sender that was received with the message; it is not
70034 necessarily the same as the outgoing return path.
70035 </para>
70036 </listitem>
70037 <listitem>
70038 <para>
70039 <indexterm role="concept">
70040 <primary>log</primary>
70041 <secondary>sender verify failure</secondary>
70042 </indexterm>
70043 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
70044 gives details of a sender verification failure is not written. Log lines for
70045 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
70046 detail is lost.
70047 </para>
70048 </listitem>
70049 <listitem>
70050 <para>
70051 <indexterm role="concept">
70052 <primary>log</primary>
70053 <secondary>size rejection</secondary>
70054 </indexterm>
70055 <option>size_reject</option>: A log line is written whenever a message is rejected because
70056 it is too big.
70057 </para>
70058 </listitem>
70059 <listitem>
70060 <para>
70061 <indexterm role="concept">
70062 <primary>log</primary>
70063 <secondary>frozen messages; skipped</secondary>
70064 </indexterm>
70065 <indexterm role="concept">
70066 <primary>frozen messages</primary>
70067 <secondary>logging skipping</secondary>
70068 </indexterm>
70069 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
70070 queue run because it is frozen or because another process is already delivering
70071 it.
70072 <indexterm role="concept">
70073 <primary><quote>spool file is locked</quote></primary>
70074 </indexterm>
70075 The message that is written is <quote>spool file is locked</quote>.
70076 </para>
70077 </listitem>
70078 <listitem>
70079 <para>
70080 <indexterm role="concept">
70081 <primary>log</primary>
70082 <secondary>smtp confirmation</secondary>
70083 </indexterm>
70084 <indexterm role="concept">
70085 <primary>SMTP</primary>
70086 <secondary>logging confirmation</secondary>
70087 </indexterm>
70088 <indexterm role="concept">
70089 <primary>LMTP</primary>
70090 <secondary>logging confirmation</secondary>
70091 </indexterm>
70092 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
70093 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
70094 A number of MTAs (including Exim) return an identifying string in this
70095 response.
70096 </para>
70097 </listitem>
70098 <listitem>
70099 <para>
70100 <indexterm role="concept">
70101 <primary>log</primary>
70102 <secondary>SMTP connections</secondary>
70103 </indexterm>
70104 <indexterm role="concept">
70105 <primary>SMTP</primary>
70106 <secondary>logging connections</secondary>
70107 </indexterm>
70108 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
70109 established or closed, unless the connection is from a host that matches
70110 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
70111 only when the closure is unexpected.) This applies to connections from local
70112 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
70113 dropped in the middle of a message, a log line is always written, whether or
70114 not this selector is set, but otherwise nothing is written at the start and end
70115 of connections unless this selector is enabled.
70116 </para>
70117 <para>
70118 For TCP/IP connections to an Exim daemon, the current number of connections is
70119 included in the log message for each new connection, but note that the count is
70120 reset if the daemon is restarted.
70121 Also, because connections are closed (and the closure is logged) in
70122 subprocesses, the count may not include connections that have been closed but
70123 whose termination the daemon has not yet noticed. Thus, while it is possible to
70124 match up the opening and closing of connections in the log, the value of the
70125 logged counts may not be entirely accurate.
70126 </para>
70127 </listitem>
70128 <listitem>
70129 <para>
70130 <indexterm role="concept">
70131 <primary>log</primary>
70132 <secondary>SMTP transaction; incomplete</secondary>
70133 </indexterm>
70134 <indexterm role="concept">
70135 <primary>SMTP</primary>
70136 <secondary>logging incomplete transactions</secondary>
70137 </indexterm>
70138 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
70139 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
70140 and the message sender plus any accepted recipients are included in the log
70141 line. This can provide evidence of dictionary attacks.
70142 </para>
70143 </listitem>
70144 <listitem>
70145 <para>
70146 <indexterm role="concept">
70147 <primary>log</primary>
70148 <secondary>non-MAIL SMTP sessions</secondary>
70149 </indexterm>
70150 <indexterm role="concept">
70151 <primary>MAIL</primary>
70152 <secondary>logging session without</secondary>
70153 </indexterm>
70154 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
70155 connection terminates without having issued a MAIL command. This includes both
70156 the case when the connection is dropped, and the case when QUIT is used. It
70157 does not include cases where the connection is rejected right at the start (by
70158 an ACL, or because there are too many connections, or whatever). These cases
70159 already have their own log lines.
70160 </para>
70161 <para>
70162 The log line that is written contains the identity of the client in the usual
70163 way, followed by D= and a time, which records the duration of the connection.
70164 If the connection was authenticated, this fact is logged exactly as it is for
70165 an incoming message, with an A= item. If the connection was encrypted, CV=,
70166 DN=, and X= items may appear as they do for an incoming message, controlled by
70167 the same logging options.
70168 </para>
70169 <para>
70170 Finally, if any SMTP commands were issued during the connection, a C= item
70171 is added to the line, listing the commands that were used. For example,
70172 </para>
70173 <literallayout class="monospaced">
70174 C=EHLO,QUIT
70175 </literallayout>
70176 <para>
70177 shows that the client issued QUIT straight after EHLO. If there were fewer
70178 than 20 commands, they are all listed. If there were more than 20 commands,
70179 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
70180 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
70181 have been aborted before 20 non-mail commands are processed.
70182 </para>
70183 </listitem>
70184 <listitem>
70185 <para>
70186 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
70187 colon-separated, is appended to the A= item for a message arrival or delivery
70188 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
70189 was accepted or used.
70190 </para>
70191 </listitem>
70192 <listitem>
70193 <para>
70194 <indexterm role="concept">
70195 <primary>log</primary>
70196 <secondary>SMTP protocol error</secondary>
70197 </indexterm>
70198 <indexterm role="concept">
70199 <primary>SMTP</primary>
70200 <secondary>logging protocol error</secondary>
70201 </indexterm>
70202 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
70203 encountered. Exim does not have perfect detection of all protocol errors
70204 because of transmission delays and the use of pipelining. If PIPELINING has
70205 been advertised to a client, an Exim server assumes that the client will use
70206 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
70207 received after rejecting MAIL) as protocol errors.
70208 </para>
70209 </listitem>
70210 <listitem>
70211 <para>
70212 <indexterm role="concept">
70213 <primary>SMTP</primary>
70214 <secondary>logging syntax errors</secondary>
70215 </indexterm>
70216 <indexterm role="concept">
70217 <primary>SMTP</primary>
70218 <secondary>syntax errors; logging</secondary>
70219 </indexterm>
70220 <indexterm role="concept">
70221 <primary>SMTP</primary>
70222 <secondary>unknown command; logging</secondary>
70223 </indexterm>
70224 <indexterm role="concept">
70225 <primary>log</primary>
70226 <secondary>unknown SMTP command</secondary>
70227 </indexterm>
70228 <indexterm role="concept">
70229 <primary>log</primary>
70230 <secondary>SMTP syntax error</secondary>
70231 </indexterm>
70232 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
70233 encountered. An unrecognized command is treated as a syntax error. For an
70234 external connection, the host identity is given; for an internal connection
70235 using <option>-bs</option> the sender identification (normally the calling user) is given.
70236 </para>
70237 </listitem>
70238 <listitem>
70239 <para>
70240 <indexterm role="concept">
70241 <primary>log</primary>
70242 <secondary>subject</secondary>
70243 </indexterm>
70244 <indexterm role="concept">
70245 <primary>subject, logging</primary>
70246 </indexterm>
70247 <option>subject</option>: The subject of the message is added to the arrival log line,
70248 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
70249 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
70250 specifies whether characters with values greater than 127 should be logged
70251 unchanged, or whether they should be rendered as escape sequences.
70252 </para>
70253 </listitem>
70254 <listitem>
70255 <para>
70256 <indexterm role="concept">
70257 <primary>log</primary>
70258 <secondary>certificate verification</secondary>
70259 </indexterm>
70260 <indexterm role="concept">
70261 <primary>log</primary>
70262 <secondary>DANE</secondary>
70263 </indexterm>
70264 <indexterm role="concept">
70265 <primary>DANE</primary>
70266 <secondary>logging</secondary>
70267 </indexterm>
70268 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
70269 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
70270 verified
70271 using a CA trust anchor,
70272 <literal>CA=dane</literal> if using a DNS trust anchor,
70273 and <literal>CV=no</literal> if not.
70274 </para>
70275 </listitem>
70276 <listitem>
70277 <para>
70278 <indexterm role="concept">
70279 <primary>log</primary>
70280 <secondary>TLS cipher</secondary>
70281 </indexterm>
70282 <indexterm role="concept">
70283 <primary>TLS</primary>
70284 <secondary>logging cipher</secondary>
70285 </indexterm>
70286 <option>tls_cipher</option>: When a message is sent or received over an encrypted
70287 connection, the cipher suite used is added to the log line, preceded by X=.
70288 </para>
70289 </listitem>
70290 <listitem>
70291 <para>
70292 <indexterm role="concept">
70293 <primary>log</primary>
70294 <secondary>TLS peer DN</secondary>
70295 </indexterm>
70296 <indexterm role="concept">
70297 <primary>TLS</primary>
70298 <secondary>logging peer DN</secondary>
70299 </indexterm>
70300 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
70301 connection, and a certificate is supplied by the remote host, the peer DN is
70302 added to the log line, preceded by DN=.
70303 </para>
70304 </listitem>
70305 <listitem>
70306 <para>
70307 <indexterm role="concept">
70308 <primary>log</primary>
70309 <secondary>TLS SNI</secondary>
70310 </indexterm>
70311 <indexterm role="concept">
70312 <primary>TLS</primary>
70313 <secondary>logging SNI</secondary>
70314 </indexterm>
70315 <option>tls_sni</option>: When a message is received over an encrypted connection, and
70316 the remote host provided the Server Name Indication extension, the SNI is
70317 added to the log line, preceded by SNI=.
70318 </para>
70319 </listitem>
70320 <listitem>
70321 <para>
70322 <indexterm role="concept">
70323 <primary>log</primary>
70324 <secondary>DNS failure in list</secondary>
70325 </indexterm>
70326 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
70327 result of a list match is failure because a DNS lookup failed.
70328 </para>
70329 </listitem>
70330 </itemizedlist>
70331 </section>
70332 <section id="SECID260">
70333 <title>Message log</title>
70334 <para>
70335 <indexterm role="concept">
70336 <primary>message</primary>
70337 <secondary>log file for</secondary>
70338 </indexterm>
70339 <indexterm role="concept">
70340 <primary>log</primary>
70341 <secondary>message log; description of</secondary>
70342 </indexterm>
70343 <indexterm role="concept">
70344 <primary><filename>msglog</filename> directory</primary>
70345 </indexterm>
70346 <indexterm role="option">
70347 <primary><option>preserve_message_logs</option></primary>
70348 </indexterm>
70349 In addition to the general log files, Exim writes a log file for each message
70350 that it handles. The names of these per-message logs are the message ids, and
70351 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
70352 message log contains copies of the log lines that apply to the message. This
70353 makes it easier to inspect the status of an individual message without having
70354 to search the main log. A message log is deleted when processing of the message
70355 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
70356 only with great care because they can fill up your disk very quickly.
70357 </para>
70358 <para>
70359 On a heavily loaded system, it may be desirable to disable the use of
70360 per-message logs, in order to reduce disk I/O. This can be done by setting the
70361 <option>message_logs</option> option false.
70362 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
70363 </para>
70364 </section>
70365 </chapter>
70366
70367 <chapter id="CHAPutils">
70368 <title>Exim utilities</title>
70369 <para>
70370 <indexterm role="concept" id="IIDutils" class="startofrange">
70371 <primary>utilities</primary>
70372 </indexterm>
70373 A number of utility scripts and programs are supplied with Exim and are
70374 described in this chapter. There is also the Exim Monitor, which is covered in
70375 the next chapter. The utilities described here are:
70376 </para>
70377 <informaltable frame="none">
70378 <tgroup cols="3" colsep="0" rowsep="0">
70379 <colspec colwidth="7*" align="left"/>
70380 <colspec colwidth="15*" align="left"/>
70381 <colspec colwidth="40*" align="left"/>
70382 <tbody>
70383 <row>
70384 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
70385 <entry><emphasis>exiwhat</emphasis></entry>
70386 <entry>list what Exim processes are doing</entry>
70387 </row>
70388 <row>
70389 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
70390 <entry><emphasis>exiqgrep</emphasis></entry>
70391 <entry>grep the queue</entry>
70392 </row>
70393 <row>
70394 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
70395 <entry><emphasis>exiqsumm</emphasis></entry>
70396 <entry>summarize the queue</entry>
70397 </row>
70398 <row>
70399 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
70400 <entry><emphasis>exigrep</emphasis></entry>
70401 <entry>search the main log</entry>
70402 </row>
70403 <row>
70404 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
70405 <entry><emphasis>exipick</emphasis></entry>
70406 <entry>select messages on various criteria</entry>
70407 </row>
70408 <row>
70409 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
70410 <entry><emphasis>exicyclog</emphasis></entry>
70411 <entry>cycle (rotate) log files</entry>
70412 </row>
70413 <row>
70414 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
70415 <entry><emphasis>eximstats</emphasis></entry>
70416 <entry>extract statistics from the log</entry>
70417 </row>
70418 <row>
70419 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
70420 <entry><emphasis>exim_checkaccess</emphasis></entry>
70421 <entry>check address acceptance from given IP</entry>
70422 </row>
70423 <row>
70424 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
70425 <entry><emphasis>exim_dbmbuild</emphasis></entry>
70426 <entry>build a DBM file</entry>
70427 </row>
70428 <row>
70429 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
70430 <entry><emphasis>exinext</emphasis></entry>
70431 <entry>extract retry information</entry>
70432 </row>
70433 <row>
70434 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdumpdb"/></entry>
70435 <entry><emphasis>exim_dumpdb</emphasis></entry>
70436 <entry>dump a hints database</entry>
70437 </row>
70438 <row>
70439 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTtidydb"/></entry>
70440 <entry><emphasis>exim_tidydb</emphasis></entry>
70441 <entry>clean up a hints database</entry>
70442 </row>
70443 <row>
70444 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfixdb"/></entry>
70445 <entry><emphasis>exim_fixdb</emphasis></entry>
70446 <entry>patch a hints database</entry>
70447 </row>
70448 <row>
70449 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
70450 <entry><emphasis>exim_lock</emphasis></entry>
70451 <entry>lock a mailbox file</entry>
70452 </row>
70453 </tbody>
70454 </tgroup>
70455 </informaltable>
70456 <para>
70457 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
70458 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
70459 <emphasis role="bold"><ulink url="https://duncanthrax.net/exilog/">https://duncanthrax.net/exilog/</ulink></emphasis> for details.
70460 </para>
70461 <section id="SECTfinoutwha">
70462 <title>Finding out what Exim processes are doing (exiwhat)</title>
70463 <para>
70464 <indexterm role="concept">
70465 <primary><emphasis>exiwhat</emphasis></primary>
70466 </indexterm>
70467 <indexterm role="concept">
70468 <primary>process, querying</primary>
70469 </indexterm>
70470 <indexterm role="concept">
70471 <primary>SIGUSR1</primary>
70472 </indexterm>
70473 On operating systems that can restart a system call after receiving a signal
70474 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
70475 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
70476 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
70477 processes it can find, having first emptied the file. It then waits for one
70478 second to allow the Exim processes to react before displaying the results. In
70479 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
70480 send the signal to the Exim processes, so it is normally run as root.
70481 </para>
70482 <para>
70483 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
70484 use by system administrators. It is not sensible, for example, to set up a
70485 script that sends SIGUSR1 signals to Exim processes at short intervals.
70486 </para>
70487 <para>
70488 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
70489 varies in different operating systems. Not only are different options used,
70490 but the format of the output is different. For this reason, there are some
70491 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
70492 it doesn&#x2019;t seem to be working for you, check the following compile-time
70493 options:
70494 </para>
70495 <literallayout>
70496 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
70497 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
70498 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
70499 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
70500 </literallayout>
70501 <para>
70502 An example of typical output from <emphasis>exiwhat</emphasis> is
70503 </para>
70504 <literallayout class="monospaced">
70505 164 daemon: -q1h, listening on port 25
70506 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
70507 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
70508   [10.19.42.42] (editor@ref.example)
70509 10592 handling incoming call from [192.168.243.242]
70510 10628 accepting a local non-SMTP message
70511 </literallayout>
70512 <para>
70513 The first number in the output line is the process number. The third line has
70514 been split here, in order to fit it on the page.
70515 </para>
70516 </section>
70517 <section id="SECTgreptheque">
70518 <title>Selective queue listing (exiqgrep)</title>
70519 <para>
70520 <indexterm role="concept">
70521 <primary><emphasis>exiqgrep</emphasis></primary>
70522 </indexterm>
70523 <indexterm role="concept">
70524 <primary>queue</primary>
70525 <secondary>grepping</secondary>
70526 </indexterm>
70527 This utility is a Perl script contributed by Matt Hubbard. It runs
70528 </para>
70529 <literallayout class="monospaced">
70530 exim -bpu
70531 </literallayout>
70532 <para>
70533 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
70534 </para>
70535 <literallayout class="monospaced">
70536 exim -bp
70537 </literallayout>
70538 <para>
70539 The <emphasis role="bold">-C</emphasis> option is used to specify an alternate <filename>exim.conf</filename> which might
70540 contain alternate exim configuration the queue management might be using.
70541 </para>
70542 <para>
70543 to obtain a queue listing, and then greps the output to select messages
70544 that match given criteria. The following selection options are available:
70545 </para>
70546 <variablelist>
70547 <varlistentry>
70548 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
70549 <listitem>
70550 <para>
70551 Match the sender address using a case-insensitive search. The field that is
70552 tested is enclosed in angle brackets, so you can test for bounce messages with
70553 </para>
70554 <literallayout class="monospaced">
70555 exiqgrep -f '^&lt;&gt;$'
70556 </literallayout>
70557 </listitem></varlistentry>
70558 <varlistentry>
70559 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
70560 <listitem>
70561 <para>
70562 Match a recipient address using a case-insensitive search. The field that is
70563 tested is not enclosed in angle brackets.
70564 </para>
70565 </listitem></varlistentry>
70566 <varlistentry>
70567 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
70568 <listitem>
70569 <para>
70570 Match against the size field.
70571 </para>
70572 </listitem></varlistentry>
70573 <varlistentry>
70574 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
70575 <listitem>
70576 <para>
70577 Match messages that are younger than the given time.
70578 </para>
70579 </listitem></varlistentry>
70580 <varlistentry>
70581 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
70582 <listitem>
70583 <para>
70584 Match messages that are older than the given time.
70585 </para>
70586 </listitem></varlistentry>
70587 <varlistentry>
70588 <term><emphasis role="bold">-z</emphasis></term>
70589 <listitem>
70590 <para>
70591 Match only frozen messages.
70592 </para>
70593 </listitem></varlistentry>
70594 <varlistentry>
70595 <term><emphasis role="bold">-x</emphasis></term>
70596 <listitem>
70597 <para>
70598 Match only non-frozen messages.
70599 </para>
70600 </listitem></varlistentry>
70601 <varlistentry>
70602 <term><emphasis role="bold">-G</emphasis>&nbsp;&lt;<emphasis>queuename</emphasis>&gt;</term>
70603 <listitem>
70604 <para>
70605 Match only messages in the given queue.  Without this, the default queue is searched.
70606 </para>
70607 </listitem></varlistentry>
70608 </variablelist>
70609 <para>
70610 The following options control the format of the output:
70611 </para>
70612 <variablelist>
70613 <varlistentry>
70614 <term><emphasis role="bold">-c</emphasis></term>
70615 <listitem>
70616 <para>
70617 Display only the count of matching messages.
70618 </para>
70619 </listitem></varlistentry>
70620 <varlistentry>
70621 <term><emphasis role="bold">-l</emphasis></term>
70622 <listitem>
70623 <para>
70624 Long format &ndash; display the full message information as output by Exim. This is
70625 the default.
70626 </para>
70627 </listitem></varlistentry>
70628 <varlistentry>
70629 <term><emphasis role="bold">-i</emphasis></term>
70630 <listitem>
70631 <para>
70632 Display message ids only.
70633 </para>
70634 </listitem></varlistentry>
70635 <varlistentry>
70636 <term><emphasis role="bold">-b</emphasis></term>
70637 <listitem>
70638 <para>
70639 Brief format &ndash; one line per message.
70640 </para>
70641 </listitem></varlistentry>
70642 <varlistentry>
70643 <term><emphasis role="bold">-R</emphasis></term>
70644 <listitem>
70645 <para>
70646 Display messages in reverse order.
70647 </para>
70648 </listitem></varlistentry>
70649 <varlistentry>
70650 <term><emphasis role="bold">-a</emphasis></term>
70651 <listitem>
70652 <para>
70653 Include delivered recipients in queue listing.
70654 </para>
70655 </listitem></varlistentry>
70656 </variablelist>
70657 <para>
70658 There is one more option, <option>-h</option>, which outputs a list of options.
70659 </para>
70660 </section>
70661 <section id="SECTsumtheque">
70662 <title>Summarizing the queue (exiqsumm)</title>
70663 <para>
70664 <indexterm role="concept">
70665 <primary><emphasis>exiqsumm</emphasis></primary>
70666 </indexterm>
70667 <indexterm role="concept">
70668 <primary>queue</primary>
70669 <secondary>summary</secondary>
70670 </indexterm>
70671 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
70672 -bp</literal> and produces a summary of the messages in the queue. Thus, you use it by
70673 running a command such as
70674 </para>
70675 <literallayout class="monospaced">
70676 exim -bp | exiqsumm
70677 </literallayout>
70678 <para>
70679 The output consists of one line for each domain that has messages waiting for
70680 it, as in the following example:
70681 </para>
70682 <literallayout class="monospaced">
70683 3   2322   74m   66m  msn.com.example
70684 </literallayout>
70685 <para>
70686 Each line lists the number of pending deliveries for a domain, their total
70687 volume, and the length of time that the oldest and the newest messages have
70688 been waiting. Note that the number of pending deliveries is greater than the
70689 number of messages when messages have more than one recipient.
70690 </para>
70691 <para>
70692 A summary line is output at the end. By default the output is sorted on the
70693 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
70694 the output to be sorted by oldest message and by count of messages,
70695 respectively. There are also three options that split the messages for each
70696 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
70697 separates frozen messages, and <option>-s</option> separates messages according to their
70698 sender.
70699 </para>
70700 <para>
70701 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
70702 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
70703 generated by aliasing or forwarding are included (unless the <option>one_time</option>
70704 option of the <command>redirect</command> router has been used to convert them into <quote>top
70705 level</quote> addresses).
70706 </para>
70707 </section>
70708 <section id="SECTextspeinf">
70709 <title>Extracting specific information from the log (exigrep)</title>
70710 <para>
70711 <indexterm role="concept">
70712 <primary><emphasis>exigrep</emphasis></primary>
70713 </indexterm>
70714 <indexterm role="concept">
70715 <primary>log</primary>
70716 <secondary>extracts; grepping for</secondary>
70717 </indexterm>
70718 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
70719 files for entries that match a given pattern. When it finds a match, it
70720 extracts all the log entries for the relevant message, not just those that
70721 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
70722 given message, or all mail for a given user, or for a given host, for example.
70723 The input files can be in Exim log format or syslog format.
70724 If a matching log line is not associated with a specific message, it is
70725 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
70726 </para>
70727 <literallayout>
70728 <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>
70729 </literallayout>
70730 <para>
70731 If no log filenames are given on the command line, the standard input is read.
70732 </para>
70733 <para>
70734 The <option>-t</option> argument specifies a number of seconds. It adds an additional
70735 condition for message selection. Messages that are complete are shown only if
70736 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds in the queue.
70737 </para>
70738 <para>
70739 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
70740 makes it case-sensitive. This may give a performance improvement when searching
70741 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
70742 option; with <option>-I</option> they do not. In both cases it is possible to change the
70743 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
70744 </para>
70745 <para>
70746 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
70747 pattern as standing for themselves. Otherwise the pattern must be a Perl
70748 regular expression.
70749 </para>
70750 <para>
70751 The <option>-v</option> option inverts the matching condition. That is, a line is selected
70752 if it does <emphasis>not</emphasis> match the pattern.
70753 </para>
70754 <para>
70755 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
70756 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
70757 normally.
70758 </para>
70759 <para>
70760 Example of <option>-M</option>:
70761 user_a sends a message to user_b, which generates a bounce back to user_b. If
70762 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
70763 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
70764 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
70765 when searching for <quote>user_a</quote> will show both messages since the bounce is
70766 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
70767 search term.
70768 </para>
70769 <para>
70770 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
70771 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
70772 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
70773 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
70774 autodetection of some well known compression extensions.
70775 </para>
70776 </section>
70777 <section id="SECTexipick">
70778 <title>Selecting messages by various criteria (exipick)</title>
70779 <para>
70780 <indexterm role="concept">
70781 <primary><emphasis>exipick</emphasis></primary>
70782 </indexterm>
70783 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
70784 lists messages from the queue according to a variety of criteria. For details
70785 of <emphasis>exipick</emphasis>&#x2019;s facilities, run <emphasis>exipick</emphasis> with
70786 the <option>--help</option> option.
70787 </para>
70788 </section>
70789 <section id="SECTcyclogfil">
70790 <title>Cycling log files (exicyclog)</title>
70791 <para>
70792 <indexterm role="concept">
70793 <primary>log</primary>
70794 <secondary>cycling local files</secondary>
70795 </indexterm>
70796 <indexterm role="concept">
70797 <primary>cycling logs</primary>
70798 </indexterm>
70799 <indexterm role="concept">
70800 <primary><emphasis>exicyclog</emphasis></primary>
70801 </indexterm>
70802 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
70803 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
70804 you are using log files with datestamps in their names (see section
70805 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
70806 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
70807 There are two command line options for <emphasis>exicyclog</emphasis>:
70808 </para>
70809 <itemizedlist>
70810 <listitem>
70811 <para>
70812 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
70813 default that is set when Exim is built. The default default is 10.
70814 </para>
70815 </listitem>
70816 <listitem>
70817 <para>
70818 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
70819 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
70820 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
70821 configuration.
70822 </para>
70823 </listitem>
70824 </itemizedlist>
70825 <para>
70826 Each time <emphasis>exicyclog</emphasis> is run the filenames get <quote>shuffled down</quote> by one. If
70827 the main log filename is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
70828 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
70829 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
70830 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
70831 logs are handled similarly.
70832 </para>
70833 <para>
70834 If the limit is greater than 99, the script uses 3-digit numbers such as
70835 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
70836 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
70837 any existing log files.
70838 </para>
70839 <para>
70840 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
70841 the end are deleted. All files with numbers greater than 01 are compressed,
70842 using a compression command which is configured by the COMPRESS_COMMAND
70843 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
70844 root <option>crontab</option> entry of the form
70845 </para>
70846 <literallayout class="monospaced">
70847 1 0 * * * su exim -c /usr/exim/bin/exicyclog
70848 </literallayout>
70849 <para>
70850 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
70851 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
70852 </para>
70853 </section>
70854 <section id="SECTmailstat">
70855 <title>Mail statistics (eximstats)</title>
70856 <para>
70857 <indexterm role="concept">
70858 <primary>statistics</primary>
70859 </indexterm>
70860 <indexterm role="concept">
70861 <primary><emphasis>eximstats</emphasis></primary>
70862 </indexterm>
70863 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
70864 information from log files. The output is either plain text, or HTML.
70865 </para>
70866 <para>
70867 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
70868 latest version is the result of some extensive revision by Steve Campbell. A
70869 lot of information is given by default, but there are options for suppressing
70870 various parts of it. Following any options, the arguments to the script are a
70871 list of files, which should be main log files. For example:
70872 </para>
70873 <literallayout class="monospaced">
70874 eximstats -nr /var/spool/exim/log/mainlog.01
70875 </literallayout>
70876 <para>
70877 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
70878 messages received from or delivered to various hosts. The information is sorted
70879 both by message count and by volume, and the top fifty hosts in each category
70880 are listed on the standard output. Similar information, based on email
70881 addresses or domains instead of hosts can be requested by means of various
70882 options. For messages delivered and received locally, similar statistics are
70883 also produced per user.
70884 </para>
70885 <para>
70886 The output also includes total counts and statistics about delivery errors, and
70887 histograms showing the number of messages received and deliveries made in each
70888 hour of the day. A delivery with more than one address in its envelope (for
70889 example, an SMTP transaction with more than one RCPT command) is counted
70890 as a single delivery by <emphasis>eximstats</emphasis>.
70891 </para>
70892 <para>
70893 Though normally more deliveries than receipts are reported (as messages may
70894 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
70895 messages received than delivered, even though the queue is empty at the start
70896 and end of the period in question. If an incoming message contains no valid
70897 recipients, no deliveries are recorded for it. A bounce message is handled as
70898 an entirely separate message.
70899 </para>
70900 <para>
70901 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
70902 of messages received and deliveries made, and the number of hosts involved in
70903 each case. It also outputs the number of messages that were delayed (that is,
70904 not completely delivered at the first attempt), and the number that had at
70905 least one address that failed.
70906 </para>
70907 <para>
70908 The remainder of the output is in sections that can be independently disabled
70909 or modified by various options. It consists of a summary of deliveries by
70910 transport, histograms of messages received and delivered per time interval
70911 (default per hour), information about the time messages spent in the queue,
70912 a list of relayed messages, lists of the top fifty sending hosts, local
70913 senders, destination hosts, and destination local users by count and by volume,
70914 and a list of delivery errors that occurred.
70915 </para>
70916 <para>
70917 The relay information lists messages that were actually relayed, that is, they
70918 came from a remote host and were directly delivered to some other remote host,
70919 without being processed (for example, for aliasing or forwarding) locally.
70920 </para>
70921 <para>
70922 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
70923 outputs. These are documented in the Perl script itself, and can be extracted
70924 by running the command <command>perldoc</command> on the script. For example:
70925 </para>
70926 <literallayout class="monospaced">
70927 perldoc /usr/exim/bin/eximstats
70928 </literallayout>
70929 </section>
70930 <section id="SECTcheckaccess">
70931 <title>Checking access policy (exim_checkaccess)</title>
70932 <para>
70933 <indexterm role="concept">
70934 <primary><emphasis>exim_checkaccess</emphasis></primary>
70935 </indexterm>
70936 <indexterm role="concept">
70937 <primary>policy control</primary>
70938 <secondary>checking access</secondary>
70939 </indexterm>
70940 <indexterm role="concept">
70941 <primary>checking access</primary>
70942 </indexterm>
70943 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
70944 debugging output, in order to check what Exim is doing when it is applying
70945 policy controls to incoming SMTP mail. However, not everybody is sufficiently
70946 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
70947 sometimes you just want to answer the question <quote>Does this address have
70948 access?</quote> without bothering with any further details.
70949 </para>
70950 <para>
70951 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
70952 two arguments, an IP address and an email address:
70953 </para>
70954 <literallayout class="monospaced">
70955 exim_checkaccess 10.9.8.7 A.User@a.domain.example
70956 </literallayout>
70957 <para>
70958 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
70959 given email address would be accepted in a RCPT command in a TCP/IP
70960 connection from the host with the given IP address. The output of the utility
70961 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
70962 </para>
70963 <literallayout class="monospaced">
70964 Rejected:
70965 550 Relay not permitted
70966 </literallayout>
70967 <para>
70968 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
70969 for the MAIL command, but you can change this by providing additional
70970 options. These are passed directly to the Exim command. For example, to specify
70971 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
70972 you can use:
70973 </para>
70974 <literallayout class="monospaced">
70975 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
70976                  -f himself@there.example
70977 </literallayout>
70978 <para>
70979 Note that these additional Exim command line items must be given after the two
70980 mandatory arguments.
70981 </para>
70982 <para>
70983 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
70984 while running its checks. You can run checks that include callouts by using
70985 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
70986 </para>
70987 </section>
70988 <section id="SECTdbmbuild">
70989 <title>Making DBM files (exim_dbmbuild)</title>
70990 <para>
70991 <indexterm role="concept">
70992 <primary>DBM</primary>
70993 <secondary>building dbm files</secondary>
70994 </indexterm>
70995 <indexterm role="concept">
70996 <primary>building DBM files</primary>
70997 </indexterm>
70998 <indexterm role="concept">
70999 <primary><emphasis>exim_dbmbuild</emphasis></primary>
71000 </indexterm>
71001 <indexterm role="concept">
71002 <primary>lower casing</primary>
71003 </indexterm>
71004 <indexterm role="concept">
71005 <primary>binary zero</primary>
71006 <secondary>in lookup key</secondary>
71007 </indexterm>
71008 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
71009 the format used by the <command>lsearch</command> lookup (see section
71010 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
71011 names as keys and the remainder of the information as data. The lower-casing
71012 can be prevented by calling the program with the <option>-nolc</option> option.
71013 </para>
71014 <para>
71015 A terminating zero is included as part of the key string. This is expected by
71016 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
71017 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
71018 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
71019 files.
71020 </para>
71021 <para>
71022 The program requires two arguments: the name of the input file (which can be a
71023 single hyphen to indicate the standard input), and the name of the output file.
71024 It creates the output under a temporary name, and then renames it if all went
71025 well.
71026 </para>
71027 <para>
71028 <indexterm role="concept">
71029 <primary>USE_DB</primary>
71030 </indexterm>
71031 If the native DB interface is in use (USE_DB is set in a compile-time
71032 configuration file &ndash; this is common in free versions of Unix) the two
71033 filenames must be different, because in this mode the Berkeley DB functions
71034 create a single output file using exactly the name given. For example,
71035 </para>
71036 <literallayout class="monospaced">
71037 exim_dbmbuild /etc/aliases /etc/aliases.db
71038 </literallayout>
71039 <para>
71040 reads the system alias file and creates a DBM version of it in
71041 <filename>/etc/aliases.db</filename>.
71042 </para>
71043 <para>
71044 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
71045 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
71046 environment, the suffixes are added to the second argument of
71047 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
71048 when the Berkeley functions are used in compatibility mode (though this is not
71049 recommended), because in that case it adds a <filename>.db</filename> suffix to the filename.
71050 </para>
71051 <para>
71052 If a duplicate key is encountered, the program outputs a warning, and when it
71053 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
71054 option is used. By default, only the first of a set of duplicates is used &ndash;
71055 this makes it compatible with <command>lsearch</command> lookups. There is an option
71056 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
71057 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
71058 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
71059 return code is 2.
71060 </para>
71061 </section>
71062 <section id="SECTfinindret">
71063 <title>Finding individual retry times (exinext)</title>
71064 <para>
71065 <indexterm role="concept">
71066 <primary>retry</primary>
71067 <secondary>times</secondary>
71068 </indexterm>
71069 <indexterm role="concept">
71070 <primary><emphasis>exinext</emphasis></primary>
71071 </indexterm>
71072 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
71073 fish specific information out of the retry database. Given a mail domain (or a
71074 complete address), it looks up the hosts for that domain, and outputs any retry
71075 information for the hosts or for the domain. At present, the retry information
71076 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
71077 output. For example:
71078 </para>
71079 <literallayout class="monospaced">
71080 $ exinext piglet@milne.fict.example
71081 kanga.milne.example:192.168.8.1 error 146: Connection refused
71082   first failed: 21-Feb-1996 14:57:34
71083   last tried:   21-Feb-1996 14:57:34
71084   next try at:  21-Feb-1996 15:02:34
71085 roo.milne.example:192.168.8.3 error 146: Connection refused
71086   first failed: 20-Jan-1996 13:12:08
71087   last tried:   21-Feb-1996 11:42:03
71088   next try at:  21-Feb-1996 19:42:03
71089   past final cutoff time
71090 </literallayout>
71091 <para>
71092 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
71093 will give any retry information for that local part in your default domain.
71094 A message id can be used to obtain retry information pertaining to a specific
71095 message. This exists only when an attempt to deliver a message to a remote host
71096 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
71097 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
71098 run very often.
71099 </para>
71100 <para>
71101 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
71102 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
71103 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
71104 configuration file, and the second sets macros for use within the configuration
71105 file. These features are mainly to help in testing, but might also be useful in
71106 environments where more than one configuration file is in use.
71107 </para>
71108 </section>
71109 <section id="SECThindatmai">
71110 <title>Hints database maintenance</title>
71111 <para>
71112 <indexterm role="concept">
71113 <primary>hints database</primary>
71114 <secondary>maintenance</secondary>
71115 </indexterm>
71116 <indexterm role="concept">
71117 <primary>maintaining Exim&#x2019;s hints database</primary>
71118 </indexterm>
71119 Three utility programs are provided for maintaining the DBM files that Exim
71120 uses to contain its delivery hint information. Each program requires two
71121 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
71122 second is the name of the database it is to operate on. These are as follows:
71123 </para>
71124 <itemizedlist>
71125 <listitem>
71126 <para>
71127 <emphasis>retry</emphasis>: the database of retry information
71128 </para>
71129 </listitem>
71130 <listitem>
71131 <para>
71132 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
71133 for remote hosts
71134 </para>
71135 </listitem>
71136 <listitem>
71137 <para>
71138 <emphasis>callout</emphasis>: the callout cache
71139 </para>
71140 </listitem>
71141 <listitem>
71142 <para>
71143 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
71144 </para>
71145 </listitem>
71146 <listitem>
71147 <para>
71148 <emphasis>misc</emphasis>: other hints data
71149 </para>
71150 </listitem>
71151 </itemizedlist>
71152 <para>
71153 The <emphasis>misc</emphasis> database is used for
71154 </para>
71155 <itemizedlist>
71156 <listitem>
71157 <para>
71158 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
71159 </para>
71160 </listitem>
71161 <listitem>
71162 <para>
71163 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
71164 <command>smtp</command> transport)
71165 </para>
71166 </listitem>
71167 <listitem>
71168 <para>
71169 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
71170 in a transport)
71171 </para>
71172 </listitem>
71173 </itemizedlist>
71174 </section>
71175 <section id="SECTdumpdb">
71176 <title>exim_dumpdb</title>
71177 <para>
71178 <indexterm role="concept">
71179 <primary><emphasis>exim_dumpdb</emphasis></primary>
71180 </indexterm>
71181 The entire contents of a database are written to the standard output by the
71182 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
71183 spool and database names. For example, to dump the retry database:
71184 </para>
71185 <literallayout class="monospaced">
71186 exim_dumpdb /var/spool/exim retry
71187 </literallayout>
71188 <para>
71189 Two lines of output are produced for each entry:
71190 </para>
71191 <literallayout class="monospaced">
71192 T:mail.ref.example:192.168.242.242 146 77 Connection refused
71193 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
71194 </literallayout>
71195 <para>
71196 The first item on the first line is the key of the record. It starts with one
71197 of the letters R, or T, depending on whether it refers to a routing or
71198 transport retry. For a local delivery, the next part is the local address; for
71199 a remote delivery it is the name of the remote host, followed by its failing IP
71200 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
71201 transport). If the remote port is not the standard one (port 25), it is added
71202 to the IP address. Then there follows an error code, an additional error code,
71203 and a textual description of the error.
71204 </para>
71205 <para>
71206 The three times on the second line are the time of first failure, the time of
71207 the last delivery attempt, and the computed time for the next attempt. The line
71208 ends with an asterisk if the cutoff time for the last retry rule has been
71209 exceeded.
71210 </para>
71211 <para>
71212 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
71213 consists of a host name followed by a list of ids for messages that are or were
71214 waiting to be delivered to that host. If there are a very large number for any
71215 one host, continuation records, with a sequence number added to the host name,
71216 may be seen. The data in these records is often out of date, because a message
71217 may be routed to several alternative hosts, and Exim makes no effort to keep
71218 cross-references.
71219 </para>
71220 </section>
71221 <section id="SECTtidydb">
71222 <title>exim_tidydb</title>
71223 <para>
71224 <indexterm role="concept">
71225 <primary><emphasis>exim_tidydb</emphasis></primary>
71226 </indexterm>
71227 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
71228 database. If run with no options, it removes all records that are more than 30
71229 days old. The age is calculated from the date and time that the record was last
71230 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
71231 since the first delivery failure. Information about a host that has been down
71232 for more than 30 days will remain in the database, provided that the record is
71233 updated sufficiently often.
71234 </para>
71235 <para>
71236 The cutoff date can be altered by means of the <option>-t</option> option, which must be
71237 followed by a time. For example, to remove all records older than a week from
71238 the retry database:
71239 </para>
71240 <literallayout class="monospaced">
71241 exim_tidydb -t 7d /var/spool/exim retry
71242 </literallayout>
71243 <para>
71244 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
71245 message ids. In the former these appear as data in records keyed by host &ndash;
71246 they were messages that were waiting for that host &ndash; and in the latter they
71247 are the keys for retry information for messages that have suffered certain
71248 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
71249 message ids in database records are those of messages that are still on the
71250 queue. Message ids for messages that no longer exist are removed from
71251 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
71252 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
71253 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
71254 whenever it removes information from the database.
71255 </para>
71256 <para>
71257 Certain records are automatically removed by Exim when they are no longer
71258 needed, but others are not. For example, if all the MX hosts for a domain are
71259 down, a retry record is created for each one. If the primary MX host comes back
71260 first, its record is removed when Exim successfully delivers to it, but the
71261 records for the others remain because Exim has not tried to use those hosts.
71262 </para>
71263 <para>
71264 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
71265 hints databases. You should do this at a quiet time of day, because it requires
71266 a database to be locked (and therefore inaccessible to Exim) while it does its
71267 work. Removing records from a DBM file does not normally make the file smaller,
71268 but all the common DBM libraries are able to re-use the space that is released.
71269 After an initial phase of increasing in size, the databases normally reach a
71270 point at which they no longer get any bigger, as long as they are regularly
71271 tidied.
71272 </para>
71273 <para>
71274 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
71275 databases is likely to keep on increasing.
71276 </para>
71277 </section>
71278 <section id="SECTfixdb">
71279 <title>exim_fixdb</title>
71280 <para>
71281 <indexterm role="concept">
71282 <primary><emphasis>exim_fixdb</emphasis></primary>
71283 </indexterm>
71284 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
71285 Its main use is for testing Exim, but it might also be occasionally useful for
71286 getting round problems in a live system. It has no options, and its interface
71287 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
71288 key of a database record can then be entered, and the data for that record is
71289 displayed.
71290 </para>
71291 <para>
71292 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
71293 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
71294 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
71295 data for individual fields can be changed by typing the field number followed
71296 by new data, for example:
71297 </para>
71298 <literallayout class="monospaced">
71299 &gt; 4 951102:1000
71300 </literallayout>
71301 <para>
71302 resets the time of the next delivery attempt. Time values are given as a
71303 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
71304 used as optional separators.
71305 </para>
71306 </section>
71307 <section id="SECTmailboxmaint">
71308 <title>Mailbox maintenance (exim_lock)</title>
71309 <para>
71310 <indexterm role="concept">
71311 <primary>mailbox</primary>
71312 <secondary>maintenance</secondary>
71313 </indexterm>
71314 <indexterm role="concept">
71315 <primary><emphasis>exim_lock</emphasis></primary>
71316 </indexterm>
71317 <indexterm role="concept">
71318 <primary>locking mailboxes</primary>
71319 </indexterm>
71320 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
71321 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
71322 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
71323 a user agent while investigating a problem. The utility requires the name of
71324 the file as its first argument. If the locking is successful, the second
71325 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
71326 second argument, the value of the SHELL environment variable is used; if this
71327 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
71328 is unlocked and the utility ends. The following options are available:
71329 </para>
71330 <variablelist>
71331 <varlistentry>
71332 <term><option>-fcntl</option></term>
71333 <listitem>
71334 <para>
71335 Use <function>fcntl()</function> locking on the open mailbox.
71336 </para>
71337 </listitem></varlistentry>
71338 <varlistentry>
71339 <term><option>-flock</option></term>
71340 <listitem>
71341 <para>
71342 Use <function>flock()</function> locking on the open mailbox, provided the operating system
71343 supports it.
71344 </para>
71345 </listitem></varlistentry>
71346 <varlistentry>
71347 <term><option>-interval</option></term>
71348 <listitem>
71349 <para>
71350 This must be followed by a number, which is a number of seconds; it sets the
71351 interval to sleep between retries (default 3).
71352 </para>
71353 </listitem></varlistentry>
71354 <varlistentry>
71355 <term><option>-lockfile</option></term>
71356 <listitem>
71357 <para>
71358 Create a lock file before opening the mailbox.
71359 </para>
71360 </listitem></varlistentry>
71361 <varlistentry>
71362 <term><option>-mbx</option></term>
71363 <listitem>
71364 <para>
71365 Lock the mailbox using MBX rules.
71366 </para>
71367 </listitem></varlistentry>
71368 <varlistentry>
71369 <term><option>-q</option></term>
71370 <listitem>
71371 <para>
71372 Suppress verification output.
71373 </para>
71374 </listitem></varlistentry>
71375 <varlistentry>
71376 <term><option>-retries</option></term>
71377 <listitem>
71378 <para>
71379 This must be followed by a number; it sets the number of times to try to get
71380 the lock (default 10).
71381 </para>
71382 </listitem></varlistentry>
71383 <varlistentry>
71384 <term><option>-restore_time</option></term>
71385 <listitem>
71386 <para>
71387 This option causes <option>exim_lock</option> to restore the modified and read times to the
71388 locked file before exiting. This allows you to access a locked mailbox (for
71389 example, to take a backup copy) without disturbing the times that the user
71390 subsequently sees.
71391 </para>
71392 </listitem></varlistentry>
71393 <varlistentry>
71394 <term><option>-timeout</option></term>
71395 <listitem>
71396 <para>
71397 This must be followed by a number, which is a number of seconds; it sets a
71398 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
71399 default), a non-blocking call is used.
71400 </para>
71401 </listitem></varlistentry>
71402 <varlistentry>
71403 <term><option>-v</option></term>
71404 <listitem>
71405 <para>
71406 Generate verbose output.
71407 </para>
71408 </listitem></varlistentry>
71409 </variablelist>
71410 <para>
71411 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
71412 default is to create a lock file and also to use <function>fcntl()</function> locking on the
71413 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
71414 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
71415 requires that the directory containing the file be writeable. Locking by lock
71416 file does not last forever; Exim assumes that a lock file is expired if it is
71417 more than 30 minutes old.
71418 </para>
71419 <para>
71420 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
71421 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
71422 to be taken out on the open mailbox, and an exclusive lock on the file
71423 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
71424 number of the mailbox file. When the locking is released, if an exclusive lock
71425 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
71426 </para>
71427 <para>
71428 The default output contains verification of the locking that takes place. The
71429 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
71430 suppresses all output except error messages.
71431 </para>
71432 <para>
71433 A command such as
71434 </para>
71435 <literallayout class="monospaced">
71436 exim_lock /var/spool/mail/spqr
71437 </literallayout>
71438 <para>
71439 runs an interactive shell while the file is locked, whereas
71440 </para>
71441 <literallayout>
71442 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
71443 &lt;<emphasis>some commands</emphasis>&gt;
71444 <literal>End</literal>
71445 </literallayout>
71446 <para>
71447 runs a specific non-interactive sequence of commands while the file is locked,
71448 suppressing all verification output. A single command can be run by a command
71449 such as
71450 </para>
71451 <literallayout class="monospaced">
71452 exim_lock -q /var/spool/mail/spqr \
71453   "cp /var/spool/mail/spqr /some/where"
71454 </literallayout>
71455 <para>
71456 Note that if a command is supplied, it must be entirely contained within the
71457 second argument &ndash; hence the quotes.
71458 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
71459 </para>
71460 </section>
71461 </chapter>
71462
71463 <chapter id="CHAPeximon">
71464 <title>The Exim monitor</title>
71465 <para>
71466 <indexterm role="concept" id="IIDeximon" class="startofrange">
71467 <primary>Exim monitor</primary>
71468 <secondary>description</secondary>
71469 </indexterm>
71470 <indexterm role="concept">
71471 <primary>X-windows</primary>
71472 </indexterm>
71473 <indexterm role="concept">
71474 <primary><emphasis>eximon</emphasis></primary>
71475 </indexterm>
71476 <indexterm role="concept">
71477 <primary>Local/eximon.conf</primary>
71478 </indexterm>
71479 <indexterm role="concept">
71480 <primary><filename>exim_monitor/EDITME</filename></primary>
71481 </indexterm>
71482 The Exim monitor is an application which displays in an X window information
71483 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
71484 perform certain operations on messages from this GUI interface; however all
71485 such facilities are also available from the command line, and indeed, the
71486 monitor itself makes use of the command line to perform any actions requested.
71487 </para>
71488 <section id="SECID264">
71489 <title>Running the monitor</title>
71490 <para>
71491 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
71492 script that sets up a number of environment variables, and then runs the
71493 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
71494 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
71495 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
71496 parameters are for.
71497 </para>
71498 <para>
71499 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
71500 a particular invocation by setting up environment variables of the same names,
71501 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
71502 </para>
71503 <literallayout class="monospaced">
71504 EXIMON_LOG_DEPTH=400 eximon
71505 </literallayout>
71506 <para>
71507 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
71508 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
71509 overrides the Exim log file configuration. This makes it possible to have
71510 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
71511 syslog messages are routed to a file on the local host.
71512 </para>
71513 <para>
71514 X resources can be used to change the appearance of the window in the normal
71515 way. For example, a resource setting of the form
71516 </para>
71517 <literallayout class="monospaced">
71518 Eximon*background: gray94
71519 </literallayout>
71520 <para>
71521 changes the colour of the background to light grey rather than white. The
71522 stripcharts are drawn with both the data lines and the reference lines in
71523 black. This means that the reference lines are not visible when on top of the
71524 data. However, their colour can be changed by setting a resource called
71525 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
71526 For example, if your X server is running Unix, you could set up lighter
71527 reference lines in the stripcharts by obeying
71528 </para>
71529 <literallayout class="monospaced">
71530 xrdb -merge &lt;&lt;End
71531 Eximon*highlight: gray
71532 End
71533 </literallayout>
71534 <para>
71535 <indexterm role="concept">
71536 <primary>admin user</primary>
71537 </indexterm>
71538 In order to see the contents of messages in the queue, and to operate on them,
71539 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
71540 </para>
71541 <para>
71542 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
71543 contain X11 resource parameters interpreted by the X11 library.  In addition,
71544 if the first parameter starts with the string "gdb" then it is removed and the
71545 binary is invoked under gdb (the parameter is used as the gdb command-name, so
71546 versioned variants of gdb can be invoked).
71547 </para>
71548 <para>
71549 The monitor&#x2019;s window is divided into three parts. The first contains one or
71550 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
71551 main log file, and the third is a display of the queue of messages awaiting
71552 delivery, with two more action buttons. The following sections describe these
71553 different parts of the display.
71554 </para>
71555 </section>
71556 <section id="SECID265">
71557 <title>The stripcharts</title>
71558 <para>
71559 <indexterm role="concept">
71560 <primary>stripchart</primary>
71561 </indexterm>
71562 The first stripchart is always a count of messages in the queue. Its name can
71563 be configured by setting QUEUE_STRIPCHART_NAME in the
71564 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
71565 configuration script by regular expression matches on log file entries, making
71566 it possible to display, for example, counts of messages delivered to certain
71567 hosts or using certain transports. The supplied defaults display counts of
71568 received and delivered messages, and of local and SMTP deliveries. The default
71569 period between stripchart updates is one minute; this can be adjusted by a
71570 parameter in the <filename>Local/eximon.conf</filename> file.
71571 </para>
71572 <para>
71573 The stripchart displays rescale themselves automatically as the value they are
71574 displaying changes. There are always 10 horizontal lines in each chart; the
71575 title string indicates the value of each division when it is greater than one.
71576 For example, <quote>x2</quote> means that each division represents a value of 2.
71577 </para>
71578 <para>
71579 It is also possible to have a stripchart which shows the percentage fullness of
71580 a particular disk partition, which is useful when local deliveries are confined
71581 to a single partition.
71582 </para>
71583 <para>
71584 <indexterm role="concept">
71585 <primary><option>statvfs</option> function</primary>
71586 </indexterm>
71587 This relies on the availability of the <function>statvfs()</function> function or equivalent in
71588 the operating system. Most, but not all versions of Unix that support Exim have
71589 this. For this particular stripchart, the top of the chart always represents
71590 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
71591 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
71592 <filename>Local/eximon.conf</filename> file.
71593 </para>
71594 </section>
71595 <section id="SECID266">
71596 <title>Main action buttons</title>
71597 <para>
71598 <indexterm role="concept">
71599 <primary>size</primary>
71600 <secondary>of monitor window</secondary>
71601 </indexterm>
71602 <indexterm role="concept">
71603 <primary>Exim monitor</primary>
71604 <secondary>window size</secondary>
71605 </indexterm>
71606 <indexterm role="concept">
71607 <primary>window size</primary>
71608 </indexterm>
71609 Below the stripcharts there is an action button for quitting the monitor. Next
71610 to this is another button marked <quote>Size</quote>. They are placed here so that
71611 shrinking the window to its default minimum size leaves just the queue count
71612 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
71613 the window to expand to its maximum size, unless it is already at the maximum,
71614 in which case it is reduced to its minimum.
71615 </para>
71616 <para>
71617 When expanding to the maximum, if the window cannot be fully seen where it
71618 currently is, it is moved back to where it was the last time it was at full
71619 size. When it is expanding from its minimum size, the old position is
71620 remembered, and next time it is reduced to the minimum it is moved back there.
71621 </para>
71622 <para>
71623 The idea is that you can keep a reduced window just showing one or two
71624 stripcharts at a convenient place on your screen, easily expand it to show
71625 the full window when required, and just as easily put it back to what it was.
71626 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
71627 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
71628 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
71629 </para>
71630 <para>
71631 Normally, the monitor starts up with the window at its full size, but it can be
71632 built so that it starts up with the window at its smallest size, by setting
71633 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
71634 </para>
71635 </section>
71636 <section id="SECID267">
71637 <title>The log display</title>
71638 <para>
71639 <indexterm role="concept">
71640 <primary>log</primary>
71641 <secondary>tail of; in monitor</secondary>
71642 </indexterm>
71643 The second section of the window is an area in which a display of the tail of
71644 the main log is maintained.
71645 To save space on the screen, the timestamp on each log line is shortened by
71646 removing the date and, if <option>log_timezone</option> is set, the timezone.
71647 The log tail is not available when the only destination for logging data is
71648 syslog, unless the syslog lines are routed to a local file whose name is passed
71649 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
71650 </para>
71651 <para>
71652 The log sub-window has a scroll bar at its lefthand side which can be used to
71653 move back to look at earlier text, and the up and down arrow keys also have a
71654 scrolling effect. The amount of log that is kept depends on the setting of
71655 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
71656 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
71657 much more efficient than throwing it away line by line. The sub-window also has
71658 a horizontal scroll bar for accessing the ends of long log lines. This is the
71659 only means of horizontal scrolling; the right and left arrow keys are not
71660 available. Text can be cut from this part of the window using the mouse in the
71661 normal way. The size of this subwindow is controlled by parameters in the
71662 configuration file <filename>Local/eximon.conf</filename>.
71663 </para>
71664 <para>
71665 Searches of the text in the log window can be carried out by means of the ^R
71666 and ^S keystrokes, which default to a reverse and a forward search,
71667 respectively. The search covers only the text that is displayed in the window.
71668 It cannot go further back up the log.
71669 </para>
71670 <para>
71671 The point from which the search starts is indicated by a caret marker. This is
71672 normally at the end of the text in the window, but can be positioned explicitly
71673 by pointing and clicking with the left mouse button, and is moved automatically
71674 by a successful search. If new text arrives in the window when it is scrolled
71675 back, the caret remains where it is, but if the window is not scrolled back,
71676 the caret is moved to the end of the new text.
71677 </para>
71678 <para>
71679 Pressing ^R or ^S pops up a window into which the search text can be typed.
71680 There are buttons for selecting forward or reverse searching, for carrying out
71681 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
71682 happens and the window remains so that further searches can be done. If the
71683 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
71684 ^C is typed the search is cancelled.
71685 </para>
71686 <para>
71687 The searching facility is implemented using the facilities of the Athena text
71688 widget. By default this pops up a window containing both <quote>search</quote> and
71689 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
71690 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
71691 However, the linkers in BSDI and HP-UX seem unable to handle an externally
71692 provided version of <option>TextPop</option> when the remaining parts of the text widget
71693 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
71694 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
71695 on these systems, at the expense of having unwanted items in the search popup
71696 window.
71697 </para>
71698 </section>
71699 <section id="SECID268">
71700 <title>The queue display</title>
71701 <para>
71702 <indexterm role="concept">
71703 <primary>queue</primary>
71704 <secondary>display in monitor</secondary>
71705 </indexterm>
71706 The bottom section of the monitor window contains a list of all messages that
71707 are in the queue, which includes those currently being received or delivered,
71708 as well as those awaiting delivery. The size of this subwindow is controlled by
71709 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
71710 at which it is updated is controlled by another parameter in the same file &ndash;
71711 the default is 5 minutes, since queue scans can be quite expensive. However,
71712 there is an <quote>Update</quote> action button just above the display which can be used
71713 to force an update of the queue display at any time.
71714 </para>
71715 <para>
71716 When a host is down for some time, a lot of pending mail can build up for it,
71717 and this can make it hard to deal with other messages in the queue. To help
71718 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
71719 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
71720 type anything in here and press <quote>Return</quote>, the text is added to a chain of
71721 such texts, and if every undelivered address in a message matches at least one
71722 of the texts, the message is not displayed.
71723 </para>
71724 <para>
71725 If there is an address that does not match any of the texts, all the addresses
71726 are displayed as normal. The matching happens on the ends of addresses so, for
71727 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
71728 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
71729 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
71730 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
71731 a hide request is automatically cancelled after one hour.
71732 </para>
71733 <para>
71734 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
71735 else to the monitor window. For this reason, if you want to cut text from the
71736 queue display to use in the dialogue box, you have to do the cutting before
71737 pressing the <quote>Hide</quote> button.
71738 </para>
71739 <para>
71740 The queue display contains, for each unhidden queued message, the length of
71741 time it has been in the queue, the size of the message, the message id, the
71742 message sender, and the first undelivered recipient, all on one line. If it is
71743 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
71744 recipient to which the message has not yet been delivered, subsequent ones are
71745 listed on additional lines, up to a maximum configured number, following which
71746 an ellipsis is displayed. Recipients that have already received the message are
71747 not shown.
71748 </para>
71749 <para>
71750 <indexterm role="concept">
71751 <primary>frozen messages</primary>
71752 <secondary>display</secondary>
71753 </indexterm>
71754 If a message is frozen, an asterisk is displayed at the left-hand side.
71755 </para>
71756 <para>
71757 The queue display has a vertical scroll bar, and can also be scrolled by means
71758 of the arrow keys. Text can be cut from it using the mouse in the normal way.
71759 The text searching facilities, as described above for the log window, are also
71760 available, but the caret is always moved to the end of the text when the queue
71761 display is updated.
71762 </para>
71763 </section>
71764 <section id="SECID269">
71765 <title>The queue menu</title>
71766 <para>
71767 <indexterm role="concept">
71768 <primary>queue</primary>
71769 <secondary>menu in monitor</secondary>
71770 </indexterm>
71771 If the <option>shift</option> key is held down and the left button is clicked when the mouse
71772 pointer is over the text for any message, an action menu pops up, and the first
71773 line of the queue display for the message is highlighted. This does not affect
71774 any selected text.
71775 </para>
71776 <para>
71777 If you want to use some other event for popping up the menu, you can set the
71778 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
71779 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
71780 value set in this parameter is a standard X event description. For example, to
71781 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
71782 </para>
71783 <literallayout class="monospaced">
71784 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
71785 </literallayout>
71786 <para>
71787 The title of the menu is the message id, and it contains entries which act as
71788 follows:
71789 </para>
71790 <itemizedlist>
71791 <listitem>
71792 <para>
71793 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
71794 in a new text window.
71795 </para>
71796 </listitem>
71797 <listitem>
71798 <para>
71799 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
71800 information and headers is displayed in a new text window. See chapter
71801 <xref linkend="CHAPspool"/> for a description of the format of spool files.
71802 </para>
71803 </listitem>
71804 <listitem>
71805 <para>
71806 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
71807 displayed in a new text window. There is a default limit of 20,000 bytes to the
71808 amount of data displayed. This can be changed by setting the BODY_MAX
71809 option at compile time, or the EXIMON_BODY_MAX option at runtime.
71810 </para>
71811 </listitem>
71812 <listitem>
71813 <para>
71814 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
71815 delivery of the message. This causes an automatic thaw if the message is
71816 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
71817 a new text window. The delivery is run in a separate process, to avoid holding
71818 up the monitor while the delivery proceeds.
71819 </para>
71820 </listitem>
71821 <listitem>
71822 <para>
71823 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
71824 that the message be frozen.
71825 </para>
71826 </listitem>
71827 <listitem>
71828 <para>
71829 <indexterm role="concept">
71830 <primary>thawing messages</primary>
71831 </indexterm>
71832 <indexterm role="concept">
71833 <primary>unfreezing messages</primary>
71834 </indexterm>
71835 <indexterm role="concept">
71836 <primary>frozen messages</primary>
71837 <secondary>thawing</secondary>
71838 </indexterm>
71839 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
71840 that the message be thawed.
71841 </para>
71842 </listitem>
71843 <listitem>
71844 <para>
71845 <indexterm role="concept">
71846 <primary>delivery</primary>
71847 <secondary>forcing failure</secondary>
71848 </indexterm>
71849 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
71850 that Exim gives up trying to deliver the message. A bounce message is generated
71851 for any remaining undelivered addresses.
71852 </para>
71853 </listitem>
71854 <listitem>
71855 <para>
71856 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
71857 that the message be deleted from the system without generating a bounce
71858 message.
71859 </para>
71860 </listitem>
71861 <listitem>
71862 <para>
71863 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
71864 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
71865 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
71866 Otherwise it must be entered as a fully qualified address. Pressing RETURN
71867 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
71868 additional recipient be added to the message, unless the entry box is empty, in
71869 which case no action is taken.
71870 </para>
71871 </listitem>
71872 <listitem>
71873 <para>
71874 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
71875 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
71876 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
71877 Otherwise it must be entered as a fully qualified address. Pressing RETURN
71878 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
71879 recipient address as already delivered, unless the entry box is empty, in which
71880 case no action is taken.
71881 </para>
71882 </listitem>
71883 <listitem>
71884 <para>
71885 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
71886 mark all recipient addresses as already delivered.
71887 </para>
71888 </listitem>
71889 <listitem>
71890 <para>
71891 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
71892 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
71893 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
71894 in which case no action is taken. If you want to set an empty sender (as in
71895 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
71896 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
71897 the address is qualified with that domain.
71898 </para>
71899 </listitem>
71900 </itemizedlist>
71901 <para>
71902 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
71903 other cases when a call to Exim is made, if there is any output from Exim (in
71904 particular, if the command fails) a window containing the command and the
71905 output is displayed. Otherwise, the results of the action are normally apparent
71906 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
71907 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
71908 if no output is generated.
71909 </para>
71910 <para>
71911 The queue display is automatically updated for actions such as freezing and
71912 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
71913 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
71914 force an update of the display after one of these actions.
71915 </para>
71916 <para>
71917 In any text window that is displayed as result of a menu action, the normal
71918 cut-and-paste facility is available, and searching can be carried out using ^R
71919 and ^S, as described above for the log tail window.
71920 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
71921 </para>
71922 </section>
71923 </chapter>
71924
71925 <chapter id="CHAPsecurity">
71926 <title>Security considerations</title>
71927 <para>
71928 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
71929 <primary>security</primary>
71930 <secondary>discussion of</secondary>
71931 </indexterm>
71932 This chapter discusses a number of issues concerned with security, some of
71933 which are also covered in other parts of this manual.
71934 </para>
71935 <para>
71936 For reasons that this author does not understand, some people have promoted
71937 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
71938 existence of this chapter in the documentation. However, the intent of the
71939 chapter is simply to describe the way Exim works in relation to certain
71940 security concerns, not to make any specific claims about the effectiveness of
71941 its security as compared with other MTAs.
71942 </para>
71943 <para>
71944 What follows is a description of the way Exim is supposed to be. Best efforts
71945 have been made to try to ensure that the code agrees with the theory, but an
71946 absence of bugs can never be guaranteed. Any that are reported will get fixed
71947 as soon as possible.
71948 </para>
71949 <section id="SECID286">
71950 <title>Building a more <quote>hardened</quote> Exim</title>
71951 <para>
71952 <indexterm role="concept">
71953 <primary>security</primary>
71954 <secondary>build-time features</secondary>
71955 </indexterm>
71956 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
71957 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
71958 Exim administrator who does not have the root password, or by someone who has
71959 penetrated the Exim (but not the root) account. These options are as follows:
71960 </para>
71961 <itemizedlist>
71962 <listitem>
71963 <para>
71964 ALT_CONFIG_PREFIX can be set to a string that is required to match the
71965 start of any filenames used with the <option>-C</option> option. When it is set, these
71966 filenames are also not allowed to contain the sequence <quote>/../</quote>. (However, if
71967 the value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
71968 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
71969 default setting for <option>ALT_CONFIG_PREFIX</option>.
71970 </para>
71971 <para>
71972 If the permitted configuration files are confined to a directory to
71973 which only root has access, this guards against someone who has broken
71974 into the Exim account from running a privileged Exim with an arbitrary
71975 configuration file, and using it to break into other accounts.
71976 </para>
71977 </listitem>
71978 <listitem>
71979 <para>
71980 If a non-trusted configuration file (i.e. not the default configuration file
71981 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
71982 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
71983 the next item), then root privilege is retained only if the caller of Exim is
71984 root. This locks out the possibility of testing a configuration using <option>-C</option>
71985 right through message reception and delivery, even if the caller is root. The
71986 reception works, but by that time, Exim is running as the Exim user, so when
71987 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
71988 privilege to be lost. However, root can test reception and delivery using two
71989 separate commands.
71990 </para>
71991 </listitem>
71992 <listitem>
71993 <para>
71994 The WHITELIST_D_MACROS build option declares some macros to be safe to override
71995 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
71996 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
71997 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
71998 the restrictive side.  Requiring build-time selection of safe macros is onerous
71999 but this option is intended solely as a transition mechanism to permit
72000 previously-working configurations to continue to work after release 4.73.
72001 </para>
72002 </listitem>
72003 <listitem>
72004 <para>
72005 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
72006 is disabled.
72007 </para>
72008 </listitem>
72009 <listitem>
72010 <para>
72011 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
72012 never to be used for any deliveries. This is like the <option>never_users</option> runtime
72013 option, but it cannot be overridden; the runtime option adds additional users
72014 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
72015 is permitted to modify the runtime file from using Exim as a way to get root.
72016 </para>
72017 </listitem>
72018 </itemizedlist>
72019 </section>
72020 <section id="SECID270">
72021 <title>Root privilege</title>
72022 <para>
72023 <indexterm role="concept">
72024 <primary>setuid</primary>
72025 </indexterm>
72026 <indexterm role="concept">
72027 <primary>root privilege</primary>
72028 </indexterm>
72029 The Exim binary is normally setuid to root, which means that it gains root
72030 privilege (runs as root) when it starts execution. In some special cases (for
72031 example, when the daemon is not in use and there are no local deliveries), it
72032 may be possible to run Exim setuid to some user other than root. This is
72033 discussed in the next section. However, in most installations, root privilege
72034 is required for two things:
72035 </para>
72036 <itemizedlist>
72037 <listitem>
72038 <para>
72039 To set up a socket connected to the standard SMTP port (25) when initialising
72040 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
72041 not required.
72042 </para>
72043 </listitem>
72044 <listitem>
72045 <para>
72046 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
72047 perform local deliveries as the receiving user or as specified in the
72048 configuration.
72049 </para>
72050 </listitem>
72051 </itemizedlist>
72052 <para>
72053 It is not necessary to be root to do any of the other things Exim does, such as
72054 receiving messages and delivering them externally over SMTP, and it is
72055 obviously more secure if Exim does not run as root except when necessary.
72056 For this reason, a user and group for Exim to use must be defined in
72057 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
72058 group</quote>. Their values can be changed by the runtime configuration, though this
72059 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
72060 <emphasis>mail</emphasis> or another user name altogether.
72061 </para>
72062 <para>
72063 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
72064 abdication; the process cannot regain root afterwards. Prior to release 4.00,
72065 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
72066 </para>
72067 <para>
72068 After a new Exim process has interpreted its command line options, it changes
72069 uid and gid in the following cases:
72070 </para>
72071 <itemizedlist>
72072 <listitem>
72073 <para>
72074 <indexterm role="option">
72075 <primary><option>-C</option></primary>
72076 </indexterm>
72077 <indexterm role="option">
72078 <primary><option>-D</option></primary>
72079 </indexterm>
72080 If the <option>-C</option> option is used to specify an alternate configuration file, or if
72081 the <option>-D</option> option is used to define macro values for the configuration, and the
72082 calling process is not running as root, the uid and gid are changed to those of
72083 the calling process.
72084 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
72085 option may not be used at all.
72086 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
72087 can be supplied if the calling process is running as root, the Exim run-time
72088 user or CONFIGURE_OWNER, if defined.
72089 </para>
72090 </listitem>
72091 <listitem>
72092 <para>
72093 <indexterm role="option">
72094 <primary><option>-be</option></primary>
72095 </indexterm>
72096 <indexterm role="option">
72097 <primary><option>-bf</option></primary>
72098 </indexterm>
72099 <indexterm role="option">
72100 <primary><option>-bF</option></primary>
72101 </indexterm>
72102 If the expansion test option (<option>-be</option>) or one of the filter testing options
72103 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
72104 calling process.
72105 </para>
72106 </listitem>
72107 <listitem>
72108 <para>
72109 If the process is not a daemon process or a queue runner process or a delivery
72110 process or a process for testing address routing (started with <option>-bt</option>), the
72111 uid and gid are changed to the Exim user and group. This means that Exim always
72112 runs under its own uid and gid when receiving messages. This also applies when
72113 testing address verification
72114 <indexterm role="option">
72115 <primary><option>-bv</option></primary>
72116 </indexterm>
72117 <indexterm role="option">
72118 <primary><option>-bh</option></primary>
72119 </indexterm>
72120 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
72121 option).
72122 </para>
72123 </listitem>
72124 <listitem>
72125 <para>
72126 For a daemon, queue runner, delivery, or address testing process, the uid
72127 remains as root at this stage, but the gid is changed to the Exim group.
72128 </para>
72129 </listitem>
72130 </itemizedlist>
72131 <para>
72132 The processes that initially retain root privilege behave as follows:
72133 </para>
72134 <itemizedlist>
72135 <listitem>
72136 <para>
72137 A daemon process changes the gid to the Exim group and the uid to the Exim
72138 user after setting up one or more listening sockets. The <function>initgroups()</function>
72139 function is called, so that if the Exim user is in any additional groups, they
72140 will be used during message reception.
72141 </para>
72142 </listitem>
72143 <listitem>
72144 <para>
72145 A queue runner process retains root privilege throughout its execution. Its
72146 job is to fork a controlled sequence of delivery processes.
72147 </para>
72148 </listitem>
72149 <listitem>
72150 <para>
72151 A delivery process retains root privilege throughout most of its execution,
72152 but any actual deliveries (that is, the transports themselves) are run in
72153 subprocesses which always change to a non-root uid and gid. For local
72154 deliveries this is typically the uid and gid of the owner of the mailbox; for
72155 remote deliveries, the Exim uid and gid are used. Once all the delivery
72156 subprocesses have been run, a delivery process changes to the Exim uid and gid
72157 while doing post-delivery tidying up such as updating the retry database and
72158 generating bounce and warning messages.
72159 </para>
72160 <para>
72161 While the recipient addresses in a message are being routed, the delivery
72162 process runs as root. However, if a user&#x2019;s filter file has to be processed,
72163 this is done in a subprocess that runs under the individual user&#x2019;s uid and
72164 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
72165 </para>
72166 </listitem>
72167 <listitem>
72168 <para>
72169 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
72170 the routing is done in the same environment as a message delivery.
72171 </para>
72172 </listitem>
72173 </itemizedlist>
72174 </section>
72175 <section id="SECTrunexiwitpri">
72176 <title>Running Exim without privilege</title>
72177 <para>
72178 <indexterm role="concept">
72179 <primary>privilege, running without</primary>
72180 </indexterm>
72181 <indexterm role="concept">
72182 <primary>unprivileged running</primary>
72183 </indexterm>
72184 <indexterm role="concept">
72185 <primary>root privilege</primary>
72186 <secondary>running without</secondary>
72187 </indexterm>
72188 Some installations like to run Exim in an unprivileged state for more of its
72189 operation, for added security. Support for this mode of operation is provided
72190 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
72191 gid are changed to the Exim user and group at the start of a delivery process
72192 (and also queue runner and address testing processes). This means that address
72193 routing is no longer run as root, and the deliveries themselves cannot change
72194 to any other uid.
72195 </para>
72196 <para>
72197 <indexterm role="concept">
72198 <primary>SIGHUP</primary>
72199 </indexterm>
72200 <indexterm role="concept">
72201 <primary>daemon</primary>
72202 <secondary>restarting</secondary>
72203 </indexterm>
72204 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
72205 that the daemon can still be started in the usual way, and it can respond
72206 correctly to SIGHUP because the re-invocation regains root privilege.
72207 </para>
72208 <para>
72209 An alternative approach is to make Exim setuid to the Exim user and also setgid
72210 to the Exim group. If you do this, the daemon must be started from a root
72211 process. (Calling Exim from a root process makes it behave in the way it does
72212 when it is setuid root.) However, the daemon cannot restart itself after a
72213 SIGHUP signal because it cannot regain privilege.
72214 </para>
72215 <para>
72216 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
72217 stops Exim from trying to re-invoke itself to do a delivery after a message has
72218 been received. Such a re-invocation is a waste of resources because it has no
72219 effect.
72220 </para>
72221 <para>
72222 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
72223 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
72224 to the Exim user seems a clean approach, but there is one complication:
72225 </para>
72226 <para>
72227 In this style of operation, Exim is running with the real uid and gid set to
72228 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
72229 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
72230 that is, the real uid/gid should be reset to the effective values so as to
72231 discard any privileges that the caller may have. While some operating systems
72232 have a function that permits this action for a non-root effective uid, quite a
72233 number of them do not. Because of this lack of standardization, Exim does not
72234 address this problem at this time.
72235 </para>
72236 <para>
72237 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
72238 is to keep the Exim binary setuid to root, and to set
72239 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
72240 be used in the most straightforward way.
72241 </para>
72242 <para>
72243 If you configure Exim not to run delivery processes as root, there are a
72244 number of restrictions on what you can do:
72245 </para>
72246 <itemizedlist>
72247 <listitem>
72248 <para>
72249 You can deliver only as the Exim user/group. You should  explicitly use the
72250 <option>user</option> and <option>group</option> options to override routers or local transports that
72251 normally deliver as the recipient. This makes sure that configurations that
72252 work in this mode function the same way in normal mode. Any implicit or
72253 explicit specification of another user causes an error.
72254 </para>
72255 </listitem>
72256 <listitem>
72257 <para>
72258 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
72259 not worthwhile to include them in the configuration.
72260 </para>
72261 </listitem>
72262 <listitem>
72263 <para>
72264 Users who wish to use <filename>.forward</filename> would have to make their home directory and
72265 the file itself accessible to the Exim user. Pipe and append-to-file entries,
72266 and their equivalents in Exim filters, cannot be used. While they could be
72267 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
72268 </para>
72269 </listitem>
72270 <listitem>
72271 <para>
72272 Unless the local user mailboxes are all owned by the Exim user (possible in
72273 some POP3 or IMAP-only environments):
72274 </para>
72275 <orderedlist numeration="arabic">
72276 <listitem>
72277 <para>
72278 They must be owned by the Exim group and be writeable by that group. This
72279 implies you must set <option>mode</option> in the appendfile configuration, as well as the
72280 mode of the mailbox files themselves.
72281 </para>
72282 </listitem>
72283 <listitem>
72284 <para>
72285 You must set <option>no_check_owner</option>, since most or all of the files will not be
72286 owned by the Exim user.
72287 </para>
72288 </listitem>
72289 <listitem>
72290 <para>
72291 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
72292 on a newly created mailbox when unprivileged. This also implies that new
72293 mailboxes need to be created manually.
72294 </para>
72295 </listitem>
72296 </orderedlist>
72297 </listitem>
72298 </itemizedlist>
72299 <para>
72300 These restrictions severely restrict what can be done in local deliveries.
72301 However, there are no restrictions on remote deliveries. If you are running a
72302 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
72303 gives more security at essentially no cost.
72304 </para>
72305 <para>
72306 If you are using the <option>mua_wrapper</option> facility (see chapter
72307 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
72308 </para>
72309 </section>
72310 <section id="SECID271">
72311 <title>Delivering to local files</title>
72312 <para>
72313 Full details of the checks applied by <command>appendfile</command> before it writes to a file
72314 are given in chapter <xref linkend="CHAPappendfile"/>.
72315 </para>
72316 </section>
72317 <section id="SECTsecconslocalcmds">
72318 <title>Running local commands</title>
72319 <para>
72320 <indexterm role="concept">
72321 <primary>security</primary>
72322 <secondary>local commands</secondary>
72323 </indexterm>
72324 <indexterm role="concept">
72325 <primary>security</primary>
72326 <secondary>command injection attacks</secondary>
72327 </indexterm>
72328 There are a number of ways in which an administrator can configure Exim to run
72329 commands based upon received, untrustworthy, data. Further, in some
72330 configurations a user who can control a <filename>.forward</filename> file can also arrange to
72331 run commands. Configuration to check includes, but is not limited to:
72332 </para>
72333 <itemizedlist>
72334 <listitem>
72335 <para>
72336 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
72337 injection may be possible with this option present. It is dangerous and should
72338 be used only with considerable caution. Consider constraints which whitelist
72339 allowed characters in a variable which is to be used in a pipe transport that
72340 has <option>use_shell</option> enabled.
72341 </para>
72342 </listitem>
72343 <listitem>
72344 <para>
72345 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
72346 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
72347 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
72348 hub to which ordinary users do not have shell access, but home directories are
72349 NFS mounted (for instance) then administrators should review the list of these
72350 forbid options available, and should bear in mind that the options that may
72351 need forbidding can change as new features are added between releases.
72352 </para>
72353 </listitem>
72354 <listitem>
72355 <para>
72356 The <option>${run...}</option> expansion item does not use a shell by default, but
72357 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
72358 Such invocations should be viewed with prejudicial suspicion.
72359 </para>
72360 </listitem>
72361 <listitem>
72362 <para>
72363 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
72364 taint checking might apply to their usage.
72365 </para>
72366 </listitem>
72367 <listitem>
72368 <para>
72369 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
72370 administrators are well advised to view its use with suspicion, in case (for
72371 instance) it allows a local-part to contain embedded Exim directives.
72372 </para>
72373 </listitem>
72374 <listitem>
72375 <para>
72376 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
72377 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
72378 each can reference arbitrary lists and files, rather than just being a list
72379 of opaque strings.
72380 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
72381 real-world security vulnerabilities caused by its use with untrustworthy data
72382 injected in, for SQL injection attacks.
72383 Consider the use of the <option>inlisti</option> expansion condition instead.
72384 </para>
72385 </listitem>
72386 </itemizedlist>
72387 </section>
72388 <section id="SECTsecconfdata">
72389 <title>Trust in configuration data</title>
72390 <para>
72391 <indexterm role="concept">
72392 <primary>security</primary>
72393 <secondary>data sources</secondary>
72394 </indexterm>
72395 <indexterm role="concept">
72396 <primary>security</primary>
72397 <secondary>regular expressions</secondary>
72398 </indexterm>
72399 <indexterm role="concept">
72400 <primary>regular expressions</primary>
72401 <secondary>security</secondary>
72402 </indexterm>
72403 <indexterm role="concept">
72404 <primary>PCRE</primary>
72405 <secondary>security</secondary>
72406 </indexterm>
72407 If configuration data for Exim can come from untrustworthy sources, there
72408 are some issues to be aware of:
72409 </para>
72410 <itemizedlist>
72411 <listitem>
72412 <para>
72413 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
72414 </para>
72415 </listitem>
72416 <listitem>
72417 <para>
72418 Letting untrusted data provide a regular expression is unwise.
72419 </para>
72420 </listitem>
72421 <listitem>
72422 <para>
72423 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
72424 data may result in pathological behaviour within PCRE.  Be aware of what
72425 "backtracking" means and consider options for being more strict with a regular
72426 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
72427 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
72428 possessive quantifiers or just not using regular expressions against untrusted
72429 data.
72430 </para>
72431 </listitem>
72432 <listitem>
72433 <para>
72434 It can be important to correctly use <option>${quote:...}</option>,
72435 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
72436 items to ensure that data is correctly constructed.
72437 </para>
72438 </listitem>
72439 <listitem>
72440 <para>
72441 Some lookups might return multiple results, even though normal usage is only
72442 expected to yield one result.
72443 </para>
72444 </listitem>
72445 </itemizedlist>
72446 </section>
72447 <section id="SECID272">
72448 <title>IPv4 source routing</title>
72449 <para>
72450 <indexterm role="concept">
72451 <primary>source routing</primary>
72452 <secondary>in IP packets</secondary>
72453 </indexterm>
72454 <indexterm role="concept">
72455 <primary>IP source routing</primary>
72456 </indexterm>
72457 Many operating systems suppress IP source-routed packets in the kernel, but
72458 some cannot be made to do this, so Exim does its own check. It logs incoming
72459 IPv4 source-routed TCP calls, and then drops them. Things are all different in
72460 IPv6. No special checking is currently done.
72461 </para>
72462 </section>
72463 <section id="SECID273">
72464 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
72465 <para>
72466 Support for these SMTP commands is disabled by default. If required, they can
72467 be enabled by defining suitable ACLs.
72468 </para>
72469 </section>
72470 <section id="SECID274">
72471 <title>Privileged users</title>
72472 <para>
72473 <indexterm role="concept">
72474 <primary>trusted users</primary>
72475 </indexterm>
72476 <indexterm role="concept">
72477 <primary>admin user</primary>
72478 </indexterm>
72479 <indexterm role="concept">
72480 <primary>privileged user</primary>
72481 </indexterm>
72482 <indexterm role="concept">
72483 <primary>user</primary>
72484 <secondary>trusted</secondary>
72485 </indexterm>
72486 <indexterm role="concept">
72487 <primary>user</primary>
72488 <secondary>admin</secondary>
72489 </indexterm>
72490 Exim recognizes two sets of users with special privileges. Trusted users are
72491 able to submit new messages to Exim locally, but supply their own sender
72492 addresses and information about a sending host. For other users submitting
72493 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
72494 permit a remote host to be specified.
72495 </para>
72496 <para>
72497 <indexterm role="option">
72498 <primary><option>-f</option></primary>
72499 </indexterm>
72500 However, an untrusted user is permitted to use the <option>-f</option> command line option
72501 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
72502 message should not cause an error report. This affects the message&#x2019;s envelope,
72503 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
72504 permitted to use specific forms of address with the <option>-f</option> option by setting
72505 the <option>untrusted_set_sender</option> option.
72506 </para>
72507 <para>
72508 Trusted users are used to run processes that receive mail messages from some
72509 other mail domain and pass them on to Exim for delivery either locally, or over
72510 the Internet. Exim trusts a caller that is running as root, as the Exim user,
72511 as any user listed in the <option>trusted_users</option> configuration option, or under any
72512 group listed in the <option>trusted_groups</option> option.
72513 </para>
72514 <para>
72515 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
72516 can freeze or thaw messages, cause them to be returned to their senders, remove
72517 them entirely, or modify them in various ways. In addition, admin users can run
72518 the Exim monitor and see all the information it is capable of providing, which
72519 includes the contents of files on the spool.
72520 </para>
72521 <para>
72522 <indexterm role="option">
72523 <primary><option>-M</option></primary>
72524 </indexterm>
72525 <indexterm role="option">
72526 <primary><option>-q</option></primary>
72527 </indexterm>
72528 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
72529 delivery of messages on its queue is restricted to admin users. This
72530 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
72531 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
72532 queue is also restricted to admin users. This restriction can be relaxed by
72533 setting <option>no_queue_list_requires_admin</option>.
72534 </para>
72535 <para>
72536 Exim recognizes an admin user if the calling process is running as root or as
72537 the Exim user or if any of the groups associated with the calling process is
72538 the Exim group. It is not necessary actually to be running under the Exim
72539 group. However, if admin users who are not root or the Exim user are to access
72540 the contents of files on the spool via the Exim monitor (which runs
72541 unprivileged), Exim must be built to allow group read access to its spool
72542 files.
72543 </para>
72544 <para>
72545 By default, regular users are trusted to perform basic testing and
72546 introspection commands, as themselves.  This setting can be tightened by
72547 setting the <option>commandline_checks_require_admin</option> option.
72548 This affects most of the checking options,
72549 such as <option>-be</option> and anything else <option>-b*</option>.
72550 </para>
72551 </section>
72552 <section id="SECID275">
72553 <title>Spool files</title>
72554 <para>
72555 <indexterm role="concept">
72556 <primary>spool directory</primary>
72557 <secondary>files</secondary>
72558 </indexterm>
72559 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
72560 set to the Exim group. The mode for spool files is defined in the
72561 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
72562 any user who is a member of the Exim group can access these files.
72563 </para>
72564 </section>
72565 <section id="SECID276">
72566 <title>Use of argv[0]</title>
72567 <para>
72568 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
72569 of specific strings, Exim assumes certain options. For example, calling Exim
72570 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
72571 to calling it with the option <option>-bS</option>. There are no security implications in
72572 this.
72573 </para>
72574 </section>
72575 <section id="SECID277">
72576 <title>Use of %f formatting</title>
72577 <para>
72578 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
72579 are actually stored in integer variables as 1000 times the load average.
72580 Consequently, their range is limited and so therefore is the length of the
72581 converted output.
72582 </para>
72583 </section>
72584 <section id="SECID278">
72585 <title>Embedded Exim path</title>
72586 <para>
72587 Exim uses its own path name, which is embedded in the code, only when it needs
72588 to re-exec in order to regain root privilege. Therefore, it is not root when it
72589 does so. If some bug allowed the path to get overwritten, it would lead to an
72590 arbitrary program&#x2019;s being run as exim, not as root.
72591 </para>
72592 </section>
72593 <section id="SECTdynmoddir">
72594 <title>Dynamic module directory</title>
72595 <para>
72596 Any dynamically loadable modules must be installed into the directory
72597 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
72598 loading it.
72599 </para>
72600 </section>
72601 <section id="SECID279">
72602 <title>Use of sprintf()</title>
72603 <para>
72604 <indexterm role="concept">
72605 <primary><function>sprintf()</function></primary>
72606 </indexterm>
72607 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
72608 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
72609 The intermediate formatting is done into a large fixed buffer by a function
72610 that runs through the format string itself, and checks the length of each
72611 conversion before performing it, thus preventing buffer overruns.
72612 </para>
72613 <para>
72614 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
72615 the output buffer is known to be sufficiently long to contain the converted
72616 string.
72617 </para>
72618 </section>
72619 <section id="SECID280">
72620 <title>Use of debug_printf() and log_write()</title>
72621 <para>
72622 Arbitrary strings are passed to both these functions, but they do their
72623 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
72624 the format string itself, and checks the length of each conversion.
72625 </para>
72626 </section>
72627 <section id="SECID281">
72628 <title>Use of strcat() and strcpy()</title>
72629 <para>
72630 These are used only in cases where the output buffer is known to be large
72631 enough to hold the result.
72632 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
72633 </para>
72634 </section>
72635 </chapter>
72636
72637 <chapter id="CHAPspool">
72638 <title>Format of spool files</title>
72639 <para>
72640 <indexterm role="concept" id="IIDforspo1" class="startofrange">
72641 <primary>format</primary>
72642 <secondary>spool files</secondary>
72643 </indexterm>
72644 <indexterm role="concept" id="IIDforspo2" class="startofrange">
72645 <primary>spool directory</primary>
72646 <secondary>format of files</secondary>
72647 </indexterm>
72648 <indexterm role="concept" id="IIDforspo3" class="startofrange">
72649 <primary>spool files</primary>
72650 <secondary>format of</secondary>
72651 </indexterm>
72652 <indexterm role="concept">
72653 <primary>spool files</primary>
72654 <secondary>editing</secondary>
72655 </indexterm>
72656 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
72657 followed by -D and -H, respectively. The data portion of the message is kept in
72658 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
72659 kept in the -H file, whose format is described in this chapter. Each of these
72660 two files contains the final component of its own name as its first line. This
72661 is insurance against disk crashes where the directory is lost but the files
72662 themselves are recoverable.
72663 </para>
72664 <para>
72665 The file formats may be changed, or new formats added, at any release.
72666 Spool files are not intended as an interface to other programs
72667 and should not be used as such.
72668 </para>
72669 <para>
72670 Some people are tempted into editing -D files in order to modify messages. You
72671 need to be extremely careful if you do this; it is not recommended and you are
72672 on your own if you do it. Here are some of the pitfalls:
72673 </para>
72674 <itemizedlist>
72675 <listitem>
72676 <para>
72677 You must ensure that Exim does not try to deliver the message while you are
72678 fiddling with it. The safest way is to take out a write lock on the -D file,
72679 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
72680 place, the lock will be retained. If you write a new file and rename it, the
72681 lock will be lost at the instant of rename.
72682 </para>
72683 </listitem>
72684 <listitem>
72685 <para>
72686 <indexterm role="variable">
72687 <primary><varname>$body_linecount</varname></primary>
72688 </indexterm>
72689 If you change the number of lines in the file, the value of
72690 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
72691 cause incomplete transmission of messages or undeliverable messages.
72692 </para>
72693 </listitem>
72694 <listitem>
72695 <para>
72696 If the message is in MIME format, you must take care not to break it.
72697 </para>
72698 </listitem>
72699 <listitem>
72700 <para>
72701 If the message is cryptographically signed, any change will invalidate the
72702 signature.
72703 </para>
72704 </listitem>
72705 </itemizedlist>
72706 <para>
72707 All in all, modifying -D files is fraught with danger.
72708 </para>
72709 <para>
72710 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
72711 its subdirectories when <option>split_spool_directory</option> is set). These are journal
72712 files, used to record addresses to which the message has been delivered during
72713 the course of a delivery attempt. If there are still undelivered recipients at
72714 the end, the -H file is updated, and the -J file is deleted. If, however, there
72715 is some kind of crash (for example, a power outage) before this happens, the -J
72716 file remains in existence. When Exim next processes the message, it notices the
72717 -J file and uses it to update the -H file before starting the next delivery
72718 attempt.
72719 </para>
72720 <para>
72721 Files whose names end with -K or .eml may also be seen in the spool.
72722 These are temporaries used for DKIM or malware processing, when that is used.
72723 They should be tidied up by normal operations; any old ones are probably
72724 relics of crashes and can be removed.
72725 </para>
72726 <section id="SECID282">
72727 <title>Format of the -H file</title>
72728 <para>
72729 <indexterm role="concept">
72730 <primary>uid (user id)</primary>
72731 <secondary>in spool file</secondary>
72732 </indexterm>
72733 <indexterm role="concept">
72734 <primary>gid (group id)</primary>
72735 <secondary>in spool file</secondary>
72736 </indexterm>
72737 The second line of the -H file contains the login name for the uid of the
72738 process that called Exim to read the message, followed by the numerical uid and
72739 gid. For a locally generated message, this is normally the user who sent the
72740 message. For a message received over TCP/IP via the daemon, it is
72741 normally the Exim user.
72742 </para>
72743 <para>
72744 The third line of the file contains the address of the message&#x2019;s sender as
72745 transmitted in the envelope, contained in angle brackets. The sender address is
72746 empty for bounce messages. For incoming SMTP mail, the sender address is given
72747 in the MAIL command. For locally generated mail, the sender address is
72748 created by Exim from the login name of the current user and the configured
72749 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
72750 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
72751 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
72752 </para>
72753 <para>
72754 The fourth line contains two numbers. The first is the time that the message
72755 was received, in the conventional Unix form &ndash; the number of seconds since the
72756 start of the epoch. The second number is a count of the number of messages
72757 warning of delayed delivery that have been sent to the sender.
72758 </para>
72759 <para>
72760 There follow a number of lines starting with a hyphen. These can appear in any
72761 order, and are omitted when not relevant:
72762 </para>
72763 <variablelist>
72764 <varlistentry>
72765 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
72766 <listitem>
72767 <para>
72768 This item is obsolete, and is not generated from Exim release 4.61 onwards;
72769 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
72770 recognized, to provide backward compatibility. In the old format, a line of
72771 this form is present for every ACL variable that is not empty. The number
72772 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
72773 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
72774 the data string for the variable. The string itself starts at the beginning of
72775 the next line, and is followed by a newline character. It may contain internal
72776 newlines.
72777 </para>
72778 </listitem></varlistentry>
72779 <varlistentry>
72780 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
72781 <listitem>
72782 <para>
72783 A line of this form is present for every ACL connection variable that is
72784 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
72785 The length is the length of the data string for the variable. The string itself
72786 starts at the beginning of the next line, and is followed by a newline
72787 character. It may contain internal newlines.
72788 </para>
72789 </listitem></varlistentry>
72790 <varlistentry>
72791 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
72792 <listitem>
72793 <para>
72794 A line of this form is present for every ACL message variable that is defined.
72795 Note that there is a space between <option>-aclm</option> and the rest of the name. The
72796 length is the length of the data string for the variable. The string itself
72797 starts at the beginning of the next line, and is followed by a newline
72798 character. It may contain internal newlines.
72799 </para>
72800 </listitem></varlistentry>
72801 <varlistentry>
72802 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
72803 <listitem>
72804 <para>
72805 This is present if, when the message was received over SMTP, the value of
72806 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
72807 </para>
72808 </listitem></varlistentry>
72809 <varlistentry>
72810 <term><option>-allow_unqualified_recipient</option></term>
72811 <listitem>
72812 <para>
72813 This is present if unqualified recipient addresses are permitted in header
72814 lines (to stop such addresses from being qualified if rewriting occurs at
72815 transport time). Local messages that were input using <option>-bnq</option> and remote
72816 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
72817 </para>
72818 </listitem></varlistentry>
72819 <varlistentry>
72820 <term><option>-allow_unqualified_sender</option></term>
72821 <listitem>
72822 <para>
72823 This is present if unqualified sender addresses are permitted in header lines
72824 (to stop such addresses from being qualified if rewriting occurs at transport
72825 time). Local messages that were input using <option>-bnq</option> and remote messages from
72826 hosts that match <option>sender_unqualified_hosts</option> set this flag.
72827 </para>
72828 </listitem></varlistentry>
72829 <varlistentry>
72830 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72831 <listitem>
72832 <para>
72833 The id information for a message received on an authenticated SMTP connection
72834 &ndash; the value of the <varname>$authenticated_id</varname> variable.
72835 </para>
72836 </listitem></varlistentry>
72837 <varlistentry>
72838 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
72839 <listitem>
72840 <para>
72841 The address of an authenticated sender &ndash; the value of the
72842 <varname>$authenticated_sender</varname> variable.
72843 </para>
72844 </listitem></varlistentry>
72845 <varlistentry>
72846 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
72847 <listitem>
72848 <para>
72849 This records the number of lines in the body of the message, and is
72850 present unless <option>-spool_file_wireformat</option> is.
72851 </para>
72852 </listitem></varlistentry>
72853 <varlistentry>
72854 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
72855 <listitem>
72856 <para>
72857 This records the number of binary zero bytes in the body of the message, and is
72858 present if the number is greater than zero.
72859 </para>
72860 </listitem></varlistentry>
72861 <varlistentry>
72862 <term><option>-deliver_firsttime</option></term>
72863 <listitem>
72864 <para>
72865 This is written when a new message is first added to the spool. When the spool
72866 file is updated after a deferral, it is omitted.
72867 </para>
72868 </listitem></varlistentry>
72869 <varlistentry>
72870 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
72871 <listitem>
72872 <para>
72873 <indexterm role="concept">
72874 <primary>frozen messages</primary>
72875 <secondary>spool data</secondary>
72876 </indexterm>
72877 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
72878 </para>
72879 </listitem></varlistentry>
72880 <varlistentry>
72881 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72882 <listitem>
72883 <para>
72884 This records the host name as specified by a remote host in a HELO or EHLO
72885 command.
72886 </para>
72887 </listitem></varlistentry>
72888 <varlistentry>
72889 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
72890 <listitem>
72891 <para>
72892 This records the IP address of the host from which the message was received and
72893 the remote port number that was used. It is omitted for locally generated
72894 messages.
72895 </para>
72896 </listitem></varlistentry>
72897 <varlistentry>
72898 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72899 <listitem>
72900 <para>
72901 If the message was received on an authenticated SMTP connection, this records
72902 the name of the authenticator &ndash; the value of the
72903 <varname>$sender_host_authenticated</varname> variable.
72904 </para>
72905 </listitem></varlistentry>
72906 <varlistentry>
72907 <term><option>-host_lookup_failed</option></term>
72908 <listitem>
72909 <para>
72910 This is present if an attempt to look up the sending host&#x2019;s name from its IP
72911 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
72912 </para>
72913 </listitem></varlistentry>
72914 <varlistentry>
72915 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72916 <listitem>
72917 <para>
72918 <indexterm role="concept">
72919 <primary>reverse DNS lookup</primary>
72920 </indexterm>
72921 <indexterm role="concept">
72922 <primary>DNS</primary>
72923 <secondary>reverse lookup</secondary>
72924 </indexterm>
72925 This records the name of the remote host from which the message was received,
72926 if the host name was looked up from the IP address when the message was being
72927 received. It is not present if no reverse lookup was done.
72928 </para>
72929 </listitem></varlistentry>
72930 <varlistentry>
72931 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
72932 <listitem>
72933 <para>
72934 For locally submitted messages, this records the login of the originating user,
72935 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
72936 ident value. For messages received over TCP/IP, this records the ident string
72937 supplied by the remote host, if any.
72938 </para>
72939 </listitem></varlistentry>
72940 <varlistentry>
72941 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
72942 <listitem>
72943 <para>
72944 This records the IP address of the local interface and the port number through
72945 which a message was received from a remote host. It is omitted for locally
72946 generated messages.
72947 </para>
72948 </listitem></varlistentry>
72949 <varlistentry>
72950 <term><option>-local</option></term>
72951 <listitem>
72952 <para>
72953 The message is from a local sender.
72954 </para>
72955 </listitem></varlistentry>
72956 <varlistentry>
72957 <term><option>-localerror</option></term>
72958 <listitem>
72959 <para>
72960 The message is a locally-generated bounce message.
72961 </para>
72962 </listitem></varlistentry>
72963 <varlistentry>
72964 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
72965 <listitem>
72966 <para>
72967 This records the data string that was returned by the <function>local_scan()</function> function
72968 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
72969 variable. It is omitted if no data was returned.
72970 </para>
72971 </listitem></varlistentry>
72972 <varlistentry>
72973 <term><option>-manual_thaw</option></term>
72974 <listitem>
72975 <para>
72976 The message was frozen but has been thawed manually, that is, by an explicit
72977 Exim command rather than via the auto-thaw process.
72978 </para>
72979 </listitem></varlistentry>
72980 <varlistentry>
72981 <term><option>-N</option></term>
72982 <listitem>
72983 <para>
72984 A testing delivery process was started using the <option>-N</option> option to suppress any
72985 actual deliveries, but delivery was deferred. At any further delivery attempts,
72986 <option>-N</option> is assumed.
72987 </para>
72988 </listitem></varlistentry>
72989 <varlistentry>
72990 <term><option>-received_protocol</option></term>
72991 <listitem>
72992 <para>
72993 This records the value of the <varname>$received_protocol</varname> variable, which contains
72994 the name of the protocol by which the message was received.
72995 </para>
72996 </listitem></varlistentry>
72997 <varlistentry>
72998 <term><option>-sender_set_untrusted</option></term>
72999 <listitem>
73000 <para>
73001 The envelope sender of this message was set by an untrusted local caller (used
73002 to ensure that the caller is displayed in queue listings).
73003 </para>
73004 </listitem></varlistentry>
73005 <varlistentry>
73006 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
73007 <listitem>
73008 <para>
73009 If a message was scanned by SpamAssassin, this is present. It records the value
73010 of <varname>$spam_score_int</varname>.
73011 </para>
73012 </listitem></varlistentry>
73013 <varlistentry>
73014 <term><option>-spool_file_wireformat</option></term>
73015 <listitem>
73016 <para>
73017 The -D file for this message is in wire-format (for ESMTP CHUNKING)
73018 rather than Unix-format.
73019 The line-ending is CRLF rather than newline.
73020 There is still, however, no leading-dot-stuffing.
73021 </para>
73022 </listitem></varlistentry>
73023 <varlistentry>
73024 <term><option>-tls_certificate_verified</option></term>
73025 <listitem>
73026 <para>
73027 A TLS certificate was received from the client that sent this message, and the
73028 certificate was verified by the server.
73029 </para>
73030 </listitem></varlistentry>
73031 <varlistentry>
73032 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
73033 <listitem>
73034 <para>
73035 When the message was received over an encrypted connection, this records the
73036 name of the cipher suite that was used.
73037 </para>
73038 </listitem></varlistentry>
73039 <varlistentry>
73040 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
73041 <listitem>
73042 <para>
73043 When the message was received over an encrypted connection, and a certificate
73044 was received from the client, this records the Distinguished Name from that
73045 certificate.
73046 </para>
73047 </listitem></varlistentry>
73048 </variablelist>
73049 <para>
73050 Any of the above may have an extra hyphen prepended, to indicate the the
73051 corresponding data is untrusted.
73052 </para>
73053 <para>
73054 Following the options there is a list of those addresses to which the message
73055 is not to be delivered. This set of addresses is initialized from the command
73056 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
73057 is set; otherwise it starts out empty. Whenever a successful delivery is made,
73058 the address is added to this set. The addresses are kept internally as a
73059 balanced binary tree, and it is a representation of that tree which is written
73060 to the spool file. If an address is expanded via an alias or forward file, the
73061 original address is added to the tree when deliveries to all its child
73062 addresses are complete.
73063 </para>
73064 <para>
73065 If the tree is empty, there is a single line in the spool file containing just
73066 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
73067 Y or N, followed by an address. The address is the value for the node of the
73068 tree, and the letters indicate whether the node has a left branch and/or a
73069 right branch attached to it, respectively. If branches exist, they immediately
73070 follow. Here is an example of a three-node tree:
73071 </para>
73072 <literallayout class="monospaced">
73073 YY darcy@austen.fict.example
73074 NN alice@wonderland.fict.example
73075 NN editor@thesaurus.ref.example
73076 </literallayout>
73077 <para>
73078 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
73079 This is a simple list, preceded by a count. It includes all the original
73080 recipients of the message, including those to whom the message has already been
73081 delivered. In the simplest case, the list contains one address per line. For
73082 example:
73083 </para>
73084 <literallayout class="monospaced">
73085 4
73086 editor@thesaurus.ref.example
73087 darcy@austen.fict.example
73088 rdo@foundation
73089 alice@wonderland.fict.example
73090 </literallayout>
73091 <para>
73092 However, when a child address has been added to the top-level addresses as a
73093 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
73094 line is of the following form:
73095 </para>
73096 <literallayout>
73097 &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;
73098 </literallayout>
73099 <para>
73100 The 01 flag bit indicates the presence of the three other fields that follow
73101 the top-level address. Other bits may be used in future to support additional
73102 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
73103 original parent of the <quote>one time</quote> address. The first two fields are the
73104 envelope sender that is associated with this address and its length. If the
73105 length is zero, there is no special envelope sender (there are then two space
73106 characters in the line). A non-empty field can arise from a <command>redirect</command> router
73107 that has an <option>errors_to</option> setting.
73108 </para>
73109 <para>
73110 A blank line separates the envelope and status information from the headers
73111 which follow. A header may occupy several lines of the file, and to save effort
73112 when reading it in, each header is preceded by a number and an identifying
73113 character. The number is the number of characters in the header, including any
73114 embedded newlines and the terminating newline. The character is one of the
73115 following:
73116 </para>
73117 <informaltable frame="none">
73118 <tgroup cols="2" colsep="0" rowsep="0">
73119 <colspec colwidth="50pt" align="left"/>
73120 <colspec colwidth="254pt" align="left"/>
73121 <tbody>
73122 <row>
73123 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
73124 <entry>header in which Exim has no special interest</entry>
73125 </row>
73126 <row>
73127 <entry><literal>B</literal></entry>
73128 <entry><emphasis>Bcc:</emphasis> header</entry>
73129 </row>
73130 <row>
73131 <entry><literal>C</literal></entry>
73132 <entry><emphasis>Cc:</emphasis> header</entry>
73133 </row>
73134 <row>
73135 <entry><literal>F</literal></entry>
73136 <entry><emphasis>From:</emphasis> header</entry>
73137 </row>
73138 <row>
73139 <entry><literal>I</literal></entry>
73140 <entry><emphasis>Message-id:</emphasis> header</entry>
73141 </row>
73142 <row>
73143 <entry><literal>P</literal></entry>
73144 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
73145 </row>
73146 <row>
73147 <entry><literal>R</literal></entry>
73148 <entry><emphasis>Reply-To:</emphasis> header</entry>
73149 </row>
73150 <row>
73151 <entry><literal>S</literal></entry>
73152 <entry><emphasis>Sender:</emphasis> header</entry>
73153 </row>
73154 <row>
73155 <entry><literal>T</literal></entry>
73156 <entry><emphasis>To:</emphasis> header</entry>
73157 </row>
73158 <row>
73159 <entry><literal>*</literal></entry>
73160 <entry>replaced or deleted header</entry>
73161 </row>
73162 </tbody>
73163 </tgroup>
73164 </informaltable>
73165 <para>
73166 Deleted or replaced (rewritten) headers remain in the spool file for debugging
73167 purposes. They are not transmitted when the message is delivered. Here is a
73168 typical set of headers:
73169 </para>
73170 <literallayout class="monospaced">
73171 111P Received: by hobbit.fict.example with local (Exim 4.00)
73172 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
73173 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
73174 038* X-rewrote-sender: bb@hobbit.fict.example
73175 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
73176 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
73177 099* To: alice@wonderland.fict.example, rdo@foundation,
73178 darcy@austen.fict.example, editor@thesaurus.ref.example
73179 104T To: alice@wonderland.fict.example, rdo@foundation.example,
73180 darcy@austen.fict.example, editor@thesaurus.ref.example
73181 038  Date: Fri, 11 May 2001 10:28:59 +0100
73182 </literallayout>
73183 <para>
73184 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
73185 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
73186 unqualified domain <emphasis>foundation</emphasis>.
73187 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
73188 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
73189 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
73190 </para>
73191 </section>
73192 <section id="SECID282a">
73193 <title>Format of the -D file</title>
73194 <para>
73195 The data file is traditionally in Unix-standard format: lines are ended with
73196 an ASCII newline character.
73197 However, when the <option>spool_wireformat</option> main option is used some -D files
73198 can have an alternate format.
73199 This is flagged by a <option>-spool_file_wireformat</option> line in the corresponding -H file.
73200 The -D file lines (not including the first name-component line) are
73201 suitable for direct copying to the wire when transmitting using the
73202 ESMTP CHUNKING option, meaning lower processing overhead.
73203 Lines are terminated with an ASCII CRLF pair.
73204 There is no dot-stuffing (and no dot-termination).
73205 </para>
73206 </section>
73207 </chapter>
73208
73209 <chapter id="CHAPdkim">
73210 <title>DKIM, SPF and DMARC</title>
73211 <titleabbrev>DKIM, SPF and DMARC Support</titleabbrev>
73212 <section id="SECDKIM">
73213 <title>DKIM (DomainKeys Identified Mail)</title>
73214 <para>
73215 <indexterm role="concept">
73216 <primary>DKIM</primary>
73217 </indexterm>
73218 </para>
73219 <para>
73220 DKIM is a mechanism by which messages sent by some entity can be provably
73221 linked to a domain which that entity controls.  It permits reputation to
73222 be tracked on a per-domain basis, rather than merely upon source IP address.
73223 DKIM is documented in RFC 6376.
73224 </para>
73225 <para>
73226 As DKIM relies on the message being unchanged in transit, messages handled
73227 by a mailing-list (which traditionally adds to the message) will not match
73228 any original DKIM signature.
73229 </para>
73230 <para>
73231 DKIM support is compiled into Exim by default if TLS support is present.
73232 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
73233 </para>
73234 <para>
73235 Exim&#x2019;s DKIM implementation allows for
73236 </para>
73237 <orderedlist numeration="arabic">
73238 <listitem>
73239 <para>
73240 Signing outgoing messages: This function is implemented in the SMTP transport.
73241 It can co-exist with all other Exim features
73242 (including transport filters)
73243 except cutthrough delivery.
73244 </para>
73245 </listitem>
73246 <listitem>
73247 <para>
73248 Verifying signatures in incoming messages: This is implemented by an additional
73249 ACL (acl_smtp_dkim), which can be called several times per message, with
73250 different signature contexts.
73251 </para>
73252 </listitem>
73253 </orderedlist>
73254 <para>
73255 In typical Exim style, the verification implementation does not include any
73256 default "policy". Instead it enables you to build your own policy using
73257 Exim&#x2019;s standard controls.
73258 </para>
73259 <para>
73260 Please note that verification of DKIM signatures in incoming mail is turned
73261 on by default for logging (in the &lt;= line) purposes.
73262 </para>
73263 <para>
73264 Additional log detail can be enabled using the <option>dkim_verbose</option> log_selector.
73265 When set, for each signature in incoming email,
73266 exim will log a line displaying the most important signature details, and the
73267 signature status. Here is an example (with line-breaks added for clarity):
73268 </para>
73269 <literallayout class="monospaced">
73270 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
73271     d=facebookmail.com s=q1-2009b
73272     c=relaxed/relaxed a=rsa-sha1
73273     i=@facebookmail.com t=1252484542 [verification succeeded]
73274 </literallayout>
73275 <para>
73276 You might want to turn off DKIM verification processing entirely for internal
73277 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
73278 control modifier. This should typically be done in the RCPT ACL, at points
73279 where you accept mail from relay sources (internal hosts or authenticated
73280 senders).
73281 </para>
73282 </section>
73283 <section id="SECDKIMSIGN">
73284 <title>Signing outgoing messages</title>
73285 <para>
73286 <indexterm role="concept">
73287 <primary>DKIM</primary>
73288 <secondary>signing</secondary>
73289 </indexterm>
73290 </para>
73291 <para>
73292 For signing to be usable you must have published a DKIM record in DNS.
73293 Note that RFC 8301 (which does not cover EC keys) says:
73294 </para>
73295 <literallayout class="monospaced">
73296 rsa-sha1 MUST NOT be used for signing or verifying.
73297
73298 Signers MUST use RSA keys of at least 1024 bits for all keys.
73299 Signers SHOULD use RSA keys of at least 2048 bits.
73300 </literallayout>
73301 <para>
73302 Note also that the key content (the &#x2019;p=&#x2019; field)
73303 in the DNS record is different between RSA and EC keys;
73304 for the former it is the base64 of the ASN.1 for the RSA public key
73305 (equivalent to the private-key .pem with the header/trailer stripped)
73306 but for EC keys it is the base64 of the pure key; no ASN.1 wrapping.
73307 </para>
73308 <para>
73309 Signing is enabled by setting private options on the SMTP transport.
73310 These options take (expandable) strings as arguments.
73311 </para>
73312 <para>
73313 <indexterm role="option">
73314 <primary><option>unset</option></primary>
73315 </indexterm>
73316 </para>
73317 <informaltable frame="all">
73318 <tgroup cols="4" colsep="0" rowsep="0">
73319 <colspec colwidth="8*" align="left"/>
73320 <colspec colwidth="6*" align="center"/>
73321 <colspec colwidth="6*" align="center"/>
73322 <colspec colwidth="6*" align="right"/>
73323 <tbody>
73324 <row>
73325 <entry><option>dkim_domain</option></entry>
73326 <entry>Use: <emphasis>smtp</emphasis></entry>
73327 <entry>Type: <emphasis>string</emphasis></entry>
73328 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
73329 </row>
73330 </tbody>
73331 </tgroup>
73332 </informaltable>
73333 <para>
73334 The domain(s) you want to sign with.
73335 After expansion, this can be a list.
73336 Each element in turn,
73337 lowercased,
73338 is put into the <option>$dkim_domain</option> expansion variable
73339 while expanding the remaining signing options.
73340 If it is empty after expansion, DKIM signing is not done,
73341 and no error will result even if <option>dkim_strict</option> is set.
73342 </para>
73343 <para>
73344 <indexterm role="option">
73345 <primary><option>unset</option></primary>
73346 </indexterm>
73347 </para>
73348 <informaltable frame="all">
73349 <tgroup cols="4" colsep="0" rowsep="0">
73350 <colspec colwidth="8*" align="left"/>
73351 <colspec colwidth="6*" align="center"/>
73352 <colspec colwidth="6*" align="center"/>
73353 <colspec colwidth="6*" align="right"/>
73354 <tbody>
73355 <row>
73356 <entry><option>dkim_selector</option></entry>
73357 <entry>Use: <emphasis>smtp</emphasis></entry>
73358 <entry>Type: <emphasis>string</emphasis></entry>
73359 <entry>Default: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
73360 </row>
73361 </tbody>
73362 </tgroup>
73363 </informaltable>
73364 <para>
73365 This sets the key selector string.
73366 After expansion, which can use <varname>$dkim_domain</varname>, this can be a list.
73367 Each element in turn is put in the expansion
73368 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
73369 option along with <option>$dkim_domain</option>.
73370 If the option is empty after expansion, DKIM signing is not done for this domain,
73371 and no error will result even if <option>dkim_strict</option> is set.
73372 </para>
73373 <para>
73374 <indexterm role="option">
73375 <primary><option>dkim_private_key</option></primary>
73376 </indexterm>
73377 </para>
73378 <informaltable frame="all">
73379 <tgroup cols="4" colsep="0" rowsep="0">
73380 <colspec colwidth="8*" align="left"/>
73381 <colspec colwidth="6*" align="center"/>
73382 <colspec colwidth="6*" align="center"/>
73383 <colspec colwidth="6*" align="right"/>
73384 <tbody>
73385 <row>
73386 <entry><option>dkim_private_key</option></entry>
73387 <entry>Use: <emphasis>smtp</emphasis></entry>
73388 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73389 <entry>Default: <emphasis>unset</emphasis></entry>
73390 </row>
73391 </tbody>
73392 </tgroup>
73393 </informaltable>
73394 <para>
73395 This sets the private key to use.
73396 You can use the <option>$dkim_domain</option> and
73397 <option>$dkim_selector</option> expansion variables to determine the private key to use.
73398 The result can either
73399 </para>
73400 <itemizedlist>
73401 <listitem>
73402 <para>
73403 be a valid RSA private key in ASCII armor (.pem file), including line breaks
73404 </para>
73405 </listitem>
73406 <listitem>
73407 <para>
73408 with GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
73409 be a valid Ed25519 private key (same format as above)
73410 </para>
73411 </listitem>
73412 <listitem>
73413 <para>
73414 start with a slash, in which case it is treated as a file that contains
73415 the private key
73416 </para>
73417 </listitem>
73418 <listitem>
73419 <para>
73420 be "0", "false" or the empty string, in which case the message will not
73421 be signed. This case will not result in an error, even if <option>dkim_strict</option>
73422 is set.
73423 </para>
73424 </listitem>
73425 </itemizedlist>
73426 <para>
73427 To generate keys under OpenSSL:
73428 </para>
73429 <literallayout class="monospaced">
73430 openssl genrsa -out dkim_rsa.private 2048
73431 openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM
73432 </literallayout>
73433 <para>
73434 The result file from the first command should be retained, and
73435 this option set to use it.
73436 Take the base-64 lines from the output of the second command, concatenated,
73437 for the DNS TXT record.
73438 See section 3.6 of RFC6376 for the record specification.
73439 </para>
73440 <para>
73441 Under GnuTLS:
73442 </para>
73443 <literallayout class="monospaced">
73444 certtool --generate-privkey --rsa --bits=2048 --password='' -8 --outfile=dkim_rsa.private
73445 certtool --load-privkey=dkim_rsa.private --pubkey-info
73446 </literallayout>
73447 <para>
73448 Note that RFC 8301 says:
73449 </para>
73450 <literallayout class="monospaced">
73451 Signers MUST use RSA keys of at least 1024 bits for all keys.
73452 Signers SHOULD use RSA keys of at least 2048 bits.
73453 </literallayout>
73454 <para>
73455 EC keys for DKIM are defined by RFC 8463.
73456 They are considerably smaller than RSA keys for equivalent protection.
73457 As they are a recent development, users should consider dual-signing
73458 (by setting a list of selectors, and an expansion for this option)
73459 for some transition period.
73460 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
73461 for EC keys.
73462 </para>
73463 <para>
73464 OpenSSL 1.1.1 and GnuTLS 3.6.0 can create Ed25519 private keys:
73465 </para>
73466 <literallayout class="monospaced">
73467 openssl genpkey -algorithm ed25519 -out dkim_ed25519.private
73468 certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private
73469 </literallayout>
73470 <para>
73471 To produce the required public key value for a DNS record:
73472 </para>
73473 <literallayout class="monospaced">
73474 openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base64
73475 certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64
73476 </literallayout>
73477 <para>
73478 Exim also supports an alternate format
73479 of Ed25519 keys in DNS which was a candidate during development
73480 of the standard, but not adopted.
73481 A future release will probably drop that support.
73482 </para>
73483 <para>
73484 <indexterm role="option">
73485 <primary><option>dkim_hash</option></primary>
73486 </indexterm>
73487 </para>
73488 <informaltable frame="all">
73489 <tgroup cols="4" colsep="0" rowsep="0">
73490 <colspec colwidth="8*" align="left"/>
73491 <colspec colwidth="6*" align="center"/>
73492 <colspec colwidth="6*" align="center"/>
73493 <colspec colwidth="6*" align="right"/>
73494 <tbody>
73495 <row>
73496 <entry><option>dkim_hash</option></entry>
73497 <entry>Use: <emphasis>smtp</emphasis></entry>
73498 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73499 <entry>Default: <emphasis>sha256</emphasis></entry>
73500 </row>
73501 </tbody>
73502 </tgroup>
73503 </informaltable>
73504 <para>
73505 Can be set to any one of the supported hash methods, which are:
73506 </para>
73507 <itemizedlist>
73508 <listitem>
73509 <para>
73510 <literal>sha1</literal> &ndash; should not be used, is old and insecure
73511 </para>
73512 </listitem>
73513 <listitem>
73514 <para>
73515 <literal>sha256</literal> &ndash; the default
73516 </para>
73517 </listitem>
73518 <listitem>
73519 <para>
73520 <literal>sha512</literal> &ndash; possibly more secure but less well supported
73521 </para>
73522 </listitem>
73523 </itemizedlist>
73524 <para>
73525 Note that RFC 8301 says:
73526 </para>
73527 <literallayout class="monospaced">
73528 rsa-sha1 MUST NOT be used for signing or verifying.
73529 </literallayout>
73530 <para>
73531 <indexterm role="option">
73532 <primary><option>dkim_identity</option></primary>
73533 </indexterm>
73534 </para>
73535 <informaltable frame="all">
73536 <tgroup cols="4" colsep="0" rowsep="0">
73537 <colspec colwidth="8*" align="left"/>
73538 <colspec colwidth="6*" align="center"/>
73539 <colspec colwidth="6*" align="center"/>
73540 <colspec colwidth="6*" align="right"/>
73541 <tbody>
73542 <row>
73543 <entry><option>dkim_identity</option></entry>
73544 <entry>Use: <emphasis>smtp</emphasis></entry>
73545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73546 <entry>Default: <emphasis>unset</emphasis></entry>
73547 </row>
73548 </tbody>
73549 </tgroup>
73550 </informaltable>
73551 <para>
73552 If set after expansion, the value is used to set an "i=" tag in
73553 the signing header.  The DKIM standards restrict the permissible
73554 syntax of this optional tag to a mail address, with possibly-empty
73555 local part, an @, and a domain identical to or subdomain of the "d="
73556 tag value.  Note that Exim does not check the value.
73557 </para>
73558 <para>
73559 <indexterm role="option">
73560 <primary><option>dkim_canon</option></primary>
73561 </indexterm>
73562 </para>
73563 <informaltable frame="all">
73564 <tgroup cols="4" colsep="0" rowsep="0">
73565 <colspec colwidth="8*" align="left"/>
73566 <colspec colwidth="6*" align="center"/>
73567 <colspec colwidth="6*" align="center"/>
73568 <colspec colwidth="6*" align="right"/>
73569 <tbody>
73570 <row>
73571 <entry><option>dkim_canon</option></entry>
73572 <entry>Use: <emphasis>smtp</emphasis></entry>
73573 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73574 <entry>Default: <emphasis>unset</emphasis></entry>
73575 </row>
73576 </tbody>
73577 </tgroup>
73578 </informaltable>
73579 <para>
73580 This option sets the canonicalization method used when signing a message.
73581 The DKIM RFC currently supports two methods: "simple" and "relaxed".
73582 The option defaults to "relaxed" when unset. Note: the current implementation
73583 only supports signing with the same canonicalization method for both headers and body.
73584 </para>
73585 <para>
73586 <indexterm role="option">
73587 <primary><option>dkim_strict</option></primary>
73588 </indexterm>
73589 </para>
73590 <informaltable frame="all">
73591 <tgroup cols="4" colsep="0" rowsep="0">
73592 <colspec colwidth="8*" align="left"/>
73593 <colspec colwidth="6*" align="center"/>
73594 <colspec colwidth="6*" align="center"/>
73595 <colspec colwidth="6*" align="right"/>
73596 <tbody>
73597 <row>
73598 <entry><option>dkim_strict</option></entry>
73599 <entry>Use: <emphasis>smtp</emphasis></entry>
73600 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73601 <entry>Default: <emphasis>unset</emphasis></entry>
73602 </row>
73603 </tbody>
73604 </tgroup>
73605 </informaltable>
73606 <para>
73607 This  option  defines  how  Exim  behaves  when  signing a message that
73608 should be signed fails for some reason.  When the expansion evaluates to
73609 either <quote>1</quote> or <quote>true</quote>, Exim will defer. Otherwise Exim will send the message
73610 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
73611 variables here.
73612 </para>
73613 <para>
73614 <indexterm role="option">
73615 <primary><option>dkim_sign_headers</option></primary>
73616 </indexterm>
73617 </para>
73618 <informaltable frame="all">
73619 <tgroup cols="4" colsep="0" rowsep="0">
73620 <colspec colwidth="8*" align="left"/>
73621 <colspec colwidth="6*" align="center"/>
73622 <colspec colwidth="6*" align="center"/>
73623 <colspec colwidth="6*" align="right"/>
73624 <tbody>
73625 <row>
73626 <entry><option>dkim_sign_headers</option></entry>
73627 <entry>Use: <emphasis>smtp</emphasis></entry>
73628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
73629 <entry>Default: <emphasis>see below</emphasis></entry>
73630 </row>
73631 </tbody>
73632 </tgroup>
73633 </informaltable>
73634 <para>
73635 If set, this option must expand to a colon-separated
73636 list of header names.
73637 Headers with these names, or the absence or such a header, will be included
73638 in the message signature.
73639 When unspecified, the header names listed in RFC4871 will be used,
73640 whether or not each header is present in the message.
73641 The default list is available for the expansion in the macro
73642 <quote>_DKIM_SIGN_HEADERS</quote>
73643 </para>
73644 <para revisionflag="changed">
73645 and an oversigning variant is in <quote>_DKIM_OVERSIGN_HEADERS</quote>.
73646 </para>
73647 <para>
73648 If a name is repeated, multiple headers by that name (or the absence thereof)
73649 will be signed.  The textually later headers in the headers part of the
73650 message are signed first, if there are multiples.
73651 </para>
73652 <para>
73653 A name can be prefixed with either an <quote>=</quote> or a <quote>+</quote> character.
73654 If an <quote>=</quote> prefix is used, all headers that are present with this name
73655 will be signed.
73656 If a <quote>+</quote> prefix if used, all headers that are present with this name
73657 will be signed, and one signature added for a missing header with the
73658 name will be appended.
73659 </para>
73660 <para>
73661 <indexterm role="option">
73662 <primary><option>dkim_timestamps</option></primary>
73663 </indexterm>
73664 </para>
73665 <informaltable frame="all">
73666 <tgroup cols="4" colsep="0" rowsep="0">
73667 <colspec colwidth="8*" align="left"/>
73668 <colspec colwidth="6*" align="center"/>
73669 <colspec colwidth="6*" align="center"/>
73670 <colspec colwidth="6*" align="right"/>
73671 <tbody>
73672 <row>
73673 <entry><option>dkim_timestamps</option></entry>
73674 <entry>Use: <emphasis>smtp</emphasis></entry>
73675 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
73676 <entry>Default: <emphasis>unset</emphasis></entry>
73677 </row>
73678 </tbody>
73679 </tgroup>
73680 </informaltable>
73681 <para>
73682 This option controls the inclusion of timestamp information in the signature.
73683 If not set, no such information will be included.
73684 Otherwise, must be an unsigned number giving an offset in seconds from the current time
73685 for the expiry tag
73686 (eg. 1209600 for two weeks);
73687 both creation (t=) and expiry (x=) tags will be included.
73688 </para>
73689 <para>
73690 RFC 6376 lists these tags as RECOMMENDED.
73691 </para>
73692 </section>
73693 <section id="SECDKIMVFY">
73694 <title>Verifying DKIM signatures in incoming mail</title>
73695 <para>
73696 <indexterm role="concept">
73697 <primary>DKIM</primary>
73698 <secondary>verification</secondary>
73699 </indexterm>
73700 </para>
73701 <para>
73702 Verification of DKIM signatures in SMTP incoming email is done for all
73703 messages for which an ACL control <option>dkim_disable_verify</option> has not been set.
73704 <indexterm role="concept">
73705 <primary>DKIM</primary>
73706 <secondary>selecting signature algorithms</secondary>
73707 </indexterm>
73708 Individual classes of signature algorithm can be ignored by changing
73709 the main options <option>dkim_verify_hashes</option> or <option>dkim_verify_keytypes</option>.
73710 The <option>dkim_verify_minimal</option> option can be set to cease verification
73711 processing for a message once the first passing signature is found.
73712 </para>
73713 <para>
73714 <indexterm role="concept">
73715 <primary>authentication</primary>
73716 <secondary>expansion item</secondary>
73717 </indexterm>
73718 Performing verification sets up information used by the
73719 <option>authresults</option> expansion item.
73720 </para>
73721 <para>
73722 For most purposes the default option settings suffice and the remainder
73723 of this section can be ignored.
73724 </para>
73725 <para>
73726 The results of verification are made available to the
73727 <option>acl_smtp_dkim</option> ACL, which can examine and modify them.
73728 A missing ACL definition defaults to accept.
73729 By default, the ACL is called once for each
73730 syntactically(!) correct signature in the incoming message.
73731 If any ACL call does not accept, the message is not accepted.
73732 If a cutthrough delivery was in progress for the message, that is
73733 summarily dropped (having wasted the transmission effort).
73734 </para>
73735 <para>
73736 To evaluate the verification result in the ACL
73737 a large number of expansion variables
73738 containing the signature status and its details are set up during the
73739 runtime of the ACL.
73740 </para>
73741 <para>
73742 Calling the ACL only for existing signatures is not sufficient to build
73743 more advanced policies. For that reason, the main option
73744 <option>dkim_verify_signers</option>, and an expansion variable
73745 <option>$dkim_signers</option> exist.
73746 </para>
73747 <para>
73748 The main option <option>dkim_verify_signers</option> can be set to a colon-separated
73749 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
73750 called. It is expanded when the message has been received. At this point,
73751 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
73752 list of signer domains and identities for the message. When
73753 <option>dkim_verify_signers</option> is not specified in the main configuration,
73754 it defaults as:
73755 </para>
73756 <literallayout class="monospaced">
73757 dkim_verify_signers = $dkim_signers
73758 </literallayout>
73759 <para>
73760 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
73761 DKIM signature in the message. Current DKIM verifiers may want to explicitly
73762 call the ACL for known domains or identities. This would be achieved as follows:
73763 </para>
73764 <literallayout class="monospaced">
73765 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
73766 </literallayout>
73767 <para>
73768 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
73769 and "ebay.com", plus all domains and identities that have signatures in the message.
73770 You can also be more creative in constructing your policy. For example:
73771 </para>
73772 <literallayout class="monospaced">
73773 dkim_verify_signers = $sender_address_domain:$dkim_signers
73774 </literallayout>
73775 <para>
73776 If a domain or identity is listed several times in the (expanded) value of
73777 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
73778 </para>
73779 <para>
73780 Note that if the option is set using untrustworthy data
73781 (such as the From: header)
73782 care should be taken to force lowercase for domains
73783 and for the domain part if identities.
73784 The default setting can be regarded as trustworthy in this respect.
73785 </para>
73786 <para>
73787 If multiple signatures match a domain (or identity), the ACL is called once
73788 for each matching signature.
73789 </para>
73790 <para>
73791 Inside the DKIM ACL, the following expansion variables are
73792 available (from most to least important):
73793 </para>
73794 <variablelist>
73795 <varlistentry>
73796 <term><option>$dkim_cur_signer</option></term>
73797 <listitem>
73798 <para>
73799 The signer that is being evaluated in this ACL run. This can be a domain or
73800 an identity. This is one of the list items from the expanded main option
73801 <option>dkim_verify_signers</option> (see above).
73802 </para>
73803 </listitem></varlistentry>
73804 <varlistentry>
73805 <term><option>$dkim_verify_status</option></term>
73806 <listitem>
73807 <para>
73808 Within the DKIM ACL,
73809 a string describing the general status of the signature. One of
73810 </para>
73811 <itemizedlist>
73812 <listitem>
73813 <para>
73814 <option>none</option>: There is no signature in the message for the current domain or
73815 identity (as reflected by <option>$dkim_cur_signer</option>).
73816 </para>
73817 </listitem>
73818 <listitem>
73819 <para>
73820 <option>invalid</option>: The signature could not be verified due to a processing error.
73821 More detail is available in <option>$dkim_verify_reason</option>.
73822 </para>
73823 </listitem>
73824 <listitem>
73825 <para>
73826 <option>fail</option>: Verification of the signature failed.  More detail is
73827 available in <option>$dkim_verify_reason</option>.
73828 </para>
73829 </listitem>
73830 <listitem>
73831 <para>
73832 <option>pass</option>: The signature passed verification. It is valid.
73833 </para>
73834 </listitem>
73835 </itemizedlist>
73836 <para>
73837 This variable can be overwritten using an ACL &#x2019;set&#x2019; modifier.
73838 This might, for instance, be done to enforce a policy restriction on
73839 hash-method or key-size:
73840 </para>
73841 <literallayout class="monospaced">
73842   warn condition       = ${if eq {$dkim_verify_status}{pass}}
73843        condition       = ${if eq {${length_3:$dkim_algo}}{rsa}}
73844        condition       = ${if or {{eq {$dkim_algo}{rsa-sha1}} \
73845                                   {&lt; {$dkim_key_length}{1024}}}}
73846        logwrite        = NOTE: forcing DKIM verify fail (was pass)
73847        set dkim_verify_status = fail
73848        set dkim_verify_reason = hash too weak or key too short
73849 </literallayout>
73850 <para>
73851 So long as a DKIM ACL is defined (it need do no more than accept),
73852 after all the DKIM ACL runs have completed, the value becomes a
73853 colon-separated list of the values after each run.
73854 This is maintained for the mime, prdr and data ACLs.
73855 </para>
73856 </listitem></varlistentry>
73857 <varlistentry>
73858 <term><option>$dkim_verify_reason</option></term>
73859 <listitem>
73860 <para>
73861 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
73862 "fail" or "invalid". One of
73863 </para>
73864 <itemizedlist>
73865 <listitem>
73866 <para>
73867 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
73868 key for the domain could not be retrieved. This may be a temporary problem.
73869 </para>
73870 </listitem>
73871 <listitem>
73872 <para>
73873 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
73874 record for the domain is syntactically invalid.
73875 </para>
73876 </listitem>
73877 <listitem>
73878 <para>
73879 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
73880 body hash does not match the one specified in the signature header. This
73881 means that the message body was modified in transit.
73882 </para>
73883 </listitem>
73884 <listitem>
73885 <para>
73886 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
73887 could not be verified. This may mean that headers were modified,
73888 re-written or otherwise changed in a way which is incompatible with
73889 DKIM verification. It may of course also mean that the signature is forged.
73890 </para>
73891 </listitem>
73892 </itemizedlist>
73893 <para>
73894 This variable can be overwritten, with any value, using an ACL &#x2019;set&#x2019; modifier.
73895 </para>
73896 </listitem></varlistentry>
73897 <varlistentry>
73898 <term><option>$dkim_domain</option></term>
73899 <listitem>
73900 <para>
73901 The signing domain. IMPORTANT: This variable is only populated if there is
73902 an actual signature in the message for the current domain or identity (as
73903 reflected by <option>$dkim_cur_signer</option>).
73904 </para>
73905 </listitem></varlistentry>
73906 <varlistentry>
73907 <term><option>$dkim_identity</option></term>
73908 <listitem>
73909 <para>
73910 The signing identity, if present. IMPORTANT: This variable is only populated
73911 if there is an actual signature in the message for the current domain or
73912 identity (as reflected by <option>$dkim_cur_signer</option>).
73913 </para>
73914 </listitem></varlistentry>
73915 <varlistentry>
73916 <term><option>$dkim_selector</option></term>
73917 <listitem>
73918 <para>
73919 The key record selector string.
73920 </para>
73921 </listitem></varlistentry>
73922 <varlistentry>
73923 <term><option>$dkim_algo</option></term>
73924 <listitem>
73925 <para>
73926 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
73927 If running under GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
73928 may also be &#x2019;ed25519-sha256&#x2019;.
73929 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
73930 for EC keys.
73931 </para>
73932 <para>
73933 Note that RFC 8301 says:
73934 </para>
73935 <literallayout class="monospaced">
73936 rsa-sha1 MUST NOT be used for signing or verifying.
73937
73938 DKIM signatures identified as having been signed with historic
73939 algorithms (currently, rsa-sha1) have permanently failed evaluation
73940 </literallayout>
73941 <para>
73942 To enforce this you must either have a DKIM ACL which checks this variable
73943 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above,
73944 or have set the main option <option>dkim_verify_hashes</option> to exclude
73945 processing of such signatures.
73946 </para>
73947 </listitem></varlistentry>
73948 <varlistentry>
73949 <term><option>$dkim_canon_body</option></term>
73950 <listitem>
73951 <para>
73952 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
73953 </para>
73954 </listitem></varlistentry>
73955 <varlistentry>
73956 <term><option>$dkim_canon_headers</option></term>
73957 <listitem>
73958 <para>
73959 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
73960 </para>
73961 </listitem></varlistentry>
73962 <varlistentry>
73963 <term><option>$dkim_copiedheaders</option></term>
73964 <listitem>
73965 <para>
73966 A transcript of headers and their values which are included in the signature
73967 (copied from the &#x2019;z=&#x2019; tag of the signature).
73968 Note that RFC6376 requires that verification fail if the From: header is
73969 not included in the signature.  Exim does not enforce this; sites wishing
73970 strict enforcement should code the check explicitly.
73971 </para>
73972 </listitem></varlistentry>
73973 <varlistentry>
73974 <term><option>$dkim_bodylength</option></term>
73975 <listitem>
73976 <para>
73977 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
73978 limit was set by the signer, "9999999999999" is returned. This makes sure
73979 that this variable always expands to an integer value.
73980 <emphasis role="bold">Note:</emphasis> The presence of the signature tag specifying a signing body length
73981 is one possible route to spoofing of valid DKIM signatures.
73982 A paranoid implementation might wish to regard signature where this variable
73983 shows less than the "no limit" return as being invalid.
73984 </para>
73985 </listitem></varlistentry>
73986 <varlistentry>
73987 <term><option>$dkim_created</option></term>
73988 <listitem>
73989 <para>
73990 UNIX timestamp reflecting the date and time when the signature was created.
73991 When this was not specified by the signer, "0" is returned.
73992 </para>
73993 </listitem></varlistentry>
73994 <varlistentry>
73995 <term><option>$dkim_expires</option></term>
73996 <listitem>
73997 <para>
73998 UNIX timestamp reflecting the date and time when the signer wants the
73999 signature to be treated as "expired". When this was not specified by the
74000 signer, "9999999999999" is returned. This makes it possible to do useful
74001 integer size comparisons against this value.
74002 Note that Exim does not check this value.
74003 </para>
74004 </listitem></varlistentry>
74005 <varlistentry>
74006 <term><option>$dkim_headernames</option></term>
74007 <listitem>
74008 <para>
74009 A colon-separated list of names of headers included in the signature.
74010 </para>
74011 </listitem></varlistentry>
74012 <varlistentry>
74013 <term><option>$dkim_key_testing</option></term>
74014 <listitem>
74015 <para>
74016 "1" if the key record has the "testing" flag set, "0" if not.
74017 </para>
74018 </listitem></varlistentry>
74019 <varlistentry>
74020 <term><option>$dkim_key_nosubdomains</option></term>
74021 <listitem>
74022 <para>
74023 "1" if the key record forbids subdomaining, "0" otherwise.
74024 </para>
74025 </listitem></varlistentry>
74026 <varlistentry>
74027 <term><option>$dkim_key_srvtype</option></term>
74028 <listitem>
74029 <para>
74030 Service type (tag s=) from the key record. Defaults to "*" if not specified
74031 in the key record.
74032 </para>
74033 </listitem></varlistentry>
74034 <varlistentry>
74035 <term><option>$dkim_key_granularity</option></term>
74036 <listitem>
74037 <para>
74038 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
74039 in the key record.
74040 </para>
74041 </listitem></varlistentry>
74042 <varlistentry>
74043 <term><option>$dkim_key_notes</option></term>
74044 <listitem>
74045 <para>
74046 Notes from the key record (tag n=).
74047 </para>
74048 </listitem></varlistentry>
74049 <varlistentry>
74050 <term><option>$dkim_key_length</option></term>
74051 <listitem>
74052 <para>
74053 Number of bits in the key.
74054 </para>
74055 <para revisionflag="changed">
74056 Valid only once the key is loaded, which is at the time the header signature
74057 is verified, which is after the body hash is.
74058 </para>
74059 <para>
74060 Note that RFC 8301 says:
74061 </para>
74062 <literallayout class="monospaced">
74063 Verifiers MUST NOT consider signatures using RSA keys of
74064 less than 1024 bits as valid signatures.
74065 </literallayout>
74066 <para>
74067 This is enforced by the default setting for the <option>dkim_verify_min_keysizes</option>
74068 option.
74069 </para>
74070 </listitem></varlistentry>
74071 </variablelist>
74072 <para>
74073 In addition, two ACL conditions are provided:
74074 </para>
74075 <variablelist>
74076 <varlistentry>
74077 <term><option>dkim_signers</option></term>
74078 <listitem>
74079 <para>
74080 ACL condition that checks a colon-separated list of domains or identities
74081 for a match against the domain or identity that the ACL is currently verifying
74082 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
74083 verb to a group of domains or identities. For example:
74084 </para>
74085 <literallayout class="monospaced">
74086 # Warn when Mail purportedly from GMail has no gmail signature
74087 warn sender_domains = gmail.com
74088      dkim_signers = gmail.com
74089      dkim_status = none
74090      log_message = GMail sender without gmail.com DKIM signature
74091 </literallayout>
74092 <para>
74093 Note that the above does not check for a total lack of DKIM signing;
74094 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
74095 </para>
74096 </listitem></varlistentry>
74097 <varlistentry>
74098 <term><option>dkim_status</option></term>
74099 <listitem>
74100 <para>
74101 ACL condition that checks a colon-separated list of possible DKIM verification
74102 results against the actual result of verification. This is typically used
74103 to restrict an ACL verb to a list of verification outcomes, for example:
74104 </para>
74105 <literallayout class="monospaced">
74106 deny sender_domains = paypal.com:paypal.de
74107      dkim_signers = paypal.com:paypal.de
74108      dkim_status = none:invalid:fail
74109      message = Mail from Paypal with invalid/missing signature
74110 </literallayout>
74111 <para>
74112 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
74113 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
74114 for more information of what they mean.
74115 </para>
74116 </listitem></varlistentry>
74117 </variablelist>
74118 </section>
74119 <section id="SECSPF">
74120 <title>SPF (Sender Policy Framework)</title>
74121 <para>
74122 <indexterm role="concept">
74123 <primary>SPF</primary>
74124 <secondary>verification</secondary>
74125 </indexterm>
74126 </para>
74127 <para>
74128 SPF is a mechanism whereby a domain may assert which IP addresses may transmit
74129 messages with its domain in the envelope from, documented by RFC 7208.
74130 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
74131 the <emphasis role="bold"><ulink url="http://openspf.org">http://openspf.org</ulink></emphasis>.
74132 </para>
74133 <para>
74134 Messages sent by a system not authorised will fail checking of such assertions.
74135 This includes retransmissions done by traditional forwarders.
74136 </para>
74137 <para>
74138 SPF verification support is built into Exim if SUPPORT_SPF=yes is set in
74139 <filename>Local/Makefile</filename>.  The support uses the <filename>libspf2</filename> library
74140 <emphasis role="bold"><ulink url="https://www.libspf2.org/">https://www.libspf2.org/</ulink></emphasis>.
74141 There is no Exim involvement in the transmission of messages;
74142 publishing certain DNS records is all that is required.
74143 </para>
74144 <para>
74145 For verification, an ACL condition and an expansion lookup are provided.
74146 <indexterm role="concept">
74147 <primary>authentication</primary>
74148 <secondary>expansion item</secondary>
74149 </indexterm>
74150 Performing verification sets up information used by the
74151 <option>authresults</option> expansion item.
74152 </para>
74153 <para>
74154 <indexterm role="concept">
74155 <primary>SPF</primary>
74156 <secondary>ACL condition</secondary>
74157 </indexterm>
74158 <indexterm role="concept">
74159 <primary>ACL</primary>
74160 <secondary>spf condition</secondary>
74161 </indexterm>
74162 The ACL condition "spf" can be used at or after the MAIL ACL.
74163 It takes as an argument a list of strings giving the outcome of the SPF check,
74164 and will succeed for any matching outcome.
74165 Valid strings are:
74166 </para>
74167 <variablelist>
74168 <varlistentry>
74169 <term><option>pass</option></term>
74170 <listitem>
74171 <para>
74172 The SPF check passed, the sending host is positively verified by SPF.
74173 </para>
74174 </listitem></varlistentry>
74175 <varlistentry>
74176 <term><option>fail</option></term>
74177 <listitem>
74178 <para>
74179 The SPF check failed, the sending host is NOT allowed to send mail for the
74180 domain in the envelope-from address.
74181 </para>
74182 </listitem></varlistentry>
74183 <varlistentry>
74184 <term><option>softfail</option></term>
74185 <listitem>
74186 <para>
74187 The SPF check failed, but the queried domain can&#x2019;t absolutely confirm that this
74188 is a forgery.
74189 </para>
74190 </listitem></varlistentry>
74191 <varlistentry>
74192 <term><option>none</option></term>
74193 <listitem>
74194 <para>
74195 The queried domain does not publish SPF records.
74196 </para>
74197 </listitem></varlistentry>
74198 <varlistentry>
74199 <term><option>neutral</option></term>
74200 <listitem>
74201 <para>
74202 The SPF check returned a "neutral" state.  This means the queried domain has
74203 published a SPF record, but wants to allow outside servers to send mail under
74204 its domain as well.  This should be treated like "none".
74205 </para>
74206 </listitem></varlistentry>
74207 <varlistentry>
74208 <term><option>permerror</option></term>
74209 <listitem>
74210 <para>
74211 This indicates a syntax error in the SPF record of the queried domain.
74212 You may deny messages when this occurs.
74213 </para>
74214 </listitem></varlistentry>
74215 <varlistentry>
74216 <term><option>temperror</option></term>
74217 <listitem>
74218 <para>
74219 This indicates a temporary error during all processing, including Exim&#x2019;s
74220 SPF processing.  You may defer messages when this occurs.
74221 </para>
74222 </listitem></varlistentry>
74223 </variablelist>
74224 <para>
74225 You can prefix each string with an exclamation mark to  invert
74226 its meaning,  for example  "!fail" will  match all  results but
74227 "fail".  The  string  list is  evaluated  left-to-right,  in a
74228 short-circuit fashion.
74229 </para>
74230 <para>
74231 Example:
74232 </para>
74233 <literallayout class="monospaced">
74234 deny spf = fail
74235      message = $sender_host_address is not allowed to send mail from \
74236                ${if def:sender_address_domain \
74237                     {$sender_address_domain}{$sender_helo_name}}.  \
74238                Please see http://www.open-spf.org/Why;\
74239                identity=${if def:sender_address_domain \
74240                              {$sender_address}{$sender_helo_name}};\
74241                ip=$sender_host_address
74242 </literallayout>
74243 <para>
74244 Note: The above mentioned URL may not be as helpful as expected. You are
74245 encouraged to replace the link with a link to a site with more
74246 explanations.
74247 </para>
74248 <para>
74249 When the spf condition has run, it sets up several expansion
74250 variables:
74251 </para>
74252 <para>
74253 <indexterm role="concept">
74254 <primary>SPF</primary>
74255 <secondary>verification variables</secondary>
74256 </indexterm>
74257 </para>
74258 <variablelist>
74259 <varlistentry>
74260 <term><varname>$spf_header_comment</varname></term>
74261 <listitem>
74262 <para>
74263 <indexterm role="variable">
74264 <primary><varname>$spf_header_comment</varname></primary>
74265 </indexterm>
74266   This contains a human-readable string describing the outcome
74267   of the SPF check. You can add it to a custom header or use
74268   it for logging purposes.
74269 </para>
74270 </listitem></varlistentry>
74271 <varlistentry>
74272 <term><varname>$spf_received</varname></term>
74273 <listitem>
74274 <para>
74275 <indexterm role="variable">
74276 <primary><varname>$spf_received</varname></primary>
74277 </indexterm>
74278   This contains a complete Received-SPF: header that can be
74279   added to the message. Please note that according to the SPF
74280   draft, this header must be added at the top of the header
74281   list. Please see section 10 on how you can do this.
74282 </para>
74283 <para>
74284   Note: in case of "Best-guess" (see below), the convention is
74285   to put this string in a header called X-SPF-Guess: instead.
74286 </para>
74287 </listitem></varlistentry>
74288 <varlistentry>
74289 <term><varname>$spf_result</varname></term>
74290 <listitem>
74291 <para>
74292 <indexterm role="variable">
74293 <primary><varname>$spf_result</varname></primary>
74294 </indexterm>
74295   This contains the outcome of the SPF check in string form,
74296   one of pass, fail, softfail, none, neutral, permerror or
74297   temperror.
74298 </para>
74299 </listitem></varlistentry>
74300 <varlistentry>
74301 <term><varname>$spf_result_guessed</varname></term>
74302 <listitem>
74303 <para>
74304 <indexterm role="variable">
74305 <primary><varname>$spf_result_guessed</varname></primary>
74306 </indexterm>
74307   This boolean is true only if a best-guess operation was used
74308   and required in order to obtain a result.
74309 </para>
74310 </listitem></varlistentry>
74311 <varlistentry>
74312 <term><varname>$spf_smtp_comment</varname></term>
74313 <listitem>
74314 <para>
74315 <indexterm role="variable">
74316 <primary><varname>$spf_smtp_comment</varname></primary>
74317 </indexterm>
74318 <indexterm role="variable">
74319 <primary><option>spf_smtp_comment_template</option></primary>
74320 </indexterm>
74321   This contains a string that can be used in a SMTP response
74322   to the calling party. Useful for "fail".
74323 </para>
74324 <para revisionflag="changed">
74325   The string is generated by the SPF library from the template configured in the main config
74326   option <option>spf_smtp_comment_template</option>.
74327 </para>
74328 </listitem></varlistentry>
74329 </variablelist>
74330 <para>
74331 <indexterm role="concept">
74332 <primary>SPF</primary>
74333 <secondary>ACL condition</secondary>
74334 </indexterm>
74335 <indexterm role="concept">
74336 <primary>ACL</primary>
74337 <secondary>spf_guess condition</secondary>
74338 </indexterm>
74339 <indexterm role="concept">
74340 <primary>SPF</primary>
74341 <secondary>best guess</secondary>
74342 </indexterm>
74343 In addition to SPF, you can also perform checks for so-called
74344 "Best-guess".  Strictly speaking, "Best-guess" is not standard
74345 SPF, but it is supported by the same framework that enables SPF
74346 capability.
74347 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>
74348 for a description of what it means.
74349 </para>
74350 <para>
74351 To access this feature, simply use the spf_guess condition in place
74352 of the spf one.  For example:
74353 </para>
74354 <literallayout class="monospaced">
74355 deny spf_guess = fail
74356      message = $sender_host_address doesn't look trustworthy to me
74357 </literallayout>
74358 <para>
74359 In case you decide to reject messages based on this check, you
74360 should note that although it uses the same framework, "Best-guess"
74361 is not SPF, and therefore you should not mention SPF at all in your
74362 reject message.
74363 </para>
74364 <para>
74365 When the spf_guess condition has run, it sets up the same expansion
74366 variables as when spf condition is run, described above.
74367 </para>
74368 <para>
74369 Additionally, since Best-guess is not standardized, you may redefine
74370 what "Best-guess" means to you by redefining the main configuration
74371 <option>spf_guess</option> option.
74372 For example, the following:
74373 </para>
74374 <literallayout class="monospaced">
74375 spf_guess = v=spf1 a/16 mx/16 ptr ?all
74376 </literallayout>
74377 <para>
74378 would relax host matching rules to a broader network range.
74379 </para>
74380 <para>
74381 <indexterm role="concept">
74382 <primary>SPF</primary>
74383 <secondary>lookup expansion</secondary>
74384 </indexterm>
74385 <indexterm role="concept">
74386 <primary>lookup</primary>
74387 <secondary>spf</secondary>
74388 </indexterm>
74389 A lookup expansion is also available. It takes an email
74390 address as the key and an IP address
74391 (v4 or v6)
74392 as the database:
74393 </para>
74394 <literallayout class="monospaced">
74395   ${lookup {username@domain} spf {ip.ip.ip.ip}}
74396 </literallayout>
74397 <para>
74398 The lookup will return the same result strings as can appear in
74399 <varname>$spf_result</varname> (pass,fail,softfail,neutral,none,err_perm,err_temp).
74400 </para>
74401 </section>
74402 <section id="SECDMARC">
74403 <title>DMARC</title>
74404 <para>
74405 <indexterm role="concept">
74406 <primary>DMARC</primary>
74407 <secondary>verification</secondary>
74408 </indexterm>
74409 </para>
74410 <para>
74411 DMARC combines feedback from SPF, DKIM, and header From: in order
74412 to attempt to provide better indicators of the authenticity of an
74413 email.  This document does not explain the fundamentals; you
74414 should read and understand how it works by visiting the website at
74415 <emphasis role="bold"><ulink url="http://www.dmarc.org/">http://www.dmarc.org/</ulink></emphasis>.
74416 </para>
74417 <para>
74418 If Exim is built with DMARC support,
74419 the libopendmarc library is used.
74420 </para>
74421 <para>
74422 For building Exim yourself, obtain the library from
74423 <emphasis role="bold"><ulink url="http://sourceforge.net/projects/opendmarc/">http://sourceforge.net/projects/opendmarc/</ulink></emphasis>
74424 to obtain a copy, or find it in your favorite package
74425 repository.  You will need to attend to the local/Makefile feature
74426 SUPPORT_DMARC and the associated LDFLAGS addition.
74427 This description assumes
74428 that headers will be in /usr/local/include, and that the libraries
74429 are in /usr/local/lib.
74430 </para>
74431 <para>
74432 There are three main-configuration options:
74433 <indexterm role="concept">
74434 <primary>DMARC</primary>
74435 <secondary>configuration options</secondary>
74436 </indexterm>
74437 </para>
74438 <para>
74439 The <option>dmarc_tld_file</option> option
74440 <indexterm role="option">
74441 <primary><option>dmarc_tld_file</option></primary>
74442 </indexterm>
74443 defines the location of a text file of valid
74444 top level domains the opendmarc library uses
74445 during domain parsing. Maintained by Mozilla,
74446 the most current version can be downloaded
74447 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>.
74448 See also the util/renew-opendmarc-tlds.sh script.
74449 </para>
74450 <para revisionflag="changed">
74451 The default for the option is unset.
74452 If not set, DMARC processing is disabled.
74453 </para>
74454 <para>
74455 The <option>dmarc_history_file</option> option, if set
74456 <indexterm role="option">
74457 <primary><option>dmarc_history_file</option></primary>
74458 </indexterm>
74459 defines the location of a file to log results
74460 of dmarc verification on inbound emails. The
74461 contents are importable by the opendmarc tools
74462 which will manage the data, send out DMARC
74463 reports, and expire the data. Make sure the
74464 directory of this file is writable by the user
74465 exim runs as.
74466 The default is unset.
74467 </para>
74468 <para>
74469 The <option>dmarc_forensic_sender</option> option
74470 <indexterm role="option">
74471 <primary><option>dmarc_forensic_sender</option></primary>
74472 </indexterm>
74473 defines an alternate email address to use when sending a
74474 forensic report detailing alignment failures
74475 if a sender domain&#x2019;s dmarc record specifies it
74476 and you have configured Exim to send them.
74477 If set, this is expanded and used for the
74478 From: header line; the address is extracted
74479 from it and used for the envelope from.
74480 If not set (the default), the From: header is expanded from
74481 the dsn_from option, and &lt;&gt; is used for the
74482 envelope from.
74483 </para>
74484 <para>
74485 <indexterm role="concept">
74486 <primary>DMARC</primary>
74487 <secondary>controls</secondary>
74488 </indexterm>
74489 By default, the DMARC processing will run for any remote,
74490 non-authenticated user.  It makes sense to only verify DMARC
74491 status of messages coming from remote, untrusted sources.  You can
74492 use standard conditions such as hosts, senders, etc, to decide that
74493 DMARC verification should *not* be performed for them and disable
74494 DMARC with an ACL control modifier:
74495 </para>
74496 <literallayout class="monospaced">
74497   control = dmarc_disable_verify
74498 </literallayout>
74499 <para>
74500 A DMARC record can also specify a "forensic address", which gives
74501 exim an email address to submit reports about failed alignment.
74502 Exim does not do this by default because in certain conditions it
74503 results in unintended information leakage (what lists a user might
74504 be subscribed to, etc).  You must configure exim to submit forensic
74505 reports to the owner of the domain.  If the DMARC record contains a
74506 forensic address and you specify the control statement below, then
74507 exim will send these forensic emails.  It is also advised that you
74508 configure a <option>dmarc_forensic_sender</option> because the default sender address
74509 construction might be inadequate.
74510 </para>
74511 <literallayout class="monospaced">
74512   control = dmarc_enable_forensic
74513 </literallayout>
74514 <para>
74515 (AGAIN: You can choose not to send these forensic reports by simply
74516 not putting the dmarc_enable_forensic control line at any point in
74517 your exim config.  If you don&#x2019;t tell exim to send them, it will not
74518 send them.)
74519 </para>
74520 <para>
74521 There are no options to either control.  Both must appear before
74522 the DATA acl.
74523 </para>
74524 <para>
74525 DMARC checks cam be run on incoming SMTP  messages by using the
74526 <quote>dmarc_status</quote> ACL condition in the DATA ACL.  You are required to
74527 call the <quote>spf</quote> condition first in the ACLs, then the <quote>dmarc_status</quote>
74528 condition.  Putting this condition in the ACLs is required in order
74529 for a DMARC check to actually occur.  All of the variables are set
74530 up before the DATA ACL, but there is no actual DMARC check that
74531 occurs until a <quote>dmarc_status</quote> condition is encountered in the ACLs.
74532 </para>
74533 <para>
74534 The <quote>dmarc_status</quote> condition takes a list of strings on its
74535 right-hand side.  These strings describe recommended action based
74536 on the DMARC check.  To understand what the policy recommendations
74537 mean, refer to the DMARC website above.  Valid strings are:
74538 </para>
74539 <literallayout>
74540 <emphasis>accept      </emphasis> The DMARC check passed and the library recommends accepting the email.
74541 <emphasis>reject      </emphasis> The DMARC check failed and the library recommends rejecting the email.
74542 <emphasis>quarantine  </emphasis> The DMARC check failed and the library recommends keeping it for further inspection.
74543 <emphasis>none        </emphasis> The DMARC check passed and the library recommends no specific action, neutral.
74544 <emphasis>norecord    </emphasis> No policy section in the DMARC record for this sender domain.
74545 <emphasis>nofrom      </emphasis> Unable to determine the domain of the sender.
74546 <emphasis>temperror   </emphasis> Library error or dns error.
74547 <emphasis>off         </emphasis> The DMARC check was disabled for this email.
74548 </literallayout>
74549 <para>
74550 You can prefix each string with an exclamation mark to invert its
74551 meaning, for example "!accept" will match all results but
74552 "accept".  The string list is evaluated left-to-right in a
74553 short-circuit fashion.  When a string matches the outcome of the
74554 DMARC check, the condition succeeds.  If none of the listed
74555 strings matches the outcome of the DMARC check, the condition
74556 fails.
74557 </para>
74558 <para>
74559 Of course, you can also use any other lookup method that Exim
74560 supports, including LDAP, Postgres, MySQL, etc, as long as the
74561 result is a list of colon-separated strings.
74562 </para>
74563 <para>
74564 Performing the check sets up information used by the
74565 <option>authresults</option> expansion item.
74566 </para>
74567 <para>
74568 Several expansion variables are set before the DATA ACL is
74569 processed, and you can use them in this ACL.  The following
74570 expansion variables are available:
74571 </para>
74572 <variablelist>
74573 <varlistentry>
74574 <term><varname>$dmarc_status</varname></term>
74575 <listitem>
74576 <para>
74577 <indexterm role="variable">
74578 <primary><varname>$dmarc_status</varname></primary>
74579 </indexterm>
74580 <indexterm role="concept">
74581 <primary>DMARC</primary>
74582 <secondary>result</secondary>
74583 </indexterm>
74584 A one word status indicating what the DMARC library
74585 thinks of the email.  It is a combination of the results of
74586 DMARC record lookup and the SPF/DKIM/DMARC processing results
74587 (if a DMARC record was found).  The actual policy declared
74588 in the DMARC record is in a separate expansion variable.
74589 </para>
74590 </listitem></varlistentry>
74591 <varlistentry>
74592 <term><varname>$dmarc_status_text</varname></term>
74593 <listitem>
74594 <para>
74595 <indexterm role="variable">
74596 <primary><varname>$dmarc_status_text</varname></primary>
74597 </indexterm>
74598 Slightly longer, human readable status.
74599 </para>
74600 </listitem></varlistentry>
74601 <varlistentry>
74602 <term><varname>$dmarc_used_domain</varname></term>
74603 <listitem>
74604 <para>
74605 <indexterm role="variable">
74606 <primary><varname>$dmarc_used_domain</varname></primary>
74607 </indexterm>
74608 The domain which DMARC used to look up the DMARC policy record.
74609 </para>
74610 </listitem></varlistentry>
74611 <varlistentry>
74612 <term><varname>$dmarc_domain_policy</varname></term>
74613 <listitem>
74614 <para>
74615 <indexterm role="variable">
74616 <primary><varname>$dmarc_domain_policy</varname></primary>
74617 </indexterm>
74618 The policy declared in the DMARC record.  Valid values
74619 are "none", "reject" and "quarantine".  It is blank when there
74620 is any error, including no DMARC record.
74621 </para>
74622 </listitem></varlistentry>
74623 </variablelist>
74624 <para>
74625 By default, Exim&#x2019;s DMARC configuration is intended to be
74626 non-intrusive and conservative.  To facilitate this, Exim will not
74627 create any type of logging files without explicit configuration by
74628 you, the admin.  Nor will Exim send out any emails/reports about
74629 DMARC issues without explicit configuration by you, the admin (other
74630 than typical bounce messages that may come about due to ACL
74631 processing or failure delivery issues).
74632 </para>
74633 <para>
74634 In order to log statistics suitable to be imported by the opendmarc
74635 tools, you need to:
74636 </para>
74637 <itemizedlist>
74638 <listitem>
74639 <para>
74640 Configure the global option <option>dmarc_history_file</option>
74641 </para>
74642 </listitem>
74643 <listitem>
74644 <para>
74645 Configure cron jobs to call the appropriate opendmarc history
74646 import scripts and truncating the dmarc_history_file
74647 </para>
74648 </listitem>
74649 </itemizedlist>
74650 <para>
74651 In order to send forensic reports, you need to:
74652 </para>
74653 <itemizedlist>
74654 <listitem>
74655 <para>
74656 Configure the global option <option>dmarc_forensic_sender</option>
74657 </para>
74658 </listitem>
74659 <listitem>
74660 <para>
74661 Configure, somewhere before the DATA ACL, the control option to
74662 enable sending DMARC forensic reports
74663 </para>
74664 </listitem>
74665 </itemizedlist>
74666 <para>
74667 Example usage:
74668 </para>
74669 <literallayout class="monospaced">
74670 (RCPT ACL)
74671   warn    domains        = +local_domains
74672           hosts          = +local_hosts
74673           control        = dmarc_disable_verify
74674
74675   warn    !domains       = +screwed_up_dmarc_records
74676           control        = dmarc_enable_forensic
74677
74678   warn    condition      = (lookup if destined to mailing list)
74679           set acl_m_mailing_list = 1
74680
74681 (DATA ACL)
74682   warn    dmarc_status   = accept : none : off
74683           !authenticated = *
74684           log_message    = DMARC DEBUG: $dmarc_status $dmarc_used_domain
74685
74686   warn    dmarc_status   = !accept
74687           !authenticated = *
74688           log_message    = DMARC DEBUG: '$dmarc_status' for $dmarc_used_domain
74689
74690   warn    dmarc_status   = quarantine
74691           !authenticated = *
74692           set $acl_m_quarantine = 1
74693           # Do something in a transport with this flag variable
74694
74695   deny    condition      = ${if eq{$dmarc_domain_policy}{reject}}
74696           condition      = ${if eq{$acl_m_mailing_list}{1}}
74697           message        = Messages from $dmarc_used_domain break mailing lists
74698
74699   deny    dmarc_status   = reject
74700           !authenticated = *
74701           message        = Message from $dmarc_used_domain failed sender's DMARC policy, REJECT
74702
74703   warn    add_header     = :at_start:${authresults {$primary_hostname}}
74704 </literallayout>
74705 </section>
74706 </chapter>
74707
74708 <chapter id="CHAPproxies">
74709 <title>Proxies</title>
74710 <titleabbrev>Proxy support</titleabbrev>
74711 <para>
74712 <indexterm role="concept">
74713 <primary>proxy support</primary>
74714 </indexterm>
74715 <indexterm role="concept">
74716 <primary>proxy</primary>
74717 <secondary>access via</secondary>
74718 </indexterm>
74719 </para>
74720 <para>
74721 A proxy is an intermediate system through which communication is passed.
74722 Proxies may provide a security, availability or load-distribution function.
74723 </para>
74724 <section id="SECTproxyInbound">
74725 <title>Inbound proxies</title>
74726 <para>
74727 <indexterm role="concept">
74728 <primary>proxy</primary>
74729 <secondary>inbound</secondary>
74730 </indexterm>
74731 <indexterm role="concept">
74732 <primary>proxy</primary>
74733 <secondary>server side</secondary>
74734 </indexterm>
74735 <indexterm role="concept">
74736 <primary>proxy</primary>
74737 <secondary>Proxy protocol</secondary>
74738 </indexterm>
74739 <indexterm role="concept">
74740 <primary>Proxy protocol</primary>
74741 <secondary>proxy</secondary>
74742 </indexterm>
74743 </para>
74744 <para>
74745 Exim has support for receiving inbound SMTP connections via a proxy
74746 that uses <quote>Proxy Protocol</quote> to speak to it.
74747 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
74748 in Local/Makefile.
74749 </para>
74750 <para>
74751 It was built on the HAProxy specification, found at
74752 <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>.
74753 </para>
74754 <para>
74755 The purpose of this facility is so that an application load balancer,
74756 such as HAProxy, can sit in front of several Exim servers
74757 to distribute load.
74758 Exim uses the local protocol communication with the proxy to obtain
74759 the remote SMTP system IP address and port information.
74760 There is no logging if a host passes or
74761 fails Proxy Protocol negotiation, but it can easily be determined and
74762 recorded in an ACL (example is below).
74763 </para>
74764 <para>
74765 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
74766 main configuration option to a hostlist; connections from these
74767 hosts will use Proxy Protocol.
74768 Exim supports both version 1 and version 2 of the Proxy Protocol and
74769 automatically determines which version is in use.
74770 </para>
74771 <para>
74772 The Proxy Protocol header is the first data received on a TCP connection
74773 and is inserted before any TLS-on-connect handshake from the client; Exim
74774 negotiates TLS between Exim-as-server and the remote client, not between
74775 Exim and the proxy server.
74776 </para>
74777 <para>
74778 The following expansion variables are usable
74779 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
74780 of the proxy):
74781 </para>
74782 <literallayout>
74783 <emphasis>proxy_external_address   </emphasis> IP of host being proxied or IP of remote interface of proxy
74784 <emphasis>proxy_external_port      </emphasis> Port of host being proxied or Port on remote interface of proxy
74785 <emphasis>proxy_local_address      </emphasis> IP of proxy server inbound or IP of local interface of proxy
74786 <emphasis>proxy_local_port         </emphasis> Port of proxy server inbound or Port on local interface of proxy
74787 <emphasis>proxy_session            </emphasis> boolean: SMTP connection via proxy
74788 </literallayout>
74789 <para>
74790 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
74791 there was a protocol error.
74792 The variables <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>
74793 will have values for the actual client system, not the proxy.
74794 </para>
74795 <para>
74796 Since the real connections are all coming from the proxy, and the
74797 per host connection tracking is done before Proxy Protocol is
74798 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
74799 handle all of the parallel volume you expect per inbound proxy.
74800 With the option set so high, you lose the ability
74801 to protect your server from many connections from one IP.
74802 In order to prevent your server from overload, you
74803 need to add a per connection ratelimit to your connect ACL.
74804 A possible solution is:
74805 </para>
74806 <literallayout>
74807   # Set max number of connections per host
74808   LIMIT   = 5
74809   # Or do some kind of IP lookup in a flat file or database
74810   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
74811
74812   defer   ratelimit      = LIMIT / 5s / per_conn / strict
74813           message        = Too many connections from this IP right now
74814 </literallayout>
74815 </section>
74816 <section id="SECTproxySOCKS">
74817 <title>Outbound proxies</title>
74818 <para>
74819 <indexterm role="concept">
74820 <primary>proxy</primary>
74821 <secondary>outbound</secondary>
74822 </indexterm>
74823 <indexterm role="concept">
74824 <primary>proxy</primary>
74825 <secondary>client side</secondary>
74826 </indexterm>
74827 <indexterm role="concept">
74828 <primary>proxy</primary>
74829 <secondary>SOCKS</secondary>
74830 </indexterm>
74831 <indexterm role="concept">
74832 <primary>SOCKS</primary>
74833 <secondary>proxy</secondary>
74834 </indexterm>
74835 Exim has support for sending outbound SMTP via a proxy
74836 using a protocol called SOCKS5 (defined by RFC1928).
74837 The support can be optionally included by defining SUPPORT_SOCKS=yes in
74838 Local/Makefile.
74839 </para>
74840 <para>
74841 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
74842 on an smtp transport.
74843 The option value is expanded and should then be a list
74844 (colon-separated by default) of proxy specifiers.
74845 Each proxy specifier is a list
74846 (space-separated by default) where the initial element
74847 is an IP address and any subsequent elements are options.
74848 </para>
74849 <para>
74850 Options are a string &lt;name&gt;=&lt;value&gt;.
74851 The list of options is in the following table:
74852 </para>
74853 <literallayout>
74854 <emphasis>auth   </emphasis> authentication method
74855 <emphasis>name   </emphasis> authentication username
74856 <emphasis>pass   </emphasis> authentication password
74857 <emphasis>port   </emphasis> tcp port
74858 <emphasis>tmo    </emphasis> connection timeout
74859 <emphasis>pri    </emphasis> priority
74860 <emphasis>weight </emphasis> selection bias
74861 </literallayout>
74862 <para>
74863 More details on each of these options follows:
74864 </para>
74865 <itemizedlist>
74866 <listitem>
74867 <para>
74868 <indexterm role="concept">
74869 <primary>authentication</primary>
74870 <secondary>to proxy</secondary>
74871 </indexterm>
74872 <indexterm role="concept">
74873 <primary>proxy</primary>
74874 <secondary>authentication</secondary>
74875 </indexterm>
74876 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
74877 Using <quote>name</quote> selects username/password authentication per RFC 1929
74878 for access to the proxy.
74879 Default is <quote>none</quote>.
74880 </para>
74881 </listitem>
74882 <listitem>
74883 <para>
74884 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
74885 Default is empty.
74886 </para>
74887 </listitem>
74888 <listitem>
74889 <para>
74890 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
74891 Default is empty.
74892 </para>
74893 </listitem>
74894 <listitem>
74895 <para>
74896 <option>port</option>: the TCP port number to use for the connection to the proxy.
74897 Default is 1080.
74898 </para>
74899 </listitem>
74900 <listitem>
74901 <para>
74902 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
74903 Default is 5.
74904 </para>
74905 </listitem>
74906 <listitem>
74907 <para>
74908 <option>pri</option>: specifies a priority for the proxy within the list,
74909 higher values being tried first.
74910 The default priority is 1.
74911 </para>
74912 </listitem>
74913 <listitem>
74914 <para>
74915 <option>weight</option>: specifies a selection bias.
74916 Within a priority set servers are queried in a random fashion,
74917 weighted by this value.
74918 The default value for selection bias is 1.
74919 </para>
74920 </listitem>
74921 </itemizedlist>
74922 <para>
74923 Proxies from the list are tried according to their priority
74924 and weight settings until one responds.  The timeout for the
74925 overall connection applies to the set of proxied attempts.
74926 </para>
74927 </section>
74928 <section id="SECTproxyLog">
74929 <title>Logging</title>
74930 <para>
74931 To log the (local) IP of a proxy in the incoming or delivery logline,
74932 add <quote>+proxy</quote> to the <option>log_selector</option> option.
74933 This will add a component tagged with <quote>PRX=</quote> to the line.
74934 </para>
74935 </section>
74936 </chapter>
74937
74938 <chapter id="CHAPi18n">
74939 <title>Internationalisation</title>
74940 <titleabbrev>Internationalisation"</titleabbrev>
74941 <para>
74942 <indexterm role="concept">
74943 <primary>internationalisation</primary>
74944 <secondary>email address</secondary>
74945 </indexterm>
74946 <indexterm role="concept">
74947 <primary>EAI</primary>
74948 </indexterm>
74949 <indexterm role="concept">
74950 <primary>i18n</primary>
74951 </indexterm>
74952 <indexterm role="concept">
74953 <primary>utf8</primary>
74954 <secondary>mail name handling</secondary>
74955 </indexterm>
74956 </para>
74957 <para>
74958 Exim has support for Internationalised mail names.
74959 To include this it must be built with SUPPORT_I18N and the libidn library.
74960 Standards supported are RFCs 2060, 5890, 6530 and 6533.
74961 </para>
74962 <para>
74963 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
74964 instead of it) then IDNA2008 is supported; this adds an extra library
74965 requirement, upon libidn2.
74966 </para>
74967 <section id="SECTi18nMTA">
74968 <title>MTA operations</title>
74969 <para>
74970 <indexterm role="concept">
74971 <primary>SMTPUTF8</primary>
74972 <secondary>ESMTP option</secondary>
74973 </indexterm>
74974 <indexterm role="concept">
74975 <primary>ESMTP extensions</primary>
74976 <secondary>SMTPUTF8</secondary>
74977 </indexterm>
74978 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
74979 a host list.  If this matches the sending host and
74980 accept_8bitmime is true (the default) then the ESMTP option
74981 SMTPUTF8 will be advertised.
74982 </para>
74983 <para>
74984 If the sender specifies the SMTPUTF8 option on a MAIL command
74985 international handling for the message is enabled and
74986 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
74987 </para>
74988 <para>
74989 The option <option>allow_utf8_domains</option> is set to true for this
74990 message. All DNS lookups are converted to a-label form
74991 whatever the setting of <option>allow_utf8_domains</option>
74992 when Exim is built with SUPPORT_I18N.
74993 </para>
74994 <para>
74995 Both localparts and domain are maintained as the original
74996 UTF-8 form internally; any comparison or regular-expression use will
74997 require appropriate care.  Filenames created, eg. by
74998 the appendfile transport, will have UTF-8 names.
74999 </para>
75000 <para>
75001 HELO names sent by the smtp transport will have any UTF-8
75002 components expanded to a-label form,
75003 and any certificate name checks will be done using the a-label
75004 form of the name.
75005 </para>
75006 <para>
75007 <indexterm role="concept">
75008 <primary>log</primary>
75009 <secondary>protocol</secondary>
75010 </indexterm>
75011 <indexterm role="concept">
75012 <primary>SMTPUTF8</primary>
75013 <secondary>logging</secondary>
75014 </indexterm>
75015 <indexterm role="concept">
75016 <primary>i18n</primary>
75017 <secondary>logging</secondary>
75018 </indexterm>
75019 Log lines and Received-by: header lines will acquire a "utf8"
75020 prefix on the protocol element, eg. utf8esmtp.
75021 </para>
75022 <para>
75023 The following expansion operators can be used:
75024 </para>
75025 <literallayout class="monospaced">
75026 ${utf8_domain_to_alabel:str}
75027 ${utf8_domain_from_alabel:str}
75028 ${utf8_localpart_to_alabel:str}
75029 ${utf8_localpart_from_alabel:str}
75030 </literallayout>
75031 <para>
75032 <indexterm role="concept">
75033 <primary>utf8</primary>
75034 <secondary>address downconversion</secondary>
75035 </indexterm>
75036 <indexterm role="concept">
75037 <primary>i18n</primary>
75038 <secondary>utf8 address downconversion</secondary>
75039 </indexterm>
75040 The RCPT ACL
75041 may use the following modifier:
75042 </para>
75043 <literallayout>
75044 control = utf8_downconvert
75045 control = utf8_downconvert/&lt;value&gt;
75046 </literallayout>
75047 <para>
75048 This sets a flag requiring that envelope addresses are converted to
75049 a-label form before smtp delivery.
75050 This is usually for use in a Message Submission Agent context,
75051 but could be used for any message.
75052 </para>
75053 <para>
75054 If a value is appended it may be:
75055 </para>
75056 <literallayout>
75057 <literal>1  </literal> mandatory downconversion
75058 <literal>0  </literal> no downconversion
75059 <literal>-1 </literal> if SMTPUTF8 not supported by destination host
75060 </literallayout>
75061 <para>
75062 If no value is given, 1 is used.
75063 </para>
75064 <para>
75065 If mua_wrapper is set, the utf8_downconvert control
75066 is initially set to -1.
75067 </para>
75068 <para>
75069 The smtp transport has an option <option>utf8_downconvert</option>.
75070 If set it must expand to one of the three values described above,
75071 or an empty string.
75072 If non-empty it overrides value previously set
75073 (due to mua_wrapper or by an ACL control).
75074 </para>
75075 <para>
75076 There is no explicit support for VRFY and EXPN.
75077 Configurations supporting these should inspect
75078 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
75079 </para>
75080 <para>
75081 There is no support for LMTP on Unix sockets.
75082 Using the "lmtp" protocol option on an smtp transport,
75083 for LMTP over TCP, should work as expected.
75084 </para>
75085 <para>
75086 There is no support for DSN unitext handling,
75087 and no provision for converting logging from or to UTF-8.
75088 </para>
75089 </section>
75090 <section id="SECTi18nMDA">
75091 <title>MDA operations</title>
75092 <para>
75093 To aid in constructing names suitable for IMAP folders
75094 the following expansion operator can be used:
75095 </para>
75096 <literallayout class="monospaced">
75097 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
75098 </literallayout>
75099 <para>
75100 The string is converted from the charset specified by
75101 the "headers charset" command (in a filter file)
75102 or <option>headers_charset</option> main configuration option (otherwise),
75103 to the
75104 modified UTF-7 encoding specified by RFC 2060,
75105 with the following exception: All occurrences of &lt;sep&gt;
75106 (which has to be a single character)
75107 are replaced with periods ("."), and all periods and slashes that are not
75108 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
75109 </para>
75110 <para>
75111 The third argument can be omitted, defaulting to an empty string.
75112 The second argument can be omitted, defaulting to "/".
75113 </para>
75114 <para>
75115 This is the encoding used by Courier for Maildir names on disk, and followed
75116 by many other IMAP servers.
75117 </para>
75118 <para>
75119 Examples:
75120 </para>
75121 <literallayout>
75122 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
75123 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
75124 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
75125 </literallayout>
75126 <para>
75127 Note that the source charset setting is vital, and also that characters
75128 must be representable in UTF-16.
75129 </para>
75130 </section>
75131 </chapter>
75132
75133 <chapter id="CHAPevents">
75134 <title>Events</title>
75135 <titleabbrev>Events</titleabbrev>
75136 <para>
75137 <indexterm role="concept">
75138 <primary>events</primary>
75139 </indexterm>
75140 </para>
75141 <para>
75142 The events mechanism in Exim can be used to intercept processing at a number
75143 of points.  It was originally invented to give a way to do customised logging
75144 actions (for example, to a database) but can also be used to modify some
75145 processing actions.
75146 </para>
75147 <para>
75148 Most installations will never need to use Events.
75149 The support can be left out of a build by defining DISABLE_EVENT=yes
75150 in <filename>Local/Makefile</filename>.
75151 </para>
75152 <para>
75153 There are two major classes of events: main and transport.
75154 The main configuration option <option>event_action</option> controls reception events;
75155 a transport option <option>event_action</option> controls delivery events.
75156 </para>
75157 <para>
75158 Both options are a string which is expanded when the event fires.
75159 An example might look like:
75160 <indexterm role="concept">
75161 <primary>logging</primary>
75162 <secondary>custom</secondary>
75163 </indexterm>
75164 </para>
75165 <literallayout class="monospaced">
75166 event_action = ${if eq {msg:delivery}{$event_name} \
75167 {${lookup pgsql {SELECT * FROM record_Delivery( \
75168     '${quote_pgsql:$sender_address_domain}',\
75169     '${quote_pgsql:${lc:$sender_address_local_part}}', \
75170     '${quote_pgsql:$domain}', \
75171     '${quote_pgsql:${lc:$local_part}}', \
75172     '${quote_pgsql:$host_address}', \
75173     '${quote_pgsql:${lc:$host}}', \
75174     '${quote_pgsql:$message_exim_id}')}} \
75175 } {}}
75176 </literallayout>
75177 <para>
75178 Events have names which correspond to the point in process at which they fire.
75179 The name is placed in the variable <varname>$event_name</varname> and the event action
75180 expansion must check this, as it will be called for every possible event type.
75181 </para>
75182 <para revisionflag="changed">
75183 The current list of events is:
75184 </para>
75185 <literallayout>
75186 <literal>dane:fail              after    transport  </literal> per connection
75187 <literal>msg:complete           after    main       </literal> per message
75188 <literal>msg:defer              after    transport  </literal> per message per delivery try
75189 <literal>msg:delivery           after    transport  </literal> per recipient
75190 <literal>msg:rcpt:host:defer    after    transport  </literal> per recipient per host
75191 <literal>msg:rcpt:defer         after    transport  </literal> per recipient
75192 <literal>msg:host:defer         after    transport  </literal> per host per delivery try; host errors
75193 <literal>msg:fail:delivery      after    transport  </literal> per recipient
75194 <literal>msg:fail:internal      after    main       </literal> per recipient
75195 <literal>tcp:connect            before   transport  </literal> per connection
75196 <literal>tcp:close              after    transport  </literal> per connection
75197 <literal>tls:cert               before   both       </literal> per certificate in verification chain
75198 <literal>smtp:connect           after    transport  </literal> per connection
75199 <literal>smtp:ehlo              after    transport  </literal> per connection
75200 </literallayout>
75201 <para>
75202 New event types may be added in future.
75203 </para>
75204 <para>
75205 The event name is a colon-separated list, defining the type of
75206 event in a tree of possibilities.  It may be used as a list
75207 or just matched on as a whole.  There will be no spaces in the name.
75208 </para>
75209 <para>
75210 The second column in the table above describes whether the event fires
75211 before or after the action is associates with.  Those which fire before
75212 can be used to affect that action (more on this below).
75213 </para>
75214 <para>
75215 The third column in the table above says what section of the configuration
75216 should define the event action.
75217 </para>
75218 <para>
75219 An additional variable, <varname>$event_data</varname>, is filled with information varying
75220 with the event type:
75221 </para>
75222 <literallayout>
75223 <literal>dane:fail            </literal> failure reason
75224 <literal>msg:defer            </literal> error string
75225 <literal>msg:delivery         </literal> smtp confirmation message
75226 <literal>msg:fail:internal    </literal> failure reason
75227 <literal>msg:fail:delivery    </literal> smtp error message
75228 <literal>msg:host:defer       </literal> error string
75229 <literal>msg:rcpt:host:defer  </literal> error string
75230 <literal>msg:rcpt:defer       </literal> error string
75231 <literal>tls:cert             </literal> verification chain depth
75232 <literal>smtp:connect         </literal> smtp banner
75233 <literal>smtp:ehlo            </literal> smtp ehlo response
75234 </literallayout>
75235 <para>
75236 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
75237 </para>
75238 <para>
75239 For complex operations an ACL expansion can be used in <option>event_action</option>
75240 however due to the multiple contexts that Exim operates in during
75241 the course of its processing:
75242 </para>
75243 <itemizedlist>
75244 <listitem>
75245 <para>
75246 variables set in transport events will not be visible outside that
75247 transport call
75248 </para>
75249 </listitem>
75250 <listitem>
75251 <para>
75252 acl_m variables in a server context are lost on a new connection,
75253 and after smtp helo/ehlo/mail/starttls/rset commands
75254 </para>
75255 </listitem>
75256 </itemizedlist>
75257 <para>
75258 Using an ACL expansion with the logwrite modifier can be
75259 a useful way of writing to the main log.
75260 </para>
75261 <para>
75262 The expansion of the event_action option should normally
75263 return an empty string.  Should it return anything else the
75264 following will be forced:
75265 </para>
75266 <literallayout>
75267 <literal>tcp:connect      </literal>  do not connect
75268 <literal>tls:cert         </literal>  refuse verification
75269 <literal>smtp:connect     </literal>  close connection
75270 </literallayout>
75271 <para>
75272 All other message types ignore the result string, and
75273 no other use is made of it.
75274 </para>
75275 <para>
75276 For a tcp:connect event, if the connection is being made to a proxy
75277 then the address and port variables will be that of the proxy and not
75278 the target system.
75279 </para>
75280 <para>
75281 For tls:cert events, if GnuTLS is in use this will trigger only per
75282 chain element received on the connection.
75283 For OpenSSL it will trigger for every chain element including those
75284 loaded locally.
75285 </para>
75286 </chapter>
75287
75288 <chapter id="CHID13">
75289 <title>Adding new drivers or lookup types</title>
75290 <titleabbrev>Adding drivers or lookups</titleabbrev>
75291 <para>
75292 <indexterm role="concept">
75293 <primary>adding drivers</primary>
75294 </indexterm>
75295 <indexterm role="concept">
75296 <primary>new drivers, adding</primary>
75297 </indexterm>
75298 <indexterm role="concept">
75299 <primary>drivers</primary>
75300 <secondary>adding new</secondary>
75301 </indexterm>
75302 The following actions have to be taken in order to add a new router, transport,
75303 authenticator, or lookup type to Exim:
75304 </para>
75305 <orderedlist numeration="arabic">
75306 <listitem>
75307 <para>
75308 Choose a name for the driver or lookup type that does not conflict with any
75309 existing name; I will use <quote>newdriver</quote> in what follows.
75310 </para>
75311 </listitem>
75312 <listitem>
75313 <para>
75314 Add to <filename>src/EDITME</filename> the line:
75315 </para>
75316 <literallayout>
75317 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
75318 </literallayout>
75319 <para>
75320 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
75321 code is not to be included in the binary by default, comment this line out. You
75322 should also add any relevant comments about the driver or lookup type.
75323 </para>
75324 </listitem>
75325 <listitem>
75326 <para>
75327 Add to <filename>src/config.h.defaults</filename> the line:
75328 </para>
75329 <literallayout class="monospaced">
75330 #define &lt;type&gt;_NEWDRIVER
75331 </literallayout>
75332 </listitem>
75333 <listitem>
75334 <para>
75335 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
75336 and create a table entry as is done for all the other drivers and lookup types.
75337 </para>
75338 </listitem>
75339 <listitem>
75340 <para>
75341 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
75342 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
75343 Add your <literal>NEWDRIVER</literal> to that list.
75344 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
75345 simple form that most lookups have.
75346 </para>
75347 </listitem>
75348 <listitem>
75349 <para>
75350 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
75351 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
75352 driver or lookup type and add it to the definition of OBJ.
75353 </para>
75354 </listitem>
75355 <listitem>
75356 <para>
75357 Edit <filename>OS/Makefile-Base</filename> adding a <filename>.o</filename> file for the predefined-macros, to the
75358 definition of OBJ_MACRO.  Add a set of line to do the compile also.
75359 </para>
75360 </listitem>
75361 <listitem>
75362 <para>
75363 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
75364 <filename>src</filename>.
75365 </para>
75366 </listitem>
75367 <listitem>
75368 <para>
75369 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
75370 as for other drivers and lookups.
75371 </para>
75372 </listitem>
75373 </orderedlist>
75374 <para>
75375 Then all you need to do is write the code! A good way to start is to make a
75376 proforma by copying an existing module of the same type, globally changing all
75377 occurrences of the name, and cutting out most of the code. Note that any
75378 options you create must be listed in alphabetical order, because the tables are
75379 searched using a binary chop procedure.
75380 </para>
75381 <para>
75382 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
75383 the interface that is expected.
75384 </para>
75385 <?sdop
75386   format="newpage"
75387   foot_right_recto="&chaptertitle;"
75388   foot_right_verso="&chaptertitle;"
75389 ?>
75390 </chapter>
75391
75392 <index role="option">
75393 <title>Options index</title>
75394 </index>
75395
75396 <index role="variable">
75397 <title>Variables index</title>
75398 </index>
75399
75400 <index role="concept">
75401 <title>Concept index</title>
75402 </index>
75403
75404 </book>